Re: [PATCH] driver core: Separate platform device name from platform device number

From: Paul Mundt
Date: Fri Mar 25 2005 - 14:59:25 EST


On Fri, Mar 25, 2005 at 02:38:22PM -0500, Kyle Moffett wrote:
> So how would you tell the difference between the following?
> device = "foobar0"
> id = -1
> path = "/sys/devices/platform/foobar0"
> versus
> device = "foobar"
> id = 0
> path = "/sys/devices/platform/foobar0"
>
Easy, we use the delimiter on anything ending with a number at the end of
the device name.. so for device = "foobar0", this would end up as
/sys/devices/platform/foobar0.0, whereas in the latter case this would
end up as /sys/devices/platform/foobar0.

The first case is a corner case, and really shouldn't happen that much in
practice outside of broken drivers.

> It's not as nice to add the extra period, but otherwise you end up with
> a lot of _extra_ special cases in both the kernel _and_ applications,
> which helps nobody.
>
No you don't, it's pretty easy to figure out that if the end of the
device name is a number that there will be a delimiter between that and
the id. This should be the exception, not the rule.

We don't go around changing /dev semantics everytime someone decides to
call their device something silly, I don't see why platform devices
should be treated differently, better to just fix the broken drivers..

Attachment: pgp00000.pgp
Description: PGP signature