Linux IIO development
 help / color / mirror / Atom feed
From: Jonathan Cameron <jic23@kernel.org>
To: Paul Lemmermann <thepaulodoom@thepaulodoom.com>
Cc: linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] IIO: accel: fixed coding style issues
Date: Sat, 2 Apr 2022 17:35:10 +0100	[thread overview]
Message-ID: <20220402173510.2b38e261@jic23-huawei> (raw)
In-Reply-To: <YkIJ3/nkVNMy/qv8@hp-amd-paul>

On Mon, 28 Mar 2022 14:17:51 -0500
Paul Lemmermann <thepaulodoom@thepaulodoom.com> wrote:

> On Mon, Mar 28, 2022 at 06:06:23PM +0100, Jonathan Cameron wrote:
> > On Mon, 28 Mar 2022 10:05:08 -0500
> > Paul Lemmermann <thepaulodoom@thepaulodoom.com> wrote:
> >   
> > > Fixed case statement issues and spacing issues.
> > > 
> > > Signed-off-by: Paul Lemmermann <thepaulodoom@thepaulodoom.com>  
> > Hi Paul,
> > 
> > Thanks for the patch.
> > 
> > These are drivers written / maintained by different authors, so one
> > patch per driver preferred.  Particularly handy as people might not
> > agree with all of them so separate patches would allow me to pick
> > and choose which ones to pick up.
> > 
> > Comments inline.
> > 
> > Please state how you identified the changes btw.  Script?  
> 
> I used the checkpatch.pl script to identify these changes.
Please mention that in patch descriptions in future.
It's useful to anyone tracking this sort of information.

I added it to the broken out patches whilst applying.

Thanks,

Jonathan

> 
> > 
> > Jonathan
> >   
> > > ---
> > >  drivers/iio/accel/bmc150-accel-core.c | 15 +++++++++++----
> > >  drivers/iio/accel/dmard09.c           |  2 +-
> > >  drivers/iio/accel/kxsd9-spi.c         |  4 ++--
> > >  3 files changed, 14 insertions(+), 7 deletions(-)
> > > 
> > > diff --git a/drivers/iio/accel/bmc150-accel-core.c b/drivers/iio/accel/bmc150-accel-core.c
> > > index d11f66801..f7dd7ec2c 100644
> > > --- a/drivers/iio/accel/bmc150-accel-core.c
> > > +++ b/drivers/iio/accel/bmc150-accel-core.c
> > > @@ -432,10 +432,17 @@ static bool bmc150_apply_bosc0200_acpi_orientation(struct device *dev,
> > >  
> > >  		for (j = 0; j < 3; j++) {
> > >  			switch (val[j]) {
> > > -			case -1: str = "-1"; break;
> > > -			case 0:  str = "0";  break;
> > > -			case 1:  str = "1";  break;
> > > -			default: goto unknown_format;
> > > +			case -1:
> > > +				str = "-1";
> > > +				break;
> > > +			case 0:
> > > +				str = "0";
> > > +				break;
> > > +			case 1:
> > > +				str = "1";
> > > +				break;
> > > +			default:
> > > +				goto unknown_format;  
> > 
> > I'm not seeing any clear advantage to this change.
> >  
> The reason for this change is that most, if not all, case statements in
> the kernel are multiple lines. Also, in the kernel docs (https://docs.kernel.org/process/coding-style.html)
> it says, to not put multiple statements on one line.
> 
> Thanks,
> Paul
> >   
> > >  			}
> > >  			orientation->rotation[i * 3 + j] = str;
> > >  		}
> > > diff --git a/drivers/iio/accel/dmard09.c b/drivers/iio/accel/dmard09.c
> > > index e6e28c964..87bc38d4d 100644
> > > --- a/drivers/iio/accel/dmard09.c
> > > +++ b/drivers/iio/accel/dmard09.c
> > > @@ -24,7 +24,7 @@
> > >  #define DMARD09_AXIS_Y 1
> > >  #define DMARD09_AXIS_Z 2
> > >  #define DMARD09_AXIS_X_OFFSET ((DMARD09_AXIS_X + 1) * 2)
> > > -#define DMARD09_AXIS_Y_OFFSET ((DMARD09_AXIS_Y + 1 )* 2)
> > > +#define DMARD09_AXIS_Y_OFFSET ((DMARD09_AXIS_Y + 1) * 2)  
> > 
> > This is one is good.
> >   
> > >  #define DMARD09_AXIS_Z_OFFSET ((DMARD09_AXIS_Z + 1) * 2)
> > >  
> > >  struct dmard09_data {
> > > diff --git a/drivers/iio/accel/kxsd9-spi.c b/drivers/iio/accel/kxsd9-spi.c
> > > index 57c451cfb..989f53fb0 100644
> > > --- a/drivers/iio/accel/kxsd9-spi.c
> > > +++ b/drivers/iio/accel/kxsd9-spi.c
> > > @@ -44,8 +44,8 @@ static const struct spi_device_id kxsd9_spi_id[] = {
> > >  MODULE_DEVICE_TABLE(spi, kxsd9_spi_id);
> > >  
> > >  static const struct of_device_id kxsd9_of_match[] = {
> > > -        { .compatible = "kionix,kxsd9" },
> > > -        { },
> > > +	{ .compatible = "kionix,kxsd9" },  
> > 
> > Also good to clean up.
> > 
> > Thanks,
> > 
> > Jonathan
> > 
> >   
> > > +	{ },
> > >  };
> > >  MODULE_DEVICE_TABLE(of, kxsd9_of_match);
> > >    
> >   


  reply	other threads:[~2022-04-02 16:27 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-28 15:05 [PATCH] IIO: accel: fixed coding style issues Paul Lemmermann
2022-03-28 17:06 ` Jonathan Cameron
2022-03-28 19:17   ` Paul Lemmermann
2022-04-02 16:35     ` Jonathan Cameron [this message]
2022-03-28 20:32 ` Andy Shevchenko
2022-03-28 21:06   ` Paul Lemmermann

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=20220402173510.2b38e261@jic23-huawei \
    --to=jic23@kernel.org \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=thepaulodoom@thepaulodoom.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox