mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-05-12 19:44:51 -04:00
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 <matchstick@neverthere.org> Acked-By: Dave Penkler <dpenkler@gmail.com> Link: https://lore.kernel.org/r/20250319215924.19387-20-matchstick@neverthere.org Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
fc2c620c39
commit
50af7beb90
@@ -26,13 +26,13 @@ struct pci_dev *gpib_pci_get_subsys(const gpib_board_config_t *config, unsigned
|
||||
unsigned int device_id, unsigned int ss_vendor,
|
||||
unsigned int ss_device, struct pci_dev *from);
|
||||
unsigned int num_gpib_events(const gpib_event_queue_t *queue);
|
||||
int push_gpib_event(gpib_board_t *board, short event_type);
|
||||
int pop_gpib_event(gpib_board_t *board, gpib_event_queue_t *queue, short *event_type);
|
||||
int gpib_request_pseudo_irq(gpib_board_t *board, irqreturn_t (*handler)(int, void *));
|
||||
void gpib_free_pseudo_irq(gpib_board_t *board);
|
||||
int push_gpib_event(struct gpib_board *board, short event_type);
|
||||
int pop_gpib_event(struct gpib_board *board, gpib_event_queue_t *queue, short *event_type);
|
||||
int gpib_request_pseudo_irq(struct gpib_board *board, irqreturn_t (*handler)(int, void *));
|
||||
void gpib_free_pseudo_irq(struct gpib_board *board);
|
||||
int gpib_match_device_path(struct device *dev, const char *device_path_in);
|
||||
|
||||
extern gpib_board_t board_array[GPIB_MAX_NUM_BOARDS];
|
||||
extern struct gpib_board board_array[GPIB_MAX_NUM_BOARDS];
|
||||
|
||||
extern struct list_head registered_drivers;
|
||||
|
||||
|
||||
@@ -10,11 +10,11 @@ int ibclose(struct inode *inode, struct file *file);
|
||||
long ibioctl(struct file *filep, unsigned int cmd, unsigned long arg);
|
||||
int osInit(void);
|
||||
void osReset(void);
|
||||
void os_start_timer(gpib_board_t *board, unsigned int usec_timeout);
|
||||
void os_remove_timer(gpib_board_t *board);
|
||||
void os_start_timer(struct gpib_board *board, unsigned int usec_timeout);
|
||||
void os_remove_timer(struct gpib_board *board);
|
||||
void osSendEOI(void);
|
||||
void osSendEOI(void);
|
||||
void init_gpib_board(gpib_board_t *board);
|
||||
void init_gpib_board(struct gpib_board *board);
|
||||
static inline unsigned long usec_to_jiffies(unsigned int usec)
|
||||
{
|
||||
unsigned long usec_per_jiffy = 1000000 / HZ;
|
||||
@@ -22,35 +22,35 @@ static inline unsigned long usec_to_jiffies(unsigned int usec)
|
||||
return 1 + (usec + usec_per_jiffy - 1) / usec_per_jiffy;
|
||||
};
|
||||
|
||||
int serial_poll_all(gpib_board_t *board, unsigned int usec_timeout);
|
||||
int serial_poll_all(struct gpib_board *board, unsigned int usec_timeout);
|
||||
void init_gpib_descriptor(gpib_descriptor_t *desc);
|
||||
int dvrsp(gpib_board_t *board, unsigned int pad, int sad,
|
||||
int dvrsp(struct gpib_board *board, unsigned int pad, int sad,
|
||||
unsigned int usec_timeout, uint8_t *result);
|
||||
int ibAPWait(gpib_board_t *board, int pad);
|
||||
int ibAPrsp(gpib_board_t *board, int padsad, char *spb);
|
||||
void ibAPE(gpib_board_t *board, int pad, int v);
|
||||
int ibcac(gpib_board_t *board, int sync, int fallback_to_async);
|
||||
int ibcmd(gpib_board_t *board, uint8_t *buf, size_t length, size_t *bytes_written);
|
||||
int ibgts(gpib_board_t *board);
|
||||
int ibonline(gpib_board_t *board);
|
||||
int iboffline(gpib_board_t *board);
|
||||
int iblines(const gpib_board_t *board, short *lines);
|
||||
int ibrd(gpib_board_t *board, uint8_t *buf, size_t length, int *end_flag, size_t *bytes_read);
|
||||
int ibrpp(gpib_board_t *board, uint8_t *buf);
|
||||
int ibrsv2(gpib_board_t *board, uint8_t status_byte, int new_reason_for_service);
|
||||
void ibrsc(gpib_board_t *board, int request_control);
|
||||
int ibsic(gpib_board_t *board, unsigned int usec_duration);
|
||||
int ibsre(gpib_board_t *board, int enable);
|
||||
int ibpad(gpib_board_t *board, unsigned int addr);
|
||||
int ibsad(gpib_board_t *board, int addr);
|
||||
int ibeos(gpib_board_t *board, int eos, int eosflags);
|
||||
int ibwait(gpib_board_t *board, int wait_mask, int clear_mask, int set_mask,
|
||||
int ibAPWait(struct gpib_board *board, int pad);
|
||||
int ibAPrsp(struct gpib_board *board, int padsad, char *spb);
|
||||
void ibAPE(struct gpib_board *board, int pad, int v);
|
||||
int ibcac(struct gpib_board *board, int sync, int fallback_to_async);
|
||||
int ibcmd(struct gpib_board *board, uint8_t *buf, size_t length, size_t *bytes_written);
|
||||
int ibgts(struct gpib_board *board);
|
||||
int ibonline(struct gpib_board *board);
|
||||
int iboffline(struct gpib_board *board);
|
||||
int iblines(const struct gpib_board *board, short *lines);
|
||||
int ibrd(struct gpib_board *board, uint8_t *buf, size_t length, int *end_flag, size_t *bytes_read);
|
||||
int ibrpp(struct gpib_board *board, uint8_t *buf);
|
||||
int ibrsv2(struct gpib_board *board, uint8_t status_byte, int new_reason_for_service);
|
||||
void ibrsc(struct gpib_board *board, int request_control);
|
||||
int ibsic(struct gpib_board *board, unsigned int usec_duration);
|
||||
int ibsre(struct gpib_board *board, int enable);
|
||||
int ibpad(struct gpib_board *board, unsigned int addr);
|
||||
int ibsad(struct gpib_board *board, int addr);
|
||||
int ibeos(struct gpib_board *board, int eos, int eosflags);
|
||||
int ibwait(struct gpib_board *board, int wait_mask, int clear_mask, int set_mask,
|
||||
int *status, unsigned long usec_timeout, gpib_descriptor_t *desc);
|
||||
int ibwrt(gpib_board_t *board, uint8_t *buf, size_t cnt, int send_eoi, size_t *bytes_written);
|
||||
int ibstatus(gpib_board_t *board);
|
||||
int general_ibstatus(gpib_board_t *board, const gpib_status_queue_t *device,
|
||||
int ibwrt(struct gpib_board *board, uint8_t *buf, size_t cnt, int send_eoi, size_t *bytes_written);
|
||||
int ibstatus(struct gpib_board *board);
|
||||
int general_ibstatus(struct gpib_board *board, const gpib_status_queue_t *device,
|
||||
int clear_mask, int set_mask, gpib_descriptor_t *desc);
|
||||
int io_timed_out(gpib_board_t *board);
|
||||
int ibppc(gpib_board_t *board, uint8_t configuration);
|
||||
int io_timed_out(struct gpib_board *board);
|
||||
int ibppc(struct gpib_board *board, uint8_t configuration);
|
||||
|
||||
#endif /* GPIB_PROTO_INCLUDED */
|
||||
|
||||
@@ -55,9 +55,9 @@ struct gpib_interface_struct {
|
||||
/* name of board */
|
||||
char *name;
|
||||
/* attach() initializes board and allocates resources */
|
||||
int (*attach)(gpib_board_t *board, const gpib_board_config_t *config);
|
||||
int (*attach)(struct gpib_board *board, const gpib_board_config_t *config);
|
||||
/* detach() shuts down board and frees resources */
|
||||
void (*detach)(gpib_board_t *board);
|
||||
void (*detach)(struct gpib_board *board);
|
||||
/* read() should read at most 'length' bytes from the bus into
|
||||
* 'buffer'. It should return when it fills the buffer or
|
||||
* encounters an END (EOI and or EOS if appropriate). It should set 'end'
|
||||
@@ -68,19 +68,19 @@ struct gpib_interface_struct {
|
||||
* return indicates error.
|
||||
* nbytes returns number of bytes read
|
||||
*/
|
||||
int (*read)(gpib_board_t *board, uint8_t *buffer, size_t length, int *end,
|
||||
int (*read)(struct gpib_board *board, uint8_t *buffer, size_t length, int *end,
|
||||
size_t *bytes_read);
|
||||
/* write() should write 'length' bytes from buffer to the bus.
|
||||
* If the boolean value send_eoi is nonzero, then EOI should
|
||||
* be sent along with the last byte. Returns number of bytes
|
||||
* written or negative value on error.
|
||||
*/
|
||||
int (*write)(gpib_board_t *board, uint8_t *buffer, size_t length, int send_eoi,
|
||||
int (*write)(struct gpib_board *board, uint8_t *buffer, size_t length, int send_eoi,
|
||||
size_t *bytes_written);
|
||||
/* command() writes the command bytes in 'buffer' to the bus
|
||||
* Returns zero on success or negative value on error.
|
||||
*/
|
||||
int (*command)(gpib_board_t *board, uint8_t *buffer, size_t length,
|
||||
int (*command)(struct gpib_board *board, uint8_t *buffer, size_t length,
|
||||
size_t *bytes_written);
|
||||
/* Take control (assert ATN). If 'asyncronous' is nonzero, take
|
||||
* control asyncronously (assert ATN immediately without waiting
|
||||
@@ -88,54 +88,54 @@ struct gpib_interface_struct {
|
||||
* until board becomes controller in charge. Returns zero no success,
|
||||
* nonzero on error.
|
||||
*/
|
||||
int (*take_control)(gpib_board_t *board, int asyncronous);
|
||||
int (*take_control)(struct gpib_board *board, int asyncronous);
|
||||
/* De-assert ATN. Returns zero on success, nonzer on error.
|
||||
*/
|
||||
int (*go_to_standby)(gpib_board_t *board);
|
||||
int (*go_to_standby)(struct gpib_board *board);
|
||||
/* request/release control of the IFC and REN lines (system controller) */
|
||||
void (*request_system_control)(gpib_board_t *board, int request_control);
|
||||
void (*request_system_control)(struct gpib_board *board, int request_control);
|
||||
/* Asserts or de-asserts 'interface clear' (IFC) depending on
|
||||
* boolean value of 'assert'
|
||||
*/
|
||||
void (*interface_clear)(gpib_board_t *board, int assert);
|
||||
void (*interface_clear)(struct gpib_board *board, int assert);
|
||||
/* Sends remote enable command if 'enable' is nonzero, disables remote mode
|
||||
* if 'enable' is zero
|
||||
*/
|
||||
void (*remote_enable)(gpib_board_t *board, int enable);
|
||||
void (*remote_enable)(struct gpib_board *board, int enable);
|
||||
/* enable END for reads, when byte 'eos' is received. If
|
||||
* 'compare_8_bits' is nonzero, then all 8 bits are compared
|
||||
* with the eos bytes. Otherwise only the 7 least significant
|
||||
* bits are compared.
|
||||
*/
|
||||
int (*enable_eos)(gpib_board_t *board, uint8_t eos, int compare_8_bits);
|
||||
int (*enable_eos)(struct gpib_board *board, uint8_t eos, int compare_8_bits);
|
||||
/* disable END on eos byte (END on EOI only)*/
|
||||
void (*disable_eos)(gpib_board_t *board);
|
||||
void (*disable_eos)(struct gpib_board *board);
|
||||
/* configure parallel poll */
|
||||
void (*parallel_poll_configure)(gpib_board_t *board, uint8_t configuration);
|
||||
void (*parallel_poll_configure)(struct gpib_board *board, uint8_t configuration);
|
||||
/* conduct parallel poll */
|
||||
int (*parallel_poll)(gpib_board_t *board, uint8_t *result);
|
||||
int (*parallel_poll)(struct gpib_board *board, uint8_t *result);
|
||||
/* set/clear ist (individual status bit) */
|
||||
void (*parallel_poll_response)(gpib_board_t *board, int ist);
|
||||
void (*parallel_poll_response)(struct gpib_board *board, int ist);
|
||||
/* select local parallel poll configuration mode PP2 versus remote PP1 */
|
||||
void (*local_parallel_poll_mode)(gpib_board_t *board, int local);
|
||||
void (*local_parallel_poll_mode)(struct gpib_board *board, int local);
|
||||
/* Returns current status of the bus lines. Should be set to
|
||||
* NULL if your board does not have the ability to query the
|
||||
* state of the bus lines.
|
||||
*/
|
||||
int (*line_status)(const gpib_board_t *board);
|
||||
int (*line_status)(const struct gpib_board *board);
|
||||
/* updates and returns the board's current status.
|
||||
* The meaning of the bits are specified in gpib_user.h
|
||||
* in the IBSTA section. The driver does not need to
|
||||
* worry about setting the CMPL, END, TIMO, or ERR bits.
|
||||
*/
|
||||
unsigned int (*update_status)(gpib_board_t *board, unsigned int clear_mask);
|
||||
unsigned int (*update_status)(struct gpib_board *board, unsigned int clear_mask);
|
||||
/* Sets primary address 0-30 for gpib interface card.
|
||||
*/
|
||||
int (*primary_address)(gpib_board_t *board, unsigned int address);
|
||||
int (*primary_address)(struct gpib_board *board, unsigned int address);
|
||||
/* Sets and enables, or disables secondary address 0-30
|
||||
* for gpib interface card.
|
||||
*/
|
||||
int (*secondary_address)(gpib_board_t *board, unsigned int address,
|
||||
int (*secondary_address)(struct gpib_board *board, unsigned int address,
|
||||
int enable);
|
||||
/* Sets the byte the board should send in response to a serial poll.
|
||||
* This function should also start or stop requests for service via
|
||||
@@ -149,7 +149,7 @@ struct gpib_interface_struct {
|
||||
* by IEEE 488.2 section 11.3.3.4.3 "Allowed Coupled Control of
|
||||
* STB, reqt, and reqf".
|
||||
*/
|
||||
void (*serial_poll_response)(gpib_board_t *board, uint8_t status_byte);
|
||||
void (*serial_poll_response)(struct gpib_board *board, uint8_t status_byte);
|
||||
/* Sets the byte the board should send in response to a serial poll.
|
||||
* This function should also request service via IEEE 488.2 reqt/reqf
|
||||
* based on MSS (bit 6 of the status_byte) and new_reason_for_service.
|
||||
@@ -164,15 +164,15 @@ struct gpib_interface_struct {
|
||||
* If this method is left NULL by the driver, then the user library
|
||||
* function ibrsv2 will not work.
|
||||
*/
|
||||
void (*serial_poll_response2)(gpib_board_t *board, uint8_t status_byte,
|
||||
void (*serial_poll_response2)(struct gpib_board *board, uint8_t status_byte,
|
||||
int new_reason_for_service);
|
||||
/* returns the byte the board will send in response to a serial poll.
|
||||
*/
|
||||
uint8_t (*serial_poll_status)(gpib_board_t *board);
|
||||
uint8_t (*serial_poll_status)(struct gpib_board *board);
|
||||
/* adjust T1 delay */
|
||||
unsigned int (*t1_delay)(gpib_board_t *board, unsigned int nano_sec);
|
||||
unsigned int (*t1_delay)(struct gpib_board *board, unsigned int nano_sec);
|
||||
/* go to local mode */
|
||||
void (*return_to_local)(gpib_board_t *board);
|
||||
void (*return_to_local)(struct gpib_board *board);
|
||||
/* board does not support 7 bit eos comparisons */
|
||||
unsigned no_7_bit_eos : 1;
|
||||
/* 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)
|
||||
struct gpib_pseudo_irq {
|
||||
struct timer_list timer;
|
||||
irqreturn_t (*handler)(int irq, void *arg);
|
||||
gpib_board_t *board;
|
||||
struct gpib_board *board;
|
||||
atomic_t active;
|
||||
};
|
||||
|
||||
@@ -216,7 +216,7 @@ typedef struct gpib_interface_list_struct {
|
||||
struct module *module;
|
||||
} gpib_interface_list_t;
|
||||
|
||||
/* One gpib_board_t is allocated for each physical board in the computer.
|
||||
/* One struct gpib_board is allocated for each physical board in the computer.
|
||||
* It provides storage for variables local to each board, and interface
|
||||
* functions for performing operations on the board
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user