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
fbb3b3eb
Commit
fbb3b3eb
authored
May 06, 2003
by
Greg Kroah-Hartman
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[PATCH] USB: converted usb-skeleton over to new usb_register_dev() changes.
parent
7a3156f2
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
24 deletions
+17
-24
drivers/usb/usb-skeleton.c
drivers/usb/usb-skeleton.c
+17
-24
No files found.
drivers/usb/usb-skeleton.c
View file @
fbb3b3eb
/*
* USB Skeleton driver - 1.
0
* USB Skeleton driver - 1.
1
*
* Copyright (c) 2001-2002 Greg Kroah-Hartman (greg@kroah.com)
*
...
...
@@ -18,6 +18,7 @@
*
* History:
*
* 2003-05-06 - 1.1 - changes due to usb core changes with usb_register_dev()
* 2003-02-25 - 1.0 - fix races involving urb->status, unlink_urb(), and
* disconnect. Fix transfer amount in read(). Use
* macros instead of magic numbers in probe(). Change
...
...
@@ -47,7 +48,6 @@
#include <linux/module.h>
#include <linux/smp_lock.h>
#include <linux/completion.h>
#include <linux/devfs_fs_kernel.h>
#include <asm/uaccess.h>
#include <linux/usb.h>
...
...
@@ -159,6 +159,16 @@ static struct file_operations skel_fops = {
.
release
=
skel_release
,
};
/*
* usb class driver info in order to get a minor number from the usb core,
* and to have the device registered with devfs and the driver core
*/
static
struct
usb_class_driver
skell_class
=
{
.
name
=
"usb/skel%d"
,
.
fops
=
&
skel_fops
,
.
mode
=
S_IFCHR
|
S_IRUSR
|
S_IWUSR
|
S_IRGRP
|
S_IWGRP
|
S_IROTH
,
.
minor_base
=
USB_SKEL_MINOR_BASE
,
};
/* usb specific object needed to register this driver with the usb subsystem */
static
struct
usb_driver
skel_driver
=
{
...
...
@@ -493,7 +503,6 @@ static int skel_probe(struct usb_interface *interface, const struct usb_device_i
struct
usb_skel
*
dev
=
NULL
;
struct
usb_host_interface
*
iface_desc
;
struct
usb_endpoint_descriptor
*
endpoint
;
int
minor
;
size_t
buffer_size
;
int
i
;
int
retval
;
...
...
@@ -506,7 +515,7 @@ static int skel_probe(struct usb_interface *interface, const struct usb_device_i
return
-
ENODEV
;
}
retval
=
usb_register_dev
(
&
skel_fops
,
USB_SKEL_MINOR_BASE
,
1
,
&
minor
);
retval
=
usb_register_dev
(
intf
,
&
skel_class
);
if
(
retval
)
{
/* something prevented us from registering this driver */
err
(
"Not able to get a minor for this device."
);
...
...
@@ -524,7 +533,7 @@ static int skel_probe(struct usb_interface *interface, const struct usb_device_i
init_MUTEX
(
&
dev
->
sem
);
dev
->
udev
=
udev
;
dev
->
interface
=
interface
;
dev
->
minor
=
minor
;
dev
->
minor
=
intf
->
minor
;
/* set up the endpoint information */
/* check out the endpoints */
...
...
@@ -591,22 +600,9 @@ static int skel_probe(struct usb_interface *interface, const struct usb_device_i
goto
error
;
}
/* initialize the devfs node for this device and register it */
sprintf
(
name
,
"usb/skel%d"
,
dev
->
minor
);
devfs
=
devfs_register
(
NULL
,
name
,
DEVFS_FL_DEFAULT
,
USB_MAJOR
,
dev
->
minor
,
S_IFCHR
|
S_IRUSR
|
S_IWUSR
|
S_IRGRP
|
S_IWGRP
|
S_IROTH
,
&
skel_fops
,
NULL
);
/* let the user know what node this device is now attached to */
info
(
"USB Skeleton device now attached to USBSkel-%d"
,
dev
->
minor
);
/* set the minor of the interface, so open() works */
interface
->
minor
=
dev
->
minor
;
goto
exit
;
error:
...
...
@@ -614,7 +610,7 @@ static int skel_probe(struct usb_interface *interface, const struct usb_device_i
dev
=
NULL
;
exit_minor:
usb_deregister_dev
(
1
,
minor
);
usb_deregister_dev
(
intf
,
&
skel_class
);
exit:
if
(
dev
)
{
...
...
@@ -657,11 +653,8 @@ static void skel_disconnect(struct usb_interface *interface)
minor
=
dev
->
minor
;
/* remove our devfs node */
devfs_remove
(
"usb/skel%d"
,
dev
->
minor
);
/* give back our dynamic minor */
usb_deregister_dev
(
1
,
minor
);
/* give back our minor */
usb_deregister_dev
(
intf
,
&
skel_class
);
/* terminate an ongoing write */
if
(
atomic_read
(
&
dev
->
write_busy
))
{
...
...
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