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
1b21d5e1
Commit
1b21d5e1
authored
Aug 28, 2006
by
Greg Kroah-Hartman
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
USB: fix __must_check warnings in drivers/usb/core/
Signed-off-by:
Greg Kroah-Hartman
<
gregkh@suse.de
>
parent
592fbbe4
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
80 additions
and
29 deletions
+80
-29
drivers/usb/core/devio.c
drivers/usb/core/devio.c
+1
-1
drivers/usb/core/driver.c
drivers/usb/core/driver.c
+7
-3
drivers/usb/core/endpoint.c
drivers/usb/core/endpoint.c
+22
-8
drivers/usb/core/sysfs.c
drivers/usb/core/sysfs.c
+43
-12
drivers/usb/core/usb.c
drivers/usb/core/usb.c
+4
-2
drivers/usb/core/usb.h
drivers/usb/core/usb.h
+3
-3
No files found.
drivers/usb/core/devio.c
View file @
1b21d5e1
...
@@ -1359,7 +1359,7 @@ static int proc_ioctl(struct dev_state *ps, struct usbdevfs_ioctl *ctl)
...
@@ -1359,7 +1359,7 @@ static int proc_ioctl(struct dev_state *ps, struct usbdevfs_ioctl *ctl)
/* let kernel drivers try to (re)bind to the interface */
/* let kernel drivers try to (re)bind to the interface */
case
USBDEVFS_CONNECT
:
case
USBDEVFS_CONNECT
:
usb_unlock_device
(
ps
->
dev
);
usb_unlock_device
(
ps
->
dev
);
bus_rescan_devices
(
intf
->
dev
.
bus
);
retval
=
bus_rescan_devices
(
intf
->
dev
.
bus
);
usb_lock_device
(
ps
->
dev
);
usb_lock_device
(
ps
->
dev
);
break
;
break
;
...
...
drivers/usb/core/driver.c
View file @
1b21d5e1
...
@@ -49,6 +49,7 @@ static ssize_t store_new_id(struct device_driver *driver,
...
@@ -49,6 +49,7 @@ static ssize_t store_new_id(struct device_driver *driver,
u32
idVendor
=
0
;
u32
idVendor
=
0
;
u32
idProduct
=
0
;
u32
idProduct
=
0
;
int
fields
=
0
;
int
fields
=
0
;
int
retval
=
0
;
fields
=
sscanf
(
buf
,
"%x %x"
,
&
idVendor
,
&
idProduct
);
fields
=
sscanf
(
buf
,
"%x %x"
,
&
idVendor
,
&
idProduct
);
if
(
fields
<
2
)
if
(
fields
<
2
)
...
@@ -68,10 +69,12 @@ static ssize_t store_new_id(struct device_driver *driver,
...
@@ -68,10 +69,12 @@ static ssize_t store_new_id(struct device_driver *driver,
spin_unlock
(
&
usb_drv
->
dynids
.
lock
);
spin_unlock
(
&
usb_drv
->
dynids
.
lock
);
if
(
get_driver
(
driver
))
{
if
(
get_driver
(
driver
))
{
driver_attach
(
driver
);
retval
=
driver_attach
(
driver
);
put_driver
(
driver
);
put_driver
(
driver
);
}
}
if
(
retval
)
return
retval
;
return
count
;
return
count
;
}
}
static
DRIVER_ATTR
(
new_id
,
S_IWUSR
,
NULL
,
store_new_id
);
static
DRIVER_ATTR
(
new_id
,
S_IWUSR
,
NULL
,
store_new_id
);
...
@@ -291,6 +294,7 @@ int usb_driver_claim_interface(struct usb_driver *driver,
...
@@ -291,6 +294,7 @@ int usb_driver_claim_interface(struct usb_driver *driver,
{
{
struct
device
*
dev
=
&
iface
->
dev
;
struct
device
*
dev
=
&
iface
->
dev
;
struct
usb_device
*
udev
=
interface_to_usbdev
(
iface
);
struct
usb_device
*
udev
=
interface_to_usbdev
(
iface
);
int
retval
=
0
;
if
(
dev
->
driver
)
if
(
dev
->
driver
)
return
-
EBUSY
;
return
-
EBUSY
;
...
@@ -308,9 +312,9 @@ int usb_driver_claim_interface(struct usb_driver *driver,
...
@@ -308,9 +312,9 @@ int usb_driver_claim_interface(struct usb_driver *driver,
* the future device_add() bind it, bypassing probe()
* the future device_add() bind it, bypassing probe()
*/
*/
if
(
device_is_registered
(
dev
))
if
(
device_is_registered
(
dev
))
device_bind_driver
(
dev
);
retval
=
device_bind_driver
(
dev
);
return
0
;
return
retval
;
}
}
EXPORT_SYMBOL
(
usb_driver_claim_interface
);
EXPORT_SYMBOL
(
usb_driver_claim_interface
);
...
...
drivers/usb/core/endpoint.c
View file @
1b21d5e1
...
@@ -207,9 +207,9 @@ static void ep_device_release(struct device *dev)
...
@@ -207,9 +207,9 @@ static void ep_device_release(struct device *dev)
kfree
(
ep_dev
);
kfree
(
ep_dev
);
}
}
void
usb_create_ep_files
(
struct
device
*
parent
,
int
usb_create_ep_files
(
struct
device
*
parent
,
struct
usb_host_endpoint
*
endpoint
,
struct
usb_host_endpoint
*
endpoint
,
struct
usb_device
*
udev
)
struct
usb_device
*
udev
)
{
{
char
name
[
8
];
char
name
[
8
];
struct
ep_device
*
ep_dev
;
struct
ep_device
*
ep_dev
;
...
@@ -242,19 +242,33 @@ void usb_create_ep_files(struct device *parent,
...
@@ -242,19 +242,33 @@ void usb_create_ep_files(struct device *parent,
retval
=
device_register
(
&
ep_dev
->
dev
);
retval
=
device_register
(
&
ep_dev
->
dev
);
if
(
retval
)
if
(
retval
)
goto
error
;
goto
error
;
sysfs_create_group
(
&
ep_dev
->
dev
.
kobj
,
&
ep_dev_attr_grp
);
retval
=
sysfs_create_group
(
&
ep_dev
->
dev
.
kobj
,
&
ep_dev_attr_grp
);
if
(
retval
)
goto
error_group
;
endpoint
->
ep_dev
=
ep_dev
;
endpoint
->
ep_dev
=
ep_dev
;
/* create the symlink to the old-style "ep_XX" directory */
/* create the symlink to the old-style "ep_XX" directory */
sprintf
(
name
,
"ep_%02x"
,
endpoint
->
desc
.
bEndpointAddress
);
sprintf
(
name
,
"ep_%02x"
,
endpoint
->
desc
.
bEndpointAddress
);
sysfs_create_link
(
&
parent
->
kobj
,
&
endpoint
->
ep_dev
->
dev
.
kobj
,
name
);
retval
=
sysfs_create_link
(
&
parent
->
kobj
,
&
endpoint
->
ep_dev
->
dev
.
kobj
,
name
);
if
(
retval
)
goto
error_link
;
exit:
exit:
return
;
return
retval
;
error_link:
sysfs_remove_group
(
&
ep_dev
->
dev
.
kobj
,
&
ep_dev_attr_grp
);
error_group:
device_unregister
(
&
ep_dev
->
dev
);
endpoint
->
ep_dev
=
NULL
;
destroy_endpoint_class
();
return
retval
;
error:
error:
kfree
(
ep_dev
);
kfree
(
ep_dev
);
return
;
destroy_endpoint_class
();
return
retval
;
}
}
void
usb_remove_ep_files
(
struct
usb_host_endpoint
*
endpoint
)
void
usb_remove_ep_files
(
struct
usb_host_endpoint
*
endpoint
)
...
...
drivers/usb/core/sysfs.c
View file @
1b21d5e1
...
@@ -210,19 +210,40 @@ static struct attribute_group dev_attr_grp = {
...
@@ -210,19 +210,40 @@ static struct attribute_group dev_attr_grp = {
.
attrs
=
dev_attrs
,
.
attrs
=
dev_attrs
,
};
};
void
usb_create_sysfs_dev_files
(
struct
usb_device
*
udev
)
int
usb_create_sysfs_dev_files
(
struct
usb_device
*
udev
)
{
{
struct
device
*
dev
=
&
udev
->
dev
;
struct
device
*
dev
=
&
udev
->
dev
;
int
retval
;
sysfs_create_group
(
&
dev
->
kobj
,
&
dev_attr_grp
);
retval
=
sysfs_create_group
(
&
dev
->
kobj
,
&
dev_attr_grp
);
if
(
retval
)
return
retval
;
if
(
udev
->
manufacturer
)
if
(
udev
->
manufacturer
)
{
device_create_file
(
dev
,
&
dev_attr_manufacturer
);
retval
=
device_create_file
(
dev
,
&
dev_attr_manufacturer
);
if
(
udev
->
product
)
if
(
retval
)
device_create_file
(
dev
,
&
dev_attr_product
);
goto
error
;
if
(
udev
->
serial
)
}
device_create_file
(
dev
,
&
dev_attr_serial
);
if
(
udev
->
product
)
{
usb_create_ep_files
(
dev
,
&
udev
->
ep0
,
udev
);
retval
=
device_create_file
(
dev
,
&
dev_attr_product
);
if
(
retval
)
goto
error
;
}
if
(
udev
->
serial
)
{
retval
=
device_create_file
(
dev
,
&
dev_attr_serial
);
if
(
retval
)
goto
error
;
}
retval
=
usb_create_ep_files
(
dev
,
&
udev
->
ep0
,
udev
);
if
(
retval
)
goto
error
;
return
0
;
error:
usb_remove_ep_files
(
&
udev
->
ep0
);
device_remove_file
(
dev
,
&
dev_attr_manufacturer
);
device_remove_file
(
dev
,
&
dev_attr_product
);
device_remove_file
(
dev
,
&
dev_attr_serial
);
return
retval
;
}
}
void
usb_remove_sysfs_dev_files
(
struct
usb_device
*
udev
)
void
usb_remove_sysfs_dev_files
(
struct
usb_device
*
udev
)
...
@@ -339,18 +360,28 @@ static inline void usb_remove_intf_ep_files(struct usb_interface *intf)
...
@@ -339,18 +360,28 @@ static inline void usb_remove_intf_ep_files(struct usb_interface *intf)
usb_remove_ep_files
(
&
iface_desc
->
endpoint
[
i
]);
usb_remove_ep_files
(
&
iface_desc
->
endpoint
[
i
]);
}
}
void
usb_create_sysfs_intf_files
(
struct
usb_interface
*
intf
)
int
usb_create_sysfs_intf_files
(
struct
usb_interface
*
intf
)
{
{
struct
usb_device
*
udev
=
interface_to_usbdev
(
intf
);
struct
usb_device
*
udev
=
interface_to_usbdev
(
intf
);
struct
usb_host_interface
*
alt
=
intf
->
cur_altsetting
;
struct
usb_host_interface
*
alt
=
intf
->
cur_altsetting
;
int
retval
;
sysfs_create_group
(
&
intf
->
dev
.
kobj
,
&
intf_attr_grp
);
retval
=
sysfs_create_group
(
&
intf
->
dev
.
kobj
,
&
intf_attr_grp
);
if
(
retval
)
goto
error
;
if
(
alt
->
string
==
NULL
)
if
(
alt
->
string
==
NULL
)
alt
->
string
=
usb_cache_string
(
udev
,
alt
->
desc
.
iInterface
);
alt
->
string
=
usb_cache_string
(
udev
,
alt
->
desc
.
iInterface
);
if
(
alt
->
string
)
if
(
alt
->
string
)
device_create_file
(
&
intf
->
dev
,
&
dev_attr_interface
);
retval
=
device_create_file
(
&
intf
->
dev
,
&
dev_attr_interface
);
usb_create_intf_ep_files
(
intf
,
udev
);
usb_create_intf_ep_files
(
intf
,
udev
);
return
0
;
error:
if
(
alt
->
string
)
device_remove_file
(
&
intf
->
dev
,
&
dev_attr_interface
);
sysfs_remove_group
(
&
intf
->
dev
.
kobj
,
&
intf_attr_grp
);
usb_remove_intf_ep_files
(
intf
);
return
retval
;
}
}
void
usb_remove_sysfs_intf_files
(
struct
usb_interface
*
intf
)
void
usb_remove_sysfs_intf_files
(
struct
usb_interface
*
intf
)
...
...
drivers/usb/core/usb.c
View file @
1b21d5e1
...
@@ -147,11 +147,13 @@ static int __find_interface(struct device * dev, void * data)
...
@@ -147,11 +147,13 @@ static int __find_interface(struct device * dev, void * data)
struct
usb_interface
*
usb_find_interface
(
struct
usb_driver
*
drv
,
int
minor
)
struct
usb_interface
*
usb_find_interface
(
struct
usb_driver
*
drv
,
int
minor
)
{
{
struct
find_interface_arg
argb
;
struct
find_interface_arg
argb
;
int
retval
;
argb
.
minor
=
minor
;
argb
.
minor
=
minor
;
argb
.
interface
=
NULL
;
argb
.
interface
=
NULL
;
driver_for_each_device
(
&
drv
->
drvwrap
.
driver
,
NULL
,
&
argb
,
/* eat the error, it will be in argb.interface */
__find_interface
);
retval
=
driver_for_each_device
(
&
drv
->
drvwrap
.
driver
,
NULL
,
&
argb
,
__find_interface
);
return
argb
.
interface
;
return
argb
.
interface
;
}
}
...
...
drivers/usb/core/usb.h
View file @
1b21d5e1
/* Functions local to drivers/usb/core/ */
/* Functions local to drivers/usb/core/ */
extern
void
usb_create_sysfs_dev_files
(
struct
usb_device
*
dev
);
extern
int
usb_create_sysfs_dev_files
(
struct
usb_device
*
dev
);
extern
void
usb_remove_sysfs_dev_files
(
struct
usb_device
*
dev
);
extern
void
usb_remove_sysfs_dev_files
(
struct
usb_device
*
dev
);
extern
void
usb_create_sysfs_intf_files
(
struct
usb_interface
*
intf
);
extern
int
usb_create_sysfs_intf_files
(
struct
usb_interface
*
intf
);
extern
void
usb_remove_sysfs_intf_files
(
struct
usb_interface
*
intf
);
extern
void
usb_remove_sysfs_intf_files
(
struct
usb_interface
*
intf
);
extern
void
usb_create_ep_files
(
struct
device
*
parent
,
struct
usb_host_endpoint
*
endpoint
,
extern
int
usb_create_ep_files
(
struct
device
*
parent
,
struct
usb_host_endpoint
*
endpoint
,
struct
usb_device
*
udev
);
struct
usb_device
*
udev
);
extern
void
usb_remove_ep_files
(
struct
usb_host_endpoint
*
endpoint
);
extern
void
usb_remove_ep_files
(
struct
usb_host_endpoint
*
endpoint
);
...
...
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