linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Johan Hovold <johan@kernel.org>
To: Hannes Petermaier <Hannes.Petermaier@br-automation.com>
Cc: Johan Hovold <johan@kernel.org>,
	andi@lisas.de, dforsi@gmail.com, gnomes@lxorguk.ukuu.org.uk,
	gregkh@linuxfoundation.org, jhovold@gmail.com,
	Linus Walleij <linus.walleij@linaro.org>,
	linux-kernel@vger.kernel.org, linux-kernel-owner@vger.kernel.org,
	linux-usb@vger.kernel.org, Wang YanQing <udknight@gmail.com>
Subject: Re: [PATCH v7] usb:serial:pl2303: add GPIOs interface on PL2303
Date: Wed, 13 Aug 2014 09:05:09 +0200	[thread overview]
Message-ID: <20140813070509.GA26836@localhost> (raw)
In-Reply-To: <OF3463CFCF.9AED608B-ONC1257D33.002239D7-C1257D33.002297E8@br-automation.com>

On Wed, Aug 13, 2014 at 08:17:50AM +0200, Hannes Petermaier wrote:
> > > 
> > > 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.
> > 
> > This is a real problem that we need to address. gpiolib isn't really
> > able to handle devices that just disappear. In fact, it's API claims 
> that
> > we must not call gpiochip_remove with requested gpios and this is
> > exactly what you might do in pl2303hx_gpio_release below.
> > 
> > As I mentioned earlier, this crashes the kernel when a new gpiochip is
> > later added (the gpiochip data structures are likely corrupted and we
> > get a NULL pointer deref in gpiochip_find_base).
> > 
> > Linus, any thoughts on this?
> 
> Hi,
> there are several USB to I2C bus adapters and I2C IO-Expanders,
> how is this handled there ?

The short answer is: it isn't.

A few i2c-gpio-expander drivers have teardown callbacks that can be used
from board files to release any gpios requested there, but this neither
translates to device tree or is of any help when gpios have been
exported to user space.

Thanks,
Johan

  reply	other threads:[~2014-08-13  7:06 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-08-09  5:28 [PATCH v7] usb:serial:pl2303: add GPIOs interface on PL2303 Wang YanQing
2014-08-12 14:46 ` Johan Hovold
2014-08-13  6:17   ` Hannes Petermaier
2014-08-13  7:05     ` Johan Hovold [this message]
2014-08-13  7:09       ` Greg KH
2014-08-17  1:04   ` Wang YanQing
2014-08-18 10:00     ` Johan Hovold
2014-08-17  2:05   ` Wang YanQing
2014-08-18 10:07     ` Johan Hovold
2014-08-27 23:43       ` Wang YanQing
2014-08-29 10:44         ` Johan Hovold

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=20140813070509.GA26836@localhost \
    --to=johan@kernel.org \
    --cc=Hannes.Petermaier@br-automation.com \
    --cc=andi@lisas.de \
    --cc=dforsi@gmail.com \
    --cc=gnomes@lxorguk.ukuu.org.uk \
    --cc=gregkh@linuxfoundation.org \
    --cc=jhovold@gmail.com \
    --cc=linus.walleij@linaro.org \
    --cc=linux-kernel-owner@vger.kernel.org \
    --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).