Alsa-Devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/2] drm: Add component_match_add_of and convert users of drm_of_component_match_add
@ 2022-11-03 18:22 Sean Anderson
  2022-11-03 18:22 ` [PATCH 1/2] component: Add helper for device nodes Sean Anderson
       [not found] ` <68562aca-5256-9e4b-bcd5-983e43408a7d@seco.com>
  0 siblings, 2 replies; 4+ messages in thread
From: Sean Anderson @ 2022-11-03 18:22 UTC (permalink / raw)
  To: David Airlie, Daniel Vetter, Maarten Lankhorst, Maxime Ripard,
	Thomas Zimmermann, dri-devel
  Cc: alsa-devel, Xinliang Liu, Liviu Dudau, linux-kernel,
	Paul Cercueil, John Stultz, Mihail Atanassov, Will Deacon,
	Samuel Holland, Sean Anderson, Joerg Roedel, Takashi Iwai,
	Russell King, Jernej Skrabec, Chen-Yu Tsai, Mali DP Maintainers,
	linux-arm-kernel, linux-arm-msm, Alain Volmat, Xinwei Kong,
	linux-sunxi, Chun-Kuang Hu, Chen Feng, freedreno, Abhinav Kumar,
	etnaviv, Christian Gmeiner, Mark Brown, linux-mediatek,
	Matthias Brugger, Sean Paul, Yong Wu, linux-mips, Tomi Valkeinen,
	iommu, Robin Murphy, Liam Girdwood, Rob Clark, Philipp Zabel,
	Dmitry Baryshkov, Tian Tao, Jyri Sarha, Brian Starkey,
	Lucas Stach

This series adds a new function component_match_add_of to simplify the
common case of calling component_match_add_release with
component_release_of and component_compare_of. There is already
drm_of_component_match_add, which allows for a custom compare function.
However, all existing users just use component_compare_of (or an
equivalent).

I can split the second commit up if that is easier to review.


Sean Anderson (2):
  component: Add helper for device nodes
  drm: Convert users of drm_of_component_match_add to
    component_match_add_of

 .../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 ++-----
 drivers/iommu/mtk_iommu.c                     |  3 +-
 drivers/iommu/mtk_iommu_v1.c                  |  3 +-
 include/drm/drm_of.h                          | 12 --------
 include/linux/component.h                     |  9 ++++++
 sound/soc/codecs/wcd938x.c                    |  6 ++--
 18 files changed, 46 insertions(+), 96 deletions(-)

