lkml.org 
[lkml]   [2017]   [Feb]   [3]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH 4/6] bus: add driver for the Technologic Systems NBUS
From
Date
Hi Linus,

On 02/03/2017 08:51 AM, Linus Walleij wrote:
> Your child nodes I guess will be instatiated as devices as well.
>
> These devices will have the NBUS driver as .parent in their
> struct device I guess. Else the design of this bus is tilted.
>
> If the NBUS driver use dev_set_drvdata(dev, state_container_cookie)
> the children can use dev_get_drvdata(dev->parent); to get a pointer to
> the same cookie.
>
> The subdrivers don't even need to know the members of the state
> container as long as you're just passing a pointer to it. It's
> enough if you forward-declare it as a "pointer to some struct":
>
> struct foo;
>
> {
> struct foo *fooptr = dev_get_drvdata(dev->parent);
> write(fooptr, 0x10);
>
> etc

Thanks a lot, this is perfect!

Best Regards,
Sebastien.

\
 
 \ /
  Last update: 2017-02-03 16:57    [W:0.105 / U:0.340 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site