Messages in this thread | | | Date | Sun, 29 May 2011 08:18:36 -0400 | From | Chris Metcalf <> | Subject | Re: [PATCH v2] arch/tile: add hypervisor-based character driver for SPI flash ROM |
| |
On 5/29/2011 7:45 AM, Greg KH wrote: > On Sat, May 28, 2011 at 08:32:07PM -0400, Chris Metcalf wrote: >>> As you are only using 1 minor device, why not just use a misc device >>> instead? It's simpler, and you get the sysfs code for free, which you >>> forgot to do, so your device node will never show up in userspace :( >> Interesting; this appears to be a bug. We use 4 minors (see "srom_devs = >> 4" higher up). I'll fix this. We may have some other devices that would >> benefit from being recast as misc devices, so I'll look at our set of >> internal devices. > This kind of implies that you didn't test this code, right? You might > want to do that next time :)
No, this bug has been in the code since day one (I just double-checked our SCM), and it has always worked fine. I'm looking into how this is possible now, but trust me, we've tested this aspect of the driver the whole time. :-)
>> Is there a good example of a character device that has multiple minors and >> also is registered with sysfs? > Lots of them, look all over the kernel, and in LDD3 there's even an > outdated example of one I think.
I didn't actually find many drivers that have both cdev_add with count>1, and mention sysfs or kobj, but char/raw.c is one that looks pretty clean. (I found only four others total: uio/uio.c, s390/char/vmlogrdr.c, staging/comedi/comedi_fops.c, and staging/vme/devices/vme_user.c.)
-- Chris Metcalf, Tilera Corp. http://www.tilera.com
| |