All of lore.kernel.org
 help / color / mirror / Atom feed
From: Herve Codina <herve.codina@bootlin.com>
To: Saravana Kannan <saravanak@google.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	"Rafael J. Wysocki" <rafael@kernel.org>,
	linux-kernel@vger.kernel.org,
	Allan Nielsen <allan.nielsen@microchip.com>,
	Horatiu Vultur <horatiu.vultur@microchip.com>,
	Steen Hegelund <steen.hegelund@microchip.com>,
	Thomas Petazzoni <thomas.petazzoni@bootlin.com>,
	stable@vger.kernel.org
Subject: Re: [PATCH 1/1] driver core: Keep the supplier fwnode consistent with the device
Date: Mon, 13 Nov 2023 10:38:20 +0100	[thread overview]
Message-ID: <20231113103820.7b04f5d0@bootlin.com> (raw)
In-Reply-To: <CAGETcx-06mFw+KNvYRf36etkQwuF4TJyNzt=KmwnCUzptKnMrw@mail.gmail.com>

Hi Saravana,

On Fri, 10 Nov 2023 17:50:07 -0800
Saravana Kannan <saravanak@google.com> wrote:

> On Thu, Nov 9, 2023 at 11:56 PM Herve Codina <herve.codina@bootlin.com> wrote:
> >
> > The commit 3a2dbc510c43 ("driver core: fw_devlink: Don't purge child
> > fwnode's consumer links") introduces the possibility to use the
> > supplier's parent device instead of the supplier itself.
> > In that case the supplier fwnode used is not updated and is no more
> > consistent with the supplier device used.
> >
> > Update the fwnode used to be consistent with the supplier device used.
> >
> > Fixes: 3a2dbc510c43 ("driver core: fw_devlink: Don't purge child fwnode's consumer links")
> > Cc: stable@vger.kernel.org
> > Signed-off-by: Herve Codina <herve.codina@bootlin.com>
> > ---
> >  drivers/base/core.c | 12 ++++++++++++
> >  1 file changed, 12 insertions(+)
> >
> > diff --git a/drivers/base/core.c b/drivers/base/core.c
> > index 4d8b315c48a1..17f2568e0a79 100644
> > --- a/drivers/base/core.c
> > +++ b/drivers/base/core.c
> > @@ -2076,6 +2076,18 @@ static int fw_devlink_create_devlink(struct device *con,
> >                 sup_dev = get_dev_from_fwnode(sup_handle);
> >
> >         if (sup_dev) {
> > +               /*
> > +                * The supplier device may have changed and so, the supplier
> > +                * fwnode maybe inconsistent.
> > +                * Update the supplier fwnode
> > +                */
> > +               sup_handle = sup_dev->fwnode;
> > +               if (!sup_handle) {
> > +                       dev_dbg(con, "Not linking %s - fwnode NULL\n",
> > +                               dev_name(sup_dev));
> > +                       goto out;
> > +               }
> > +  
> 
> Nack. It's easier to debug when you know what supplier you were
> pointing to in DT that triggered the creation of the device link. The
> parent could be several levels up and multiple supplier links might be
> skipped for various reasons. If they all printed the parent's fwnode,
> it'll be confusing to debug.

In fact, I will remove the check if(!sup_handle) in the next iteration.

Indeed, sup_handle cannot be NULL.
sup_dev is retrieved from fwnode_get_next_parent_dev() or get_dev_from_fwnode().
In both cases, if sup_dev is valid, sup_dev->fwnode is valid too.
So, the check and the dev_dbg() call make no sense.

Best regards,
Hervé

      reply	other threads:[~2023-11-13  9:38 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-11-10  7:55 [PATCH 1/1] driver core: Keep the supplier fwnode consistent with the device Herve Codina
2023-11-11  1:50 ` Saravana Kannan
2023-11-13  9:38   ` Herve Codina [this message]

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=20231113103820.7b04f5d0@bootlin.com \
    --to=herve.codina@bootlin.com \
    --cc=allan.nielsen@microchip.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=horatiu.vultur@microchip.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rafael@kernel.org \
    --cc=saravanak@google.com \
    --cc=stable@vger.kernel.org \
    --cc=steen.hegelund@microchip.com \
    --cc=thomas.petazzoni@bootlin.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.