From: Miquel Raynal <miquel.raynal@bootlin.com>
To: Rob Herring <robh@kernel.org>
Cc: Thierry Reding <thierry.reding@gmail.com>,
David Airlie <airlied@gmail.com>, Daniel Vetter <daniel@ffwll.ch>,
Mikko Perttunen <mperttunen@nvidia.com>,
dri-devel@lists.freedesktop.org,
Krzysztof Kozlowski <krzk+dt@kernel.org>,
devicetree@vger.kernel.org,
Thomas Petazzoni <thomas.petazzoni@bootlin.com>,
linux-tegra@vger.kernel.org,
Frank Rowand <frowand.list@gmail.com>
Subject: Re: [PATCH v2 2/2] gpu: host1x: Stop open-coding of_device_uevent()
Date: Thu, 22 Jun 2023 23:29:32 +0200 [thread overview]
Message-ID: <20230622232932.4a077869@xps-13> (raw)
In-Reply-To: <20230622143140.GA1638531-robh@kernel.org>
Hi Rob,
robh@kernel.org wrote on Thu, 22 Jun 2023 08:31:40 -0600:
> On Fri, Jun 09, 2023 at 05:56:34PM +0200, Miquel Raynal wrote:
> > There is apparently no reasons to open-code of_device_uevent() besides:
> > - The helper receives a struct device while we want to use the of_node
> > member of the struct device *parent*.
> > - of_device_uevent() could not be called by modules because of a missing
> > EXPORT_SYMBOL*().
> >
> > In practice, the former point is not very constraining, just calling
> > of_device_uevent(dev->parent, ...) would have made the trick.
> >
> > The latter point is more an observation rather than a real blocking
> > point because nothing prevented of_uevent() (called by the inline
> > function of_device_uevent()) to be exported to modules. In practice,
> > this helper is now exported, so nothing prevent us from using
> > of_device_uevent() anymore.
> >
> > Let's use the core helper directly instead of open-coding it.
> >
> > Cc: Thierry Reding <thierry.reding@gmail.com>
> > Cc: David Airlie <airlied@gmail.com>
> > Cc: Daniel Vetter <daniel@ffwll.ch>
> > Cc: Mikko Perttunen <mperttunen@nvidia.com>
> > Cc: Rob Herring <robh+dt@kernel.org>
> > Cc: Frank Rowand <frowand.list@gmail.com>
> > Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
> >
> > ---
> >
> > This patch depends on the changes performed earlier in the series under
> > the drivers/of/ folder.
> > ---
> > drivers/gpu/host1x/bus.c | 29 ++++++-----------------------
> > 1 file changed, 6 insertions(+), 23 deletions(-)
> >
> > diff --git a/drivers/gpu/host1x/bus.c b/drivers/gpu/host1x/bus.c
> > index 4d16a3396c4a..dae589b83be1 100644
> > --- a/drivers/gpu/host1x/bus.c
> > +++ b/drivers/gpu/host1x/bus.c
> > @@ -338,32 +338,15 @@ static int host1x_device_match(struct device *dev, struct device_driver *drv)
> > return strcmp(dev_name(dev), drv->name) == 0;
> > }
> >
> > +/*
> > + * Note that this is really only needed for backwards compatibility
> > + * with libdrm, which parses this information from sysfs and will
> > + * fail if it can't find the OF_FULLNAME, specifically.
> > + */
> > static int host1x_device_uevent(const struct device *dev,
> > struct kobj_uevent_env *env)
> > {
> > - struct device_node *np = dev->parent->of_node;
> > - unsigned int count = 0;
> > - struct property *p;
> > - const char *compat;
> > -
> > - /*
> > - * This duplicates most of of_device_uevent(), but the latter cannot
> > - * be called from modules and operates on dev->of_node, which is not
> > - * available in this case.
> > - *
> > - * Note that this is really only needed for backwards compatibility
> > - * with libdrm, which parses this information from sysfs and will
> > - * fail if it can't find the OF_FULLNAME, specifically.
> > - */
> > - add_uevent_var(env, "OF_NAME=%pOFn", np);
> > - add_uevent_var(env, "OF_FULLNAME=%pOF", np);
> > -
> > - of_property_for_each_string(np, "compatible", p, compat) {
> > - add_uevent_var(env, "OF_COMPATIBLE_%u=%s", count, compat);
> > - count++;
> > - }
> > -
> > - add_uevent_var(env, "OF_COMPATIBLE_N=%u", count);
> > + of_device_uevent((const struct device *)&dev->parent, env);
>
> Why do you have the cast and the "&"?
Actually that's a mistake, I was blurred by the "I want a const pointer
and this is not a const pointer" warning (hence the cast). This change
is broken, I'll fix it.
Thanks,
Miquèl
prev parent reply other threads:[~2023-06-22 21:29 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-06-09 15:56 [PATCH v2 0/2] Small of/device cleanup Miquel Raynal
2023-06-09 15:56 ` [PATCH v2 1/2] of: module: Export of_device_uevent() Miquel Raynal
2023-06-14 23:34 ` Rob Herring
2023-06-09 15:56 ` [PATCH v2 2/2] gpu: host1x: Stop open-coding of_device_uevent() Miquel Raynal
2023-06-22 14:31 ` Rob Herring
2023-06-22 21:29 ` Miquel Raynal [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=20230622232932.4a077869@xps-13 \
--to=miquel.raynal@bootlin.com \
--cc=airlied@gmail.com \
--cc=daniel@ffwll.ch \
--cc=devicetree@vger.kernel.org \
--cc=dri-devel@lists.freedesktop.org \
--cc=frowand.list@gmail.com \
--cc=krzk+dt@kernel.org \
--cc=linux-tegra@vger.kernel.org \
--cc=mperttunen@nvidia.com \
--cc=robh@kernel.org \
--cc=thierry.reding@gmail.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 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).