All of lore.kernel.org
 help / color / mirror / Atom feed
From: grant.likely@secretlab.ca (Grant Likely)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH RESEND 4/6 v13] gpiolib: Fix default attributes for class
Date: Fri, 15 Feb 2013 22:55:14 +0000	[thread overview]
Message-ID: <20130215225514.8D54B3E15F8@localhost> (raw)
In-Reply-To: <1358250716-21986-5-git-send-email-stigge@antcom.de>

On Tue, 15 Jan 2013 12:51:54 +0100, Roland Stigge <stigge@antcom.de> wrote:
> There is a race condition between creating a gpio or gpiochip device and adding
> default attributes. This patch fixes this by defining the default attributes as
> dev_attrs of the class. For this, it was necessary to create a separate
> gpiochip_class besides gpio_class.
> 
> Signed-off-by: Roland Stigge <stigge@antcom.de>

Hi Roland,

Yup, that's a bug. Thanks for looking at this. Unfortunately creating a
new class creates a new problem because it changes the userspace ABI
(the gpiochip simlinks move to a different class directory).

Instead, I think the correct solution here is to use (struct device *)->groups
to add attributes to a device. Unfortunately that means that
create_device() won't work anymore. It does some useful setup work
though that I don't want to have to reproduce. You could create a
variant that also allows groups to be set, or you could factor out the
allocation/setup stuff so we can do an allocate/fixup/register sequence.

g.

WARNING: multiple messages have this Message-ID (diff)
From: Grant Likely <grant.likely@secretlab.ca>
To: Roland Stigge <stigge@antcom.de>,
	gregkh@linuxfoundation.org, linus.walleij@linaro.org,
	linux-kernel@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org, w.sang@pengutronix.de,
	jbe@pengutronix.de, plagnioj@jcrosoft.com, highguy@gmail.com,
	broonie@opensource.wolfsonmicro.com, daniel-gl@gmx.net,
	rmallon@gmail.com, sr@denx.de, wg@grandegger.com,
	tru@work-microwave.de, mark.rutland@arm.com
Cc: Roland Stigge <stigge@antcom.de>
Subject: Re: [PATCH RESEND 4/6 v13] gpiolib: Fix default attributes for class
Date: Fri, 15 Feb 2013 22:55:14 +0000	[thread overview]
Message-ID: <20130215225514.8D54B3E15F8@localhost> (raw)
In-Reply-To: <1358250716-21986-5-git-send-email-stigge@antcom.de>

On Tue, 15 Jan 2013 12:51:54 +0100, Roland Stigge <stigge@antcom.de> wrote:
> There is a race condition between creating a gpio or gpiochip device and adding
> default attributes. This patch fixes this by defining the default attributes as
> dev_attrs of the class. For this, it was necessary to create a separate
> gpiochip_class besides gpio_class.
> 
> Signed-off-by: Roland Stigge <stigge@antcom.de>

Hi Roland,

Yup, that's a bug. Thanks for looking at this. Unfortunately creating a
new class creates a new problem because it changes the userspace ABI
(the gpiochip simlinks move to a different class directory).

Instead, I think the correct solution here is to use (struct device *)->groups
to add attributes to a device. Unfortunately that means that
create_device() won't work anymore. It does some useful setup work
though that I don't want to have to reproduce. You could create a
variant that also allows groups to be set, or you could factor out the
allocation/setup stuff so we can do an allocate/fixup/register sequence.

g.


  reply	other threads:[~2013-02-15 22:55 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-01-15 11:51 [PATCH RESEND 0/6 v13] gpio: Add block GPIO Roland Stigge
2013-01-15 11:51 ` Roland Stigge
2013-01-15 11:51 ` [PATCH RESEND 1/6 v13] gpio: Add a block GPIO API to gpiolib Roland Stigge
2013-01-15 11:51   ` Roland Stigge
2013-01-18 12:13   ` Stijn Devriendt
2013-01-18 12:13     ` Stijn Devriendt
2013-01-18 13:18     ` Roland Stigge
2013-01-18 13:18       ` Roland Stigge
2013-02-15 13:16     ` Grant Likely
2013-02-15 13:16       ` Grant Likely
2013-02-15 14:47   ` Grant Likely
2013-02-15 14:47     ` Grant Likely
2013-02-15 16:34   ` Grant Likely
2013-02-15 16:34     ` Grant Likely
2013-01-15 11:51 ` [PATCH RESEND 2/6 v13] gpio: Add sysfs support to block GPIO API Roland Stigge
2013-01-15 11:51   ` Roland Stigge
2013-02-15 21:50   ` Grant Likely
2013-02-15 21:50     ` Grant Likely
2013-01-15 11:51 ` [PATCH RESEND 3/6 v13] gpio: Add userland device interface to block GPIO Roland Stigge
2013-01-15 11:51   ` Roland Stigge
2013-01-15 11:51 ` [PATCH RESEND 4/6 v13] gpiolib: Fix default attributes for class Roland Stigge
2013-01-15 11:51   ` Roland Stigge
2013-02-15 22:55   ` Grant Likely [this message]
2013-02-15 22:55     ` Grant Likely
2013-01-15 11:51 ` [PATCH RESEND 5/6 v13] gpio: Add device tree support to block GPIO API Roland Stigge
2013-01-15 11:51   ` Roland Stigge
2013-01-15 11:51 ` [PATCH RESEND 6/6 v13] gpio: Add block gpio to several gpio drivers Roland Stigge
2013-01-15 11:51   ` Roland Stigge
2013-01-15 13:18   ` Nicolas Ferre
2013-01-15 13:18     ` Nicolas Ferre
2013-01-15 13:30     ` Roland Stigge
2013-01-15 13:30       ` Roland Stigge

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=20130215225514.8D54B3E15F8@localhost \
    --to=grant.likely@secretlab.ca \
    --cc=linux-arm-kernel@lists.infradead.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.