2019-03-28 23:44:26

by Colin King

[permalink] [raw]
Subject: [PATCH] scsi: pm8001: clean up structurally dead code when PM8001_USE_MSIX is defined

From: Colin Ian King <[email protected]>

When macro PM8001_USE_MSIX is defined there are redundant dead code
calls to pm8001_chip_intx_interrupt_{enable|disable}. Clean this up
by compiling in the appropriate enable/disable handlers for the
defined PM8001_USE_MSIX and undefined PM8001_USE_MSIX cases.

Signed-off-by: Colin Ian King <[email protected]>
---
drivers/scsi/pm8001/pm8001_hwi.c | 14 ++++++++------
1 file changed, 8 insertions(+), 6 deletions(-)

diff --git a/drivers/scsi/pm8001/pm8001_hwi.c b/drivers/scsi/pm8001/pm8001_hwi.c
index e4209091c1da..7d81246a432b 100644
--- a/drivers/scsi/pm8001/pm8001_hwi.c
+++ b/drivers/scsi/pm8001/pm8001_hwi.c
@@ -1204,6 +1204,7 @@ void pm8001_chip_iounmap(struct pm8001_hba_info *pm8001_ha)
}
}

+#ifndef PM8001_USE_MSIX
/**
* pm8001_chip_interrupt_enable - enable PM8001 chip interrupt
* @pm8001_ha: our hba card information
@@ -1225,6 +1226,8 @@ pm8001_chip_intx_interrupt_disable(struct pm8001_hba_info *pm8001_ha)
pm8001_cw32(pm8001_ha, 0, MSGU_ODMR, ODMR_MASK_ALL);
}

+#else
+
/**
* pm8001_chip_msix_interrupt_enable - enable PM8001 chip interrupt
* @pm8001_ha: our hba card information
@@ -1256,6 +1259,7 @@ pm8001_chip_msix_interrupt_disable(struct pm8001_hba_info *pm8001_ha,
msi_index += MSIX_TABLE_BASE;
pm8001_cw32(pm8001_ha, 0, msi_index, MSIX_INTERRUPT_DISABLE);
}
+#endif

/**
* pm8001_chip_interrupt_enable - enable PM8001 chip interrupt
@@ -1266,10 +1270,9 @@ pm8001_chip_interrupt_enable(struct pm8001_hba_info *pm8001_ha, u8 vec)
{
#ifdef PM8001_USE_MSIX
pm8001_chip_msix_interrupt_enable(pm8001_ha, 0);
- return;
-#endif
+#else
pm8001_chip_intx_interrupt_enable(pm8001_ha);
-
+#endif
}

/**
@@ -1281,10 +1284,9 @@ pm8001_chip_interrupt_disable(struct pm8001_hba_info *pm8001_ha, u8 vec)
{
#ifdef PM8001_USE_MSIX
pm8001_chip_msix_interrupt_disable(pm8001_ha, 0);
- return;
-#endif
+#else
pm8001_chip_intx_interrupt_disable(pm8001_ha);
-
+#endif
}

/**
--
2.20.1



2019-03-29 08:18:07

by Jinpu Wang

[permalink] [raw]
Subject: Re: [PATCH] scsi: pm8001: clean up structurally dead code when PM8001_USE_MSIX is defined

On Fri, Mar 29, 2019 at 12:43 AM Colin King <[email protected]> wrote:
>
> From: Colin Ian King <[email protected]>
>
> When macro PM8001_USE_MSIX is defined there are redundant dead code
> calls to pm8001_chip_intx_interrupt_{enable|disable}. Clean this up
> by compiling in the appropriate enable/disable handlers for the
> defined PM8001_USE_MSIX and undefined PM8001_USE_MSIX cases.
>
> Signed-off-by: Colin Ian King <[email protected]>
Thanks, Colin,
Acked-by: Jack Wang <[email protected]>
> ---
> drivers/scsi/pm8001/pm8001_hwi.c | 14 ++++++++------
> 1 file changed, 8 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/scsi/pm8001/pm8001_hwi.c b/drivers/scsi/pm8001/pm8001_hwi.c
> index e4209091c1da..7d81246a432b 100644
> --- a/drivers/scsi/pm8001/pm8001_hwi.c
> +++ b/drivers/scsi/pm8001/pm8001_hwi.c
> @@ -1204,6 +1204,7 @@ void pm8001_chip_iounmap(struct pm8001_hba_info *pm8001_ha)
> }
> }
>
> +#ifndef PM8001_USE_MSIX
> /**
> * pm8001_chip_interrupt_enable - enable PM8001 chip interrupt
> * @pm8001_ha: our hba card information
> @@ -1225,6 +1226,8 @@ pm8001_chip_intx_interrupt_disable(struct pm8001_hba_info *pm8001_ha)
> pm8001_cw32(pm8001_ha, 0, MSGU_ODMR, ODMR_MASK_ALL);
> }
>
> +#else
> +
> /**
> * pm8001_chip_msix_interrupt_enable - enable PM8001 chip interrupt
> * @pm8001_ha: our hba card information
> @@ -1256,6 +1259,7 @@ pm8001_chip_msix_interrupt_disable(struct pm8001_hba_info *pm8001_ha,
> msi_index += MSIX_TABLE_BASE;
> pm8001_cw32(pm8001_ha, 0, msi_index, MSIX_INTERRUPT_DISABLE);
> }
> +#endif
>
> /**
> * pm8001_chip_interrupt_enable - enable PM8001 chip interrupt
> @@ -1266,10 +1270,9 @@ pm8001_chip_interrupt_enable(struct pm8001_hba_info *pm8001_ha, u8 vec)
> {
> #ifdef PM8001_USE_MSIX
> pm8001_chip_msix_interrupt_enable(pm8001_ha, 0);
> - return;
> -#endif
> +#else
> pm8001_chip_intx_interrupt_enable(pm8001_ha);
> -
> +#endif
> }
>
> /**
> @@ -1281,10 +1284,9 @@ pm8001_chip_interrupt_disable(struct pm8001_hba_info *pm8001_ha, u8 vec)
> {
> #ifdef PM8001_USE_MSIX
> pm8001_chip_msix_interrupt_disable(pm8001_ha, 0);
> - return;
> -#endif
> +#else
> pm8001_chip_intx_interrupt_disable(pm8001_ha);
> -
> +#endif
> }
>
> /**
> --
> 2.20.1
>


--
Jack Wang
Linux Kernel Developer

1&1 IONOS Cloud GmbH | Greifswalder Str. 207 | 10405 Berlin | Germany
Phone: +49 30 57700-8042 | Fax: +49 30 57700-8598
E-mail: [email protected] | Web: http://www.ionos.de


Head Office: Berlin, Germany
District Court Berlin Charlottenburg, Registration number: HRB 125506 B
Executive Management: Christoph Steffens, Matthias Steinberg, Achim Weiss

Member of United Internet

This e-mail may contain confidential and/or privileged information. If
you are not the intended recipient of this e-mail, you are hereby
notified that saving, distribution or use of the content of this
e-mail in any way is prohibited. If you have received this e-mail in
error, please notify the sender and delete the e-mail.

2019-03-29 10:30:49

by Mukesh Ojha

[permalink] [raw]
Subject: Re: [PATCH] scsi: pm8001: clean up structurally dead code when PM8001_USE_MSIX is defined


On 3/29/2019 5:13 AM, Colin King wrote:
> From: Colin Ian King <[email protected]>
>
> When macro PM8001_USE_MSIX is defined there are redundant dead code
> calls to pm8001_chip_intx_interrupt_{enable|disable}. Clean this up
> by compiling in the appropriate enable/disable handlers for the
> defined PM8001_USE_MSIX and undefined PM8001_USE_MSIX cases.
>
> Signed-off-by: Colin Ian King <[email protected]>


This looks good.

Reviewed-by: Mukesh Ojha <[email protected]>


Not relevant to this patch but Can you do something about
pm8001_chip_is_our_interupt() as well ?


Cheers,
-Mukesh
> ---
> drivers/scsi/pm8001/pm8001_hwi.c | 14 ++++++++------
> 1 file changed, 8 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/scsi/pm8001/pm8001_hwi.c b/drivers/scsi/pm8001/pm8001_hwi.c
> index e4209091c1da..7d81246a432b 100644
> --- a/drivers/scsi/pm8001/pm8001_hwi.c
> +++ b/drivers/scsi/pm8001/pm8001_hwi.c
> @@ -1204,6 +1204,7 @@ void pm8001_chip_iounmap(struct pm8001_hba_info *pm8001_ha)
> }
> }
>
> +#ifndef PM8001_USE_MSIX
> /**
> * pm8001_chip_interrupt_enable - enable PM8001 chip interrupt
> * @pm8001_ha: our hba card information
> @@ -1225,6 +1226,8 @@ pm8001_chip_intx_interrupt_disable(struct pm8001_hba_info *pm8001_ha)
> pm8001_cw32(pm8001_ha, 0, MSGU_ODMR, ODMR_MASK_ALL);
> }
>
> +#else
> +
> /**
> * pm8001_chip_msix_interrupt_enable - enable PM8001 chip interrupt
> * @pm8001_ha: our hba card information
> @@ -1256,6 +1259,7 @@ pm8001_chip_msix_interrupt_disable(struct pm8001_hba_info *pm8001_ha,
> msi_index += MSIX_TABLE_BASE;
> pm8001_cw32(pm8001_ha, 0, msi_index, MSIX_INTERRUPT_DISABLE);
> }
> +#endif
>
> /**
> * pm8001_chip_interrupt_enable - enable PM8001 chip interrupt
> @@ -1266,10 +1270,9 @@ pm8001_chip_interrupt_enable(struct pm8001_hba_info *pm8001_ha, u8 vec)
> {
> #ifdef PM8001_USE_MSIX
> pm8001_chip_msix_interrupt_enable(pm8001_ha, 0);
> - return;
> -#endif
> +#else
> pm8001_chip_intx_interrupt_enable(pm8001_ha);
> -
> +#endif
> }
>
> /**
> @@ -1281,10 +1284,9 @@ pm8001_chip_interrupt_disable(struct pm8001_hba_info *pm8001_ha, u8 vec)
> {
> #ifdef PM8001_USE_MSIX
> pm8001_chip_msix_interrupt_disable(pm8001_ha, 0);
> - return;
> -#endif
> +#else
> pm8001_chip_intx_interrupt_disable(pm8001_ha);
> -
> +#endif
> }
>
> /**

2019-03-29 10:40:26

by Colin King

[permalink] [raw]
Subject: Re: [PATCH] scsi: pm8001: clean up structurally dead code when PM8001_USE_MSIX is defined

On 29/03/2019 10:29, Mukesh Ojha wrote:
>
> On 3/29/2019 5:13 AM, Colin King wrote:
>> From: Colin Ian King <[email protected]>
>>
>> When macro PM8001_USE_MSIX is defined there are redundant dead code
>> calls to pm8001_chip_intx_interrupt_{enable|disable}. Clean this up
>> by compiling in the appropriate enable/disable handlers for the
>> defined PM8001_USE_MSIX and undefined PM8001_USE_MSIX cases.
>>
>> Signed-off-by: Colin Ian King <[email protected]>
>
>
> This looks good.
>
> Reviewed-by: Mukesh Ojha <[email protected]>
>
>
> Not relevant to this patch but Can you do something about
> pm8001_chip_is_our_interupt() as well ?

Ah, yes, I missed that one, will do that sometime today.

>
>
> Cheers,
> -Mukesh
>> ---
>>   drivers/scsi/pm8001/pm8001_hwi.c | 14 ++++++++------
>>   1 file changed, 8 insertions(+), 6 deletions(-)
>>
>> diff --git a/drivers/scsi/pm8001/pm8001_hwi.c
>> b/drivers/scsi/pm8001/pm8001_hwi.c
>> index e4209091c1da..7d81246a432b 100644
>> --- a/drivers/scsi/pm8001/pm8001_hwi.c
>> +++ b/drivers/scsi/pm8001/pm8001_hwi.c
>> @@ -1204,6 +1204,7 @@ void pm8001_chip_iounmap(struct pm8001_hba_info
>> *pm8001_ha)
>>       }
>>   }
>>   +#ifndef PM8001_USE_MSIX
>>   /**
>>    * pm8001_chip_interrupt_enable - enable PM8001 chip interrupt
>>    * @pm8001_ha: our hba card information
>> @@ -1225,6 +1226,8 @@ pm8001_chip_intx_interrupt_disable(struct
>> pm8001_hba_info *pm8001_ha)
>>       pm8001_cw32(pm8001_ha, 0, MSGU_ODMR, ODMR_MASK_ALL);
>>   }
>>   +#else
>> +
>>   /**
>>    * pm8001_chip_msix_interrupt_enable - enable PM8001 chip interrupt
>>    * @pm8001_ha: our hba card information
>> @@ -1256,6 +1259,7 @@ pm8001_chip_msix_interrupt_disable(struct
>> pm8001_hba_info *pm8001_ha,
>>       msi_index += MSIX_TABLE_BASE;
>>       pm8001_cw32(pm8001_ha, 0,  msi_index, MSIX_INTERRUPT_DISABLE);
>>   }
>> +#endif
>>     /**
>>    * pm8001_chip_interrupt_enable - enable PM8001 chip interrupt
>> @@ -1266,10 +1270,9 @@ pm8001_chip_interrupt_enable(struct
>> pm8001_hba_info *pm8001_ha, u8 vec)
>>   {
>>   #ifdef PM8001_USE_MSIX
>>       pm8001_chip_msix_interrupt_enable(pm8001_ha, 0);
>> -    return;
>> -#endif
>> +#else
>>       pm8001_chip_intx_interrupt_enable(pm8001_ha);
>> -
>> +#endif
>>   }
>>     /**
>> @@ -1281,10 +1284,9 @@ pm8001_chip_interrupt_disable(struct
>> pm8001_hba_info *pm8001_ha, u8 vec)
>>   {
>>   #ifdef PM8001_USE_MSIX
>>       pm8001_chip_msix_interrupt_disable(pm8001_ha, 0);
>> -    return;
>> -#endif
>> +#else
>>       pm8001_chip_intx_interrupt_disable(pm8001_ha);
>> -
>> +#endif
>>   }
>>     /**


2019-03-29 14:17:31

by Martin K. Petersen

[permalink] [raw]
Subject: Re: [PATCH] scsi: pm8001: clean up structurally dead code when PM8001_USE_MSIX is defined


Colin,

> When macro PM8001_USE_MSIX is defined there are redundant dead code
> calls to pm8001_chip_intx_interrupt_{enable|disable}. Clean this up by
> compiling in the appropriate enable/disable handlers for the defined
> PM8001_USE_MSIX and undefined PM8001_USE_MSIX cases.

Applied to 5.2/scsi-queue, thanks!

--
Martin K. Petersen Oracle Linux Engineering