Modernize gpib_interface_t initialization and make static
PATCH 1/1 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.
--- .../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/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_82341/hp_82341.c | 102 ++-- drivers/staging/gpib/ines/ines.h | 7 - drivers/staging/gpib/ines/ines_gpib.c | 208 +++---- .../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 +++++++++--------- 17 files changed, 1139 insertions(+), 1152 deletions(-)
drivers/staging/gpib/agilent_82350b/agilent_82350b.c +50 -50
@@ -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
@@ -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/cec/cec.h +0 -4
@@ -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_82341/hp_82341.c +51 -51
110 lines not on this page · raw message
drivers/staging/gpib/ines/ines.h +0 -7
@@ -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 +104 -104
220 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
The subsystem prefix is missing in the subject.
Quoted 14 lines · Dave Penkler
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 syntaxChange the initialization to use the C99 syntax
.field = value;
This also resolves the checkpatch constraint of no indentation.
Quoted 8 lines
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.
The c99 initializers and the making the structs static would ideally be done in separate patches. Splitting up patches is kind of more art than science...
regards,
dan carpenter