Re: [PATCH RFC 02/11 v4] gpio: Add sysfs support to block GPIO API

From: Linus Walleij
Date: Tue Oct 16 2012 - 17:08:42 EST


On Tue, Oct 16, 2012 at 7:40 PM, Greg KH <gregkh@xxxxxxxxxxxxxxxxxxx> wrote:
> On Tue, Oct 16, 2012 at 07:27:15PM +0200, Linus Walleij wrote:
>> The thing is, as I've tried to explain but maybe didn't get across,
>> that these devices don't *have* a parent, and are not part of any
>> tree.
>
> You are passing in a parent device to the device_create() call, where
> did that pointer come from?

You mean this:

dev = device_create(&gpio_class, desc->chip->dev, MKDEV(0, 0),
desc, ioname ? ioname : "gpio%u", gpio);

desc->chip->dev is an *optional* pointer to a parent device of
the GPIO chip (not the GPIO chip itself). It is usually NULL.

>> They are parentless mock devices, created on-the-fly just to get
>> sysfs entries.
>
> That's fine, well, not the "parentless" part, but that should be trivial
> to fix, just pass in the correct pointer and you should be fine.

Hm, yeah well, they are orphans mostly.

>> What is needed it to get the device model right in the first
>> place.
>
> I thought it was in the device model already?

GPIO chips are not devices. :-(

Yours,
Linus Walleij
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/