mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH] state: use name of device node as name, if alias is not available
@ 2015-07-03 11:49 Marc Kleine-Budde
  2015-07-06  4:37 ` Sascha Hauer
  0 siblings, 1 reply; 2+ messages in thread
From: Marc Kleine-Budde @ 2015-07-03 11:49 UTC (permalink / raw)
  To: barebox

Wihtout this patch, when using more than one state device an alias is
mandatory, otherwise the there will be two state devices with the name state.

This patch fixes the limitation by using the device node's name if no alias is
defined.

Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
---
 drivers/misc/state.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/misc/state.c b/drivers/misc/state.c
index f3e366480fa2..7a3303264206 100644
--- a/drivers/misc/state.c
+++ b/drivers/misc/state.c
@@ -37,7 +37,7 @@ static int state_probe(struct device_d *dev)
 
 	alias = of_alias_get(np);
 	if (!alias)
-		alias = "state";
+		alias = np->name;
 
 	state = state_new_from_node(alias, np);
 	if (IS_ERR(state))
-- 
2.1.4


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] state: use name of device node as name, if alias is not available
  2015-07-03 11:49 [PATCH] state: use name of device node as name, if alias is not available Marc Kleine-Budde
@ 2015-07-06  4:37 ` Sascha Hauer
  0 siblings, 0 replies; 2+ messages in thread
From: Sascha Hauer @ 2015-07-06  4:37 UTC (permalink / raw)
  To: Marc Kleine-Budde; +Cc: barebox

On Fri, Jul 03, 2015 at 01:49:41PM +0200, Marc Kleine-Budde wrote:
> Wihtout this patch, when using more than one state device an alias is
> mandatory, otherwise the there will be two state devices with the name state.

Are there really two devices? I hope there's a -EEXIST somewhere...

> 
> This patch fixes the limitation by using the device node's name if no alias is
> defined.

The node name is not necessarily unique. Also you might end up with
state names like "state@0" which probably also is not what we want.
Maybe making the alias mandatory for multiple state devices is not the
worst behaviour.

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] 2+ messages in thread

end of thread, other threads:[~2015-07-06  4:37 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-07-03 11:49 [PATCH] state: use name of device node as name, if alias is not available Marc Kleine-Budde
2015-07-06  4:37 ` Sascha Hauer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox