of: property: add port base loop
Subsystems (59)
Kuninori Morimoto
maintainerv3 cover of: property: add port base loop
Hi Rob
This is v3 of port base loop patch-set
We have "endpoint" base functions
- of_graph_get_next_endpoint()
- of_graph_get_endpoint_count()
- for_each_endpoint_of_node()
But to handling "port" base things, it is not useful. We want to have "port" base functions, too. This patch-set adds it.
Because current existing drivers couldn't use "port" base functions, it were implemented in a different way. This patch-set doesn't try to full-replace to avoid unknown bug, try easy / quick replace only for now, but easy to know how "port" base functions are needed.
Because I can't test the driver which I can't use, non-ASoC drivers needs Tested-by, Acked-by.
This patch-set renames existing "endpoint" to *_device_* because it is rather than focusing to device's endpoint instead of port's endpoint.
- of_graph_get_next_endpoint()
+ of_graph_get_next_device_endpoint()
- of_graph_get_endpoint_count()
+ of_graph_get_device_endpoint_count()
- for_each_endpoint_of_node()
+ for_each_device_endpoint_of_node()
[PATCH 01/24] - [PATCH 02/24] : tidyup existing endpoint function kerneldoc [PATCH 03/24] - [PATCH 11/24] : replace existing function to *_device_* [PATCH 12/24] - [PATCH 24/24] : add new function and use it
v2 -> v3
- tidyup existing endpoint function kerneldoc
- replace exising function to *_device_*
v1 -> v2
- tidyup function explain
- add missing header on each files
https://lore.kernel.org/r/[email protected]
https://lore.kernel.org/r/[email protected]
Kuninori Morimoto (24):
1) of: property: add missing kerneldoc for of_graph_get_endpoint_count()
2) of: property: use unsigned int return on of_graph_get_endpoint_count()
3) of: property: rename of_graph_get_next_endpoint() to of_graph_get_next_device_endpoint()
4) video: fbdev: switch to use of_graph_get_next_device_endpoint()
5) media: i2c: switch to use of_graph_get_next_device_endpoint()
6) media: platform: switch to use of_graph_get_next_device_endpoint()
7) gpu: drm: switch to use of_graph_get_next_device_endpoint()
8) hwtracing: switch to use of_graph_get_next_device_endpoint()
9) staging: switch to use of_graph_get_next_device_endpoint()
10) ASoC: switch to use of_graph_get_next_device_endpoint()
11) of: remove of_graph_get_next_endpoint() define
12) of: property: add port base loop
13) of: property: use of_graph_get_next_port() on of_graph_get_next_endpoint()
14) of: property: add of_graph_get_next_endpoint()
15) drm: omapdrm: use of_graph_get_next_endpoint()
16) media: xilinx-tpg: use of_graph_get_next_endpoint()
17) ASoC: audio-graph-card: use of_graph_get_next_endpoint()
18) ASoC: audio-graph-card2: use of_graph_get_next_port()
19) ASoC: audio-graph-card2: use of_graph_get_next_endpoint()
20) ASoC: test-component: use for_each_port_of_node()
21) fbdev: omapfb: use of_graph_get_remote_port()
22) fbdev: omapfb: use of_graph_get_next_port()
23) fbdev: omapfb: use of_graph_get_next_endpoint()
24) fbdev: omapfb: use of_graph_get_next_device_endpoint()
.clang-format | 2 +- drivers/gpu/drm/armada/armada_drv.c | 2 +- drivers/gpu/drm/bridge/tc358767.c | 2 +- drivers/gpu/drm/drm_of.c | 6 +- drivers/gpu/drm/meson/meson_drv.c | 4 +- drivers/gpu/drm/msm/msm_drv.c | 2 +- drivers/gpu/drm/mxsfb/lcdif_drv.c | 2 +- drivers/gpu/drm/omapdrm/dss/base.c | 2 +- drivers/gpu/drm/omapdrm/dss/dpi.c | 2 +- drivers/gpu/drm/omapdrm/dss/sdi.c | 2 +- .../drm/panel/panel-raspberrypi-touchscreen.c | 2 +- drivers/gpu/drm/pl111/pl111_drv.c | 2 +- drivers/gpu/drm/renesas/rcar-du/rcar_du_kms.c | 2 +- drivers/gpu/drm/stm/ltdc.c | 4 +- drivers/gpu/drm/tiny/arcpgu.c | 2 +- .../hwtracing/coresight/coresight-platform.c | 4 +- drivers/media/i2c/adv7343.c | 2 +- drivers/media/i2c/adv748x/adv748x-core.c | 2 +- drivers/media/i2c/adv7604.c | 2 +- drivers/media/i2c/isl7998x.c | 2 +- drivers/media/i2c/max9286.c | 2 +- drivers/media/i2c/mt9p031.c | 2 +- drivers/media/i2c/mt9v032.c | 2 +- drivers/media/i2c/ov2659.c | 2 +- drivers/media/i2c/ov5645.c | 2 +- drivers/media/i2c/ov5647.c | 2 +- drivers/media/i2c/s5c73m3/s5c73m3-core.c | 2 +- drivers/media/i2c/s5k5baf.c | 2 +- drivers/media/i2c/tc358743.c | 2 +- drivers/media/i2c/tda1997x.c | 2 +- drivers/media/i2c/tvp514x.c | 2 +- drivers/media/i2c/tvp5150.c | 4 +- drivers/media/i2c/tvp7002.c | 2 +- drivers/media/platform/atmel/atmel-isi.c | 4 +- drivers/media/platform/intel/pxa_camera.c | 2 +- .../microchip/microchip-sama5d2-isc.c | 2 +- .../microchip/microchip-sama7g5-isc.c | 2 +- drivers/media/platform/qcom/camss/camss.c | 2 +- drivers/media/platform/renesas/renesas-ceu.c | 2 +- .../platform/samsung/exynos4-is/fimc-is.c | 2 +- .../platform/samsung/exynos4-is/mipi-csis.c | 2 +- drivers/media/platform/st/stm32/stm32-dcmi.c | 4 +- .../media/platform/ti/am437x/am437x-vpfe.c | 2 +- drivers/media/platform/ti/davinci/vpif.c | 3 +- .../media/platform/ti/davinci/vpif_capture.c | 3 +- drivers/media/platform/video-mux.c | 2 +- drivers/media/platform/xilinx/xilinx-tpg.c | 3 +- drivers/media/platform/xilinx/xilinx-vipp.c | 2 +- drivers/of/property.c | 126 ++++++++++++++---- .../deprecated/atmel/atmel-sama5d2-isc.c | 2 +- .../deprecated/atmel/atmel-sama7g5-isc.c | 2 +- drivers/staging/media/tegra-video/csi.c | 2 +- drivers/staging/media/tegra-video/vi.c | 2 +- drivers/staging/media/tegra-video/vip.c | 2 +- drivers/video/fbdev/amba-clcd.c | 2 +- drivers/video/fbdev/omap2/omapfb/dss/dpi.c | 3 +- drivers/video/fbdev/omap2/omapfb/dss/dsi.c | 3 +- drivers/video/fbdev/omap2/omapfb/dss/dss-of.c | 101 +------------- drivers/video/fbdev/omap2/omapfb/dss/dss.c | 9 +- drivers/video/fbdev/omap2/omapfb/dss/hdmi4.c | 3 +- drivers/video/fbdev/omap2/omapfb/dss/hdmi5.c | 3 +- .../omap2/omapfb/dss/omapdss-boot-init.c | 2 +- drivers/video/fbdev/omap2/omapfb/dss/sdi.c | 3 +- drivers/video/fbdev/omap2/omapfb/dss/venc.c | 3 +- drivers/video/fbdev/pxafb.c | 2 +- include/linux/of_graph.h | 51 +++++-- include/video/omapfb_dss.h | 11 -- sound/soc/codecs/ak4613.c | 2 +- sound/soc/generic/audio-graph-card.c | 2 +- sound/soc/generic/audio-graph-card2.c | 33 ++--- sound/soc/generic/simple-card-utils.c | 6 +- sound/soc/generic/test-component.c | 4 +- sound/soc/sh/rcar/core.c | 4 +- 73 files changed, 247 insertions(+), 251 deletions(-)
Signature · 1 line
2.25.1
Kuninori Morimoto
maintainerPATCH v3 1/24 of: property: add missing kerneldoc for of_graph_get_endpoint_count()
of_graph_get_endpoint_count() doesn't have kerneldoc. Add it.
--- drivers/of/property.c | 6 ++++++ 1 file changed, 6 insertions(+)
drivers/of/property.c +6 -0
@@ -811,6 +811,12 @@ struct device_node *of_graph_get_remote_port(const struct device_node *node) }EXPORT_SYMBOL (of_graph_get_remote_port); +/** +* of_graph_get_endpoint_count() - get count of endpoint +* @np: pointer to the parent device node +* +* Return: count of endpoint of this device node +*/ int of_graph_get_endpoint_count (const struct device_node *np) {struct device_node *endpoint;
Signature · 1 line
2.25.1
Kuninori Morimoto
maintainerPATCH v3 2/24 of: property: use unsigned int return on of_graph_get_endpoint_count()
In reply to Kuninori MorimotoThe return type and the variable of of_graph_get_endpoint_count() should be unsigned. Tidyup it.
--- drivers/of/property.c | 2 +- include/linux/of_graph.h | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-)
drivers/of/property.c +1 -1
@@ -817,7 +817,7 @@ EXPORT_SYMBOL(of_graph_get_remote_port);* * Return: count of endpoint of this device node */ -int of_graph_get_endpoint_count (const struct device_node *np) +unsigned int of_graph_get_endpoint_count (const struct device_node *np) {struct device_node *endpoint;int num =0 ;
include/linux/of_graph.h +2 -2
@@ -41,7 +41,7 @@ struct of_endpoint {bool of_graph_is_present (const struct device_node *node);int of_graph_parse_endpoint (const struct device_node *node,struct of_endpoint *endpoint); -int of_graph_get_endpoint_count (const struct device_node *np); +unsigned int of_graph_get_endpoint_count (const struct device_node *np);struct device_node *of_graph_get_port_by_id (struct device_node *node,u32 id);struct device_node *of_graph_get_next_endpoint (const struct device_node *parent,struct device_node *previous);
@@ -68,7 +68,7 @@ static inline int of_graph_parse_endpoint(const struct device_node *node,return -ENOSYS ; } -static inline int of_graph_get_endpoint_count (const struct device_node *np) +static inline unsigned int of_graph_get_endpoint_count (const struct device_node *np) {return 0 ; }
Signature · 1 line
2.25.1
Re: [PATCH v3 02/24] of: property: use unsigned int return on of_graph_get_endpoint_count()
Quoted 3 lines · Kuninori Morimoto
The return type and the variable of
of_graph_get_endpoint_count()should be unsigned. Tidyup it.
'the variable'?
I'd have added a few words telling that return type can be unsigned because there is no error reporting for this function.
Quoted 43 lines
Signed-off-by Kuninori Morimoto <[email protected]>--- drivers/of/property.c | 2 +- include/linux/of_graph.h | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-)drivers/of/property.c +1
-1@@ -817,7 +817,7 @@ EXPORT_SYMBOL(of_graph_get_remote_port);* * Return: count of endpoint of this device node */ -int of_graph_get_endpoint_count (const struct device_node *np) +unsigned int of_graph_get_endpoint_count (const struct device_node *np) {struct device_node *endpoint;int num =0 ;include/linux/of_graph.h +2
-3@@ -41,7 +41,7 @@ struct of_endpoint {bool of_graph_is_present (const struct device_node *node);int of_graph_parse_endpoint (const struct device_node *node,struct of_endpoint *endpoint); -int of_graph_get_endpoint_count (const struct device_node *np); +unsigned int of_graph_get_endpoint_count (const struct device_node *np);struct device_node *of_graph_get_port_by_id (struct device_node *node,u32 id);struct device_node *of_graph_get_next_endpoint (const struct device_node *parent,struct device_node *previous);@@ -68,7 +68,7 @@ static inline int of_graph_parse_endpoint(const struct device_node *node,return -ENOSYS ; } -static inline int of_graph_get_endpoint_count (const struct device_node *np) +static inline unsigned int of_graph_get_endpoint_count (const struct device_node *np) {return 0 ; } --
Quoted 2 lines
2.25.1
--
With best wishes
Dmitry
Kuninori Morimoto
maintainerRe: [PATCH v3 02/24] of: property: use unsigned int return on of_graph_get_endpoint_count()
Hi Dmitry
Thank you for your review
Quoted 7 lines
Quoted 2 lines
The return type and the variable of
of_graph_get_endpoint_count()should be unsigned. Tidyup it.'the variable'?
I'd have added a few words telling that return type can be unsigned because there is no error reporting for this function.
I see. v4 will be
Because of of_graph_get_endpoint_count() doesn't report error, just return count of endpoint, the return type of it should be unsigned. Tidyup it.
Thank you for your help !!
Best regards
---
Renesas Electronics
Ph.D. Kuninori Morimoto
Kuninori Morimoto
maintainerPATCH v3 3/24 of: property: rename of_graph_get_next_endpoint() to of_graph_get_next_device_endpoint()
In reply to Kuninori MorimotoCurrent of_graph_get_next_endpoint() will get next endpoint.
ports {
port@0 {
endpoint@0 {...};
(A) endpoint@1 {...};
};
port@1 {
(B) endpoint {...};
};
...
};If it reached to end of port (A), it will get next endpoint from next port (B). This behavior is not intuitive to user. User assume it return NULL after (A) from this function name.
This function gets "endpoint" from "device" one after another instead of "port". So let's rename related functions as
of_graph_get_next_endpoint() -> of_graph_get_next_device_endpoint() of_graph_get_endpoint_count() -> of_graph_get_device_endpoint_count()for_each_endpoint_of_node() -> for_each_device_endpoint_of_node()
--- .clang-format | 2 +- drivers/of/property.c | 24 +++++++++++++----------- include/linux/of_graph.h | 23 ++++++++++++++--------- 3 files changed, 28 insertions(+), 21 deletions(-)
.clang-format +1 -1
@@ -231,6 +231,7 @@ ForEachMacros: - 'for_each_dedup_cand' - 'for_each_dev_addr' - 'for_each_dev_scope' + - 'for_each_device_endpoint_of_node' - 'for_each_dma_cap_mask' - 'for_each_dpcm_be' - 'for_each_dpcm_be_rollback'
@@ -243,7 +244,6 @@ ForEachMacros: - 'for_each_element' - 'for_each_element_extid' - 'for_each_element_id' - - 'for_each_endpoint_of_node' - 'for_each_event' - 'for_each_event_tps' - 'for_each_evictable_lru'
drivers/of/property.c +13 -11
@@ -632,15 +632,17 @@ struct device_node *of_graph_get_port_by_id(struct device_node *parent, u32 id)EXPORT_SYMBOL (of_graph_get_port_by_id);/** -* of_graph_get_next_endpoint() - get next endpoint node +* of_graph_get_next_device_endpoint() - get next endpoint node. If it reached to end of the port, +* it gets next endpoint from next port. +* * @parent: pointer to the parent device node * @prev: previous endpoint node, or NULL to get first * * Return: An 'endpoint' node pointer with refcount incremented. Refcount * of the passed @prev node is decremented. */ -struct device_node *of_graph_get_next_endpoint (const struct device_node *parent, -struct device_node *prev) +struct device_node *of_graph_get_next_device_endpoint (const struct device_node *parent, +struct device_node *prev) {struct device_node *endpoint;struct device_node *port;
@@ -696,7 +698,7 @@ struct device_node *of_graph_get_next_endpoint(const struct device_node *parent, }while (!of_node_name_eq (port,"port" )); } } -EXPORT_SYMBOL (of_graph_get_next_endpoint); +EXPORT_SYMBOL (of_graph_get_next_device_endpoint);/** * of_graph_get_endpoint_by_regs() - get endpoint node of specific identifiers
@@ -714,7 +716,7 @@ struct device_node *of_graph_get_endpoint_by_regs(struct of_endpoint endpoint;struct device_node *node =NULL ; -for_each_endpoint_of_node (parent, node) { +for_each_device_endpoint_of_node (parent, node) {of_graph_parse_endpoint (node, &endpoint);if (((port_reg ==-1 ) || (endpoint.port == port_reg)) && ((reg ==-1 ) || (endpoint.id == reg)))
@@ -812,22 +814,22 @@ struct device_node *of_graph_get_remote_port(const struct device_node *node)EXPORT_SYMBOL (of_graph_get_remote_port);/** -* of_graph_get_endpoint_count() - get count of endpoint +* of_graph_get_device_endpoint_count() - get count of endpoint * @np: pointer to the parent device node * * Return: count of endpoint of this device node */ -unsigned int of_graph_get_endpoint_count (const struct device_node *np) +unsigned int of_graph_get_device_endpoint_count (const struct device_node *np) {struct device_node *endpoint;int num =0 ; -for_each_endpoint_of_node (np, endpoint) +for_each_device_endpoint_of_node (np, endpoint) num++;return num; } -EXPORT_SYMBOL (of_graph_get_endpoint_count); +EXPORT_SYMBOL (of_graph_get_device_endpoint_count);/** * of_graph_get_remote_node() - get remote parent device_node for given port/endpoint
@@ -1017,8 +1019,8 @@ static struct fwnode_handle * of_fwnode_graph_get_next_endpoint(const struct fwnode_handle *fwnode, struct fwnode_handle *prev) { - return of_fwnode_handle(of_graph_get_next_endpoint(to_of_node(fwnode), -to_of_node (prev ))); + return of_fwnode_handle(of_graph_get_next_device_endpoint(to_of_node(fwnode), +to_of_node (prev ))); } static struct fwnode_handle *
include/linux/of_graph.h +14 -9
@@ -26,25 +26,30 @@ struct of_endpoint {const struct device_node *local_node; }; +/* REMOVE ME */ +#define of_graph_get_next_endpoint (parent, previous) of_graph_get_next_device_endpoint(parent, previous) +#define for_each_endpoint_of_node (parent, child) for_each_device_endpoint_of_node(parent, child) +#define of_graph_get_endpoint_count (np) of_graph_get_device_endpoint_count(np) +/** -* for_each_endpoint_of_node - iterate over every endpoint in a device node +* for_each_device_endpoint_of_node - iterate over every endpoint in a device node * @parent: parent device node containing ports and endpoints * @child: loop variable pointing to the current endpoint node * * When breaking out of the loop, of_node_put(child) has to be called manually. */ -#define for_each_endpoint_of_node (parent, child) \ - for (child = of_graph_get_next_endpoint(parent, NULL); child != NULL; \ - child = of_graph_get_next_endpoint(parent, child)) +#define for_each_device_endpoint_of_node (parent, child) \ + for (child = of_graph_get_next_device_endpoint(parent, NULL); child != NULL; \ + child = of_graph_get_next_device_endpoint(parent, child))#ifdef CONFIG_OF bool of_graph_is_present (const struct device_node *node);int of_graph_parse_endpoint (const struct device_node *node,struct of_endpoint *endpoint); -unsigned int of_graph_get_endpoint_count (const struct device_node *np); +unsigned int of_graph_get_device_endpoint_count (const struct device_node *np);struct device_node *of_graph_get_port_by_id (struct device_node *node,u32 id); -struct device_node *of_graph_get_next_endpoint (const struct device_node *parent, -struct device_node *previous); +struct device_node *of_graph_get_next_device_endpoint (const struct device_node *parent, +struct device_node *previous);struct device_node *of_graph_get_endpoint_by_regs (const struct device_node *parent,int port_reg,int reg); struct device_node *of_graph_get_remote_endpoint(
@@ -68,7 +73,7 @@ static inline int of_graph_parse_endpoint(const struct device_node *node,return -ENOSYS ; } -static inline unsigned int of_graph_get_endpoint_count (const struct device_node *np) +static inline unsigned int of_graph_get_device_endpoint_count (const struct device_node *np) {return 0 ; }
@@ -79,7 +84,7 @@ static inline struct device_node *of_graph_get_port_by_id(return NULL ; } -static inline struct device_node *of_graph_get_next_endpoint ( +static inline struct device_node *of_graph_get_next_device_endpoint (const struct device_node *parent,struct device_node *previous) {
Signature · 1 line
2.25.1
Kuninori Morimoto
maintainerPATCH v3 4/24 video: fbdev: switch to use of_graph_get_next_device_endpoint()
In reply to Kuninori Morimotoof_graph_get_next_endpoint() is now renamed to of_graph_get_next_device_endpoint(). Switch to it.
--- drivers/video/fbdev/amba-clcd.c | 2 +- drivers/video/fbdev/omap2/omapfb/dss/omapdss-boot-init.c | 2 +- drivers/video/fbdev/pxafb.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-)
drivers/video/fbdev/amba-clcd.c +1 -1
@@ -691,7 +691,7 @@ static int clcdfb_of_init_display(struct clcd_fb *fb)/* * Fetch the panel endpoint. */ - endpoint =of_graph_get_next_endpoint (fb->dev->dev.of_node,NULL ); + endpoint =of_graph_get_next_device_endpoint (fb->dev->dev.of_node,NULL );if (!endpoint)return -ENODEV ;
drivers/video/fbdev/omap2/omapfb/dss/omapdss-boot-init.c +1 -1
@@ -150,7 +150,7 @@ static void __init omapdss_walk_device(struct device_node *node, bool root)of_node_put (n); n =NULL ; -while ((n =of_graph_get_next_endpoint (node, n)) !=NULL ) { +while ((n =of_graph_get_next_device_endpoint (node, n)) !=NULL ) {struct device_node *pn; pn =of_graph_get_remote_port_parent (n);
drivers/video/fbdev/pxafb.c +1 -1
@@ -2171,7 +2171,7 @@ static int of_get_pxafb_mode_info(struct device *dev,u32 bus_width;int ret, i; - np =of_graph_get_next_endpoint (dev->of_node,NULL ); + np =of_graph_get_next_device_endpoint (dev->of_node,NULL );if (!np) {dev_err (dev,"could not find endpoint\n" );return -EINVAL ;
Signature · 1 line
2.25.1
Kuninori Morimoto
maintainerPATCH v3 5/24 media: i2c: switch to use of_graph_get_next_device_endpoint()
In reply to Kuninori Morimotoof_graph_get_next_endpoint() is now renamed to of_graph_get_next_device_endpoint(). Switch to it.
--- drivers/media/i2c/adv7343.c | 2 +- drivers/media/i2c/adv748x/adv748x-core.c | 2 +- drivers/media/i2c/adv7604.c | 2 +- drivers/media/i2c/isl7998x.c | 2 +- drivers/media/i2c/max9286.c | 2 +- drivers/media/i2c/mt9p031.c | 2 +- drivers/media/i2c/mt9v032.c | 2 +- drivers/media/i2c/ov2659.c | 2 +- drivers/media/i2c/ov5645.c | 2 +- drivers/media/i2c/ov5647.c | 2 +- drivers/media/i2c/s5c73m3/s5c73m3-core.c | 2 +- drivers/media/i2c/s5k5baf.c | 2 +- drivers/media/i2c/tc358743.c | 2 +- drivers/media/i2c/tda1997x.c | 2 +- drivers/media/i2c/tvp514x.c | 2 +- drivers/media/i2c/tvp5150.c | 4 ++-- drivers/media/i2c/tvp7002.c | 2 +- 17 files changed, 18 insertions(+), 18 deletions(-)
drivers/media/i2c/adv7343.c +1 -1
@@ -403,7 +403,7 @@ adv7343_get_pdata(struct i2c_client *client)if (!IS_ENABLED (CONFIG_OF ) || !client->dev.of_node)return client->dev.platform_data; - np =of_graph_get_next_endpoint (client->dev.of_node,NULL ); + np =of_graph_get_next_device_endpoint (client->dev.of_node,NULL );if (!np)return NULL ;
drivers/media/i2c/adv748x/adv748x-core.c +1 -1
@@ -657,7 +657,7 @@ static int adv748x_parse_dt(struct adv748x_state *state)bool in_found = false;int ret; -for_each_endpoint_of_node (state->dev->of_node, ep_np) { +for_each_device_endpoint_of_node (state->dev->of_node, ep_np) {of_graph_parse_endpoint (ep_np, &ep);adv_info (state,"Endpoint %pOF on port %d" , ep.local_node, ep.port);
drivers/media/i2c/adv7604.c +1 -1
@@ -3205,7 +3205,7 @@ static int adv76xx_parse_dt(struct adv76xx_state *state) np = state->i2c_clients[ADV76XX_PAGE_IO ]->dev.of_node;/* Parse the endpoint. */ - endpoint =of_graph_get_next_endpoint (np,NULL ); + endpoint =of_graph_get_next_device_endpoint (np,NULL );if (!endpoint)return -EINVAL ;
drivers/media/i2c/isl7998x.c +1 -1
@@ -580,7 +580,7 @@ static int isl7998x_get_nr_inputs(struct device_node *of_node)unsigned int inputs =0 ;unsigned int i; -if (of_graph_get_endpoint_count (of_node) >ISL7998X_NUM_PADS ) +if (of_graph_get_device_endpoint_count (of_node) >ISL7998X_NUM_PADS )return -EINVAL ;/*
drivers/media/i2c/max9286.c +1 -1
@@ -1452,7 +1452,7 @@ static int max9286_parse_dt(struct max9286_priv *priv)of_node_put (i2c_mux);/* Parse the endpoints */ -for_each_endpoint_of_node (dev->of_node, node) { +for_each_device_endpoint_of_node (dev->of_node, node) {struct max9286_source *source;struct of_endpoint ep;
drivers/media/i2c/mt9p031.c +1 -1
@@ -1080,7 +1080,7 @@ mt9p031_get_pdata(struct i2c_client *client)if (!IS_ENABLED (CONFIG_OF ) || !client->dev.of_node)return client->dev.platform_data; - np =of_graph_get_next_endpoint (client->dev.of_node,NULL ); + np =of_graph_get_next_device_endpoint (client->dev.of_node,NULL );if (!np)return NULL ;
drivers/media/i2c/mt9v032.c +1 -1
@@ -1008,7 +1008,7 @@ mt9v032_get_pdata(struct i2c_client *client)if (!IS_ENABLED (CONFIG_OF ) || !client->dev.of_node)return client->dev.platform_data; - np =of_graph_get_next_endpoint (client->dev.of_node,NULL ); + np =of_graph_get_next_device_endpoint (client->dev.of_node,NULL );if (!np)return NULL ;
drivers/media/i2c/ov2659.c +1 -1
@@ -1388,7 +1388,7 @@ ov2659_get_pdata(struct i2c_client *client)if (!IS_ENABLED (CONFIG_OF ) || !client->dev.of_node)return client->dev.platform_data; - endpoint =of_graph_get_next_endpoint (client->dev.of_node,NULL ); + endpoint =of_graph_get_next_device_endpoint (client->dev.of_node,NULL );if (!endpoint)return NULL ;
drivers/media/i2c/ov5645.c +1 -1
@@ -1053,7 +1053,7 @@ static int ov5645_probe(struct i2c_client *client) ov5645->i2c_client = client; ov5645->dev = dev; - endpoint =of_graph_get_next_endpoint (dev->of_node,NULL ); + endpoint =of_graph_get_next_device_endpoint (dev->of_node,NULL );if (!endpoint) {dev_err (dev,"endpoint node not found\n" );return -EINVAL ;
drivers/media/i2c/ov5647.c +1 -1
@@ -1363,7 +1363,7 @@ static int ov5647_parse_dt(struct ov5647 *sensor, struct device_node *np)struct device_node *ep;int ret; - ep =of_graph_get_next_endpoint (np,NULL ); + ep =of_graph_get_next_device_endpoint (np,NULL );if (!ep)return -EINVAL ;
drivers/media/i2c/s5c73m3/s5c73m3-core.c +1 -1
@@ -1555,7 +1555,7 @@ static int s5c73m3_get_dt_data(struct s5c73m3 *state) "failed to request gpio S5C73M3_RST\n");gpiod_set_consumer_name (state->reset,"S5C73M3_RST" ); - node_ep =of_graph_get_next_endpoint (node,NULL ); + node_ep =of_graph_get_next_device_endpoint (node,NULL );if (!node_ep) {dev_warn (dev,"no endpoint defined for node: %pOF\n" , node);return 0 ;
drivers/media/i2c/s5k5baf.c +1 -1
@@ -1836,7 +1836,7 @@ static int s5k5baf_parse_device_node(struct s5k5baf *state, struct device *dev) state->mclk_frequency); } - node_ep =of_graph_get_next_endpoint (node,NULL ); + node_ep =of_graph_get_next_device_endpoint (node,NULL );if (!node_ep) {dev_err (dev,"no endpoint defined at node %pOF\n" , node);return -EINVAL ;
drivers/media/i2c/tc358743.c +1 -1
@@ -1895,7 +1895,7 @@ static int tc358743_probe_of(struct tc358743_state *state)return dev_err_probe (dev,PTR_ERR (refclk),"failed to get refclk\n" ); - ep =of_graph_get_next_endpoint (dev->of_node,NULL ); + ep =of_graph_get_next_device_endpoint (dev->of_node,NULL );if (!ep) {dev_err (dev,"missing endpoint node\n" );return -EINVAL ;
drivers/media/i2c/tda1997x.c +1 -1
@@ -2307,7 +2307,7 @@ static int tda1997x_parse_dt(struct tda1997x_state *state) pdata->vidout_sel_de =DE_FREF_SEL_DE_VHREF ; np = state->client->dev.of_node; - ep =of_graph_get_next_endpoint (np,NULL ); + ep =of_graph_get_next_device_endpoint (np,NULL );if (!ep)return -EINVAL ;
drivers/media/i2c/tvp514x.c +1 -1
@@ -988,7 +988,7 @@ tvp514x_get_pdata(struct i2c_client *client)if (!IS_ENABLED (CONFIG_OF ) || !client->dev.of_node)return client->dev.platform_data; - endpoint =of_graph_get_next_endpoint (client->dev.of_node,NULL ); + endpoint =of_graph_get_next_device_endpoint (client->dev.of_node,NULL );if (!endpoint)return NULL ;
drivers/media/i2c/tvp5150.c +2 -2
@@ -2000,7 +2000,7 @@ static int tvp5150_parse_dt(struct tvp5150 *decoder, struct device_node *np)int ret;/* At least 1 output and 1 input */ - ep_num =of_graph_get_endpoint_count (np); + ep_num =of_graph_get_device_endpoint_count (np);if (ep_num <2 || ep_num >5 ) {dev_err (dev,"At least 1 input and 1 output must be connected to the device.\n" );return -EINVAL ;
@@ -2017,7 +2017,7 @@ static int tvp5150_parse_dt(struct tvp5150 *decoder, struct device_node *np)* tvp-5150 port@2 * endpoint (video bitstream output at YOUT[0-7] parallel bus) */ -for_each_endpoint_of_node (np, ep_np) { +for_each_device_endpoint_of_node (np, ep_np) {struct fwnode_handle *ep_fwnode =of_fwnode_handle (ep_np);unsigned int next_connector = decoder->connectors_num;struct of_endpoint ep;
drivers/media/i2c/tvp7002.c +1 -1
@@ -893,7 +893,7 @@ tvp7002_get_pdata(struct i2c_client *client)if (!IS_ENABLED (CONFIG_OF ) || !client->dev.of_node)return client->dev.platform_data; - endpoint =of_graph_get_next_endpoint (client->dev.of_node,NULL ); + endpoint =of_graph_get_next_device_endpoint (client->dev.of_node,NULL );if (!endpoint)return NULL ;
Signature · 1 line
2.25.1
Rob Herring
maintainerRe: [PATCH v3 05/24] media: i2c: switch to use of_graph_get_next_device_endpoint()
Quoted 29 lines · Kuninori Morimoto
of_graph_get_next_endpoint()is now renamed toof_graph_get_next_device_endpoint(). Switch to it.Signed-off-by Kuninori Morimoto <[email protected]>--- drivers/media/i2c/adv7343.c | 2 +- drivers/media/i2c/adv748x/adv748x-core.c | 2 +- drivers/media/i2c/adv7604.c | 2 +- drivers/media/i2c/isl7998x.c | 2 +- drivers/media/i2c/max9286.c | 2 +- drivers/media/i2c/mt9p031.c | 2 +- drivers/media/i2c/mt9v032.c | 2 +- drivers/media/i2c/ov2659.c | 2 +- drivers/media/i2c/ov5645.c | 2 +- drivers/media/i2c/ov5647.c | 2 +- drivers/media/i2c/s5c73m3/s5c73m3-core.c | 2 +- drivers/media/i2c/s5k5baf.c | 2 +- drivers/media/i2c/tc358743.c | 2 +- drivers/media/i2c/tda1997x.c | 2 +- drivers/media/i2c/tvp514x.c | 2 +- drivers/media/i2c/tvp5150.c | 4 ++-- drivers/media/i2c/tvp7002.c | 2 +- 17 files changed, 18 insertions(+), 18 deletions(-)drivers/media/i2c/adv7343.c +0
-0
drivers/media/i2c/adv7343.c adv7343_get_pdata(struct i2c_client *client) · line 406
Quoted 5 lines
drivers/media/i2c/adv7343.c +1
-1@@ -403,7 +403,7 @@ adv7343_get_pdata(struct i2c_client *client)if (!IS_ENABLED (CONFIG_OF ) || !client->dev.of_node)return client->dev.platform_data; - np =of_graph_get_next_endpoint (client->dev.of_node,NULL ); + np =of_graph_get_next_device_endpoint (client->dev.of_node,NULL );
This is assuming there's just 1 port and 1 endpoint, but let's be specific as the bindings are (first endpoint on port 0):
of_graph_get_endpoint_by_regs(client->dev.of_node, 0, -1);
Note we could ask for endpoint 0 here, but the bindings generally allow for more than 1.
I imagine most of the other cases here are the same.
drivers/media/i2c/adv748x/adv748x-core.c static int adv748x_parse_dt(struct adv748x_state *state) · line 660
Quoted 13 lines
drivers/media/i2c/adv7343.c +0
-0if (!np)return NULL ;drivers/media/i2c/adv748x/adv748x-core.c +1
-1@@ -657,7 +657,7 @@ static int adv748x_parse_dt(struct adv748x_state *state)bool in_found = false;int ret; -for_each_endpoint_of_node (state->dev->of_node, ep_np) { +for_each_device_endpoint_of_node (state->dev->of_node, ep_np) {
I would skip the rename.
Rob
Kuninori Morimoto
maintainerRe: [PATCH v3 05/24] media: i2c: switch to use of_graph_get_next_device_endpoint()
Hi Rob
Quoted 9 lines
This is assuming there's just 1 port and 1 endpoint, but let's be specific as the bindings are (first endpoint on port 0):
of_graph_get_endpoint_by_regs(client->dev.of_node, 0, -1);Note we could ask for endpoint 0 here, but the bindings generally allow for more than 1.
I imagine most of the other cases here are the same.
I will do it on new patch-set
Quoted 4 lines
drivers/media/i2c/adv748x/adv748x-core.c static int adv748x_parse_dt(struct adv748x_state *state) · line 660
Quoted 2 lines
drivers/media/i2c/adv748x/adv748x-core.c +1
-1-for_each_endpoint_of_node (state->dev->of_node, ep_np) { +for_each_device_endpoint_of_node (state->dev->of_node, ep_np) {I would skip the rename.
It is needed to avoid confuse, because new function will add another endpoint loop.
see
https://lore.kernel.org/r/20240131100701.754a95ee@booty
Thank you for your help !!
Best regards
---
Renesas Electronics
Ph.D. Kuninori Morimoto
Rob Herring
maintainerRe: [PATCH v3 05/24] media: i2c: switch to use of_graph_get_next_device_endpoint()
Quoted 20 lines · Kuninori Morimoto
Hi Rob
Quoted 9 lines
This is assuming there's just 1 port and 1 endpoint, but let's be specific as the bindings are (first endpoint on port 0):
of_graph_get_endpoint_by_regs(client->dev.of_node, 0, -1);Note we could ask for endpoint 0 here, but the bindings generally allow for more than 1.
I imagine most of the other cases here are the same.
I will do it on new patch-set
Quoted 4 lines
drivers/media/i2c/adv748x/adv748x-core.c static int adv748x_parse_dt(struct adv748x_state *state) · line 660
Quoted 2 lines
drivers/media/i2c/adv748x/adv748x-core.c +1
-1-for_each_endpoint_of_node (state->dev->of_node, ep_np) { +for_each_device_endpoint_of_node (state->dev->of_node, ep_np) {I would skip the rename.
Quoted 5 lines
It is needed to avoid confuse, because new function will add another endpoint loop.
I've read the threads already and think you should skip the rename. Just put 'port' in the name of the new one. That and taking a port number param should be enough distinction.
Rob
Kuninori Morimoto
maintainerRe: [PATCH v3 05/24] media: i2c: switch to use of_graph_get_next_device_endpoint()
Hi Rob
Quoted 2 lines
I've read the threads already and think you should skip the rename. Just put 'port' in the name of the new one.
OK
Quoted 1 line
That and taking a port number param should be enough distinction.
I think we want to use "port" directly instead of "port number" on new function.
Thank you for your help !!
Best regards
---
Renesas Electronics
Ph.D. Kuninori Morimoto
Kuninori Morimoto
maintainerRe: [PATCH v3 05/24] media: i2c: switch to use of_graph_get_next_device_endpoint()
In reply to Kuninori MorimotoHi Rob, again
Quoted 9 lines
Quoted 9 lines
This is assuming there's just 1 port and 1 endpoint, but let's be specific as the bindings are (first endpoint on port 0):
of_graph_get_endpoint_by_regs(client->dev.of_node, 0, -1);Note we could ask for endpoint 0 here, but the bindings generally allow for more than 1.
I imagine most of the other cases here are the same.
I'm bit confused here.
You mentioned that -1 is wrong in previous mail.
Most cases are in the form of of_graph_get_next_endpoint(dev, NULL) which is equivalent to of_graph_get_endpoint_by_regs(dev, 0, 0). Technically, -1 instead of 0 is equivalent, but I'd argue is sloppy and wrong.
But you mentioned -1 here, So, I will use it on next patch-set.
Thank you for your help !!
Best regards
---
Renesas Electronics
Ph.D. Kuninori Morimoto
Kuninori Morimoto
maintainerPATCH v3 6/24 media: platform: switch to use of_graph_get_next_device_endpoint()
In reply to Kuninori Morimotoof_graph_get_next_endpoint() is now renamed to of_graph_get_next_device_endpoint(). Switch to it.
--- drivers/media/platform/atmel/atmel-isi.c | 4 ++-- drivers/media/platform/intel/pxa_camera.c | 2 +- drivers/media/platform/microchip/microchip-sama5d2-isc.c | 2 +- drivers/media/platform/microchip/microchip-sama7g5-isc.c | 2 +- drivers/media/platform/qcom/camss/camss.c | 2 +- drivers/media/platform/renesas/renesas-ceu.c | 2 +- drivers/media/platform/samsung/exynos4-is/fimc-is.c | 2 +- drivers/media/platform/samsung/exynos4-is/mipi-csis.c | 2 +- drivers/media/platform/st/stm32/stm32-dcmi.c | 4 ++-- drivers/media/platform/ti/am437x/am437x-vpfe.c | 2 +- drivers/media/platform/ti/davinci/vpif.c | 3 +-- drivers/media/platform/ti/davinci/vpif_capture.c | 3 +-- drivers/media/platform/video-mux.c | 2 +- drivers/media/platform/xilinx/xilinx-vipp.c | 2 +- 14 files changed, 16 insertions(+), 18 deletions(-)
drivers/media/platform/atmel/atmel-isi.c +2 -2
@@ -831,7 +831,7 @@ static int atmel_isi_parse_dt(struct atmel_isi *isi, isi->pdata.full_mode =1 ; isi->pdata.frate =ISI_CFG1_FRATE_CAPTURE_ALL ; - np =of_graph_get_next_endpoint (np,NULL ); + np =of_graph_get_next_device_endpoint (np,NULL );if (!np) {dev_err (&pdev->dev,"Could not find the endpoint\n" );return -EINVAL ;
@@ -1155,7 +1155,7 @@ static int isi_graph_init(struct atmel_isi *isi)struct device_node *ep;int ret; - ep =of_graph_get_next_endpoint (isi->dev->of_node,NULL ); + ep =of_graph_get_next_device_endpoint (isi->dev->of_node,NULL );if (!ep)return -EINVAL ;
drivers/media/platform/intel/pxa_camera.c +1 -1
@@ -2207,7 +2207,7 @@ static int pxa_camera_pdata_from_dt(struct device *dev, pcdev->mclk = mclk_rate; } - np =of_graph_get_next_endpoint (np,NULL ); + np =of_graph_get_next_device_endpoint (np,NULL );if (!np) {dev_err (dev,"could not find endpoint\n" );return -EINVAL ;
drivers/media/platform/microchip/microchip-sama5d2-isc.c +1 -1
@@ -363,7 +363,7 @@ static int isc_parse_dt(struct device *dev, struct isc_device *isc)while (1 ) {struct v4l2_fwnode_endpoint v4l2_epn = { .bus_type =0 }; - epn =of_graph_get_next_endpoint (np, epn); + epn =of_graph_get_next_device_endpoint (np, epn);if (!epn)return 0 ;
drivers/media/platform/microchip/microchip-sama7g5-isc.c +1 -1
@@ -349,7 +349,7 @@ static int xisc_parse_dt(struct device *dev, struct isc_device *isc)while (1 ) {struct v4l2_fwnode_endpoint v4l2_epn = { .bus_type =0 }; - epn =of_graph_get_next_endpoint (np, epn); + epn =of_graph_get_next_device_endpoint (np, epn);if (!epn)return 0 ;
drivers/media/platform/qcom/camss/camss.c +1 -1
@@ -1136,7 +1136,7 @@ static int camss_of_parse_ports(struct camss *camss)struct device_node *remote =NULL ;int ret, num_subdevs =0 ; -for_each_endpoint_of_node (dev->of_node, node) { +for_each_device_endpoint_of_node (dev->of_node, node) {struct camss_async_subdev *csd;if (!of_device_is_available (node))
drivers/media/platform/renesas/renesas-ceu.c +1 -1
@@ -1526,7 +1526,7 @@ static int ceu_parse_dt(struct ceu_device *ceudev)int num_ep;int ret; - num_ep =of_graph_get_endpoint_count (of); + num_ep =of_graph_get_device_endpoint_count (of);if (!num_ep)return -ENODEV ;
drivers/media/platform/samsung/exynos4-is/fimc-is.c +1 -1
@@ -175,7 +175,7 @@ static int fimc_is_parse_sensor_config(struct fimc_is *is, unsigned int index,return -EINVAL ; } - ep =of_graph_get_next_endpoint (node,NULL ); + ep =of_graph_get_next_device_endpoint (node,NULL );if (!ep)return -ENXIO ;
drivers/media/platform/samsung/exynos4-is/mipi-csis.c +1 -1
@@ -728,7 +728,7 @@ static int s5pcsis_parse_dt(struct platform_device *pdev, &state->max_num_lanes))return -EINVAL ; - node =of_graph_get_next_endpoint (node,NULL ); + node =of_graph_get_next_device_endpoint (node,NULL );if (!node) {dev_err (&pdev->dev,"No port node at %pOF\n" , pdev->dev.of_node);
drivers/media/platform/st/stm32/stm32-dcmi.c +2 -2
@@ -1856,7 +1856,7 @@ static int dcmi_graph_init(struct stm32_dcmi *dcmi)struct device_node *ep;int ret; - ep =of_graph_get_next_endpoint (dcmi->dev->of_node,NULL ); + ep =of_graph_get_next_device_endpoint (dcmi->dev->of_node,NULL );if (!ep) {dev_err (dcmi->dev,"Failed to get next endpoint\n" );return -EINVAL ;
@@ -1915,7 +1915,7 @@ static int dcmi_probe(struct platform_device *pdev) "Could not get reset control\n");/* Get bus characteristics from devicetree */ - np =of_graph_get_next_endpoint (np,NULL ); + np =of_graph_get_next_device_endpoint (np,NULL );if (!np) {dev_err (&pdev->dev,"Could not find the endpoint\n" );return -ENODEV ;
drivers/media/platform/ti/am437x/am437x-vpfe.c +1 -1
@@ -2309,7 +2309,7 @@ vpfe_get_pdata(struct vpfe_device *vpfe)struct v4l2_fwnode_endpoint bus_cfg = { .bus_type =0 };struct device_node *rem; - endpoint =of_graph_get_next_endpoint (dev->of_node, endpoint); + endpoint =of_graph_get_next_device_endpoint (dev->of_node, endpoint);if (!endpoint)break ;
drivers/media/platform/ti/davinci/vpif.c +1 -2
@@ -465,8 +465,7 @@ static int vpif_probe(struct platform_device *pdev)* so their devices need to be registered manually here * for their legacy platform_drivers to work. */ - endpoint =of_graph_get_next_endpoint (pdev->dev.of_node, - endpoint); + endpoint =of_graph_get_next_device_endpoint (pdev->dev.of_node, endpoint);if (!endpoint)return 0 ;of_node_put (endpoint);
drivers/media/platform/ti/davinci/vpif_capture.c +1 -2
@@ -1521,8 +1521,7 @@ vpif_capture_get_pdata(struct platform_device *pdev,unsigned int flags;int err; - endpoint =of_graph_get_next_endpoint (pdev->dev.of_node, - endpoint); + endpoint =of_graph_get_next_device_endpoint (pdev->dev.of_node, endpoint);if (!endpoint)break ;
drivers/media/platform/video-mux.c +1 -1
@@ -408,7 +408,7 @@ static int video_mux_probe(struct platform_device *pdev)* The largest numbered port is the output port. It determines * total number of pads. */ -for_each_endpoint_of_node (np, ep) { +for_each_device_endpoint_of_node (np, ep) {struct of_endpoint endpoint;of_graph_parse_endpoint (ep, &endpoint);
drivers/media/platform/xilinx/xilinx-vipp.c +1 -1
@@ -207,7 +207,7 @@ static int xvip_graph_build_dma(struct xvip_composite_device *xdev)while (1 ) {/* Get the next endpoint and parse its link. */ - ep =of_graph_get_next_endpoint (node, ep); + ep =of_graph_get_next_device_endpoint (node, ep);if (ep ==NULL )break ;
Signature · 1 line
2.25.1
Rob Herring
maintainerRe: [PATCH v3 06/24] media: platform: switch to use of_graph_get_next_device_endpoint()
Quoted 26 lines · Kuninori Morimoto
of_graph_get_next_endpoint()is now renamed toof_graph_get_next_device_endpoint(). Switch to it.Signed-off-by Kuninori Morimoto <[email protected]>--- drivers/media/platform/atmel/atmel-isi.c | 4 ++-- drivers/media/platform/intel/pxa_camera.c | 2 +- drivers/media/platform/microchip/microchip-sama5d2-isc.c | 2 +- drivers/media/platform/microchip/microchip-sama7g5-isc.c | 2 +- drivers/media/platform/qcom/camss/camss.c | 2 +- drivers/media/platform/renesas/renesas-ceu.c | 2 +- drivers/media/platform/samsung/exynos4-is/fimc-is.c | 2 +- drivers/media/platform/samsung/exynos4-is/mipi-csis.c | 2 +- drivers/media/platform/st/stm32/stm32-dcmi.c | 4 ++-- drivers/media/platform/ti/am437x/am437x-vpfe.c | 2 +- drivers/media/platform/ti/davinci/vpif.c | 3 +-- drivers/media/platform/ti/davinci/vpif_capture.c | 3 +-- drivers/media/platform/video-mux.c | 2 +- drivers/media/platform/xilinx/xilinx-vipp.c | 2 +- 14 files changed, 16 insertions(+), 18 deletions(-)drivers/media/platform/atmel/atmel-isi.c +0
-0
drivers/media/platform/atmel/atmel-isi.c static int atmel_isi_parse_dt(struct atmel_isi *isi, · line 834
Quoted 5 lines
drivers/media/platform/atmel/atmel-isi.c +1
-1@@ -831,7 +831,7 @@ static int atmel_isi_parse_dt(struct atmel_isi *isi, isi->pdata.full_mode =1 ; isi->pdata.frate =ISI_CFG1_FRATE_CAPTURE_ALL ; - np =of_graph_get_next_endpoint (np,NULL ); + np =of_graph_get_next_device_endpoint (np,NULL );
Same comment on using of_graph_get_endpoint_by_regs().
Quoted 30 lines
drivers/media/platform/atmel/atmel-isi.c +1
-1if (!np) {dev_err (&pdev->dev,"Could not find the endpoint\n" );return -EINVAL ;@@ -1155,7 +1155,7 @@ static int isi_graph_init(struct atmel_isi *isi)struct device_node *ep;int ret; - ep =of_graph_get_next_endpoint (isi->dev->of_node,NULL ); + ep =of_graph_get_next_device_endpoint (isi->dev->of_node,NULL );if (!ep)return -EINVAL ;drivers/media/platform/intel/pxa_camera.c +1
-1@@ -2207,7 +2207,7 @@ static int pxa_camera_pdata_from_dt(struct device *dev, pcdev->mclk = mclk_rate; } - np =of_graph_get_next_endpoint (np,NULL ); + np =of_graph_get_next_device_endpoint (np,NULL );if (!np) {dev_err (dev,"could not find endpoint\n" );return -EINVAL ;drivers/media/platform/microchip/microchip-sama5d2-isc.c +0
-0
drivers/media/platform/microchip/microchip-sama5d2-isc.c static int isc_parse_dt(struct device *dev, struct isc_device *isc) · line 366
Quoted 5 lines
drivers/media/platform/microchip/microchip-sama5d2-isc.c +1
-1@@ -363,7 +363,7 @@ static int isc_parse_dt(struct device *dev, struct isc_device *isc)while (1 ) {struct v4l2_fwnode_endpoint v4l2_epn = { .bus_type =0 }; - epn =of_graph_get_next_endpoint (np, epn); + epn =of_graph_get_next_device_endpoint (np, epn);
Looks like this should use the iterator?
Quoted 149 lines
drivers/media/platform/microchip/microchip-sama5d2-isc.c +0
-0if (!epn)return 0 ;drivers/media/platform/microchip/microchip-sama7g5-isc.c +1
-1@@ -349,7 +349,7 @@ static int xisc_parse_dt(struct device *dev, struct isc_device *isc)while (1 ) {struct v4l2_fwnode_endpoint v4l2_epn = { .bus_type =0 }; - epn =of_graph_get_next_endpoint (np, epn); + epn =of_graph_get_next_device_endpoint (np, epn);if (!epn)return 0 ;drivers/media/platform/qcom/camss/camss.c +1
-1@@ -1136,7 +1136,7 @@ static int camss_of_parse_ports(struct camss *camss)struct device_node *remote =NULL ;int ret, num_subdevs =0 ; -for_each_endpoint_of_node (dev->of_node, node) { +for_each_device_endpoint_of_node (dev->of_node, node) {struct camss_async_subdev *csd;if (!of_device_is_available (node))drivers/media/platform/renesas/renesas-ceu.c +1
-1@@ -1526,7 +1526,7 @@ static int ceu_parse_dt(struct ceu_device *ceudev)int num_ep;int ret; - num_ep =of_graph_get_endpoint_count (of); + num_ep =of_graph_get_device_endpoint_count (of);if (!num_ep)return -ENODEV ;drivers/media/platform/samsung/exynos4-is/fimc-is.c +1
-1@@ -175,7 +175,7 @@ static int fimc_is_parse_sensor_config(struct fimc_is *is, unsigned int index,return -EINVAL ; } - ep =of_graph_get_next_endpoint (node,NULL ); + ep =of_graph_get_next_device_endpoint (node,NULL );if (!ep)return -ENXIO ;drivers/media/platform/samsung/exynos4-is/mipi-csis.c +1
-1@@ -728,7 +728,7 @@ static int s5pcsis_parse_dt(struct platform_device *pdev, &state->max_num_lanes))return -EINVAL ; - node =of_graph_get_next_endpoint (node,NULL ); + node =of_graph_get_next_device_endpoint (node,NULL );if (!node) {dev_err (&pdev->dev,"No port node at %pOF\n" , pdev->dev.of_node);drivers/media/platform/st/stm32/stm32-dcmi.c +2
-2@@ -1856,7 +1856,7 @@ static int dcmi_graph_init(struct stm32_dcmi *dcmi)struct device_node *ep;int ret; - ep =of_graph_get_next_endpoint (dcmi->dev->of_node,NULL ); + ep =of_graph_get_next_device_endpoint (dcmi->dev->of_node,NULL );if (!ep) {dev_err (dcmi->dev,"Failed to get next endpoint\n" );return -EINVAL ;@@ -1915,7 +1915,7 @@ static int dcmi_probe(struct platform_device *pdev) "Could not get reset control\n");/* Get bus characteristics from devicetree */ - np =of_graph_get_next_endpoint (np,NULL ); + np =of_graph_get_next_device_endpoint (np,NULL );if (!np) {dev_err (&pdev->dev,"Could not find the endpoint\n" );return -ENODEV ;drivers/media/platform/ti/am437x/am437x-vpfe.c +1
-1@@ -2309,7 +2309,7 @@ vpfe_get_pdata(struct vpfe_device *vpfe)struct v4l2_fwnode_endpoint bus_cfg = { .bus_type =0 };struct device_node *rem; - endpoint =of_graph_get_next_endpoint (dev->of_node, endpoint); + endpoint =of_graph_get_next_device_endpoint (dev->of_node, endpoint);if (!endpoint)break ;drivers/media/platform/ti/davinci/vpif.c +1
-2@@ -465,8 +465,7 @@ static int vpif_probe(struct platform_device *pdev)* so their devices need to be registered manually here * for their legacy platform_drivers to work. */ - endpoint =of_graph_get_next_endpoint (pdev->dev.of_node, - endpoint); + endpoint =of_graph_get_next_device_endpoint (pdev->dev.of_node, endpoint);if (!endpoint)return 0 ;of_node_put (endpoint);drivers/media/platform/ti/davinci/vpif_capture.c +1
-2@@ -1521,8 +1521,7 @@ vpif_capture_get_pdata(struct platform_device *pdev,unsigned int flags;int err; - endpoint =of_graph_get_next_endpoint (pdev->dev.of_node, - endpoint); + endpoint =of_graph_get_next_device_endpoint (pdev->dev.of_node, endpoint);if (!endpoint)break ;drivers/media/platform/video-mux.c +1
-1@@ -408,7 +408,7 @@ static int video_mux_probe(struct platform_device *pdev)* The largest numbered port is the output port. It determines * total number of pads. */ -for_each_endpoint_of_node (np, ep) { +for_each_device_endpoint_of_node (np, ep) {struct of_endpoint endpoint;of_graph_parse_endpoint (ep, &endpoint);drivers/media/platform/xilinx/xilinx-vipp.c +0
-0
drivers/media/platform/xilinx/xilinx-vipp.c static int xvip_graph_build_dma(struct xvip_composite_device *xdev) · line 210
Quoted 5 lines
drivers/media/platform/xilinx/xilinx-vipp.c +1
-1@@ -207,7 +207,7 @@ static int xvip_graph_build_dma(struct xvip_composite_device *xdev)while (1 ) {/* Get the next endpoint and parse its link. */ - ep =of_graph_get_next_endpoint (node, ep); + ep =of_graph_get_next_device_endpoint (node, ep);
The rest of this file uses fwnode versions including the very next function. This should be fwnode_graph_get_next_endpoint(). But then it's a loop, so should be a loop iterator instead.
Rob
Kuninori Morimoto
maintainerPATCH v3 7/24 gpu: drm: switch to use of_graph_get_next_device_endpoint()
In reply to Kuninori Morimotoof_graph_get_next_endpoint() is now renamed to of_graph_get_next_device_endpoint(). Switch to it.
--- drivers/gpu/drm/armada/armada_drv.c | 2 +- drivers/gpu/drm/bridge/tc358767.c | 2 +- drivers/gpu/drm/drm_of.c | 6 +++--- drivers/gpu/drm/meson/meson_drv.c | 4 ++-- drivers/gpu/drm/msm/msm_drv.c | 2 +- drivers/gpu/drm/mxsfb/lcdif_drv.c | 2 +- drivers/gpu/drm/omapdrm/dss/base.c | 2 +- drivers/gpu/drm/panel/panel-raspberrypi-touchscreen.c | 2 +- drivers/gpu/drm/pl111/pl111_drv.c | 2 +- drivers/gpu/drm/renesas/rcar-du/rcar_du_kms.c | 2 +- drivers/gpu/drm/stm/ltdc.c | 4 ++-- drivers/gpu/drm/tiny/arcpgu.c | 2 +- 12 files changed, 16 insertions(+), 16 deletions(-)
drivers/gpu/drm/armada/armada_drv.c +1 -1
@@ -175,7 +175,7 @@ static void armada_add_endpoints(struct device *dev, {struct device_node *ep, *remote; -for_each_endpoint_of_node (dev_node, ep) { +for_each_device_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,
drivers/gpu/drm/bridge/tc358767.c +1 -1
@@ -2190,7 +2190,7 @@ static int tc_probe_bridge_endpoint(struct tc_data *tc)* DSI -> port@0 -> port@1 -> DPI :: [port@2 is not connected] */ -for_each_endpoint_of_node (dev->of_node, node) { +for_each_device_endpoint_of_node (dev->of_node, node) {of_graph_parse_endpoint (node, &endpoint);if (endpoint.port >2 ) {of_node_put (node);
drivers/gpu/drm/drm_of.c +3 -3
@@ -63,7 +63,7 @@ uint32_t drm_of_find_possible_crtcs(struct drm_device *dev,struct device_node *remote_port, *ep;uint32_t possible_crtcs =0 ; -for_each_endpoint_of_node (port, ep) { +for_each_device_endpoint_of_node (port, ep) { remote_port =of_graph_get_remote_port (ep);if (!remote_port) {of_node_put (ep);
@@ -203,7 +203,7 @@ int drm_of_encoder_active_endpoint(struct device_node *node,if (!node || !crtc)return -EINVAL ; -for_each_endpoint_of_node (node, ep) { +for_each_device_endpoint_of_node (node, ep) { port =of_graph_get_remote_port (ep);of_node_put (port);if (port == crtc->port) {
@@ -516,7 +516,7 @@ struct mipi_dsi_host *drm_of_get_dsi_bus(struct device *dev)/* * Get first endpoint child from device. */ - endpoint =of_graph_get_next_endpoint (dev->of_node,NULL ); + endpoint =of_graph_get_next_device_endpoint (dev->of_node,NULL );if (!endpoint)return ERR_PTR (-ENODEV );
drivers/gpu/drm/meson/meson_drv.c +2 -2
@@ -113,7 +113,7 @@ static bool meson_vpu_has_available_connectors(struct device *dev)struct device_node *ep, *remote;/* Parses each endpoint and check if remote exists */ -for_each_endpoint_of_node (dev->of_node, ep) { +for_each_device_endpoint_of_node (dev->of_node, ep) {/* If the endpoint node exists, consider it enabled */ remote =of_graph_get_remote_port (ep);if (remote) {
@@ -481,7 +481,7 @@ static int meson_drv_probe(struct platform_device *pdev)struct device_node *ep, *remote;int count =0 ; -for_each_endpoint_of_node (np, ep) { +for_each_device_endpoint_of_node (np, ep) { remote =of_graph_get_remote_port_parent (ep);if (!remote || !of_device_is_available (remote)) {of_node_put (remote);
drivers/gpu/drm/msm/msm_drv.c +1 -1
@@ -840,7 +840,7 @@ static int add_components_mdp(struct device *master_dev,struct device_node *np = master_dev->of_node;struct device_node *ep_node; -for_each_endpoint_of_node (np, ep_node) { +for_each_device_endpoint_of_node (np, ep_node) {struct device_node *intf;struct of_endpoint ep;int ret;
drivers/gpu/drm/mxsfb/lcdif_drv.c +1 -1
@@ -51,7 +51,7 @@ static int lcdif_attach_bridge(struct lcdif_drm_private *lcdif)struct drm_bridge *bridge;int ret; -for_each_endpoint_of_node (dev->of_node, ep) { +for_each_device_endpoint_of_node (dev->of_node, ep) {struct device_node *remote;struct of_endpoint of_ep;struct drm_encoder *encoder;
drivers/gpu/drm/omapdrm/dss/base.c +1 -1
@@ -243,7 +243,7 @@ static void omapdss_walk_device(struct device *dev, struct device_node *node,of_node_put (n); n =NULL ; -while ((n =of_graph_get_next_endpoint (node, n)) !=NULL ) { +while ((n =of_graph_get_next_device_endpoint (node, n)) !=NULL ) {struct device_node *pn =of_graph_get_remote_port_parent (n);if (!pn)
drivers/gpu/drm/panel/panel-raspberrypi-touchscreen.c +1 -1
@@ -400,7 +400,7 @@ static int rpi_touchscreen_probe(struct i2c_client *i2c)rpi_touchscreen_i2c_write (ts,REG_POWERON ,0 );/* Look up the DSI host. It needs to probe before we do. */ - endpoint =of_graph_get_next_endpoint (dev->of_node,NULL ); + endpoint =of_graph_get_next_device_endpoint (dev->of_node,NULL );if (!endpoint)return -ENODEV ;
drivers/gpu/drm/pl111/pl111_drv.c +1 -1
@@ -93,7 +93,7 @@ static int pl111_modeset_init(struct drm_device *dev) mode_config->max_height =768 ; i =0 ; -for_each_endpoint_of_node (np, remote) { +for_each_device_endpoint_of_node (np, remote) {struct drm_panel *tmp_panel;struct drm_bridge *tmp_bridge;
drivers/gpu/drm/renesas/rcar-du/rcar_du_kms.c +1 -1
@@ -609,7 +609,7 @@ static int rcar_du_encoders_init(struct rcar_du_device *rcdu)* Iterate over the endpoints and create one encoder for each output * pipeline. */ -for_each_endpoint_of_node (np, ep_node) { +for_each_device_endpoint_of_node (np, ep_node) {enum rcar_du_output output;struct of_endpoint ep;unsigned int i;
drivers/gpu/drm/stm/ltdc.c +2 -2
@@ -1931,7 +1931,7 @@ int ltdc_load(struct drm_device *ddev)DRM_DEBUG_DRIVER ("\n" );/* Get number of endpoints */ - nb_endpoints =of_graph_get_endpoint_count (np); + nb_endpoints =of_graph_get_device_endpoint_count (np);if (!nb_endpoints)return -ENODEV ;
@@ -2087,7 +2087,7 @@ void ltdc_unload(struct drm_device *ddev)DRM_DEBUG_DRIVER ("\n" ); - nb_endpoints =of_graph_get_endpoint_count (dev->of_node); + nb_endpoints =of_graph_get_device_endpoint_count (dev->of_node);for (i =0 ; i < nb_endpoints; i++)drm_of_panel_bridge_remove (ddev->dev->of_node,0 , i);
drivers/gpu/drm/tiny/arcpgu.c +1 -1
@@ -288,7 +288,7 @@ static int arcpgu_load(struct arcpgu_drm_private *arcpgu)* There is only one output port inside each device. It is linked with * encoder endpoint. */ - endpoint_node =of_graph_get_next_endpoint (pdev->dev.of_node,NULL ); + endpoint_node =of_graph_get_next_device_endpoint (pdev->dev.of_node,NULL );if (endpoint_node) { encoder_node =of_graph_get_remote_port_parent (endpoint_node);of_node_put (endpoint_node);
Signature · 1 line
2.25.1
Re: [PATCH v3 07/24] gpu: drm: switch to use of_graph_get_next_device_endpoint()
Quoted 5 lines · Kuninori Morimoto
of_graph_get_next_endpoint()is now renamed toof_graph_get_next_device_endpoint(). Switch to it.Signed-off-by Kuninori Morimoto <[email protected]>
Quoted 15 lines
--- drivers/gpu/drm/armada/armada_drv.c | 2 +- drivers/gpu/drm/bridge/tc358767.c | 2 +- drivers/gpu/drm/drm_of.c | 6 +++--- drivers/gpu/drm/meson/meson_drv.c | 4 ++-- drivers/gpu/drm/msm/msm_drv.c | 2 +- drivers/gpu/drm/mxsfb/lcdif_drv.c | 2 +- drivers/gpu/drm/omapdrm/dss/base.c | 2 +- drivers/gpu/drm/panel/panel-raspberrypi-touchscreen.c | 2 +- drivers/gpu/drm/pl111/pl111_drv.c | 2 +- drivers/gpu/drm/renesas/rcar-du/rcar_du_kms.c | 2 +- drivers/gpu/drm/stm/ltdc.c | 4 ++-- drivers/gpu/drm/tiny/arcpgu.c | 2 +- 12 files changed, 16 insertions(+), 16 deletions(-)
Signature · 2 lines
With best wishes Dmitry
Kuninori Morimoto
maintainerPATCH v3 8/24 hwtracing: switch to use of_graph_get_next_device_endpoint()
In reply to Kuninori Morimotoof_graph_get_next_endpoint() is now renamed to of_graph_get_next_device_endpoint(). Switch to it.
--- drivers/hwtracing/coresight/coresight-platform.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/hwtracing/coresight/coresight-platform.c +2 -2
@@ -275,7 +275,7 @@ static int of_get_coresight_platform_data(struct device *dev,*/ if (!parent) {/* -* Avoid warnings in of_graph_get_next_endpoint() +* Avoid warnings in of_graph_get_next_device_endpoint() * if the device doesn't have any graph connections */ if (!of_graph_is_present (node))
@@ -286,7 +286,7 @@ static int of_get_coresight_platform_data(struct device *dev, }/* Iterate through each output port to discover topology */ -while ((ep =of_graph_get_next_endpoint (parent, ep))) { +while ((ep =of_graph_get_next_device_endpoint (parent, ep))) {/* * Legacy binding mixes input/output ports under the * same parent. So, skip the input ports if we are dealing
Signature · 1 line
2.25.1
Re: [PATCH v3 08/24] hwtracing: switch to use of_graph_get_next_device_endpoint()
Quoted 22 lines · Kuninori Morimoto
of_graph_get_next_endpoint()is now renamed toof_graph_get_next_device_endpoint(). Switch to it.Signed-off-by Kuninori Morimoto <[email protected]>--- drivers/hwtracing/coresight/coresight-platform.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)drivers/hwtracing/coresight/coresight-platform.c +1
-1@@ -275,7 +275,7 @@ static int of_get_coresight_platform_data(struct device *dev,*/ if (!parent) {/* -* Avoid warnings in of_graph_get_next_endpoint() +* Avoid warnings in of_graph_get_next_device_endpoint() * if the device doesn't have any graph connections */ if (!of_graph_is_present (node))
drivers/hwtracing/coresight/coresight-platform.c static int of_get_coresight_platform_data(struct device *dev, · line 292
Quoted 8 lines
drivers/hwtracing/coresight/coresight-platform.c +1
-1@@ -286,7 +286,7 @@ static int of_get_coresight_platform_data(struct device *dev, }/* Iterate through each output port to discover topology */ -while ((ep =of_graph_get_next_endpoint (parent, ep))) { +while ((ep =of_graph_get_next_device_endpoint (parent, ep))) {/* * Legacy binding mixes input/output ports under the * same parent. So, skip the input ports if we are dealing
Kuninori Morimoto
maintainerPATCH v3 9/24 staging: switch to use of_graph_get_next_device_endpoint()
In reply to Kuninori Morimotoof_graph_get_next_endpoint() is now renamed to of_graph_get_next_device_endpoint(). Switch to it.
--- drivers/staging/media/deprecated/atmel/atmel-sama5d2-isc.c | 2 +- drivers/staging/media/deprecated/atmel/atmel-sama7g5-isc.c | 2 +- drivers/staging/media/tegra-video/csi.c | 2 +- drivers/staging/media/tegra-video/vi.c | 2 +- drivers/staging/media/tegra-video/vip.c | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-)
drivers/staging/media/deprecated/atmel/atmel-sama5d2-isc.c +1 -1
@@ -343,7 +343,7 @@ static int isc_parse_dt(struct device *dev, struct isc_device *isc)while (1 ) {struct v4l2_fwnode_endpoint v4l2_epn = { .bus_type =0 }; - epn =of_graph_get_next_endpoint (np, epn); + epn =of_graph_get_next_device_endpoint (np, epn);if (!epn)return 0 ;
drivers/staging/media/deprecated/atmel/atmel-sama7g5-isc.c +1 -1
@@ -329,7 +329,7 @@ static int xisc_parse_dt(struct device *dev, struct isc_device *isc)while (1 ) {struct v4l2_fwnode_endpoint v4l2_epn = { .bus_type =0 }; - epn =of_graph_get_next_endpoint (np, epn); + epn =of_graph_get_next_device_endpoint (np, epn);if (!epn)return 0 ;
drivers/staging/media/tegra-video/csi.c +1 -1
@@ -571,7 +571,7 @@ static int tegra_csi_channels_alloc(struct tegra_csi *csi) goto err_node_put; } - num_pads =of_graph_get_endpoint_count (channel); + num_pads =of_graph_get_device_endpoint_count (channel);if (num_pads ==TEGRA_CSI_PADS_NUM ) { ret =tegra_csi_channel_alloc (csi, channel, portno, lanes, num_pads);
drivers/staging/media/tegra-video/vi.c +1 -1
@@ -1704,7 +1704,7 @@ static int tegra_vi_graph_parse_one(struct tegra_vi_channel *chan,dev_dbg (vi->dev,"parsing node %pOF\n" ,to_of_node (fwnode));/* parse all the remote entities and put them into the list */ -for_each_endpoint_of_node (to_of_node (fwnode), node) { +for_each_device_endpoint_of_node (to_of_node (fwnode), node) { ep =of_fwnode_handle (node); remote =fwnode_graph_get_remote_port_parent (ep);if (!remote) {
drivers/staging/media/tegra-video/vip.c +1 -1
@@ -137,7 +137,7 @@ static int tegra_vip_channel_of_parse(struct tegra_vip *vip) goto err_node_put; } - num_pads =of_graph_get_endpoint_count (np); + num_pads =of_graph_get_device_endpoint_count (np);if (num_pads !=TEGRA_VIP_PADS_NUM ) { err = -EINVAL ;dev_err_probe (dev, err,"%pOF: need 2 pads, got %d\n" , np, num_pads);
Signature · 1 line
2.25.1
Kuninori Morimoto
maintainerPATCH v3 10/24 ASoC: switch to use of_graph_get_next_device_endpoint()
In reply to Kuninori Morimotoof_graph_get_next_endpoint() is now renamed to of_graph_get_next_device_endpoint(). Switch to it.
--- sound/soc/codecs/ak4613.c | 2 +- sound/soc/generic/audio-graph-card2.c | 2 +- sound/soc/generic/simple-card-utils.c | 6 +++--- sound/soc/generic/test-component.c | 4 ++-- sound/soc/sh/rcar/core.c | 4 ++-- 5 files changed, 9 insertions(+), 9 deletions(-)
sound/soc/codecs/ak4613.c +1 -1
@@ -870,7 +870,7 @@ static void ak4613_parse_of(struct ak4613_priv *priv,* TDM support is assuming it is probed via Audio-Graph-Card style here. * Default is SDTIx1 if it was probed via Simple-Audio-Card for now. */ - sdti_num =of_graph_get_endpoint_count (np); + sdti_num =of_graph_get_device_endpoint_count (np);if ((sdti_num >= SDTx_MAX) || (sdti_num <1 )) sdti_num =1 ;
sound/soc/generic/audio-graph-card2.c +1 -1
@@ -1104,7 +1104,7 @@ static int graph_counter(struct device_node *lnk)/* * CPU/Codec = N:M case has many endpoints. -* We can't use of_graph_get_endpoint_count() here +* We can't use of_graph_get_device_endpoint_count() here */ while (1 ) { port =of_get_next_child (ports, port);
sound/soc/generic/simple-card-utils.c +3 -3
@@ -1049,7 +1049,7 @@ static int graph_get_dai_id(struct device_node *ep)*/ i =0 ; id =-1 ; -for_each_endpoint_of_node (node, endpoint) { +for_each_device_endpoint_of_node (node, endpoint) {if (endpoint == ep) id = i; i++;
@@ -1093,7 +1093,7 @@ int graph_util_parse_dai(struct device *dev, struct device_node *ep,/* Get dai->name */ args.np = node; args.args[0 ] =graph_get_dai_id (ep); - args.args_count = (of_graph_get_endpoint_count (node) >1 ); + args.args_count = (of_graph_get_device_endpoint_count (node) >1 );/* * FIXME
@@ -1122,7 +1122,7 @@ int graph_util_parse_dai(struct device *dev, struct device_node *ep, parse_dai_end:if (is_single_link) - *is_single_link =of_graph_get_endpoint_count (node) ==1 ; + *is_single_link =of_graph_get_device_endpoint_count (node) ==1 ;return 0 ; }
sound/soc/generic/test-component.c +2 -2
@@ -538,7 +538,7 @@ static int test_driver_probe(struct platform_device *pdev)struct test_priv *priv;int num, ret, i; - num =of_graph_get_endpoint_count (node); + num =of_graph_get_device_endpoint_count (node);if (!num) {dev_err (dev,"no port exits\n" );return -EINVAL ;
@@ -600,7 +600,7 @@ static int test_driver_probe(struct platform_device *pdev) } i =0 ; -for_each_endpoint_of_node (node, ep) { +for_each_device_endpoint_of_node (node, ep) {snprintf (dname[i].name,TEST_NAME_LEN ,"%s.%d" , node->name, i); ddriv[i].name = dname[i].name;
sound/soc/sh/rcar/core.c +2 -2
@@ -1298,7 +1298,7 @@ static int rsnd_dai_of_node(struct rsnd_priv *priv, int *is_graph)if (!of_node_name_eq (ports,"ports" ) && !of_node_name_eq (ports,"port" ))continue ; - priv->component_dais[i] =of_graph_get_endpoint_count (ports); + priv->component_dais[i] =of_graph_get_device_endpoint_count (ports); nr += priv->component_dais[i]; i++;if (i >=RSND_MAX_COMPONENT ) {
@@ -1510,7 +1510,7 @@ static int rsnd_dai_probe(struct rsnd_priv *priv)if (!of_node_name_eq (ports,"ports" ) && !of_node_name_eq (ports,"port" ))continue ; -for_each_endpoint_of_node (ports, dai_np) { +for_each_device_endpoint_of_node (ports, dai_np) {__rsnd_dai_probe (priv, dai_np, dai_np,0 , dai_i);if (rsnd_is_gen3 (priv) ||rsnd_is_gen4 (priv)) { rdai =rsnd_rdai_get (priv, dai_i);
Signature · 1 line
2.25.1
Kuninori Morimoto
maintainerPATCH v3 11/24 of: remove of_graph_get_next_endpoint() define
In reply to Kuninori MorimotoAll driver are using new of_graph_get_next_device_endpoint(), remove of_graph_get_next_endpoint() macro.
--- include/linux/of_graph.h | 5 ----- 1 file changed, 5 deletions(-)
include/linux/of_graph.h +0 -5
@@ -26,11 +26,6 @@ struct of_endpoint {const struct device_node *local_node; }; -/* REMOVE ME */ -#define of_graph_get_next_endpoint (parent, previous) of_graph_get_next_device_endpoint(parent, previous) -#define for_each_endpoint_of_node (parent, child) for_each_device_endpoint_of_node(parent, child) -#define of_graph_get_endpoint_count (np) of_graph_get_device_endpoint_count(np) -/** * for_each_device_endpoint_of_node - iterate over every endpoint in a device node * @parent: parent device node containing ports and endpoints
Signature · 1 line
2.25.1
Kuninori Morimoto
maintainerPATCH v3 12/24 of: property: add port base loop
In reply to Kuninori MorimotoWe have endpoint base functions
- of_graph_get_next_device_endpoint()
- of_graph_get_device_endpoint_count()
- for_each_device_endpoint_of_node()
Here, for_each_device_endpoint_of_node() loop finds each endpoints
ports {
port@0 {
(1) endpoint {...};
};
port@1 {
(2) endpoint {...};
};
...
};In above case, for_each_device_endpoint_of_node() loop finds endpoint as (1) -> (2) -> ...
Basically, user/driver knows which port is used for what, but not in all cases. For example on flexible/generic driver case, how many ports are used is not fixed.
For example Sound Generic Card driver which is used from many venders can't know how many ports are used. Because the driver is very flexible/generic, it is impossible to know how many ports are used, it depends on each vender SoC and/or its used board.
And more, the port can have multi endpoints. For example Generic Sound Card case, it supports many type of connection between CPU / Codec, and some of them uses multi endpoint in one port.
Then, Generic Sound Card want to handle each connection via "port" instead of "endpoint".
But, it is very difficult to handle each "port" by for_each_device_endpoint_of_node(). Getting "port" by
using of_get_parent() from "endpoint" doesn't work. see below.
ports {
port@0 {
(1) endpoint@0 {...};
(2) endpoint@1 {...};
};
port@1 {
(3) endpoint {...};
};
...
};Add "port" base functions.
--- drivers/of/property.c | 56 ++++++++++++++++++++++++++++++++++++++++ include/linux/of_graph.h | 26 +++++++++++++++++++ 2 files changed, 82 insertions(+)
drivers/of/property.c +56 -0
@@ -631,6 +631,44 @@ struct device_node *of_graph_get_port_by_id(struct device_node *parent, u32 id) }EXPORT_SYMBOL (of_graph_get_port_by_id); +/** +* of_graph_get_next_port() - get next port node. +* @parent: pointer to the parent device node +* @port: current port node, or NULL to get first +* +* Return: A 'port' node pointer with refcount incremented. Refcount +* of the passed @prev node is decremented. +*/ +struct device_node *of_graph_get_next_port (const struct device_node *parent, +struct device_node *port) +{ +if (!parent) +return NULL ; + +if (!port) { +struct device_node *node; +struct device_node *port; + + node =of_get_child_by_name (parent,"ports" ); +if (node) + parent = node; + + port =of_get_child_by_name (parent,"port" ); +of_node_put (node); + +return port; + } + +do { + port =of_get_next_child (parent, port); +if (!port) +break ; + }while (!of_node_name_eq (port,"port" )); + +return port; +} +EXPORT_SYMBOL (of_graph_get_next_port); +/** * of_graph_get_next_device_endpoint() - get next endpoint node. If it reached to end of the port, * it gets next endpoint from next port.
@@ -831,6 +869,24 @@ unsigned int of_graph_get_device_endpoint_count(const struct device_node *np) }EXPORT_SYMBOL (of_graph_get_device_endpoint_count); +/** +* of_graph_get_port_count() - get count of port +* @np: pointer to the parent device node +* +* Return: count of port of this device node +*/ +unsigned int of_graph_get_port_count (const struct device_node *np) +{ +struct device_node *port; +int num =0 ; + +for_each_port_of_node (np, port) + num++; + +return num; +} +EXPORT_SYMBOL (of_graph_get_port_count); +/** * of_graph_get_remote_node() - get remote parent device_node for given port/endpoint * @node: pointer to parent device_node containing graph port/endpoint
include/linux/of_graph.h +26 -0
@@ -37,14 +37,28 @@ struct of_endpoint {for (child =of_graph_get_next_device_endpoint (parent,NULL ); child !=NULL ; \ child =of_graph_get_next_device_endpoint (parent, child)) +/** +* for_each_port_of_node - iterate over every port in a device node +* @parent: parent device node containing ports/port +* @child: loop variable pointing to the current port node +* +* When breaking out of the loop, of_node_put(child) has to be called manually. + */ +#define for_each_port_of_node (parent, child) \ + for (child = of_graph_get_next_port(parent, NULL); child != NULL; \ + child = of_graph_get_next_port(parent, child)) +#ifdef CONFIG_OF bool of_graph_is_present (const struct device_node *node);int of_graph_parse_endpoint (const struct device_node *node,struct of_endpoint *endpoint);unsigned int of_graph_get_device_endpoint_count (const struct device_node *np); +unsigned int of_graph_get_port_count (const struct device_node *np);struct device_node *of_graph_get_port_by_id (struct device_node *node,u32 id);struct device_node *of_graph_get_next_device_endpoint (const struct device_node *parent,struct device_node *previous); +struct device_node *of_graph_get_next_port (const struct device_node *parent, +struct device_node *previous);struct device_node *of_graph_get_endpoint_by_regs (const struct device_node *parent,int port_reg,int reg); struct device_node *of_graph_get_remote_endpoint(
@@ -73,6 +87,11 @@ static inline unsigned int of_graph_get_device_endpoint_count(const struct devicreturn 0 ; } +static inline unsigned int of_graph_get_port_count (const struct device_node *np) +{ +return 0 ; +} +static inline struct device_node *of_graph_get_port_by_id (struct device_node *node,u32 id) {
@@ -86,6 +105,13 @@ static inline struct device_node *of_graph_get_next_device_endpoint(return NULL ; } +static inline struct device_node *of_graph_get_next_port ( +const struct device_node *parent, +struct device_node *previous) +{ +return NULL ; +} +static inline struct device_node *of_graph_get_endpoint_by_regs (const struct device_node *parent,int port_reg,int reg) {
Signature · 1 line
2.25.1
Kuninori Morimoto
maintainerPATCH v3 13/24 of: property: use of_graph_get_next_port() on of_graph_get_next_endpoint()
In reply to Kuninori MorimotoWe have of_graph_get_next_port(), use it on of_graph_get_next_endpoint().
--- drivers/of/property.c | 18 ++++-------------- 1 file changed, 4 insertions(+), 14 deletions(-)
drivers/of/property.c +4 -14
@@ -694,15 +694,7 @@ struct device_node *of_graph_get_next_device_endpoint(const struct device_node ** parent port node. */ if (!prev) { -struct device_node *node; - - node =of_get_child_by_name (parent,"ports" ); -if (node) - parent = node; - - port =of_get_child_by_name (parent,"port" ); -of_node_put (node); - + port =of_graph_get_next_port (parent,NULL );if (!port) {pr_err ("graph: no port node found in %pOF\n" , parent);return NULL ;
@@ -729,11 +721,9 @@ struct device_node *of_graph_get_next_device_endpoint(const struct device_node */* No more endpoints under this port, try the next one. */ prev =NULL ; -do { - port =of_get_next_child (parent, port); -if (!port) -return NULL ; - }while (!of_node_name_eq (port,"port" )); + port =of_graph_get_next_port (parent, port); +if (!port) +return NULL ; } }EXPORT_SYMBOL (of_graph_get_next_device_endpoint);
Signature · 1 line
2.25.1
Kuninori Morimoto
maintainerPATCH v3 14/24 of: property: add of_graph_get_next_endpoint()
In reply to Kuninori MorimotoWe already have of_graph_get_next_device_endpoint(), but it is not intuitive to use.
(X) node {
(Y) ports {
port@0 { endpoint { remote-endpoint = ...; };};
(A1) port@1 { endpoint { remote-endpoint = ...; };
(A2) endpoint { remote-endpoint = ...; };};
(B) port@2 { endpoint { remote-endpoint = ...; };};
};
};For example, if I want to handle port@1's 2 endpoints (= A1, A2), I want to use like below
A1 = of_graph_get_next_device_endpoint(port1, NULL); A2 = of_graph_get_next_device_endpoint(port1, A1);
But 1st one will be error, because of_graph_get_next_device_endpoint() requested "parent" means "node" (X) or "ports" (Y), not "port". Below are OK
/* These will be node/ports/port@0/endpoint */ of_graph_get_next_device_endpoint(node, NULL); of_graph_get_next_device_endpoint(ports, NULL);
In other words, we can't handle A1/A2 directly via of_graph_get_next_device_endpoint() so far.
There is another non intuitive behavior on of_graph_get_next_device_endpoint(). In case of if I could get A1 pointer for some way, and if I want to handle port@1 things, I would like use it like below
/*
* "ep" is now A1, and handle port1 things here,
* but we don't know how many endpoints port1 has.
*
* Because "ep" is non NULL, we can use port1
* as of_graph_get_next_device_endpoint(port1, xxx)
*/
do {
/* do something for port1 specific things here */
} while (ep = of_graph_get_next_device_endpoint(port1, ep))But it also not worked as I expected.
I expect it will be A1 -> A2 -> NULL,
but it will be A1 -> A2 -> B, becauseof_graph_get_next_device_endpoint() will fetch endpoint beyond the port.
It is not useful on generic driver like Generic Sound Card. It uses of_get_next_child() instead for now, but it is not intuitive, and not check node name (= "endpoint").
To handle endpoint more intuitive, create of_graph_get_next_endpoint()
of_graph_get_next_endpoint(port1, NULL); // A1 of_graph_get_next_endpoint(port1, A1); // A2 of_graph_get_next_endpoint(port1, A2); // NULL
--- drivers/of/property.c | 24 +++++++++++++++++++++++- include/linux/of_graph.h | 9 +++++++++ 2 files changed, 32 insertions(+), 1 deletion(-)
drivers/of/property.c +23 -1
@@ -669,6 +669,28 @@ struct device_node *of_graph_get_next_port(const struct device_node *parent, }EXPORT_SYMBOL (of_graph_get_next_port); +/** +* of_graph_get_next_endpoint() - get next endpoint node. If it reached to end of the port, +* it will return NULL. +* @port: pointer to the target port node +* @endpoint: current endpoint node, or NULL to get first +* +* Return: An 'endpoint' node pointer with refcount incremented. Refcount +* of the passed @prev node is decremented. +*/ +struct device_node *of_graph_get_next_endpoint (const struct device_node *port, +struct device_node *endpoint) +{ +do { + endpoint =of_get_next_child (port, endpoint); +if (!endpoint) +break ; + }while (!of_node_name_eq (endpoint,"endpoint" )); + +return endpoint; +} +EXPORT_SYMBOL (of_graph_get_next_endpoint); +/** * of_graph_get_next_device_endpoint() - get next endpoint node. If it reached to end of the port, * it gets next endpoint from next port.
@@ -712,7 +734,7 @@ struct device_node *of_graph_get_next_device_endpoint(const struct device_node ** getting the next child. If the previous endpoint is NULL this * will return the first child. */ - endpoint =of_get_next_child (port, prev); + endpoint =of_graph_get_next_endpoint (port, prev);if (endpoint) {of_node_put (port);return endpoint;
include/linux/of_graph.h +9 -0
@@ -57,6 +57,8 @@ unsigned int of_graph_get_port_count(const struct device_node *np);struct device_node *of_graph_get_port_by_id (struct device_node *node,u32 id);struct device_node *of_graph_get_next_device_endpoint (const struct device_node *parent,struct device_node *previous); +struct device_node *of_graph_get_next_endpoint (const struct device_node *port, +struct device_node *prev);struct device_node *of_graph_get_next_port (const struct device_node *parent,struct device_node *previous); struct device_node *of_graph_get_endpoint_by_regs(
@@ -105,6 +107,13 @@ static inline struct device_node *of_graph_get_next_device_endpoint(return NULL ; } +static inline struct device_node *of_graph_get_next_endpoint ( +const struct device_node *parent, +struct device_node *previous) +{ +return NULL ; +} +static inline struct device_node *of_graph_get_next_port (const struct device_node *parent,struct device_node *previous)
Signature · 1 line
2.25.1
Luca Ceresoli
maintainerRe: [PATCH v3 14/24] of: property: add of_graph_get_next_endpoint()
Hello Kuninori Morimoto,
Quoted 5 lines · On Wed, 31 Jan 2024 05:06:36 +0000 Kuninori Morimoto…
To handle endpoint more intuitive, create
of_graph_get_next_endpoint()of_graph_get_next_endpoint(port1, NULL); // A1 of_graph_get_next_endpoint(port1, A1); // A2 of_graph_get_next_endpoint(port1, A2); // NULL
The idea looks good. My only concern is about reusing the of_graph_get_next_endpoint() name after having removed the old, different function having the same name. This can be confusing in the first place to who is used to the old function, and also to anybody rebasing their patches on top of a new kernel to find their code behaving differently.
Also, as now we'd have two similar variants of this function, it would be good if each of them were having a name that clearly identifies in which way they differ from the other.
So a better name for this function would probably be of_graph_get_next_port_endpoint() I guess, to clearly differentiate from of_graph_get_next_device_endpoint().
Luca
Signature · 3 lines
Luca Ceresoli, Bootlin Embedded Linux and Kernel engineering https://bootlin.com
Kuninori Morimoto
maintainerRe: [PATCH v3 14/24] of: property: add of_graph_get_next_endpoint()
Hi Luca
Thank you for your review
Quoted 13 lines
Quoted 5 lines
To handle endpoint more intuitive, create
of_graph_get_next_endpoint()of_graph_get_next_endpoint(port1, NULL); // A1 of_graph_get_next_endpoint(port1, A1); // A2 of_graph_get_next_endpoint(port1, A2); // NULLThe idea looks good. My only concern is about reusing the
of_graph_get_next_endpoint()name after having removed the old, different function having the same name. This can be confusing in the first place to who is used to the old function, and also to anybody rebasing their patches on top of a new kernel to find their code behaving differently.
Quoted 7 lines
Also, as now we'd have two similar variants of this function, it would be good if each of them were having a name that clearly identifies in which way they differ from the other.
So a better name for this function would probably be
of_graph_get_next_port_endpoint()I guess, to clearly differentiate fromof_graph_get_next_device_endpoint().
Yes, Indeed, Thank you for pointing it !
I will update it on v4
Thank you for your help !!
Best regards
---
Renesas Electronics
Ph.D. Kuninori Morimoto
Kuninori Morimoto
maintainerPATCH v3 15/24 drm: omapdrm: use of_graph_get_next_endpoint()
In reply to Kuninori MorimotoWe can now use of_graph_get_next_endpoint(), let's use it.
--- drivers/gpu/drm/omapdrm/dss/dpi.c | 2 +- drivers/gpu/drm/omapdrm/dss/sdi.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/omapdrm/dss/dpi.c +1 -1
@@ -709,7 +709,7 @@ int dpi_init_port(struct dss_device *dss, struct platform_device *pdev,if (!dpi)return -ENOMEM ; - ep =of_get_next_child (port,NULL ); + ep =of_graph_get_next_endpoint (port,NULL );if (!ep)return 0 ;
drivers/gpu/drm/omapdrm/dss/sdi.c +1 -1
@@ -346,7 +346,7 @@ int sdi_init_port(struct dss_device *dss, struct platform_device *pdev,if (!sdi)return -ENOMEM ; - ep =of_get_next_child (port,NULL ); + ep =of_graph_get_next_endpoint (port,NULL );if (!ep) { r =0 ; goto err_free;
Signature · 1 line
2.25.1
Kuninori Morimoto
maintainerPATCH v3 16/24 media: xilinx-tpg: use of_graph_get_next_endpoint()
In reply to Kuninori MorimotoWe can now use of_graph_get_next_endpoint(), let's use it.
--- drivers/media/platform/xilinx/xilinx-tpg.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/media/platform/xilinx/xilinx-tpg.c +2 -1
@@ -13,6 +13,7 @@#include <linux/gpio/consumer.h> #include <linux/module.h> #include <linux/of.h> +#include <linux/of_graph.h> #include <linux/platform_device.h> #include <linux/xilinx-v4l2-controls.h>
@@ -745,7 +746,7 @@ static int xtpg_parse_of(struct xtpg_device *xtpg) }if (nports ==0 ) { - endpoint =of_get_next_child (port,NULL ); + endpoint =of_graph_get_next_endpoint (port,NULL );if (endpoint) has_endpoint = true;of_node_put (endpoint);
Signature · 1 line
2.25.1
Kuninori Morimoto
maintainerPATCH v3 17/24 ASoC: audio-graph-card: use of_graph_get_next_endpoint()
In reply to Kuninori MorimotoWe can now use of_graph_get_next_endpoint(), let's use it.
--- sound/soc/generic/audio-graph-card.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
sound/soc/generic/audio-graph-card.c +1 -1
@@ -344,7 +344,7 @@ static int __graph_for_each_link(struct simple_util_priv *priv,/* loop for all CPU endpoint */ while (1 ) { - cpu_ep =of_get_next_child (cpu_port, cpu_ep); + cpu_ep =of_graph_get_next_endpoint (cpu_port, cpu_ep);if (!cpu_ep)break ;
Signature · 1 line
2.25.1
Kuninori Morimoto
maintainerPATCH v3 18/24 ASoC: audio-graph-card2: use of_graph_get_next_port()
In reply to Kuninori MorimotoNow we can use of_graph_get_next_port() for port parsing. Use it on audio-graph-card2 driver.
--- sound/soc/generic/audio-graph-card2.c | 29 ++++++++------------------- 1 file changed, 8 insertions(+), 21 deletions(-)
sound/soc/generic/audio-graph-card2.c +8 -21
@@ -339,12 +339,7 @@ static struct device_node *graph_get_next_multi_ep(struct device_node **port)* port@1 { rep1 }; * }; */ -do { - *port =of_get_next_child (ports, *port); -if (!*port) -break ; - }while (!of_node_name_eq (*port,"port" )); - + *port =of_graph_get_next_port (ports, *port);if (*port) { ep =port_to_endpoint (*port); rep =of_graph_get_remote_endpoint (ep);
@@ -539,7 +534,8 @@ static int graph_parse_node_multi_nm(struct snd_soc_dai_link *dai_link,*/ struct device_node *mcpu_ep =port_to_endpoint (mcpu_port);struct device_node *mcpu_ep_n = mcpu_ep; -struct device_node *mcpu_port_top =of_get_next_child (of_get_parent (mcpu_port),NULL ); +struct device_node *mcpu_ports =of_get_parent (mcpu_port); +struct device_node *mcpu_port_top =of_graph_get_next_port (mcpu_ports,NULL );struct device_node *mcpu_ep_top =port_to_endpoint (mcpu_port_top);struct device_node *mcodec_ep_top =of_graph_get_remote_endpoint (mcpu_ep_top);struct device_node *mcodec_port_top =of_get_parent (mcodec_ep_top);
@@ -572,12 +568,12 @@ static int graph_parse_node_multi_nm(struct snd_soc_dai_link *dai_link, goto mcpu_err; codec_idx =0 ; - mcodec_port_i =of_get_next_child (mcodec_ports,NULL ); + mcodec_port_i =of_graph_get_next_port (mcodec_ports,NULL );while (1 ) {if (codec_idx > dai_link->num_codecs) goto mcodec_err; - mcodec_port_i =of_get_next_child (mcodec_ports, mcodec_port_i); + mcodec_port_i =of_graph_get_next_port (mcodec_ports, mcodec_port_i);if (!mcodec_port_i) goto mcodec_err;
@@ -967,7 +963,7 @@ int audio_graph2_link_c2c(struct simple_util_priv *priv,of_node_get (lnk); port0 = lnk; ports =of_get_parent (port0); - port1 =of_get_next_child (ports, lnk); + port1 =of_graph_get_next_port (ports, port0);/* * Card2 can use original Codec2Codec settings if DT has.
@@ -1099,21 +1095,12 @@ static int graph_counter(struct device_node *lnk)*/ if (graph_lnk_is_multi (lnk)) {struct device_node *ports =of_get_parent (lnk); -struct device_node *port =NULL ; -int cnt =0 ;/* * CPU/Codec = N:M case has many endpoints. * We can't use of_graph_get_device_endpoint_count() here */ -while (1 ) { - port =of_get_next_child (ports, port); -if (!port) -break ; - cnt++; - } - -return cnt -1 ; +return of_graph_get_port_count (ports) -1 ; }/* * Single CPU / Codec
@@ -1197,7 +1184,7 @@ static int graph_count_c2c(struct simple_util_priv *priv, {struct device_node *ports =of_get_parent (lnk);struct device_node *port0 = lnk; -struct device_node *port1 =of_get_next_child (ports, lnk); +struct device_node *port1 =of_graph_get_next_port (ports, port0);struct device_node *ep0 =port_to_endpoint (port0);struct device_node *ep1 =port_to_endpoint (port1);struct device_node *codec0 =of_graph_get_remote_port (ep0);
Signature · 1 line
2.25.1
Kuninori Morimoto
maintainerPATCH v3 19/24 ASoC: audio-graph-card2: use of_graph_get_next_endpoint()
In reply to Kuninori MorimotoWe can now use of_graph_get_next_endpoint(), let's use it.
--- sound/soc/generic/audio-graph-card2.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
sound/soc/generic/audio-graph-card2.c +1 -1
@@ -555,7 +555,7 @@ static int graph_parse_node_multi_nm(struct snd_soc_dai_link *dai_link,if (*nm_idx > nm_max)break ; - mcpu_ep_n =of_get_next_child (mcpu_port, mcpu_ep_n); + mcpu_ep_n =of_graph_get_next_endpoint (mcpu_port, mcpu_ep_n);if (!mcpu_ep_n) { ret =0 ;break ;
Signature · 1 line
2.25.1
Kuninori Morimoto
maintainerPATCH v3 20/24 ASoC: test-component: use for_each_port_of_node()
In reply to Kuninori MorimotoCurrent test-component.c is using for_each_endpoint_of_node() for parsing, but it should use "port" base loop instead of "endpoint", because properties are "port" base instead of "endpoint".
--- sound/soc/generic/test-component.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
sound/soc/generic/test-component.c +1 -1
@@ -600,7 +600,7 @@ static int test_driver_probe(struct platform_device *pdev) } i =0 ; -for_each_device_endpoint_of_node (node, ep) { +for_each_port_of_node (node, ep) {snprintf (dname[i].name,TEST_NAME_LEN ,"%s.%d" , node->name, i); ddriv[i].name = dname[i].name;
Signature · 1 line
2.25.1
Kuninori Morimoto
maintainerPATCH v3 21/24 fbdev: omapfb: use of_graph_get_remote_port()
In reply to Kuninori MorimotoWe already have of_graph_get_remote_port(), Let's use it.
--- drivers/video/fbdev/omap2/omapfb/dss/dss-of.c | 15 +-------------- 1 file changed, 1 insertion(+), 14 deletions(-)
drivers/video/fbdev/omap2/omapfb/dss/dss-of.c +1 -14
@@ -117,19 +117,6 @@ u32 dss_of_port_get_port_number(struct device_node *port)return reg; } -static struct device_node *omapdss_of_get_remote_port (const struct device_node *node) -{ -struct device_node *np; - - np =of_graph_get_remote_endpoint (node); -if (!np) -return NULL ; - - np =of_get_next_parent (np); - -return np; -} -struct device_node *omapdss_of_get_first_endpoint (const struct device_node *parent) {
@@ -159,7 +146,7 @@ omapdss_of_find_source_for_first_ep(struct device_node *node)if (!ep)return ERR_PTR (-EINVAL ); - src_port =omapdss_of_get_remote_port (ep); + src_port =of_graph_get_remote_port (ep);if (!src_port) {of_node_put (ep);return ERR_PTR (-EINVAL );
Signature · 1 line
2.25.1
Kuninori Morimoto
maintainerPATCH v3 22/24 fbdev: omapfb: use of_graph_get_next_port()
In reply to Kuninori MorimotoNow we can use of_graph_get_next_port() for port parsing. Use it on omapfb.
--- drivers/video/fbdev/omap2/omapfb/dss/dss-of.c | 48 +------------------ drivers/video/fbdev/omap2/omapfb/dss/dss.c | 9 ++-- include/video/omapfb_dss.h | 4 -- 3 files changed, 6 insertions(+), 55 deletions(-)
drivers/video/fbdev/omap2/omapfb/dss/dss-of.c +1 -47
@@ -15,52 +15,6 @@#include "dss.h" -struct device_node * -omapdss_of_get_next_port (const struct device_node *parent, -struct device_node *prev) -{ -struct device_node *port =NULL ; - -if (!parent) -return NULL ; - -if (!prev) { -struct device_node *ports; -/* -* It's the first call, we have to find a port subnode -* within this node or within an optional 'ports' node. -*/ - ports =of_get_child_by_name (parent,"ports" ); -if (ports) - parent = ports; - - port =of_get_child_by_name (parent,"port" ); - -/* release the 'ports' node */ -of_node_put (ports); - }else { -struct device_node *ports; - - ports =of_get_parent (prev); -if (!ports) -return NULL ; - -do { - port =of_get_next_child (ports, prev); -if (!port) { -of_node_put (ports); -return NULL ; - } - prev = port; - }while (!of_node_name_eq (port,"port" )); - -of_node_put (ports); - } - -return port; -} -EXPORT_SYMBOL_GPL (omapdss_of_get_next_port); -struct device_node *omapdss_of_get_next_endpoint (const struct device_node *parent,struct device_node *prev)
@@ -122,7 +76,7 @@ omapdss_of_get_first_endpoint(const struct device_node *parent) {struct device_node *port, *ep; - port =omapdss_of_get_next_port (parent,NULL ); + port =of_graph_get_next_port (parent,NULL );if (!port)return NULL ;
drivers/video/fbdev/omap2/omapfb/dss/dss.c +5 -4
@@ -26,6 +26,7 @@#include <linux/mfd/syscon.h> #include <linux/regmap.h> #include <linux/of.h> +#include <linux/of_graph.h> #include <linux/regulator/consumer.h> #include <linux/suspend.h> #include <linux/component.h>
@@ -922,7 +923,7 @@ static int dss_init_ports(struct platform_device *pdev)if (parent ==NULL )return 0 ; - port =omapdss_of_get_next_port (parent,NULL ); + port =of_graph_get_next_port (parent,NULL );if (!port)return 0 ;
@@ -953,7 +954,7 @@ static int dss_init_ports(struct platform_device *pdev)break ; } }while (!ret && - (port =omapdss_of_get_next_port (parent, port)) !=NULL ); + (port =of_graph_get_next_port (parent, port)) !=NULL );if (ret)dss_uninit_ports (pdev);
@@ -969,7 +970,7 @@ static void dss_uninit_ports(struct platform_device *pdev)if (parent ==NULL )return ; - port =omapdss_of_get_next_port (parent,NULL ); + port =of_graph_get_next_port (parent,NULL );if (!port)return ;
@@ -1000,7 +1001,7 @@ static void dss_uninit_ports(struct platform_device *pdev)default :break ; } - }while ((port =omapdss_of_get_next_port (parent, port)) !=NULL ); + }while ((port =of_graph_get_next_port (parent, port)) !=NULL ); }static int dss_video_pll_probe (struct platform_device *pdev)
include/video/omapfb_dss.h +0 -4
@@ -811,10 +811,6 @@ static inline bool omapdss_device_is_enabled(struct omap_dss_device *dssdev)return dssdev->state ==OMAP_DSS_DISPLAY_ACTIVE ; } -struct device_node * -omapdss_of_get_next_port (const struct device_node *parent, -struct device_node *prev); -struct device_node *omapdss_of_get_next_endpoint (const struct device_node *parent,struct device_node *prev);
Signature · 1 line
2.25.1
Kuninori Morimoto
maintainerPATCH v3 23/24 fbdev: omapfb: use of_graph_get_next_endpoint()
In reply to Kuninori MorimotoWe can now use of_graph_get_next_endpoint(), let's use it.
--- drivers/video/fbdev/omap2/omapfb/dss/dpi.c | 3 ++- drivers/video/fbdev/omap2/omapfb/dss/dss-of.c | 22 +------------------ drivers/video/fbdev/omap2/omapfb/dss/sdi.c | 3 ++- include/video/omapfb_dss.h | 4 ---- 4 files changed, 5 insertions(+), 27 deletions(-)
drivers/video/fbdev/omap2/omapfb/dss/dpi.c +2 -1
@@ -20,6 +20,7 @@#include <linux/regulator/consumer.h> #include <linux/string.h> #include <linux/of.h> +#include <linux/of_graph.h> #include <linux/clk.h> #include <linux/component.h>
@@ -845,7 +846,7 @@ int dpi_init_port(struct platform_device *pdev, struct device_node *port)if (!dpi)return -ENOMEM ; - ep =omapdss_of_get_next_endpoint (port,NULL ); + ep =of_graph_get_next_endpoint (port,NULL );if (!ep)return 0 ;
drivers/video/fbdev/omap2/omapfb/dss/dss-of.c +1 -21
@@ -15,26 +15,6 @@#include "dss.h" -struct device_node * -omapdss_of_get_next_endpoint (const struct device_node *parent, -struct device_node *prev) -{ -struct device_node *ep =NULL ; - -if (!parent) -return NULL ; - -do { - ep =of_get_next_child (parent, prev); -if (!ep) -return NULL ; - prev = ep; - }while (!of_node_name_eq (ep,"endpoint" )); - -return ep; -} -EXPORT_SYMBOL_GPL (omapdss_of_get_next_endpoint); -struct device_node *dss_of_port_get_parent_device (struct device_node *port) {struct device_node *np;
@@ -81,7 +61,7 @@ omapdss_of_get_first_endpoint(const struct device_node *parent)if (!port)return NULL ; - ep =omapdss_of_get_next_endpoint (port,NULL ); + ep =of_graph_get_next_endpoint (port,NULL );of_node_put (port);
drivers/video/fbdev/omap2/omapfb/dss/sdi.c +2 -1
@@ -16,6 +16,7 @@#include <linux/platform_device.h> #include <linux/string.h> #include <linux/of.h> +#include <linux/of_graph.h> #include <linux/component.h> #include <video/omapfb_dss.h>
@@ -405,7 +406,7 @@ int sdi_init_port(struct platform_device *pdev, struct device_node *port)u32 datapairs;int r; - ep =omapdss_of_get_next_endpoint (port,NULL ); + ep =of_graph_get_next_endpoint (port,NULL );if (!ep)return 0 ;
include/video/omapfb_dss.h +0 -4
@@ -811,10 +811,6 @@ static inline bool omapdss_device_is_enabled(struct omap_dss_device *dssdev)return dssdev->state ==OMAP_DSS_DISPLAY_ACTIVE ; } -struct device_node * -omapdss_of_get_next_endpoint (const struct device_node *parent, -struct device_node *prev); -struct device_node *omapdss_of_get_first_endpoint (const struct device_node *parent);
Signature · 1 line
2.25.1
Kuninori Morimoto
maintainerPATCH v3 24/24 fbdev: omapfb: use of_graph_get_next_device_endpoint()
In reply to Kuninori Morimotoomapdss_of_get_first_endpoint() is same as of_graph_get_next_device_endpoint(xxx, NULL). Replcase it.
--- drivers/video/fbdev/omap2/omapfb/dss/dsi.c | 3 ++- drivers/video/fbdev/omap2/omapfb/dss/dss-of.c | 20 +------------------ drivers/video/fbdev/omap2/omapfb/dss/hdmi4.c | 3 ++- drivers/video/fbdev/omap2/omapfb/dss/hdmi5.c | 3 ++- drivers/video/fbdev/omap2/omapfb/dss/venc.c | 3 ++- include/video/omapfb_dss.h | 3 --- 6 files changed, 9 insertions(+), 26 deletions(-)
drivers/video/fbdev/omap2/omapfb/dss/dsi.c +2 -1
@@ -28,6 +28,7 @@#include <linux/debugfs.h> #include <linux/pm_runtime.h> #include <linux/of.h> +#include <linux/of_graph.h> #include <linux/of_platform.h> #include <linux/component.h>
@@ -5079,7 +5080,7 @@ static int dsi_probe_of(struct platform_device *pdev)struct device_node *ep;struct omap_dsi_pin_config pin_cfg; - ep =omapdss_of_get_first_endpoint (node); + ep =of_graph_get_next_device_endpoint (node,NULL );if (!ep)return 0 ;
drivers/video/fbdev/omap2/omapfb/dss/dss-of.c +1 -19
@@ -51,24 +51,6 @@ u32 dss_of_port_get_port_number(struct device_node *port)return reg; } -struct device_node * -omapdss_of_get_first_endpoint (const struct device_node *parent) -{ -struct device_node *port, *ep; - - port =of_graph_get_next_port (parent,NULL ); - -if (!port) -return NULL ; - - ep =of_graph_get_next_endpoint (port,NULL ); - -of_node_put (port); - -return ep; -} -EXPORT_SYMBOL_GPL (omapdss_of_get_first_endpoint); -struct omap_dss_device *omapdss_of_find_source_for_first_ep (struct device_node *node) {
@@ -76,7 +58,7 @@ omapdss_of_find_source_for_first_ep(struct device_node *node)struct device_node *src_port;struct omap_dss_device *src; - ep =omapdss_of_get_first_endpoint (node); + ep =of_graph_get_next_device_endpoint (node,NULL );if (!ep)return ERR_PTR (-EINVAL );
drivers/video/fbdev/omap2/omapfb/dss/hdmi4.c +2 -1
@@ -20,6 +20,7 @@#include <linux/pm_runtime.h> #include <linux/clk.h> #include <linux/of.h> +#include <linux/of_graph.h> #include <linux/regulator/consumer.h> #include <linux/component.h> #include <video/omapfb_dss.h>
@@ -529,7 +530,7 @@ static int hdmi_probe_of(struct platform_device *pdev)struct device_node *ep;int r; - ep =omapdss_of_get_first_endpoint (node); + ep =of_graph_get_next_device_endpoint (node,NULL );if (!ep)return 0 ;
drivers/video/fbdev/omap2/omapfb/dss/hdmi5.c +2 -1
@@ -25,6 +25,7 @@#include <linux/pm_runtime.h> #include <linux/clk.h> #include <linux/of.h> +#include <linux/of_graph.h> #include <linux/regulator/consumer.h> #include <linux/component.h> #include <video/omapfb_dss.h>
@@ -561,7 +562,7 @@ static int hdmi_probe_of(struct platform_device *pdev)struct device_node *ep;int r; - ep =omapdss_of_get_first_endpoint (node); + ep =of_graph_get_next_device_endpoint (node,NULL );if (!ep)return 0 ;
drivers/video/fbdev/omap2/omapfb/dss/venc.c +2 -1
@@ -24,6 +24,7 @@#include <linux/regulator/consumer.h> #include <linux/pm_runtime.h> #include <linux/of.h> +#include <linux/of_graph.h> #include <linux/component.h> #include <video/omapfb_dss.h>
@@ -764,7 +765,7 @@ static int venc_probe_of(struct platform_device *pdev)u32 channels;int r; - ep =omapdss_of_get_first_endpoint (node); + ep =of_graph_get_next_device_endpoint (node,NULL );if (!ep)return 0 ;
include/video/omapfb_dss.h +0 -3
@@ -811,9 +811,6 @@ static inline bool omapdss_device_is_enabled(struct omap_dss_device *dssdev) return dssdev->state == OMAP_DSS_DISPLAY_ACTIVE; } -struct device_node * -omapdss_of_get_first_endpoint (const struct device_node *parent); -struct omap_dss_device *omapdss_of_find_source_for_first_ep (struct device_node *node);#else
Signature · 1 line
2.25.1