dt: remove of_alias_get_id() reference
Subsystems (2)
PATCH 1/1 dt: remove of_alias_get_id() reference
of_alias_get_id() is broken and being reverted. Remove the reference to it and replace with a single incrementing id number.
There is no risk of regression here on the imx driver since the imx change to use of_alias_get_id() is commit 22698aa2, "serial/imx: add device tree probe support" which is new for v3.1, and it won't get used unless CONFIG_OF is enabled and the board is booted using a device tree. A single incrementing integer is sufficient for now.
---
I'm about to ask Linus to pull this patch through the devicetree/merge branch along with the of_alias revert.
drivers/tty/serial/imx.c | 13 ++++--------- 1 files changed, 4 insertions(+), 9 deletions(-)
drivers/tty/serial/imx.c +4 -9
@@ -1286,22 +1286,17 @@ static int serial_imx_resume(struct platform_device *dev)static int serial_imx_probe_dt (struct imx_port *sport,struct platform_device *pdev) { +static int portnum =0 ;struct device_node *np = pdev->dev.of_node;const struct of_device_id *of_id =of_match_device (imx_uart_dt_ids, &pdev->dev); -int ret;if (!np)return -ENODEV ; - ret =of_alias_get_id (np,"serial" ); -if (ret <0 ) { -pr_err ("%s: failed to get alias id, errno %d\n" , - __func__, ret); -return -ENODEV ; - }else { - sport->port.line = ret; - } + sport->port.line = portnum++; +if (sport->port.line >=UART_NR ) +return -EINVAL ;if (of_get_property (np,"fsl,uart-has-rtscts" ,NULL )) sport->have_rtscts =1 ;
Quoted 24 lines · Grant Likely
of_alias_get_id()is broken and being reverted. Remove the reference to it and replace with a single incrementing id number.There is no risk of regression here on the imx driver since the imx change to use
of_alias_get_id()is commit22698aa2, "serial/imx: add device tree probe support" which is new for v3.1, and it won't get used unlessCONFIG_OFis enabled and the board is booted using a device tree. A single incrementing integer is sufficient for now.Signed-off-by Grant Likely <grant.likely-s3s/[email protected]>Acked-by Shawn Guo <[email protected]>---
I'm about to ask Linus to pull this patch through the devicetree/merge branch along with the
of_aliasrevert.drivers/tty/serial/imx.c | 13 ++++--------- 1 files changed, 4 insertions(+), 9 deletions(-)drivers/tty/serial/imx.c +0
-0
drivers/tty/serial/imx.c static int serial_imx_resume(struct platform_device *dev) · line 1289
Quoted 4 lines
drivers/tty/serial/imx.c +1
-0@@ -1286,22 +1286,17 @@ static int serial_imx_resume(struct platform_device *dev)static int serial_imx_probe_dt (struct imx_port *sport,struct platform_device *pdev) { +static int portnum =0 ;
would it be better to use an IDR here ?
Signature · 1 line
balbi
_______________________________________________
devicetree-discuss mailing list devicetree-discuss-uLR06cmDAlY/[email protected]
https://lists.ozlabs.org/listinfo/devicetree-discuss
Quoted 20 lines · Felipe Balbi
Quoted 19 lines · Grant Likely
of_alias_get_id()is broken and being reverted. Remove the reference to it and replace with a single incrementing id number.There is no risk of regression here on the imx driver since the imx change to use
of_alias_get_id()is commit22698aa2, "serial/imx: add device tree probe support" which is new for v3.1, and it won't get used unlessCONFIG_OFis enabled and the board is booted using a device tree. A single incrementing integer is sufficient for now.Signed-off-by Grant Likely <grant.likely-s3s/[email protected]>Acked-by Shawn Guo <[email protected]>---
I'm about to ask Linus to pull this patch through the devicetree/merge branch along with the
of_aliasrevert.drivers/tty/serial/imx.c | 13 ++++---------
1 files changed, 4 insertions(+), 9 deletions(-)
Quoted 11 lines
drivers/tty/serial/imx.c static int serial_imx_resume(struct platform_device *dev) · line 1289
Quoted 9 lines
drivers/tty/serial/imx.c +1
-0@@ -1286,22 +1286,17 @@ static int serial_imx_resume(struct platform_device *dev) static int serial_imx_probe_dt(struct imx_port *sport, struct platform_device *pdev) { + static int portnum = 0;would it be better to use an IDR here ?
Hmmm, I've not looked at idr before. Yes, it would probably be the right thing to do. This patch is needed to fix a build failure, but when it is reworked for v3.2 I think idr should be considered. Thanks!
g.
Quoted 33 lines · Grant Likely
Quoted 20 lines · Felipe Balbi
Quoted 19 lines · Grant Likely
of_alias_get_id()is broken and being reverted. Remove the reference to it and replace with a single incrementing id number.There is no risk of regression here on the imx driver since the imx change to use
of_alias_get_id()is commit22698aa2, "serial/imx: add device tree probe support" which is new for v3.1, and it won't get used unlessCONFIG_OFis enabled and the board is booted using a device tree. A single incrementing integer is sufficient for now.Signed-off-by Grant Likely <[email protected]>Acked-by Shawn Guo <[email protected]>---
I'm about to ask Linus to pull this patch through the devicetree/merge branch along with the
of_aliasrevert.drivers/tty/serial/imx.c | 13 ++++---------
1 files changed, 4 insertions(+), 9 deletions(-)Quoted 11 lines
drivers/tty/serial/imx.c static int serial_imx_resume(struct platform_device *dev) · line 1289
Quoted 9 lines
drivers/tty/serial/imx.c +1
-0@@ -1286,22 +1286,17 @@ static int serial_imx_resume(struct platform_device *dev) static int serial_imx_probe_dt(struct imx_port *sport, struct platform_device *pdev) { + static int portnum = 0;would it be better to use an IDR here ?
Quoted 4 lines
Hmmm, I've not looked at idr before. Yes, it would probably be the right thing to do. This patch is needed to fix a build failure, but when it is reworked for v3.2 I think idr should be considered. Thanks!
no problem ;-)
Signature · 1 line
balbi
Quoted 20 lines · Felipe Balbi
Quoted 19 lines · Grant Likely
of_alias_get_id()is broken and being reverted. Remove the reference to it and replace with a single incrementing id number.There is no risk of regression here on the imx driver since the imx change to use
of_alias_get_id()is commit22698aa2, "serial/imx: add device tree probe support" which is new for v3.1, and it won't get used unlessCONFIG_OFis enabled and the board is booted using a device tree. A single incrementing integer is sufficient for now.Signed-off-by Grant Likely <grant.likely-s3s/[email protected]>Acked-by Shawn Guo <[email protected]>---
I'm about to ask Linus to pull this patch through the devicetree/merge branch along with the
of_aliasrevert.drivers/tty/serial/imx.c | 13 ++++--------- 1 files changed, 4 insertions(+), 9 deletions(-)
Quoted 12 lines
drivers/tty/serial/imx.c static int serial_imx_resume(struct platform_device *dev) · line 1289
Quoted 9 lines
drivers/tty/serial/imx.c +1
-0@@ -1286,22 +1286,17 @@ static int serial_imx_resume(struct platform_device *dev)static int serial_imx_probe_dt (struct imx_port *sport,struct platform_device *pdev) { +static int portnum =0 ;would it be better to use an IDR here ?
This patch is a step back to avoid using of_alias_* api since it's been reverted. But we need to fix the api to make it right later. That said the serial will still go after the of_alias_get_id.
What we want is a fixed device id for specified serial instance, which is defined by device tree (in turn by hardware), instead of a random id. I'm not sure that I completely understand what IDR is exactly for. But from the documentation in lib/idr.c, I feel it's not what we need here. Or can you please elaborate why it fits here?
/*
* You call it to allocate an id (an int) an associate with that id a
* pointer or what ever, we treat it as a (void *). You can pass this
* id to a user for him to pass back at a later time. You then pass
* that id to this code and it returns your pointer.
*/
Signature · 2 lines
Regards, Shawn