All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jonathan Cameron <Jonathan.Cameron@huawei.com>
To: "Hernán Gonzalez" <hernan@vanguardiasur.com.ar>
Cc: <lars@metafoo.de>, <Michael.Hennerich@analog.com>,
	<jic23@kernel.org>, <knaack.h@gmx.de>, <pmeerw@pmeerw.net>,
	<linux-iio@vger.kernel.org>, <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH 04/11] staging: iio: ad7746: Reorder variable declarations
Date: Fri, 23 Mar 2018 12:40:16 +0000	[thread overview]
Message-ID: <20180323134016.00007753@huawei.com> (raw)
In-Reply-To: <1521642539-4845-5-git-send-email-hernan@vanguardiasur.com.ar>

On Wed, 21 Mar 2018 11:28:52 -0300
Hernán Gonzalez <hernan@vanguardiasur.com.ar> wrote:

> Reorder some variable declarations in an inverse-pyramid scheme.
> 
> Signed-off-by: Hernán Gonzalez <hernan@vanguardiasur.com.ar>
I'm not sure the first few cases here actually add much in
the way of readablity.

This 'rule' is very 'vague' deliberately as sometimes it makes sense
and sometimes it really doesn't.

One nice convention is to have ret on it's own line when it is the
value returned by the function (it doesn't logically group with anything
else).  Having that one last is also nice to see (so I like your final
change more than the others!)

