On Wed, Nov 24, 2010 at 10:16:36AM +0100, Belisko Marek wrote: > On Tue, Nov 23, 2010 at 10:28 PM, Jiri Slaby <jirislaby@xxxxxxxxx> wrote: > > On 11/23/2010 03:00 PM, Belisko Marek wrote: > >> On Tue, Nov 23, 2010 at 2:53 PM, Jiri Slaby <jirislaby@xxxxxxxxx> wrote: > >>> On 11/23/2010 01:29 PM, Marek Belisko wrote: > >>>> Use simple misc device for ioctl driver funtionality testing. > >>>> > >>>> Signed-off-by: Marek Belisko <marek.belisko@xxxxxxxxxxxxxxx> > >>>> --- > >>>> drivers/staging/ft1000/ft1000-usb/ft1000_chdev.c | 90 ++++++++++++++++++--- > >>>> 1 files changed, 77 insertions(+), 13 deletions(-) > >>>> > >>>> diff --git a/drivers/staging/ft1000/ft1000-usb/ft1000_chdev.c b/drivers/staging/ft1000/ft1000-usb/ft1000_chdev.c > >>>> index 1aec926..d1784a3 100644 > >>>> --- a/drivers/staging/ft1000/ft1000-usb/ft1000_chdev.c > >>>> +++ b/drivers/staging/ft1000/ft1000-usb/ft1000_chdev.c > >>>> @@ -32,6 +32,7 @@ > >>>> #include <linux/poll.h> > >>>> #include <linux/netdevice.h> > >>>> #include <linux/delay.h> > >>>> +#include <linux/miscdevice.h> > >>>> > >>>> #include <linux/fs.h> > >>>> #include <linux/kmod.h> > >>>> @@ -78,6 +79,47 @@ static struct file_operations ft1000fops = > >>>> .llseek = no_llseek, > >>>> }; > >>>> > >>>> +struct ft1000_misc_device { > >>>> + struct miscdevice dev; > >>>> + int inf_id; > >>>> +}; > >>>> + > >>>> +#define FREE_ID (0xFF) > >>>> + > >>>> +/* we support just 3 devices */ > >>>> +#define MAX_DEVICE 3 > >>> > >>> No, why this should be converted to miscdevice? Leave it as chrdev. > >> Is there any problem with using miscdev? > > > > Yes, if you want more than a single device per system. > > > >> Old interface create /dev nodes with > >> calling kernel thread and some usermode_helper or whatever. > > > > Yes, that's crap indeed. But doesn't judge for miscdevice. > > > >> Just convert to misc dev > >> where this is done automatically. > > > > So the only thing you need to do is to send a uevent to udev appropriately. > Could be used something like: > register_chrdev(0,"ft1000", &fops) > class = class_create(THIS_MODULE, "ft1000"); > device_create(class, NULL, MKDEV(major, i), NULL, "ft1000%d", i); > Then will be created different devices for every plugged device. > This should have effect of automatic device node creation also suppose. Please don't create new classes. Is this a USB device? If so, why not just use the USB major number? Just ask me and I can reserve you a USB minor number for your driver. thanks, greg k-h _______________________________________________ devel mailing list devel@xxxxxxxxxxxxxxxxxxxxxx http://driverdev.linuxdriverproject.org/mailman/listinfo/devel