linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Saravana Kannan <saravanak@google.com>
To: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: "Rafael J. Wysocki" <rafael@kernel.org>,
	Ulf Hansson <ulf.hansson@linaro.org>,
	Marek Szyprowski <m.szyprowski@samsung.com>,
	kernel-team@android.com, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v1] driver core: fw_devlink: Don't create device links for devices not on a bus
Date: Wed, 1 Sep 2021 14:55:50 -0700	[thread overview]
Message-ID: <CAGETcx8B-9GJr_wCRLqH=eBKY+f=Cd+LGWfM+GQGt6HzOj1TdQ@mail.gmail.com> (raw)
In-Reply-To: <YS8oOWjFe4yQ1Q/v@kroah.com>

On Wed, Sep 1, 2021 at 12:14 AM Greg Kroah-Hartman
<gregkh@linuxfoundation.org> wrote:
>
> On Tue, Aug 31, 2021 at 11:57:45PM -0700, Saravana Kannan wrote:
> > On Tue, Aug 31, 2021 at 11:24 PM Greg Kroah-Hartman
> > <gregkh@linuxfoundation.org> wrote:
> > >
> > > On Tue, Aug 31, 2021 at 03:45:10PM -0700, Saravana Kannan wrote:
> > > > Devices that are not on a bus will never have a driver bound to it. So,
> > > > fw_devlink should not create device links for it as it can cause probe
> > > > issues[1] or sync_state() call back issues[2].
> > > >
> > > > [1] - https://lore.kernel.org/lkml/CAGETcx_xJCqOWtwZ9Ee2+0sPGNLM5=F=djtbdYENkAYZa0ynqQ@mail.gmail.com/
> > > > [2] - https://lore.kernel.org/lkml/CAPDyKFo9Bxremkb1dDrr4OcXSpE0keVze94Cm=zrkOVxHHxBmQ@mail.gmail.com/
> > > > Fixes: f9aa460672c9 ("driver core: Refactor fw_devlink feature")
> > > > Reported-by: Ulf Hansson <ulf.hansson@linaro.org>
> > > > Reported-by: Marek Szyprowski <m.szyprowski@samsung.com>
> > > > Signed-off-by: Saravana Kannan <saravanak@google.com>
> > > > ---
> > > >  drivers/base/core.c | 16 ++++++++++++++++
> > > >  1 file changed, 16 insertions(+)
> > > >
> > > > diff --git a/drivers/base/core.c b/drivers/base/core.c
> > > > index f6360490a4a3..304a06314656 100644
> > > > --- a/drivers/base/core.c
> > > > +++ b/drivers/base/core.c
> > > > @@ -1719,8 +1719,24 @@ static int fw_devlink_create_devlink(struct device *con,
> > > >       struct device *sup_dev;
> > > >       int ret = 0;
> > > >
> > > > +     /*
> > > > +      * If a consumer device is not on a bus (i.e. a driver will never bind
> > > > +      * to it), it doesn't make sense for fw_devlink to create device links
> > > > +      * for it.
> > > > +      */
> > > > +     if (con->bus == NULL)
> > > > +             return -EINVAL;
> > > > +
> > >
> > > Why would a device not be on a bus that has to do with a driver needing
> > > it?  What types of devices are these?
> >
> > I'm not sure what you are asking, because it seems like a question
> > you'd know the answer to. What I'm trying to say is that
> > bus_probe_device() is obviously only possible if the device is on a
> > bus. And fw_devlink creates managed device links that track if a
> > device is bound to a driver. So it doesn't make sense to create the
> > device link if the device is not on a bus.
> >
> > There are plenty of examples for this -- like all the devices that get
> > added to a class? For example the platform bus or the mdio bus itself
> > are devices that are added to a class instead of a bus.
> >
> > Not sure if I answered your question. Let me know.
>
> Sorry, that was a vague question.
>
> I was trying to say, "how can a device that is not attached to a bus at
> all even be called for this?"

This code path is called for all device_add()s.

> Who would be making that type of
> connection, what subsystem is causing this to happen?

fw_devlink trying to interpret DT dependencies can sometimes end up in
this situation for some uncommon cases. But it's not helping [1] or
[2], so for now let's drop this patch. I'll come back to this if I
need this to fix any real issue.

-Saravana

  reply	other threads:[~2021-09-01 21:56 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-31 22:45 [PATCH v1] driver core: fw_devlink: Don't create device links for devices not on a bus Saravana Kannan
2021-09-01  6:24 ` Greg Kroah-Hartman
2021-09-01  6:57   ` Saravana Kannan
2021-09-01  7:14     ` Greg Kroah-Hartman
2021-09-01 21:55       ` Saravana Kannan [this message]
2021-09-01 22:11         ` Ulf Hansson
2021-09-01 15:44 ` Ulf Hansson
2021-09-01 21:53   ` Saravana Kannan
2021-09-01 22:17     ` Ulf Hansson
2021-09-02  0:16       ` Saravana Kannan
2021-09-02  1:43         ` Saravana Kannan

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='CAGETcx8B-9GJr_wCRLqH=eBKY+f=Cd+LGWfM+GQGt6HzOj1TdQ@mail.gmail.com' \
    --to=saravanak@google.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=kernel-team@android.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=m.szyprowski@samsung.com \
    --cc=rafael@kernel.org \
    --cc=ulf.hansson@linaro.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;
as well as URLs for NNTP newsgroup(s).