[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <4111948.OqsXPJi3b5@vostro.rjw.lan>
Date: Fri, 26 Sep 2014 16:42:28 +0200
From: "Rafael J. Wysocki" <rjw@...ysocki.net>
To: Arnd Bergmann <arnd@...db.de>
Cc: Darren Hart <dvhart@...radead.org>,
David Woodhouse <david.woodhouse@...el.com>,
Linus Walleij <linus.walleij@...aro.org>,
Mika Westerberg <mika.westerberg@...ux.intel.com>,
Grant Likely <grant.likely@...aro.org>,
Mark Rutland <mark.rutland@....com>,
ACPI Devel Maling List <linux-acpi@...r.kernel.org>,
"devicetree@...r.kernel.org" <devicetree@...r.kernel.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Alexandre Courbot <gnurou@...il.com>,
Dmitry Torokhov <dmitry.torokhov@...il.com>,
Bryan Wu <cooloney@...il.com>,
Lee Jones <lee.jones@...aro.org>, Aaron Lu <aaron.lu@...el.com>
Subject: Re: [RFC PATCH v2 07/16] gpio: Add support for unified device properties interface
On Friday, September 26, 2014 10:36:06 AM Arnd Bergmann wrote:
> On Thursday 25 September 2014 20:21:32 Darren Hart wrote:
> > On Wed, Sep 24, 2014 at 11:12:36AM +0200, Arnd Bergmann wrote:
> > > How would you feel about a more general way of probing LED, using
> > > a new helper in the leds-core that iterates over the child nodes
> > > and parses the standard properties but calls into a driver specific
> > > callback to parse the specific properties?
> > > It's probably much more work than your current approach, but it seems
> > > to me that there is more to gain by solving the problem for LED
> > > drivers in particular to cut down the per-driver duplication
> > > at the same time as the per-firmware-interface duplication.
> > >
> > > As a start, we could probably take the proposed device_for_each_child_node
> > > and move that into the leds-core, changing the fw_dev_node argument
> > > for an led_classdev with the addition of the of_node and acpi_object
> > > members. It would still leave it up to the gpio-leds driver to do
> > >
> > > if (led_cdev->of_node)
> > > gpiod = devm_of_get_gpiod(led_cdev->of_node, ...);
> > > else
> > > gpiod = devm_acpi_get_gpiod(led_cdev->acpi_object, ...);
> >
> > So as Mika has pointed out, LEDs aren't the only ones affected. Several drivers
> > will need to walk through non-device child nodes, and it seems to me that having
> > a firmware-independent mechanism to do so benefits the drivers by both making
> > them smaller and by increasing the reusability of new drivers and drivers
> > updated to use the new API across platforms.
> >
> > I fear we might be entering bike shed territory as we seem to be repeating
> > points now. Can you restate your concern with the interface and why this level
> > of abstraction is worse for the kernel? I'm not seeing this point, so I'm not
> > sure what to address in my response.
>
> I think we should have abstractions for all common interfaces but make
> them as simple as possible. In the discussions at the kernel summit,
> everyone agreed that we should have common accessors for simple properties
> (bool, int, string, ...) based on device pointers, as well as subsystem
> specific accessors to handle the high-level abstractions (registers,
> interrupts, gpio, regulator, pinctrl, dma, reset, pwm, ...).
>
> Having generalized accessors for the same properties in child nodes of
> the device goes beyond that, and I think this is the wrong trade-off
> between interface simplicity and generality since only few drivers will
> be able to use those. I think we will always have to live with a leaky
> abstraction because some drivers need to do things beyond what we can
> do with a common API.
Some drivers do, but then we can avoid adding DT/ACPI knowledge to some
drivers by adding general accessors for properties in child nodes. In my
opinion, drivers should not do things specific to DT/ACPI unless that is
unavoidable.
>
> > Grant, Linus W? Thoughts?
>
> I definitely want to hear other voices on this too. This is really not
> a fundamental debate I think, but more a question of how far the abstraction
> should go.
Right.
--
I speak only for myself.
Rafael J. Wysocki, Intel Open Source Technology Center.
--
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