public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: "Måns Rullgård" <mans@mansr.com>
To: "Rafael J. Wysocki" <rafael@kernel.org>
Cc: Johan Hovold <johan@kernel.org>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] platform: set of_node in platform_device_register_full()
Date: Wed, 20 Feb 2019 12:26:46 +0000	[thread overview]
Message-ID: <yw1xef82wsqh.fsf@mansr.com> (raw)
In-Reply-To: <CAJZ5v0jTxeVrDSA8RMVZ+U7-TvPN72ZcF+J4r66-dhngaWpiAw@mail.gmail.com> (Rafael J. Wysocki's message of "Wed, 20 Feb 2019 13:18:39 +0100")

"Rafael J. Wysocki" <rafael@kernel.org> writes:

> On Wed, Feb 20, 2019 at 1:12 PM Måns Rullgård <mans@mansr.com> wrote:
>>
>> Johan Hovold <johan@kernel.org> writes:
>>
>> > On Wed, Feb 20, 2019 at 11:35:06AM +0000, Mans Rullgard wrote:
>> >> If the provided fwnode is an OF node, set dev.of_node as well.
>> >>
>> >> Some drivers are just shims that create extra "glue" devices with the
>> >> DT device as parent and have the real driver bind to these.  In these
>> >> cases, the glue device needs to get a reference to the original DT node
>> >> in order for the main driver to access properties and child nodes.
>> >>
>> >> For example, the sunxi-musb driver creates such a glue device using
>> >> platform_device_register_full().  Consequently, devices attached to
>> >> this USB interface don't get associated with DT nodes, if present,
>> >> the way they do with EHCI.
>> >>
>> >> This change will allow sunxi-musb and similar driver to easily
>> >> propagate the DT node to child devices as required.
>> >
>> > Just a drive-by comment, didn't look to closely at this patch, but this
>> > all sounds familiar.
>> >
>> > Note that if both platform devices are bound to drivers you may end up
>> > with some resources like pinctrl which are handled automatically by
>> > driver core at probe time to be requested twice (and failing the second
>> > time).
>> >
>> > Take a look at 4e75e1d7dac9 ("driver core: add helper to reuse a
>> > device-tree node"), which provides a means to avoid this, and
>> > 49484abd93ab ("USB: musb: dsps: propagate device-tree node").
>>
>> Thanks, and ugh.  So we should be setting the of_node_reused flag when
>> this is the case.  It's easy for the musb-dsps driver since it doesn't
>> use platform_device_register_full() and can do this before the
>> device_add() call.  How can we convey that this flag needs to be set?
>
> Through pdevinfo I guess?

Not without adding another field to it.  The most direct is of course to
simply add an of_node_reused flag there too and copy it over.  Would
that be OK, or is there a better way?

-- 
Måns Rullgård

  reply	other threads:[~2019-02-20 12:26 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-02-16 16:45 [PATCH] platform: set of_node in platform_device_register_full() Mans Rullgard
2019-02-17 21:36 ` Rafael J. Wysocki
2019-02-18 11:03   ` Måns Rullgård
2019-02-20  9:50     ` Rafael J. Wysocki
2019-02-20 10:41       ` Måns Rullgård
2019-02-20 10:51         ` Rafael J. Wysocki
2019-02-20 11:02           ` Måns Rullgård
2019-02-20 11:08             ` Rafael J. Wysocki
2019-02-20 11:35 ` Mans Rullgard
2019-02-20 11:51   ` Johan Hovold
2019-02-20 12:12     ` Måns Rullgård
2019-02-20 12:18       ` Rafael J. Wysocki
2019-02-20 12:26         ` Måns Rullgård [this message]
2019-02-20 21:50           ` Rafael J. Wysocki
2019-02-20 11:53   ` Måns Rullgård

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=yw1xef82wsqh.fsf@mansr.com \
    --to=mans@mansr.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=johan@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rafael@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox