public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: Andy Shevchenko <andy.shevchenko@gmail.com>
Cc: Sudip Mukherjee <sudipm.mukherjee@gmail.com>,
	Linus Walleij <linus.walleij@linaro.org>,
	Alexandre Courbot <gnurou@gmail.com>,
	Jiri Slaby <jslaby@suse.com>,
	One Thousand Gnomes <gnomes@lxorguk.ukuu.org.uk>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"linux-serial@vger.kernel.org" <linux-serial@vger.kernel.org>,
	"linux-gpio@vger.kernel.org" <linux-gpio@vger.kernel.org>
Subject: Re: [PATCH v9 1/3] gpio: exar: add gpio for exar cards
Date: Thu, 19 Jan 2017 14:22:01 +0100	[thread overview]
Message-ID: <20170119132201.GA29998@kroah.com> (raw)
In-Reply-To: <CAHp75VfcUr-1sjh+xySHMaeNEi7QxHANvqbHGwt9=uWeOvMCJQ@mail.gmail.com>

On Sun, Jan 15, 2017 at 04:57:32PM +0200, Andy Shevchenko wrote:
> On Sun, Jan 15, 2017 at 12:50 AM, Sudip Mukherjee
> <sudipm.mukherjee@gmail.com> wrote:
> > From: Sudip Mukherjee <sudip.mukherjee@codethink.co.uk>
> >
> > Exar XR17V352/354/358 chips have 16 multi-purpose inputs/outputs which
> > can be controlled using gpio interface.
> >
> > Add the gpio specific code.
> 
> Thanks for an updated code.
> Briefly looking into first two patches v10 would be needed.
> 
> Here one important line is missed, nevertheless I'll go to comment
> some minor stuff as well.
> Overall looks good!
> 
> > name[16] should be enough. Maximum of 12 char will be used.
> 
> Better to use enough space, otherwise there is a room for a bug.
> So, you need to understand that kernel might crash in such cases,
> though it's minor for now.
> 
> > +++ b/drivers/gpio/gpio-exar.c
> > @@ -0,0 +1,199 @@
> 
> > +static void exar_update(struct gpio_chip *chip, unsigned int reg, int val,
> > +                       unsigned int offset)
> > +{
> > +       struct exar_gpio_chip *exar_gpio = gpiochip_get_data(chip);
> > +       int temp;
> > +
> > +       mutex_lock(&exar_gpio->lock);
> > +       temp = readb(exar_gpio->regs + reg);
> > +       temp &= ~BIT(offset);
> 
> > +       if (val)
> > +               temp |= BIT(offset);
> 
> You would do this in one line, but I dunno which style Linus prefers more
> 
> temp |= val ? BIT(...) : 0;

Use the if () format, it's easier to read and understand, which is more
important overall.

thanks,

greg k-h

      reply	other threads:[~2017-01-19 13:28 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-01-14 22:50 [PATCH v9 1/3] gpio: exar: add gpio for exar cards Sudip Mukherjee
2017-01-14 22:50 ` [PATCH v9 2/3] serial: exar: split out the exar code from 8250_pci Sudip Mukherjee
2017-01-15 15:40   ` Andy Shevchenko
2017-01-14 22:50 ` [PATCH v9 3/3] serial: 8250_pci: remove exar code Sudip Mukherjee
2017-01-15 15:46   ` Andy Shevchenko
2017-01-15 15:47   ` Andy Shevchenko
2017-01-15 14:57 ` [PATCH v9 1/3] gpio: exar: add gpio for exar cards Andy Shevchenko
2017-01-19 13:22   ` Greg Kroah-Hartman [this message]

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=20170119132201.GA29998@kroah.com \
    --to=gregkh@linuxfoundation.org \
    --cc=andy.shevchenko@gmail.com \
    --cc=gnomes@lxorguk.ukuu.org.uk \
    --cc=gnurou@gmail.com \
    --cc=jslaby@suse.com \
    --cc=linus.walleij@linaro.org \
    --cc=linux-gpio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-serial@vger.kernel.org \
    --cc=sudipm.mukherjee@gmail.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