[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <fa686aa41003121338oe34eb89o22177cb0a309cc85@mail.gmail.com>
Date: Fri, 12 Mar 2010 14:38:02 -0700
From: Grant Likely <grant.likely@...retlab.ca>
To: Andrew Morton <akpm@...ux-foundation.org>
Cc: Anton Vorontsov <avorontsov@...mvista.com>,
David Brownell <dbrownell@...rs.sourceforge.net>,
Bill Gatliff <bgat@...lgatliff.com>,
Dmitry Eremin-Solenikov <dbaryshkov@...il.com>,
Benjamin Herrenschmidt <benh@...nel.crashing.org>,
linuxppc-dev@...abs.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH 3/4] of/gpio: Implement GPIOLIB notifier hooks
On Fri, Mar 12, 2010 at 2:07 PM, Andrew Morton
<akpm@...ux-foundation.org> wrote:
> On Fri, 5 Feb 2010 23:32:36 +0300
> Anton Vorontsov <avorontsov@...mvista.com> wrote:
>
>> This patch implements GPIOLIB notifier hooks, and thus makes device-enabled
>> GPIO chips (i.e. the ones that have gpio_chip->dev specified) automatically
>> attached to the OpenFirmware subsystem. Which means that now we can handle
>> I2C and SPI GPIO chips almost* transparently.
>>
>> ...
>>
>> +static int of_gpiochip_register_simple(struct gpio_chip *chip,
>> + struct device_node *np)
>
> Why is this called "register_simple" but the unregistration function
> isn't called "unregister_simple"?
>
>> +{
>> + struct of_gpio_chip *of_gc;
>> +
>> + if (np->data) {
>> + WARN_ON(1);
>> + return -EBUSY;
>> + }
>> +
>> + of_gc = kzalloc(sizeof(*of_gc), GFP_KERNEL);
>> + if (!of_gc)
>> + return -ENOMEM;
>> +
>> + of_gc->gpio_cells = 2;
>> + of_gc->xlate = of_gpio_simple_xlate;
>> + of_gc->chip = chip;
>> + np->data = of_gc;
>> + of_node_get(np);
>> +
>> + return 0;
>> +}
>> +EXPORT_SYMBOL(of_gpiochip_register_simple);
>
> Makes no sense to export a static symbol and to provide no declaration
> of it in a .h file. I assume the export was unintended.
>
>
> My plot is somewhat lost. Grant, could you please summarise in
> easy-for-akpm-to-understand terms what your issues are with this
> patchset and how you think we should proceed?
Sure.
I suggested the notifier approach in the first place, but now that I
see what is required to implement it I don't like it. I also don't
like the potential race condition between registering GPIO devices and
registering the OF gpio notifier. It is simpler and less code to put
the of_gpio hook directly into the GPIO registration path. If
CONFIG_OF is not set, then the OF hooks can resolve to empty static
inline functions.
How to proceed: I'd like to leave this series out for the 2.6.34
cycle and I'll pick it into my OF tree before the 2.6.35 merge window,
but I'll probably modify it to call the OF hooks directly and leave
out the unnecessary notifier infrastructure.
g.
--
Grant Likely, B.Sc., P.Eng.
Secret Lab Technologies Ltd.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists