Commit 20543029 authored by Damien Le Moal's avatar Damien Le Moal Committed by Martin K. Petersen
Browse files

scsi: pm8001: Remove PM8001_USE_TASKLET



Remove the macro PM8001_USE_TASKLET used to conditionally use tasklets for
MSI-X interrupts handling and replace it with the boolean module parameter
pm8001_use_tasklet. This parameter defaults to true and can be true only if
pm8001_use_msix is also true.

Code conditionnaly defined with PM8001_USE_TASKLET is modified to instead
use the parameter pm8001_use_tasklet.

Signed-off-by: default avatarDamien Le Moal <dlemoal@kernel.org>
Link: https://lore.kernel.org/r/20230911232745.325149-10-dlemoal@kernel.org


Acked-by: default avatarJack Wang <jinpu.wang@ionos.com>
Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
parent efa1fca4
Loading
Loading
Loading
Loading
+21 −19
Original line number Diff line number Diff line
@@ -60,6 +60,10 @@ bool pm8001_use_msix = true;
module_param_named(use_msix, pm8001_use_msix, bool, 0444);
MODULE_PARM_DESC(zoned, "Use MSIX interrupts. Default: true");

static bool pm8001_use_tasklet = true;
module_param_named(use_tasklet, pm8001_use_tasklet, bool, 0444);
MODULE_PARM_DESC(zoned, "Use MSIX interrupts. Default: true");

static struct scsi_transport_template *pm8001_stt;
static int pm8001_init_ccb_tag(struct pm8001_hba_info *);

@@ -204,8 +208,6 @@ static void pm8001_free(struct pm8001_hba_info *pm8001_ha)
	kfree(pm8001_ha);
}

#ifdef PM8001_USE_TASKLET

/**
 * pm8001_tasklet() - tasklet for 64 msi-x interrupt handler
 * @opaque: the passed general host adapter struct
@@ -213,13 +215,12 @@ static void pm8001_free(struct pm8001_hba_info *pm8001_ha)
 */
static void pm8001_tasklet(unsigned long opaque)
{
	struct pm8001_hba_info *pm8001_ha;
	struct isr_param *irq_vector;
	struct isr_param *irq_vector = (struct isr_param *)opaque;
	struct pm8001_hba_info *pm8001_ha = irq_vector->drv_inst;

	if (WARN_ON_ONCE(!pm8001_ha))
		return;

	irq_vector = (struct isr_param *)opaque;
	pm8001_ha = irq_vector->drv_inst;
	if (unlikely(!pm8001_ha))
		BUG_ON(1);
	PM8001_CHIP_DISP->isr(pm8001_ha, irq_vector->irq_id);
}

@@ -227,6 +228,9 @@ static void pm8001_init_tasklet(struct pm8001_hba_info *pm8001_ha)
{
	int i;

	if (!pm8001_use_tasklet)
		return;

	/*  Tasklet for non msi-x interrupt handler */
	if ((!pm8001_ha->pdev->msix_cap || !pci_msi_enabled()) ||
	    (pm8001_ha->chip_id == chip_8001)) {
@@ -243,6 +247,9 @@ static void pm8001_kill_tasklet(struct pm8001_hba_info *pm8001_ha)
{
	int i;

	if (!pm8001_use_tasklet)
		return;

	/* For non-msix and msix interrupts */
	if ((!pm8001_ha->pdev->msix_cap || !pci_msi_enabled()) ||
	    (pm8001_ha->chip_id == chip_8001)) {
@@ -254,13 +261,6 @@ static void pm8001_kill_tasklet(struct pm8001_hba_info *pm8001_ha)
		tasklet_kill(&pm8001_ha->tasklet[i]);
}

#else

static void pm8001_init_tasklet(struct pm8001_hba_info *pm8001_ha) {}
static void pm8001_kill_tasklet(struct pm8001_hba_info *pm8001_ha) {}

#endif

static irqreturn_t pm8001_handle_irq(struct pm8001_hba_info *pm8001_ha,
				     int irq)
{
@@ -270,12 +270,11 @@ static irqreturn_t pm8001_handle_irq(struct pm8001_hba_info *pm8001_ha,
	if (!PM8001_CHIP_DISP->is_our_interrupt(pm8001_ha))
		return IRQ_NONE;

#ifdef PM8001_USE_TASKLET
	if (!pm8001_use_tasklet)
		return PM8001_CHIP_DISP->isr(pm8001_ha, irq);

	tasklet_schedule(&pm8001_ha->tasklet[irq]);
	return IRQ_HANDLED;
#else
	return PM8001_CHIP_DISP->isr(pm8001_ha, irq);
#endif
}

/**
@@ -1538,6 +1537,9 @@ static int __init pm8001_init(void)
{
	int rc = -ENOMEM;

	if (pm8001_use_tasklet && !pm8001_use_msix)
		pm8001_use_tasklet = false;

	pm8001_wq = alloc_workqueue("pm80xx", 0, 0);
	if (!pm8001_wq)
		goto err;
+0 −3
Original line number Diff line number Diff line
@@ -85,7 +85,6 @@ do { \

extern bool pm8001_use_msix;

#define PM8001_USE_TASKLET
#define PM8001_READ_VPD


@@ -526,9 +525,7 @@ struct pm8001_hba_info {
	int			number_of_intr;/*will be used in remove()*/
	char			intr_drvname[PM8001_MAX_MSIX_VEC]
				[PM8001_NAME_LENGTH+1+3+1];
#ifdef PM8001_USE_TASKLET
	struct tasklet_struct	tasklet[PM8001_MAX_MSIX_VEC];
#endif
	u32			logging_level;
	u32			link_rate;
	u32			fw_status;