component: Add common helpers for compare/release
Subsystems (37)
Yong Wu
maintainercover component: Add common helpers for compare/release
The component requires the compare/release functions, there are many copies in current kernel. This patchset just defines four common helpers for them. No functional change.
Change note:
v1: a) Split the original patch into many small patches.
b) Use device_match_of_node helper.
c) Move the functions into c and export since the callback doesn't look like it should be "inline".
d) Add "component_" prefix for the functon names.
e) Add a new component_compare_dev_name.
RFC: https://lore.kernel.org/dri-devel/[email protected]/
rebase on v5.17-rc1
Yong Wu (23):
component: Add common helper for compare/release functions drm/komeda: Make use of the helper component_compare_of drm/armada: Make use of the helper component_compare_of/dev_name drm/etnaviv: Make use of the helper component_compare_of/dev_name drm/hirin: Make use of the helper component_compare_of drm/ingenic: Make use of the helper component_compare_of drm/mediatek: Make use of the helper component_compare_of drm/meson: Make use of the helper component_compare_of drm/msm: Make use of the helper component_compare_of drm/sprd: Make use of the helper component_compare_of drm/sti: Make use of the helper component_compare_of drm/sun4i: Make use of the helper component_compare_of drm/rockchip: Make use of the helper component_compare_dev drm/exynos: Make use of the helper component_compare_dev drm/mcde: Make use of the helper component_compare_dev drm/omap: dss: Make use of the helper component_compare_dev drm/vc4: Make use of the helper component_compare_dev
drm: of: Make use of the helper component_release_of iommu/mediatek: Make use of the helper component_compare/release_of
ASoC: codecs: wcd938x: Make use of the helper
component_compare/release_of
power: supply: ab8500: Make use of the helper component_compare_dev
video: omapfb: dss: Make use of the helper component_compare_dev
ALSA: hda/realtek: Make use of the helper component_compare_dev_name
drivers/base/component.c | 58 +++++++++++++++++++ .../gpu/drm/arm/display/komeda/komeda_drv.c | 7 +-- drivers/gpu/drm/armada/armada_drv.c | 17 +----- drivers/gpu/drm/drm_of.c | 7 +-- drivers/gpu/drm/etnaviv/etnaviv_drv.c | 16 +---- drivers/gpu/drm/exynos/exynos_drm_drv.c | 8 +-- .../gpu/drm/hisilicon/kirin/kirin_drm_drv.c | 7 +-- drivers/gpu/drm/ingenic/ingenic-drm-drv.c | 7 +-- drivers/gpu/drm/mcde/mcde_drv.c | 7 +-- drivers/gpu/drm/mediatek/mtk_drm_drv.c | 7 +-- drivers/gpu/drm/meson/meson_drv.c | 10 +--- drivers/gpu/drm/msm/msm_drv.c | 15 +---- drivers/gpu/drm/omapdrm/dss/dss.c | 8 +-- drivers/gpu/drm/rockchip/rockchip_drm_drv.c | 7 +-- drivers/gpu/drm/sprd/sprd_drm.c | 7 +-- drivers/gpu/drm/sti/sti_drv.c | 7 +-- drivers/gpu/drm/sun4i/sun4i_drv.c | 11 +--- drivers/gpu/drm/vc4/vc4_drv.c | 7 +-- drivers/iommu/mtk_iommu.c | 4 +- drivers/iommu/mtk_iommu.h | 10 ---- drivers/iommu/mtk_iommu_v1.c | 4 +- drivers/power/supply/ab8500_charger.c | 8 +-- drivers/video/fbdev/omap2/omapfb/dss/dss.c | 8 +-- include/linux/component.h | 6 ++ sound/pci/hda/patch_realtek.c | 11 +--- sound/soc/codecs/wcd938x.c | 18 ++---- 26 files changed, 99 insertions(+), 183 deletions(-)
Signature · 1 line
2.18.0
Yong Wu
maintainerPATCH 1/23 component: Add common helper for compare/release functions
The component requires the compare/release functions, there are so many copies in current kernel. Just define four common helpers for them.
---
I have run "make htmldocs". Due to my poor english, If the grammer is wrong or need more comments, please help to correct or supplement. Thanks.
--- drivers/base/component.c | 58 +++++++++++++++++++++++++++++++++++++++ include/linux/component.h | 6 ++++ 2 files changed, 64 insertions(+)
drivers/base/component.c +58 -0
@@ -11,6 +11,7 @@#include <linux/device.h> #include <linux/list.h> #include <linux/mutex.h> +#include <linux/of.h> #include <linux/slab.h> #include <linux/debugfs.h>
@@ -287,6 +288,63 @@ static void take_down_master(struct master *master) } } +/** +* component_compare_of - A common component compare function for of_node +* @dev: component device +* @data: @compare_data from component_match_add_release() +* +* A common compare function when compare_data is device of_node. e.g. +* component_match_add_release(masterdev, &match, component_release_of, +* component_compare_of, component_dev_of_node) +*/ +int component_compare_of (struct device *dev,void *data) +{ +return device_match_of_node (dev, data); +} +EXPORT_SYMBOL_GPL (component_compare_of); + +/** +* component_release_of - A common component release function for of_node +* @dev: component device +* @data: @compare_data from component_match_add_release() +* +* About the example, Please see component_compare_of(). +*/ +void component_release_of (struct device *dev,void *data) +{ +of_node_put (data); +} +EXPORT_SYMBOL_GPL (component_release_of); + +/** +* component_compare_dev - A common component compare function for dev +* @dev: component device +* @data: @compare_data from component_match_add_release() +* +* A common compare function when compare_data is struce device. e.g. +* component_match_add(masterdev, &match, component_compare_dev, component_dev) +*/ +int component_compare_dev (struct device *dev,void *data) +{ +return dev == data; +} +EXPORT_SYMBOL_GPL (component_compare_dev); + +/** +* component_compare_dev_name - A common component compare function for device name +* @dev: component device +* @data: @compare_data from component_match_add_release() +* +* A common compare function when compare_data is device name string. e.g. +* component_match_add(masterdev, &match, component_compare_dev_name, +* "component_dev_name") +*/ +int component_compare_dev_name (struct device *dev,void *data) +{ +return device_match_name (dev, data); +} +EXPORT_SYMBOL_GPL (component_compare_dev_name); +static void devm_component_match_release (struct device *parent,void *res) {struct component_match *match = res;
include/linux/component.h +6 -0
@@ -82,6 +82,12 @@ struct component_master_ops {void (*unbind)(struct device *master); }; +/* A set helper functions for component compare/release */ +int component_compare_of (struct device *dev,void *data); +void component_release_of (struct device *dev,void *data); +int component_compare_dev (struct device *dev,void *data); +int component_compare_dev_name (struct device *dev,void *data); +void component_master_del (struct device *,const struct component_master_ops *);
Signature · 1 line
2.18.0
Yong Wu
maintainerPATCH 2/23 drm/komeda: Make use of the helper component_compare_of
In reply to Yong WuUse the common compare helper from component.
--- drivers/gpu/drm/arm/display/komeda/komeda_drv.c | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-)
drivers/gpu/drm/arm/display/komeda/komeda_drv.c +1 -6
@@ -92,11 +92,6 @@ static const struct component_master_ops komeda_master_ops = { .unbind = komeda_unbind, }; -static int compare_of (struct device *dev,void *data) -{ -return dev->of_node == data; -} - static void komeda_add_slave(struct device *master, struct component_match **match, struct device_node *np,
@@ -106,7 +101,7 @@ static void komeda_add_slave(struct device *master, remote =of_graph_get_remote_node (np, port, endpoint);if (remote) { -drm_of_component_match_add (master, match, compare_of, remote); +drm_of_component_match_add (master, match, component_compare_of, remote);of_node_put (remote); } }
Signature · 1 line
2.18.0
Yong Wu
maintainerPATCH 3/23 drm/armada: Make use of the helper component_compare_of/dev_name
In reply to Yong WuUse the common compare helpers from component.
--- drivers/gpu/drm/armada/armada_drv.c | 17 +++-------------- 1 file changed, 3 insertions(+), 14 deletions(-)
drivers/gpu/drm/armada/armada_drv.c +3 -14
@@ -177,17 +177,6 @@ static void armada_drm_unbind(struct device *dev)drm_mm_takedown (&priv->linear); } -static int compare_of (struct device *dev,void *data) -{ -return dev->of_node == data; -} - -static int compare_dev_name (struct device *dev,void *data) -{ -const char *name = data; -return !strcmp (dev_name (dev), name); -} -static void armada_add_endpoints (struct device *dev,struct component_match **match,struct device_node *dev_node) {
@@ -196,7 +185,7 @@ 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, compare_of, +drm_of_component_match_add (dev, match, component_compare_of, remote);of_node_put (remote); }
@@ -213,7 +202,7 @@ static int armada_drm_probe(struct platform_device *pdev)struct device *dev = &pdev->dev;int ret; - ret =drm_of_component_probe (dev, compare_dev_name, &armada_master_ops); + ret =drm_of_component_probe (dev, component_compare_dev_name, &armada_master_ops);if (ret != -EINVAL )return ret;
@@ -223,7 +212,7 @@ static int armada_drm_probe(struct platform_device *pdev)int i;for (i =0 ; devices[i]; i++) -component_match_add (dev, &match, compare_dev_name, +component_match_add (dev, &match, component_compare_dev_name, devices[i]);if (i ==0 ) {
Signature · 1 line
2.18.0
Yong Wu
maintainerPATCH 4/23 drm/etnaviv: Make use of the helper component_compare_of/dev_name
In reply to Yong WuUse the common compare helpers from component.
--- drivers/gpu/drm/etnaviv/etnaviv_drv.c | 16 ++-------------- 1 file changed, 2 insertions(+), 14 deletions(-)
drivers/gpu/drm/etnaviv/etnaviv_drv.c +2 -14
@@ -574,18 +574,6 @@ static const struct component_master_ops etnaviv_master_ops = { .unbind = etnaviv_unbind, }; -static int compare_of (struct device *dev,void *data) -{ -struct device_node *np = data; - -return dev->of_node == np; -} - -static int compare_str (struct device *dev,void *data) -{ -return !strcmp (dev_name (dev), data); -} -static int etnaviv_pdev_probe (struct platform_device *pdev) {struct device *dev = &pdev->dev;
@@ -603,14 +591,14 @@ static int etnaviv_pdev_probe(struct platform_device *pdev) first_node = core_node;drm_of_component_match_add (&pdev->dev, &match, - compare_of, core_node); + component_compare_of, core_node); } }else {char **names = dev->platform_data;unsigned i;for (i =0 ; names[i]; i++) -component_match_add (dev, &match, compare_str, names[i]); +component_match_add (dev, &match, component_compare_dev_name, names[i]); }/*
Signature · 1 line
2.18.0
Yong Wu
maintainerPATCH 5/23 drm/hirin: Make use of the helper component_compare_of
In reply to Yong WuUse the common compare helper from component.
--- drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-)
drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c +1 -6
@@ -203,11 +203,6 @@ static int kirin_drm_kms_init(struct drm_device *dev,return ret; } -static int compare_of (struct device *dev,void *data) -{ -return dev->of_node == data; -} -static int kirin_drm_kms_cleanup (struct drm_device *dev) {drm_kms_helper_poll_fini (dev);
@@ -278,7 +273,7 @@ static int kirin_drm_platform_probe(struct platform_device *pdev)if (!remote)return -ENODEV ; -drm_of_component_match_add (dev, &match, compare_of, remote); +drm_of_component_match_add (dev, &match, component_compare_of, remote);of_node_put (remote);return component_master_add_with_match (dev, &kirin_drm_ops, match);
Signature · 1 line
2.18.0
Yong Wu
maintainerPATCH 6/23 drm/ingenic: Make use of the helper component_compare_of
In reply to Yong WuUse the common compare helper from component.
--- drivers/gpu/drm/ingenic/ingenic-drm-drv.c | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-)
drivers/gpu/drm/ingenic/ingenic-drm-drv.c +1 -6
@@ -1322,11 +1322,6 @@ static int ingenic_drm_bind_with_components(struct device *dev)return ingenic_drm_bind (dev, true); } -static int compare_of (struct device *dev,void *data) -{ -return dev->of_node == data; -} -static void ingenic_drm_unbind (struct device *dev) {struct ingenic_drm *priv =dev_get_drvdata (dev);
@@ -1360,7 +1355,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, compare_of, np); +drm_of_component_match_add (dev, &match, component_compare_of, np);of_node_put (np);return component_master_add_with_match (dev, &ingenic_master_ops, match);
Signature · 1 line
2.18.0
Re: [PATCH 06/23] drm/ingenic: Make use of the helper component_compare_of
Hi,
Quoted 5 lines · Yong Wu
Use the common compare helper from component.
Cheers,
-Paul
Quoted 35 lines
--- drivers/gpu/drm/ingenic/ingenic-drm-drv.c | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-)drivers/gpu/drm/ingenic/ingenic-drm-drv.c +0
-5@@ -1322,11 +1322,6 @@ static int ingenic_drm_bind_with_components(struct device *dev) return ingenic_drm_bind(dev, true); } -static int compare_of (struct device *dev,void *data) -{ -return dev->of_node == data; -} -static void ingenic_drm_unbind (struct device *dev) {drivers/gpu/drm/ingenic/ingenic-drm-drv.c +1
-1struct ingenic_drm *priv =dev_get_drvdata (dev);@@ -1360,7 +1355,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, compare_of, np); +drm_of_component_match_add (dev, &match, component_compare_of, np);of_node_put (np);return component_master_add_with_match(dev,
&ingenic_master_ops,
match);
--
2.18.0
Yong Wu
maintainerPATCH 7/23 drm/mediatek: Make use of the helper component_compare_of
In reply to Yong WuUse the common compare helper from component.
--- drivers/gpu/drm/mediatek/mtk_drm_drv.c | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-)
drivers/gpu/drm/mediatek/mtk_drm_drv.c +1 -6
@@ -369,11 +369,6 @@ static const struct drm_driver mtk_drm_driver = { .minor = DRIVER_MINOR, }; -static int compare_of (struct device *dev,void *data) -{ -return dev->of_node == data; -} -static int mtk_drm_bind (struct device *dev) {struct mtk_drm_private *private =dev_get_drvdata (dev);
@@ -614,7 +609,7 @@ 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, compare_of, +drm_of_component_match_add (dev, &match, component_compare_of, node); }
Signature · 1 line
2.18.0
Yong Wu
maintainerPATCH 8/23 drm/meson: Make use of the helper component_compare_of
In reply to Yong WuUse the common compare helper from component.
--- drivers/gpu/drm/meson/meson_drv.c | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-)
drivers/gpu/drm/meson/meson_drv.c +1 -9
@@ -423,14 +423,6 @@ static int __maybe_unused meson_drv_pm_resume(struct device *dev)return drm_mode_config_helper_resume (priv->drm); } -static int compare_of (struct device *dev,void *data) -{ -DRM_DEBUG_DRIVER ("Comparing of node %pOF with %pOF\n" , - dev->of_node, data); - -return dev->of_node == data; -} -static void meson_drv_shutdown (struct platform_device *pdev) {struct meson_drm *priv =dev_get_drvdata (&pdev->dev);
@@ -473,7 +465,7 @@ static int meson_drv_probe(struct platform_device *pdev)dev_dbg (&pdev->dev,"parent %pOF remote match add %pOF parent %s\n" , np, remote,dev_name (&pdev->dev)); -component_match_add (&pdev->dev, &match, compare_of, remote); +component_match_add (&pdev->dev, &match, component_compare_of, remote);of_node_put (remote);
Signature · 1 line
2.18.0
Yong Wu
maintainerPATCH 9/23 drm/msm: Make use of the helper component_compare_of
In reply to Yong WuUse the common compare helper from component.
--- drivers/gpu/drm/msm/msm_drv.c | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-)
drivers/gpu/drm/msm/msm_drv.c +3 -12
@@ -1173,15 +1173,6 @@ static const struct dev_pm_ops msm_pm_ops = {* Componentized driver support: */ -/* -* NOTE: duplication of the same code as exynos or imx (or probably any other). -* so probably some room for some helpers -*/ -static int compare_of (struct device *dev,void *data) -{ -return dev->of_node == data; -} -/* * Identify what components need to be added by parsing what remote-endpoints * our MDP output ports are connected to. In the case of LVDS on MDP4, there
@@ -1239,7 +1230,7 @@ static int add_components_mdp(struct device *mdp_dev,if (of_device_is_available (intf))drm_of_component_match_add (master_dev, matchptr, - compare_of, intf); + component_compare_of, intf);of_node_put (intf); }
@@ -1285,7 +1276,7 @@ static int add_display_components(struct platform_device *pdev,put_device (mdp_dev);/* add the MDP component itself */ -drm_of_component_match_add (dev, matchptr, compare_of, +drm_of_component_match_add (dev, matchptr, component_compare_of, mdp_dev->of_node);break ;case KMS_MDP4 :
@@ -1324,7 +1315,7 @@ static int add_gpu_components(struct device *dev,return 0 ;if (of_device_is_available (np)) -drm_of_component_match_add (dev, matchptr, compare_of, np); +drm_of_component_match_add (dev, matchptr, component_compare_of, np);of_node_put (np);
Signature · 1 line
2.18.0
Yong Wu
maintainerPATCH 10/23 drm/sprd: Make use of the helper component_compare_of
In reply to Yong WuUse the common compare helper from component.
--- drivers/gpu/drm/sprd/sprd_drm.c | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-)
drivers/gpu/drm/sprd/sprd_drm.c +1 -6
@@ -134,14 +134,9 @@ static const struct component_master_ops drm_component_ops = { .unbind = sprd_drm_unbind, }; -static int compare_of (struct device *dev,void *data) -{ -return dev->of_node == data; -} -static int sprd_drm_probe (struct platform_device *pdev) { -return drm_of_component_probe (&pdev->dev, compare_of, &drm_component_ops); +return drm_of_component_probe (&pdev->dev, component_compare_of, &drm_component_ops); }static int sprd_drm_remove (struct platform_device *pdev)
Signature · 1 line
2.18.0
Yong Wu
maintainerPATCH 11/23 drm/sti: Make use of the helper component_compare_of
In reply to Yong WuUse the common compare helper from component.
--- drivers/gpu/drm/sti/sti_drv.c | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-)
drivers/gpu/drm/sti/sti_drv.c +1 -6
@@ -144,11 +144,6 @@ static const struct drm_driver sti_driver = { .minor = DRIVER_MINOR, }; -static int compare_of (struct device *dev,void *data) -{ -return dev->of_node == data; -} -static int sti_init (struct drm_device *ddev) {struct sti_private *private;
@@ -244,7 +239,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, compare_of, +drm_of_component_match_add (dev, &match, component_compare_of, child_np); child_np =of_get_next_available_child (node, child_np); }
Signature · 1 line
2.18.0
Yong Wu
maintainerPATCH 12/23 drm/sun4i: Make use of the helper component_compare_of
In reply to Yong WuUse the common compare helper from component.
--- drivers/gpu/drm/sun4i/sun4i_drv.c | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-)
drivers/gpu/drm/sun4i/sun4i_drv.c +1 -10
@@ -201,15 +201,6 @@ static bool sun4i_drv_node_is_tcon_top(struct device_node *node) !!of_match_node (sun8i_tcon_top_of_table, node); } -static int compare_of (struct device *dev,void *data) -{ -DRM_DEBUG_DRIVER ("Comparing of node %pOF with %pOF\n" , - dev->of_node, - data); - -return dev->of_node == data; -} -/* * The encoder drivers use drm_of_find_possible_crtcs to get upstream * crtcs from the device tree using of_graph. For the results to be
@@ -329,7 +320,7 @@ 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, compare_of, node); +drm_of_component_match_add (dev, match, component_compare_of, node); count++; }
Signature · 1 line
2.18.0
Yong Wu
maintainerPATCH 13/23 drm/rockchip: Make use of the helper component_compare_dev
In reply to Yong WuUse the common compare helper from component.
--- drivers/gpu/drm/rockchip/rockchip_drm_drv.c | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-)
drivers/gpu/drm/rockchip/rockchip_drm_drv.c +1 -6
@@ -290,11 +290,6 @@ int rockchip_drm_endpoint_is_subdriver(struct device_node *ep)return false; } -static int compare_dev (struct device *dev,void *data) -{ -return dev == (struct device *)data; -} -static void rockchip_drm_match_remove (struct device *dev) {struct device_link *link;
@@ -321,7 +316,7 @@ static struct component_match *rockchip_drm_match_add(struct device *dev)break ;device_link_add (dev, d,DL_FLAG_STATELESS ); -component_match_add (dev, &match, compare_dev, d); +component_match_add (dev, &match, component_compare_dev, d); }while (true); }
Signature · 1 line
2.18.0
Re: [PATCH 13/23] drm/rockchip: Make use of the helper component_compare_dev
Am Montag, 14. Februar 2022, 07:08:09 CET schrieb Yong Wu:
Quoted 6 lines
Use the common compare helper from component.
Cc Sandy Huang <[email protected]>Cc "Heiko St¨¹bner" <[email protected]>Signed-off-by Yong Wu <[email protected]>
Quoted 30 lines
--- drivers/gpu/drm/rockchip/rockchip_drm_drv.c | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-)drivers/gpu/drm/rockchip/rockchip_drm_drv.c +1
-6@@ -290,11 +290,6 @@ int rockchip_drm_endpoint_is_subdriver(struct device_node *ep)return false; } -static int compare_dev (struct device *dev,void *data) -{ -return dev == (struct device *)data; -} -static void rockchip_drm_match_remove (struct device *dev) {struct device_link *link;@@ -321,7 +316,7 @@ static struct component_match *rockchip_drm_match_add(struct device *dev)break ;device_link_add (dev, d,DL_FLAG_STATELESS ); -component_match_add (dev, &match, compare_dev, d); +component_match_add (dev, &match, component_compare_dev, d); }while (true); }
Yong Wu
maintainerPATCH 14/23 drm/exynos: Make use of the helper component_compare_dev
In reply to Yong WuUse the common compare helper from component.
--- drivers/gpu/drm/exynos/exynos_drm_drv.c | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-)
drivers/gpu/drm/exynos/exynos_drm_drv.c +1 -7
@@ -212,11 +212,6 @@ static struct exynos_drm_driver_info exynos_drm_drivers[] = { } }; -static int compare_dev (struct device *dev,void *data) -{ -return dev == (struct device *)data; -} -static struct component_match *exynos_drm_match_add (struct device *dev) {struct component_match *match =NULL ;
@@ -234,8 +229,7 @@ static struct component_match *exynos_drm_match_add(struct device *dev)if (!(info->flags &DRM_FIMC_DEVICE ) ||exynos_drm_check_fimc_device (d) ==0 ) -component_match_add (dev, &match, - compare_dev, d); +component_match_add (dev, &match, component_compare_dev, d); p = d; }put_device (p);
Signature · 1 line
2.18.0
Yong Wu
maintainerPATCH 15/23 drm/mcde: Make use of the helper component_compare_dev
In reply to Yong WuUse the common compare helper from component.
--- drivers/gpu/drm/mcde/mcde_drv.c | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-)
drivers/gpu/drm/mcde/mcde_drv.c +1 -6
@@ -265,11 +265,6 @@ static struct platform_driver *const mcde_component_drivers[] = { &mcde_dsi_driver, }; -static int mcde_compare_dev (struct device *dev,void *data) -{ -return dev == data; -} -static int mcde_probe (struct platform_device *pdev) {struct device *dev = &pdev->dev;
@@ -399,7 +394,7 @@ static int mcde_probe(struct platform_device *pdev)while ((d =platform_find_device_by_driver (p, drv))) {put_device (p); -component_match_add (dev, &match, mcde_compare_dev, d); +component_match_add (dev, &match, component_compare_dev, d); p = d; }put_device (p);
Signature · 1 line
2.18.0
Yong Wu
maintainerPATCH 16/23 drm/omap: dss: Make use of the helper component_compare_dev
In reply to Yong WuUse the common compare helper from component.
--- drivers/gpu/drm/omapdrm/dss/dss.c | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-)
drivers/gpu/drm/omapdrm/dss/dss.c +1 -7
@@ -1344,12 +1344,6 @@ static const struct component_master_ops dss_component_ops = { .unbind = dss_unbind, }; -static int dss_component_compare (struct device *dev,void *data) -{ -struct device *child = data; -return dev == child; -} -struct dss_component_match_data {struct device *dev;struct component_match **match;
@@ -1379,7 +1373,7 @@ static int dss_add_child_component(struct device *dev, void *data)return device_for_each_child (dev, cmatch, dss_add_child_component); -component_match_add (cmatch->dev, match, dss_component_compare, dev); +component_match_add (cmatch->dev, match, component_compare_dev, dev);return 0 ; }
Signature · 1 line
2.18.0
Yong Wu
maintainerPATCH 17/23 drm/vc4: Make use of the helper component_compare_dev
In reply to Yong WuUse the common compare helper from component.
--- drivers/gpu/drm/vc4/vc4_drv.c | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-)
drivers/gpu/drm/vc4/vc4_drv.c +1 -6
@@ -187,11 +187,6 @@ static struct drm_driver vc4_drm_driver = { .patchlevel = DRIVER_PATCHLEVEL, }; -static int compare_dev (struct device *dev,void *data) -{ -return dev == data; -} - static void vc4_match_add_drivers(struct device *dev, struct component_match **match, struct platform_driver *const *drivers,
@@ -205,7 +200,7 @@ static void vc4_match_add_drivers(struct device *dev,while ((d =platform_find_device_by_driver (p, drv))) {put_device (p); -component_match_add (dev, match, compare_dev, d); +component_match_add (dev, match, component_compare_dev, d); p = d; }put_device (p);
Signature · 1 line
2.18.0
Yong Wu
maintainerPATCH 18/23 drm: of: Make use of the helper component_release_of
In reply to Yong WuUse the common release helper from component.
--- drivers/gpu/drm/drm_of.c | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-)
drivers/gpu/drm/drm_of.c +1 -6
@@ -18,11 +18,6 @@* properties. */ -static void drm_release_of (struct device *dev,void *data) -{ -of_node_put (data); -} -/** * drm_of_crtc_port_mask - find the mask of a registered CRTC by port OF node * @dev: DRM device
@@ -94,7 +89,7 @@ void drm_of_component_match_add(struct device *master, struct device_node *node) {of_node_get (node); -component_match_add_release (master, matchptr, drm_release_of, +component_match_add_release (master, matchptr, component_release_of, compare, node); }EXPORT_SYMBOL_GPL (drm_of_component_match_add);
Signature · 1 line
2.18.0
Yong Wu
maintainerPATCH 19/23 iommu/mediatek: Make use of the helper component_compare/release_of
In reply to Yong WuUse the common compare/release helpers from component.
--- drivers/iommu/mtk_iommu.c | 4 ++-- drivers/iommu/mtk_iommu.h | 10 ---------- drivers/iommu/mtk_iommu_v1.c | 4 ++-- 3 files changed, 4 insertions(+), 14 deletions(-)
drivers/iommu/mtk_iommu.c +2 -2
@@ -852,8 +852,8 @@ static int mtk_iommu_probe(struct platform_device *pdev) } data->larb_imu[id].dev = &plarbdev->dev; -component_match_add_release (dev, &match, release_of, - compare_of, larbnode); +component_match_add_release (dev, &match, component_release_of, + component_compare_of, larbnode); }/* Get smi-common dev from the last larb. */
drivers/iommu/mtk_iommu.h +0 -10
@@ -84,16 +84,6 @@ struct mtk_iommu_data {struct mtk_smi_larb_iommu larb_imu[MTK_LARB_NR_MAX ]; }; -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 mtk_iommu_bind (struct device *dev) {struct mtk_iommu_data *data =dev_get_drvdata (dev);
drivers/iommu/mtk_iommu_v1.c +2 -2
@@ -599,8 +599,8 @@ static int mtk_iommu_probe(struct platform_device *pdev) } data->larb_imu[i].dev = &plarbdev->dev; -component_match_add_release (dev, &match, release_of, - compare_of, larbnode); +component_match_add_release (dev, &match, component_release_of, + component_compare_of, larbnode); }platform_set_drvdata (pdev, data);
Signature · 1 line
2.18.0
Yong Wu
maintainerPATCH 20/23 ASoC: codecs: wcd938x: Make use of the helper component_compare/release_of
In reply to Yong WuUse the common compare/release helpers from component.
--- sound/soc/codecs/wcd938x.c | 18 ++++-------------- 1 file changed, 4 insertions(+), 14 deletions(-)
sound/soc/codecs/wcd938x.c +4 -14
@@ -4417,16 +4417,6 @@ static const struct component_master_ops wcd938x_comp_ops = { .unbind = wcd938x_unbind, }; -static int wcd938x_compare_of (struct device *dev,void *data) -{ -return dev->of_node == data; -} - -static void wcd938x_release_of (struct device *dev,void *data) -{ -of_node_put (data); -} -static int wcd938x_add_slave_components (struct wcd938x_priv *wcd938x,struct device *dev,struct component_match **matchptr)
@@ -4442,8 +4432,8 @@ static int wcd938x_add_slave_components(struct wcd938x_priv *wcd938x, }of_node_get (wcd938x->rxnode); -component_match_add_release (dev, matchptr, wcd938x_release_of, - wcd938x_compare_of, wcd938x->rxnode); +component_match_add_release (dev, matchptr, component_release_of, + component_compare_of, wcd938x->rxnode); wcd938x->txnode =of_parse_phandle (np,"qcom,tx-device" ,0 );if (!wcd938x->txnode) {
@@ -4451,8 +4441,8 @@ static int wcd938x_add_slave_components(struct wcd938x_priv *wcd938x,return -ENODEV ; }of_node_get (wcd938x->txnode); -component_match_add_release (dev, matchptr, wcd938x_release_of, - wcd938x_compare_of, wcd938x->txnode); +component_match_add_release (dev, matchptr, component_release_of, + component_compare_of, wcd938x->txnode);return 0 ; }
Signature · 1 line
2.18.0
Mark Brown
maintainerRe: [PATCH 20/23] ASoC: codecs: wcd938x: Make use of the helper component_compare/release_of
Quoted 1 line · Yong Wu
Use the common compare/release helpers from component.
What's the story with dependencies here? I've just got this one patch with no cover letter...
AngeloGioacchino Del Regno
maintainerRe: [PATCH 20/23] ASoC: codecs: wcd938x: Make use of the helper component_compare/release_of
Il 14/02/22 13:40, Mark Brown ha scritto:
Quoted 5 lines · Yong Wu
Quoted 1 line
Use the common compare/release helpers from component.
What's the story with dependencies here? I've just got this one patch with no cover letter...
Hello Mark,
I agree, the cover letter should be sent to everyone; Yong, please add the proper Ccs to it next time.
Anyway, context:
https://patchwork.kernel.org/project/linux-mediatek/cover/[email protected]/
Cheers,
Angelo
Yong Wu
maintainerRe: [PATCH 20/23] ASoC: codecs: wcd938x: Make use of the helper component_compare/release_of
Quoted 7 lines · AngeloGioacchino Del Regno
Il 14/02/22 13:40, Mark Brown ha scritto:
Quoted 6 lines · Yong Wu
Quoted 1 line
Use the common compare/release helpers from component.
What's the story with dependencies here? I've just got this one patch
with no cover letter...
Sorry for this. I will add in cover letter next time. Maybe in next week. Just to see if there is any other comment.
Thanks.
Quoted 8 lines
Hello Mark,
I agree, the cover letter should be sent to everyone; Yong, please add the
proper Ccs to it next time.Anyway, context:
https://patchwork.kernel.org/project/linux-mediatek/cover/[email protected]/
Thanks very much:)
Quoted 3 lines
Cheers,
Angelo
Yong Wu
maintainerPATCH 21/23 power: supply: ab8500: Make use of the helper component_compare_dev
In reply to Yong WuUse the common compare helper from component.
--- drivers/power/supply/ab8500_charger.c | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-)
drivers/power/supply/ab8500_charger.c +1 -7
@@ -3414,11 +3414,6 @@ static struct platform_driver *const ab8500_charger_component_drivers[] = { &ab8500_chargalg_driver, }; -static int ab8500_charger_compare_dev (struct device *dev,void *data) -{ -return dev == data; -} -static int ab8500_charger_probe (struct platform_device *pdev) {struct device *dev = &pdev->dev;
@@ -3657,8 +3652,7 @@ static int ab8500_charger_probe(struct platform_device *pdev)while ((d =platform_find_device_by_driver (p, drv))) {put_device (p); -component_match_add (dev, &match, - ab8500_charger_compare_dev, d); +component_match_add (dev, &match, component_compare_dev, d); p = d; }put_device (p);
Signature · 1 line
2.18.0
Yong Wu
maintainerPATCH 22/23 video: omapfb: dss: Make use of the helper component_compare_dev
In reply to Yong WuUse the common compare helper from component.
--- drivers/video/fbdev/omap2/omapfb/dss/dss.c | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-)
drivers/video/fbdev/omap2/omapfb/dss/dss.c +1 -7
@@ -1193,12 +1193,6 @@ static const struct component_master_ops dss_component_ops = { .unbind = dss_unbind, }; -static int dss_component_compare (struct device *dev,void *data) -{ -struct device *child = data; -return dev == child; -} -static int dss_add_child_component (struct device *dev,void *data) {struct component_match **match = data;
@@ -1212,7 +1206,7 @@ static int dss_add_child_component(struct device *dev, void *data)if (strstr (dev_name (dev),"rfbi" ))return 0 ; -component_match_add (dev->parent, match, dss_component_compare, dev); +component_match_add (dev->parent, match, component_compare_dev, dev);return 0 ; }
Signature · 6 lines
2.18.0 _______________________________________________ iommu mailing list [email protected] https://lists.linuxfoundation.org/mailman/listinfo/iommu
Re: [PATCH 22/23] video: omapfb: dss: Make use of the helper component_compare_dev
Quoted 6 lines · Yong Wu
Use the common compare helper from component.
Cc Helge Deller <[email protected]>Signed-off-by Yong Wu <[email protected]>
Applied to the fbdev for-next branch.
Thanks!
Helge
Quoted 30 lines
drivers/video/fbdev/omap2/omapfb/dss/dss.c | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-)drivers/video/fbdev/omap2/omapfb/dss/dss.c +1
-7@@ -1193,12 +1193,6 @@ static const struct component_master_ops dss_component_ops = { .unbind = dss_unbind, }; -static int dss_component_compare (struct device *dev,void *data) -{ -struct device *child = data; -return dev == child; -} -static int dss_add_child_component (struct device *dev,void *data) {struct component_match **match = data;@@ -1212,7 +1206,7 @@ static int dss_add_child_component(struct device *dev, void *data)if (strstr (dev_name (dev),"rfbi" ))return 0 ; -component_match_add (dev->parent, match, dss_component_compare, dev); +component_match_add (dev->parent, match, component_compare_dev, dev);return 0 ; }
Greg Kroah-Hartman
maintainerRe: [PATCH 22/23] video: omapfb: dss: Make use of the helper component_compare_dev
Quoted 9 lines · Helge Deller
Quoted 6 lines · Yong Wu
Use the common compare helper from component.
Cc Helge Deller <[email protected]>Signed-off-by Yong Wu <[email protected]>Applied to the fbdev for-next branch.
That will break the build, it needs patch 1/23 to build properly :(
Yong Wu
maintainerPATCH 23/23 ALSA: hda/realtek: Make use of the helper component_compare_dev_name
In reply to Yong WuUse the common compare helper from component.
--- sound/pci/hda/patch_realtek.c | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-)
sound/pci/hda/patch_realtek.c +3 -8
@@ -6530,11 +6530,6 @@ static void alc287_fixup_legion_15imhg05_speakers(struct hda_codec *codec, } } -static int comp_match_dev_name (struct device *dev,void *data) -{ -return strcmp (dev_name (dev), data) ==0 ; -} -static int find_comp_by_dev_name (struct alc_spec *spec,const char *name) {int i;
@@ -6595,7 +6590,7 @@ static void cs35l41_generic_fixup(struct hda_codec *cdc, int action, const char "%s-%s:00-cs35l41-hda.%d", bus, hid, i);if (!name)return ; -component_match_add (dev, &spec->match, comp_match_dev_name, name); +component_match_add (dev, &spec->match, component_compare_dev_name, name); } ret =component_master_add_with_match (dev, &comp_master_ops, spec->match);if (ret)
@@ -6644,9 +6639,9 @@ static void alc287_fixup_legion_16achg6_speakers(struct hda_codec *cdc, const stswitch (action) {case HDA_FIXUP_ACT_PRE_PROBE : -component_match_add (dev, &spec->match, comp_match_dev_name, +component_match_add (dev, &spec->match, component_compare_dev_name,"i2c-CLSA0100:00-cs35l41-hda.0" ); -component_match_add (dev, &spec->match, comp_match_dev_name, +component_match_add (dev, &spec->match, component_compare_dev_name,"i2c-CLSA0100:00-cs35l41-hda.1" ); ret =component_master_add_with_match (dev, &comp_master_ops, spec->match);if (ret)
Signature · 1 line
2.18.0