From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751164AbdBCP4u (ORCPT ); Fri, 3 Feb 2017 10:56:50 -0500 Received: from mail.savoirfairelinux.com ([208.88.110.44]:54988 "EHLO mail.savoirfairelinux.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751027AbdBCP4r (ORCPT ); Fri, 3 Feb 2017 10:56:47 -0500 Subject: Re: [PATCH 4/6] bus: add driver for the Technologic Systems NBUS To: Linus Walleij References: <20161214231237.17496-1-sebastien.bourdelin@savoirfairelinux.com> <20161214231237.17496-5-sebastien.bourdelin@savoirfairelinux.com> <7bc0871f-ac0a-e8a0-0c84-a0e61b3991a8@savoirfairelinux.com> Cc: "linux-kernel@vger.kernel.org" , linux-watchdog@vger.kernel.org, "linux-arm-kernel@lists.infradead.org" , "devicetree@vger.kernel.org" , kernel , Mark Featherston , kris@embeddedarm.com, Simon Horman , Thierry Reding , Jon Hunter , Florian Fainelli , Fabio Estevam , Sascha Hauer , Shawn Guo , Russell King , Guenter Roeck , Wim Van Sebroeck , Mark Rutland , Rob Herring , damien.riegel@savoirfairelinux.com, Lucile Quirion , Olof Johansson , Arnd Bergmann , "Suzuki K. Poulose" , Will Deacon , Masahiro Yamada From: Sebastien Bourdelin Message-ID: <3f3cd438-63dc-dea8-e17b-7eb3e588cc36@savoirfairelinux.com> Date: Fri, 3 Feb 2017 10:56:34 -0500 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.6.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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.