linux-gpio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: David Cohen <david.a.cohen@linux.intel.com>
To: Bruno Randolf <br1@einfach.org>
Cc: linus.walleij@linaro.org, wim@iguana.be,
	linux-gpio@vger.kernel.org, mika.westerberg@linux.intel.com,
	mathias.nyman@linux.intel.com, simon.guinot@sequanux.org
Subject: Re: [PATCH] gpio: add GPIO support for SMSC SCH311x
Date: Tue, 03 Dec 2013 17:06:15 -0800	[thread overview]
Message-ID: <529E8007.6060407@linux.intel.com> (raw)
In-Reply-To: <1386116613-5241-1-git-send-email-br1@einfach.org>

Hi Bruno,

I've got a small suggestion below.
But regardless that, your patch looks fine.

On 12/03/2013 04:23 PM, Bruno Randolf wrote:
> This patch adds support for the GPIOs found on the SMSC "Super I/O" chips
> SCH311x.
>
> The chip detection and I/O functions are copied from sch311x_wdt.c
>
> Signed-off-by: Bruno Randolf <br1@einfach.org>
>
> ---
> Notes:
> - All GPIOs are now supported, driver data is runtime allocated
>   and I tried to address all comments as far as possible.
> - Still a platform device is registered, similar to gpio-f7188x.c
> ---
>  drivers/gpio/Kconfig        |   9 +
>  drivers/gpio/Makefile       |   1 +
>  drivers/gpio/gpio-sch311x.c | 430 ++++++++++++++++++++++++++++++++++++++++++++
>  3 files changed, 440 insertions(+)
>  create mode 100644 drivers/gpio/gpio-sch311x.c
>

[snip]

> +static int __init sch311x_gpio_init(void)
> +{
> +	int err, i, found = 0;
> +	unsigned short addr = 0;
> +
> +	for (i = 0; !found && i < ARRAY_SIZE(sch311x_ioports); i++)
> +		if (sch311x_detect(sch311x_ioports[i], &addr) == 0)
> +			found++;

'found' variable isn't necessary here. Just turn it into a label placed
below
'return -ENODEV' then 'goto found' directly.

> +	if (!found)

This 'if' wouldn't be necessary anymore.
You'd call return unconditionally at this point.

Br, David Cohen

> +		return -ENODEV;
> +
> +	err = platform_driver_register(&sch311x_gpio_driver);
> +	if (err)
> +		return err;
> +
> +	err = sch311x_gpio_pdev_add(addr);
> +	if (err)
> +		goto unreg_platform_driver;
> +
> +	return 0;
> +
> +unreg_platform_driver:
> +	platform_driver_unregister(&sch311x_gpio_driver);
> +	return err;
> +}
> +
> +static void __exit sch311x_gpio_exit(void)
> +{
> +	platform_device_unregister(sch311x_gpio_pdev);
> +	platform_driver_unregister(&sch311x_gpio_driver);
> +}
> +
> +module_init(sch311x_gpio_init);
> +module_exit(sch311x_gpio_exit);
> +
> +MODULE_AUTHOR("Bruno Randolf <br1@einfach.org>");
> +MODULE_DESCRIPTION("SMSC SCH311x GPIO Driver");
> +MODULE_LICENSE("GPL");
> +MODULE_ALIAS("platform:gpio-sch311x");


  reply	other threads:[~2013-12-04  1:01 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-12-04  0:23 [PATCH] gpio: add GPIO support for SMSC SCH311x Bruno Randolf
2013-12-04  1:06 ` David Cohen [this message]
2013-12-10 11:51 ` Linus Walleij
2013-12-10 17:05   ` Matthew Garrett
2013-12-11  4:05   ` Vivien Didelot
2013-12-12 19:50     ` Linus Walleij
2013-12-16  2:46       ` Vivien Didelot
2013-12-20  9:07         ` Linus Walleij
  -- strict thread matches above, loose matches on Subject: below --
2013-11-28  0:18 Bruno Randolf
2013-11-29 14:40 ` Linus Walleij
2013-11-29 15:02   ` Mika Westerberg
2013-11-29 19:55     ` Linus Walleij
2013-11-29 17:21   ` Bruno Randolf
2013-11-29 20:00     ` Linus Walleij
2013-11-29 20:37   ` Simon Guinot
2013-12-04 12:33     ` Linus Walleij
2013-11-29 18:56 ` Simon Guinot
2013-12-02 12:43   ` Bruno Randolf
2013-12-05 16:56     ` Simon Guinot
2013-12-10 10:18       ` Bruno Randolf
2013-12-10 11:44         ` Simon Guinot
2013-12-10 12:19           ` Bruno Randolf

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=529E8007.6060407@linux.intel.com \
    --to=david.a.cohen@linux.intel.com \
    --cc=br1@einfach.org \
    --cc=linus.walleij@linaro.org \
    --cc=linux-gpio@vger.kernel.org \
    --cc=mathias.nyman@linux.intel.com \
    --cc=mika.westerberg@linux.intel.com \
    --cc=simon.guinot@sequanux.org \
    --cc=wim@iguana.be \
    /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;
as well as URLs for NNTP newsgroup(s).