@@ -274,6 +274,7 @@ static irqreturn_t pm8001_interrupt_handler_intx(int irq, void *dev_id)
274
274
}
275
275
276
276
static u32 pm8001_request_irq (struct pm8001_hba_info * pm8001_ha );
277
+ static void pm8001_free_irq (struct pm8001_hba_info * pm8001_ha );
277
278
278
279
/**
279
280
* pm8001_alloc - initiate our hba structure and 6 DMAs area.
@@ -1057,6 +1058,24 @@ static u32 pm8001_request_irq(struct pm8001_hba_info *pm8001_ha)
1057
1058
SHOST_TO_SAS_HA (pm8001_ha -> shost ));
1058
1059
}
1059
1060
1061
+ static void pm8001_free_irq (struct pm8001_hba_info * pm8001_ha )
1062
+ {
1063
+ #ifdef PM8001_USE_MSIX
1064
+ struct pci_dev * pdev = pm8001_ha -> pdev ;
1065
+ int i ;
1066
+
1067
+ for (i = 0 ; i < pm8001_ha -> number_of_intr ; i ++ )
1068
+ synchronize_irq (pci_irq_vector (pdev , i ));
1069
+
1070
+ for (i = 0 ; i < pm8001_ha -> number_of_intr ; i ++ )
1071
+ free_irq (pci_irq_vector (pdev , i ), & pm8001_ha -> irq_vector [i ]);
1072
+
1073
+ pci_free_irq_vectors (pdev );
1074
+ #else
1075
+ free_irq (pm8001_ha -> irq , pm8001_ha -> sas );
1076
+ #endif
1077
+ }
1078
+
1060
1079
/**
1061
1080
* pm8001_pci_probe - probe supported device
1062
1081
* @pdev: pci device which kernel has been prepared for.
@@ -1252,24 +1271,17 @@ static int pm8001_init_ccb_tag(struct pm8001_hba_info *pm8001_ha)
1252
1271
static void pm8001_pci_remove (struct pci_dev * pdev )
1253
1272
{
1254
1273
struct sas_ha_struct * sha = pci_get_drvdata (pdev );
1255
- struct pm8001_hba_info * pm8001_ha ;
1274
+ struct pm8001_hba_info * pm8001_ha = sha -> lldd_ha ;
1256
1275
int i , j ;
1257
- pm8001_ha = sha -> lldd_ha ;
1276
+
1258
1277
sas_unregister_ha (sha );
1259
1278
sas_remove_host (pm8001_ha -> shost );
1260
1279
list_del (& pm8001_ha -> list );
1261
1280
PM8001_CHIP_DISP -> interrupt_disable (pm8001_ha , 0xFF );
1262
1281
PM8001_CHIP_DISP -> chip_soft_rst (pm8001_ha );
1263
1282
1264
- #ifdef PM8001_USE_MSIX
1265
- for (i = 0 ; i < pm8001_ha -> number_of_intr ; i ++ )
1266
- synchronize_irq (pci_irq_vector (pdev , i ));
1267
- for (i = 0 ; i < pm8001_ha -> number_of_intr ; i ++ )
1268
- free_irq (pci_irq_vector (pdev , i ), & pm8001_ha -> irq_vector [i ]);
1269
- pci_free_irq_vectors (pdev );
1270
- #else
1271
- free_irq (pm8001_ha -> irq , sha );
1272
- #endif
1283
+ pm8001_free_irq (pm8001_ha );
1284
+
1273
1285
#ifdef PM8001_USE_TASKLET
1274
1286
/* For non-msix and msix interrupts */
1275
1287
if ((!pdev -> msix_cap || !pci_msi_enabled ()) ||
@@ -1309,7 +1321,8 @@ static int __maybe_unused pm8001_pci_suspend(struct device *dev)
1309
1321
struct pci_dev * pdev = to_pci_dev (dev );
1310
1322
struct sas_ha_struct * sha = pci_get_drvdata (pdev );
1311
1323
struct pm8001_hba_info * pm8001_ha = sha -> lldd_ha ;
1312
- int i , j ;
1324
+ int j ;
1325
+
1313
1326
sas_suspend_ha (sha );
1314
1327
flush_workqueue (pm8001_wq );
1315
1328
scsi_block_requests (pm8001_ha -> shost );
@@ -1319,15 +1332,9 @@ static int __maybe_unused pm8001_pci_suspend(struct device *dev)
1319
1332
}
1320
1333
PM8001_CHIP_DISP -> interrupt_disable (pm8001_ha , 0xFF );
1321
1334
PM8001_CHIP_DISP -> chip_soft_rst (pm8001_ha );
1322
- #ifdef PM8001_USE_MSIX
1323
- for (i = 0 ; i < pm8001_ha -> number_of_intr ; i ++ )
1324
- synchronize_irq (pci_irq_vector (pdev , i ));
1325
- for (i = 0 ; i < pm8001_ha -> number_of_intr ; i ++ )
1326
- free_irq (pci_irq_vector (pdev , i ), & pm8001_ha -> irq_vector [i ]);
1327
- pci_free_irq_vectors (pdev );
1328
- #else
1329
- free_irq (pm8001_ha -> irq , sha );
1330
- #endif
1335
+
1336
+ pm8001_free_irq (pm8001_ha );
1337
+
1331
1338
#ifdef PM8001_USE_TASKLET
1332
1339
/* For non-msix and msix interrupts */
1333
1340
if ((!pdev -> msix_cap || !pci_msi_enabled ()) ||
0 commit comments