Skip to content

Commit 7daafcc

Browse files
Michael Rubingregkh
authored andcommitted
staging: gpib: agilent_82357a: struct gpib_board
Using Linux code style for struct gpib_board. Adhering to Linux code style. In general, a pointer, or a struct that has elements that can reasonably be directly accessed should never be a typedef. Signed-off-by: Michael Rubin <[email protected]> Acked-By: Dave Penkler <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent 53b8698 commit 7daafcc

File tree

1 file changed

+46
-39
lines changed

1 file changed

+46
-39
lines changed

drivers/staging/gpib/agilent_82357a/agilent_82357a.c

Lines changed: 46 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,10 @@ MODULE_DESCRIPTION("GPIB driver for Agilent 82357A/B usb adapters");
2525
static struct usb_interface *agilent_82357a_driver_interfaces[MAX_NUM_82357A_INTERFACES];
2626
static DEFINE_MUTEX(agilent_82357a_hotplug_lock); // protect board insertion and removal
2727

28-
static unsigned int agilent_82357a_update_status(gpib_board_t *board, unsigned int clear_mask);
28+
static unsigned int agilent_82357a_update_status(struct gpib_board *board,
29+
unsigned int clear_mask);
2930

30-
static int agilent_82357a_take_control_internal(gpib_board_t *board, int synchronous);
31+
static int agilent_82357a_take_control_internal(struct gpib_board *board, int synchronous);
3132

3233
static void agilent_82357a_bulk_complete(struct urb *urb)
3334
{
@@ -419,10 +420,10 @@ static int agilent_82357a_abort(struct agilent_82357a_priv *a_priv, int flush)
419420
}
420421