Jonathan
> ---
>  drivers/staging/iio/cdc/ad7746.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/staging/iio/cdc/ad7746.c b/drivers/staging/iio/cdc/ad7746.c
> index 86919e8..57623db 100644
> --- a/drivers/staging/iio/cdc/ad7746.c
> +++ b/drivers/staging/iio/cdc/ad7746.c
> @@ -220,8 +220,8 @@ static int ad7746_select_channel(struct iio_dev *indio_dev,
>  				 struct iio_chan_spec const *chan)
>  {
>  	struct ad7746_chip_info *chip = iio_priv(indio_dev);
> -	int ret, delay, idx;
>  	u8 vt_setup, cap_setup;
> +	int ret, delay, idx;
>  
>  	switch (chan->type) {
>  	case IIO_CAPACITANCE:
> @@ -289,8 +289,8 @@ static inline ssize_t ad7746_start_calib(struct device *dev,
>  {
>  	struct iio_dev *indio_dev = dev_to_iio_dev(dev);
>  	struct ad7746_chip_info *chip = iio_priv(indio_dev);
> -	bool doit;
>  	int ret, timeout = 10;
> +	bool doit;
>  
>  	ret = strtobool(buf, &doit);
>  	if (ret < 0)
> @@ -681,8 +681,8 @@ static int ad7746_probe(struct i2c_client *client,
>  	struct ad7746_platform_data *pdata = client->dev.platform_data;
>  	struct ad7746_chip_info *chip;
>  	struct iio_dev *indio_dev;
> -	int ret = 0;
>  	unsigned char regval = 0;
> +	int ret = 0;
>  
>  	indio_dev = devm_iio_device_alloc(&client->dev, sizeof(*chip));
>  	if (!indio_dev)

WARNING: multiple messages have this Message-ID (diff)
From: Jonathan Cameron <Jonathan.Cameron@huawei.com>
To: "Hernán Gonzalez" <hernan@vanguardiasur.com.ar>
Cc: <lars@metafoo.de>, <Michael.Hennerich@analog.com>,
	<jic23@kernel.org>, <knaack.h@gmx.de>, <pmeerw@pmeerw.net>,
	<linux-iio@vger.kernel.org>, <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH 04/11] staging: iio: ad7746: Reorder variable declarations
Date: Fri, 23 Mar 2018 12:40:16 +0000	[thread overview]
Message-ID: <20180323134016.00007753@huawei.com> (raw)
In-Reply-To: <1521642539-4845-5-git-send-email-hernan@vanguardiasur.com.ar>

On Wed, 21 Mar 2018 11:28:52 -0300
Hern=E1n Gonzalez <hernan@vanguardiasur.com.ar> wrote:

> Reorder some variable declarations in an inverse-pyramid scheme.
>=20
> Signed-off-by: Hern=E1n Gonzalez <hernan@vanguardiasur.com.ar>
I'm not sure the first few cases here actually add much in
the way of readablity.

This 'rule' is very 'vague' deliberately as sometimes it makes sense
and sometimes it really doesn't.

One nice convention is to have ret on it's own line when it is the
value returned by the function (it doesn't logically group with anything
else).  Having that one last is also nice to see (so I like your final
change more than the others!)

Jonathan
> ---
>  drivers/staging/iio/cdc/ad7746.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
>=20
> diff --git a/drivers/staging/iio/cdc/ad7746.c b/drivers/staging/iio/cdc/a=
d7746.c
> index 86919e8..57623db 100644
> --- a/drivers/staging/iio/cdc/ad7746.c
> +++ b/drivers/staging/iio/cdc/ad7746.c
> @@ -220,8 +220,8 @@ static int ad7746_select_channel(struct iio_dev *indi=
o_dev,
>  				 struct iio_chan_spec const *chan)
>  {
>  	struct ad7746_chip_info *chip =3D iio_priv(indio_dev);
> -	int ret, delay, idx;
>  	u8 vt_setup, cap_setup;
> +	int ret, delay, idx;
> =20
>  	switch (chan->type) {
>  	case IIO_CAPACITANCE:
> @@ -289,8 +289,8 @@ static inline ssize_t ad7746_start_calib(struct devic=
e *dev,
>  {
>  	struct iio_dev *indio_dev =3D dev_to_iio_dev(dev);
>  	struct ad7746_chip_info *chip =3D iio_priv(indio_dev);
> -	bool doit;
>  	int ret, timeout =3D 10;
> +	bool doit;
> =20
>  	ret =3D strtobool(buf, &doit);
>  	if (ret < 0)
> @@ -681,8 +681,8 @@ static int ad7746_probe(struct i2c_client *client,
>  	struct ad7746_platform_data *pdata =3D client->dev.platform_data;
>  	struct ad7746_chip_info *chip;
>  	struct iio_dev *indio_dev;
> -	int ret =3D 0;
>  	unsigned char regval =3D 0;
> +	int ret =3D 0;
> =20
>  	indio_dev =3D devm_iio_device_alloc(&client->dev, sizeof(*chip));
>  	if (!indio_dev)

  reply	other threads:[~2018-03-23 12:40 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-03-21 14:28 [PATCH 00/11] Move ad7746 out of staging Hernán Gonzalez
2018-03-21 14:28 ` [PATCH 01/11] staging: iio: ad7746: Adjust arguments to match open parenthesis Hernán Gonzalez
2018-03-23 12:36   ` Jonathan Cameron
2018-03-21 14:28 ` [PATCH 02/11] staging: iio: ad7746: Fix multiple line dereference Hernán Gonzalez
2018-03-21 14:28 ` [PATCH 03/11] staging: iio: ad7746: Reorder includes alphabetically Hernán Gonzalez
2018-03-21 14:28 ` [PATCH 04/11] staging: iio: ad7746: Reorder variable declarations Hernán Gonzalez
2018-03-23 12:40   ` Jonathan Cameron [this message]
2018-03-23 12:40     ` Jonathan Cameron
2018-03-21 14:28 ` [PATCH 05/11] staging: iio: ad7746: Remove unused defines Hernán Gonzalez
2018-03-23 12:44   ` Jonathan Cameron
2018-03-23 12:44     ` Jonathan Cameron
2018-03-21 14:28 ` [PATCH 06/11] staging: iio: ad7746: Add dt-bindings Hernán Gonzalez
2018-03-23 12:46   ` Jonathan Cameron
2018-03-21 14:28 ` [PATCH 07/11] staging: iio: ad7746: Add remove() Hernán Gonzalez
2018-03-23 12:48   ` Jonathan Cameron
2018-03-23 12:48     ` Jonathan Cameron
2018-03-21 14:28 ` [PATCH 08/11] staging: iio: ad7746: Add comments Hernán Gonzalez
2018-03-23 12:52   ` Jonathan Cameron
2018-03-21 14:28 ` [PATCH 09/11] staging: iio: ad7746: Add devicetree bindings documentation Hernán Gonzalez
2018-03-23 12:54   ` Jonathan Cameron
2018-03-21 14:28 ` [PATCH 10/11] staging: iio: ad7746: Rename sysfs attrs to comply with the ABI Hernán Gonzalez
2018-03-23 12:57   ` Jonathan Cameron
2018-03-23 12:57     ` Jonathan Cameron
2018-03-21 14:28 ` [PATCH 11/11] Move cdc ad7746 driver out of staging to mainline iio Hernán Gonzalez
2018-03-23 10:21   ` kbuild test robot
2018-03-23 12:33     ` Jonathan Cameron
2018-03-23 12:59   ` Jonathan Cameron
2018-03-23 13:04 ` [PATCH 00/11] Move ad7746 out of staging Jonathan Cameron
2018-03-23 13:04   ` Jonathan Cameron

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180323134016.00007753@huawei.com \
    --to=jonathan.cameron@huawei.com \
    --cc=Michael.Hennerich@analog.com \
    --cc=hernan@vanguardiasur.com.ar \
    --cc=jic23@kernel.org \
    --cc=knaack.h@gmx.de \
    --cc=lars@metafoo.de \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=pmeerw@pmeerw.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.