Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
L
linux
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
linux
Commits
b41c55be
Commit
b41c55be
authored
May 06, 2003
by
Greg Kroah-Hartman
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[PATCH] USB: converted auerswald over to new usb_register_dev() changes.
parent
ced55da1
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
51 deletions
+20
-51
drivers/usb/misc/auerswald.c
drivers/usb/misc/auerswald.c
+20
-51
No files found.
drivers/usb/misc/auerswald.c
View file @
b41c55be
...
...
@@ -29,7 +29,6 @@
#include <linux/slab.h>
#include <linux/module.h>
#include <linux/init.h>
#include <linux/devfs_fs_kernel.h>
#undef DEBUG
/* include debug macros until it's done */
#include <linux/usb.h>
...
...
@@ -60,16 +59,10 @@ do { \
/* Auerswald Vendor ID */
#define ID_AUERSWALD 0x09BF
#ifdef CONFIG_USB_DYNAMIC_MINORS
/* we can have up to 256 devices at once */
#define AUER_MINOR_BASE 0
#define AUER_MAX_DEVICES 256
#else
#define AUER_MINOR_BASE 112
/* auerswald driver minor number */
/* we can have up to this number of device plugged in at once */
#define AUER_MAX_DEVICES 16
#endif
/* Number of read buffers for each device */
...
...
@@ -256,12 +249,6 @@ typedef struct
wait_queue_head_t
bufferwait
;
/* wait for a control buffer */
}
auerswald_t
,
*
pauerswald_t
;
/* array of pointers to our devices that are currently connected */
static
pauerswald_t
dev_table
[
AUER_MAX_DEVICES
];
/* lock to protect the dev_table structure */
static
struct
semaphore
dev_table_mutex
;
/* ................................................................... */
/* character device context */
typedef
struct
...
...
@@ -1384,29 +1371,29 @@ static void auerswald_removeservice (pauerswald_t cp, pauerscon_t scp)
/* Open a new character device */
static
int
auerchar_open
(
struct
inode
*
inode
,
struct
file
*
file
)
{
int
dtindex
=
minor
(
inode
->
i_rdev
)
-
AUER_MINOR_BASE
;
int
dtindex
=
minor
(
inode
->
i_rdev
);
pauerswald_t
cp
=
NULL
;
pauerchar_t
ccp
=
NULL
;
struct
usb_interface
*
intf
;
int
ret
;
/* minor number in range? */
if
(
(
dtindex
<
0
)
||
(
dtindex
>=
AUER_MAX_DEVICES
)
)
{
if
(
dtindex
<
0
)
{
return
-
ENODEV
;
}
/* usb device available? */
if
(
down_interruptible
(
&
dev_table_mutex
)
)
{
return
-
E
RESTARTSYS
;
intf
=
usb_find_interface
(
&
auerswald_driver
,
dtindex
);
if
(
!
intf
)
{
return
-
E
NODEV
;
}
cp
=
dev_table
[
dtindex
];
/* usb device available? */
cp
=
usb_get_intfdata
(
intf
);
if
(
cp
==
NULL
)
{
up
(
&
dev_table_mutex
);
return
-
ENODEV
;
}
if
(
down_interruptible
(
&
cp
->
mutex
))
{
up
(
&
dev_table_mutex
);
return
-
ERESTARTSYS
;
}
up
(
&
dev_table_mutex
);
/* we have access to the device. Now lets allocate memory */
ccp
=
(
pauerchar_t
)
kmalloc
(
sizeof
(
auerchar_t
),
GFP_KERNEL
);
...
...
@@ -1895,6 +1882,13 @@ static struct file_operations auerswald_fops =
.
release
=
auerchar_release
,
};
static
struct
usb_class_driver
auerswald_class
=
{
.
name
=
"usb/auer%d"
,
.
fops
=
&
auerswald_fops
,
.
mode
=
S_IFCHR
|
S_IRUGO
|
S_IWUGO
,
.
minor_base
=
AUER_MINOR_BASE
,
};
/* --------------------------------------------------------------------- */
/* Special USB driver functions */
...
...
@@ -1923,7 +1917,6 @@ static int auerswald_probe (struct usb_interface *intf,
struct
usb_device
*
usbdev
=
interface_to_usbdev
(
intf
);
pauerswald_t
cp
=
NULL
;
DECLARE_WAIT_QUEUE_HEAD
(
wqh
);
unsigned
int
dtindex
;
unsigned
int
u
=
0
;
char
*
pbuf
;
int
ret
;
...
...
@@ -1954,27 +1947,17 @@ static int auerswald_probe (struct usb_interface *intf,
auerbuf_init
(
&
cp
->
bufctl
);
init_waitqueue_head
(
&
cp
->
bufferwait
);
down
(
&
dev_table_mutex
);
ret
=
usb_register_dev
(
&
auerswald_fops
,
AUER_MINOR_BASE
,
1
,
&
dtindex
);
ret
=
usb_register_dev
(
intf
,
&
auerswald_class
);
if
(
ret
)
{
err
(
"Not able to get a minor for this device."
);
up
(
&
dev_table_mutex
);
goto
pfail
;
}
/* Give the device a name */
sprintf
(
cp
->
name
,
"usb/auer%d"
,
dtindex
);
sprintf
(
cp
->
name
,
"usb/auer%d"
,
intf
->
minor
);
/* Store the index */
cp
->
dtindex
=
dtindex
;
dev_table
[
dtindex
]
=
cp
;
up
(
&
dev_table_mutex
);
/* initialize the devfs node for this device and register it */
devfs_register
(
NULL
,
cp
->
name
,
0
,
USB_MAJOR
,
AUER_MINOR_BASE
+
dtindex
,
S_IFCHR
|
S_IRUGO
|
S_IWUGO
,
&
auerswald_fops
,
NULL
);
cp
->
dtindex
=
intf
->
minor
;
/* Get the usb version of the device */
cp
->
version
=
cp
->
usbdev
->
descriptor
.
bcdDevice
;
...
...
@@ -2083,18 +2066,8 @@ static void auerswald_disconnect (struct usb_interface *intf)
down
(
&
cp
->
mutex
);
info
(
"device /dev/%s now disconnecting"
,
cp
->
name
);
/* remove from device table */
/* Nobody can open() this device any more */
down
(
&
dev_table_mutex
);
dev_table
[
cp
->
dtindex
]
=
NULL
;
up
(
&
dev_table_mutex
);
/* remove our devfs node */
/* Nobody can see this device any more */
devfs_remove
(
cp
->
name
);
/* give back our USB minor number */
usb_deregister_dev
(
1
,
cp
->
dtindex
);
usb_deregister_dev
(
intf
,
&
auerswald_class
);
/* Stop the interrupt endpoint */
auerswald_int_release
(
cp
);
...
...
@@ -2163,10 +2136,6 @@ static int __init auerswald_init (void)
int
result
;
dbg
(
"init"
);
/* initialize the device table */
memset
(
&
dev_table
,
0
,
sizeof
(
dev_table
));
init_MUTEX
(
&
dev_table_mutex
);
/* register driver at the USB subsystem */
result
=
usb_register
(
&
auerswald_driver
);
if
(
result
<
0
)
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment