staging: iio: ad5933: align arguments on new line with open parenthesis
Subsystems (4)
PATCH v2 1/1 staging: iio: ad5933: align arguments on new line with open parenthesis
Issue found by checkpatch: "Alignment should match open parenthesis." Multiple lines are also reduced to a single line where possible.
---
Changes in v2:
-Bring broken argument lists to one line where
80 characters or less is possible
-Fix error in v1 in which alignment caused 2 lines
to be over 80 characters by breaking up line
drivers/staging/iio/impedance-analyzer/ad5933.c | 38 ++++++++++++------------- 1 file changed, 19 insertions(+), 19 deletions(-)
drivers/staging/iio/impedance-analyzer/ad5933.c +19 -19
@@ -156,8 +156,7 @@ static const struct iio_chan_spec ad5933_channels[] = { }, }; -static int ad5933_i2c_write (struct i2c_client *client, -u8 reg,u8 len,u8 *data) +static int ad5933_i2c_write (struct i2c_client *client,u8 reg,u8 len,u8 *data) {int ret;
@@ -171,8 +170,7 @@ static int ad5933_i2c_write(struct i2c_client *client,return 0 ; } -static int ad5933_i2c_read (struct i2c_client *client, -u8 reg,u8 len,u8 *data) +static int ad5933_i2c_read (struct i2c_client *client,u8 reg,u8 len,u8 *data) {int ret;
@@ -269,7 +267,8 @@ static int ad5933_setup(struct ad5933_state *st) dat =cpu_to_be16 (st->settling_cycles); ret =ad5933_i2c_write (st->client, -AD5933_REG_SETTLING_CYCLES ,2 , (u8 *)&dat); +AD5933_REG_SETTLING_CYCLES , +2 , (u8 *)&dat);if (ret <0 )return ret;
@@ -294,8 +293,8 @@ static void ad5933_calc_out_ranges(struct ad5933_state *st)*/ static ssize_t ad5933_show_frequency (struct device *dev, -struct device_attribute *attr, -char *buf) +struct device_attribute *attr, +char *buf) {struct iio_dev *indio_dev =dev_to_iio_dev (dev);struct ad5933_state *st =iio_priv (indio_dev);
@@ -322,9 +321,9 @@ static ssize_t ad5933_show_frequency(struct device *dev, }static ssize_t ad5933_store_frequency (struct device *dev, -struct device_attribute *attr, -const char *buf, -size_t len) +struct device_attribute *attr, +const char *buf, +size_t len) {struct iio_dev *indio_dev =dev_to_iio_dev (dev);struct ad5933_state *st =iio_priv (indio_dev);
@@ -357,8 +356,8 @@ static IIO_DEVICE_ATTR(out_voltage0_freq_increment, S_IRUGO | S_IWUSR, AD5933_REG_FREQ_INC);static ssize_t ad5933_show (struct device *dev, -struct device_attribute *attr, -char *buf) +struct device_attribute *attr, +char *buf) {struct iio_dev *indio_dev =dev_to_iio_dev (dev);struct ad5933_state *st =iio_priv (indio_dev);
@@ -399,9 +398,9 @@ static ssize_t ad5933_show(struct device *dev, }static ssize_t ad5933_store (struct device *dev, -struct device_attribute *attr, -const char *buf, -size_t len) +struct device_attribute *attr, +const char *buf, +size_t len) {struct iio_dev *indio_dev =dev_to_iio_dev (dev);struct ad5933_state *st =iio_priv (indio_dev);
@@ -451,7 +450,8 @@ static ssize_t ad5933_store(struct device *dev, dat =cpu_to_be16 (val); ret =ad5933_i2c_write (st->client, -AD5933_REG_SETTLING_CYCLES ,2 , (u8 *)&dat); +AD5933_REG_SETTLING_CYCLES , +2 , (u8 *)&dat);break ;case AD5933_FREQ_POINTS : val =clamp (val, (u16 )0 , (u16 )511 );
@@ -545,8 +545,8 @@ static int ad5933_read_raw(struct iio_dev *indio_dev, goto out; ret =ad5933_i2c_read (st->client, -AD5933_REG_TEMP_DATA ,2 , - (u8 *)&dat); +AD5933_REG_TEMP_DATA , +2 , (u8 *)&dat);if (ret <0 ) goto out;mutex_unlock (&indio_dev->mlock);
@@ -705,7 +705,7 @@ static void ad5933_work(struct work_struct *work) }static int ad5933_probe (struct i2c_client *client, -const struct i2c_device_id *id) +const struct i2c_device_id *id) {int ret, voltage_uv =0 ;struct ad5933_platform_data *pdata =dev_get_platdata (&client->dev);
Signature · 1 line
2.7.4
Quoted 8 lines · Katie Dunne
Issue found by checkpatch: "Alignment should match open parenthesis." Multiple lines are also reduced to a single line where possible.
Signed-off-by Katie Dunne <[email protected]>---
Changes in v2:
-Bring broken argument lists to one line where
80 characters or less is possible
There are more that can be pulled in. Not into one line, but that can go from 3 to 2 lines. We're not trying to align the parameters in a list. We want to fit as many as we can within 80 chars on the 1st line, then fit as many as we can on the 2nd line, etc.
I did one below as an example, but there are more beyond that.
Thanks for cleaning this up,
alisons
Quoted 32 lines
-Fix error in v1 in which alignment caused 2 lines
to be over 80 characters by breaking up linedrivers/staging/iio/impedance-analyzer/ad5933.c | 38 ++++++++++++------------- 1 file changed, 19 insertions(+), 19 deletions(-)drivers/staging/iio/impedance-analyzer/ad5933.c +2
-4@@ -156,8 +156,7 @@ static const struct iio_chan_spec ad5933_channels[] = { }, }; -static int ad5933_i2c_write (struct i2c_client *client, -u8 reg,u8 len,u8 *data) +static int ad5933_i2c_write (struct i2c_client *client,u8 reg,u8 len,u8 *data) {int ret;@@ -171,8 +170,7 @@ static int ad5933_i2c_write(struct i2c_client *client,return 0 ; } -static int ad5933_i2c_read (struct i2c_client *client, -u8 reg,u8 len,u8 *data) +static int ad5933_i2c_read (struct i2c_client *client,u8 reg,u8 len,u8 *data) {int ret;
drivers/staging/iio/impedance-analyzer/ad5933.c static int ad5933_setup(struct ad5933_state *st) · line 271
Quoted 6 lines
drivers/staging/iio/impedance-analyzer/ad5933.c +2
-1@@ -269,7 +267,8 @@ static int ad5933_setup(struct ad5933_state *st) dat =cpu_to_be16 (st->settling_cycles); ret =ad5933_i2c_write (st->client, -AD5933_REG_SETTLING_CYCLES ,2 , (u8 *)&dat); +AD5933_REG_SETTLING_CYCLES , +2 , (u8 *)&dat);
ret = ad5933_i2c_write(st->client, AD5933_REG_SETTLING_CYCLES, 2, (u8 *)&dat);
Quoted 90 lines
drivers/staging/iio/impedance-analyzer/ad5933.c +15
-14if (ret <0 )return ret;@@ -294,8 +293,8 @@ static void ad5933_calc_out_ranges(struct ad5933_state *st)*/ static ssize_t ad5933_show_frequency (struct device *dev, -struct device_attribute *attr, -char *buf) +struct device_attribute *attr, +char *buf) {struct iio_dev *indio_dev =dev_to_iio_dev (dev);struct ad5933_state *st =iio_priv (indio_dev);@@ -322,9 +321,9 @@ static ssize_t ad5933_show_frequency(struct device *dev, }static ssize_t ad5933_store_frequency (struct device *dev, -struct device_attribute *attr, -const char *buf, -size_t len) +struct device_attribute *attr, +const char *buf, +size_t len) {struct iio_dev *indio_dev =dev_to_iio_dev (dev);struct ad5933_state *st =iio_priv (indio_dev);@@ -357,8 +356,8 @@ static IIO_DEVICE_ATTR(out_voltage0_freq_increment, S_IRUGO | S_IWUSR, AD5933_REG_FREQ_INC);static ssize_t ad5933_show (struct device *dev, -struct device_attribute *attr, -char *buf) +struct device_attribute *attr, +char *buf) {struct iio_dev *indio_dev =dev_to_iio_dev (dev);struct ad5933_state *st =iio_priv (indio_dev);@@ -399,9 +398,9 @@ static ssize_t ad5933_show(struct device *dev, }static ssize_t ad5933_store (struct device *dev, -struct device_attribute *attr, -const char *buf, -size_t len) +struct device_attribute *attr, +const char *buf, +size_t len) {struct iio_dev *indio_dev =dev_to_iio_dev (dev);struct ad5933_state *st =iio_priv (indio_dev);@@ -451,7 +450,8 @@ static ssize_t ad5933_store(struct device *dev, dat =cpu_to_be16 (val); ret =ad5933_i2c_write (st->client, -AD5933_REG_SETTLING_CYCLES ,2 , (u8 *)&dat); +AD5933_REG_SETTLING_CYCLES , +2 , (u8 *)&dat);break ;case AD5933_FREQ_POINTS : val =clamp (val, (u16 )0 , (u16 )511 );@@ -545,8 +545,8 @@ static int ad5933_read_raw(struct iio_dev *indio_dev, goto out; ret =ad5933_i2c_read (st->client, -AD5933_REG_TEMP_DATA ,2 , - (u8 *)&dat); +AD5933_REG_TEMP_DATA , +2 , (u8 *)&dat);if (ret <0 ) goto out;mutex_unlock (&indio_dev->mlock);@@ -705,7 +705,7 @@ static void ad5933_work(struct work_struct *work) }static int ad5933_probe (struct i2c_client *client, -const struct i2c_device_id *id) +const struct i2c_device_id *id) {int ret, voltage_uv =0 ;struct ad5933_platform_data *pdata =dev_get_platdata (&client->dev);Signature · 8 lines
2.7.4 -- You received this message because you are subscribed to the Google Groups "outreachy-kernel" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/outreachy-kernel/20160914171828.GA3062%40katie-Inspiron-5748. For more options, visit https://groups.google.com/d/optout.
A message that is not in the archive (sent off-list or not yet received): [email protected]
A message that is not in the archive (sent off-list or not yet received): [email protected]
Quoted 33 lines · Jonathan Cameron
Quoted 17 lines · Jonathan Cameron
Quoted 10 lines · Alison Schofield
Quoted 8 lines · Katie Dunne
Issue found by checkpatch: "Alignment should match open parenthesis." Multiple lines are also reduced to a single line where possible.
Signed-off-by Katie Dunne <[email protected]>---
Changes in v2:
-Bring broken argument lists to one line where
80 characters or less is possibleQuoted 6 lines
There are more that can be pulled in. Not into one line, but that can go from 3 to 2 lines. We're not trying to align the parameters in a list. We want to fit as many as we can within 80 chars on the 1st line, then fit as many as we can on the 2nd line, etc.
I did one below as an example, but there are more beyond that.
Quoted 9 lines
As a small addition to what Alisons has said, there are sometimes
reasons to do breaks in particular locations. The classic would be
to keep an array pointer argument next to an argument saying how many elements it has in it.Sometimes it comes down to personal preference on when to do this or not. Mostly we don't actually care about such find details when reviewing patches (or I don't anyway ;)
Upshot is that the patch is a good improvement. Perhaps it could have been ever so slightly better, but well worth having!
Applied to the togreg branch of iio.git. Will be initially pushed out as testing for the autobuilders at 0day to play with it.
Quoted 7 lines
Might make the upcoming merge window depending on whether Linus decides to let the current cycle run to an rc8.
Thanks,
Jonathan
Thanks for the feedback. I'll keep this in mind for future patches.
Katie
Quoted 156 lines
Quoted 10 lines
Jonathan
Quoted 9 lines
Thanks for cleaning this up,
alisonsQuoted 5 lines
-Fix error in v1 in which alignment caused 2 lines
to be over 80 characters by breaking up linedrivers/staging/iio/impedance-analyzer/ad5933.c | 38++++++++++++-------------
Quoted 3 lines
Quoted 3 lines
Review
Quoted 3 lines
1 file changed, 19 insertions(+), 19 deletions(-)(quoted diff) +0
-0
b/drivers/staging/iio/impedance-analyzer/ad5933.cQuoted 4 lines
Quoted 4 lines
drivers/staging/iio/impedance-analyzer/ad5933.c static const struct iio_chan_spec
Quoted 4 lines
index 24c348d..5eecf1c 100644
drivers/staging/iio/impedance-analyzer/ad5933.c +0
-0@@ -156,8 +156,7 @@ static const struct iio_chan_specad5933_channels[] = {
Quoted 6 lines
Quoted 6 lines
drivers/staging/iio/impedance-analyzer/ad5933.c static const struct iio_chan_spec ad5933_channels[] = {
Quoted 6 lines
drivers/staging/iio/impedance-analyzer/ad5933.c +1
-2}, }; -static int ad5933_i2c_write (struct i2c_client *client, -u8 reg,u8 len,u8 *data) +static int ad5933_i2c_write(struct i2c_client *client, u8 reg, u8len, u8 *data)
Quoted 4 lines
Quoted 4 lines
drivers/staging/iio/impedance-analyzer/ad5933.c static int ad5933_i2c_write(struct i2c_client
Quoted 4 lines
drivers/staging/iio/impedance-analyzer/ad5933.c +0
-0{int ret;@@ -171,8 +170,7 @@ static int ad5933_i2c_write(struct i2c_client*client,
Quoted 6 lines
Quoted 6 lines
drivers/staging/iio/impedance-analyzer/ad5933.c static int ad5933_i2c_write(struct i2c_client *client,
Quoted 6 lines
drivers/staging/iio/impedance-analyzer/ad5933.c +1
-2return 0 ; } -static int ad5933_i2c_read (struct i2c_client *client, -u8 reg,u8 len,u8 *data) +static int ad5933_i2c_read(struct i2c_client *client, u8 reg, u8 len,u8 *data)
Quoted 15 lines
Quoted 15 lines
drivers/staging/iio/impedance-analyzer/ad5933.c static int ad5933_setup(struct ad5933_state *st) · line 271
Quoted 10 lines
drivers/staging/iio/impedance-analyzer/ad5933.c +2
-1{int ret;@@ -269,7 +267,8 @@ static int ad5933_setup(struct ad5933_state *st) dat =cpu_to_be16 (st->settling_cycles); ret =ad5933_i2c_write (st->client, -AD5933_REG_SETTLING_CYCLES ,2 , (u8 *)&dat); +AD5933_REG_SETTLING_CYCLES , +2 , (u8 *)&dat);ret = ad5933_i2c_write(st->client, AD5933_REG_SETTLING_CYCLES, 2, (u8 *)&dat);Quoted 4 lines
Quoted 4 lines
drivers/staging/iio/impedance-analyzer/ad5933.c static void ad5933_calc_out_ranges(struct
Quoted 4 lines
drivers/staging/iio/impedance-analyzer/ad5933.c +0
-0if (ret <0 )return ret;@@ -294,8 +293,8 @@ static void ad5933_calc_out_ranges(struct
ad5933_state*st)Quoted 11 lines
Quoted 11 lines
drivers/staging/iio/impedance-analyzer/ad5933.c static ssize_t ad5933_show_frequency(struct device
Quoted 11 lines
drivers/staging/iio/impedance-analyzer/ad5933.c +2
-2*/ static ssize_t ad5933_show_frequency (struct device *dev, -struct device_attribute *attr, -char *buf) +struct device_attribute *attr, +char *buf) {struct iio_dev *indio_dev =dev_to_iio_dev (dev);struct ad5933_state *st =iio_priv (indio_dev);@@ -322,9 +321,9 @@ static ssize_t ad5933_show_frequency(struct device*dev,
Quoted 13 lines
Quoted 13 lines
drivers/staging/iio/impedance-analyzer/ad5933.c static IIO_DEVICE_ATTR(out_voltage0_freq_increment,
Quoted 13 lines
drivers/staging/iio/impedance-analyzer/ad5933.c +3
-3}static ssize_t ad5933_store_frequency (struct device *dev, -struct device_attribute *attr, -const char *buf, -size_t len) +struct device_attribute *attr, +const char *buf, +size_t len) {struct iio_dev *indio_dev =dev_to_iio_dev (dev);struct ad5933_state *st =iio_priv (indio_dev);@@ -357,8 +356,8 @@ static IIO_DEVICE_ATTR(out_voltage0_freq_increment,
S_IRUGO|S_IWUSR,Quoted 25 lines
Quoted 25 lines
Quoted 25 lines
drivers/staging/iio/impedance-analyzer/ad5933.c +5
-5AD5933_REG_FREQ_INC);static ssize_t ad5933_show (struct device *dev, -struct device_attribute *attr, -char *buf) +struct device_attribute *attr, +char *buf) {struct iio_dev *indio_dev =dev_to_iio_dev (dev);struct ad5933_state *st =iio_priv (indio_dev);@@ -399,9 +398,9 @@ static ssize_t ad5933_show(struct device *dev, }static ssize_t ad5933_store (struct device *dev, -struct device_attribute *attr, -const char *buf, -size_t len) +struct device_attribute *attr, +const char *buf, +size_t len) {struct iio_dev *indio_dev =dev_to_iio_dev (dev);struct ad5933_state *st =iio_priv (indio_dev);@@ -451,7 +450,8 @@ static ssize_t ad5933_store(struct device *dev,Quoted 9 lines
Quoted 9 lines
drivers/staging/iio/impedance-analyzer/ad5933.c static int ad5933_read_raw(struct iio_dev
Quoted 9 lines
drivers/staging/iio/impedance-analyzer/ad5933.c +2
-1dat =cpu_to_be16 (val); ret =ad5933_i2c_write (st->client, -AD5933_REG_SETTLING_CYCLES ,2 , (u8 *)&dat); +AD5933_REG_SETTLING_CYCLES , +2 , (u8 *)&dat);break ;case AD5933_FREQ_POINTS : val =clamp (val, (u16 )0 , (u16 )511 );@@ -545,8 +545,8 @@ static int ad5933_read_raw(struct iio_dev
*indio_dev,Quoted 13 lines
Quoted 13 lines
Quoted 13 lines
drivers/staging/iio/impedance-analyzer/ad5933.c +2
-2goto out; ret =ad5933_i2c_read (st->client, -AD5933_REG_TEMP_DATA ,2 , - (u8 *)&dat); +AD5933_REG_TEMP_DATA , +2 , (u8 *)&dat);if (ret <0 ) goto out;mutex_unlock (&indio_dev->mlock);@@ -705,7 +705,7 @@ static void ad5933_work(struct work_struct *work) }Quoted 6 lines
Quoted 6 lines
drivers/staging/iio/impedance-analyzer/ad5933.c static void ad5933_work(struct work_struct *work)
Quoted 6 lines
drivers/staging/iio/impedance-analyzer/ad5933.c +1
-1static int ad5933_probe (struct i2c_client *client, -const struct i2c_device_id *id) +const struct i2c_device_id *id) {int ret, voltage_uv =0 ;struct ad5933_platform_data *pdata =dev_get_platdata (&client->dev);
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
--
2.7.4--
You received this message because you are subscribed to the GoogleGroups "outreachy-kernel" group.
Quoted 1 line
Quoted 1 line
Quoted 1 line
To unsubscribe from this group and stop receiving emails from it, send
an email to [email protected].
Quoted 1 line
Quoted 1 line
Quoted 1 line
To post to this group, send email to [email protected]
.
Quoted 1 line
Quoted 1 line
Quoted 1 line
To view this discussion on the web visit https://groups.google.com/d/
msgid/outreachy-kernel/20160914171828.GA3062%40katie-Inspiron-5748.
Quoted 2 lines
Quoted 1 line
Quoted 1 line
For more options, visit https://groups.google.com/d/optout.