Re: PIXIS gpio controller and gpio flags

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Trent Piepho
Date: Saturday, July 19, 2008 - 2:08 pm

On Fri, 18 Jul 2008, Anton Vorontsov wrote:

You have a race here.  What if px_gpio_xlate() is called at the same time
for different gpios?  This is an easy one to fix, since you can use the
atomic bitops.

It doesn't look like you have any way to unset the active low flag.  What if
I unload the leds-gpio driver (or another gpio user) and then try to use the
gpio with something else?  The active low flag is stuck on!  It doesn't show
in sysfs or debugfs either.  That could be very confusing.

I also wonder if it's ok to have the xlate function do flag setting?

of_get_property() just gets the property, it doesn't allocate it.  Same with
of_get_address() and of_get_pci_address(), they don't actually allocate or
map an address, they just get the value.  of_get_gpio() doesn't allocate the
gpio, that gets done later with gpio_request().  It seems like what it's
supposed to do is just get the translated value of the gpio property.

Except, your pixis gpio xlate function sets the gpio's flags.  What if one
wants to just look up a gpio number, but not allocate it?  The flags will
still get set.

Most gpio users, including leds-gpio, can handle gpios being busy.  If
leds-gpio can't get one of the gpios, it rolls back all the leds it did
create, doesn't drive the device and returns EBUSY.  Except with
of_get_gpio() setting the flags, it will change the flags out from under
whatever had the gpio already allocated!
--
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[PATCH] leds: implement OpenFirmare GPIO LED driver, Anton Vorontsov, (Mon Jul 14, 9:41 am)
Re: [PATCH] leds: implement OpenFirmare GPIO LED driver, Stephen Rothwell, (Mon Jul 14, 8:10 pm)
Re: [PATCH] leds: implement OpenFirmare GPIO LED driver, Anton Vorontsov, (Tue Jul 15, 5:38 am)
[PATCH v2] leds: implement OpenFirmare GPIO LED driver, Anton Vorontsov, (Tue Jul 15, 5:40 am)
Re: [PATCH v2] leds: implement OpenFirmare GPIO LED driver, Richard Purdie, (Tue Jul 15, 5:54 am)
Re: [PATCH v2] leds: implement OpenFirmare GPIO LED driver, Anton Vorontsov, (Tue Jul 15, 6:24 am)
Re: [PATCH v2] leds: implement OpenFirmare GPIO LED driver, Richard Purdie, (Tue Jul 15, 6:31 am)
Re: [PATCH v2] leds: implement OpenFirmare GPIO LED driver, Anton Vorontsov, (Tue Jul 15, 7:23 am)
Re: [PATCH v2] leds: implement OpenFirmare GPIO LED driver, Richard Purdie, (Tue Jul 15, 7:43 am)
[PATCH v3] leds: implement OpenFirmare GPIO LED driver, Anton Vorontsov, (Tue Jul 15, 8:19 am)
Re: [PATCH] leds: implement OpenFirmare GPIO LED driver, Segher Boessenkool, (Wed Jul 16, 10:59 pm)
Re: [PATCH] leds: implement OpenFirmare GPIO LED driver, Anton Vorontsov, (Thu Jul 17, 4:07 am)
Re: [PATCH v3] leds: implement OpenFirmare GPIO LED driver, Anton Vorontsov, (Thu Jul 17, 6:55 am)
Re: [PATCH v3] leds: implement OpenFirmare GPIO LED driver, Anton Vorontsov, (Thu Jul 17, 7:05 am)
Re: [PATCH v3] leds: implement OpenFirmare GPIO LED driver, Anton Vorontsov, (Thu Jul 17, 7:13 am)
Re: [PATCH] leds: implement OpenFirmare GPIO LED driver, Sean MacLennan, (Thu Jul 17, 7:58 am)
Re: [PATCH] leds: implement OpenFirmare GPIO LED driver, Grant Likely, (Thu Jul 17, 8:07 am)
Re: [PATCH v3] leds: implement OpenFirmare GPIO LED driver, Anton Vorontsov, (Thu Jul 17, 8:20 am)
Re: [PATCH v3] leds: implement OpenFirmare GPIO LED driver, Anton Vorontsov, (Thu Jul 17, 4:42 pm)
Re: [PATCH] leds: implement OpenFirmare GPIO LED driver, David Gibson, (Thu Jul 17, 8:35 pm)
Re: [PATCH] leds: implement OpenFirmare GPIO LED driver, Grant Likely, (Thu Jul 17, 9:44 pm)
Re: [PATCH v3] leds: implement OpenFirmare GPIO LED driver, Anton Vorontsov, (Fri Jul 18, 3:05 am)
Re: PIXIS gpio controller and gpio flags, Trent Piepho, (Sat Jul 19, 2:08 pm)
Re: PIXIS gpio controller and gpio flags, Anton Vorontsov, (Mon Jul 21, 10:53 am)
Re: PIXIS gpio controller and gpio flags, Trent Piepho, (Mon Jul 21, 2:12 pm)
Re: PIXIS gpio controller and gpio flags, Anton Vorontsov, (Wed Jul 23, 7:56 am)
Re: PIXIS gpio controller and gpio flags, Trent Piepho, (Wed Jul 23, 4:42 pm)
[RFC PATCH] of_gpio: implement of_get_gpio_flags(), Anton Vorontsov, (Fri Jul 25, 9:48 am)
[PATCH 1/2] leds: make the default trigger name const, Trent Piepho, (Fri Jul 25, 2:01 pm)
[PATCH 2/2] leds: Support OpenFirmware led bindings, Trent Piepho, (Fri Jul 25, 2:01 pm)
Re: [RFC PATCH] of_gpio: implement of_get_gpio_flags(), Trent Piepho, (Sat Jul 26, 1:26 am)
Re: [PATCH 2/2] leds: Support OpenFirmware led bindings, Grant Likely, (Sat Jul 26, 7:21 pm)
Re: [PATCH 1/2] leds: make the default trigger name const, Stephen Rothwell, (Sun Jul 27, 6:11 am)
[PATCH v2] leds: make the default trigger name const, Trent Piepho, (Sun Jul 27, 7:02 pm)
Re: [PATCH 2/2] leds: Support OpenFirmware led bindings, Trent Piepho, (Mon Jul 28, 1:31 am)
Re: [PATCH 1/2] leds: make the default trigger name const, Anton Vorontsov, (Mon Jul 28, 2:53 am)
Re: [PATCH 2/2] leds: Support OpenFirmware led bindings, Grant Likely, (Mon Jul 28, 10:09 am)
Re: [PATCH 2/2] leds: Support OpenFirmware led bindings, Anton Vorontsov, (Mon Jul 28, 11:02 am)
Re: [PATCH 2/2] leds: Support OpenFirmware led bindings, Grant Likely, (Mon Jul 28, 11:06 am)
Re: [PATCH 2/2] leds: Support OpenFirmware led bindings, Trent Piepho, (Mon Jul 28, 11:26 am)
Re: [PATCH 2/2] leds: Support OpenFirmware led bindings, Grant Likely, (Mon Jul 28, 11:49 am)
Re: [PATCH 2/2] leds: Support OpenFirmware led bindings, Anton Vorontsov, (Mon Jul 28, 11:51 am)
Re: [PATCH 2/2] leds: Support OpenFirmware led bindings, Trent Piepho, (Mon Jul 28, 12:11 pm)