From: Greg KH <greg@kroah.com>
To: Belisko Marek <marek.belisko@gmail.com>
Cc: Jiri Slaby <jirislaby@gmail.com>,
devel@driverdev.osuosl.org, Greg Kroah-Hartman <gregkh@suse.de>,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH 2/6] staging: ft1000: Use misc device instead self created device.
Date: Mon, 29 Nov 2010 11:44:14 -0800 [thread overview]
Message-ID: <20101129194414.GB14086@kroah.com> (raw)
In-Reply-To: <AANLkTin6Am=17wyMZJRu9bYk5-QTYqZhGtZqV_sDwJW4@mail.gmail.com>
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@gmail.com> wrote:
> > On 11/23/2010 03:00 PM, Belisko Marek wrote:
> >> On Tue, Nov 23, 2010 at 2:53 PM, Jiri Slaby <jirislaby@gmail.com> 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@open-nandra.com>
> >>>> ---
> >>>> 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
next prev parent reply other threads:[~2010-11-29 19:46 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-11-23 12:29 [PATCH 0/6] Add misc device handling Marek Belisko
2010-11-23 12:29 ` [PATCH 1/6] staging: ft1000: Remove functions which create devices in kernel space Marek Belisko
2010-11-23 12:29 ` [PATCH 2/6] staging: ft1000: Use misc device instead self created device Marek Belisko
2010-11-23 13:53 ` Jiri Slaby
2010-11-23 14:00 ` Belisko Marek
2010-11-23 21:28 ` Jiri Slaby
2010-11-24 9:16 ` Belisko Marek
2010-11-29 19:44 ` Greg KH [this message]
2010-11-29 20:08 ` Belisko Marek
2010-12-01 4:06 ` Greg KH
2010-12-01 9:35 ` Belisko Marek
2010-11-23 12:29 ` [PATCH 3/6] staging: ft1000: Remove unused variables Marek Belisko
2010-11-23 12:29 ` [PATCH 4/6] staging: ft1000: Remove unused headers Marek Belisko
2010-11-29 19:43 ` Greg KH
2010-11-23 12:29 ` [PATCH 5/6] staging: ft1000: Remove dead code Marek Belisko
2010-11-23 12:29 ` [PATCH 6/6] staging: ft1000: Check return value of ft1000_CreateDevice() Marek Belisko
2010-11-29 19:44 ` [PATCH 0/6] Add misc device handling Greg KH
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20101129194414.GB14086@kroah.com \
--to=greg@kroah.com \
--cc=devel@driverdev.osuosl.org \
--cc=gregkh@suse.de \
--cc=jirislaby@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=marek.belisko@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®