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
60bd3b5e
Commit
60bd3b5e
authored
Nov 30, 2002
by
Oliver Neukum
Committed by
Greg Kroah-Hartman
Nov 30, 2002
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[PATCH] - cleanup for new module primitives
parent
24dd2623
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
19 additions
and
27 deletions
+19
-27
drivers/usb/core/devio.c
drivers/usb/core/devio.c
+7
-9
drivers/usb/core/usb.c
drivers/usb/core/usb.c
+12
-18
No files found.
drivers/usb/core/devio.c
View file @
60bd3b5e
...
@@ -860,7 +860,7 @@ static int proc_submiturb(struct dev_state *ps, void *arg)
...
@@ -860,7 +860,7 @@ static int proc_submiturb(struct dev_state *ps, void *arg)
if
(
uurb
.
buffer_length
>
16384
)
if
(
uurb
.
buffer_length
>
16384
)
return
-
EINVAL
;
return
-
EINVAL
;
if
(
!
access_ok
((
uurb
.
endpoint
&
USB_DIR_IN
)
?
VERIFY_WRITE
:
VERIFY_READ
,
uurb
.
buffer
,
uurb
.
buffer_length
))
if
(
!
access_ok
((
uurb
.
endpoint
&
USB_DIR_IN
)
?
VERIFY_WRITE
:
VERIFY_READ
,
uurb
.
buffer
,
uurb
.
buffer_length
))
return
-
EFAULT
;
return
-
EFAULT
;
break
;
break
;
default:
default:
...
@@ -955,10 +955,10 @@ static int processcompl(struct async *as)
...
@@ -955,10 +955,10 @@ static int processcompl(struct async *as)
if
(
!
(
usb_pipeisoc
(
urb
->
pipe
)))
if
(
!
(
usb_pipeisoc
(
urb
->
pipe
)))
return
0
;
return
0
;
for
(
i
=
0
;
i
<
urb
->
number_of_packets
;
i
++
)
{
for
(
i
=
0
;
i
<
urb
->
number_of_packets
;
i
++
)
{
if
(
put_user
(
urb
->
iso_frame_desc
[
i
].
actual_length
,
if
(
put_user
(
urb
->
iso_frame_desc
[
i
].
actual_length
,
&
((
struct
usbdevfs_urb
*
)
as
->
userurb
)
->
iso_frame_desc
[
i
].
actual_length
))
&
((
struct
usbdevfs_urb
*
)
as
->
userurb
)
->
iso_frame_desc
[
i
].
actual_length
))
return
-
EFAULT
;
return
-
EFAULT
;
if
(
put_user
(
urb
->
iso_frame_desc
[
i
].
status
,
if
(
put_user
(
urb
->
iso_frame_desc
[
i
].
status
,
&
((
struct
usbdevfs_urb
*
)
as
->
userurb
)
->
iso_frame_desc
[
i
].
status
))
&
((
struct
usbdevfs_urb
*
)
as
->
userurb
)
->
iso_frame_desc
[
i
].
status
))
return
-
EFAULT
;
return
-
EFAULT
;
}
}
...
@@ -1122,18 +1122,16 @@ static int proc_ioctl (struct dev_state *ps, void *arg)
...
@@ -1122,18 +1122,16 @@ static int proc_ioctl (struct dev_state *ps, void *arg)
unlock_kernel
();
unlock_kernel
();
retval
=
-
ENOSYS
;
retval
=
-
ENOSYS
;
}
else
{
}
else
{
if
(
driver
->
owner
if
(
!
try_module_get
(
driver
->
owner
))
{
&&
!
try_inc_mod_count
(
driver
->
owner
))
{
unlock_kernel
();
unlock_kernel
();
retval
=
-
ENOSYS
;
retval
=
-
ENOSYS
;
break
;
break
;
}
}
unlock_kernel
();
unlock_kernel
();
retval
=
driver
->
ioctl
(
ifp
,
ctrl
.
ioctl_code
,
buf
);
retval
=
driver
->
ioctl
(
ifp
,
ctrl
.
ioctl_code
,
buf
);
if
(
driver
->
owner
)
put_module
(
driver
->
owner
);
__MOD_DEC_USE_COUNT
(
driver
->
owner
);
}
}
if
(
retval
==
-
ENOIOCTLCMD
)
if
(
retval
==
-
ENOIOCTLCMD
)
retval
=
-
ENOTTY
;
retval
=
-
ENOTTY
;
}
}
...
@@ -1188,7 +1186,7 @@ static int usbdev_ioctl(struct inode *inode, struct file *file, unsigned int cmd
...
@@ -1188,7 +1186,7 @@ static int usbdev_ioctl(struct inode *inode, struct file *file, unsigned int cmd
case
USBDEVFS_RESET
:
case
USBDEVFS_RESET
:
ret
=
proc_resetdevice
(
ps
);
ret
=
proc_resetdevice
(
ps
);
break
;
break
;
case
USBDEVFS_CLEAR_HALT
:
case
USBDEVFS_CLEAR_HALT
:
ret
=
proc_clearhalt
(
ps
,
(
void
*
)
arg
);
ret
=
proc_clearhalt
(
ps
,
(
void
*
)
arg
);
if
(
ret
>=
0
)
if
(
ret
>=
0
)
...
...
drivers/usb/core/usb.c
View file @
60bd3b5e
...
@@ -69,7 +69,8 @@ static struct device_driver usb_generic_driver = {
...
@@ -69,7 +69,8 @@ static struct device_driver usb_generic_driver = {
.
probe
=
generic_probe
,
.
probe
=
generic_probe
,
.
remove
=
generic_remove
,
.
remove
=
generic_remove
,
};
};
/* needs to be called with BKL held */
int
usb_device_probe
(
struct
device
*
dev
)
int
usb_device_probe
(
struct
device
*
dev
)
{
{
struct
usb_interface
*
intf
=
to_usb_interface
(
dev
);
struct
usb_interface
*
intf
=
to_usb_interface
(
dev
);
...
@@ -83,11 +84,8 @@ int usb_device_probe(struct device *dev)
...
@@ -83,11 +84,8 @@ int usb_device_probe(struct device *dev)
if
(
!
driver
->
probe
)
if
(
!
driver
->
probe
)
return
error
;
return
error
;
if
(
driver
->
owner
)
{
if
(
!
try_module_get
(
driver
->
owner
))
m
=
try_inc_mod_count
(
driver
->
owner
);
return
error
;
if
(
m
==
0
)
return
error
;
}
id
=
usb_match_id
(
intf
,
driver
->
id_table
);
id
=
usb_match_id
(
intf
,
driver
->
id_table
);
if
(
id
)
{
if
(
id
)
{
...
@@ -99,8 +97,7 @@ int usb_device_probe(struct device *dev)
...
@@ -99,8 +97,7 @@ int usb_device_probe(struct device *dev)
if
(
!
error
)
if
(
!
error
)
intf
->
driver
=
driver
;
intf
->
driver
=
driver
;
if
(
driver
->
owner
)
put_module
(
driver
->
owner
);
__MOD_DEC_USE_COUNT
(
driver
->
owner
);
return
error
;
return
error
;
}
}
...
@@ -120,14 +117,12 @@ int usb_device_remove(struct device *dev)
...
@@ -120,14 +117,12 @@ int usb_device_remove(struct device *dev)
return
-
ENODEV
;
return
-
ENODEV
;
}
}
if
(
driver
->
owner
)
{
m
=
try_module_get
(
driver
->
owner
);
m
=
try_inc_mod_count
(
driver
->
owner
);
if
(
m
==
0
)
{
if
(
m
==
0
)
{
// FIXME this happens even when we just rmmod
// FIXME this happens even when we just rmmod
// drivers that aren't in active use...
// drivers that aren't in active use...
err
(
"Dieing driver still bound to device.
\n
"
);
err
(
"Dieing driver still bound to device.
\n
"
);
return
-
EIO
;
return
-
EIO
;
}
}
}
/* if we sleep here on an umanaged driver
/* if we sleep here on an umanaged driver
...
@@ -143,8 +138,7 @@ int usb_device_remove(struct device *dev)
...
@@ -143,8 +138,7 @@ int usb_device_remove(struct device *dev)
usb_driver_release_interface
(
driver
,
intf
);
usb_driver_release_interface
(
driver
,
intf
);
up
(
&
driver
->
serialize
);
up
(
&
driver
->
serialize
);
if
(
driver
->
owner
)
module_put
(
driver
->
owner
)
__MOD_DEC_USE_COUNT
(
driver
->
owner
);
return
0
;
return
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