421422
// interface functions
422-
int agilent_82357a_command(gpib_board_t *board, uint8_t *buffer, size_t length,
423+
int agilent_82357a_command(struct gpib_board *board, uint8_t *buffer, size_t length,
423424
size_t *bytes_written);
424425

425-
static int agilent_82357a_read(gpib_board_t *board, uint8_t *buffer, size_t length, int *end,
426+
static int agilent_82357a_read(struct gpib_board *board, uint8_t *buffer, size_t length, int *end,
426427
size_t *nbytes)
427428
{
428429
int retval;
@@ -533,8 +534,10 @@ static int agilent_82357a_read(gpib_board_t *board, uint8_t *buffer, size_t leng
533534
return retval;
534535
}
535536

536-
static ssize_t agilent_82357a_generic_write(gpib_board_t *board, uint8_t *buffer, size_t length,
537-
int send_commands, int send_eoi, size_t *bytes_written)
537+
static ssize_t agilent_82357a_generic_write(struct gpib_board *board,
538+
uint8_t *buffer, size_t length,
539+
int send_commands, int send_eoi,
540+
size_t *bytes_written)
538541
{
539542
int retval;
540543
struct agilent_82357a_priv *a_priv = board->private_data;
@@ -672,19 +675,19 @@ static ssize_t agilent_82357a_generic_write(gpib_board_t *board, uint8_t *buffer
672675
return 0;
673676
}
674677

675-
static int agilent_82357a_write(gpib_board_t *board, uint8_t *buffer, size_t length,
676-
int send_eoi, size_t *bytes_written)
678+
static int agilent_82357a_write(struct gpib_board *board, uint8_t *buffer,
679+
size_t length, int send_eoi, size_t *bytes_written)
677680
{
678681
return agilent_82357a_generic_write(board, buffer, length, 0, send_eoi, bytes_written);
679682
}
680683

681-
int agilent_82357a_command(gpib_board_t *board, uint8_t *buffer, size_t length,
684+
int agilent_82357a_command(struct gpib_board *board, uint8_t *buffer, size_t length,
682685
size_t *bytes_written)
683686
{
684687
return agilent_82357a_generic_write(board, buffer, length, 1, 0, bytes_written);
685688
}
686689

687-
int agilent_82357a_take_control_internal(gpib_board_t *board, int synchronous)
690+
int agilent_82357a_take_control_internal(struct gpib_board *board, int synchronous)
688691
{
689692
struct agilent_82357a_priv *a_priv = board->private_data;
690693
struct usb_device *usb_dev = interface_to_usbdev(a_priv->bus_interface);
@@ -703,7 +706,7 @@ int agilent_82357a_take_control_internal(gpib_board_t *board, int synchronous)
703706
return retval;
704707
}
705708

706-
static int agilent_82357a_take_control(gpib_board_t *board, int synchronous)
709+
static int agilent_82357a_take_control(struct gpib_board *board, int synchronous)
707710
{
708711
struct agilent_82357a_priv *a_priv = board->private_data;
709712
const int timeout = 10;
@@ -732,7 +735,7 @@ static int agilent_82357a_take_control(gpib_board_t *board, int synchronous)
732735
return 0;
733736
}
734737

735-
static int agilent_82357a_go_to_standby(gpib_board_t *board)
738+
static int agilent_82357a_go_to_standby(struct gpib_board *board)
736739
{
737740
struct agilent_82357a_priv *a_priv = board->private_data;
738741
struct usb_device *usb_dev;
@@ -752,7 +755,8 @@ static int agilent_82357a_go_to_standby(gpib_board_t *board)
752755
}
753756

754757
//FIXME should change prototype to return int
755-
static void agilent_82357a_request_system_control(gpib_board_t *board, int request_control)
758+
static void agilent_82357a_request_system_control(struct gpib_board *board,
759+
int request_control)
756760
{
757761
struct agilent_82357a_priv *a_priv = board->private_data;
758762
struct usb_device *usb_dev;
@@ -784,7 +788,7 @@ static void agilent_82357a_request_system_control(gpib_board_t *board, int reque
784788
return;// retval;
785789
}
786790

787-
static void agilent_82357a_interface_clear(gpib_board_t *board, int assert)
791+
static void agilent_82357a_interface_clear(struct gpib_board *board, int assert)
788792
{
789793
struct agilent_82357a_priv *a_priv = board->private_data;
790794
struct usb_device *usb_dev;
@@ -806,7 +810,7 @@ static void agilent_82357a_interface_clear(gpib_board_t *board, int assert)
806810
dev_err(&usb_dev->dev, "write_registers() returned error\n");
807811
}
808812

809-
static void agilent_82357a_remote_enable(gpib_board_t *board, int enable)
813+
static void agilent_82357a_remote_enable(struct gpib_board *board, int enable)
810814
{
811815
struct agilent_82357a_priv *a_priv = board->private_data;
812816
struct usb_device *usb_dev;
@@ -828,7 +832,8 @@ static void agilent_82357a_remote_enable(gpib_board_t *board, int enable)
828832
return;// 0;
829833
}
830834

831-
static int agilent_82357a_enable_eos(gpib_board_t *board, uint8_t eos_byte, int compare_8_bits)
835+
static int agilent_82357a_enable_eos(struct gpib_board *board, uint8_t eos_byte,
836+
int compare_8_bits)
832837
{
833838
struct agilent_82357a_priv *a_priv = board->private_data;
834839

@@ -842,14 +847,15 @@ static int agilent_82357a_enable_eos(gpib_board_t *board, uint8_t eos_byte, int
842847
return 0;
843848
}
844849

845-
static void agilent_82357a_disable_eos(gpib_board_t *board)
850+
static void agilent_82357a_disable_eos(struct gpib_board *board)
846851
{
847852
struct agilent_82357a_priv *a_priv = board->private_data;
848853

849854
a_priv->eos_mode &= ~REOS;
850855
}
851856

852-
static unsigned int agilent_82357a_update_status(gpib_board_t *board, unsigned int clear_mask)
857+
static unsigned int agilent_82357a_update_status(struct gpib_board *board,
858+
unsigned int clear_mask)
853859
{
854860
struct agilent_82357a_priv *a_priv = board->private_data;
855861
struct usb_device *usb_dev;
@@ -911,7 +917,7 @@ static unsigned int agilent_82357a_update_status(gpib_board_t *board, unsigned i
911917
return board->status;
912918
}
913919

914-
static int agilent_82357a_primary_address(gpib_board_t *board, unsigned int address)
920+
static int agilent_82357a_primary_address(struct gpib_board *board, unsigned int address)
915921
{
916922
struct agilent_82357a_priv *a_priv = board->private_data;
917923
struct usb_device *usb_dev = interface_to_usbdev(a_priv->bus_interface);
@@ -932,14 +938,15 @@ static int agilent_82357a_primary_address(gpib_board_t *board, unsigned int addr
932938
return retval;
933939
}
934940

935-
static int agilent_82357a_secondary_address(gpib_board_t *board, unsigned int address, int enable)
941+
static int agilent_82357a_secondary_address(struct gpib_board *board,
942+
unsigned int address, int enable)
936943
{
937944
if (enable)
938945
return -EOPNOTSUPP;
939946
return 0;
940947
}
941948

942-
static int agilent_82357a_parallel_poll(gpib_board_t *board, uint8_t *result)
949+
static int agilent_82357a_parallel_poll(struct gpib_board *board, uint8_t *result)
943950
{
944951
struct agilent_82357a_priv *a_priv = board->private_data;
945952
struct usb_device *usb_dev;
@@ -981,37 +988,37 @@ static int agilent_82357a_parallel_poll(gpib_board_t *board, uint8_t *result)
981988
return 0;
982989
}
983990

984-
static void agilent_82357a_parallel_poll_configure(gpib_board_t *board, uint8_t config)
991+
static void agilent_82357a_parallel_poll_configure(struct gpib_board *board, uint8_t config)
985992
{
986993
//board can only be system controller
987994
return;// 0;
988995
}
989996

990-
static void agilent_82357a_parallel_poll_response(gpib_board_t *board, int ist)
997+
static void agilent_82357a_parallel_poll_response(struct gpib_board *board, int ist)
991998
{
992999
//board can only be system controller
9931000
return;// 0;
9941001
}
9951002

996-
static void agilent_82357a_serial_poll_response(gpib_board_t *board, uint8_t status)
1003+
static void agilent_82357a_serial_poll_response(struct gpib_board *board, uint8_t status)
9971004
{
9981005
//board can only be system controller
9991006
return;// 0;
10001007
}
10011008

1002-
static uint8_t agilent_82357a_serial_poll_status(gpib_board_t *board)
1009+
static uint8_t agilent_82357a_serial_poll_status(struct gpib_board *board)
10031010
{
10041011
//board can only be system controller
10051012
return 0;
10061013
}
10071014

1008-
static void agilent_82357a_return_to_local(gpib_board_t *board)
1015+
static void agilent_82357a_return_to_local(struct gpib_board *board)
10091016
{
10101017
//board can only be system controller
10111018
return;// 0;
10121019
}
10131020

1014-
static int agilent_82357a_line_status(const gpib_board_t *board)
1021+
static int agilent_82357a_line_status(const struct gpib_board *board)
10151022
{
10161023
struct agilent_82357a_priv *a_priv = board->private_data;
10171024
struct usb_device *usb_dev;
@@ -1064,7 +1071,7 @@ static unsigned short nanosec_to_fast_talker_bits(unsigned int *nanosec)
10641071
return bits;
10651072
}
10661073

1067-
static unsigned int agilent_82357a_t1_delay(gpib_board_t *board, unsigned int nanosec)
1074+
static unsigned int agilent_82357a_t1_delay(struct gpib_board *board, unsigned int nanosec)
10681075
{
10691076
struct agilent_82357a_priv *a_priv = board->private_data;
10701077
struct usb_device *usb_dev;
@@ -1084,7 +1091,7 @@ static unsigned int agilent_82357a_t1_delay(gpib_board_t *board, unsigned int na
10841091

10851092
static void agilent_82357a_interrupt_complete(struct urb *urb)
10861093
{
1087-
gpib_board_t *board = urb->context;
1094+
struct gpib_board *board = urb->context;
10881095
struct agilent_82357a_priv *a_priv = board->private_data;
10891096
struct usb_device *usb_dev = interface_to_usbdev(a_priv->bus_interface);
10901097
int retval;
@@ -1122,7 +1129,7 @@ static void agilent_82357a_interrupt_complete(struct urb *urb)
11221129
dev_err(&usb_dev->dev, "failed to resubmit interrupt urb\n");
11231130
}
11241131

1125-
static int agilent_82357a_setup_urbs(gpib_board_t *board)
1132+
static int agilent_82357a_setup_urbs(struct gpib_board *board)
11261133
{
11271134
struct agilent_82357a_priv *a_priv = board->private_data;
11281135
struct usb_device *usb_dev;
@@ -1186,7 +1193,7 @@ static void agilent_82357a_release_urbs(struct agilent_82357a_priv *a_priv)
11861193
}
11871194
}
11881195

1189-
static int agilent_82357a_allocate_private(gpib_board_t *board)
1196+
static int agilent_82357a_allocate_private(struct gpib_board *board)
11901197
{
11911198
struct agilent_82357a_priv *a_priv;
11921199

@@ -1201,14 +1208,14 @@ static int agilent_82357a_allocate_private(gpib_board_t *board)
12011208
return 0;
12021209
}
12031210

1204-
static void agilent_82357a_free_private(gpib_board_t *board)
1211+
static void agilent_82357a_free_private(struct gpib_board *board)
12051212
{
12061213
kfree(board->private_data);
12071214
board->private_data = NULL;
12081215
}
12091216

12101217
#define INIT_NUM_REG_WRITES 18
1211-
static int agilent_82357a_init(gpib_board_t *board)
1218+
static int agilent_82357a_init(struct gpib_board *board)
12121219
{
12131220
struct agilent_82357a_priv *a_priv = board->private_data;
12141221
struct usb_device *usb_dev = interface_to_usbdev(a_priv->bus_interface);
@@ -1298,7 +1305,7 @@ static inline int agilent_82357a_device_match(struct usb_interface *interface,
12981305
return 1;
12991306
}
13001307

1301-
static int agilent_82357a_attach(gpib_board_t *board, const gpib_board_config_t *config)
1308+
static int agilent_82357a_attach(struct gpib_board *board, const gpib_board_config_t *config)
13021309
{
13031310
int retval;
13041311
int i;
@@ -1374,7 +1381,7 @@ static int agilent_82357a_attach(gpib_board_t *board, const gpib_board_config_t
13741381
return retval;
13751382
}
13761383

1377-
static int agilent_82357a_go_idle(gpib_board_t *board)
1384+
static int agilent_82357a_go_idle(struct gpib_board *board)
13781385
{
13791386
struct agilent_82357a_priv *a_priv = board->private_data;
13801387
struct usb_device *usb_dev = interface_to_usbdev(a_priv->bus_interface);
@@ -1403,7 +1410,7 @@ static int agilent_82357a_go_idle(gpib_board_t *board)
14031410
return 0;
14041411
}
14051412

1406-
static void agilent_82357a_detach(gpib_board_t *board)
1413+
static void agilent_82357a_detach(struct gpib_board *board)
14071414
{
14081415
struct agilent_82357a_priv *a_priv;
14091416

@@ -1511,7 +1518,7 @@ static void agilent_82357a_driver_disconnect(struct usb_interface *interface)
15111518

15121519
for (i = 0; i < MAX_NUM_82357A_INTERFACES; ++i) {
15131520
if (agilent_82357a_driver_interfaces[i] == interface) {
1514-
gpib_board_t *board = usb_get_intfdata(interface);
1521+
struct gpib_board *board = usb_get_intfdata(interface);
15151522

15161523
if (board) {
15171524
struct agilent_82357a_priv *a_priv = board->private_data;
@@ -1547,7 +1554,7 @@ static int agilent_82357a_driver_suspend(struct usb_interface *interface, pm_mes
15471554

15481555
for (i = 0; i < MAX_NUM_82357A_INTERFACES; ++i) {
15491556
if (agilent_82357a_driver_interfaces[i] == interface) {
1550-
gpib_board_t *board = usb_get_intfdata(interface);
1557+
struct gpib_board *board = usb_get_intfdata(interface);
15511558

15521559
if (board) {
15531560
struct agilent_82357a_priv *a_priv = board->private_data;
@@ -1583,7 +1590,7 @@ static int agilent_82357a_driver_suspend(struct usb_interface *interface, pm_mes
15831590
static int agilent_82357a_driver_resume(struct usb_interface *interface)
15841591
{
15851592
struct usb_device *usb_dev = interface_to_usbdev(interface);
1586-
gpib_board_t *board;
1593+
struct gpib_board *board;
15871594
int i, retval;
15881595

15891596
mutex_lock(&agilent_82357a_hotplug_lock);

0 commit comments

Comments
 (0)