linux-gpio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Johan Hovold <johan@kernel.org>
To: "Frkuska, Joshua" <Joshua_Frkuska@mentor.com>
Cc: "linux-gpio@vger.kernel.org" <linux-gpio@vger.kernel.org>
Subject: Re: gpiolib, gpio removal while a gpio in-use
Date: Thu, 23 Apr 2015 09:15:00 +0200	[thread overview]
Message-ID: <20150423071500.GA1136@localhost> (raw)
In-Reply-To: <20150422162933.GE16828@localhost>

On Wed, Apr 22, 2015 at 06:29:33PM +0200, Johan Hovold wrote:
> On Tue, Mar 17, 2015 at 02:59:08AM +0000, Frkuska, Joshua wrote:
> > Hello,
> > 
> > In 3.18, the upstream commit e1db1706c8 made it acceptable to remove
> > gpio chips that were in use in exchange for a critical message. The
> > reasoning from what I gathered from the mailing list was to avoid
> > handling errors in the device remove handler. The justification was
> > that the error seemed unused by most drivers and there was a compiler
> > warning when ignoring the return value.
> >
> > At a higher level, this is a gpio handling policy shift. Previously
> > the behavior was to result in an error and disallow the gpio device to
> > be removed. Then starting at 3.18, it becomes ok to free a gpio device
> > regardless of whatever the (possibly critical) gpio may be doing as
> > long as a critical message is displayed.
> 
> It still isn't acceptable to remove a gpio chip with requested gpios as
> it will lead to memory leaks (even though the most pre-3.18 crashes have
> been fixed).

To clarify: the memory leaks are primarily related to sysfs.

The major issue is of course the crashes when attempting to call into
chip drivers whose device state is likely deallocated with descriptors
and chip structures that also have or could have been freed (e.g. as in
your i2c example). This only affects in-kernel consumers using the
gpiod-interface.

So to summarise: Using a requested gpio post chip-removal is not
supported.

Johan

      reply	other threads:[~2015-04-23  7:15 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-03-17  2:59 gpiolib, gpio removal while a gpio in-use Frkuska, Joshua
2015-03-23  7:00 ` Alexandre Courbot
2015-03-31  4:23   ` Frkuska, Joshua
2015-04-22 16:29 ` Johan Hovold
2015-04-23  7:15   ` Johan Hovold [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=20150423071500.GA1136@localhost \
    --to=johan@kernel.org \
    --cc=Joshua_Frkuska@mentor.com \
    --cc=linux-gpio@vger.kernel.org \
    /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).