Subject: [PATCH 2/3] drivers: scsi: remove unnecessary #ifdef MODULE

The MODULE_DEVICE_TABLE() macro already checks for MODULE defined,
so the extra check here is not necessary.

Signed-off-by: Enrico Weigelt <[email protected]>
---
drivers/scsi/BusLogic.c | 2 --
drivers/scsi/dpt_i2o.c | 3 ---
2 files changed, 5 deletions(-)

diff --git a/drivers/scsi/BusLogic.c b/drivers/scsi/BusLogic.c
index e41e51f..68cc68b 100644
--- a/drivers/scsi/BusLogic.c
+++ b/drivers/scsi/BusLogic.c
@@ -3893,7 +3893,6 @@ static void __exit blogic_exit(void)

__setup("BusLogic=", blogic_setup);

-#ifdef MODULE
/*static struct pci_device_id blogic_pci_tbl[] = {
{ PCI_VENDOR_ID_BUSLOGIC, PCI_DEVICE_ID_BUSLOGIC_MULTIMASTER,
PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
@@ -3909,7 +3908,6 @@ static void __exit blogic_exit(void)
{PCI_DEVICE(PCI_VENDOR_ID_BUSLOGIC, PCI_DEVICE_ID_BUSLOGIC_FLASHPOINT)},
{0, },
};
-#endif
MODULE_DEVICE_TABLE(pci, blogic_pci_tbl);

module_init(blogic_init);
diff --git a/drivers/scsi/dpt_i2o.c b/drivers/scsi/dpt_i2o.c
index abc74fd..9b28f9f 100644
--- a/drivers/scsi/dpt_i2o.c
+++ b/drivers/scsi/dpt_i2o.c
@@ -177,14 +177,11 @@ static u8 adpt_read_blink_led(adpt_hba* host)
*============================================================================
*/

-#ifdef MODULE
static struct pci_device_id dptids[] = {
{ PCI_DPT_VENDOR_ID, PCI_DPT_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID,},
{ PCI_DPT_VENDOR_ID, PCI_DPT_RAPTOR_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID,},
{ 0, }
};
-#endif
-
MODULE_DEVICE_TABLE(pci,dptids);

static int adpt_detect(struct scsi_host_template* sht)
--
1.9.1


Subject: RE: [PATCH 2/3] drivers: scsi: remove unnecessary #ifdef MODULE



> -----Original Message-----
> From: [email protected] <linux-kernel-
> [email protected]> On Behalf Of Enrico Weigelt, metux IT consult
> Sent: Saturday, June 01, 2019 9:02 AM
> Subject: [PATCH 2/3] drivers: scsi: remove unnecessary #ifdef MODULE
>
> The MODULE_DEVICE_TABLE() macro already checks for MODULE defined,
> so the extra check here is not necessary.
>
...
> diff --git a/drivers/scsi/BusLogic.c b/drivers/scsi/BusLogic.c
...
>
> -#ifdef MODULE
> static struct pci_device_id dptids[] = {
> { PCI_DPT_VENDOR_ID, PCI_DPT_DEVICE_ID, PCI_ANY_ID,
> PCI_ANY_ID,},
> { PCI_DPT_VENDOR_ID, PCI_DPT_RAPTOR_DEVICE_ID, PCI_ANY_ID,
> PCI_ANY_ID,},
> { 0, }
> };
> -#endif
> -
> MODULE_DEVICE_TABLE(pci,dptids);

I don't see any reply to James' comment that these changes result in
static struct definitions that are unused, which should result in
complaints by the compiler like:
warning: 'dptids' defined by not used [-Wunused-variable]


2019-06-03 17:50:44

by Khalid Aziz

[permalink] [raw]
Subject: Re: [PATCH 2/3] drivers: scsi: remove unnecessary #ifdef MODULE

On 6/1/19 8:01 AM, Enrico Weigelt, metux IT consult wrote:
> The MODULE_DEVICE_TABLE() macro already checks for MODULE defined,
> so the extra check here is not necessary.
>
> Signed-off-by: Enrico Weigelt <[email protected]>
> ---
> drivers/scsi/BusLogic.c | 2 --
> drivers/scsi/dpt_i2o.c | 3 ---
> 2 files changed, 5 deletions(-)
>
> diff --git a/drivers/scsi/BusLogic.c b/drivers/scsi/BusLogic.c
> index e41e51f..68cc68b 100644
> --- a/drivers/scsi/BusLogic.c
> +++ b/drivers/scsi/BusLogic.c
> @@ -3893,7 +3893,6 @@ static void __exit blogic_exit(void)
>
> __setup("BusLogic=", blogic_setup);
>
> -#ifdef MODULE
> /*static struct pci_device_id blogic_pci_tbl[] = {
> { PCI_VENDOR_ID_BUSLOGIC, PCI_DEVICE_ID_BUSLOGIC_MULTIMASTER,
> PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
> @@ -3909,7 +3908,6 @@ static void __exit blogic_exit(void)
> {PCI_DEVICE(PCI_VENDOR_ID_BUSLOGIC, PCI_DEVICE_ID_BUSLOGIC_FLASHPOINT)},
> {0, },
> };
> -#endif
> MODULE_DEVICE_TABLE(pci, blogic_pci_tbl);
>
> module_init(blogic_init);> diff --git a/drivers/scsi/dpt_i2o.c b/drivers/scsi/dpt_i2o.c
> index abc74fd..9b28f9f 100644
> --- a/drivers/scsi/dpt_i2o.c
> +++ b/drivers/scsi/dpt_i2o.c
> @@ -177,14 +177,11 @@ static u8 adpt_read_blink_led(adpt_hba* host)
> *============================================================================
> */
>
> -#ifdef MODULE
> static struct pci_device_id dptids[] = {
> { PCI_DPT_VENDOR_ID, PCI_DPT_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID,},
> { PCI_DPT_VENDOR_ID, PCI_DPT_RAPTOR_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID,},
> { 0, }
> };
> -#endif
> -
> MODULE_DEVICE_TABLE(pci,dptids);
>
> static int adpt_detect(struct scsi_host_template* sht)
>

As James pointed out, this will result in warning from compiler about
unused variable. Please address that first.

--
Khalid

Subject: Re: [PATCH 2/3] drivers: scsi: remove unnecessary #ifdef MODULE

On 01.06.19 15:40, Elliott, Robert (Servers) wrote:

<snip>

> I don't see any reply to James' comment that these changes result in

I've missed that mail :(

> static struct definitions that are unused, which should result in
> complaints by the compiler like:
> warning: 'dptids' defined by not used [-Wunused-variable]

hmm, seems that const is missing on dptids ... I'll test that and
repost fixed vrsion.

--mtx

--
Enrico Weigelt, metux IT consult
Free software and Linux embedded engineering
[email protected] -- +49-151-27565287