From: sarha@kapsi.fi
To: "Sean Anderson" <sean.anderson@seco.com>,
"David Airlie" <airlied@gmail.com>,
"Daniel Vetter" <daniel@ffwll.ch>,
"Maarten Lankhorst" <maarten.lankhorst@linux.intel.com>,
"Maxime Ripard" <mripard@kernel.org>,
"Thomas Zimmermann" <tzimmermann@suse.de>,
dri-devel@lists.freedesktop.org
Cc: linux-kernel@vger.kernel.org,
"Abhinav Kumar" <quic_abhinavk@quicinc.com>,
"Alain Volmat" <alain.volmat@foss.st.com>,
"Brian Starkey" <brian.starkey@arm.com>,
"Chen Feng" <puck.chen@hisilicon.com>,
"Chen-Yu Tsai" <wens@csie.org>,
"Christian Gmeiner" <christian.gmeiner@gmail.com>,
"Chun-Kuang Hu" <chunkuang.hu@kernel.org>,
"Dmitry Baryshkov" <dmitry.baryshkov@linaro.org>,
"Jernej Skrabec" <jernej.skrabec@gmail.com>,
"John Stultz" <jstultz@google.com>,
"Jyri Sarha" <jyri.sarha@iki.fi>,
"Liviu Dudau" <liviu.dudau@arm.com>,
"Lucas Stach" <l.stach@pengutronix.de>,
"Mali DP Maintainers" <malidp@foss.arm.com>,
"Matthias Brugger" <matthias.bgg@gmail.com>,
"Mihail Atanassov" <mihail.atanassov@arm.com>,
"Paul Cercueil" <paul@crapouillou.net>,
"Philipp Zabel" <p.zabel@pengutronix.de>,
"Rob Clark" <robdclark@gmail.com>,
"Russell King" <linux@armlinux.org.uk>,
"Samuel Holland" <samuel@sholland.org>,
"Sean Paul" <sean@poorly.run>,
"Tian Tao" <tiantao6@hisilicon.com>,
"Tomi Valkeinen" <tomba@kernel.org>,
"Xinliang Liu" <xinliang.liu@linaro.org>,
"Xinwei Kong" <kong.kongxinwei@hisilicon.com>,
etnaviv@lists.freedesktop.org, freedreno@lists.freedesktop.org,
linux-arm-kernel@lists.infradead.org,
linux-arm-msm@vger.kernel.org,
linux-mediatek@lists.infradead.org, linux-mips@vger.kernel.org,
linux-sunxi@lists.linux.dev
Subject: Re: [PATCH 2/2] drm: Convert users of drm_of_component_match_add to component_match_add_of
Date: Mon, 07 Nov 2022 20:27:02 +0000 [thread overview]
Message-ID: <4ad0beebfea802c1caec176f4d71955407cd5c4f@kapsi.fi> (raw)
In-Reply-To: 20221103182222.2247724-1-sean.anderson@seco.com
November 3, 2022 at 8:22 PM, "Sean Anderson" <sean.anderson@seco.com mailto:sean.anderson@seco.com?to=%22Sean%20Anderson%22%20%3Csean.anderson%40seco.com%3E > wrote:
>
> Every user of this function either uses component_compare_of or
> something equivalent. Most of them immediately put the device node as
> well. Convert these users to component_match_add_of and remove
> drm_of_component_match_add.
>
> Signed-off-by: Sean Anderson <sean.anderson@seco.com>
Acked-by: Jyri Sarha <jyri.sarhaı@iki.fi>
Also tested that Beaglebone-Black HDMI audio, that relies on componet system, still works. So for tilcdc:
Tested-by: Jyri Sarha <jyri.sarha@iki.fi>
> ---
>
> .../gpu/drm/arm/display/komeda/komeda_drv.c | 6 ++--
> drivers/gpu/drm/arm/hdlcd_drv.c | 9 +-----
> drivers/gpu/drm/arm/malidp_drv.c | 11 +------
> drivers/gpu/drm/armada/armada_drv.c | 10 ++++---
> drivers/gpu/drm/drm_of.c | 29 +++----------------
> drivers/gpu/drm/etnaviv/etnaviv_drv.c | 4 +--
> .../gpu/drm/hisilicon/kirin/kirin_drm_drv.c | 3 +-
> drivers/gpu/drm/ingenic/ingenic-drm-drv.c | 3 +-
> drivers/gpu/drm/mediatek/mtk_drm_drv.c | 4 +--
> drivers/gpu/drm/msm/msm_drv.c | 14 ++++-----
> drivers/gpu/drm/sti/sti_drv.c | 3 +-
> drivers/gpu/drm/sun4i/sun4i_drv.c | 3 +-
> drivers/gpu/drm/tilcdc/tilcdc_external.c | 10 ++-----
> include/drm/drm_of.h | 12 --------
> 14 files changed, 33 insertions(+), 88 deletions(-)
>
> diff --git a/drivers/gpu/drm/arm/display/komeda/komeda_drv.c b/drivers/gpu/drm/arm/display/komeda/komeda_drv.c
> index 9fce4239d4ad..e5bf439b799f 100644
> --- a/drivers/gpu/drm/arm/display/komeda/komeda_drv.c
> +++ b/drivers/gpu/drm/arm/display/komeda/komeda_drv.c
> @@ -103,10 +103,8 @@ static void komeda_add_slave(struct device *master,
> struct device_node *remote;
>
> remote = of_graph_get_remote_node(np, port, endpoint);
> - if (remote) {
> - drm_of_component_match_add(master, match, component_compare_of, remote);
> - of_node_put(remote);
> - }
> + if (remote)
> + component_match_add_of(master, match, remote);
> }
>
> static int komeda_platform_probe(struct platform_device *pdev)
> diff --git a/drivers/gpu/drm/arm/hdlcd_drv.c b/drivers/gpu/drm/arm/hdlcd_drv.c
> index a032003c340c..18e58863a2f1 100644
> --- a/drivers/gpu/drm/arm/hdlcd_drv.c
> +++ b/drivers/gpu/drm/arm/hdlcd_drv.c
> @@ -352,11 +352,6 @@ static const struct component_master_ops hdlcd_master_ops = {
> .unbind = hdlcd_drm_unbind,
> };
>
> -static int compare_dev(struct device *dev, void *data)
> -{
> - return dev->of_node == data;
> -}
> -
> static int hdlcd_probe(struct platform_device *pdev)
> {
> struct device_node *port;
> @@ -367,9 +362,7 @@ static int hdlcd_probe(struct platform_device *pdev)
> if (!port)
> return -ENODEV;
>
> - drm_of_component_match_add(&pdev->dev, &match, compare_dev, port);
> - of_node_put(port);
> -
> + component_match_add_of(&pdev->dev, &match, port);
> return component_master_add_with_match(&pdev->dev, &hdlcd_master_ops,
> match);
> }
> diff --git a/drivers/gpu/drm/arm/malidp_drv.c b/drivers/gpu/drm/arm/malidp_drv.c
> index 1d0b0c54ccc7..aace8b87c6d3 100644
> --- a/drivers/gpu/drm/arm/malidp_drv.c
> +++ b/drivers/gpu/drm/arm/malidp_drv.c
> @@ -926,13 +926,6 @@ static const struct component_master_ops malidp_master_ops = {
> .unbind = malidp_unbind,
> };
>
> -static int malidp_compare_dev(struct device *dev, void *data)
> -{
> - struct device_node *np = data;
> -
> - return dev->of_node == np;
> -}
> -
> static int malidp_platform_probe(struct platform_device *pdev)
> {
> struct device_node *port;
> @@ -946,9 +939,7 @@ static int malidp_platform_probe(struct platform_device *pdev)
> if (!port)
> return -ENODEV;
>
> - drm_of_component_match_add(&pdev->dev, &match, malidp_compare_dev,
> - port);
> - of_node_put(port);
> + component_match_add_of(&pdev->dev, &match, port);
> return component_master_add_with_match(&pdev->dev, &malidp_master_ops,
> match);
> }
> diff --git a/drivers/gpu/drm/armada/armada_drv.c b/drivers/gpu/drm/armada/armada_drv.c
> index 0643887800b4..c0211ad7a45d 100644
> --- a/drivers/gpu/drm/armada/armada_drv.c
> +++ b/drivers/gpu/drm/armada/armada_drv.c
> @@ -184,10 +184,12 @@ static void armada_add_endpoints(struct device *dev,
>
> for_each_endpoint_of_node(dev_node, ep) {
> remote = of_graph_get_remote_port_parent(ep);
> - if (remote of_device_is_available(remote))
> - drm_of_component_match_add(dev, match, component_compare_of,
> - remote);
> - of_node_put(remote);
> + if (remote) {
> + if (of_device_is_available(remote))
> + component_match_add_of(dev, match, remote);
> + else
> + of_node_put(remote);
> + }
> }
> }
>
> diff --git a/drivers/gpu/drm/drm_of.c b/drivers/gpu/drm/drm_of.c
> index 7bbcb999bb75..0a474729ddf6 100644
> --- a/drivers/gpu/drm/drm_of.c
> +++ b/drivers/gpu/drm/drm_of.c
> @@ -78,24 +78,6 @@ uint32_t drm_of_find_possible_crtcs(struct drm_device *dev,
> }
> EXPORT_SYMBOL(drm_of_find_possible_crtcs);
>
> -/**
> - * drm_of_component_match_add - Add a component helper OF node match rule
> - * @master: master device
> - * @matchptr: component match pointer
> - * @compare: compare function used for matching component
> - * @node: of_node
> - */
> -void drm_of_component_match_add(struct device *master,
> - struct component_match **matchptr,
> - int (*compare)(struct device *, void *),
> - struct device_node *node)
> -{
> - of_node_get(node);
> - component_match_add_release(master, matchptr, component_release_of,
> - compare, node);
> -}
> -EXPORT_SYMBOL_GPL(drm_of_component_match_add);
> -
> /**
> * drm_of_component_probe - Generic probe function for a component based master
> * @dev: master device containing the OF node
> @@ -130,10 +112,9 @@ int drm_of_component_probe(struct device *dev,
> break;
>
> if (of_device_is_available(port->parent))
> - drm_of_component_match_add(dev, &match, compare_of,
> - port);
> -
> - of_node_put(port);
> + component_match_add_of(dev, &match, port);
> + else
> + of_node_put(port);
> }
>
> if (i == 0) {
> @@ -171,9 +152,7 @@ int drm_of_component_probe(struct device *dev,
> continue;
> }
>
> - drm_of_component_match_add(dev, &match, compare_of,
> - remote);
> - of_node_put(remote);
> + component_match_add_of(dev, &match, remote);
> }
> of_node_put(port);
> }
> diff --git a/drivers/gpu/drm/etnaviv/etnaviv_drv.c b/drivers/gpu/drm/etnaviv/etnaviv_drv.c
> index 1d2b4fb4bcf8..4a0dba34a6e7 100644
> --- a/drivers/gpu/drm/etnaviv/etnaviv_drv.c
> +++ b/drivers/gpu/drm/etnaviv/etnaviv_drv.c
> @@ -590,8 +590,8 @@ static int etnaviv_pdev_probe(struct platform_device *pdev)
> if (!first_node)
> first_node = core_node;
>
> - drm_of_component_match_add(&pdev->dev, &match,
> - component_compare_of, core_node);
> + of_node_get(core_node);
> + component_match_add_of(&pdev->dev, &match, core_node);
> }
> } else {
> char **names = dev->platform_data;
> diff --git a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c
> index 73ee7f25f734..fc736759274f 100644
> --- a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c
> +++ b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c
> @@ -273,8 +273,7 @@ static int kirin_drm_platform_probe(struct platform_device *pdev)
> if (!remote)
> return -ENODEV;
>
> - drm_of_component_match_add(dev, &match, component_compare_of, remote);
> - of_node_put(remote);
> + component_match_add_of(dev, &match, remote);
>
> return component_master_add_with_match(dev, &kirin_drm_ops, match);
> }
> diff --git a/drivers/gpu/drm/ingenic/ingenic-drm-drv.c b/drivers/gpu/drm/ingenic/ingenic-drm-drv.c
> index ab0515d2c420..75a19e6b85c0 100644
> --- a/drivers/gpu/drm/ingenic/ingenic-drm-drv.c
> +++ b/drivers/gpu/drm/ingenic/ingenic-drm-drv.c
> @@ -1445,8 +1445,7 @@ static int ingenic_drm_probe(struct platform_device *pdev)
> if (!np)
> return ingenic_drm_bind(dev, false);
>
> - drm_of_component_match_add(dev, &match, component_compare_of, np);
> - of_node_put(np);
> + component_match_add_of(dev, &match, np);
>
> return component_master_add_with_match(dev, &ingenic_master_ops, match);
> }
> diff --git a/drivers/gpu/drm/mediatek/mtk_drm_drv.c b/drivers/gpu/drm/mediatek/mtk_drm_drv.c
> index 91f58db5915f..9ca265129659 100644
> --- a/drivers/gpu/drm/mediatek/mtk_drm_drv.c
> +++ b/drivers/gpu/drm/mediatek/mtk_drm_drv.c
> @@ -779,8 +779,8 @@ static int mtk_drm_probe(struct platform_device *pdev)
> comp_type == MTK_DSI) {
> dev_info(dev, "Adding component match for %pOF\n",
> node);
> - drm_of_component_match_add(dev, &match, component_compare_of,
> - node);
> + of_node_get(node);
> + component_match_add_of(dev, &match, node);
> }
>
> ret = mtk_ddp_comp_init(node, &private->ddp_comp[comp_id], comp_id);
> diff --git a/drivers/gpu/drm/msm/msm_drv.c b/drivers/gpu/drm/msm/msm_drv.c
> index 28034c21f6bc..1152da3d58dc 100644
> --- a/drivers/gpu/drm/msm/msm_drv.c
> +++ b/drivers/gpu/drm/msm/msm_drv.c
> @@ -5,6 +5,7 @@
> * Author: Rob Clark <robdclark@gmail.com>
> */
>
> +#include <linux/component.h>
> #include <linux/dma-mapping.h>
> #include <linux/fault-inject.h>
> #include <linux/kthread.h>
> @@ -1148,10 +1149,9 @@ static int add_components_mdp(struct device *master_dev,
> continue;
>
> if (of_device_is_available(intf))
> - drm_of_component_match_add(master_dev, matchptr,
> - component_compare_of, intf);
> -
> - of_node_put(intf);
> + component_match_add_of(master_dev, matchptr, intf);
> + else
> + of_node_put(intf);
> }
>
> return 0;
> @@ -1180,9 +1180,9 @@ static int add_gpu_components(struct device *dev,
> return 0;
>
> if (of_device_is_available(np))
> - drm_of_component_match_add(dev, matchptr, component_compare_of, np);
> -
> - of_node_put(np);
> + component_match_add_of(dev, matchptr, np);
> + else
> + of_node_put(np);
>
> return 0;
> }
> diff --git a/drivers/gpu/drm/sti/sti_drv.c b/drivers/gpu/drm/sti/sti_drv.c
> index 7abf010a3293..3ae4b73dfa92 100644
> --- a/drivers/gpu/drm/sti/sti_drv.c
> +++ b/drivers/gpu/drm/sti/sti_drv.c
> @@ -238,8 +238,7 @@ static int sti_platform_probe(struct platform_device *pdev)
> child_np = of_get_next_available_child(node, NULL);
>
> while (child_np) {
> - drm_of_component_match_add(dev, &match, component_compare_of,
> - child_np);
> + component_match_add_of(dev, &match, child_np);
> child_np = of_get_next_available_child(node, child_np);
> }
>
> diff --git a/drivers/gpu/drm/sun4i/sun4i_drv.c b/drivers/gpu/drm/sun4i/sun4i_drv.c
> index d06ffd99d86e..a67c2010c7a2 100644
> --- a/drivers/gpu/drm/sun4i/sun4i_drv.c
> +++ b/drivers/gpu/drm/sun4i/sun4i_drv.c
> @@ -323,7 +323,8 @@ static int sun4i_drv_add_endpoints(struct device *dev,
> of_device_is_available(node))) {
> /* Add current component */
> DRM_DEBUG_DRIVER("Adding component %pOF\n", node);
> - drm_of_component_match_add(dev, match, component_compare_of, node);
> + of_node_get(node);
> + component_match_add_of(dev, match, node);
> count++;
> }
>
> diff --git a/drivers/gpu/drm/tilcdc/tilcdc_external.c b/drivers/gpu/drm/tilcdc/tilcdc_external.c
> index 3b86d002ef62..0138ce02a64f 100644
> --- a/drivers/gpu/drm/tilcdc/tilcdc_external.c
> +++ b/drivers/gpu/drm/tilcdc/tilcdc_external.c
> @@ -155,11 +155,6 @@ int tilcdc_attach_external_device(struct drm_device *ddev)
> return ret;
> }
>
> -static int dev_match_of(struct device *dev, void *data)
> -{
> - return dev->of_node == data;
> -}
> -
> int tilcdc_get_external_components(struct device *dev,
> struct component_match **match)
> {
> @@ -173,7 +168,8 @@ int tilcdc_get_external_components(struct device *dev,
> }
>
> if (match)
> - drm_of_component_match_add(dev, match, dev_match_of, node);
> - of_node_put(node);
> + component_match_add_of(dev, match, node);
> + else
> + of_node_put(node);
> return 1;
> }
> diff --git a/include/drm/drm_of.h b/include/drm/drm_of.h
> index 10ab58c40746..685c44dc1dae 100644
> --- a/include/drm/drm_of.h
> +++ b/include/drm/drm_of.h
> @@ -33,10 +33,6 @@ uint32_t drm_of_crtc_port_mask(struct drm_device *dev,
> struct device_node *port);
> uint32_t drm_of_find_possible_crtcs(struct drm_device *dev,
> struct device_node *port);
> -void drm_of_component_match_add(struct device *master,
> - struct component_match **matchptr,
> - int (*compare)(struct device *, void *),
> - struct device_node *node);
> int drm_of_component_probe(struct device *dev,
> int (*compare_of)(struct device *, void *),
> const struct component_master_ops *m_ops);
> @@ -69,14 +65,6 @@ static inline uint32_t drm_of_find_possible_crtcs(struct drm_device *dev,
> return 0;
> }
>
> -static inline void
> -drm_of_component_match_add(struct device *master,
> - struct component_match **matchptr,
> - int (*compare)(struct device *, void *),
> - struct device_node *node)
> -{
> -}
> -
> static inline int
> drm_of_component_probe(struct device *dev,
> int (*compare_of)(struct device *, void *),
> --
> 2.35.1.1320.gc452695387.dirty
>
next prev parent reply other threads:[~2022-11-07 21:12 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-11-03 18:22 [PATCH 0/2] drm: Add component_match_add_of and convert users of drm_of_component_match_add Sean Anderson
2022-11-03 18:22 ` [PATCH 2/2] drm: Convert users of drm_of_component_match_add to component_match_add_of Sean Anderson
2022-11-07 20:27 ` sarha [this message]
2022-12-16 17:08 ` [PATCH 0/2] drm: Add component_match_add_of and convert users of drm_of_component_match_add Sean Anderson
2022-12-16 17:41 ` Robin Murphy
2022-12-22 21:24 ` Sean Anderson
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=4ad0beebfea802c1caec176f4d71955407cd5c4f@kapsi.fi \
--to=sarha@kapsi.fi \
--cc=airlied@gmail.com \
--cc=alain.volmat@foss.st.com \
--cc=brian.starkey@arm.com \
--cc=christian.gmeiner@gmail.com \
--cc=chunkuang.hu@kernel.org \
--cc=daniel@ffwll.ch \
--cc=dmitry.baryshkov@linaro.org \
--cc=dri-devel@lists.freedesktop.org \
--cc=etnaviv@lists.freedesktop.org \
--cc=freedreno@lists.freedesktop.org \
--cc=jernej.skrabec@gmail.com \
--cc=jstultz@google.com \
--cc=jyri.sarha@iki.fi \
--cc=kong.kongxinwei@hisilicon.com \
--cc=l.stach@pengutronix.de \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mediatek@lists.infradead.org \
--cc=linux-mips@vger.kernel.org \
--cc=linux-sunxi@lists.linux.dev \
--cc=linux@armlinux.org.uk \
--cc=liviu.dudau@arm.com \
--cc=maarten.lankhorst@linux.intel.com \
--cc=malidp@foss.arm.com \
--cc=matthias.bgg@gmail.com \
--cc=mihail.atanassov@arm.com \
--cc=mripard@kernel.org \
--cc=p.zabel@pengutronix.de \
--cc=paul@crapouillou.net \
--cc=puck.chen@hisilicon.com \
--cc=quic_abhinavk@quicinc.com \
--cc=robdclark@gmail.com \
--cc=samuel@sholland.org \
--cc=sean.anderson@seco.com \
--cc=sean@poorly.run \
--cc=tiantao6@hisilicon.com \
--cc=tomba@kernel.org \
--cc=tzimmermann@suse.de \
--cc=wens@csie.org \
--cc=xinliang.liu@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