Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xiphi1978
linux
提交
1b21d5e1
L
linux
项目概览
xiphi1978
/
linux
通知
2
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
L
linux
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
1b21d5e1
编写于
8月 28, 2006
作者:
G
Greg Kroah-Hartman
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
USB: fix __must_check warnings in drivers/usb/core/
Signed-off-by:
N
Greg Kroah-Hartman
<
gregkh@suse.de
>
上级
592fbbe4
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
80 addition
and
29 deletion
+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
未找到文件。
drivers/usb/core/devio.c
浏览文件 @
1b21d5e1
...
...
@@ -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 */
case
USBDEVFS_CONNECT
:
usb_unlock_device
(
ps
->
dev
);
bus_rescan_devices
(
intf
->
dev
.
bus
);
retval
=
bus_rescan_devices
(
intf
->
dev
.
bus
);
usb_lock_device
(
ps
->
dev
);
break
;
...
...
drivers/usb/core/driver.c
浏览文件 @
1b21d5e1
...
...
@@ -49,6 +49,7 @@ static ssize_t store_new_id(struct device_driver *driver,
u32
idVendor
=
0
;
u32
idProduct
=
0
;
int
fields
=
0
;
int
retval
=
0
;
fields
=
sscanf
(
buf
,
"%x %x"
,
&
idVendor
,
&
idProduct
);
if
(
fields
<
2
)
...
...
@@ -68,10 +69,12 @@ static ssize_t store_new_id(struct device_driver *driver,
spin_unlock
(
&
usb_drv
->
dynids
.
lock
);
if
(
get_driver
(
driver
))
{
driver_attach
(
driver
);
retval
=
driver_attach
(
driver
);
put_driver
(
driver
);
}
if
(
retval
)
return
retval
;
return
count
;
}
static
DRIVER_ATTR
(
new_id
,
S_IWUSR
,
NULL
,
store_new_id
);
...
...
@@ -291,6 +294,7 @@ int usb_driver_claim_interface(struct usb_driver *driver,
{
struct
device
*
dev
=
&
iface
->
dev
;
struct
usb_device
*
udev
=
interface_to_usbdev
(
iface
);
int
retval
=
0
;
if
(
dev
->
driver
)
return
-
EBUSY
;
...
...
@@ -308,9 +312,9 @@ int usb_driver_claim_interface(struct usb_driver *driver,
* the future device_add() bind it, bypassing probe()
*/
if
(
device_is_registered
(
dev
))
device_bind_driver
(
dev
);
retval
=
device_bind_driver
(
dev
);
return
0
;
return
retval
;
}
EXPORT_SYMBOL
(
usb_driver_claim_interface
);
...
...
drivers/usb/core/endpoint.c
浏览文件 @
1b21d5e1
...
...
@@ -207,9 +207,9 @@ static void ep_device_release(struct device *dev)
kfree
(
ep_dev
);
}
void
usb_create_ep_files
(
struct
device
*
parent
,
struct
usb_host_endpoint
*
endpoint
,
struct
usb_device
*
udev
)
int
usb_create_ep_files
(
struct
device
*
parent
,
struct
usb_host_endpoint
*
endpoint
,
struct
usb_device
*
udev
)
{
char
name
[
8
];
struct
ep_device
*
ep_dev
;
...
...
@@ -242,19 +242,33 @@ void usb_create_ep_files(struct device *parent,
retval
=
device_register
(
&
ep_dev
->
dev
);
if
(
retval
)
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
;
/* create the symlink to the old-style "ep_XX" directory */
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:
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:
kfree
(
ep_dev
);
return
;
destroy_endpoint_class
();
return
retval
;
}
void
usb_remove_ep_files
(
struct
usb_host_endpoint
*
endpoint
)
...
...
drivers/usb/core/sysfs.c
浏览文件 @
1b21d5e1
...
...
@@ -210,19 +210,40 @@ static struct attribute_group dev_attr_grp = {
.
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
;
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
)
device_create_file
(
dev
,
&
dev_attr_manufacturer
);
if
(
udev
->
product
)
device_create_file
(
dev
,
&
dev_attr_product
);
if
(
udev
->
serial
)
device_create_file
(
dev
,
&
dev_attr_serial
);
usb_create_ep_files
(
dev
,
&
udev
->
ep0
,
udev
);
if
(
udev
->
manufacturer
)
{
retval
=
device_create_file
(
dev
,
&
dev_attr_manufacturer
);
if
(
retval
)
goto
error
;
}
if
(
udev
->
product
)
{
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
)
...
...
@@ -339,18 +360,28 @@ static inline void usb_remove_intf_ep_files(struct usb_interface *intf)
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_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
)
alt
->
string
=
usb_cache_string
(
udev
,
alt
->
desc
.
iInterface
);
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
);
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
)
...
...
drivers/usb/core/usb.c
浏览文件 @
1b21d5e1
...
...
@@ -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
find_interface_arg
argb
;
int
retval
;
argb
.
minor
=
minor
;
argb
.
interface
=
NULL
;
driver_for_each_device
(
&
drv
->
drvwrap
.
driver
,
NULL
,
&
argb
,
__find_interface
);
/* eat the error, it will be in argb.interface */
retval
=
driver_for_each_device
(
&
drv
->
drvwrap
.
driver
,
NULL
,
&
argb
,
__find_interface
);
return
argb
.
interface
;
}
...
...
drivers/usb/core/usb.h
浏览文件 @
1b21d5e1
/* 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_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_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
);
extern
void
usb_remove_ep_files
(
struct
usb_host_endpoint
*
endpoint
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录