linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Linus Walleij <linus.walleij@linaro.org>
To: Wang YanQing <udknight@gmail.com>,
	Greg KH <gregkh@linuxfoundation.org>,
	Linus Walleij <linus.walleij@linaro.org>,
	Johan Hovold <jhovold@gmail.com>,
	"linux-usb@vger.kernel.org" <linux-usb@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	andi@lisas.de, dforsi@gmail.com
Subject: Re: [PATCH v3] usb:serial:pl2303: add GPIOs interface on PL2303
Date: Wed, 23 Jul 2014 16:59:22 +0200	[thread overview]
Message-ID: <CACRpkdYUkTWxzqX0AqvEUcCNVtbMeg=zmYDWd5fe3-SRnSTs8Q@mail.gmail.com> (raw)
In-Reply-To: <20140721024624.GA25469@udknight>

On Mon, Jul 21, 2014 at 4:46 AM, Wang YanQing <udknight@gmail.com> wrote:

> PL2303HX has two GPIOs, this patch add interface for it.
>
> Signed-off-by: Wang YanQing <udknight@gmail.com>
> ---
>  Changes v2-v3:
>  1: fix errors and warnings reported by Daniele Forsi checked with checkpatch.pl
>  2: fix missing GPIOLIB dependence in Kconfig
>  3: fix pl2303_gpio_get can't work
>
>  Known issue:
>  If gpios are in use(export to userspace through sysfs interface, etc),
>  then call pl2303_release(unplug usb-serial convertor, modprobe -r, etc),
>  will cause trouble, so we need to make sure there is no gpio user before
>  call pl2303_release.

The sysfs ABI is not sound, using it is a recipe for trouble.
IIRC it was merged at a time when drivers/gpio was unmaintained :-(

(...)
> +static struct gpio_chip template_chip = {
> +       .label                  = "pl2303-gpio",
> +       .owner                  = THIS_MODULE,
> +       .direction_input        = pl2303_gpio_direction_in,
> +       .get                    = pl2303_gpio_get,
> +       .direction_output       = pl2303_gpio_direction_out,
> +       .set                    = pl2303_gpio_set,
> +       .can_sleep              = 1,

This is a bool so use = true,

> +#ifdef CONFIG_USB_SERIAL_PL2303_GPIO
> +       if (spriv && spriv->gpio) {
> +               if (gpiochip_remove(&spriv->gpio->gpio_chip))
> +                       dev_err(&serial->interface->dev,
> +                               "unable to remove gpio_chip?\n");

I'm getting rid of the return code from gpiochip_remove() and have removed
the __must_check tag in the gpio tree, so just call gpiochip_remove()
unconditionally and ignore any compile error messages for now.

Yours,
Linus Walleij

      parent reply	other threads:[~2014-07-23 15:06 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-07-21  2:46 [PATCH v3] usb:serial:pl2303: add GPIOs interface on PL2303 Wang YanQing
2014-07-21  5:46 ` Andreas Mohr
2014-07-21 11:03   ` Wang YanQing
2014-07-23 14:59 ` Linus Walleij [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='CACRpkdYUkTWxzqX0AqvEUcCNVtbMeg=zmYDWd5fe3-SRnSTs8Q@mail.gmail.com' \
    --to=linus.walleij@linaro.org \
    --cc=andi@lisas.de \
    --cc=dforsi@gmail.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=jhovold@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=udknight@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;
as well as URLs for NNTP newsgroup(s).