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
Kirill Smelkov
linux
Commits
7c4dac4f
Commit
7c4dac4f
authored
Sep 26, 2002
by
Greg Kroah-Hartman
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
USB: convert the usb-skeleton.c driver to work with the latest USB core changes.
parent
ce437bff
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
22 additions
and
15 deletions
+22
-15
drivers/usb/usb-skeleton.c
drivers/usb/usb-skeleton.c
+22
-15
No files found.
drivers/usb/usb-skeleton.c
View file @
7c4dac4f
/*
/*
* USB Skeleton driver - 0.
7
* USB Skeleton driver - 0.
8
*
*
* Copyright (c) 2001 Greg Kroah-Hartman (greg@kroah.com)
* Copyright (c) 2001
-2002
Greg Kroah-Hartman (greg@kroah.com)
*
*
* This program is free software; you can redistribute it and/or
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of
* published by the Free Software Foundation, version 2.
* the License, or (at your option) any later version.
*
*
*
*
* This driver is to be used as a skeleton driver to be able to create a
* This driver is to be used as a skeleton driver to be able to create a
...
@@ -22,6 +21,8 @@
...
@@ -22,6 +21,8 @@
*
*
* History:
* History:
*
*
* 2002_09_26 - 0.8 - changes due to USB core conversion to struct device
* driver.
* 2002_02_12 - 0.7 - zero out dev in probe function for devices that do
* 2002_02_12 - 0.7 - zero out dev in probe function for devices that do
* not have both a bulk in and bulk out endpoint.
* not have both a bulk in and bulk out endpoint.
* Thanks to Holger Waechtler for the fix.
* Thanks to Holger Waechtler for the fix.
...
@@ -133,8 +134,8 @@ static int skel_ioctl (struct inode *inode, struct file *file, unsigned int cmd
...
@@ -133,8 +134,8 @@ static int skel_ioctl (struct inode *inode, struct file *file, unsigned int cmd
static
int
skel_open
(
struct
inode
*
inode
,
struct
file
*
file
);
static
int
skel_open
(
struct
inode
*
inode
,
struct
file
*
file
);
static
int
skel_release
(
struct
inode
*
inode
,
struct
file
*
file
);
static
int
skel_release
(
struct
inode
*
inode
,
struct
file
*
file
);
static
void
*
skel_probe
(
struct
usb_device
*
dev
,
unsigned
int
ifnum
,
const
struct
usb_device_id
*
id
);
static
int
skel_probe
(
struct
usb_interface
*
intf
,
const
struct
usb_device_id
*
id
);
static
void
skel_disconnect
(
struct
usb_
device
*
dev
,
void
*
ptr
);
static
void
skel_disconnect
(
struct
usb_
interface
*
intf
);
static
void
skel_write_bulk_callback
(
struct
urb
*
urb
);
static
void
skel_write_bulk_callback
(
struct
urb
*
urb
);
...
@@ -509,10 +510,10 @@ static void skel_write_bulk_callback (struct urb *urb)
...
@@ -509,10 +510,10 @@ static void skel_write_bulk_callback (struct urb *urb)
* Called by the usb core when a new device is connected that it thinks
* Called by the usb core when a new device is connected that it thinks
* this driver might be interested in.
* this driver might be interested in.
*/
*/
static
void
*
skel_probe
(
struct
usb_device
*
udev
,
unsigned
int
ifnum
,
const
struct
usb_device_id
*
id
)
static
int
skel_probe
(
struct
usb_interface
*
interface
,
const
struct
usb_device_id
*
id
)
{
{
struct
usb_device
*
udev
=
interface_to_usbdev
(
interface
);
struct
usb_skel
*
dev
=
NULL
;
struct
usb_skel
*
dev
=
NULL
;
struct
usb_interface
*
interface
;
struct
usb_interface_descriptor
*
iface_desc
;
struct
usb_interface_descriptor
*
iface_desc
;
struct
usb_endpoint_descriptor
*
endpoint
;
struct
usb_endpoint_descriptor
*
endpoint
;
int
minor
;
int
minor
;
...
@@ -525,7 +526,7 @@ static void * skel_probe(struct usb_device *udev, unsigned int ifnum, const stru
...
@@ -525,7 +526,7 @@ static void * skel_probe(struct usb_device *udev, unsigned int ifnum, const stru
/* See if the device offered us matches what we can accept */
/* See if the device offered us matches what we can accept */
if
((
udev
->
descriptor
.
idVendor
!=
USB_SKEL_VENDOR_ID
)
||
if
((
udev
->
descriptor
.
idVendor
!=
USB_SKEL_VENDOR_ID
)
||
(
udev
->
descriptor
.
idProduct
!=
USB_SKEL_PRODUCT_ID
))
{
(
udev
->
descriptor
.
idProduct
!=
USB_SKEL_PRODUCT_ID
))
{
return
NULL
;
return
-
ENODEV
;
}
}
down
(
&
minor_table_mutex
);
down
(
&
minor_table_mutex
);
...
@@ -545,8 +546,6 @@ static void * skel_probe(struct usb_device *udev, unsigned int ifnum, const stru
...
@@ -545,8 +546,6 @@ static void * skel_probe(struct usb_device *udev, unsigned int ifnum, const stru
memset
(
dev
,
0x00
,
sizeof
(
*
dev
));
memset
(
dev
,
0x00
,
sizeof
(
*
dev
));
minor_table
[
minor
]
=
dev
;
minor_table
[
minor
]
=
dev
;
interface
=
&
udev
->
actconfig
->
interface
[
ifnum
];
init_MUTEX
(
&
dev
->
sem
);
init_MUTEX
(
&
dev
->
sem
);
dev
->
udev
=
udev
;
dev
->
udev
=
udev
;
dev
->
interface
=
interface
;
dev
->
interface
=
interface
;
...
@@ -619,7 +618,11 @@ static void * skel_probe(struct usb_device *udev, unsigned int ifnum, const stru
...
@@ -619,7 +618,11 @@ static void * skel_probe(struct usb_device *udev, unsigned int ifnum, const stru
exit:
exit:
up
(
&
minor_table_mutex
);
up
(
&
minor_table_mutex
);
return
dev
;
if
(
dev
)
{
dev_set_drvdata
(
&
interface
->
dev
,
dev
);
return
0
;
}
return
-
ENODEV
;
}
}
...
@@ -628,13 +631,17 @@ static void * skel_probe(struct usb_device *udev, unsigned int ifnum, const stru
...
@@ -628,13 +631,17 @@ static void * skel_probe(struct usb_device *udev, unsigned int ifnum, const stru
*
*
* Called by the usb core when the device is removed from the system.
* Called by the usb core when the device is removed from the system.
*/
*/
static
void
skel_disconnect
(
struct
usb_
device
*
udev
,
void
*
ptr
)
static
void
skel_disconnect
(
struct
usb_
interface
*
interface
)
{
{
struct
usb_skel
*
dev
;
struct
usb_skel
*
dev
;
int
minor
;
int
minor
;
dev
=
(
struct
usb_skel
*
)
ptr
;
dev
=
dev_get_drvdata
(
&
interface
->
dev
);
dev_set_drvdata
(
&
interface
->
dev
,
NULL
);
if
(
!
dev
)
return
;
down
(
&
minor_table_mutex
);
down
(
&
minor_table_mutex
);
down
(
&
dev
->
sem
);
down
(
&
dev
->
sem
);
...
...
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