linux-hwmon.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* clean some unneeded #ifdef MODULE
@ 2019-05-31 15:09 Enrico Weigelt, metux IT consult
  2019-05-31 15:09 ` [PATCH 1/3] drivers: cpufreq: cpufreq-nforce2: remove unnecessary " Enrico Weigelt, metux IT consult
                   ` (3 more replies)
  0 siblings, 4 replies; 9+ messages in thread
From: Enrico Weigelt, metux IT consult @ 2019-05-31 15:09 UTC (permalink / raw)
  To: linux-kernel
  Cc: rjw, viresh.kumar, jdelvare, linux, khalid, jejb,
	martin.petersen, aacraid, linux-pm, linux-hwmon, linux-scsi

Hi folks,

here're some patches that clean up uncessary cases of #ifdef MODULE.
These ifdef's just exlude MODULE_DEVICE_TABLE's when the kernel is
built w/o module support. As MODULE_DEVICE_TABLE() macro already
checks for that, these extra #ifdef's shouldn't be necessary.


--mtx


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

* [PATCH 1/3] drivers: cpufreq: cpufreq-nforce2: remove unnecessary #ifdef MODULE
  2019-05-31 15:09 clean some unneeded #ifdef MODULE Enrico Weigelt, metux IT consult
@ 2019-05-31 15:09 ` Enrico Weigelt, metux IT consult
  2019-05-31 15:09 ` [PATCH 2/3] drivers: scsci: " Enrico Weigelt, metux IT consult
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 9+ messages in thread
From: Enrico Weigelt, metux IT consult @ 2019-05-31 15:09 UTC (permalink / raw)
  To: linux-kernel
  Cc: rjw, viresh.kumar, jdelvare, linux, khalid, jejb,
	martin.petersen, aacraid, linux-pm, linux-hwmon, linux-scsi

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

Signed-off-by: Enrico Weigelt <info@metux.net>
---
 drivers/cpufreq/cpufreq-nforce2.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/drivers/cpufreq/cpufreq-nforce2.c b/drivers/cpufreq/cpufreq-nforce2.c
index 33c309a..b8a6c9e 100644
--- a/drivers/cpufreq/cpufreq-nforce2.c
+++ b/drivers/cpufreq/cpufreq-nforce2.c
@@ -374,13 +374,11 @@ static int nforce2_cpu_exit(struct cpufreq_policy *policy)
 	.exit = nforce2_cpu_exit,
 };
 
-#ifdef MODULE
 static const struct pci_device_id nforce2_ids[] = {
 	{ PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NFORCE2 },
 	{}
 };
 MODULE_DEVICE_TABLE(pci, nforce2_ids);
-#endif
 
 /**
  * nforce2_detect_chipset - detect the Southbridge which contains FSB PLL logic
-- 
1.9.1


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

* [PATCH 2/3] drivers: scsci: remove unnecessary #ifdef MODULE
  2019-05-31 15:09 clean some unneeded #ifdef MODULE Enrico Weigelt, metux IT consult
  2019-05-31 15:09 ` [PATCH 1/3] drivers: cpufreq: cpufreq-nforce2: remove unnecessary " Enrico Weigelt, metux IT consult
@ 2019-05-31 15:09 ` Enrico Weigelt, metux IT consult
  2019-05-31 15:09 ` [PATCH 3/3] drivers: hwmon: i5k_amb: " Enrico Weigelt, metux IT consult
  2019-05-31 15:15 ` clean some unneeded " James Bottomley
  3 siblings, 0 replies; 9+ messages in thread
From: Enrico Weigelt, metux IT consult @ 2019-05-31 15:09 UTC (permalink / raw)
  To: linux-kernel
  Cc: rjw, viresh.kumar, jdelvare, linux, khalid, jejb,
	martin.petersen, aacraid, linux-pm, linux-hwmon, linux-scsi

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

Signed-off-by: Enrico Weigelt <info@metux.net>
---
 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 a3afd14..eb5cfe8 100644
--- a/drivers/scsi/dpt_i2o.c
+++ b/drivers/scsi/dpt_i2o.c
@@ -180,14 +180,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


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

* [PATCH 3/3] drivers: hwmon: i5k_amb: remove unnecessary #ifdef MODULE
  2019-05-31 15:09 clean some unneeded #ifdef MODULE Enrico Weigelt, metux IT consult
  2019-05-31 15:09 ` [PATCH 1/3] drivers: cpufreq: cpufreq-nforce2: remove unnecessary " Enrico Weigelt, metux IT consult
  2019-05-31 15:09 ` [PATCH 2/3] drivers: scsci: " Enrico Weigelt, metux IT consult
@ 2019-05-31 15:09 ` Enrico Weigelt, metux IT consult
  2019-05-31 15:15 ` clean some unneeded " James Bottomley
  3 siblings, 0 replies; 9+ messages in thread
From: Enrico Weigelt, metux IT consult @ 2019-05-31 15:09 UTC (permalink / raw)
  To: linux-kernel
  Cc: rjw, viresh.kumar, jdelvare, linux, khalid, jejb,
	martin.petersen, aacraid, linux-pm, linux-hwmon, linux-scsi

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

Signed-off-by: Enrico Weigelt <info@metux.net>
---
 drivers/hwmon/i5k_amb.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/drivers/hwmon/i5k_amb.c b/drivers/hwmon/i5k_amb.c
index 2cf73d8..622405b 100644
--- a/drivers/hwmon/i5k_amb.c
+++ b/drivers/hwmon/i5k_amb.c
@@ -495,14 +495,12 @@ static int i5k_channel_probe(u16 *amb_present, unsigned long dev_id)
 	{ 0, 0 }
 };
 
-#ifdef MODULE
 static const struct pci_device_id i5k_amb_ids[] = {
 	{ PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_5000_ERR) },
 	{ PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_5400_ERR) },
 	{ 0, }
 };
 MODULE_DEVICE_TABLE(pci, i5k_amb_ids);
-#endif
 
 static int i5k_amb_probe(struct platform_device *pdev)
 {
-- 
1.9.1


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

* Re: clean some unneeded #ifdef MODULE
  2019-05-31 15:09 clean some unneeded #ifdef MODULE Enrico Weigelt, metux IT consult
                   ` (2 preceding siblings ...)
  2019-05-31 15:09 ` [PATCH 3/3] drivers: hwmon: i5k_amb: " Enrico Weigelt, metux IT consult
@ 2019-05-31 15:15 ` James Bottomley
  3 siblings, 0 replies; 9+ messages in thread
From: James Bottomley @ 2019-05-31 15:15 UTC (permalink / raw)
  To: Enrico Weigelt, metux IT consult, linux-kernel
  Cc: rjw, viresh.kumar, jdelvare, linux, khalid, martin.petersen,
	aacraid, linux-pm, linux-hwmon, linux-scsi

On Fri, 2019-05-31 at 17:09 +0200, Enrico Weigelt, metux IT consult
wrote:
> Hi folks,
> 
> here're some patches that clean up uncessary cases of #ifdef MODULE.
> These ifdef's just exlude MODULE_DEVICE_TABLE's when the kernel is
> built w/o module support. As MODULE_DEVICE_TABLE() macro already
> checks for that, these extra #ifdef's shouldn't be necessary.

Isn't the problem the #ifdefs are trying to solve a complaint about an
unused variable in the non-module case? if so, is that fixed some other
way?

James


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

* Re: [PATCH 3/3] drivers: hwmon: i5k_amb: remove unnecessary #ifdef MODULE
  2019-06-05 23:59     ` Enrico Weigelt, metux IT consult
@ 2019-06-06  1:35       ` Guenter Roeck
  0 siblings, 0 replies; 9+ messages in thread
From: Guenter Roeck @ 2019-06-06  1:35 UTC (permalink / raw)
  To: Enrico Weigelt, metux IT consult, Enrico Weigelt, metux IT consult
  Cc: linux-kernel, rjw, viresh.kumar, jdelvare, khalid, jejb,
	martin.petersen, aacraid, linux-pm, linux-hwmon, linux-scsi

On 6/5/19 4:59 PM, Enrico Weigelt, metux IT consult wrote:
> On 01.06.19 22:49, Guenter Roeck wrote:
>> On Sat, Jun 01, 2019 at 04:01:40PM +0200, 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 <info@metux.net>
>>> ---
>>>   drivers/hwmon/i5k_amb.c | 2 --
>>>   1 file changed, 2 deletions(-)
>>>
>>> diff --git a/drivers/hwmon/i5k_amb.c b/drivers/hwmon/i5k_amb.c
>>> index b09c39a..b674c2f 100644
>>> --- a/drivers/hwmon/i5k_amb.c
>>> +++ b/drivers/hwmon/i5k_amb.c
>>> @@ -482,14 +482,12 @@ static int i5k_channel_probe(u16 *amb_present, unsigned long dev_id)
>>>       { 0, 0 }
>>>   };
>>> -#ifdef MODULE
>>>   static const struct pci_device_id i5k_amb_ids[] = {
>>>       { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_5000_ERR) },
>>>       { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_5400_ERR) },
>>>       { 0, }
>>>   };
>>>   MODULE_DEVICE_TABLE(pci, i5k_amb_ids);
>>> -#endif
>>
>> I'd rather know what this table is used for in the first place.
> 
> Seems it's really just used for the module loader, while actual probing
> is using a different table. IMHO, the worst thing my patch could do is
> introducing a warning on unused variable (IMHO shouldn't happen when
> it's static const).
> 

You are wrong. You'll need __maybe_unused qualifiers for those variables
to avoid the warning.

Guenter

> I've just rewritten it to move everything into i5k_amb_ids ... just need
> to run build tests on it (unfortunately can't run-test, as I don't have
> that device).
> 
> 
> --mtx
> 


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

* Re: [PATCH 3/3] drivers: hwmon: i5k_amb: remove unnecessary #ifdef MODULE
  2019-06-01 22:49   ` Guenter Roeck
@ 2019-06-05 23:59     ` Enrico Weigelt, metux IT consult
  2019-06-06  1:35       ` Guenter Roeck
  0 siblings, 1 reply; 9+ messages in thread
From: Enrico Weigelt, metux IT consult @ 2019-06-05 23:59 UTC (permalink / raw)
  To: Guenter Roeck, Enrico Weigelt, metux IT consult
  Cc: linux-kernel, rjw, viresh.kumar, jdelvare, khalid, jejb,
	martin.petersen, aacraid, linux-pm, linux-hwmon, linux-scsi

On 01.06.19 22:49, Guenter Roeck wrote:
> On Sat, Jun 01, 2019 at 04:01:40PM +0200, 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 <info@metux.net>
>> ---
>>   drivers/hwmon/i5k_amb.c | 2 --
>>   1 file changed, 2 deletions(-)
>>
>> diff --git a/drivers/hwmon/i5k_amb.c b/drivers/hwmon/i5k_amb.c
>> index b09c39a..b674c2f 100644
>> --- a/drivers/hwmon/i5k_amb.c
>> +++ b/drivers/hwmon/i5k_amb.c
>> @@ -482,14 +482,12 @@ static int i5k_channel_probe(u16 *amb_present, unsigned long dev_id)
>>   	{ 0, 0 }
>>   };
>>   
>> -#ifdef MODULE
>>   static const struct pci_device_id i5k_amb_ids[] = {
>>   	{ PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_5000_ERR) },
>>   	{ PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_5400_ERR) },
>>   	{ 0, }
>>   };
>>   MODULE_DEVICE_TABLE(pci, i5k_amb_ids);
>> -#endif
>>   
> 
> I'd rather know what this table is used for in the first place.

Seems it's really just used for the module loader, while actual probing
is using a different table. IMHO, the worst thing my patch could do is
introducing a warning on unused variable (IMHO shouldn't happen when
it's static const).

I've just rewritten it to move everything into i5k_amb_ids ... just need
to run build tests on it (unfortunately can't run-test, as I don't have
that device).


--mtx

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

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

* Re: [PATCH 3/3] drivers: hwmon: i5k_amb: remove unnecessary #ifdef MODULE
  2019-06-01 14:01 ` [PATCH 3/3] drivers: hwmon: i5k_amb: remove unnecessary " Enrico Weigelt, metux IT consult
@ 2019-06-01 22:49   ` Guenter Roeck
  2019-06-05 23:59     ` Enrico Weigelt, metux IT consult
  0 siblings, 1 reply; 9+ messages in thread
From: Guenter Roeck @ 2019-06-01 22:49 UTC (permalink / raw)
  To: Enrico Weigelt, metux IT consult
  Cc: linux-kernel, rjw, viresh.kumar, jdelvare, khalid, jejb,
	martin.petersen, aacraid, linux-pm, linux-hwmon, linux-scsi

On Sat, Jun 01, 2019 at 04:01:40PM +0200, 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 <info@metux.net>
> ---
>  drivers/hwmon/i5k_amb.c | 2 --
>  1 file changed, 2 deletions(-)
> 
> diff --git a/drivers/hwmon/i5k_amb.c b/drivers/hwmon/i5k_amb.c
> index b09c39a..b674c2f 100644
> --- a/drivers/hwmon/i5k_amb.c
> +++ b/drivers/hwmon/i5k_amb.c
> @@ -482,14 +482,12 @@ static int i5k_channel_probe(u16 *amb_present, unsigned long dev_id)
>  	{ 0, 0 }
>  };
>  
> -#ifdef MODULE
>  static const struct pci_device_id i5k_amb_ids[] = {
>  	{ PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_5000_ERR) },
>  	{ PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_5400_ERR) },
>  	{ 0, }
>  };
>  MODULE_DEVICE_TABLE(pci, i5k_amb_ids);
> -#endif
>  

I'd rather know what this table is used for in the first place.

Guenter

>  static int i5k_amb_probe(struct platform_device *pdev)
>  {
> -- 
> 1.9.1
> 

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

* [PATCH 3/3] drivers: hwmon: i5k_amb: remove unnecessary #ifdef MODULE
  2019-06-01 14:01 remove " Enrico Weigelt, metux IT consult
@ 2019-06-01 14:01 ` Enrico Weigelt, metux IT consult
  2019-06-01 22:49   ` Guenter Roeck
  0 siblings, 1 reply; 9+ messages in thread
From: Enrico Weigelt, metux IT consult @ 2019-06-01 14:01 UTC (permalink / raw)
  To: linux-kernel
  Cc: rjw, viresh.kumar, jdelvare, linux, khalid, jejb,
	martin.petersen, aacraid, linux-pm, linux-hwmon, linux-scsi

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

Signed-off-by: Enrico Weigelt <info@metux.net>
---
 drivers/hwmon/i5k_amb.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/drivers/hwmon/i5k_amb.c b/drivers/hwmon/i5k_amb.c
index b09c39a..b674c2f 100644
--- a/drivers/hwmon/i5k_amb.c
+++ b/drivers/hwmon/i5k_amb.c
@@ -482,14 +482,12 @@ static int i5k_channel_probe(u16 *amb_present, unsigned long dev_id)
 	{ 0, 0 }
 };
 
-#ifdef MODULE
 static const struct pci_device_id i5k_amb_ids[] = {
 	{ PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_5000_ERR) },
 	{ PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_5400_ERR) },
 	{ 0, }
 };
 MODULE_DEVICE_TABLE(pci, i5k_amb_ids);
-#endif
 
 static int i5k_amb_probe(struct platform_device *pdev)
 {
-- 
1.9.1


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

end of thread, other threads:[~2019-06-06  1:35 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-05-31 15:09 clean some unneeded #ifdef MODULE Enrico Weigelt, metux IT consult
2019-05-31 15:09 ` [PATCH 1/3] drivers: cpufreq: cpufreq-nforce2: remove unnecessary " Enrico Weigelt, metux IT consult
2019-05-31 15:09 ` [PATCH 2/3] drivers: scsci: " Enrico Weigelt, metux IT consult
2019-05-31 15:09 ` [PATCH 3/3] drivers: hwmon: i5k_amb: " Enrico Weigelt, metux IT consult
2019-05-31 15:15 ` clean some unneeded " James Bottomley
2019-06-01 14:01 remove " Enrico Weigelt, metux IT consult
2019-06-01 14:01 ` [PATCH 3/3] drivers: hwmon: i5k_amb: remove unnecessary " Enrico Weigelt, metux IT consult
2019-06-01 22:49   ` Guenter Roeck
2019-06-05 23:59     ` Enrico Weigelt, metux IT consult
2019-06-06  1:35       ` Guenter Roeck

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).