Skip to content

Commit 50af7be

Browse files
Michael Rubingregkh
authored andcommitted
staging: gpib: struct typing for gpib_gboard_t
Using Linux code style for gpib_board struct. 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 fc2c620 commit 50af7be

File tree

3 files changed

+61
-61
lines changed

3 files changed

+61
-61
lines changed

drivers/staging/gpib/include/gpibP.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,13 +26,13 @@ struct pci_dev *gpib_pci_get_subsys(const gpib_board_config_t *config, unsigned
2626
unsigned int device_id, unsigned int ss_vendor,
2727
unsigned int ss_device, struct pci_dev *from);
2828
unsigned int num_gpib_events(const gpib_event_queue_t *queue);
29-
int push_gpib_event(gpib_board_t *board, short event_type);
30-
int pop_gpib_event(gpib_board_t *board, gpib_event_queue_t *queue, short *event_type);
31-
int gpib_request_pseudo_irq(gpib_board_t *board, irqreturn_t (*handler)(int, void *));
32-
void gpib_free_pseudo_irq(gpib_board_t *board);
29+
int push_gpib_event(struct gpib_board *board, short event_type);
30+
int pop_gpib_event(struct gpib_board *board, gpib_event_queue_t *queue, short *event_type);
31+
int gpib_request_pseudo_irq(struct gpib_board *board, irqreturn_t (*handler)(int, void *));
32+
void gpib_free_pseudo_irq(struct gpib_board *board);
3333
int gpib_match_device_path(struct device *dev, const char *device_path_in);
3434

35-
extern gpib_board_t board_array[GPIB_MAX_NUM_BOARDS];
35+
extern struct gpib_board board_array[GPIB_MAX_NUM_BOARDS];
3636

3737
extern struct list_head registered_drivers;
3838

drivers/staging/gpib/include/gpib_proto.h

Lines changed: 29 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -10,47 +10,47 @@ int ibclose(struct inode *inode, struct file *file);
1010
long ibioctl(struct file *filep, unsigned int cmd, unsigned long arg);
1111
int osInit(void);
1212
void osReset(void);
13-
void os_start_timer(gpib_board_t *board, unsigned int usec_timeout);
14-
void os_remove_timer(gpib_board_t *board);
13+
void os_start_timer(struct gpib_board *board, unsigned int usec_timeout);
14+
void os_remove_timer(struct gpib_board *board);
1515
void osSendEOI(void);
1616
void osSendEOI(void);
17-
void init_gpib_board(gpib_board_t *board);
17+
void init_gpib_board(struct gpib_board *board);
1818
static inline unsigned long usec_to_jiffies(unsigned int usec)
1919
{
2020
unsigned long usec_per_jiffy = 1000000 / HZ;
2121

2222
return 1 + (usec + usec_per_jiffy - 1) / usec_per_jiffy;
2323
};
2424

