* [PATCH] ata: pata-imx: simplify assignment of device name
@ 2016-12-23 9:45 Uwe Kleine-König
2016-12-23 9:50 ` Uwe Kleine-König
2017-01-09 8:43 ` Sascha Hauer
0 siblings, 2 replies; 5+ messages in thread
From: Uwe Kleine-König @ 2016-12-23 9:45 UTC (permalink / raw)
To: barebox
If OF_DEVICE isn't enabled, of_alias_get returns NULL. Also xstrdup
returns NULL when NULL is passed as argument. This allows to simplify
accordingly.
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
---
drivers/ata/pata-imx.c | 8 +-------
1 file changed, 1 insertion(+), 7 deletions(-)
diff --git a/drivers/ata/pata-imx.c b/drivers/ata/pata-imx.c
index c8098a537fe5..4f75048c12ce 100644
--- a/drivers/ata/pata-imx.c
+++ b/drivers/ata/pata-imx.c
@@ -158,7 +158,6 @@ static int imx_pata_probe(struct device_d *dev)
struct clk *clk;
void __iomem *base;
int ret;
- const char *devname = NULL;
ide = xzalloc(sizeof(*ide));
iores = dev_request_mem_resource(dev, 0);
@@ -182,14 +181,9 @@ static int imx_pata_probe(struct device_d *dev)
pata_imx_set_bus_timing(base, clk_get_rate(clk), 4);
- if (IS_ENABLED(CONFIG_OFDEVICE)) {
- devname = of_alias_get(dev->device_node);
- if (devname)
- devname = xstrdup(devname);
- }
ide->port.dev = dev;
- ide->port.devname = devname;
+ ide->port.devname = xstrdup(of_alias_get(dev->device_node));
dev->priv = ide;
dev->detect = pata_imx_detect;
--
2.11.0
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] ata: pata-imx: simplify assignment of device name
2016-12-23 9:45 [PATCH] ata: pata-imx: simplify assignment of device name Uwe Kleine-König
@ 2016-12-23 9:50 ` Uwe Kleine-König
2017-01-09 8:53 ` Sascha Hauer
2017-01-09 8:43 ` Sascha Hauer
1 sibling, 1 reply; 5+ messages in thread
From: Uwe Kleine-König @ 2016-12-23 9:50 UTC (permalink / raw)
To: barebox
Hello,
On Fri, Dec 23, 2016 at 10:45:49AM +0100, Uwe Kleine-König wrote:
> dev->detect = pata_imx_detect;
BTW, another thing I noticed while reading through this driver is:
pata_imx_detect is a wrapper around ata_port_detect. Later in
imx_pata_probe the function ide_port_register is called which also calls
ata_port_detect.
I don't have a machine handy where I could test, but I guess
pata_imx_detect could be dropped. (Or alternatively ide_port_register
could be reworked and all callers fixed to setup a detect call.)
Best regards
Uwe
--
Pengutronix e.K. | Uwe Kleine-König |
Industrial Linux Solutions | http://www.pengutronix.de/ |
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] ata: pata-imx: simplify assignment of device name
2016-12-23 9:45 [PATCH] ata: pata-imx: simplify assignment of device name Uwe Kleine-König
2016-12-23 9:50 ` Uwe Kleine-König
@ 2017-01-09 8:43 ` Sascha Hauer
1 sibling, 0 replies; 5+ messages in thread
From: Sascha Hauer @ 2017-01-09 8:43 UTC (permalink / raw)
To: Uwe Kleine-König; +Cc: barebox
On Fri, Dec 23, 2016 at 10:45:49AM +0100, Uwe Kleine-König wrote:
> If OF_DEVICE isn't enabled, of_alias_get returns NULL. Also xstrdup
> returns NULL when NULL is passed as argument. This allows to simplify
> accordingly.
>
> Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
> ---
Applied, thanks
Sascha
> drivers/ata/pata-imx.c | 8 +-------
> 1 file changed, 1 insertion(+), 7 deletions(-)
>
> diff --git a/drivers/ata/pata-imx.c b/drivers/ata/pata-imx.c
> index c8098a537fe5..4f75048c12ce 100644
> --- a/drivers/ata/pata-imx.c
> +++ b/drivers/ata/pata-imx.c
> @@ -158,7 +158,6 @@ static int imx_pata_probe(struct device_d *dev)
> struct clk *clk;
> void __iomem *base;
> int ret;
> - const char *devname = NULL;
>
> ide = xzalloc(sizeof(*ide));
> iores = dev_request_mem_resource(dev, 0);
> @@ -182,14 +181,9 @@ static int imx_pata_probe(struct device_d *dev)
>
> pata_imx_set_bus_timing(base, clk_get_rate(clk), 4);
>
> - if (IS_ENABLED(CONFIG_OFDEVICE)) {
> - devname = of_alias_get(dev->device_node);
> - if (devname)
> - devname = xstrdup(devname);
> - }
>
> ide->port.dev = dev;
> - ide->port.devname = devname;
> + ide->port.devname = xstrdup(of_alias_get(dev->device_node));
>
> dev->priv = ide;
> dev->detect = pata_imx_detect;
> --
> 2.11.0
>
>
> _______________________________________________
> barebox mailing list
> barebox@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/barebox
--
Pengutronix e.K. | |
Industrial Linux Solutions | http://www.pengutronix.de/ |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] ata: pata-imx: simplify assignment of device name
2016-12-23 9:50 ` Uwe Kleine-König
@ 2017-01-09 8:53 ` Sascha Hauer
2017-01-11 16:06 ` Uwe Kleine-König
0 siblings, 1 reply; 5+ messages in thread
From: Sascha Hauer @ 2017-01-09 8:53 UTC (permalink / raw)
To: Uwe Kleine-König; +Cc: barebox
On Fri, Dec 23, 2016 at 10:50:46AM +0100, Uwe Kleine-König wrote:
> Hello,
>
> On Fri, Dec 23, 2016 at 10:45:49AM +0100, Uwe Kleine-König wrote:
> > dev->detect = pata_imx_detect;
>
> BTW, another thing I noticed while reading through this driver is:
>
> pata_imx_detect is a wrapper around ata_port_detect. Later in
> imx_pata_probe the function ide_port_register is called which also calls
> ata_port_detect.
>
> I don't have a machine handy where I could test, but I guess
> pata_imx_detect could be dropped. (Or alternatively ide_port_register
> could be reworked and all callers fixed to setup a detect call.)
ide_port_register() has:
ret = ata_port_register(&ide->port);
if (!ret)
ata_port_detect(&ide->port);
The call to ata_port_detect() goes back to:
commit 9c8f73ba86884026f4bbfc6f593d73741cfebcdc
Author: Michel Stam <m.stam@fugro.nl>
Date: Mon Apr 7 12:01:21 2014 +0200
The hunk adding ata_port_detect() is wrong as it shortcircuits the
optional detection mechanism.
Sascha
--
Pengutronix e.K. | |
Industrial Linux Solutions | http://www.pengutronix.de/ |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] ata: pata-imx: simplify assignment of device name
2017-01-09 8:53 ` Sascha Hauer
@ 2017-01-11 16:06 ` Uwe Kleine-König
0 siblings, 0 replies; 5+ messages in thread
From: Uwe Kleine-König @ 2017-01-11 16:06 UTC (permalink / raw)
To: Sascha Hauer, Michel Stam; +Cc: barebox
On Mon, Jan 09, 2017 at 09:53:36AM +0100, Sascha Hauer wrote:
> On Fri, Dec 23, 2016 at 10:50:46AM +0100, Uwe Kleine-König wrote:
> > Hello,
> >
> > On Fri, Dec 23, 2016 at 10:45:49AM +0100, Uwe Kleine-König wrote:
> > > dev->detect = pata_imx_detect;
> >
> > BTW, another thing I noticed while reading through this driver is:
> >
> > pata_imx_detect is a wrapper around ata_port_detect. Later in
> > imx_pata_probe the function ide_port_register is called which also calls
> > ata_port_detect.
> >
> > I don't have a machine handy where I could test, but I guess
> > pata_imx_detect could be dropped. (Or alternatively ide_port_register
> > could be reworked and all callers fixed to setup a detect call.)
>
>
> ide_port_register() has:
>
> ret = ata_port_register(&ide->port);
> if (!ret)
> ata_port_detect(&ide->port);
>
> The call to ata_port_detect() goes back to:
>
> commit 9c8f73ba86884026f4bbfc6f593d73741cfebcdc
> Author: Michel Stam <m.stam@fugro.nl>
> Date: Mon Apr 7 12:01:21 2014 +0200
>
> The hunk adding ata_port_detect() is wrong as it shortcircuits the
> optional detection mechanism.
Who fixes this? /me looks at Michel who was added to Cc: :-)
Best regards
Uwe
--
Pengutronix e.K. | Uwe Kleine-König |
Industrial Linux Solutions | http://www.pengutronix.de/ |
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2017-01-11 16:07 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-12-23 9:45 [PATCH] ata: pata-imx: simplify assignment of device name Uwe Kleine-König
2016-12-23 9:50 ` Uwe Kleine-König
2017-01-09 8:53 ` Sascha Hauer
2017-01-11 16:06 ` Uwe Kleine-König
2017-01-09 8:43 ` Sascha Hauer
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox