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

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


On Fri, Mar 25, 2005 at 10:10:14AM -0800, Greg KH wrote:
> > This might make sense for devices that end in numbers, but does it really
> > make sense for devices that don't?
>
> Then fix those drivers to not put the number in there if they don't have
> one :)
>
But they do have non -1 ids, the device name itself just doesn't end in a
number. In this event, the delimiter makes no sense.

These drivers are expecting that you will have <devicename><id>, and
application code is expecting the same. /dev follows this convention too,
I don't see this as being an unreasonable expectation.

If anything, serial8250 is broken and should rename itself to something
not ending in a number. It's not nice when one driver exhibits a corner
case and decides to change the semantics for everyone else.

> I don't see the serial8250 driver adding that .0 to it on my machines,
> does this happen on yours?
>
Yes, we end up having /sys/devices/platform/serial8250 and serial8250.0.
Where serial8250.0 ends up as:

drwxr-xr-x 3 0 0 0 Jan 1 00:00 .
drwxr-xr-x 18 0 0 0 Jan 1 00:00 ..
lrwxrwxrwx 1 0 0 0 Jan 1 00:00 bus -> ../../../bus/platform
-rw-r--r-- 1 0 0 4096 Jan 1 00:00 detach_state
lrwxrwxrwx 1 0 0 0 Jan 1 00:00 driver -> ../../../bus/platform/drivers/serial8250
drwxr-xr-x 2 0 0 0 Jan 1 00:00 power

That doesn't really bother me, having serial8250.0 is more sensible then
serial82500. For this type of corner case the delimiter makes sense, but
not in a blanket sense.

> What userspace code are you referring to?
>
Anything that expects that it can open a /sys/devices/platform/<device><id>
path. I have a few applications like this, I have no reason to doubt that
others do too. I don't see any reason to go out of the way to break this
convention if the end of the device name is not a number.

Attachment: pgp00000.pgp
Description: PGP signature