[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20150508164647.GK18496@lunn.ch>
Date: Fri, 8 May 2015 18:46:47 +0200
From: Andrew Lunn <andrew@...n.ch>
To: Bert Vermeulen <bert@...t.com>
Cc: f.fainelli@...il.com, netdev@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH] net: mdio-gpio: Allow for unspecified bus id
> >> - snprintf(new_bus->id, MII_BUS_ID_SIZE, "gpio-%x", bus_id);
> >> + if (bus_id != -1)
> >> + snprintf(new_bus->id, MII_BUS_ID_SIZE, "gpio-%x", bus_id);
> >> + else
> >> + strncpy(new_bus->id, "gpio", MII_BUS_ID_SIZE);
> >
> > Hi Bert
> >
> > What happens if there are multiple platform_device's with -1? You
> > should probably be using use idr_alloc().
>
> It's an instance id per driver, not globally, and -1 specifically means it's
> the only instance. From Documentation/driver-model/platform.txt:
Ah, did not know there can only be one with -1. I've used i2c where
this does not apply when registering adaptors. It will allocate a
unique id to each added with id = -1.
Andrew
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists