staging: kpc2000: whitespace and line length cleanup
cover staging: kpc2000: whitespace and line length cleanup
From: John Hubbard <[email protected]>
Hi everyone,
This is an easy, drive-by cleanup that I did while reviewing Bharath's changes to convert over to put_user_page(). It should make the code less obviously non-conforming, and therefore help future reviews and cleanups.
This is on top of latest linux.git, commit fec88ab0af97 ("Merge tag 'for-linus-hmm' of git://git.kernel.org/pub/scm/linux/kernel/git/rdma/rdma"),
and it does NOT have Bharath's patch applied, so it conflicts (but should be trivial to resolve, regardless of which is applied first, as it's just whitespace).
John Hubbard (1):
staging: kpc2000: whitespace and line length cleanup
drivers/staging/kpc2000/kpc2000_i2c.c | 189 +++++++++++------ drivers/staging/kpc2000/kpc2000_spi.c | 116 +++++----- drivers/staging/kpc2000/kpc_dma/dma.c | 109 ++++++---- drivers/staging/kpc2000/kpc_dma/fileops.c | 199 +++++++++++------- .../staging/kpc2000/kpc_dma/kpc_dma_driver.c | 113 +++++----- .../staging/kpc2000/kpc_dma/kpc_dma_driver.h | 154 +++++++------- 6 files changed, 507 insertions(+), 373 deletions(-)
Signature · 1 line
2.22.0
PATCH 1/1 staging: kpc2000: whitespace and line length cleanup
From: John Hubbard <[email protected]>
This commit was created by running indent(1):
indent -linux
...and then applying some manual corrections and cleanup afterward, to keep it sane. No functional changes were made.
In addition to whitespace changes, some strings were split, but not strings that were likely to be a grep problem (in other words, if a user is likely to grep for a string within the driver, that should still work in most cases).
A few "void * foo" cases were fixed to be "void *foo".
That was enough to make checkpatch.pl run without errors, although note that there are lots of serious warnings remaining--but those require functional, not just whitespace changes. So those are left for a separate patch.
--- drivers/staging/kpc2000/kpc2000_i2c.c | 189 +++++++++++------ drivers/staging/kpc2000/kpc2000_spi.c | 116 +++++----- drivers/staging/kpc2000/kpc_dma/dma.c | 109 ++++++---- drivers/staging/kpc2000/kpc_dma/fileops.c | 199 +++++++++++------- .../staging/kpc2000/kpc_dma/kpc_dma_driver.c | 113 +++++----- .../staging/kpc2000/kpc_dma/kpc_dma_driver.h | 156 +++++++------- 6 files changed, 509 insertions(+), 373 deletions(-)
drivers/staging/kpc2000/kpc2000_i2c.c +124 -65
@@ -33,9 +33,9 @@ MODULE_LICENSE("GPL");MODULE_AUTHOR ("[email protected]" );struct i2c_device { -unsigned long smba; -struct i2c_adapter adapter; -unsigned int features; +unsigned long smba; +struct i2c_adapter adapter; +unsigned int features; };/*****************************
@@ -52,9 +52,9 @@ struct i2c_device {#define SMBHSTDAT0 (p) ((5 * REG_SIZE) + (p)->smba)#define SMBHSTDAT1 (p) ((6 * REG_SIZE) + (p)->smba)#define SMBBLKDAT (p) ((7 * REG_SIZE) + (p)->smba) -#define SMBPEC (p) ((8 * REG_SIZE) + (p)->smba)/* ICH3 and later */ -#define SMBAUXSTS (p) ((12 * REG_SIZE) + (p)->smba)/* ICH4 and later */ -#define SMBAUXCTL (p) ((13 * REG_SIZE) + (p)->smba)/* ICH4 and later */ +#define SMBPEC (p) ((8 * REG_SIZE) + (p)->smba)/* ICH3 and later */ +#define SMBAUXSTS (p) ((12 * REG_SIZE) + (p)->smba)/* ICH4 and later */ +#define SMBAUXCTL (p) ((13 * REG_SIZE) + (p)->smba)/* ICH4 and later */ /* PCI Address Constants */ #define SMBBAR 4
@@ -74,20 +74,20 @@ struct i2c_device {/* Other settings */ #define MAX_RETRIES 400 -#define ENABLE_INT9 0/* set to 0x01 to enable - untested */ +#define ENABLE_INT9 0/* set to 0x01 to enable - untested */ /* I801 command constants */ #define I801_QUICK 0x00#define I801_BYTE 0x04#define I801_BYTE_DATA 0x08#define I801_WORD_DATA 0x0C -#define I801_PROC_CALL 0x10/* unimplemented */ +#define I801_PROC_CALL 0x10/* unimplemented */ #define I801_BLOCK_DATA 0x14 -#define I801_I2C_BLOCK_DATA 0x18/* ICH5 and later */ +#define I801_I2C_BLOCK_DATA 0x18/* ICH5 and later */ #define I801_BLOCK_LAST 0x34 -#define I801_I2C_BLOCK_LAST 0x38/* ICH5 and later */ +#define I801_I2C_BLOCK_LAST 0x38/* ICH5 and later */ #define I801_START 0x40 -#define I801_PEC_EN 0x80/* ICH3 and later */ +#define I801_PEC_EN 0x80/* ICH3 and later */ /* I801 Hosts Status register bits */ #define SMBHSTSTS_BYTE_DONE 0x80
@@ -99,7 +99,9 @@ struct i2c_device {#define SMBHSTSTS_INTR 0x02#define SMBHSTSTS_HOST_BUSY 0x01 -#define STATUS_FLAGS (SMBHSTSTS_BYTE_DONE | SMBHSTSTS_FAILED | SMBHSTSTS_BUS_ERR | SMBHSTSTS_DEV_ERR | SMBHSTSTS_INTR) +#define STATUS_FLAGS \ + (SMBHSTSTS_BYTE_DONE | SMBHSTSTS_FAILED | SMBHSTSTS_BUS_ERR | \ + SMBHSTSTS_DEV_ERR | SMBHSTSTS_INTR)/* Older devices have their ID defined in <linux/pci_ids.h> */ #define PCI_DEVICE_ID_INTEL_COUGARPOINT_SMBUS 0x1c22
@@ -136,17 +138,21 @@ static int i801_check_pre(struct i2c_device *priv) status =inb_p (SMBHSTSTS (priv));if (status &SMBHSTSTS_HOST_BUSY ) { -dev_err (&priv->adapter.dev,"SMBus is busy, can't use it! (status=%x)\n" , status); +dev_err (&priv->adapter.dev, +"SMBus is busy, can't use it! (status=%x)\n" , status);return -EBUSY ; } status &=STATUS_FLAGS ;if (status) { -//dev_dbg(&priv->adapter.dev, "Clearing status flags (%02x)\n", status); +//dev_dbg(&priv->adapter.dev, +//"Clearing status flags (%02x)\n", status); outb_p (status,SMBHSTSTS (priv)); status =inb_p (SMBHSTSTS (priv)) &STATUS_FLAGS ;if (status) { -dev_err (&priv->adapter.dev,"Failed clearing status flags (%02x)\n" , status); +dev_err (&priv->adapter.dev, +"Failed clearing status flags (%02x)\n" , + status);return -EBUSY ; } }
@@ -162,15 +168,20 @@ static int i801_check_post(struct i2c_device *priv, int status, int timeout)if (timeout) {dev_err (&priv->adapter.dev,"Transaction timeout\n" );/* try to stop the current command */ -dev_dbg (&priv->adapter.dev,"Terminating the current operation\n" ); -outb_p (inb_p (SMBHSTCNT (priv)) |SMBHSTCNT_KILL ,SMBHSTCNT (priv)); +dev_dbg (&priv->adapter.dev, +"Terminating the current operation\n" ); +outb_p (inb_p (SMBHSTCNT (priv)) |SMBHSTCNT_KILL , +SMBHSTCNT (priv));usleep_range (1000 ,2000 ); -outb_p (inb_p (SMBHSTCNT (priv)) & (~SMBHSTCNT_KILL ),SMBHSTCNT (priv)); +outb_p (inb_p (SMBHSTCNT (priv)) & (~SMBHSTCNT_KILL ), +SMBHSTCNT (priv));/* Check if it worked */ status =inb_p (SMBHSTSTS (priv)); -if ((status &SMBHSTSTS_HOST_BUSY ) || !(status &SMBHSTSTS_FAILED )) -dev_err (&priv->adapter.dev,"Failed terminating the transaction\n" ); +if ((status &SMBHSTSTS_HOST_BUSY ) + || !(status &SMBHSTSTS_FAILED )) +dev_err (&priv->adapter.dev, +"Failed terminating the transaction\n" );outb_p (STATUS_FLAGS ,SMBHSTSTS (priv));return -ETIMEDOUT ; }
@@ -193,7 +204,9 @@ static int i801_check_post(struct i2c_device *priv, int status, int timeout)outb_p (status &STATUS_FLAGS ,SMBHSTSTS (priv)); status =inb_p (SMBHSTSTS (priv)) &STATUS_FLAGS ;if (status) -dev_warn (&priv->adapter.dev,"Failed clearing status flags at end of transaction (%02x)\n" , status); +dev_warn (&priv->adapter.dev, +"Failed clearing status flags at end of transaction (%02x)\n" , + status); }return result;
@@ -244,12 +257,14 @@ static void i801_wait_hwpec(struct i2c_device *priv)outb_p (status,SMBHSTSTS (priv)); } -static int i801_block_transaction_by_block (struct i2c_device *priv,union i2c_smbus_data *data,char read_write,int hwpec) +static int i801_block_transaction_by_block (struct i2c_device *priv, +union i2c_smbus_data *data, +char read_write,int hwpec) {int i, len;int status; -inb_p (SMBHSTCNT (priv));/* reset the data buffer index */ +inb_p (SMBHSTCNT (priv));/* reset the data buffer index */ /* Use 32-byte buffer to process this transaction */ if (read_write ==I2C_SMBUS_WRITE ) {
@@ -259,7 +274,10 @@ static int i801_block_transaction_by_block(struct i2c_device *priv, union i2c_smoutb_p (data->block[i +1 ],SMBBLKDAT (priv)); } - status =i801_transaction (priv,I801_BLOCK_DATA |ENABLE_INT9 |I801_PEC_EN * hwpec); + status = +i801_transaction (priv, +I801_BLOCK_DATA |ENABLE_INT9 |I801_PEC_EN * + hwpec);if (status)return status;
@@ -275,7 +293,10 @@ static int i801_block_transaction_by_block(struct i2c_device *priv, union i2c_smreturn 0 ; } -static int i801_block_transaction_byte_by_byte (struct i2c_device *priv,union i2c_smbus_data *data,char read_write,int command,int hwpec) +static int i801_block_transaction_byte_by_byte (struct i2c_device *priv, +union i2c_smbus_data *data, +char read_write,int command, +int hwpec) {int i, len;int smbcmd;
@@ -301,7 +322,8 @@ static int i801_block_transaction_byte_by_byte(struct i2c_device *priv, union i2else smbcmd =I801_BLOCK_LAST ; }else { -if (command ==I2C_SMBUS_I2C_BLOCK_DATA && read_write ==I2C_SMBUS_READ ) +if (command ==I2C_SMBUS_I2C_BLOCK_DATA + && read_write ==I2C_SMBUS_READ ) smbcmd =I801_I2C_BLOCK_DATA ;else smbcmd =I801_BLOCK_DATA ;
@@ -309,24 +331,30 @@ static int i801_block_transaction_byte_by_byte(struct i2c_device *priv, union i2outb_p (smbcmd |ENABLE_INT9 ,SMBHSTCNT (priv));if (i ==1 ) -outb_p (inb (SMBHSTCNT (priv)) |I801_START ,SMBHSTCNT (priv)); +outb_p (inb (SMBHSTCNT (priv)) |I801_START , +SMBHSTCNT (priv));/* We will always wait for a fraction of a second! */ timeout =0 ;do {usleep_range (250 ,500 ); status =inb_p (SMBHSTSTS (priv)); - }while ((!(status &SMBHSTSTS_BYTE_DONE )) && (timeout++ <MAX_RETRIES )); + }while ((!(status &SMBHSTSTS_BYTE_DONE )) + && (timeout++ <MAX_RETRIES )); result =i801_check_post (priv, status, timeout >MAX_RETRIES );if (result <0 )return result; -if (i ==1 && read_write ==I2C_SMBUS_READ && command !=I2C_SMBUS_I2C_BLOCK_DATA ) { +if (i ==1 && read_write ==I2C_SMBUS_READ + && command !=I2C_SMBUS_I2C_BLOCK_DATA ) { len =inb_p (SMBHSTDAT0 (priv));if (len <1 || len >I2C_SMBUS_BLOCK_MAX ) { -dev_err (&priv->adapter.dev,"Illegal SMBus block read size %d\n" , len); +dev_err (&priv->adapter.dev, +"Illegal SMBus block read size %d\n" , + len);/* Recover */ while (inb_p (SMBHSTSTS (priv)) &SMBHSTSTS_HOST_BUSY ) -outb_p (SMBHSTSTS_BYTE_DONE ,SMBHSTSTS (priv)); +outb_p (SMBHSTSTS_BYTE_DONE , +SMBHSTSTS (priv));outb_p (SMBHSTSTS_INTR ,SMBHSTSTS (priv));return -EPROTO ; }
@@ -354,7 +382,9 @@ static int i801_set_block_buffer_mode(struct i2c_device *priv) }/* Block transaction function */ -static int i801_block_transaction (struct i2c_device *priv,union i2c_smbus_data *data,char read_write,int command,int hwpec) +static int i801_block_transaction (struct i2c_device *priv, +union i2c_smbus_data *data,char read_write, +int command,int hwpec) {int result =0 ;//unsigned char hostc;
@@ -363,15 +393,19 @@ static int i801_block_transaction(struct i2c_device *priv, union i2c_smbus_dataif (read_write ==I2C_SMBUS_WRITE ) {/* set I2C_EN bit in configuration register */ //TODO: Figure out the right thing to do here... -//pci_read_config_byte(priv->pci_dev, SMBHSTCFG, &hostc); -//pci_write_config_byte(priv->pci_dev, SMBHSTCFG, hostc | SMBHSTCFG_I2C_EN); +//pci_read_config_byte(priv->pci_dev, +// SMBHSTCFG, &hostc); +// pci_write_config_byte(priv->pci_dev, SMBHSTCFG, +// hostc | SMBHSTCFG_I2C_EN); }else if (!(priv->features &FEATURE_I2C_BLOCK_READ )) { -dev_err (&priv->adapter.dev,"I2C block read is unsupported!\n" ); +dev_err (&priv->adapter.dev, +"I2C block read is unsupported!\n" );return -EOPNOTSUPP ; } } -if (read_write ==I2C_SMBUS_WRITE || command ==I2C_SMBUS_I2C_BLOCK_DATA ) { +if (read_write ==I2C_SMBUS_WRITE + || command ==I2C_SMBUS_I2C_BLOCK_DATA ) {if (data->block[0 ] <1 ) data->block[0 ] =1 ;if (data->block[0 ] >I2C_SMBUS_BLOCK_MAX )
@@ -384,13 +418,20 @@ static int i801_block_transaction(struct i2c_device *priv, union i2c_smbus_data* SMBus (not I2C) block transactions, even though the datasheet * doesn't mention this limitation. */ -if ((priv->features &FEATURE_BLOCK_BUFFER ) && command !=I2C_SMBUS_I2C_BLOCK_DATA &&i801_set_block_buffer_mode (priv) ==0 ) - result =i801_block_transaction_by_block (priv, data, read_write, hwpec); +if ((priv->features &FEATURE_BLOCK_BUFFER ) + && command !=I2C_SMBUS_I2C_BLOCK_DATA + &&i801_set_block_buffer_mode (priv) ==0 ) + result = +i801_block_transaction_by_block (priv, data, read_write, + hwpec);else - result =i801_block_transaction_byte_by_byte (priv, data, read_write, command, hwpec); + result = +i801_block_transaction_byte_by_byte (priv, data, read_write, + command, hwpec);if (result ==0 && hwpec)i801_wait_hwpec (priv); -if (command ==I2C_SMBUS_I2C_BLOCK_DATA && read_write ==I2C_SMBUS_WRITE ) { +if (command ==I2C_SMBUS_I2C_BLOCK_DATA + && read_write ==I2C_SMBUS_WRITE ) {/* restore saved configuration register value */ //TODO: Figure out the right thing to do here... //pci_write_config_byte(priv->pci_dev, SMBHSTCFG, hostc);
@@ -399,32 +440,38 @@ static int i801_block_transaction(struct i2c_device *priv, union i2c_smbus_data }/* Return negative errno on error. */ -static s32 i801_access (struct i2c_adapter *adap,u16 addr,unsigned short flags,char read_write,u8 command,int size,union i2c_smbus_data *data) +static s32 i801_access (struct i2c_adapter *adap,u16 addr,unsigned short flags, +char read_write,u8 command,int size, +union i2c_smbus_data *data) {int hwpec;int block =0 ;int ret, xact =0 ;struct i2c_device *priv =i2c_get_adapdata (adap); - hwpec = (priv->features &FEATURE_SMBUS_PEC ) && (flags &I2C_CLIENT_PEC ) && size !=I2C_SMBUS_QUICK && size !=I2C_SMBUS_I2C_BLOCK_DATA ; + hwpec = (priv->features &FEATURE_SMBUS_PEC ) && (flags &I2C_CLIENT_PEC ) + && size !=I2C_SMBUS_QUICK && size !=I2C_SMBUS_I2C_BLOCK_DATA ;switch (size) {case I2C_SMBUS_QUICK :dev_dbg (&priv->adapter.dev," [acc] SMBUS_QUICK\n" ); -outb_p (((addr &0x7f ) <<1 ) | (read_write &0x01 ),SMBHSTADD (priv)); +outb_p (((addr &0x7f ) <<1 ) | (read_write &0x01 ), +SMBHSTADD (priv)); xact =I801_QUICK ;break ;case I2C_SMBUS_BYTE :dev_dbg (&priv->adapter.dev," [acc] SMBUS_BYTE\n" ); -outb_p (((addr &0x7f ) <<1 ) | (read_write &0x01 ),SMBHSTADD (priv)); +outb_p (((addr &0x7f ) <<1 ) | (read_write &0x01 ), +SMBHSTADD (priv));if (read_write ==I2C_SMBUS_WRITE )outb_p (command,SMBHSTCMD (priv)); xact =I801_BYTE ;break ;case I2C_SMBUS_BYTE_DATA :dev_dbg (&priv->adapter.dev," [acc] SMBUS_BYTE_DATA\n" ); -outb_p (((addr &0x7f ) <<1 ) | (read_write &0x01 ),SMBHSTADD (priv)); +outb_p (((addr &0x7f ) <<1 ) | (read_write &0x01 ), +SMBHSTADD (priv));outb_p (command,SMBHSTCMD (priv));if (read_write ==I2C_SMBUS_WRITE )outb_p (data->byte,SMBHSTDAT0 (priv));
@@ -432,7 +479,8 @@ static s32 i801_access(struct i2c_adapter *adap, u16 addr, unsigned short flags,break ;case I2C_SMBUS_WORD_DATA :dev_dbg (&priv->adapter.dev," [acc] SMBUS_WORD_DATA\n" ); -outb_p (((addr &0x7f ) <<1 ) | (read_write &0x01 ),SMBHSTADD (priv)); +outb_p (((addr &0x7f ) <<1 ) | (read_write &0x01 ), +SMBHSTADD (priv));outb_p (command,SMBHSTCMD (priv));if (read_write ==I2C_SMBUS_WRITE ) {outb_p (data->word &0xff ,SMBHSTDAT0 (priv));
@@ -442,7 +490,8 @@ static s32 i801_access(struct i2c_adapter *adap, u16 addr, unsigned short flags,break ;case I2C_SMBUS_BLOCK_DATA :dev_dbg (&priv->adapter.dev," [acc] SMBUS_BLOCK_DATA\n" ); -outb_p (((addr &0x7f ) <<1 ) | (read_write &0x01 ),SMBHSTADD (priv)); +outb_p (((addr &0x7f ) <<1 ) | (read_write &0x01 ), +SMBHSTADD (priv));outb_p (command,SMBHSTCMD (priv)); block =1 ;break ;
@@ -463,22 +512,25 @@ static s32 i801_access(struct i2c_adapter *adap, u16 addr, unsigned short flags, block =1 ;break ;default : -dev_dbg (&priv->adapter.dev," [acc] Unsupported transaction %d\n" , size); +dev_dbg (&priv->adapter.dev, +" [acc] Unsupported transaction %d\n" , size);return -EOPNOTSUPP ; } -if (hwpec) {/* enable/disable hardware PEC */ +if (hwpec) {/* enable/disable hardware PEC */ dev_dbg (&priv->adapter.dev," [acc] hwpec: yes\n" );outb_p (inb_p (SMBAUXCTL (priv)) |SMBAUXCTL_CRC ,SMBAUXCTL (priv)); }else {dev_dbg (&priv->adapter.dev," [acc] hwpec: no\n" ); -outb_p (inb_p (SMBAUXCTL (priv)) & (~SMBAUXCTL_CRC ),SMBAUXCTL (priv)); +outb_p (inb_p (SMBAUXCTL (priv)) & (~SMBAUXCTL_CRC ), +SMBAUXCTL (priv)); }if (block) {//ret = 0; dev_dbg (&priv->adapter.dev," [acc] block: yes\n" ); - ret =i801_block_transaction (priv, data, read_write, size, hwpec); + ret = +i801_block_transaction (priv, data, read_write, size, hwpec); }else {dev_dbg (&priv->adapter.dev," [acc] block: no\n" ); ret =i801_transaction (priv, xact |ENABLE_INT9 );
@@ -490,7 +542,8 @@ static s32 i801_access(struct i2c_adapter *adap, u16 addr, unsigned short flags,*/ if (hwpec || block) {dev_dbg (&priv->adapter.dev," [acc] hwpec || block\n" ); -outb_p (inb_p (SMBAUXCTL (priv)) & ~(SMBAUXCTL_CRC |SMBAUXCTL_E32B ),SMBAUXCTL (priv)); +outb_p (inb_p (SMBAUXCTL (priv)) & + ~(SMBAUXCTL_CRC |SMBAUXCTL_E32B ),SMBAUXCTL (priv)); }if (block) {dev_dbg (&priv->adapter.dev," [acc] block\n" );
@@ -501,19 +554,22 @@ static s32 i801_access(struct i2c_adapter *adap, u16 addr, unsigned short flags,return ret; }if ((read_write ==I2C_SMBUS_WRITE ) || (xact ==I801_QUICK )) { -dev_dbg (&priv->adapter.dev," [acc] I2C_SMBUS_WRITE || I801_QUICK -> ret 0\n" ); +dev_dbg (&priv->adapter.dev, +" [acc] I2C_SMBUS_WRITE || I801_QUICK -> ret 0\n" );return 0 ; }switch (xact &0x7f ) { -case I801_BYTE :/* Result put in SMBHSTDAT0 */ +case I801_BYTE :/* Result put in SMBHSTDAT0 */ case I801_BYTE_DATA : -dev_dbg (&priv->adapter.dev," [acc] I801_BYTE or I801_BYTE_DATA\n" ); +dev_dbg (&priv->adapter.dev, +" [acc] I801_BYTE or I801_BYTE_DATA\n" ); data->byte =inb_p (SMBHSTDAT0 (priv));break ;case I801_WORD_DATA :dev_dbg (&priv->adapter.dev," [acc] I801_WORD_DATA\n" ); - data->word =inb_p (SMBHSTDAT0 (priv)) + (inb_p (SMBHSTDAT1 (priv)) <<8 ); + data->word = +inb_p (SMBHSTDAT0 (priv)) + (inb_p (SMBHSTDAT1 (priv)) <<8 );break ; }return 0 ;
@@ -558,13 +614,14 @@ static u32 i801_func(struct i2c_adapter *adapter)I2C_FUNC_SMBUS_WORD_DATA |/* _READ_WORD_DATA _WRITE_WORD_DATA */ I2C_FUNC_SMBUS_BLOCK_DATA |/* _READ_BLOCK_DATA _WRITE_BLOCK_DATA */ !I2C_FUNC_SMBUS_I2C_BLOCK |/* _READ_I2C_BLOCK _WRITE_I2C_BLOCK */ - !I2C_FUNC_SMBUS_EMUL ;/* _QUICK _BYTE _BYTE_DATA _WORD_DATA _PROC_CALL _WRITE_BLOCK_DATA _I2C_BLOCK _PEC */ +/* _QUICK _BYTE _BYTE_DATA _WORD_DATA _PROC_CALL _WRITE_BLOCK_DATA _I2C_BLOCK _PEC : */ + !I2C_FUNC_SMBUS_EMUL ;return f; }static const struct i2c_algorithm smbus_algorithm = { - .smbus_xfer = i801_access, - .functionality = i801_func, + .smbus_xfer = i801_access, + .functionality = i801_func, };/********************************
@@ -610,8 +667,10 @@ static int pi2c_probe(struct platform_device *pldev)/* Retry up to 3 times on lost arbitration */ priv->adapter.retries =3 ; -//snprintf(priv->adapter.name, sizeof(priv->adapter.name), "Fake SMBus I801 adapter at %04lx", priv->smba); -snprintf (priv->adapter.name,sizeof (priv->adapter.name),"Fake SMBus I801 adapter" ); +//snprintf(priv->adapter.name, sizeof(priv->adapter.name), +// "Fake SMBus I801 adapter at %04lx", priv->smba); +snprintf (priv->adapter.name,sizeof (priv->adapter.name), +"Fake SMBus I801 adapter" ); err =i2c_add_adapter (&priv->adapter);if (err) {
@@ -641,10 +700,10 @@ static int pi2c_remove(struct platform_device *pldev) }static struct platform_driver i2c_plat_driver_i = { - .probe = pi2c_probe, - .remove = pi2c_remove, - .driver = { - .name =KP_DRIVER_NAME_I2C , + .probe = pi2c_probe, + .remove = pi2c_remove, + .driver = { + .name =KP_DRIVER_NAME_I2C , }, };
drivers/staging/kpc2000/kpc2000_spi.c +54 -62
275 lines not on this page · raw message
drivers/staging/kpc2000/kpc_dma/dma.c +68 -41
236 lines not on this page · raw message
drivers/staging/kpc2000/kpc_dma/fileops.c +122 -77
379 lines not on this page · raw message
drivers/staging/kpc2000/kpc_dma/kpc_dma_driver.c +66 -47
224 lines not on this page · raw message
drivers/staging/kpc2000/kpc_dma/kpc_dma_driver.h +75 -81
240 lines not on this page · raw message
Signature · 1 line
2.22.0
Quoted 8 lines · On Mon, 2019-07-15 at 14:21 -0700, [email protected] wrote:
From: John Hubbard <[email protected]>
This commit was created by running indent(1):
indent -linux...and then applying some manual corrections and cleanup afterward, to keep it sane. No functional changes were made.
I don't find many of these whitespace changes "better".
Sometimes, it's just fine to have > 80 char lines.
Alignment formatting was OK before this and now has many odd uses that make reading for a human harder rather than simpler or easier.
drivers/staging/kpc2000/kpc2000_i2c.c
Quoted 1 line
drivers/staging/kpc2000/kpc2000_i2c.c +0
-0
[]
drivers/staging/kpc2000/kpc2000_i2c.c MODULE_LICENSE("GPL"); · line 38
Quoted 10 lines
drivers/staging/kpc2000/kpc2000_i2c.c +3
-3@@ -33,9 +33,9 @@ MODULE_LICENSE("GPL");MODULE_AUTHOR ("[email protected]" );struct i2c_device { -unsigned long smba; -struct i2c_adapter adapter; -unsigned int features; +unsigned long smba; +struct i2c_adapter adapter; +unsigned int features;
Here the spaces before the identifier are converted to tab aligned
drivers/staging/kpc2000/kpc2000_i2c.c struct i2c_device { · line 57
Quoted 13 lines
drivers/staging/kpc2000/kpc2000_i2c.c +3
-3};/***************************** @@ -52,9 +52,9 @@ struct i2c_device {#define SMBHSTDAT0 (p) ((5 * REG_SIZE) + (p)->smba)#define SMBHSTDAT1 (p) ((6 * REG_SIZE) + (p)->smba)#define SMBBLKDAT (p) ((7 * REG_SIZE) + (p)->smba) -#define SMBPEC (p) ((8 * REG_SIZE) + (p)->smba)/* ICH3 and later */ -#define SMBAUXSTS (p) ((12 * REG_SIZE) + (p)->smba)/* ICH4 and later */ -#define SMBAUXCTL (p) ((13 * REG_SIZE) + (p)->smba)/* ICH4 and later */ +#define SMBPEC (p) ((8 * REG_SIZE) + (p)->smba)/* ICH3 and later */ +#define SMBAUXSTS (p) ((12 * REG_SIZE) + (p)->smba)/* ICH4 and later */ +#define SMBAUXCTL (p) ((13 * REG_SIZE) + (p)->smba)/* ICH4 and later */
But here the #define value still has spaces but the comment uses tabs. Why tab align the comments but not the #define value?
drivers/staging/kpc2000/kpc2000_i2c.c static int i801_check_pre(struct i2c_device *priv)
Quoted 1 line
drivers/staging/kpc2000/kpc2000_i2c.c +0
-0@@ -136,17 +138,21 @@ static int i801_check_pre(struct i2c_device *priv)
[]
drivers/staging/kpc2000/kpc2000_i2c.c static int i801_check_pre(struct i2c_device *priv) · line 149
Quoted 5 lines
drivers/staging/kpc2000/kpc2000_i2c.c +2
-1status &=STATUS_FLAGS ;if (status) { -//dev_dbg(&priv->adapter.dev, "Clearing status flags (%02x)\n", status); +//dev_dbg(&priv->adapter.dev, +//"Clearing status flags (%02x)\n", status);
This was better before.
An improvement might be to add more macros like:
#define i2c_err(priv, fmt, ...) dev_err(&(priv)->adapter.dev, fmt, ##__VA_ARGS__) #define i2c_dbg(priv, fmt, ...) dev_dbg(&(priv)->adapter.dev, fmt, ##__VA_ARGS__)
So all these uses of dev_<level>(&priv->adapter.dev, ...) become much shorter visually and the line wrapping becomes rather better.
drivers/staging/kpc2000/kpc2000_i2c.c static int i801_check_pre(struct i2c_device *priv) · line 155
Quoted 7 lines
drivers/staging/kpc2000/kpc2000_i2c.c +3
-1outb_p (status,SMBHSTSTS (priv)); status =inb_p (SMBHSTSTS (priv)) &STATUS_FLAGS ;if (status) { -dev_err (&priv->adapter.dev,"Failed clearing status flags (%02x)\n" , status); +dev_err (&priv->adapter.dev, +"Failed clearing status flags (%02x)\n" , + status);
e.g.:
i2c_err(priv, "Failed clearing status flags (%02x)\n", status);
etc...
[]
drivers/staging/kpc2000/kpc2000_i2c.c static int i801_block_transaction_byte_by_byte(struct i2c_device *priv, union i2 · line 326
Quoted 7 lines
drivers/staging/kpc2000/kpc2000_i2c.c +2
-1@@ -301,7 +322,8 @@ static int i801_block_transaction_byte_by_byte(struct i2c_device *priv, union i2else smbcmd =I801_BLOCK_LAST ; }else { -if (command ==I2C_SMBUS_I2C_BLOCK_DATA && read_write ==I2C_SMBUS_READ ) +if (command ==I2C_SMBUS_I2C_BLOCK_DATA + && read_write ==I2C_SMBUS_READ )
logic continuations should be at EOL.
if (command == I2C_SMBUS_I2C_BLOCK_DATA && read_write == I2C_SMBUS_READ)
[]
Quoted 5 lines
drivers/staging/kpc2000/kpc2000_i2c.c +0
-1@@ -558,13 +614,14 @@ static u32 i801_func(struct i2c_adapter *adapter)I2C_FUNC_SMBUS_WORD_DATA |/* _READ_WORD_DATA _WRITE_WORD_DATA */ I2C_FUNC_SMBUS_BLOCK_DATA |/* _READ_BLOCK_DATA _WRITE_BLOCK_DATA */ !I2C_FUNC_SMBUS_I2C_BLOCK | /* _READ_I2C_BLOCK _WRITE_I2C_BLOCK */ - !I2C_FUNC_SMBUS_EMUL ;/* _QUICK _BYTE _BYTE_DATA _WORD_DATA _PROC_CALL _WRITE_BLOCK_DATA _I2C_BLOCK _PEC */
drivers/staging/kpc2000/kpc2000_i2c.c static u32 i801_func(struct i2c_adapter *adapter) · line 624
Quoted 10 lines
drivers/staging/kpc2000/kpc2000_i2c.c +4
-2+/* _QUICK _BYTE _BYTE_DATA _WORD_DATA _PROC_CALL _WRITE_BLOCK_DATA _I2C_BLOCK _PEC : */ + !I2C_FUNC_SMBUS_EMUL ;return f; }static const struct i2c_algorithm smbus_algorithm = { - .smbus_xfer = i801_access, - .functionality = i801_func, + .smbus_xfer = i801_access, + .functionality = i801_func,
Many people prefer the aligned function names.
etc...
Quoted 6 lines · Joe Perches
Quoted 5 lines · On Mon, 2019-07-15 at 14:21 -0700, [email protected] wrote:
From: John Hubbard <[email protected]>
This commit was created by running indent(1):
indent -linux
Quoted 7 lines
Quoted 3 lines
...and then applying some manual corrections and cleanup afterward, to keep it sane. No functional changes were made.
I don't find many of these whitespace changes "better".
Sometimes, it's just fine to have > 80 char lines.
Definitely agree! :)
Quoted 4 lines
Alignment formatting was OK before this and now has many odd uses that make reading for a human harder rather than simpler or easier.
OK, I'll accept that. I attempted to pick something that fit on the screen [much!] better, without making it less readable, but if people feel that it is a net "worse", then let's just drop the patch, no problem.
Quoted 103 lines
drivers/staging/kpc2000/kpc2000_i2c.c
Quoted 2 lines
drivers/staging/kpc2000/kpc2000_i2c.c +0
-0[]
drivers/staging/kpc2000/kpc2000_i2c.c MODULE_LICENSE("GPL"); · line 38
Quoted 10 lines
drivers/staging/kpc2000/kpc2000_i2c.c +3
-3@@ -33,9 +33,9 @@ MODULE_LICENSE("GPL");MODULE_AUTHOR ("[email protected]" );struct i2c_device { -unsigned long smba; -struct i2c_adapter adapter; -unsigned int features; +unsigned long smba; +struct i2c_adapter adapter; +unsigned int features;Here the spaces before the identifier are converted to tab aligned
drivers/staging/kpc2000/kpc2000_i2c.c struct i2c_device { · line 57
Quoted 13 lines
drivers/staging/kpc2000/kpc2000_i2c.c +3
-3};/***************************** @@ -52,9 +52,9 @@ struct i2c_device {#define SMBHSTDAT0 (p) ((5 * REG_SIZE) + (p)->smba)#define SMBHSTDAT1 (p) ((6 * REG_SIZE) + (p)->smba)#define SMBBLKDAT (p) ((7 * REG_SIZE) + (p)->smba) -#define SMBPEC (p) ((8 * REG_SIZE) + (p)->smba)/* ICH3 and later */ -#define SMBAUXSTS (p) ((12 * REG_SIZE) + (p)->smba)/* ICH4 and later */ -#define SMBAUXCTL (p) ((13 * REG_SIZE) + (p)->smba)/* ICH4 and later */ +#define SMBPEC (p) ((8 * REG_SIZE) + (p)->smba)/* ICH3 and later */ +#define SMBAUXSTS (p) ((12 * REG_SIZE) + (p)->smba)/* ICH4 and later */ +#define SMBAUXCTL (p) ((13 * REG_SIZE) + (p)->smba)/* ICH4 and later */ But here the #define value still has spaces but the comment uses tabs. Why tab align the comments but not the #define value?
drivers/staging/kpc2000/kpc2000_i2c.c static int i801_check_pre(struct i2c_device *priv)
Quoted 1 line
drivers/staging/kpc2000/kpc2000_i2c.c +0
-0@@ -136,17 +138,21 @@ static int i801_check_pre(struct i2c_device *priv)[]
drivers/staging/kpc2000/kpc2000_i2c.c static int i801_check_pre(struct i2c_device *priv) · line 149
Quoted 5 lines
drivers/staging/kpc2000/kpc2000_i2c.c +2
-1status &=STATUS_FLAGS ;if (status) { -//dev_dbg(&priv->adapter.dev, "Clearing status flags (%02x)\n", status); +//dev_dbg(&priv->adapter.dev, +//"Clearing status flags (%02x)\n", status); This was better before.
An improvement might be to add more macros like:
#define i2c_err(priv, fmt, ...) dev_err(&(priv)->adapter.dev, fmt, ##__VA_ARGS__) #define i2c_dbg(priv, fmt, ...) dev_dbg(&(priv)->adapter.dev, fmt, ##__VA_ARGS__)So all these uses of dev_<level>(&priv->adapter.dev, ...) become much shorter visually and the line wrapping becomes rather better.
drivers/staging/kpc2000/kpc2000_i2c.c static int i801_check_pre(struct i2c_device *priv) · line 155
Quoted 7 lines
drivers/staging/kpc2000/kpc2000_i2c.c +3
-1outb_p (status,SMBHSTSTS (priv)); status =inb_p (SMBHSTSTS (priv)) &STATUS_FLAGS ;if (status) { -dev_err (&priv->adapter.dev,"Failed clearing status flags (%02x)\n" , status); +dev_err (&priv->adapter.dev, +"Failed clearing status flags (%02x)\n" , + status);e.g.:
i2c_err(priv, "Failed clearing status flags (%02x)\n", status);etc...
[]
drivers/staging/kpc2000/kpc2000_i2c.c static int i801_block_transaction_byte_by_byte(struct i2c_device *priv, union i2 · line 326
Quoted 7 lines
drivers/staging/kpc2000/kpc2000_i2c.c +2
-1@@ -301,7 +322,8 @@ static int i801_block_transaction_byte_by_byte(struct i2c_device *priv, union i2else smbcmd =I801_BLOCK_LAST ; }else { -if (command ==I2C_SMBUS_I2C_BLOCK_DATA && read_write ==I2C_SMBUS_READ ) +if (command ==I2C_SMBUS_I2C_BLOCK_DATA + && read_write ==I2C_SMBUS_READ )logic continuations should be at EOL.
if (command == I2C_SMBUS_I2C_BLOCK_DATA && read_write == I2C_SMBUS_READ)[]
Quoted 5 lines
drivers/staging/kpc2000/kpc2000_i2c.c +0
-1@@ -558,13 +614,14 @@ static u32 i801_func(struct i2c_adapter *adapter)I2C_FUNC_SMBUS_WORD_DATA |/* _READ_WORD_DATA _WRITE_WORD_DATA */ I2C_FUNC_SMBUS_BLOCK_DATA |/* _READ_BLOCK_DATA _WRITE_BLOCK_DATA */ !I2C_FUNC_SMBUS_I2C_BLOCK | /* _READ_I2C_BLOCK _WRITE_I2C_BLOCK */ - !I2C_FUNC_SMBUS_EMUL ;/* _QUICK _BYTE _BYTE_DATA _WORD_DATA _PROC_CALL _WRITE_BLOCK_DATA _I2C_BLOCK _PEC */ drivers/staging/kpc2000/kpc2000_i2c.c static u32 i801_func(struct i2c_adapter *adapter) · line 624
Quoted 10 lines
drivers/staging/kpc2000/kpc2000_i2c.c +4
-2+/* _QUICK _BYTE _BYTE_DATA _WORD_DATA _PROC_CALL _WRITE_BLOCK_DATA _I2C_BLOCK _PEC : */ + !I2C_FUNC_SMBUS_EMUL ;return f; }static const struct i2c_algorithm smbus_algorithm = { - .smbus_xfer = i801_access, - .functionality = i801_func, + .smbus_xfer = i801_access, + .functionality = i801_func,Many people prefer the aligned function names.
Quoted 2 lines
etc...
Sure. Opinions differ on that, I was guessing that the indent -linux option was the majority, but that could be wrong.
thanks,
Signature · 2 lines
John Hubbard NVIDIA
Greg Kroah-Hartman
maintainerQuoted 30 lines · On Mon, Jul 15, 2019 at 02:21:23PM -0700, [email protected] wrote:
From: John Hubbard <[email protected]>
This commit was created by running indent(1):
indent -linux...and then applying some manual corrections and cleanup afterward, to keep it sane. No functional changes were made.
In addition to whitespace changes, some strings were split, but not strings that were likely to be a grep problem (in other words, if a user is likely to grep for a string within the driver, that should still work in most cases).
A few "void * foo" cases were fixed to be "void *foo".
That was enough to make checkpatch.pl run without errors, although note that there are lots of serious warnings remaining--but those require functional, not just whitespace changes. So those are left for a separate patch.
Cc Greg Kroah-Hartman <[email protected]>Cc Simon Sandström <[email protected]>Cc Geordan Neukum <[email protected]>Cc Jeremy Sowden <[email protected]>Cc Dan Carpenter <[email protected]>Cc Vandana BN <[email protected]>Cc Bharath Vedartham <[email protected]>Signed-off-by John Hubbard <[email protected]>
Quoted 8 lines
--- drivers/staging/kpc2000/kpc2000_i2c.c | 189 +++++++++++------ drivers/staging/kpc2000/kpc2000_spi.c | 116 +++++----- drivers/staging/kpc2000/kpc_dma/dma.c | 109 ++++++---- drivers/staging/kpc2000/kpc_dma/fileops.c | 199 +++++++++++------- .../staging/kpc2000/kpc_dma/kpc_dma_driver.c | 113 +++++----- .../staging/kpc2000/kpc_dma/kpc_dma_driver.h | 156 +++++++------- 6 files changed, 509 insertions(+), 373 deletions(-)
THat's way too many different types of changes to do all at once, and some of these are making the code look worse, not better.
There's a reason we don't run lindent :)
If you want to do one-type-of-fix-per-patch, I'll gladly take these, otherwise, I recommend leaving this for those people learning how to do development to do.
thanks,
greg k-h
Quoted 2 lines · Greg Kroah-Hartman
Quoted 1 line · On Mon, Jul 15, 2019 at 02:21:23PM -0700, [email protected] wrote:
From: John Hubbard <[email protected]>
...
Quoted 8 lines
Quoted 7 lines
drivers/staging/kpc2000/kpc2000_i2c.c | 189 +++++++++++------ drivers/staging/kpc2000/kpc2000_spi.c | 116 +++++----- drivers/staging/kpc2000/kpc_dma/dma.c | 109 ++++++---- drivers/staging/kpc2000/kpc_dma/fileops.c | 199 +++++++++++------- .../staging/kpc2000/kpc_dma/kpc_dma_driver.c | 113 +++++----- .../staging/kpc2000/kpc_dma/kpc_dma_driver.h | 156 +++++++------- 6 files changed, 509 insertions(+), 373 deletions(-)
Quoted 4 lines
THat's way too many different types of changes to do all at once, and some of these are making the code look worse, not better.
There's a reason we don't run lindent :)
Yes, I am seeing that very clearly now. :)
Quoted 5 lines
If you want to do one-type-of-fix-per-patch, I'll gladly take these, otherwise, I recommend leaving this for those people learning how to do development to do.
OK, I'm going to pretend that I'm not one of those people, despite recent hard evidence to the contrary here. haha. Anyway, this does present a nice set of things for new developers to get started on. So I'll leave it as is.
thanks,
Signature · 2 lines
John Hubbard NVIDIA