From: Yong Wu via iommu <iommu@lists.linux-foundation.org>
To: Daniel Vetter <daniel@ffwll.ch>
Cc: David Airlie <airlied@linux.ie>,
Liviu Dudau <liviu.dudau@arm.com>,
dri-devel@lists.freedesktop.org,
Sebastian Reichel <sre@kernel.org>,
Srinivas Kandagatla <srinivas.kandagatla@linaro.org>,
Laurent Pinchart <laurent.pinchart@ideasonboard.com>,
Will Deacon <will@kernel.org>,
Krzysztof Kozlowski <krzysztof.kozlowski@canonical.com>,
James Wang <james.qian.wang@arm.com>,
Chun-Kuang Hu <chunkuang.hu@kernel.org>,
Arnd Bergmann <arnd@arndb.de>,
linux-mediatek@lists.infradead.org,
Hsin-Yi Wang <hsinyi@chromium.org>,
Matthias Brugger <matthias.bgg@gmail.com>,
linux-arm-kernel@lists.infradead.org,
AngeloGioacchino Del Regno
<angelogioacchino.delregno@collabora.com>,
srv_heupstream@mediatek.com, Stephen Boyd <sboyd@kernel.org>,
linux-kernel@vger.kernel.org, iommu@lists.linux-foundation.org,
Robin Murphy <robin.murphy@arm.com>
Subject: Re: [RFC PATCH] component: Add common helpers for compare/release functions
Date: Thu, 10 Feb 2022 15:50:43 +0800 [thread overview]
Message-ID: <ebb92c1c8c584464245da68e42bcafac2170558c.camel@mediatek.com> (raw)
In-Reply-To: <YfRtGF3v+BwH5RkG@phenom.ffwll.local>
On Fri, 2022-01-28 at 23:24 +0100, Daniel Vetter wrote:
> On Fri, Jan 28, 2022 at 04:11:01PM +0800, Yong Wu wrote:
> > The component requires the compare/release functions, there are so
> > many
> > copy in current kernel. Just define three common helpers for them.
> > No functional change.
> >
> > Signed-off-by: Yong Wu <yong.wu@mediatek.com>
> > ---
> > Base on v5.17-rc1
> > ---
> > .../gpu/drm/arm/display/komeda/komeda_drv.c | 5 -----
> > drivers/gpu/drm/arm/hdlcd_drv.c | 7 +------
> > drivers/gpu/drm/armada/armada_drv.c | 5 -----
> > drivers/gpu/drm/drm_of.c | 8 +-------
> > drivers/gpu/drm/etnaviv/etnaviv_drv.c | 7 -------
> > drivers/gpu/drm/exynos/exynos_drm_drv.c | 5 -----
> > .../gpu/drm/hisilicon/kirin/kirin_drm_drv.c | 5 -----
> > drivers/gpu/drm/imx/imx-drm-core.c | 4 ++--
> > drivers/gpu/drm/ingenic/ingenic-drm-drv.c | 5 -----
> > drivers/gpu/drm/mcde/mcde_drv.c | 7 +------
> > drivers/gpu/drm/mediatek/mtk_drm_drv.c | 5 -----
> > drivers/gpu/drm/meson/meson_drv.c | 8 --------
> > drivers/gpu/drm/msm/msm_drv.c | 9 ---------
> > drivers/gpu/drm/omapdrm/dss/dss.c | 8 +-------
> > drivers/gpu/drm/rockchip/rockchip_drm_drv.c | 5 -----
> > drivers/gpu/drm/sti/sti_drv.c | 5 -----
> > drivers/gpu/drm/sun4i/sun4i_drv.c | 9 ---------
> > drivers/gpu/drm/vc4/vc4_drv.c | 5 -----
> > drivers/iommu/mtk_iommu.h | 10 ----------
> > drivers/power/supply/ab8500_charger.c | 8 +-------
> > drivers/video/fbdev/omap2/omapfb/dss/dss.c | 8 +-------
> > include/linux/component.h | 18
> > ++++++++++++++++++
> > sound/soc/codecs/wcd938x.c | 16 ++----------
> > ----
>
> Seems like a neat idea. Please add kerneldoc for the new functions
> you're
> adding (bonus point for an example in there) and make sure it all
> renders
> correctly in
OK, I will add it.
>
> $ make htmldoc
sorry, I still need some time to run this in my environment.
>
> Also please split up the patch series per-driver and add the
> maintainers
> to each patches' Cc: list. With that I think this should be ready for
> merging.
In the orignal idea, I thought the name compare_of/release_of was
enough, thus I squashed them into one patch, otherwise, it may cause
build fail due to redefinition when bisecting.
From Jani, It's better to add a namespace for the function name,
something like comp_ or component_?
If the function name is changed, then I could split them. A question:
The biggest change are in DRM, and all of these patches will go
together. Maybe all the DRM parts could be in one patch, to avoid so
many small patches, is this ok? or We'd better create a patch per a drm
driver.
In the end, then the code should be something like:
--- a/drivers/base/component.c
+++ b/drivers/base/component.c
@@ -287,6 +287,24 @@ static void take_down_master(struct master
*master)
}
}
+int component_compare_of(struct device *dev, void *data)
+{
+ return device_match_of_node(dev, data);
+}
+EXPORT_SYMBOL_GPL(component_compare_of);
+
+void component_release_of(struct device *dev, void *data)
+{
+ of_node_put(data);
+}
+EXPORT_SYMBOL_GPL(component_release_of);
>
> Cheers, Daniel
>
> > 23 files changed, 28 insertions(+), 144 deletions(-)
> > diff --git a/include/linux/component.h b/include/linux/component.h
> > index 16de18f473d7..5a7468ea827c 100644
> > --- a/include/linux/component.h
> > +++ b/include/linux/component.h
> > @@ -2,6 +2,8 @@
> > #ifndef COMPONENT_H
> > #define COMPONENT_H
> >
> > +#include <linux/device.h>
> > +#include <linux/of.h>
> > #include <linux/stddef.h>
> >
> >
> > @@ -82,6 +84,22 @@ struct component_master_ops {
> > void (*unbind)(struct device *master);
> > };
> >
> > +/* A set common helpers for compare/release functions */
> > +static inline int compare_of(struct device *dev, void *data)
> > +{
> > + return dev->of_node == data;
> > +}
> > +
> > +static inline void release_of(struct device *dev, void *data)
> > +{
> > + of_node_put(data);
> > +}
> > +
> > +static inline int compare_dev(struct device *dev, void *data)
> > +{
> > + return dev == data;
> > +}
> > +
> > void component_master_del(struct device *,
> > const struct component_master_ops *);
>
>
_______________________________________________
iommu mailing list
iommu@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/iommu
prev parent reply other threads:[~2022-02-10 7:50 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-01-28 8:11 [RFC PATCH] component: Add common helpers for compare/release functions Yong Wu
2022-01-28 13:04 ` Robin Murphy
2022-02-10 7:49 ` Yong Wu via iommu
2022-01-28 22:24 ` Daniel Vetter
2022-01-31 10:57 ` Jani Nikula
2022-02-10 7:50 ` Yong Wu via iommu [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=ebb92c1c8c584464245da68e42bcafac2170558c.camel@mediatek.com \
--to=iommu@lists.linux-foundation.org \
--cc=airlied@linux.ie \
--cc=angelogioacchino.delregno@collabora.com \
--cc=arnd@arndb.de \
--cc=chunkuang.hu@kernel.org \
--cc=daniel@ffwll.ch \
--cc=dri-devel@lists.freedesktop.org \
--cc=hsinyi@chromium.org \
--cc=james.qian.wang@arm.com \
--cc=krzysztof.kozlowski@canonical.com \
--cc=laurent.pinchart@ideasonboard.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mediatek@lists.infradead.org \
--cc=liviu.dudau@arm.com \
--cc=matthias.bgg@gmail.com \
--cc=robin.murphy@arm.com \
--cc=sboyd@kernel.org \
--cc=sre@kernel.org \
--cc=srinivas.kandagatla@linaro.org \
--cc=srv_heupstream@mediatek.com \
--cc=will@kernel.org \
--cc=yong.wu@mediatek.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