-- 
2.35.1.1320.gc452695387.dirty


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH 1/2] component: Add helper for device nodes
  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 ` Sean Anderson
  2022-11-03 18:32   ` Mark Brown
       [not found] ` <68562aca-5256-9e4b-bcd5-983e43408a7d@seco.com>
  1 sibling, 1 reply; 4+ messages in thread
From: Sean Anderson @ 2022-11-03 18:22 UTC (permalink / raw)
  To: David Airlie, Daniel Vetter, Maarten Lankhorst, Maxime Ripard,
	Thomas Zimmermann, dri-devel
  Cc: alsa-devel, Sean Anderson, Will Deacon, Joerg Roedel,
	Takashi Iwai, Liam Girdwood, linux-kernel, iommu, Mark Brown,
	linux-mediatek, linux-arm-kernel, Matthias Brugger, Robin Murphy,
	Yong Wu

There is a common case where component_patch_add_release is called with
component_release_of/component_compare_of and a device node. Add a
helper and convert existing users.

Signed-off-by: Sean Anderson <sean.anderson@seco.com>
---

 drivers/iommu/mtk_iommu.c    | 3 +--
 drivers/iommu/mtk_iommu_v1.c | 3 +--
 include/linux/component.h    | 9 +++++++++
 sound/soc/codecs/wcd938x.c   | 6 ++----
 4 files changed, 13 insertions(+), 8 deletions(-)

diff --git a/drivers/iommu/mtk_iommu.c b/drivers/iommu/mtk_iommu.c
index 2ab2ecfe01f8..483b7a9e4410 100644
--- a/drivers/iommu/mtk_iommu.c
+++ b/drivers/iommu/mtk_iommu.c
@@ -1079,8 +1079,7 @@ static int mtk_iommu_mm_dts_parse(struct device *dev, struct component_match **m
 		}
 		data->larb_imu[id].dev = &plarbdev->dev;
 
-		component_match_add_release(dev, match, component_release_of,
-					    component_compare_of, larbnode);
+		component_match_add_of(dev, match, larbnode);
 	}
 
 	/* Get smi-(sub)-common dev from the last larb. */
diff --git a/drivers/iommu/mtk_iommu_v1.c b/drivers/iommu/mtk_iommu_v1.c
index 6e0e65831eb7..fb09ed6bf550 100644
--- a/drivers/iommu/mtk_iommu_v1.c
+++ b/drivers/iommu/mtk_iommu_v1.c
@@ -672,8 +672,7 @@ static int mtk_iommu_v1_probe(struct platform_device *pdev)
 		}
 		data->larb_imu[i].dev = &plarbdev->dev;
 
-		component_match_add_release(dev, &match, component_release_of,
-					    component_compare_of, larbnode);
+		component_match_add_of(dev, &match, larbnode);
 	}
 
 	platform_set_drvdata(pdev, data);
diff --git a/include/linux/component.h b/include/linux/component.h
index df4aa75c9e7c..fb5d2dbc34d8 100644
--- a/include/linux/component.h
+++ b/include/linux/component.h
@@ -6,6 +6,7 @@
 
 
 struct device;
+struct device_node;
 
 /**
  * struct component_ops - callbacks for component drivers
@@ -128,4 +129,12 @@ static inline void component_match_add(struct device *parent,
 				    compare_data);
 }
 
+static inline void component_match_add_of(struct device *parent,
+					  struct component_match **matchptr,
+					  struct device_node *node)
+{
+	component_match_add_release(parent, matchptr, component_release_of,
+				    component_compare_of, node);
+}
+
 #endif
diff --git a/sound/soc/codecs/wcd938x.c b/sound/soc/codecs/wcd938x.c
index aca06a4026f3..2f8444e54083 100644
--- a/sound/soc/codecs/wcd938x.c
+++ b/sound/soc/codecs/wcd938x.c
@@ -4474,8 +4474,7 @@ static int wcd938x_add_slave_components(struct wcd938x_priv *wcd938x,
 	}
 
 	of_node_get(wcd938x->rxnode);
-	component_match_add_release(dev, matchptr, component_release_of,
-				    component_compare_of, wcd938x->rxnode);
+	component_match_add_of(dev, matchptr, wcd938x->rxnode);
 
 	wcd938x->txnode = of_parse_phandle(np, "qcom,tx-device", 0);
 	if (!wcd938x->txnode) {
@@ -4483,8 +4482,7 @@ static int wcd938x_add_slave_components(struct wcd938x_priv *wcd938x,
 		return -ENODEV;
 	}
 	of_node_get(wcd938x->txnode);
-	component_match_add_release(dev, matchptr, component_release_of,
-				    component_compare_of, wcd938x->txnode);
+	component_match_add_of(dev, matchptr, wcd938x->txnode);
 	return 0;
 }
 
-- 
2.35.1.1320.gc452695387.dirty


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH 1/2] component: Add helper for device nodes
  2022-11-03 18:22 ` [PATCH 1/2] component: Add helper for device nodes Sean Anderson
