[PATCH 0/2] drm: Add component_match_add_of and convert users of drm_of_component_match_add
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(-)
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; }
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
participants (2)
-
Mark Brown
-
Sean Anderson