25-
int serial_poll_all(gpib_board_t *board, unsigned int usec_timeout);
25+
int serial_poll_all(struct gpib_board *board, unsigned int usec_timeout);
2626
void init_gpib_descriptor(gpib_descriptor_t *desc);
27-
int dvrsp(gpib_board_t *board, unsigned int pad, int sad,
27+
int dvrsp(struct gpib_board *board, unsigned int pad, int sad,
2828
unsigned int usec_timeout, uint8_t *result);
29-
int ibAPWait(gpib_board_t *board, int pad);
30-
int ibAPrsp(gpib_board_t *board, int padsad, char *spb);
31-
void ibAPE(gpib_board_t *board, int pad, int v);
32-
int ibcac(gpib_board_t *board, int sync, int fallback_to_async);
33-
int ibcmd(gpib_board_t *board, uint8_t *buf, size_t length, size_t *bytes_written);
34-
int ibgts(gpib_board_t *board);
35-
int ibonline(gpib_board_t *board);
36-
int iboffline(gpib_board_t *board);
37-
int iblines(const gpib_board_t *board, short *lines);
38-
int ibrd(gpib_board_t *board, uint8_t *buf, size_t length, int *end_flag, size_t *bytes_read);
39-
int ibrpp(gpib_board_t *board, uint8_t *buf);
40-
int ibrsv2(gpib_board_t *board, uint8_t status_byte, int new_reason_for_service);
41-
void ibrsc(gpib_board_t *board, int request_control);
42-
int ibsic(gpib_board_t *board, unsigned int usec_duration);
43-
int ibsre(gpib_board_t *board, int enable);
44-
int ibpad(gpib_board_t *board, unsigned int addr);
45-
int ibsad(gpib_board_t *board, int addr);
46-
int ibeos(gpib_board_t *board, int eos, int eosflags);
47-
int ibwait(gpib_board_t *board, int wait_mask, int clear_mask, int set_mask,
29+
int ibAPWait(struct gpib_board *board, int pad);
30+
int ibAPrsp(struct gpib_board *board, int padsad, char *spb);
31+
void ibAPE(struct gpib_board *board, int pad, int v);
32+
int ibcac(struct gpib_board *board, int sync, int fallback_to_async);
33+
int ibcmd(struct gpib_board *board, uint8_t *buf, size_t length, size_t *bytes_written);
34+
int ibgts(struct gpib_board *board);
35+
int ibonline(struct gpib_board *board);
36+
int iboffline(struct gpib_board *board);
37+
int iblines(const struct gpib_board *board, short *lines);
38+
int ibrd(struct gpib_board *board, uint8_t *buf, size_t length, int *end_flag, size_t *bytes_read);
39+
int ibrpp(struct gpib_board *board, uint8_t *buf);
40+
int ibrsv2(struct gpib_board *board, uint8_t status_byte, int new_reason_for_service);
41+
void ibrsc(struct gpib_board *board, int request_control);
42+
int ibsic(struct gpib_board *board, unsigned int usec_duration);
43+
int ibsre(struct gpib_board *board, int enable);
44+
int ibpad(struct gpib_board *board, unsigned int addr);
45+
int ibsad(struct gpib_board *board, int addr);
46+
int ibeos(struct gpib_board *board, int eos, int eosflags);
47+
int ibwait(struct gpib_board *board, int wait_mask, int clear_mask, int set_mask,
4848
int *status, unsigned long usec_timeout, gpib_descriptor_t *desc);
49-
int ibwrt(gpib_board_t *board, uint8_t *buf, size_t cnt, int send_eoi, size_t *bytes_written);
50-
int ibstatus(gpib_board_t *board);
51-
int general_ibstatus(gpib_board_t *board, const gpib_status_queue_t *device,
49+
int ibwrt(struct gpib_board *board, uint8_t *buf, size_t cnt, int send_eoi, size_t *bytes_written);
50+
int ibstatus(struct gpib_board *board);
51+
int general_ibstatus(struct gpib_board *board, const gpib_status_queue_t *device,
5252
int clear_mask, int set_mask, gpib_descriptor_t *desc);
53-
int io_timed_out(gpib_board_t *board);
54-
int ibppc(gpib_board_t *board, uint8_t configuration);
53+
int io_timed_out(struct gpib_board *board);
54+
int ibppc(struct gpib_board *board, uint8_t configuration);
5555

5656
#endif /* GPIB_PROTO_INCLUDED */

drivers/staging/gpib/include/gpib_types.h

Lines changed: 27 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -55,9 +55,9 @@ struct gpib_interface_struct {
5555
/* name of board */
5656
char *name;
5757
/* attach() initializes board and allocates resources */
58-
int (*attach)(gpib_board_t *board, const gpib_board_config_t *config);
58+
int (*attach)(struct gpib_board *board, const gpib_board_config_t *config);
5959
/* detach() shuts down board and frees resources */
60-
void (*detach)(gpib_board_t *board);
60+
void (*detach)(struct gpib_board *board);
6161
/* read() should read at most 'length' bytes from the bus into
6262
* 'buffer'. It should return when it fills the buffer or
6363
* encounters an END (EOI and or EOS if appropriate). It should set 'end'
@@ -68,74 +68,74 @@ struct gpib_interface_struct {
6868
* return indicates error.
6969
* nbytes returns number of bytes read
7070
*/
71-
int (*read)(gpib_board_t *board, uint8_t *buffer, size_t length, int *end,
71+
int (*read)(struct gpib_board *board, uint8_t *buffer, size_t length, int *end,
7272
size_t *bytes_read);
7373
/* write() should write 'length' bytes from buffer to the bus.
7474
* If the boolean value send_eoi is nonzero, then EOI should
7575
* be sent along with the last byte. Returns number of bytes
7676
* written or negative value on error.
7777
*/
78-
int (*write)(gpib_board_t *board, uint8_t *buffer, size_t length, int send_eoi,
78+
int (*write)(struct gpib_board *board, uint8_t *buffer, size_t length, int send_eoi,
7979
size_t *bytes_written);
8080
/* command() writes the command bytes in 'buffer' to the bus
8181
* Returns zero on success or negative value on error.
8282
*/
83-
int (*command)(gpib_board_t *board, uint8_t *buffer, size_t length,
83+
int (*command)(struct gpib_board *board, uint8_t *buffer, size_t length,
8484
size_t *bytes_written);
8585
/* Take control (assert ATN). If 'asyncronous' is nonzero, take
8686
* control asyncronously (assert ATN immediately without waiting
8787
* for other processes to complete first). Should not return
8888
* until board becomes controller in charge. Returns zero no success,
8989
* nonzero on error.
9090
*/
91-
int (*take_control)(gpib_board_t *board, int asyncronous);
91+
int (*take_control)(struct gpib_board *board, int asyncronous);
9292
/* De-assert ATN. Returns zero on success, nonzer on error.
9393
*/
94-
int (*go_to_standby)(gpib_board_t *board);
94+
int (*go_to_standby)(struct gpib_board *board);
9595
/* request/release control of the IFC and REN lines (system controller) */
96-
void (*request_system_control)(gpib_board_t *board, int request_control);
96+
void (*request_system_control)(struct gpib_board *board, int request_control);
9797
/* Asserts or de-asserts 'interface clear' (IFC) depending on
9898
* boolean value of 'assert'
9999
*/
100-
void (*interface_clear)(gpib_board_t *board, int assert);
100+
void (*interface_clear)(struct gpib_board *board, int assert);
101101
/* Sends remote enable command if 'enable' is nonzero, disables remote mode
102102
* if 'enable' is zero
103103
*/
104-
void (*remote_enable)(gpib_board_t *board, int enable);
104+
void (*remote_enable)(struct gpib_board *board, int enable);
105105
/* enable END for reads, when byte 'eos' is received. If
106106
* 'compare_8_bits' is nonzero, then all 8 bits are compared
107107
* with the eos bytes. Otherwise only the 7 least significant
108108
* bits are compared.
109109
*/
110-
int (*enable_eos)(gpib_board_t *board, uint8_t eos, int compare_8_bits);
110+
int (*enable_eos)(struct gpib_board *board, uint8_t eos, int compare_8_bits);
111111
/* disable END on eos byte (END on EOI only)*/
112-
void (*disable_eos)(gpib_board_t *board);
112+
void (*disable_eos)(struct gpib_board *board);
113113
/* configure parallel poll */
114-
void (*parallel_poll_configure)(gpib_board_t *board, uint8_t configuration);
114+
void (*parallel_poll_configure)(struct gpib_board *board, uint8_t configuration);
115115
/* conduct parallel poll */
116-
int (*parallel_poll)(gpib_board_t *board, uint8_t *result);
116+
int (*parallel_poll)(struct gpib_board *board, uint8_t *result);
117117
/* set/clear ist (individual status bit) */
118-
void (*parallel_poll_response)(gpib_board_t *board, int ist);
118+
void (*parallel_poll_response)(struct gpib_board *board, int ist);
119119
/* select local parallel poll configuration mode PP2 versus remote PP1 */
120-
void (*local_parallel_poll_mode)(gpib_board_t *board, int local);
120+
void (*local_parallel_poll_mode)(struct gpib_board *board, int local);
121121
/* Returns current status of the bus lines. Should be set to
122122
* NULL if your board does not have the ability to query the
123123
* state of the bus lines.
124124
*/
125-
int (*line_status)(const gpib_board_t *board);
125+
int (*line_status)(const struct gpib_board *board);
126126
/* updates and returns the board's current status.
127127
* The meaning of the bits are specified in gpib_user.h
128128
* in the IBSTA section. The driver does not need to
129129
* worry about setting the CMPL, END, TIMO, or ERR bits.
130130
*/
131-
unsigned int (*update_status)(gpib_board_t *board, unsigned int clear_mask);
131+
unsigned int (*update_status)(struct gpib_board *board, unsigned int clear_mask);
132132
/* Sets primary address 0-30 for gpib interface card.
133133
*/
134-
int (*primary_address)(gpib_board_t *board, unsigned int address);
134+
int (*primary_address)(struct gpib_board *board, unsigned int address);
135135
/* Sets and enables, or disables secondary address 0-30
136136
* for gpib interface card.
137137
*/
138-
int (*secondary_address)(gpib_board_t *board, unsigned int address,
138+
int (*secondary_address)(struct gpib_board *board, unsigned int address,
139139
int enable);
140140
/* Sets the byte the board should send in response to a serial poll.
141141
* This function should also start or stop requests for service via
@@ -149,7 +149,7 @@ struct gpib_interface_struct {
149149
* by IEEE 488.2 section 11.3.3.4.3 "Allowed Coupled Control of
150150
* STB, reqt, and reqf".
151151
*/
152-
void (*serial_poll_response)(gpib_board_t *board, uint8_t status_byte);
152+
void (*serial_poll_response)(struct gpib_board *board, uint8_t status_byte);
153153
/* Sets the byte the board should send in response to a serial poll.
154154
* This function should also request service via IEEE 488.2 reqt/reqf
155155
* based on MSS (bit 6 of the status_byte) and new_reason_for_service.
@@ -164,15 +164,15 @@ struct gpib_interface_struct {
164164
* If this method is left NULL by the driver, then the user library
165165
* function ibrsv2 will not work.
166166
*/
167-
void (*serial_poll_response2)(gpib_board_t *board, uint8_t status_byte,
167+
void (*serial_poll_response2)(struct gpib_board *board, uint8_t status_byte,
168168
int new_reason_for_service);
169169
/* returns the byte the board will send in response to a serial poll.
170170
*/
171-
uint8_t (*serial_poll_status)(gpib_board_t *board);
171+
uint8_t (*serial_poll_status)(struct gpib_board *board);
172172
/* adjust T1 delay */
173-
unsigned int (*t1_delay)(gpib_board_t *board, unsigned int nano_sec);
173+
unsigned int (*t1_delay)(struct gpib_board *board, unsigned int nano_sec);
174174
/* go to local mode */
175-
void (*return_to_local)(gpib_board_t *board);
175+
void (*return_to_local)(struct gpib_board *board);
176176
/* board does not support 7 bit eos comparisons */
177177
unsigned no_7_bit_eos : 1;
178178
/* skip check for listeners before trying to send command bytes */
@@ -198,7 +198,7 @@ static inline void init_event_queue(gpib_event_queue_t *queue)
198198
struct gpib_pseudo_irq {
199199
struct timer_list timer;
200200
irqreturn_t (*handler)(int irq, void *arg);
201-
gpib_board_t *board;
201+
struct gpib_board *board;
202202
atomic_t active;
203203
};
204204

@@ -216,7 +216,7 @@ typedef struct gpib_interface_list_struct {
216216
struct module *module;
217217
} gpib_interface_list_t;
218218

219-
/* One gpib_board_t is allocated for each physical board in the computer.
219+
/* One struct gpib_board is allocated for each physical board in the computer.
220220
* It provides storage for variables local to each board, and interface
221221
* functions for performing operations on the board
222222
*/

0 commit comments

Comments
 (0)