drivers: staging: ft1000: Improve coding style
PATCH 1/1 drivers: staging: ft1000: Improve coding style
Improvements include:
- Lines over 80 characters;
- Use pr_info() instead printk(KERN_INFO);
- Removal of typedefs;
- Indentation.
- Fix IOCTL_FT1000_* marcos:
- Add closing brackets;
- remove sizeof (_IOR and _IOW macro can accept types);
- replace _IOW which size of 0 (the last arg) with _IO.
- Actually these macros are not used anywhere and might be removed.
--- drivers/staging/ft1000/ft1000-usb/ft1000_debug.c | 40 +++---- drivers/staging/ft1000/ft1000-usb/ft1000_ioctl.h | 138 ++++++++++++---------- drivers/staging/ft1000/ft1000-usb/ft1000_usb.h | 33 +++--- drivers/staging/ft1000/ft1000.h | 8 +- 4 files changed, 119 insertions(+), 100 deletions(-)
drivers/staging/ft1000/ft1000-usb/ft1000_debug.c +20 -20
@@ -408,17 +408,17 @@ static unsigned int ft1000_poll_dev(struct file *file, poll_table *wait)static long ft1000_ioctl (struct file *file,unsigned int command,unsigned long argument) { -void __user *argp = (void __user *)argument; +void __user *argp = (void __user *) argument;struct ft1000_info *info; -struct ft1000_usb *ft1000dev; -int result=0 ; -int cmd; -int i; -u16 tempword; -unsigned long flags; -struct timeval tv; -IOCTL_GET_VER get_ver_data; -IOCTL_GET_DSP_STAT get_stat_data; +struct ft1000_usb *ft1000dev; +int result =0 ; +int cmd; +int i; +u16 tempword; +unsigned long flags; +struct timeval tv; +struct IOCTL_GET_VER get_ver_data; +struct IOCTL_GET_DSP_STAT get_stat_data;u8 ConnectionMsg[] = {0x00 ,0x44 ,0x10 ,0x20 ,0x80 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x03 ,0x00 ,0x00 ,0x00 ,0x93 ,0x64 ,0x00 ,0x00 ,0x02 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x05 ,0x00 ,0x00 ,0x00 ,0x0a ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x02 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,
@@ -527,15 +527,15 @@ static long ft1000_ioctl(struct file *file, unsigned int command,break ;case IOCTL_SET_DPRAM_CMD : { -IOCTL_DPRAM_BLK *dpram_data =NULL ; -/* IOCTL_DPRAM_COMMAND dpram_command; */ -u16 qtype; -u16 msgsz; +struct IOCTL_DPRAM_BLK *dpram_data =NULL ; +/* struct IOCTL_DPRAM_COMMAND dpram_command; */ +u16 qtype; +u16 msgsz;struct pseudo_hdr *ppseudo_hdr; -u16 *pmsg; -u16 total_len; -u16 app_index; -u16 status; +u16 *pmsg; +u16 total_len; +u16 app_index; +u16 status;/* DEBUG("FT1000:ft1000_ioctl: IOCTL_FT1000_SET_DPRAM called\n");*/
@@ -672,8 +672,8 @@ static long ft1000_ioctl(struct file *file, unsigned int command,case IOCTL_GET_DPRAM_CMD : {struct dpram_blk *pdpram_blk; -IOCTL_DPRAM_BLK __user *pioctl_dpram; -int msglen; +struct IOCTL_DPRAM_BLK __user *pioctl_dpram; +int msglen;/* DEBUG("FT1000:ft1000_ioctl: IOCTL_FT1000_GET_DPRAM called\n"); */
drivers/staging/ft1000/ft1000-usb/ft1000_ioctl.h +76 -62
159 lines not on this page · raw message
drivers/staging/ft1000/ft1000-usb/ft1000_usb.h +18 -15
@@ -14,17 +14,21 @@struct app_info_block {u32 nTxMsg;/* DPRAM msg sent to DSP with app_id */ u32 nRxMsg;/* DPRAM msg rcv from dsp with app_id */ -u32 nTxMsgReject;/* DPRAM msg rejected due to DSP doorbell set */ +u32 nTxMsgReject;/* DPRAM msg rejected due to DSP doorbell +* set +*/ u32 nRxMsgMiss;/* DPRAM msg dropped due to overflow */ struct fown_struct *fileobject;/* Application's file object */ u16 app_id;/* Application id */ int DspBCMsgFlag;int NumOfMsg;/* number of messages queued up */ wait_queue_head_t wait_dpram_msg; -struct list_head app_sqlist;/* link list of msgs for applicaton on slow queue */ +struct list_head app_sqlist;/* link list of msgs for applicaton on +* slow queue +*/ } __packed; -#define DEBUG(args...) printk(KERN_INFO args) +#define DEBUG(args...) pr_info(args)#define FALSE 0#define TRUE 1
@@ -41,9 +45,9 @@ struct app_info_block {/* MEMORY MAP FOR MAGNEMITE */ /* the indexes are swapped comparing to PCMCIA - is it OK or a bug? */ #undef FT1000_MAG_DSP_LED_INDX -#define FT1000_MAG_DSP_LED_INDX 0x1/* dsp led status for PAD device */ +#define FT1000_MAG_DSP_LED_INDX 0x1/* dsp led status for PAD device */ #undef FT1000_MAG_DSP_CON_STATE_INDX -#define FT1000_MAG_DSP_CON_STATE_INDX 0x0/* DSP Connection Status Info */ +#define FT1000_MAG_DSP_CON_STATE_INDX 0x0/* DSP Connection Status Info */ /* Maximum times trying to get ASIC out of reset */ #define MAX_ASIC_RESET_CNT 20
@@ -99,21 +103,21 @@ struct dpram_blk { } __packed;int ft1000_read_register (struct ft1000_usb *ft1000dev, -u16 *Data,u16 nRegIndx); +u16 *Data,u16 nRegIndx);int ft1000_write_register (struct ft1000_usb *ft1000dev,u16 value,u16 nRegIndx);int ft1000_read_dpram32 (struct ft1000_usb *ft1000dev,u16 indx,u8 *buffer,u16 cnt);int ft1000_write_dpram32 (struct ft1000_usb *ft1000dev, -u16 indx,u8 *buffer,u16 cnt); +u16 indx,u8 *buffer,u16 cnt);int ft1000_read_dpram16 (struct ft1000_usb *ft1000dev,u16 indx,u8 *buffer,u8 highlow);int ft1000_write_dpram16 (struct ft1000_usb *ft1000dev, -u16 indx,u16 value,u8 highlow); +u16 indx,u16 value,u8 highlow);int fix_ft1000_read_dpram32 (struct ft1000_usb *ft1000dev, -u16 indx,u8 *buffer); +u16 indx,u8 *buffer);int fix_ft1000_write_dpram32 (struct ft1000_usb *ft1000dev, -u16 indx,u8 *buffer); +u16 indx,u8 *buffer);extern void *pFileStart;extern size_t FileLength;
@@ -125,12 +129,13 @@ int scram_dnldr(struct ft1000_usb *ft1000dev, void *pFileStart,extern struct list_head freercvpool; -extern spinlock_t free_buff_lock;/* lock to arbitrate free buffer list for receive command data */ +/* lock to arbitrate free buffer list for receive command data */ +extern spinlock_t free_buff_lock;int ft1000_create_dev (struct ft1000_usb *dev);void ft1000_destroy_dev (struct net_device *dev);extern void card_send_command (struct ft1000_usb *ft1000dev, -void *ptempbuffer,int size); +void *ptempbuffer,int size);struct dpram_blk *ft1000_get_buffer (struct list_head *bufflist);void ft1000_free_buffer (struct dpram_blk *pdpram_blk,struct list_head *plist);
@@ -145,6 +150,4 @@ int ft1000_poll(void *dev_id);int ft1000_init_proc (struct net_device *dev);void ft1000_cleanup_proc (struct ft1000_info *info); - - -#endif +#endif /* _FT1000_USB_H_ */
drivers/staging/ft1000/ft1000.h +5 -3
@@ -1,8 +1,8 @@/* -* Common structures and definitions for FT1000 Flarion Flash OFDM PCMCIA and USB devices +* Common structures and definitions for FT1000 Flarion Flash OFDM PCMCIA and +* USB devices. * * Originally copyright (c) 2002 Flarion Technologies -* */ #define DSPVERSZ 4
@@ -17,7 +17,9 @@#define MAGNEMITE_ID 0x1a01/* ASIC ID for Magnemite */ /* MEMORY MAP common to both ELECTRABUZZ and MAGNEMITE */ -#define FT1000_REG_DPRAM_ADDR 0x000E/* DPADR - Dual Port Ram Indirect Address Register */ +#define FT1000_REG_DPRAM_ADDR 0x000E/* DPADR - Dual Port Ram Indirect +* Address Register +*/ #define FT1000_REG_SUP_CTRL 0x0020/* HCTR - Host Control Register */ #define FT1000_REG_SUP_STAT 0x0022/* HSTAT - Host Status Register */ #define FT1000_REG_RESET 0x0024/* HCTR - Host Control Register */
Signature · 1 line
1.7.10.4
Quoted 10 lines · Artem Fetishev
Improvements include:
- Lines over 80 characters;
- Usepr_info()insteadprintk(KERN_INFO);
- Removal of typedefs;
- Indentation.
- Fix IOCTL_FT1000_* marcos:
- Add closing brackets;
- remove sizeof (_IORand_IOWmacro can accept types);
- replace_IOWwhich size of 0 (the last arg) with_IO.
- Actually these macros are not used anywhere and might be removed.
Hello Artem.
All of these are nice little fixes, but combined, they are difficult to review.
Could you please separate them into multiple patches, one per line item entry?
Maybe reorder them too doing the indentation fix first and leaving the 80 column changes until last.