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

2005-03-25 Thread Paul Mundt
On Fri, Mar 25, 2005 at 09:03:57PM +, Russell King wrote:
> > It would be trivial to treat them both as foobar0 and have the
> > registration succeed for whoever gets it first, but I could see that this
> > would be problematic in the serial8250 case. On the other hand, this is
> > then serial8250's problem.
> 
> Thank you for ignoring the other case of i82385 to justify your point
> of view of it being just a single driver problem.
> 
I didn't ignore it, I said that this was useful for anything that had
device names ending in numbers. The above was just in reply to what you
had pointed out about the serial8250 behaviour. Thank you for missing the
point though.

> Maybe you can work out a patch to fix up this mess?
> 
Yes, I'll hack something together in the morning.


pgpsXpFv90phM.pgp
Description: PGP signature


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

2005-03-25 Thread Russell King
On Fri, Mar 25, 2005 at 10:56:03PM +0200, Paul Mundt wrote:
> On Fri, Mar 25, 2005 at 08:25:08PM +, Russell King wrote:
> > Eh?  How do you end up with "/sys/devices/platform/foobar0.0" for the
> > former case?  It has an ID of "-1", and not zero.  Your idea doesn't
> > make any sense.
> > 
> Yes, I missed the -1 part, so Kyle is correct.
> 
> It would be trivial to treat them both as foobar0 and have the
> registration succeed for whoever gets it first, but I could see that this
> would be problematic in the serial8250 case. On the other hand, this is
> then serial8250's problem.

Thank you for ignoring the other case of i82385 to justify your point
of view of it being just a single driver problem.

Maybe you can work out a patch to fix up this mess?

-- 
Russell King
 Linux kernel2.6 ARM Linux   - http://www.arm.linux.org.uk/
 maintainer of:  2.6 Serial core
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


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

2005-03-25 Thread Paul Mundt
On Fri, Mar 25, 2005 at 08:25:08PM +, Russell King wrote:
> Eh?  How do you end up with "/sys/devices/platform/foobar0.0" for the
> former case?  It has an ID of "-1", and not zero.  Your idea doesn't
> make any sense.
> 
Yes, I missed the -1 part, so Kyle is correct.

It would be trivial to treat them both as foobar0 and have the
registration succeed for whoever gets it first, but I could see that this
would be problematic in the serial8250 case. On the other hand, this is
then serial8250's problem.

> > The first case is a corner case, and really shouldn't happen that much in
> > practice outside of broken drivers.
> 
> It does happen today.  Firstly, the 8250 driver registers a device of
> "serial8250" with id = -1 for the backwards-compatible devices.
> Platforms can then register a platform device called "serial8250"
> with zero or positive id numbers.
> 
That's fine, but that still doesn't make it any less of a corner case.

> > 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..
> 
> It's not about something being called something silly.  It's about
> the original concept of how to generate the path being down right
> stupid.
> 
 is a fairly common thing, if you have a problem with this,
maybe you would like to audit /dev while you are at it. I don't disagree
with you that this is useful for the devices that do end with numbers in
their names, but breaking everything else as a result of this makes no
sense either.

What would you do if you needed to register a character device using the
name of the device (which may end in a number, and there was a range of
them)? This likely doesn't happen enough in practice for anyone to
actually care, but you would have the same problem there otherwise.

This should arguably be the problem of the corner case driver, it
certainly shouldn't change convention for everyone else. While the
original concept of how to generate the path may have been "down right
stupid", it works for /dev, and I don't see how adding a superfluous . in
the paths of devices that just don't care and subsequently breaking
existing expectations of behaviour is any more inspired..


pgpSKqMDAHDAO.pgp
Description: PGP signature


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

2005-03-25 Thread Russell King
On Fri, Mar 25, 2005 at 09:58:26PM +0200, Paul Mundt wrote:
> 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.

Eh?  How do you end up with "/sys/devices/platform/foobar0.0" for the
former case?  It has an ID of "-1", and not zero.  Your idea doesn't
make any sense.

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

It does happen today.  Firstly, the 8250 driver registers a device of
"serial8250" with id = -1 for the backwards-compatible devices.
Platforms can then register a platform device called "serial8250"
with zero or positive id numbers.

> > 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.

Note that id = -1 means _no id_.  So, Kyle is quite correct to ask about
that case.

device = "serial8250"
id = -1
=> /sys/devices/platform/serial8250

The "-1" means "do not add the ID".

but, under the old naming scenario, the following comes out to the same
sysfs path:

device = "serial825"
id = 0
=> /sys/devices/platform/serial8250

and

device = "serial8250"
id = 0
=> /sys/devices/platform/serial82500

is just too confusing.  Same problem with i82365 platform devices, etc.

> 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..

It's not about something being called something silly.  It's about
the original concept of how to generate the path being down right
stupid.

-- 
Russell King
 Linux kernel2.6 ARM Linux   - http://www.arm.linux.org.uk/
 maintainer of:  2.6 Serial core
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


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

2005-03-25 Thread Kyle Moffett
On Mar 25, 2005, at 14:58, Paul Mundt wrote:
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.
But then you've just created yet another special case that will clutter 
the
interface in both the kernel _and_ all the applications.  Besides, the 
ID
on the first entry isn't 0, it's -1, which indicates it's a singleton.
You'd break existing applications anyways, because you're renaming a 
device
that existed and worked fine until it got renamed.  We should try to fix
the interface properly where it's broken so that we don't have to live 
with
the consequences for the next 3 years.

The first case is a corner case, and really shouldn't happen that much 
in
practice outside of broken drivers.
But a driver ending in a number _isn't_ really a corner case.  Most 
devices
have model numbers, and so we shouldn't twist that case to do something
funny when we shouldn't have to.

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.
But on the first example, there _isn't_ an ID, it's -1, it's a 
singleton.

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..
Fix the broken interface to have a unique naming scheme that doesn't 
need
special cases and this problem will be less likely to occur again in the
future.

We all agree that if we were just creating this interface now, we would
use something like this, right?
if (id == -1) {
snprintf( path, path_len, "/sys/devices/platform/%s", name);
} else {
snprintf( path, path_len, "/sys/devices/platform/%s.%lu", name, id );
}
So why not do this now?  It's a lot simpler and easier to get right, 
with
no special cases other than the already existing singleton case.  It 
also
only requires a 1-character change to all existing code, the extra ".".

