[PATCH] Platform bus support

Kay Sievers kay.sievers at vrfy.org
Wed Aug 24 13:58:58 PDT 2005


On Wed, Aug 24, 2005 at 05:48:20PM +0200, Pierre Ossman wrote:
> David Zeuthen wrote:
> 
> >On Tue, 2005-08-23 at 23:06 +0200, Pierre Ossman wrote:
> >  
> >
> >>Huh? Platform has been in the kernel for ages. At least since 2.6.9,
> >>probably since 2.6.0.
> >>    
> >>
> >
> >Yes.. but fixing the x86 floppy driver to give this
> >
> >        [davidz at daxter ~]$ ls -l /sys/bus/platform/devices/floppy.0/
> >        total 0
> >        lrwxrwxrwx  1 root root 0 Aug 24 10:14 block -> ../../../block/fd0
> >        lrwxrwxrwx  1 root root 0 Aug 24 06:13 bus -> ../../../bus/platform
> >        drwxr-xr-x  2 root root 0 Aug 24 10:14 power
> >        [davidz at daxter ~]$
> >
> >is a rather recent addition - an addition that allows us to treat the
> >x86 floppy drive like any other block device. So.. we just need to make
> >sure that the patch works with this too..
> >
> Ah. So the situation would be that with this patch you would get a
> floppy block node _without_ a parent on old systems and a node _with_ a
> parent on new systems, right?
> 
> >>I've found a machine to fiddle with. I has a floppy controller, but no
> >>floppy drive. But when I removed 'parent == NULL' from your hack I at
> >>least got:
> >>
> >>16124: 22:57:42.943: probe-pc-floppy.c:73: Checking if /dev/fd0 is
> >>actually present
> >>16124: 22:57:42.945: probe-pc-floppy.c:88: floppy drive name is 'H1440'
> >>16124: 22:57:43.633: probe-pc-floppy.c:96: floppy drive /dev/fd0 seems
> >>not to exist
> >>
> >>It would seem some hacking is till needed since the platform information
> >>cannot provide any decent information about the actual device. Perhaps
> >>we could scan all block devices with the ioctl:s in probe-pc-floppy and
> >>use that?
> >>
> >>
> >>I have to run off now, but if you have some ideas on how to proceed I
> >>can continue this tomorrow.
> >>    
> >>
> >
> >I have a machine with a real floppy drive.. Send me a patch and I'll
> >test it!
> 
> Well, I wouldn't know how to make said patch. It still needs some hack
> to determine that it's a floppy. I see three solutions:
> 
> * Continue checking device node name. Easiest to do, just remove (parent
> == NULL) from the current if-clause.
> * Check the name of the device (i.e. "floppy-[0-9]+"). This is how the
> platform bus identifies things on Linux.
> * Try the floppy ioctl:s on every block device found. Consider those
> with a valid response to be floppies. This is the least hackish, but I
> don't know enough about the ioctls to determine how well it would work.
> 
> So which of the three would be preferred?

Hannes added a special attribute to floppies. It will show up in 2.6.14:
  ftp://ftp.kernel.org/pub/linux/kernel/people/akpm/patches/2.6/2.6.13-rc6/2.6.13-rc6-mm2/broken-out/gregkh-driver-floppy-cmos-attribute.patch

We read this with udev to create the correct device nodes:
  http://www.kernel.org/git/?p=linux/hotplug/udev.git;a=blob;h=f4003c2ce2944b5bb5ac1f77d81a5b5d6616ea44;hb=8c11a2f0ff27264513033691bb818262f009fe4e;f=extras/floppy/create_floppy_devices.c

Kay


More information about the hal mailing list