Skip to contentSkip to conversation

clean some unneeded #ifdef MODULE

PATCH New Enrico Weigelt, metux IT consult 2 participants 5 messages May 31, 2019

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

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

#1 lore raw

PATCH 1/3 drivers: cpufreq: cpufreq-nforce2: remove unnecessary #ifdef MODULE

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

---
 drivers/cpufreq/cpufreq-nforce2.c | 2 --
 1 file changed, 2 deletions(-)
drivers/cpufreq/cpufreq-nforce2.c +0 -2
index 33c309a..b8a6c9e 100644
@@ -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
Signature · 1 line
1.9.1
#2 lore raw

PATCH 2/3 drivers: scsci: remove unnecessary #ifdef MODULE

In reply to Enrico Weigelt, metux IT consult

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

---
 drivers/scsi/BusLogic.c | 2 --
 drivers/scsi/dpt_i2o.c  | 3 ---
 2 files changed, 5 deletions(-)
drivers/scsi/BusLogic.c +0 -2
index e41e51f..68cc68b 100644
@@ -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);
drivers/scsi/dpt_i2o.c +0 -3
index a3afd14..eb5cfe8 100644
@@ -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)
Signature · 1 line
1.9.1
#3 lore raw

PATCH 3/3 drivers: hwmon: i5k_amb: remove unnecessary #ifdef MODULE

In reply to Enrico Weigelt, metux IT consult

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

---
 drivers/hwmon/i5k_amb.c | 2 --
 1 file changed, 2 deletions(-)
drivers/hwmon/i5k_amb.c +0 -2
index 2cf73d8..622405b 100644
@@ -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)
 {
Signature · 1 line
1.9.1
#4 lore raw
In reply to Enrico Weigelt, metux IT consult
Quoted 6 lines · metux IT consult

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