Skip to contentSkip to conversation

staging: gpib: Modernize gpib_interface_t initialization and make static

PATCH New Dave Penkler 1 participant 1 message Jan 11, 2025 Staging

lore
Share & tools
lore
#0 lore raw

PATCH v3 1/1 staging: gpib: Modernize gpib_interface_t initialization and make static

All interface drivers were using the old style initialization of this struct

field : value;

This generated the followng sparse warning, for example:
agilent_82357a/agilent_82357a.c:1492:1: warning: obsolete struct initializer, use C99 syntax

Change the initialization to use the C99 syntax

.field = value;

This also resolves the checkpatch constraint of no indentation

These structs were also not declared as static, unnecessarily polluting the symbol namespace and generating the following sparse warnings, for example:

agilent_82357a/agilent_82357a.c:1465:18: warning: symbol 'agilent_82357a_gpib_interface' was not declared. Should it be static?

Declare them as static and remove any conflicting extern declarations in the corresponding include files.

---
v1 -> v2 Add subsystem prefix to subject
v2 -> v3 handle pcmcia interfaces and isa bus drivers also

.../gpib/agilent_82350b/agilent_82350b.c | 100 ++--

 .../gpib/agilent_82350b/agilent_82350b.h      |   2 -
 .../gpib/agilent_82357a/agilent_82357a.c      |  56 +-
 drivers/staging/gpib/cb7210/cb7210.c          | 464 ++++++++--------
 drivers/staging/gpib/cb7210/cb7210.h          |   5 -
 drivers/staging/gpib/cec/cec.h                |   4 -
 drivers/staging/gpib/cec/cec_gpib.c           |  52 +-
 drivers/staging/gpib/eastwood/fluke_gpib.c    | 150 ++---
 drivers/staging/gpib/fmh_gpib/fmh_gpib.c      | 208 +++----
 drivers/staging/gpib/gpio/gpib_bitbang.c      |  50 +-
 drivers/staging/gpib/hp_82335/hp82335.c       |  52 +-
 drivers/staging/gpib/hp_82335/hp82335.h       |   3 -
 drivers/staging/gpib/hp_82341/hp_82341.c      | 102 ++--
 drivers/staging/gpib/hp_82341/hp_82341.h      |   2 -
 drivers/staging/gpib/ines/ines.h              |   7 -
 drivers/staging/gpib/ines/ines_gpib.c         | 364 ++++++------
 .../gpib/lpvo_usb_gpib/lpvo_usb_gpib.c        |  54 +-
 drivers/staging/gpib/ni_usb/ni_usb_gpib.c     |  54 +-
 drivers/staging/gpib/pc2/pc2_gpib.c           | 208 +++----
 drivers/staging/gpib/tnt4882/tnt4882_gpib.c   | 520 +++++++++---------
 20 files changed, 1217 insertions(+), 1240 deletions(-)
drivers/staging/gpib/agilent_82350b/agilent_82350b.c +50 -50
index e9c1f0100b2a..95bb55b4c0e9 100644
@@ -828,58 +828,58 @@ void agilent_82350b_detach(gpib_board_t *board)
 	agilent_82350b_free_private(board);
 }
 
