From: Greg KH <greg@kroah.com>
To: rio500-devel <rio500-devel@lists.sourceforge.net>,
linux-kernel <linux-kernel@vger.kernel.org>
Cc: linux-usb-devel@lists.sourceforge.net
Subject: Re: [patch] rio500 devfs support
Date: Mon, 25 Jun 2001 10:35:21 -0700 [thread overview]
Message-ID: <20010625103521.A17036@kroah.com> (raw)
In-Reply-To: <20010619175224.A1137@glitch.snoozer.net>
In-Reply-To: <20010619175224.A1137@glitch.snoozer.net>; from haphazard@socket.net on Tue, Jun 19, 2001 at 05:52:24PM -0500
[-- Attachment #1: Type: text/plain, Size: 570 bytes --]
On Tue, Jun 19, 2001 at 05:52:24PM -0500, Gregory T. Norris wrote:
> The attached diff adds devfs support to the rio500 driver, so that
> /dev/usb/rio500 gets created automagically. It was generated against
> 2.4.5, but probably applies fine against any recent kernel. Comments
> are welcome (but be gentle, this is my first attempt at a kernel
> patch :-).
Here's a small change that makes the node a child of the usb devfs
entry. It also enables the node to only be present when the device is
actually present. The patch is against 2.4.6-pre5.
thanks,
greg k-h
[-- Attachment #2: usb-rio500-2.4.6-pre5.patch --]
[-- Type: text/plain, Size: 2405 bytes --]
diff -Nru a/drivers/usb/rio500.c b/drivers/usb/rio500.c
--- a/drivers/usb/rio500.c Mon Jun 25 10:31:03 2001
+++ b/drivers/usb/rio500.c Mon Jun 25 10:31:03 2001
@@ -38,13 +38,14 @@
#include <linux/spinlock.h>
#include <linux/usb.h>
#include <linux/smp_lock.h>
+#include <linux/devfs_fs_kernel.h>
#include "rio500_usb.h"
/*
* Version Information
*/
-#define DRIVER_VERSION "v1.0.0"
+#define DRIVER_VERSION "v1.1"
#define DRIVER_AUTHOR "Cesar Miquel <miquel@df.uba.ar>"
#define DRIVER_DESC "USB Rio 500 driver"
@@ -60,6 +61,7 @@
struct rio_usb_data {
struct usb_device *rio_dev; /* init: probe_rio */
+ devfs_handle_t devfs; /* devfs device */
unsigned int ifnum; /* Interface number of the USB device */
int isopen; /* nz if open */
int present; /* Device is present on the bus */
@@ -69,6 +71,8 @@
struct semaphore lock; /* general race avoidance */
};
+extern devfs_handle_t usb_devfs_handle; /* /dev/usb dir. */
+
static struct rio_usb_data rio_instance;
static int open_rio(struct inode *inode, struct file *file)
@@ -416,6 +420,15 @@
return read_count;
}
+static struct
+file_operations usb_rio_fops = {
+ read: read_rio,
+ write: write_rio,
+ ioctl: ioctl_rio,
+ open: open_rio,
+ release: close_rio,
+};
+
static void *probe_rio(struct usb_device *dev, unsigned int ifnum,
const struct usb_device_id *id)
{
@@ -439,6 +452,14 @@
}
dbg("probe_rio: ibuf address:%p", rio->ibuf);
+ rio->devfs = devfs_register(usb_devfs_handle, "rio500",
+ DEVFS_FL_DEFAULT, USB_MAJOR,
+ RIO_MINOR,
+ S_IFCHR | S_IRUSR | S_IWUSR | S_IRGRP |
+ S_IWGRP, &usb_rio_fops, NULL);
+ if (rio->devfs == NULL)
+ dbg("probe_rio: device node registration failed");
+
init_MUTEX(&(rio->lock));
return rio;
@@ -448,6 +469,8 @@
{
struct rio_usb_data *rio = (struct rio_usb_data *) ptr;
+ devfs_unregister(rio->devfs);
+
if (rio->isopen) {
rio->isopen = 0;
/* better let it finish - the release will do whats needed */
@@ -461,15 +484,6 @@
rio->present = 0;
}
-
-static struct
-file_operations usb_rio_fops = {
- read: read_rio,
- write: write_rio,
- ioctl: ioctl_rio,
- open: open_rio,
- release: close_rio,
-};
static struct usb_device_id rio_table [] = {
{ USB_DEVICE(0x0841, 1) }, /* Rio 500 */
next prev parent reply other threads:[~2001-06-25 17:38 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2001-06-19 22:52 Gregory T. Norris
2001-06-24 22:37 ` Gregory T. Norris
2001-06-25 6:16 ` Richard Gooch
2001-06-25 11:43 ` Gregory T. Norris
2001-06-25 17:35 ` Greg KH [this message]
2001-06-25 22:12 ` Gregory T. Norris
2001-06-26 5:07 ` Greg KH
2001-07-01 20:55 ` Gregory T. Norris
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=20010625103521.A17036@kroah.com \
--to=greg@kroah.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-usb-devel@lists.sourceforge.net \
--cc=rio500-devel@lists.sourceforge.net \
/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®