From: Andrew Lunn <andrew@lunn.ch>
To: Bert Vermeulen <bert@biot.com>
Cc: f.fainelli@gmail.com, netdev@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] net: mdio-gpio: Allow for unspecified bus id
Date: Fri, 8 May 2015 18:46:47 +0200 [thread overview]
Message-ID: <20150508164647.GK18496@lunn.ch> (raw)
In-Reply-To: <554CDDD2.6050104@biot.com>
> >> - 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
next prev parent reply other threads:[~2015-05-08 16:46 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-05-08 14:18 [PATCH] net: mdio-gpio: Allow for unspecified bus id Bert Vermeulen
2015-05-08 15:48 ` Andrew Lunn
2015-05-08 16:01 ` Bert Vermeulen
2015-05-08 16:46 ` Andrew Lunn [this message]
2015-05-08 16:49 ` Andrew Lunn
2015-05-10 23:42 ` David Miller
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20150508164647.GK18496@lunn.ch \
--to=andrew@lunn.ch \
--cc=bert@biot.com \
--cc=f.fainelli@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).