Skip to content

Commit d6f2f6c

Browse files
damien-lemoalmartinkpetersen
authored andcommitted
scsi: pm8001: Simplify pm8001_chip_interrupt_enable/disable()
pm8001_chip_msix_interrupt_enable() and pm8001_chip_msix_interrupt_disable() are always cold with the vector argument equal to 0. This allows simplifying the code for these functions. With this change, the functions are simple enough and can be removed by open coding them directly in pm8001_chip_interrupt_enable() and pm8001_chip_interrupt_disable(). Also do the same for the functions pm8001_chip_intx_interrupt_enable() and pm8001_chip_intx_interrupt_disable() and remove these functions. 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 07ca8c1 commit d6f2f6c

File tree

1 file changed

+6
-63
lines changed

1 file changed

+6
-63
lines changed

drivers/scsi/pm8001/pm8001_hwi.c

Lines changed: 6 additions & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -1180,65 +1180,6 @@ void pm8001_chip_iounmap(struct pm8001_hba_info *pm8001_ha)
11801180
}
11811181
}
11821182

1183-
#ifndef PM8001_USE_MSIX
1184-
/**
1185-
* pm8001_chip_intx_interrupt_enable - enable PM8001 chip interrupt
1186-
* @pm8001_ha: our hba card information
1187-
*/
1188-
static void
1189-
pm8001_chip_intx_interrupt_enable(struct pm8001_hba_info *pm8001_ha)
1190-
{
1191-
pm8001_cw32(pm8001_ha, 0, MSGU_ODMR, ODMR_CLEAR_ALL);
1192-
pm8001_cw32(pm8001_ha, 0, MSGU_ODCR, ODCR_CLEAR_ALL);
1193-
}
1194-
1195-
/**
1196-
* pm8001_chip_intx_interrupt_disable - disable PM8001 chip interrupt
1197-
* @pm8001_ha: our hba card information
1198-
*/
1199-
static void
1200-
pm8001_chip_intx_interrupt_disable(struct pm8001_hba_info *pm8001_ha)
1201-
{
1202-
pm8001_cw32(pm8001_ha, 0, MSGU_ODMR, ODMR_MASK_ALL);
1203-
}
1204-
1205-
#else
1206-
1207-
/**
1208-
* pm8001_chip_msix_interrupt_enable - enable PM8001 chip interrupt
1209-
* @pm8001_ha: our hba card information
1210-
* @int_vec_idx: interrupt number to enable
1211-
*/
1212-
static void
1213-
pm8001_chip_msix_interrupt_enable(struct pm8001_hba_info *pm8001_ha,
1214-
u32 int_vec_idx)
1215-
{
1216-
u32 msi_index;
1217-
u32 value;
1218-
msi_index = int_vec_idx * MSIX_TABLE_ELEMENT_SIZE;
1219-
msi_index += MSIX_TABLE_BASE;
1220-
pm8001_cw32(pm8001_ha, 0, msi_index, MSIX_INTERRUPT_ENABLE);
1221-
value = (1 << int_vec_idx);
1222-
pm8001_cw32(pm8001_ha, 0, MSGU_ODCR, value);
1223-
1224-
}
1225-
1226-
/**
1227-
* pm8001_chip_msix_interrupt_disable - disable PM8001 chip interrupt
1228-
* @pm8001_ha: our hba card information
1229-
* @int_vec_idx: interrupt number to disable
1230-
*/
1231-
static void
1232-
pm8001_chip_msix_interrupt_disable(struct pm8001_hba_info *pm8001_ha,
1233-
u32 int_vec_idx)
1234-
{
1235-
u32 msi_index;
1236-
msi_index = int_vec_idx * MSIX_TABLE_ELEMENT_SIZE;
1237-
msi_index += MSIX_TABLE_BASE;
1238-
pm8001_cw32(pm8001_ha, 0, msi_index, MSIX_INTERRUPT_DISABLE);
1239-
}
1240-
#endif
1241-
12421183
/**
12431184
* pm8001_chip_interrupt_enable - enable PM8001 chip interrupt
12441185
* @pm8001_ha: our hba card information
@@ -1248,9 +1189,11 @@ static void
12481189
pm8001_chip_interrupt_enable(struct pm8001_hba_info *pm8001_ha, u8 vec)
12491190
{
12501191
#ifdef PM8001_USE_MSIX
1251-
pm8001_chip_msix_interrupt_enable(pm8001_ha, 0);
1192+
pm8001_cw32(pm8001_ha, 0, MSIX_TABLE_BASE, MSIX_INTERRUPT_ENABLE);
1193+
pm8001_cw32(pm8001_ha, 0, MSGU_ODCR, 1);
12521194
#else
1253-
pm8001_chip_intx_interrupt_enable(pm8001_ha);
1195+
pm8001_cw32(pm8001_ha, 0, MSGU_ODMR, ODMR_CLEAR_ALL);
1196+
pm8001_cw32(pm8001_ha, 0, MSGU_ODCR, ODCR_CLEAR_ALL);
12541197
#endif
12551198
}
12561199

@@ -1263,9 +1206,9 @@ static void
12631206
pm8001_chip_interrupt_disable(struct pm8001_hba_info *pm8001_ha, u8 vec)
12641207
{
12651208
#ifdef PM8001_USE_MSIX
1266-
pm8001_chip_msix_interrupt_disable(pm8001_ha, 0);
1209+
pm8001_cw32(pm8001_ha, 0, MSIX_TABLE_BASE, MSIX_INTERRUPT_DISABLE);
12671210
#else
1268-
pm8001_chip_intx_interrupt_disable(pm8001_ha);
1211+
pm8001_cw32(pm8001_ha, 0, MSGU_ODMR, ODMR_MASK_ALL);
12691212
#endif
12701213
}
12711214

0 commit comments

Comments
 (0)