staging: gpib: Removing typedefs
cover staging: gpib: Removing typedefs
Removing various typedefs to adhere to Linux code style.
Reported by checkpatch.pl
In general, a pointer, or a struct that has elements that can reasonably be directly accessed should never be a typedef.
* Patch 1: Removing gpib_event_queue_t for struct gpib_event_queue
* Patch 2: Removing gpib_interface_list_t for struct gpib_interface_list
* Patch 3: Removing gpib_event_t for struct gpib_event
* Patch 4: Removing gpib_status_queue_t for struct gpib_status_queue
* Patch 5: Removing status_byte_t for struct gpib_status_bye
* Patch 6: Removing gpib_descriptor_t for struct gpib_descriptor
* Patch 7: Removing gpib_file_private_t for struct gpib_file_private
Michael Rubin (7):
staging: gpib: Removing typedef gpib_event_queue
staging: gpib: Removing gpib_interface_list_t
staging: gpib: Removing gpib_event_t typedef
staging: gpib: Removing typedef gpib_status_queue
staging: gpib: Removing typedef of status_byte
staging: gpib: Removing typedef gpib_descriptor_t
staging: gpib: Remove typedef gpib_file_private_t
drivers/staging/gpib/common/gpib_os.c | 155 +++++++++++----------- drivers/staging/gpib/common/iblib.c | 12 +- drivers/staging/gpib/common/ibsys.h | 11 +- drivers/staging/gpib/include/gpibP.h | 4 +- drivers/staging/gpib/include/gpib_proto.h | 8 +- drivers/staging/gpib/include/gpib_types.h | 38 +++--- 6 files changed, 116 insertions(+), 112 deletions(-)
Signature · 1 line
2.43.0
PATCH 1/7 staging: gpib: Removing typedef gpib_event_queue
Removing gpib_event_queue_t to adhere to Linux code style.
Reported by checkpatch.pl
In general, a pointer, or a struct that has elements that can reasonably be directly accessed should never be a typedef.
--- drivers/staging/gpib/common/gpib_os.c | 10 +++++----- drivers/staging/gpib/include/gpibP.h | 4 ++-- drivers/staging/gpib/include/gpib_types.h | 8 ++++---- 3 files changed, 11 insertions(+), 11 deletions(-)
drivers/staging/gpib/common/gpib_os.c +5 -5
@@ -74,7 +74,7 @@ static int t1_delay_ioctl(struct gpib_board *board, unsigned long arg);static int cleanup_open_devices (gpib_file_private_t *file_priv,struct gpib_board *board);static int pop_gpib_event_nolock (struct gpib_board *board, -gpib_event_queue_t *queue,short *event_type); +struct gpib_event_queue *queue,short *event_type);/* * Timer functions
@@ -1839,14 +1839,14 @@ static int select_device_path_ioctl(struct gpib_board_config *config, unsigned lreturn 0 ; } -unsigned int num_gpib_events (const gpib_event_queue_t *queue) +unsigned int num_gpib_events (const struct gpib_event_queue *queue) {return queue->num_events; }static int push_gpib_event_nolock (struct gpib_board *board,short event_type) { -gpib_event_queue_t *queue = &board->event_queue; +struct gpib_event_queue *queue = &board->event_queue;struct list_head *head = &queue->event_head;gpib_event_t *event;static const unsigned int max_num_events =1024 ;
@@ -1901,7 +1901,7 @@ int push_gpib_event(struct gpib_board *board, short event_type)EXPORT_SYMBOL (push_gpib_event);static int pop_gpib_event_nolock (struct gpib_board *board, -gpib_event_queue_t *queue,short *event_type) +struct gpib_event_queue *queue,short *event_type) {struct list_head *head = &queue->event_head;struct list_head *front = head->next;
@@ -1935,7 +1935,7 @@ static int pop_gpib_event_nolock(struct gpib_board *board, }// pop event from front of event queue -int pop_gpib_event (struct gpib_board *board,gpib_event_queue_t *queue,short *event_type) +int pop_gpib_event (struct gpib_board *board,struct gpib_event_queue *queue,short *event_type) {unsigned long flags;int retval;
drivers/staging/gpib/include/gpibP.h +2 -2
@@ -25,9 +25,9 @@ struct pci_dev *gpib_pci_get_device(const struct gpib_board_config *config, unsistruct pci_dev *gpib_pci_get_subsys (const struct gpib_board_config *config,unsigned int vendor_id,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); +unsigned int num_gpib_events (const struct gpib_event_queue *queue);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 pop_gpib_event (struct gpib_board *board,struct gpib_event_queue *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);
drivers/staging/gpib/include/gpib_types.h +4 -4
@@ -178,14 +178,14 @@ struct gpib_interface { unsigned skip_check_for_command_acceptors : 1; }; -typedef struct { +struct gpib_event_queue {struct list_head event_head;spinlock_t lock;// for access to event list unsigned int num_events;unsigned dropped_event :1 ; -}gpib_event_queue_t ; +}; -static inline void init_event_queue (gpib_event_queue_t *queue) +static inline void init_event_queue (struct gpib_event_queue *queue) {INIT_LIST_HEAD (&queue->event_head); queue->num_events =0 ;
@@ -283,7 +283,7 @@ struct gpib_board {/* autospoll kernel thread */ struct task_struct *autospoll_task;/* queue for recording received trigger/clear/ifc events */ -gpib_event_queue_t event_queue; +struct gpib_event_queue event_queue;/* minor number for this board's device file */ int minor;/* struct to deal with polling mode*/
Signature · 1 line
2.43.0
PATCH 2/7 staging: gpib: Removing gpib_interface_list_t
In reply to Michael RubinRemoving gpib_interface_list_t to adhere to Linux code style.
Reported by checkpatch.pl
In general, a pointer, or a struct that has elements that can reasonably be directly accessed should never be a typedef.
--- drivers/staging/gpib/common/gpib_os.c | 10 +++++----- drivers/staging/gpib/include/gpib_types.h | 4 ++-- 2 files changed, 7 insertions(+), 7 deletions(-)
drivers/staging/gpib/common/gpib_os.c +5 -5
@@ -826,9 +826,9 @@ static int board_type_ioctl(gpib_file_private_t *file_priv,for (list_ptr = registered_drivers.next; list_ptr != ®istered_drivers; list_ptr = list_ptr->next) { -gpib_interface_list_t *entry; +struct gpib_interface_list *entry; - entry =list_entry (list_ptr, gpib_interface_list_t, list); + entry = list_entry(list_ptr, struct gpib_interface_list, list);if (strcmp (entry->interface->name, cmd.name) ==0 ) {int i;int had_module = file_priv->got_module;
@@ -2026,7 +2026,7 @@ void init_gpib_descriptor(gpib_descriptor_t *desc)int gpib_register_driver (struct gpib_interface *interface,struct module *provider_module) { -struct gpib_interface_list_struct *entry; +struct gpib_interface_list *entry; entry =kmalloc (sizeof (*entry),GFP_KERNEL );if (!entry)
@@ -2057,9 +2057,9 @@ void gpib_unregister_driver(struct gpib_interface *interface) } }for (list_ptr = registered_drivers.next; list_ptr != ®istered_drivers;) { -gpib_interface_list_t *entry; +struct gpib_interface_list *entry; - entry =list_entry (list_ptr, gpib_interface_list_t, list); + entry = list_entry(list_ptr, struct gpib_interface_list, list); list_ptr = list_ptr->next;if (entry->interface == interface) {list_del (&entry->list);
drivers/staging/gpib/include/gpib_types.h +2 -2
@@ -209,11 +209,11 @@ static inline void init_gpib_pseudo_irq(struct gpib_pseudo_irq *pseudo_irq) }/* list so we can make a linked list of drivers */ -typedef struct gpib_interface_list_struct { +struct gpib_interface_list {struct list_head list;struct gpib_interface *interface;struct module *module; -}gpib_interface_list_t ; +};/* One struct gpib_board is allocated for each physical board in the computer. * It provides storage for variables local to each board, and interface
Signature · 1 line
2.43.0
PATCH 3/7 staging: gpib: Removing gpib_event_t typedef
In reply to Michael RubinRemoving gpib_event_t to adhere to Linux code style.
Reported by checkpatch.pl
In general, a pointer, or a struct that has elements that can reasonably be directly accessed should never be a typedef.
--- drivers/staging/gpib/common/gpib_os.c | 8 ++++---- drivers/staging/gpib/include/gpib_types.h | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-)
drivers/staging/gpib/common/gpib_os.c +4 -4
@@ -1848,7 +1848,7 @@ static int push_gpib_event_nolock(struct gpib_board *board, short event_type) {struct gpib_event_queue *queue = &board->event_queue;struct list_head *head = &queue->event_head; -gpib_event_t *event; +struct gpib_event *event;static const unsigned int max_num_events =1024 ;int retval;
@@ -1861,7 +1861,7 @@ static int push_gpib_event_nolock(struct gpib_board *board, short event_type)return retval; } - event =kmalloc (sizeof (gpib_event_t),GFP_ATOMIC ); + event =kmalloc (sizeof (struct gpib_event ),GFP_ATOMIC );if (!event) { queue->dropped_event =1 ;dev_err (board->gpib_dev,"failed to allocate memory for event\n" );
@@ -1905,7 +1905,7 @@ static int pop_gpib_event_nolock(struct gpib_board *board, {struct list_head *head = &queue->event_head;struct list_head *front = head->next; -gpib_event_t *event; +struct gpib_event *event;if (num_gpib_events (queue) ==0 ) { *event_type =EVENT_NONE ;
@@ -1920,7 +1920,7 @@ static int pop_gpib_event_nolock(struct gpib_board *board,return -EPIPE ; } - event =list_entry (front, gpib_event_t, list); + event = list_entry(front, struct gpib_event, list); *event_type = event->event_type;list_del (front);
drivers/staging/gpib/include/gpib_types.h +2 -2
@@ -302,10 +302,10 @@ struct gpib_board { };/* element of event queue */ -typedef struct { +struct gpib_event {struct list_head list;short event_type; -}gpib_event_t ; +};/* Each board has a list of gpib_status_queue_t to keep track of all open devices * on the bus, so we know what address to poll when we get a service request
Signature · 1 line
2.43.0
PATCH 4/7 staging: gpib: Removing typedef gpib_status_queue
In reply to Michael RubinRemoving gpib_status_queue_t to adhere to Linux code style.
Reported by checkpatch.pl
In general, a pointer, or a struct that has elements that can reasonably be directly accessed should never be a typedef.
--- drivers/staging/gpib/common/gpib_os.c | 34 +++++++++++------------ drivers/staging/gpib/common/iblib.c | 6 ++-- drivers/staging/gpib/common/ibsys.h | 11 +++++--- drivers/staging/gpib/include/gpib_proto.h | 2 +- drivers/staging/gpib/include/gpib_types.h | 8 +++--- 5 files changed, 32 insertions(+), 29 deletions(-)
drivers/staging/gpib/common/gpib_os.c +17 -17
@@ -172,7 +172,7 @@ EXPORT_SYMBOL(gpib_free_pseudo_irq);static const unsigned int serial_timeout =1000000 ; -unsigned int num_status_bytes (const gpib_status_queue_t *dev) +unsigned int num_status_bytes (const struct gpib_status_queue *dev) {if (!dev)return 0 ;
@@ -180,7 +180,7 @@ unsigned int num_status_bytes(const gpib_status_queue_t *dev) }// push status byte onto back of status byte fifo -int push_status_byte (struct gpib_board *board,gpib_status_queue_t *device,u8 poll_byte) +int push_status_byte (struct gpib_board *board,struct gpib_status_queue *device,u8 poll_byte) {struct list_head *head = &device->status_bytes;status_byte_t *status;
@@ -214,7 +214,7 @@ int push_status_byte(struct gpib_board *board, gpib_status_queue_t *device, u8 p }// pop status byte from front of status byte fifo -int pop_status_byte (struct gpib_board *board,gpib_status_queue_t *device,u8 *poll_byte) +int pop_status_byte (struct gpib_board *board,struct gpib_status_queue *device,u8 *poll_byte) {struct list_head *head = &device->status_bytes;struct list_head *front = head->next;
@@ -245,14 +245,14 @@ int pop_status_byte(struct gpib_board *board, gpib_status_queue_t *device, u8 *preturn 0 ; } -gpib_status_queue_t *get_gpib_status_queue (struct gpib_board *board,unsigned int pad,int sad) +struct gpib_status_queue *get_gpib_status_queue (struct gpib_board *board,unsigned int pad,int sad) { -gpib_status_queue_t *device; +struct gpib_status_queue *device;struct list_head *list_ptr;const struct list_head *head = &board->device_list;for (list_ptr = head->next; list_ptr != head; list_ptr = list_ptr->next) { - device =list_entry (list_ptr, gpib_status_queue_t, list); + device = list_entry(list_ptr, struct gpib_status_queue, list);if (gpib_address_equal (device->pad, device->sad, pad, sad))return device; }
@@ -263,7 +263,7 @@ gpib_status_queue_t *get_gpib_status_queue(struct gpib_board *board, unsigned inint get_serial_poll_byte (struct gpib_board *board,unsigned int pad,int sad,unsigned int usec_timeout,uint8_t *poll_byte) { -gpib_status_queue_t *device; +struct gpib_status_queue *device; device =get_gpib_status_queue (board, pad, sad);if (num_status_bytes (device))
@@ -429,7 +429,7 @@ int serial_poll_all(struct gpib_board *board, unsigned int usec_timeout)int retval =0 ;struct list_head *cur;const struct list_head *head =NULL ; -gpib_status_queue_t *device; +struct gpib_status_queue *device;u8 result;unsigned int num_bytes =0 ;
@@ -442,7 +442,7 @@ int serial_poll_all(struct gpib_board *board, unsigned int usec_timeout)return retval;for (cur = head->next; cur != head; cur = cur->next) { - device =list_entry (cur, gpib_status_queue_t, list); + device = list_entry(cur, struct gpib_status_queue, list); retval =read_serial_poll_byte (board, device->pad, device->sad, usec_timeout, &result);if (retval <0 )
@@ -1092,7 +1092,7 @@ static int write_ioctl(gpib_file_private_t *file_priv, struct gpib_board *board,static int status_bytes_ioctl (struct gpib_board *board,unsigned long arg) { -gpib_status_queue_t *device; +struct gpib_status_queue *device;spoll_bytes_ioctl_t cmd;int retval;
@@ -1117,13 +1117,13 @@ static int increment_open_device_count(struct gpib_board *board, struct list_hea unsigned int pad, int sad) {struct list_head *list_ptr; -gpib_status_queue_t *device; +struct gpib_status_queue *device;/* first see if address has already been opened, then increment * open count */ for (list_ptr = head->next; list_ptr != head; list_ptr = list_ptr->next) { - device =list_entry (list_ptr, gpib_status_queue_t, list); + device = list_entry(list_ptr, struct gpib_status_queue, list);if (gpib_address_equal (device->pad, device->sad, pad, sad)) {dev_dbg (board->gpib_dev,"incrementing open count for pad %i, sad %i\n" , device->pad, device->sad);
@@ -1132,8 +1132,8 @@ static int increment_open_device_count(struct gpib_board *board, struct list_hea } } -/* otherwise we need to allocate a new gpib_status_queue_t */ - device =kmalloc (sizeof (gpib_status_queue_t),GFP_ATOMIC ); +/* otherwise we need to allocate a new struct gpib_status_queue */ + device =kmalloc (sizeof (struct gpib_status_queue ),GFP_ATOMIC );if (!device)return -ENOMEM ;init_gpib_status_queue (device);
@@ -1151,11 +1151,11 @@ static int increment_open_device_count(struct gpib_board *board, struct list_heastatic int subtract_open_device_count (struct gpib_board *board,struct list_head *head,unsigned int pad,int sad,unsigned int count) { -gpib_status_queue_t *device; +struct gpib_status_queue *device;struct list_head *list_ptr;for (list_ptr = head->next; list_ptr != head; list_ptr = list_ptr->next) { - device =list_entry (list_ptr, gpib_status_queue_t, list); + device = list_entry(list_ptr, struct gpib_status_queue, list);if (gpib_address_equal (device->pad, device->sad, pad, sad)) {dev_dbg (board->gpib_dev,"decrementing open count for pad %i, sad %i\n" , device->pad, device->sad);
@@ -2147,7 +2147,7 @@ static void init_board_array(struct gpib_board *board_array, unsigned int length } } -void init_gpib_status_queue (gpib_status_queue_t *device) +void init_gpib_status_queue (struct gpib_status_queue *device) {INIT_LIST_HEAD (&device->list);INIT_LIST_HEAD (&device->status_bytes);
drivers/staging/gpib/common/iblib.c +3 -3
@@ -506,7 +506,7 @@ int ibstatus(struct gpib_board *board)return general_ibstatus (board,NULL ,0 ,0 ,NULL ); } -int general_ibstatus (struct gpib_board *board,const gpib_status_queue_t *device, +int general_ibstatus (struct gpib_board *board,const struct gpib_status_queue *device,int clear_mask,int set_mask,gpib_descriptor_t *desc) {int status =0 ;
@@ -573,7 +573,7 @@ static void init_wait_info(struct wait_info *winfo)timer_setup_on_stack (&winfo->timer, wait_timeout,0 ); } -static int wait_satisfied (struct wait_info *winfo,gpib_status_queue_t *status_queue, +static int wait_satisfied (struct wait_info *winfo,struct gpib_status_queue *status_queue,int wait_mask,int *status,gpib_descriptor_t *desc) {struct gpib_board *board = winfo->board;
@@ -626,7 +626,7 @@ 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 retval = 0; -gpib_status_queue_t *status_queue; +struct gpib_status_queue *status_queue;struct wait_info winfo;if (desc->is_board)
drivers/staging/gpib/common/ibsys.h +7 -4
@@ -22,10 +22,13 @@int gpib_allocate_board (struct gpib_board *board);void gpib_deallocate_board (struct gpib_board *board); -unsigned int num_status_bytes (const gpib_status_queue_t *dev); -int push_status_byte (struct gpib_board *board,gpib_status_queue_t *device,uint8_t poll_byte); -int pop_status_byte (struct gpib_board *board,gpib_status_queue_t *device,uint8_t *poll_byte); -gpib_status_queue_t *get_gpib_status_queue (struct gpib_board *board,unsigned int pad,int sad); +unsigned int num_status_bytes (const struct gpib_status_queue *dev); +int push_status_byte (struct gpib_board *board,struct gpib_status_queue *device, +uint8_t poll_byte); +int pop_status_byte (struct gpib_board *board,struct gpib_status_queue *device, +uint8_t *poll_byte); +struct gpib_status_queue *get_gpib_status_queue (struct gpib_board *board, +unsigned int pad,int sad);int get_serial_poll_byte (struct gpib_board *board,unsigned int pad,int sad,unsigned int usec_timeout,uint8_t *poll_byte);int autopoll_all_devices (struct gpib_board *board);
drivers/staging/gpib/include/gpib_proto.h +1 -1
@@ -48,7 +48,7 @@ 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 (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 general_ibstatus (struct gpib_board *board,const struct gpib_status_queue *device,int clear_mask,int set_mask,gpib_descriptor_t *desc);int io_timed_out (struct gpib_board *board);int ibppc (struct gpib_board *board,uint8_t configuration);
drivers/staging/gpib/include/gpib_types.h +4 -4
@@ -307,10 +307,10 @@ struct gpib_event {short event_type; }; -/* Each board has a list of gpib_status_queue_t to keep track of all open devices +/* Each board has a list of gpib_status_queue to keep track of all open devices * on the bus, so we know what address to poll when we get a service request */ -typedef struct { +struct gpib_status_queue {/* list_head so we can make a linked list of devices */ struct list_head list;unsigned int pad;/* primary gpib address */
@@ -322,14 +322,14 @@ typedef struct {unsigned int reference_count;/* flags loss of status byte error due to limit on size of queue */ unsigned dropped_byte : 1; -} gpib_status_queue_t; +};typedef struct {struct list_head list;u8 poll_byte; }status_byte_t ; -void init_gpib_status_queue (gpib_status_queue_t *device); +void init_gpib_status_queue (struct gpib_status_queue *device);/* Used to store device-descriptor-specific information */ typedef struct {
Signature · 1 line
2.43.0
PATCH 5/7 staging: gpib: Removing typedef of status_byte
In reply to Michael RubinReplacing typedef of status_byte_t with struct gpib_status_byte to adhere to Linux coding style.
Reported by checkpatch.pl
In general, a pointer, or a struct that has elements that can reasonably be directly accessed should never be a typedef.
--- drivers/staging/gpib/common/gpib_os.c | 8 ++++---- drivers/staging/gpib/include/gpib_types.h | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-)
drivers/staging/gpib/common/gpib_os.c +4 -4
@@ -183,7 +183,7 @@ unsigned int num_status_bytes(const struct gpib_status_queue *dev)int push_status_byte (struct gpib_board *board,struct gpib_status_queue *device,u8 poll_byte) {struct list_head *head = &device->status_bytes; -status_byte_t *status; +struct gpib_status_byte *status;static const unsigned int max_num_status_bytes =1024 ;int retval;
@@ -196,7 +196,7 @@ int push_status_byte(struct gpib_board *board, struct gpib_status_queue *device,return retval; } - status =kmalloc (sizeof (status_byte_t),GFP_KERNEL ); + status =kmalloc (sizeof (struct gpib_status_byte ),GFP_KERNEL );if (!status)return -ENOMEM ;
@@ -218,7 +218,7 @@ int pop_status_byte(struct gpib_board *board, struct gpib_status_queue *device, {struct list_head *head = &device->status_bytes;struct list_head *front = head->next; -status_byte_t *status; +struct gpib_status_byte *status;if (num_status_bytes (device) ==0 )return -EIO ;
@@ -231,7 +231,7 @@ int pop_status_byte(struct gpib_board *board, struct gpib_status_queue *device,return -EPIPE ; } - status =list_entry (front, status_byte_t, list); + status = list_entry(front, struct gpib_status_byte, list); *poll_byte = status->poll_byte;list_del (front);
drivers/staging/gpib/include/gpib_types.h +2 -2
@@ -324,10 +324,10 @@ struct gpib_status_queue { unsigned dropped_byte : 1; }; -typedef struct { +struct gpib_status_byte {struct list_head list;u8 poll_byte; -}status_byte_t ; +};void init_gpib_status_queue (struct gpib_status_queue *device);
Signature · 1 line
2.43.0
PATCH 6/7 staging: gpib: Removing typedef gpib_descriptor_t
In reply to Michael RubinRemoving gpib_descriptor_t to adhere to Linux code style.
Reported by checkpatch.pl
In general, a pointer, or a struct that has elements that can reasonably be directly accessed should never be a typedef.
--- drivers/staging/gpib/common/gpib_os.c | 26 +++++++++++------------ drivers/staging/gpib/common/iblib.c | 6 +++--- drivers/staging/gpib/include/gpib_proto.h | 6 +++--- drivers/staging/gpib/include/gpib_types.h | 6 +++--- 4 files changed, 22 insertions(+), 22 deletions(-)
drivers/staging/gpib/common/gpib_os.c +13 -13
@@ -494,7 +494,7 @@ int dvrsp(struct gpib_board *board, unsigned int pad, int sad,return retval; } -static gpib_descriptor_t *handle_to_descriptor (const gpib_file_private_t *file_priv, +static struct gpib_descriptor *handle_to_descriptor (const gpib_file_private_t *file_priv,int handle) {if (handle <0 || handle >=GPIB_MAX_NUM_DESCRIPTORS ) {
@@ -509,7 +509,7 @@ static int init_gpib_file_private(gpib_file_private_t *priv) {memset (priv,0 ,sizeof (*priv));atomic_set (&priv->holding_mutex,0 ); - priv->descriptors[0 ] =kmalloc (sizeof (gpib_descriptor_t),GFP_KERNEL ); + priv->descriptors[0 ] =kmalloc (sizeof (struct gpib_descriptor ),GFP_KERNEL );if (!priv->descriptors[0 ]) {pr_err ("gpib: failed to allocate default board descriptor\n" );return -ENOMEM ;
@@ -563,7 +563,7 @@ int ibclose(struct inode *inode, struct file *filep)unsigned int minor =iminor (inode);struct gpib_board *board;gpib_file_private_t *priv = filep->private_data; -gpib_descriptor_t *desc; +struct gpib_descriptor *desc;if (minor >=GPIB_MAX_NUM_BOARDS ) {pr_err ("gpib: invalid minor number of device file\n" );
@@ -869,7 +869,7 @@ static int read_ioctl(gpib_file_private_t *file_priv, struct gpib_board *board,int end_flag =0 ;int retval;ssize_t read_ret =0 ; -gpib_descriptor_t *desc; +struct gpib_descriptor *desc;size_t nbytes; retval =copy_from_user (&read_cmd, (void __user *)arg,sizeof (read_cmd));
@@ -943,7 +943,7 @@ static int command_ioctl(gpib_file_private_t *file_priv,unsigned long remain;int retval;int fault =0 ; -gpib_descriptor_t *desc; +struct gpib_descriptor *desc;size_t bytes_written;int no_clear_io_in_prog;
@@ -1027,7 +1027,7 @@ static int write_ioctl(gpib_file_private_t *file_priv, struct gpib_board *board,unsigned long remain;int retval =0 ;int fault; -gpib_descriptor_t *desc; +struct gpib_descriptor *desc; fault =copy_from_user (&write_cmd, (void __user *)arg,sizeof (write_cmd));if (fault)
@@ -1189,7 +1189,7 @@ static int cleanup_open_devices(gpib_file_private_t *file_priv, struct gpib_boarint i;for (i =0 ; i <GPIB_MAX_NUM_DESCRIPTORS ; i++) { -gpib_descriptor_t *desc; +struct gpib_descriptor *desc; desc = file_priv->descriptors[i];if (!desc)
@@ -1228,7 +1228,7 @@ static int open_dev_ioctl(struct file *filep, struct gpib_board *board, unsignedmutex_unlock (&file_priv->descriptors_mutex);return -ERANGE ; } - file_priv->descriptors[i] =kmalloc (sizeof (gpib_descriptor_t),GFP_KERNEL ); + file_priv->descriptors[i] =kmalloc (sizeof (struct gpib_descriptor ),GFP_KERNEL );if (!file_priv->descriptors[i]) {mutex_unlock (&file_priv->descriptors_mutex);return -ENOMEM ;
@@ -1311,7 +1311,7 @@ static int wait_ioctl(gpib_file_private_t *file_priv, struct gpib_board *board, {wait_ioctl_t wait_cmd;int retval; -gpib_descriptor_t *desc; +struct gpib_descriptor *desc; retval =copy_from_user (&wait_cmd, (void __user *)arg,sizeof (wait_cmd));if (retval)
@@ -1438,7 +1438,7 @@ static int pad_ioctl(struct gpib_board *board, gpib_file_private_t *file_priv, {pad_ioctl_t cmd;int retval; -gpib_descriptor_t *desc; +struct gpib_descriptor *desc; retval =copy_from_user (&cmd, (void __user *)arg,sizeof (cmd));if (retval)
@@ -1474,7 +1474,7 @@ static int sad_ioctl(struct gpib_board *board, gpib_file_private_t *file_priv, {sad_ioctl_t cmd;int retval; -gpib_descriptor_t *desc; +struct gpib_descriptor *desc; retval =copy_from_user (&cmd, (void __user *)arg,sizeof (cmd));if (retval)
@@ -1600,7 +1600,7 @@ static int autospoll_ioctl(struct gpib_board *board, gpib_file_private_t *file_p {autospoll_ioctl_t enable;int retval; -gpib_descriptor_t *desc; +struct gpib_descriptor *desc; retval =copy_from_user (&enable, (void __user *)arg,sizeof (enable));if (retval)
@@ -2015,7 +2015,7 @@ struct gpib_board board_array[GPIB_MAX_NUM_BOARDS];LIST_HEAD (registered_drivers); -void init_gpib_descriptor (gpib_descriptor_t *desc) +void init_gpib_descriptor (struct gpib_descriptor *desc) { desc->pad =0 ; desc->sad =-1 ;
drivers/staging/gpib/common/iblib.c +3 -3
@@ -507,7 +507,7 @@ int ibstatus(struct gpib_board *board) }int general_ibstatus (struct gpib_board *board,const struct gpib_status_queue *device, -int clear_mask,int set_mask,gpib_descriptor_t *desc) +int clear_mask,int set_mask,struct gpib_descriptor *desc) {int status =0 ;short line_status;
@@ -574,7 +574,7 @@ static void init_wait_info(struct wait_info *winfo) }static int wait_satisfied (struct wait_info *winfo,struct gpib_status_queue *status_queue, -int wait_mask,int *status,gpib_descriptor_t *desc) +int wait_mask,int *status,struct gpib_descriptor *desc) {struct gpib_board *board = winfo->board;int temp_status;
@@ -623,7 +623,7 @@ static void remove_wait_timer(struct wait_info *winfo)* no condition is waited for. */ 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 *status,unsigned long usec_timeout,struct gpib_descriptor *desc) {int retval =0 ;struct gpib_status_queue *status_queue;
drivers/staging/gpib/include/gpib_proto.h +3 -3
@@ -23,7 +23,7 @@ static inline unsigned long usec_to_jiffies(unsigned int usec) };int serial_poll_all (struct gpib_board *board,unsigned int usec_timeout); -void init_gpib_descriptor (gpib_descriptor_t *desc); +void init_gpib_descriptor (struct gpib_descriptor *desc);int dvrsp (struct gpib_board *board,unsigned int pad,int sad,unsigned int usec_timeout,uint8_t *result);int ibAPWait (struct gpib_board *board,int pad);
@@ -45,11 +45,11 @@ 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 *status,unsigned long usec_timeout,struct gpib_descriptor *desc);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 struct gpib_status_queue *device, -int clear_mask,int set_mask,gpib_descriptor_t *desc); +int clear_mask,int set_mask,struct gpib_descriptor *desc);int io_timed_out (struct gpib_board *board);int ibppc (struct gpib_board *board,uint8_t configuration);
drivers/staging/gpib/include/gpib_types.h +3 -3
@@ -332,17 +332,17 @@ struct gpib_status_byte {void init_gpib_status_queue (struct gpib_status_queue *device);/* Used to store device-descriptor-specific information */ -typedef struct { +struct gpib_descriptor {unsigned int pad;/* primary gpib address */ int sad;/* secondary gpib address (negative means disabled) */ atomic_t io_in_progress;unsigned is_board :1 ;unsigned autopoll_enabled :1 ; -}gpib_descriptor_t ; +}; typedef struct { atomic_t holding_mutex; - gpib_descriptor_t *descriptors[GPIB_MAX_NUM_DESCRIPTORS]; + struct gpib_descriptor *descriptors[GPIB_MAX_NUM_DESCRIPTORS]; /* locked while descriptors are being allocated/deallocated */ struct mutex descriptors_mutex; unsigned got_module : 1;
Signature · 1 line
2.43.0
PATCH 7/7 staging: gpib: Remove typedef gpib_file_private_t
In reply to Michael RubinRemoving gpib_file_private_t to adhere to Linux code style.
Reported by checkpatch.pl
In general, a pointer, or a struct that has elements that can reasonably be directly accessed should never be a typedef.
--- drivers/staging/gpib/common/gpib_os.c | 61 ++++++++++++----------- drivers/staging/gpib/include/gpib_types.h | 4 +- 2 files changed, 33 insertions(+), 32 deletions(-)
drivers/staging/gpib/common/gpib_os.c +31 -30
@@ -26,26 +26,27 @@ MODULE_LICENSE("GPL");MODULE_DESCRIPTION ("GPIB base support" );MODULE_ALIAS_CHARDEV_MAJOR (GPIB_CODE ); -static int board_type_ioctl (gpib_file_private_t *file_priv, +static int board_type_ioctl (struct gpib_file_private *file_priv,struct gpib_board *board,unsigned long arg); -static int read_ioctl (gpib_file_private_t *file_priv,struct gpib_board *board, +static int read_ioctl (struct gpib_file_private *file_priv,struct gpib_board *board,unsigned long arg); -static int write_ioctl (gpib_file_private_t *file_priv,struct gpib_board *board, +static int write_ioctl (struct gpib_file_private *file_priv,struct gpib_board *board,unsigned long arg); -static int command_ioctl (gpib_file_private_t *file_priv,struct gpib_board *board, +static int command_ioctl (struct gpib_file_private *file_priv,struct gpib_board *board,unsigned long arg);static int open_dev_ioctl (struct file *filep,struct gpib_board *board,unsigned long arg);static int close_dev_ioctl (struct file *filep,struct gpib_board *board,unsigned long arg);static int serial_poll_ioctl (struct gpib_board *board,unsigned long arg); -static int wait_ioctl (gpib_file_private_t *file_priv,struct gpib_board *board,unsigned long arg); +static int wait_ioctl (struct gpib_file_private *file_priv, +struct gpib_board *board,unsigned long arg);static int parallel_poll_ioctl (struct gpib_board *board,unsigned long arg);static int online_ioctl (struct gpib_board *board,unsigned long arg);static int remote_enable_ioctl (struct gpib_board *board,unsigned long arg);static int take_control_ioctl (struct gpib_board *board,unsigned long arg);static int line_status_ioctl (struct gpib_board *board,unsigned long arg); -static int pad_ioctl (struct gpib_board *board,gpib_file_private_t *file_priv, +static int pad_ioctl (struct gpib_board *board,struct gpib_file_private *file_priv,unsigned long arg); -static int sad_ioctl (struct gpib_board *board,gpib_file_private_t *file_priv, +static int sad_ioctl (struct gpib_board *board,struct gpib_file_private *file_priv,unsigned long arg);static int eos_ioctl (struct gpib_board *board,unsigned long arg);static int request_service_ioctl (struct gpib_board *board,unsigned long arg);
@@ -53,9 +54,9 @@ static int request_service2_ioctl(struct gpib_board *board, unsigned long arg);static int iobase_ioctl (struct gpib_board_config *config,unsigned long arg);static int irq_ioctl (struct gpib_board_config *config,unsigned long arg);static int dma_ioctl (struct gpib_board_config *config,unsigned long arg); -static int autospoll_ioctl (struct gpib_board *board,gpib_file_private_t *file_priv, +static int autospoll_ioctl (struct gpib_board *board,struct gpib_file_private *file_priv,unsigned long arg); -static int mutex_ioctl (struct gpib_board *board,gpib_file_private_t *file_priv, +static int mutex_ioctl (struct gpib_board *board,struct gpib_file_private *file_priv,unsigned long arg);static int timeout_ioctl (struct gpib_board *board,unsigned long arg);static int status_bytes_ioctl (struct gpib_board *board,unsigned long arg);
@@ -71,7 +72,7 @@ static int event_ioctl(struct gpib_board *board, unsigned long arg);static int request_system_control_ioctl (struct gpib_board *board,unsigned long arg);static int t1_delay_ioctl (struct gpib_board *board,unsigned long arg); -static int cleanup_open_devices (gpib_file_private_t *file_priv,struct gpib_board *board); +static int cleanup_open_devices (struct gpib_file_private *file_priv,struct gpib_board *board);static int pop_gpib_event_nolock (struct gpib_board *board,struct gpib_event_queue *queue,short *event_type);
@@ -494,8 +495,8 @@ int dvrsp(struct gpib_board *board, unsigned int pad, int sad,return retval; } -static struct gpib_descriptor *handle_to_descriptor (const gpib_file_private_t *file_priv, -int handle) +static struct gpib_descriptor *handle_to_descriptor (const struct gpib_file_private *file_priv, +int handle) {if (handle <0 || handle >=GPIB_MAX_NUM_DESCRIPTORS ) {pr_err ("gpib: invalid handle %i\n" , handle);
@@ -505,7 +506,7 @@ static struct gpib_descriptor *handle_to_descriptor(const gpib_file_private_t *freturn file_priv->descriptors[handle]; } -static int init_gpib_file_private (gpib_file_private_t *priv) +static int init_gpib_file_private (struct gpib_file_private *priv) {memset (priv,0 ,sizeof (*priv));atomic_set (&priv->holding_mutex,0 );
@@ -524,7 +525,7 @@ int ibopen(struct inode *inode, struct file *filep) {unsigned int minor =iminor (inode);struct gpib_board *board; -gpib_file_private_t *priv; +struct gpib_file_private *priv;if (minor >=GPIB_MAX_NUM_BOARDS ) {pr_err ("gpib: invalid minor number of device file\n" );
@@ -533,12 +534,12 @@ int ibopen(struct inode *inode, struct file *filep) board = &board_array[minor]; - filep->private_data =kmalloc (sizeof (gpib_file_private_t),GFP_KERNEL ); + filep->private_data =kmalloc (sizeof (struct gpib_file_private ),GFP_KERNEL );if (!filep->private_data)return -ENOMEM ; priv = filep->private_data; -init_gpib_file_private ((gpib_file_private_t *)filep->private_data); +init_gpib_file_private ((struct gpib_file_private *)filep->private_data);if (board->use_count ==0 ) {int retval;
@@ -562,7 +563,7 @@ int ibclose(struct inode *inode, struct file *filep) {unsigned int minor =iminor (inode);struct gpib_board *board; -gpib_file_private_t *priv = filep->private_data; +struct gpib_file_private *priv = filep->private_data;struct gpib_descriptor *desc;if (minor >=GPIB_MAX_NUM_BOARDS ) {
@@ -608,7 +609,7 @@ long ibioctl(struct file *filep, unsigned int cmd, unsigned long arg) {unsigned int minor =iminor (filep->f_path.dentry->d_inode);struct gpib_board *board; -gpib_file_private_t *file_priv = filep->private_data; +struct gpib_file_private *file_priv = filep->private_data;long retval = -ENOTTY ;if (minor >=GPIB_MAX_NUM_BOARDS ) {
@@ -808,7 +809,7 @@ long ibioctl(struct file *filep, unsigned int cmd, unsigned long arg)return retval; } -static int board_type_ioctl (gpib_file_private_t *file_priv, +static int board_type_ioctl (struct gpib_file_private *file_priv,struct gpib_board *board,unsigned long arg) {struct list_head *list_ptr;
@@ -860,7 +861,7 @@ static int board_type_ioctl(gpib_file_private_t *file_priv,return -EINVAL ; } -static int read_ioctl (gpib_file_private_t *file_priv,struct gpib_board *board, +static int read_ioctl (struct gpib_file_private *file_priv,struct gpib_board *board,unsigned long arg) {read_write_ioctl_t read_cmd;
@@ -935,7 +936,7 @@ static int read_ioctl(gpib_file_private_t *file_priv, struct gpib_board *board,return read_ret; } -static int command_ioctl (gpib_file_private_t *file_priv, +static int command_ioctl (struct gpib_file_private *file_priv,struct gpib_board *board,unsigned long arg) {read_write_ioctl_t cmd;
@@ -1019,7 +1020,7 @@ static int command_ioctl(gpib_file_private_t *file_priv,return retval; } -static int write_ioctl (gpib_file_private_t *file_priv,struct gpib_board *board, +static int write_ioctl (struct gpib_file_private *file_priv,struct gpib_board *board,unsigned long arg) {read_write_ioctl_t write_cmd;
@@ -1183,7 +1184,7 @@ static inline int decrement_open_device_count(struct gpib_board *board, struct lreturn subtract_open_device_count (board, head, pad, sad,1 ); } -static int cleanup_open_devices (gpib_file_private_t *file_priv,struct gpib_board *board) +static int cleanup_open_devices (struct gpib_file_private *file_priv,struct gpib_board *board) {int retval =0 ;int i;
@@ -1212,7 +1213,7 @@ static int open_dev_ioctl(struct file *filep, struct gpib_board *board, unsigned {open_dev_ioctl_t open_dev_cmd;int retval; -gpib_file_private_t *file_priv = filep->private_data; +struct gpib_file_private *file_priv = filep->private_data;int i; retval =copy_from_user (&open_dev_cmd, (void __user *)arg,sizeof (open_dev_cmd));
@@ -1261,7 +1262,7 @@ static int open_dev_ioctl(struct file *filep, struct gpib_board *board, unsignedstatic int close_dev_ioctl (struct file *filep,struct gpib_board *board,unsigned long arg) {close_dev_ioctl_t cmd; -gpib_file_private_t *file_priv = filep->private_data; +struct gpib_file_private *file_priv = filep->private_data;int retval; retval =copy_from_user (&cmd, (void __user *)arg,sizeof (cmd));
@@ -1306,7 +1307,7 @@ static int serial_poll_ioctl(struct gpib_board *board, unsigned long arg)return 0 ; } -static int wait_ioctl (gpib_file_private_t *file_priv,struct gpib_board *board, +static int wait_ioctl (struct gpib_file_private *file_priv,struct gpib_board *board,unsigned long arg) {wait_ioctl_t wait_cmd;
@@ -1433,7 +1434,7 @@ static int line_status_ioctl(struct gpib_board *board, unsigned long arg)return 0 ; } -static int pad_ioctl (struct gpib_board *board,gpib_file_private_t *file_priv, +static int pad_ioctl (struct gpib_board *board,struct gpib_file_private *file_priv,unsigned long arg) {pad_ioctl_t cmd;
@@ -1469,7 +1470,7 @@ static int pad_ioctl(struct gpib_board *board, gpib_file_private_t *file_priv,return 0 ; } -static int sad_ioctl (struct gpib_board *board,gpib_file_private_t *file_priv, +static int sad_ioctl (struct gpib_board *board,struct gpib_file_private *file_priv,unsigned long arg) {sad_ioctl_t cmd;
@@ -1595,7 +1596,7 @@ static int dma_ioctl(struct gpib_board_config *config, unsigned long arg)return 0 ; } -static int autospoll_ioctl (struct gpib_board *board,gpib_file_private_t *file_priv, +static int autospoll_ioctl (struct gpib_board *board,struct gpib_file_private *file_priv,unsigned long arg) {autospoll_ioctl_t enable;
@@ -1633,7 +1634,7 @@ static int autospoll_ioctl(struct gpib_board *board, gpib_file_private_t *file_preturn retval; } -static int mutex_ioctl (struct gpib_board *board,gpib_file_private_t *file_priv, +static int mutex_ioctl (struct gpib_board *board,struct gpib_file_private *file_priv,unsigned long arg) {int retval, lock_mutex;
drivers/staging/gpib/include/gpib_types.h +2 -2
@@ -340,13 +340,13 @@ struct gpib_descriptor { unsigned autopoll_enabled : 1; }; -typedef struct { +struct gpib_file_private {atomic_t holding_mutex;struct gpib_descriptor *descriptors[GPIB_MAX_NUM_DESCRIPTORS ];/* locked while descriptors are being allocated/deallocated */ struct mutex descriptors_mutex;unsigned got_module :1 ; -}gpib_file_private_t ; +};#endif /* __KERNEL__ */
Signature · 1 line
2.43.0