@ 2022-11-03 18:32   ` Mark Brown
  0 siblings, 0 replies; 4+ messages in thread
From: Mark Brown @ 2022-11-03 18:32 UTC (permalink / raw)
  To: Sean Anderson
  Cc: linux-arm-kernel, alsa-devel, Thomas Zimmermann, Will Deacon,
	Liam Girdwood, Robin Murphy, Joerg Roedel, Takashi Iwai,
	Maarten Lankhorst, linux-kernel, dri-devel, iommu, linux-mediatek,
	Maxime Ripard, Daniel Vetter, Matthias Brugger, David Airlie,
	Yong Wu

[-- Attachment #1: Type: text/plain, Size: 414 bytes --]

On Thu, Nov 03, 2022 at 02:22:21PM -0400, Sean Anderson wrote:

> There is a common case where component_patch_add_release is called with
> component_release_of/component_compare_of and a device node. Add a
> helper and convert existing users.

The usual pattern here would be to split adding the helper from updating
to use the helper - it makes things easier to merge.

Acked-by: Mark Brown <broonie@kernel.org>

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH 0/2] drm: Add component_match_add_of and convert users of drm_of_component_match_add
       [not found]   ` <2db73405-464f-6980-a7c1-7fe232611331@arm.com>
@ 2022-12-22 21:24     ` Sean Anderson
  0 siblings, 0 replies; 4+ messages in thread
From: Sean Anderson @ 2022-12-22 21:24 UTC (permalink / raw)
  To: Robin Murphy, David Airlie, Daniel Vetter, Maarten Lankhorst,
	Maxime Ripard, Thomas Zimmermann, dri-devel
  Cc: alsa-devel, linux-arm-msm, linux-kernel, etnaviv, iommu,
	linux-mediatek, linux-arm-kernel, linux-mips, freedreno,
	linux-sunxi, Yong Wu

Hi Robin,

On 12/16/22 12:41, Robin Murphy wrote:
> On 2022-12-16 17:08, Sean Anderson wrote:
>> On 11/3/22 14:22, Sean Anderson wrote:
>>> This series adds a new function component_match_add_of to simplify the
>>> common case of calling component_match_add_release with
>>> component_release_of and component_compare_of. There is already
>>> drm_of_component_match_add, which allows for a custom compare function.
>>> However, all existing users just use component_compare_of (or an
>>> equivalent).
>>>
>>> I can split the second commit up if that is easier to review.
>>>
>>>
>>> Sean Anderson (2):
>>>    component: Add helper for device nodes
>>>    drm: Convert users of drm_of_component_match_add to
>>>      component_match_add_of
>>>
>>>   .../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 ++-----
>>>   drivers/iommu/mtk_iommu.c                     |  3 +-
>>>   drivers/iommu/mtk_iommu_v1.c                  |  3 +-
>>>   include/drm/drm_of.h                          | 12 --------
>>>   include/linux/component.h                     |  9 ++++++
>>>   sound/soc/codecs/wcd938x.c                    |  6 ++--
>>>   18 files changed, 46 insertions(+), 96 deletions(-)
>>>
>>
>> ping?
>>
>> Should I send a v2 broken up like Mark suggested?
> 
> FWIW you'll need to rebase the IOMMU changes on 6.2-rc1 anyway - mtk_iommu stops using component_match_add_release() at all.
> 
> Thanks,
> Robin.

I am preparing v2 of this series, but I don't see these changes on
drm-next, which seems to have been updated to at least 6.2-rc1. I tried
searching for these changes on lore [1], but I don't see them there
either. Do you have a commit hash/lore link for these changes?

--Sean

[1] https://lore.kernel.org/all/?q=dfn%3Adrivers%2Fiommu%2Fmtk_iommu.c+b%3Acomponent

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2022-12-22 21:25 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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 1/2] component: Add helper for device nodes Sean Anderson
2022-11-03 18:32   ` Mark Brown
     [not found] ` <68562aca-5256-9e4b-bcd5-983e43408a7d@seco.com>
     [not found]   ` <2db73405-464f-6980-a7c1-7fe232611331@arm.com>
2022-12-22 21:24     ` [PATCH 0/2] drm: Add component_match_add_of and convert users of drm_of_component_match_add Sean Anderson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox