Skip to contentSkip to conversation

comedi: don't build module device_ids if built in

PATCH In review Ben Dooks 1 participant 2 messages Mar 8, 2024 Comedi drivers

lore
Share & tools
lore

Ben Dooks

author
#0 lore raw

PATCH 1/1 comedi: don't build module device_ids if built in

If not building as a module, then the device_ids[] array is not used by the MODULE_DEVICE_TABLE(pnp, device_ids) so remove the warning about it not being used by enclosing it in #ifdef MODULE

Fixes:

drivers/comedi/drivers/ni_atmio.c:209:35: warning: ‘device_ids’ defined but not used [-Wunused-const-variable=]

---
 drivers/comedi/drivers/ni_atmio.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/comedi/drivers/ni_atmio.c +2 -0
index 8876a1d24c56..f0dbe4c2341a 100644
@@ -206,6 +206,7 @@ static const int ni_irqpin[] = {
 
 #include "ni_mio_common.c"
 
+#ifndef MODULE
 static const struct pnp_device_id device_ids[] = {
 	{.id = "NIC1900", .driver_data = 0},
 	{.id = "NIC2400", .driver_data = 0},
@@ -216,6 +217,7 @@ static const struct pnp_device_id device_ids[] = {
 };
 
 MODULE_DEVICE_TABLE(pnp, device_ids);
+#endif
 
 static int ni_isapnp_find_board(struct pnp_dev **dev)
 {
Signature · 1 line
2.37.2.352.g3c44437643
author
#1 lore raw
Quoted 18 lines · Ben Dooks

If not building as a module, then the device_ids[] array is not used by the MODULE_DEVICE_TABLE(pnp, device_ids) so remove the warning about it not being used by enclosing it in #ifdef MODULE

Fixes:

drivers/comedi/drivers/ni_atmio.c:209:35: warning: ‘device_ids’ defined but not used [-Wunused-const-variable=]

---
  drivers/comedi/drivers/ni_atmio.c | 2 ++
  1 file changed, 2 insertions(+)
drivers/comedi/drivers/ni_atmio.c +0 -0
index 8876a1d24c56..f0dbe4c2341a 100644

drivers/comedi/drivers/ni_atmio.c static const int ni_irqpin[] = { · line 209

Quoted 4 lines
drivers/comedi/drivers/ni_atmio.c +1 -0
@@ -206,6 +206,7 @@ static const int ni_irqpin[] = {
 
  #include "ni_mio_common.c"
 
+#ifndef MODULE

Whoops, this was meant to be fixed to #ifdef.
Will send fixed patch Monday

Quoted 11 lines
drivers/comedi/drivers/ni_atmio.c +1 -0
  static const struct pnp_device_id device_ids[] = {
  	{.id = "NIC1900", .driver_data = 0},
  	{.id = "NIC2400", .driver_data = 0},
@@ -216,6 +217,7 @@ static const struct pnp_device_id device_ids[] = {
  };
 
  MODULE_DEVICE_TABLE(pnp, device_ids);
+#endif
 
  static int ni_isapnp_find_board(struct pnp_dev **dev)
  {
Signature · 4 lines
Ben Dooks				http://www.codethink.co.uk/
Senior Engineer				Codethink - Providing Genius

https://www.codethink.co.uk/privacy.html