Re: [PATCH] drivers:staging: sources for HCI LL PM protocol

From: Alan Cox
Date: Tue Mar 30 2010 - 14:29:40 EST


> The ST KIM module, is a platform device, which I use to pass the GPIO data from the arch/XX/board-XXX.c files, so, suppose we do have 2 devices for a platform, then I would need 2 platform devices right ?
>
> And there-by can I use that platform device context ?

Yes or some struct created in the actual module and passed around in
preference to the platform device. A lot of kernel drivers end up
creating something per device that looks like

struct my_thing {
struct device *dev; /* or pci_dev etc */
[ all my per device bits ]
};

and sometimes creating linked lists of them (for power management most
often)

> However the problem really is,
>
> Suppose a BT driver wants to do an st_register() and use ST as its transport, how can I then tie it to a device ?

Not sure I follow

If you have some kind of context to kill off all the globals then you can
attach that to whatever local object you have for each device you are
interested in. That is why IRQ handlers pass a data value, why timers do,
why tty has ldisc_data, why workqueues do similar things and so on.

And if there is another layer you need to interface to which doesn't have
some kind of pointer for binding to layers above/below - add one.

--
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/