-gpib_interface_t agilent_82350b_unaccel_interface = {
-name: "agilent_82350b_unaccel",
-attach : agilent_82350b_unaccel_attach,
-detach : agilent_82350b_detach,
-read : agilent_82350b_read,
-write : agilent_82350b_write,
-command : agilent_82350b_command,
-request_system_control : agilent_82350b_request_system_control,
-take_control : agilent_82350b_take_control,
-go_to_standby : agilent_82350b_go_to_standby,
-interface_clear : agilent_82350b_interface_clear,
-remote_enable : agilent_82350b_remote_enable,
-enable_eos : agilent_82350b_enable_eos,
-disable_eos : agilent_82350b_disable_eos,
-parallel_poll : agilent_82350b_parallel_poll,
-parallel_poll_configure : agilent_82350b_parallel_poll_configure,
-parallel_poll_response : agilent_82350b_parallel_poll_response,
-local_parallel_poll_mode : NULL, // XXX
-line_status : agilent_82350b_line_status,
-update_status : agilent_82350b_update_status,
-primary_address : agilent_82350b_primary_address,
-secondary_address : agilent_82350b_secondary_address,
-serial_poll_response : agilent_82350b_serial_poll_response,
-t1_delay : agilent_82350b_t1_delay,
-return_to_local : agilent_82350b_return_to_local,
+static gpib_interface_t agilent_82350b_unaccel_interface = {
+	.name = "agilent_82350b_unaccel",
+	.attach = agilent_82350b_unaccel_attach,
+	.detach = agilent_82350b_detach,
+	.read = agilent_82350b_read,
+	.write = agilent_82350b_write,
+	.command = agilent_82350b_command,
+	.request_system_control = agilent_82350b_request_system_control,
+	.take_control = agilent_82350b_take_control,
+	.go_to_standby = agilent_82350b_go_to_standby,
+	.interface_clear = agilent_82350b_interface_clear,
+	.remote_enable = agilent_82350b_remote_enable,
+	.enable_eos = agilent_82350b_enable_eos,
+	.disable_eos = agilent_82350b_disable_eos,
+	.parallel_poll = agilent_82350b_parallel_poll,
+	.parallel_poll_configure = agilent_82350b_parallel_poll_configure,
+	.parallel_poll_response = agilent_82350b_parallel_poll_response,
+	.local_parallel_poll_mode = NULL, // XXX
+	.line_status = agilent_82350b_line_status,
+	.update_status = agilent_82350b_update_status,
+	.primary_address = agilent_82350b_primary_address,
+	.secondary_address = agilent_82350b_secondary_address,
+	.serial_poll_response = agilent_82350b_serial_poll_response,
+	.t1_delay = agilent_82350b_t1_delay,
+	.return_to_local = agilent_82350b_return_to_local,
 };
 
-gpib_interface_t agilent_82350b_interface = {
-name: "agilent_82350b",
-attach : agilent_82350b_accel_attach,
-detach : agilent_82350b_detach,
-read : agilent_82350b_accel_read,
-write : agilent_82350b_accel_write,
-command : agilent_82350b_command,
-request_system_control : agilent_82350b_request_system_control,
-take_control : agilent_82350b_take_control,
-go_to_standby : agilent_82350b_go_to_standby,
-interface_clear : agilent_82350b_interface_clear,
-remote_enable : agilent_82350b_remote_enable,
-enable_eos : agilent_82350b_enable_eos,
-disable_eos : agilent_82350b_disable_eos,
-parallel_poll : agilent_82350b_parallel_poll,
-parallel_poll_configure : agilent_82350b_parallel_poll_configure,
-parallel_poll_response : agilent_82350b_parallel_poll_response,
-local_parallel_poll_mode : NULL, // XXX
-line_status : agilent_82350b_line_status,
-update_status : agilent_82350b_update_status,
-primary_address : agilent_82350b_primary_address,
-secondary_address : agilent_82350b_secondary_address,
-serial_poll_response : agilent_82350b_serial_poll_response,
-t1_delay : agilent_82350b_t1_delay,
-return_to_local : agilent_82350b_return_to_local,
+static gpib_interface_t agilent_82350b_interface = {
+	.name = "agilent_82350b",
+	.attach = agilent_82350b_accel_attach,
+	.detach = agilent_82350b_detach,
+	.read = agilent_82350b_accel_read,
+	.write = agilent_82350b_accel_write,
+	.command = agilent_82350b_command,
+	.request_system_control = agilent_82350b_request_system_control,
+	.take_control = agilent_82350b_take_control,
+	.go_to_standby = agilent_82350b_go_to_standby,
+	.interface_clear = agilent_82350b_interface_clear,
+	.remote_enable = agilent_82350b_remote_enable,
+	.enable_eos = agilent_82350b_enable_eos,
+	.disable_eos = agilent_82350b_disable_eos,
+	.parallel_poll = agilent_82350b_parallel_poll,
+	.parallel_poll_configure = agilent_82350b_parallel_poll_configure,
+	.parallel_poll_response = agilent_82350b_parallel_poll_response,
+	.local_parallel_poll_mode = NULL, // XXX
+	.line_status = agilent_82350b_line_status,
+	.update_status = agilent_82350b_update_status,
+	.primary_address = agilent_82350b_primary_address,
+	.secondary_address = agilent_82350b_secondary_address,
+	.serial_poll_response = agilent_82350b_serial_poll_response,
+	.t1_delay = agilent_82350b_t1_delay,
+	.return_to_local = agilent_82350b_return_to_local,
 };
 
 static int agilent_82350b_pci_probe(struct pci_dev *dev, const struct pci_device_id *id)
drivers/staging/gpib/agilent_82350b/agilent_82350b.h +0 -2
index 30683d67d170..6915c1b2c85b 100644
@@ -60,8 +60,6 @@ struct agilent_82350b_priv {
 // driver name
 extern const char *driver_name;
 
-// interfaces
-extern gpib_interface_t agilent_82350b_interface;
 // init functions
 
 int agilent_82350b_unaccel_attach(gpib_board_t *board, const gpib_board_config_t *config);
drivers/staging/gpib/agilent_82357a/agilent_82357a.c +28 -28

62 lines not on this page · raw message

drivers/staging/gpib/cb7210/cb7210.c +232 -232

490 lines not on this page · raw message

drivers/staging/gpib/cb7210/cb7210.h +0 -5
index 4ad976de2b68..18353b542f9f 100644
@@ -36,11 +36,6 @@ struct cb7210_priv {
 	unsigned in_fifo_half_full : 1;
 };
 
-// interfaces
-extern gpib_interface_t cb_pcmcia_interface;
-extern gpib_interface_t cb_pcmcia_accel_interface;
-extern gpib_interface_t cb_pcmcia_unaccel_interface;
-
 // interrupt service routines
 irqreturn_t cb_pci_interrupt(int irq, void *arg);
 irqreturn_t cb7210_interrupt(int irq, void *arg);
drivers/staging/gpib/cec/cec.h +0 -4
index 352cf83d8328..040ca70ed708 100644
@@ -16,10 +16,6 @@ struct cec_priv  {
 	unsigned int irq;
 };
 
-// interfaces
-extern gpib_interface_t cec_pci_interface;
-extern gpib_interface_t cec_pcmcia_interface;
-
 // interface functions
 int cec_read(gpib_board_t *board, uint8_t *buffer, size_t length, int *end, size_t *bytes_read);
 int cec_write(gpib_board_t *board, uint8_t *buffer, size_t length, int send_eoi,
drivers/staging/gpib/cec/cec_gpib.c +26 -26

58 lines not on this page · raw message

drivers/staging/gpib/eastwood/fluke_gpib.c +75 -75

164 lines not on this page · raw message

drivers/staging/gpib/fmh_gpib/fmh_gpib.c +104 -104

220 lines not on this page · raw message

drivers/staging/gpib/gpio/gpib_bitbang.c +25 -25

56 lines not on this page · raw message

drivers/staging/gpib/hp_82335/hp82335.c +26 -26

58 lines not on this page · raw message

drivers/staging/gpib/hp_82335/hp82335.h +0 -3
index 5e5297af731a..4b185d7c5188 100644
@@ -17,9 +17,6 @@ struct hp82335_priv  {
 	unsigned long raw_iobase;
 };
 
-// interfaces
-extern gpib_interface_t hp82335_interface;
-
 // interface functions
 int hp82335_read(gpib_board_t *board, uint8_t *buffer, size_t length, int *end, size_t *bytes_read);
 int hp82335_write(gpib_board_t *board, uint8_t *buffer, size_t length,
drivers/staging/gpib/hp_82341/hp_82341.c +51 -51

110 lines not on this page · raw message

drivers/staging/gpib/hp_82341/hp_82341.h +0 -2
index 7c391860b399..0065ebd9747c 100644
@@ -26,8 +26,6 @@ struct hp_82341_priv {
 	enum hp_82341_hardware_version hw_version;
 };
 
-// interfaces
-extern gpib_interface_t hp_82341_interface;
 
 // interface functions
 int hp_82341_accel_read(gpib_board_t *board, uint8_t *buffer, size_t length, int *end,
drivers/staging/gpib/ines/ines.h +0 -7
index 7e8302619998..4e243d7951af 100644
@@ -35,13 +35,6 @@ struct ines_priv {
 	u8 extend_mode_bits;
 };
 
-// interfaces
-extern gpib_interface_t ines_pci_interface;
-extern gpib_interface_t ines_pci_accel_interface;
-extern gpib_interface_t ines_pcmcia_interface;
-extern gpib_interface_t ines_pcmcia_accel_interface;
-extern gpib_interface_t ines_pcmcia_unaccel_interface;
-
 // interface functions
 int ines_read(gpib_board_t *board, uint8_t *buffer, size_t length, int *end, size_t *bytes_read);
 int ines_write(gpib_board_t *board, uint8_t *buffer, size_t length,
drivers/staging/gpib/ines/ines_gpib.c +182 -182

386 lines not on this page · raw message

drivers/staging/gpib/lpvo_usb_gpib/lpvo_usb_gpib.c +27 -27

60 lines not on this page · raw message

drivers/staging/gpib/ni_usb/ni_usb_gpib.c +27 -27

60 lines not on this page · raw message

drivers/staging/gpib/pc2/pc2_gpib.c +104 -104

220 lines not on this page · raw message

drivers/staging/gpib/tnt4882/tnt4882_gpib.c +260 -260

545 lines not on this page · raw message

Signature · 1 line
2.47.1