linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2] drivers: scsi: remove unnecessary #ifdef MODULE
@ 2019-06-06 15:04 Enrico Weigelt, metux IT consult
  2019-06-07  0:41 ` James Bottomley
  0 siblings, 1 reply; 3+ messages in thread
From: Enrico Weigelt, metux IT consult @ 2019-06-06 15:04 UTC (permalink / raw)
  To: linux-kernel; +Cc: khalid, jejb, martin.petersen, aacraid, linux-scsi

From: Enrico Weigelt <info@metux.net>

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

Changes v2:
    * make dptids const to fix warning on unused variable

Signed-off-by: Enrico Weigelt <info@metux.net>
---
 drivers/scsi/BusLogic.c | 2 --
 drivers/scsi/dpt_i2o.c  | 5 +----
 2 files changed, 1 insertion(+), 6 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..162d56a 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[] = {
+static const 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


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH v2] drivers: scsi: remove unnecessary #ifdef MODULE
  2019-06-06 15:04 [PATCH v2] drivers: scsi: remove unnecessary #ifdef MODULE Enrico Weigelt, metux IT consult
@ 2019-06-07  0:41 ` James Bottomley
  2019-06-07 21:50   ` Enrico Weigelt, metux IT consult
  0 siblings, 1 reply; 3+ messages in thread
From: James Bottomley @ 2019-06-07  0:41 UTC (permalink / raw)
  To: Enrico Weigelt, metux IT consult, linux-kernel
  Cc: khalid, martin.petersen, aacraid, linux-scsi

On Thu, 2019-06-06 at 17:04 +0200, Enrico Weigelt, metux IT consult
wrote:
> From: Enrico Weigelt <info@metux.net>
> 
> The MODULE_DEVICE_TABLE() macro already checks for MODULE defined,
> so the extra check here is not necessary.
> 
> Changes v2:
>     * make dptids const to fix warning on unused variable

I don't think this works; in my version of gcc, const does not defeat
the unused variable warning if I try with a test programme:

jejb@jarvis:~> gcc -Wunused-variable -c test1.c
test1.c:3:18: warning: ‘i’ defined but not used [-Wunused-cons
t-variable=]
 static const int i[] = { 1, 2, 3};

James


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH v2] drivers: scsi: remove unnecessary #ifdef MODULE
  2019-06-07  0:41 ` James Bottomley
@ 2019-06-07 21:50   ` Enrico Weigelt, metux IT consult
  0 siblings, 0 replies; 3+ messages in thread
From: Enrico Weigelt, metux IT consult @ 2019-06-07 21:50 UTC (permalink / raw)
  To: James Bottomley, Enrico Weigelt, metux IT consult, linux-kernel
  Cc: khalid, martin.petersen, aacraid, linux-scsi

On 07.06.19 02:41, James Bottomley wrote:
> On Thu, 2019-06-06 at 17:04 +0200, Enrico Weigelt, metux IT consult
> wrote:
>> From: Enrico Weigelt <info@metux.net>
>>
>> The MODULE_DEVICE_TABLE() macro already checks for MODULE defined,
>> so the extra check here is not necessary.
>>
>> Changes v2:
>>     * make dptids const to fix warning on unused variable
> 
> I don't think this works; in my version of gcc, const does not defeat
> the unused variable warning if I try with a test programme:
> 
> jejb@jarvis:~> gcc -Wunused-variable -c test1.c
> test1.c:3:18: warning: ‘i’ defined but not used [-Wunused-cons
> t-variable=]
>  static const int i[] = { 1, 2, 3};

Which gcc version are you using ?
Could you please have a try w/ the kernel (plus my patch) ?

Tested w/ 6.3.0-18+deb9u1 (stretch-amd64), got no warnings.


--mtx

-- 
Enrico Weigelt, metux IT consult
Free software and Linux embedded engineering
info@metux.net -- +49-151-27565287

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2019-06-07 21:51 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-06-06 15:04 [PATCH v2] drivers: scsi: remove unnecessary #ifdef MODULE Enrico Weigelt, metux IT consult
2019-06-07  0:41 ` James Bottomley
2019-06-07 21:50   ` Enrico Weigelt, metux IT consult

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).