Cheers,
Kyle Moffett
-BEGIN GEEK CODE BLOCK-
Version: 3.12
GCM/CS/IT/U d- s++: a18 C>$ UB/L/X/*(+)>$ P+++()>$
L(+++) E W++(+) N+++(++) o? K? w--- O? M++ V? PS+() PE+(-) Y+
PGP+++ t+(+++) 5 X R? tv-(--) b(++) DI+ D+ G e->$ h!*()>++$ r  
!y?(-)
--END GEEK CODE BLOCK--

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


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

2005-03-25 Thread Paul Mundt
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..


pgpXOhohVGxXC.pgp
Description: PGP signature


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

2005-03-25 Thread Kyle Moffett
On Mar 25, 2005, at 13:35, Paul Mundt wrote:
Anything that expects that it can open a 
/sys/devices/platform/
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.
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"
I'll agree that having two drivers named like this is bad, but how is a
userspace application given a path like "/sys/devices/platform/foobar0"
supposed to figure out which one it is.  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.
Cheers,
Kyle Moffett
-BEGIN GEEK CODE BLOCK-
Version: 3.12
GCM/CS/IT/U d- s++: a18 C>$ UB/L/X/*(+)>$ P+++()>$
L(+++) E W++(+) N+++(++) o? K? w--- O? M++ V? PS+() PE+(-) Y+
PGP+++ t+(+++) 5 X R? tv-(--) b(++) DI+ D+ G e->$ h!*()>++$ r  
!y?(-)
--END GEEK CODE BLOCK--

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


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

2005-03-25 Thread Paul Mundt
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 , 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-x3 00   0 Jan  1 00:00 .
drwxr-xr-x   18 00   0 Jan  1 00:00 ..
lrwxrwxrwx1 00   0 Jan  1 00:00 bus -> 
../../../bus/platform
-rw-r--r--1 004096 Jan  1 00:00 detach_state
lrwxrwxrwx1 00   0 Jan  1 00:00 driver -> 
../../../bus/platform/drivers/serial8250
drwxr-xr-x2 00   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/
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.


pgpskYF7jwfiV.pgp
Description: PGP signature


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

2005-03-25 Thread Greg KH
On Fri, Mar 25, 2005 at 08:01:36PM +0200, Paul Mundt wrote:
> On Wed, Mar 09, 2005 at 04:34:39PM -0800, Greg KH wrote:
> > [PATCH] driver core: Separate platform device name from platform device 
> > number
> > 
> > Separate platform device name from platform device number such that
> > names ending with numbers aren't confusing.
> > 
> 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 :)

> I don't really see how having something like randomfb.0 is intuitive,
> this may make sense for things like serial8250 where another 0 would
> be misleading without some form of delimiter, but those are the corner
> cases and should be treated as such.

I don't see the serial8250 driver adding that .0 to it on my machines,
does this happen on yours?

> It's a bit irritating to have to constantly update userspace code that is
> acting under the false pretense that there is some sort of consistent
> naming scheme in place that won't change every time some new corner case
> crops up.

What userspace code are you referring to?

thanks,

greg k-h
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


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

2005-03-25 Thread Paul Mundt
On Wed, Mar 09, 2005 at 04:34:39PM -0800, Greg KH wrote:
> [PATCH] driver core: Separate platform device name from platform device number
> 
> Separate platform device name from platform device number such that
> names ending with numbers aren't confusing.
> 
This might make sense for devices that end in numbers, but does it really
make sense for devices that don't? I don't really see how having
something like randomfb.0 is intuitive, this may make sense for things
like serial8250 where another 0 would be misleading without some form of
delimiter, but those are the corner cases and should be treated as such.

It's a bit irritating to have to constantly update userspace code that is
acting under the false pretense that there is some sort of consistent
naming scheme in place that won't change every time some new corner case
crops up.

(And yes, I should have brought this up when the patch was posted, but I
didn't see it until _after_ being bit by this change).


pgpkDvoOIRkMI.pgp
Description: PGP signature


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

2005-03-25 Thread Paul Mundt
On Wed, Mar 09, 2005 at 04:34:39PM -0800, Greg KH wrote:
 [PATCH] driver core: Separate platform device name from platform device number
 
 Separate platform device name from platform device number such that
 names ending with numbers aren't confusing.
 
This might make sense for devices that end in numbers, but does it really
make sense for devices that don't? I don't really see how having
something like randomfb.0 is intuitive, this may make sense for things
like serial8250 where another 0 would be misleading without some form of
delimiter, but those are the corner cases and should be treated as such.

It's a bit irritating to have to constantly update userspace code that is
acting under the false pretense that there is some sort of consistent
naming scheme in place that won't change every time some new corner case
crops up.

(And yes, I should have brought this up when the patch was posted, but I
didn't see it until _after_ being bit by this change).


pgpkDvoOIRkMI.pgp
Description: PGP signature


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

2005-03-25 Thread Greg KH
On Fri, Mar 25, 2005 at 08:01:36PM +0200, Paul Mundt wrote:
 On Wed, Mar 09, 2005 at 04:34:39PM -0800, Greg KH wrote:
  [PATCH] driver core: Separate platform device name from platform device 
  number
  
  Separate platform device name from platform device number such that
  names ending with numbers aren't confusing.
  
 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 :)

 I don't really see how having something like randomfb.0 is intuitive,
 this may make sense for things like serial8250 where another 0 would
 be misleading without some form of delimiter, but those are the corner
 cases and should be treated as such.

I don't see the serial8250 driver adding that .0 to it on my machines,
does this happen on yours?

 It's a bit irritating to have to constantly update userspace code that is
 acting under the false pretense that there is some sort of consistent
 naming scheme in place that won't change every time some new corner case
 crops up.

What userspace code are you referring to?

thanks,

greg k-h
-
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


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

2005-03-25 Thread Paul Mundt
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 devicenameid, 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-x3 00   0 Jan  1 00:00 .
drwxr-xr-x   18 00   0 Jan  1 00:00 ..
lrwxrwxrwx1 00   0 Jan  1 00:00 bus - 
../../../bus/platform
-rw-r--r--1 004096 Jan  1 00:00 detach_state
lrwxrwxrwx1 00   0 Jan  1 00:00 driver - 
../../../bus/platform/drivers/serial8250
drwxr-xr-x2 00   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/deviceid
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.


pgpskYF7jwfiV.pgp
Description: PGP signature


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

2005-03-25 Thread Kyle Moffett
On Mar 25, 2005, at 13:35, Paul Mundt wrote:
Anything that expects that it can open a 
/sys/devices/platform/deviceid
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.
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
I'll agree that having two drivers named like this is bad, but how is a
userspace application given a path like /sys/devices/platform/foobar0
supposed to figure out which one it is.  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.
Cheers,
Kyle Moffett
-BEGIN GEEK CODE BLOCK-
Version: 3.12
GCM/CS/IT/U d- s++: a18 C$ UB/L/X/*(+)$ P+++()$
L(+++) E W++(+) N+++(++) o? K? w--- O? M++ V? PS+() PE+(-) Y+
PGP+++ t+(+++) 5 X R? tv-(--) b(++) DI+ D+ G e-$ h!*()++$ r  
!y?(-)
--END GEEK CODE BLOCK--

-
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


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

2005-03-25 Thread Paul Mundt
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..


pgpXOhohVGxXC.pgp
Description: PGP signature


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

2005-03-25 Thread Kyle Moffett
On Mar 25, 2005, at 14:58, Paul Mundt wrote:
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.
But then you've just created yet another special case that will clutter 
the
interface in both the kernel _and_ all the applications.  Besides, the 
ID
on the first entry isn't 0, it's -1, which indicates it's a singleton.
You'd break existing applications anyways, because you're renaming a 
device
that existed and worked fine until it got renamed.  We should try to fix
the interface properly where it's broken so that we don't have to live 
with
the consequences for the next 3 years.

The first case is a corner case, and really shouldn't happen that much 
in
practice outside of broken drivers.
But a driver ending in a number _isn't_ really a corner case.  Most 
devices
have model numbers, and so we shouldn't twist that case to do something
funny when we shouldn't have to.

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.
But on the first example, there _isn't_ an ID, it's -1, it's a 
singleton.

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..
Fix the broken interface to have a unique naming scheme that doesn't 
need
special cases and this problem will be less likely to occur again in the
future.

We all agree that if we were just creating this interface now, we would
use something like this, right?
if (id == -1) {
snprintf( path, path_len, /sys/devices/platform/%s, name);
} else {
snprintf( path, path_len, /sys/devices/platform/%s.%lu, name, id );
}
So why not do this now?  It's a lot simpler and easier to get right, 
with
no special cases other than the already existing singleton case.  It 
also
only requires a 1-character change to all existing code, the extra ..

Cheers,
Kyle Moffett
-BEGIN GEEK CODE BLOCK-
Version: 3.12
GCM/CS/IT/U d- s++: a18 C$ UB/L/X/*(+)$ P+++()$
L(+++) E W++(+) N+++(++) o? K? w--- O? M++ V? PS+() PE+(-) Y+
PGP+++ t+(+++) 5 X R? tv-(--) b(++) DI+ D+ G e-$ h!*()++$ r  
!y?(-)
--END GEEK CODE BLOCK--

-
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


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

2005-03-25 Thread Russell King
On Fri, Mar 25, 2005 at 09:58:26PM +0200, Paul Mundt wrote:
 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.

Eh?  How do you end up with /sys/devices/platform/foobar0.0 for the
former case?  It has an ID of -1, and not zero.  Your idea doesn't
make any sense.

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

It does happen today.  Firstly, the 8250 driver registers a device of
serial8250 with id = -1 for the backwards-compatible devices.
Platforms can then register a platform device called serial8250
with zero or positive id numbers.

  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.

Note that id = -1 means _no id_.  So, Kyle is quite correct to ask about
that case.

device = serial8250
id = -1
= /sys/devices/platform/serial8250

The -1 means do not add the ID.

but, under the old naming scenario, the following comes out to the same
sysfs path:

device = serial825
id = 0
= /sys/devices/platform/serial8250

and

device = serial8250
id = 0
= /sys/devices/platform/serial82500

is just too confusing.  Same problem with i82365 platform devices, etc.

 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..

It's not about something being called something silly.  It's about
the original concept of how to generate the path being down right
stupid.

-- 
Russell King
 Linux kernel2.6 ARM Linux   - http://www.arm.linux.org.uk/
 maintainer of:  2.6 Serial core
-
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


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

2005-03-25 Thread Paul Mundt
On Fri, Mar 25, 2005 at 08:25:08PM +, Russell King wrote:
 Eh?  How do you end up with /sys/devices/platform/foobar0.0 for the
 former case?  It has an ID of -1, and not zero.  Your idea doesn't
 make any sense.
 
Yes, I missed the -1 part, so Kyle is correct.

It would be trivial to treat them both as foobar0 and have the
registration succeed for whoever gets it first, but I could see that this
would be problematic in the serial8250 case. On the other hand, this is
then serial8250's problem.

  The first case is a corner case, and really shouldn't happen that much in
  practice outside of broken drivers.
 
 It does happen today.  Firstly, the 8250 driver registers a device of
 serial8250 with id = -1 for the backwards-compatible devices.
 Platforms can then register a platform device called serial8250
 with zero or positive id numbers.
 
That's fine, but that still doesn't make it any less of a corner case.

  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..
 
 It's not about something being called something silly.  It's about
 the original concept of how to generate the path being down right
 stupid.
 
devid is a fairly common thing, if you have a problem with this,
maybe you would like to audit /dev while you are at it. I don't disagree
with you that this is useful for the devices that do end with numbers in
their names, but breaking everything else as a result of this makes no
sense either.

What would you do if you needed to register a character device using the
name of the device (which may end in a number, and there was a range of
them)? This likely doesn't happen enough in practice for anyone to
actually care, but you would have the same problem there otherwise.

This should arguably be the problem of the corner case driver, it
certainly shouldn't change convention for everyone else. While the
original concept of how to generate the path may have been down right
stupid, it works for /dev, and I don't see how adding a superfluous . in
the paths of devices that just don't care and subsequently breaking
existing expectations of behaviour is any more inspired..


pgpSKqMDAHDAO.pgp
Description: PGP signature


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

2005-03-25 Thread Russell King
On Fri, Mar 25, 2005 at 10:56:03PM +0200, Paul Mundt wrote:
 On Fri, Mar 25, 2005 at 08:25:08PM +, Russell King wrote:
  Eh?  How do you end up with /sys/devices/platform/foobar0.0 for the
  former case?  It has an ID of -1, and not zero.  Your idea doesn't
  make any sense.
  
 Yes, I missed the -1 part, so Kyle is correct.
 
 It would be trivial to treat them both as foobar0 and have the
 registration succeed for whoever gets it first, but I could see that this
 would be problematic in the serial8250 case. On the other hand, this is
 then serial8250's problem.

Thank you for ignoring the other case of i82385 to justify your point
of view of it being just a single driver problem.

Maybe you can work out a patch to fix up this mess?

-- 
Russell King
 Linux kernel2.6 ARM Linux   - http://www.arm.linux.org.uk/
 maintainer of:  2.6 Serial core
-
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


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

2005-03-25 Thread Paul Mundt
On Fri, Mar 25, 2005 at 09:03:57PM +, Russell King wrote:
  It would be trivial to treat them both as foobar0 and have the
  registration succeed for whoever gets it first, but I could see that this
  would be problematic in the serial8250 case. On the other hand, this is
  then serial8250's problem.
 
 Thank you for ignoring the other case of i82385 to justify your point
 of view of it being just a single driver problem.
 
I didn't ignore it, I said that this was useful for anything that had
device names ending in numbers. The above was just in reply to what you
had pointed out about the serial8250 behaviour. Thank you for missing the
point though.

 Maybe you can work out a patch to fix up this mess?
 
Yes, I'll hack something together in the morning.


pgpsXpFv90phM.pgp
Description: PGP signature