Skip to content

Commit 2054302

Browse files
damien-lemoalmartinkpetersen
authored andcommitted
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: Damien Le Moal <[email protected]> Link: https://lore.kernel.org/r/[email protected] Acked-by: Jack Wang <[email protected]> Signed-off-by: Martin K. Petersen <[email protected]>
1 parent efa1fca commit 2054302

File tree

2 files changed

+21
-22
lines changed

2 files changed

+21
-22
lines changed

drivers/scsi/pm8001/pm8001_init.c

Lines changed: 21 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,10 @@ bool pm8001_use_msix = true;
6060
module_param_named(use_msix, pm8001_use_msix, bool, 0444);
6161
MODULE_PARM_DESC(zoned, "Use MSIX interrupts. Default: true");
6262

63+
static bool pm8001_use_tasklet = true;
64+
module_param_named(use_tasklet, pm8001_use_tasklet, bool, 0444);
65+
MODULE_PARM_DESC(zoned, "Use MSIX interrupts. Default: true");
66+
6367
static struct scsi_transport_template *pm8001_stt;
6468
static int pm8001_init_ccb_tag(struct pm8001_hba_info *);
6569

@@ -204,29 +208,29 @@ static void pm8001_free(struct pm8001_hba_info *pm8001_ha)
204208
kfree(pm8001_ha);
205209
}
206210

207-
#ifdef PM8001_USE_TASKLET
208-
209211
/**
210212
* pm8001_tasklet() - tasklet for 64 msi-x interrupt handler
211213
* @opaque: the passed general host adapter struct
212214
* Note: pm8001_tasklet is common for pm8001 & pm80xx
213215
*/
214216
static void pm8001_tasklet(unsigned long opaque)
215217
{
216-
struct pm8001_hba_info *pm8001_ha;
217-
struct isr_param *irq_vector;
218+
struct isr_param *irq_vector = (struct isr_param *)opaque;
219+
struct pm8001_hba_info *pm8001_ha = irq_vector->drv_inst;
220+
221+
if (WARN_ON_ONCE(!pm8001_ha))
222+
return;
218223

219-
irq_vector = (struct isr_param *)opaque;
220-
pm8001_ha = irq_vector->drv_inst;
221-
if (unlikely(!pm8001_ha))
222-
BUG_ON(1);
223224
PM8001_CHIP_DISP->isr(pm8001_ha, irq_vector->irq_id);
224225
}
225226

226227
static void pm8001_init_tasklet(struct pm8001_hba_info *pm8001_ha)
227228
{
228229
int i;
229230

231+
if (!pm8001_use_tasklet)
232+
return;
233+
230234
/* Tasklet for non msi-x interrupt handler */
231235
if ((!pm8001_ha->pdev->msix_cap || !pci_msi_enabled()) ||
232236
(pm8001_ha->chip_id == chip_8001)) {
@@ -243,6 +247,9 @@ static void pm8001_kill_tasklet(struct pm8001_hba_info *pm8001_ha)
243247
{
244248
int i;
245249

250+
if (!pm8001_use_tasklet)
251+
return;
252+
246253
/* For non-msix and msix interrupts */
247254
if ((!pm8001_ha->pdev->msix_cap || !pci_msi_enabled()) ||
248255
(pm8001_ha->chip_id == chip_8001)) {
@@ -254,13 +261,6 @@ static void pm8001_kill_tasklet(struct pm8001_hba_info *pm8001_ha)
254261
tasklet_kill(&pm8001_ha->tasklet[i]);
255262
}
256263

257-
#else
258-
259-
static void pm8001_init_tasklet(struct pm8001_hba_info *pm8001_ha) {}
260-
static void pm8001_kill_tasklet(struct pm8001_hba_info *pm8001_ha) {}
261-
262-
#endif
263-
264264
static irqreturn_t pm8001_handle_irq(struct pm8001_hba_info *pm8001_ha,
265265
int irq)
266266
{
@@ -270,12 +270,11 @@ static irqreturn_t pm8001_handle_irq(struct pm8001_hba_info *pm8001_ha,
270270
if (!PM8001_CHIP_DISP->is_our_interrupt(pm8001_ha))
271271
return IRQ_NONE;
272272

273-
#ifdef PM8001_USE_TASKLET
273+
if (!pm8001_use_tasklet)
274+
return PM8001_CHIP_DISP->isr(pm8001_ha, irq);
275+
274276
tasklet_schedule(&pm8001_ha->tasklet[irq]);
275277
return IRQ_HANDLED;
276-
#else
277-
return PM8001_CHIP_DISP->isr(pm8001_ha, irq);
278-
#endif
279278
}
280279

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

1540+
if (pm8001_use_tasklet && !pm8001_use_msix)
1541+
pm8001_use_tasklet = false;
1542+
15411543
pm8001_wq = alloc_workqueue("pm80xx", 0, 0);
15421544
if (!pm8001_wq)
15431545
goto err;

drivers/scsi/pm8001/pm8001_sas.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,6 @@ do { \
8585

8686
extern bool pm8001_use_msix;
8787

88-
#define PM8001_USE_TASKLET
8988
#define PM8001_READ_VPD
9089

9190

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

0 commit comments

Comments
 (0)