Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
Kernel
提交
b19441af
K
Kernel
项目概览
openeuler
/
Kernel
大约 1 年 前同步成功
通知
5
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
K
Kernel
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
b19441af
编写于
8月 28, 2006
作者:
G
Greg Kroah-Hartman
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
PCI: fix __must_check warnings
Signed-off-by:
N
Greg Kroah-Hartman
<
gregkh@suse.de
>
上级
660a0e8f
变更
9
隐藏空白更改
内联
并排
Showing
9 changed file
with
138 addition
and
62 deletion
+138
-62
drivers/pci/bus.c
drivers/pci/bus.c
+16
-6
drivers/pci/hotplug/fakephp.c
drivers/pci/hotplug/fakephp.c
+14
-4
drivers/pci/pci-driver.c
drivers/pci/pci-driver.c
+4
-1
drivers/pci/pci-sysfs.c
drivers/pci/pci-sysfs.c
+73
-39
drivers/pci/pcie/aer/aerdrv_core.c
drivers/pci/pcie/aer/aerdrv_core.c
+2
-1
drivers/pci/pcie/portdrv_core.c
drivers/pci/pcie/portdrv_core.c
+2
-4
drivers/pci/pcie/portdrv_pci.c
drivers/pci/pcie/portdrv_pci.c
+12
-4
drivers/pci/probe.c
drivers/pci/probe.c
+14
-2
include/linux/pci.h
include/linux/pci.h
+1
-1
未找到文件。
drivers/pci/bus.c
浏览文件 @
b19441af
...
...
@@ -77,9 +77,12 @@ pci_bus_alloc_resource(struct pci_bus *bus, struct resource *res,
* This adds a single pci device to the global
* device list and adds sysfs and procfs entries
*/
void
__devinit
pci_bus_add_device
(
struct
pci_dev
*
dev
)
int
__devinit
pci_bus_add_device
(
struct
pci_dev
*
dev
)
{
device_add
(
&
dev
->
dev
);
int
retval
;
retval
=
device_add
(
&
dev
->
dev
);
if
(
retval
)
return
retval
;
down_write
(
&
pci_bus_sem
);
list_add_tail
(
&
dev
->
global_list
,
&
pci_devices
);
...
...
@@ -87,6 +90,7 @@ void __devinit pci_bus_add_device(struct pci_dev *dev)
pci_proc_attach_device
(
dev
);
pci_create_sysfs_dev_files
(
dev
);
return
0
;
}
/**
...
...
@@ -104,6 +108,7 @@ void __devinit pci_bus_add_device(struct pci_dev *dev)
void
__devinit
pci_bus_add_devices
(
struct
pci_bus
*
bus
)
{
struct
pci_dev
*
dev
;
int
retval
;
list_for_each_entry
(
dev
,
&
bus
->
devices
,
bus_list
)
{
/*
...
...
@@ -112,7 +117,9 @@ void __devinit pci_bus_add_devices(struct pci_bus *bus)
*/
if
(
!
list_empty
(
&
dev
->
global_list
))
continue
;
pci_bus_add_device
(
dev
);
retval
=
pci_bus_add_device
(
dev
);
if
(
retval
)
dev_err
(
&
dev
->
dev
,
"Error adding device, continuing
\n
"
);
}
list_for_each_entry
(
dev
,
&
bus
->
devices
,
bus_list
)
{
...
...
@@ -129,10 +136,13 @@ void __devinit pci_bus_add_devices(struct pci_bus *bus)
list_add_tail
(
&
dev
->
subordinate
->
node
,
&
dev
->
bus
->
children
);
up_write
(
&
pci_bus_sem
);
}
}
pci_bus_add_devices
(
dev
->
subordinate
);
sysfs_create_link
(
&
dev
->
subordinate
->
class_dev
.
kobj
,
&
dev
->
dev
.
kobj
,
"bridge"
);
retval
=
sysfs_create_link
(
&
dev
->
subordinate
->
class_dev
.
kobj
,
&
dev
->
dev
.
kobj
,
"bridge"
);
if
(
retval
)
dev_err
(
&
dev
->
dev
,
"Error creating sysfs "
"bridge symlink, continuing...
\n
"
);
}
}
}
...
...
drivers/pci/hotplug/fakephp.c
浏览文件 @
b19441af
...
...
@@ -176,7 +176,9 @@ static void pci_rescan_slot(struct pci_dev *temp)
struct
pci_bus
*
bus
=
temp
->
bus
;
struct
pci_dev
*
dev
;
int
func
;
int
retval
;
u8
hdr_type
;
if
(
!
pci_read_config_byte
(
temp
,
PCI_HEADER_TYPE
,
&
hdr_type
))
{
temp
->
hdr_type
=
hdr_type
&
0x7f
;
if
(
!
pci_find_slot
(
bus
->
number
,
temp
->
devfn
))
{
...
...
@@ -185,8 +187,12 @@ static void pci_rescan_slot(struct pci_dev *temp)
dbg
(
"New device on %s function %x:%x
\n
"
,
bus
->
name
,
temp
->
devfn
>>
3
,
temp
->
devfn
&
7
);
pci_bus_add_device
(
dev
);
add_slot
(
dev
);
retval
=
pci_bus_add_device
(
dev
);
if
(
retval
)
dev_err
(
&
dev
->
dev
,
"error adding "
"device, continuing.
\n
"
);
else
add_slot
(
dev
);
}
}
/* multifunction device? */
...
...
@@ -205,8 +211,12 @@ static void pci_rescan_slot(struct pci_dev *temp)
dbg
(
"New device on %s function %x:%x
\n
"
,
bus
->
name
,
temp
->
devfn
>>
3
,
temp
->
devfn
&
7
);
pci_bus_add_device
(
dev
);
add_slot
(
dev
);
retval
=
pci_bus_add_device
(
dev
);
if
(
retval
)
dev_err
(
&
dev
->
dev
,
"error adding "
"device, continuing.
\n
"
);
else
add_slot
(
dev
);
}
}
}
...
...
drivers/pci/pci-driver.c
浏览文件 @
b19441af
...
...
@@ -56,6 +56,7 @@ store_new_id(struct device_driver *driver, const char *buf, size_t count)
subdevice
=
PCI_ANY_ID
,
class
=
0
,
class_mask
=
0
;
unsigned
long
driver_data
=
0
;
int
fields
=
0
;
int
retval
=
0
;
fields
=
sscanf
(
buf
,
"%x %x %x %x %x %x %lux"
,
&
vendor
,
&
device
,
&
subvendor
,
&
subdevice
,
...
...
@@ -82,10 +83,12 @@ store_new_id(struct device_driver *driver, const char *buf, size_t count)
spin_unlock
(
&
pdrv
->
dynids
.
lock
);
if
(
get_driver
(
&
pdrv
->
driver
))
{
driver_attach
(
&
pdrv
->
driver
);
retval
=
driver_attach
(
&
pdrv
->
driver
);
put_driver
(
&
pdrv
->
driver
);
}
if
(
retval
)
return
retval
;
return
count
;
}
static
DRIVER_ATTR
(
new_id
,
S_IWUSR
,
NULL
,
store_new_id
);
...
...
drivers/pci/pci-sysfs.c
浏览文件 @
b19441af
...
...
@@ -117,6 +117,7 @@ is_enabled_store(struct device *dev, struct device_attribute *attr,
const
char
*
buf
,
size_t
count
)
{
struct
pci_dev
*
pdev
=
to_pci_dev
(
dev
);
int
retval
=
0
;
/* this can crash the machine when done on the "wrong" device */
if
(
!
capable
(
CAP_SYS_ADMIN
))
...
...
@@ -126,8 +127,10 @@ is_enabled_store(struct device *dev, struct device_attribute *attr,
pci_disable_device
(
pdev
);
if
(
*
buf
==
'1'
)
pci_enable_device
(
pdev
);
retval
=
pci_enable_device
(
pdev
);
if
(
retval
)
return
retval
;
return
count
;
}
...
...
@@ -425,16 +428,39 @@ pci_mmap_resource(struct kobject *kobj, struct bin_attribute *attr,
return
pci_mmap_page_range
(
pdev
,
vma
,
mmap_type
,
0
);
}
/**
* pci_remove_resource_files - cleanup resource files
* @dev: dev to cleanup
*
* If we created resource files for @dev, remove them from sysfs and
* free their resources.
*/
static
void
pci_remove_resource_files
(
struct
pci_dev
*
pdev
)
{
int
i
;
for
(
i
=
0
;
i
<
PCI_ROM_RESOURCE
;
i
++
)
{
struct
bin_attribute
*
res_attr
;
res_attr
=
pdev
->
res_attr
[
i
];
if
(
res_attr
)
{
sysfs_remove_bin_file
(
&
pdev
->
dev
.
kobj
,
res_attr
);
kfree
(
res_attr
);
}
}
}
/**
* pci_create_resource_files - create resource files in sysfs for @dev
* @dev: dev in question
*
* Walk the resources in @dev creating files for each resource available.
*/
static
void
pci_create_resource_files
(
struct
pci_dev
*
pdev
)
static
int
pci_create_resource_files
(
struct
pci_dev
*
pdev
)
{
int
i
;
int
retval
;
/* Expose the PCI resources from this device as files */
for
(
i
=
0
;
i
<
PCI_ROM_RESOURCE
;
i
++
)
{
...
...
@@ -457,35 +483,19 @@ pci_create_resource_files(struct pci_dev *pdev)
res_attr
->
size
=
pci_resource_len
(
pdev
,
i
);
res_attr
->
mmap
=
pci_mmap_resource
;
res_attr
->
private
=
&
pdev
->
resource
[
i
];
sysfs_create_bin_file
(
&
pdev
->
dev
.
kobj
,
res_attr
);
}
}
}
/**
* pci_remove_resource_files - cleanup resource files
* @dev: dev to cleanup
*
* If we created resource files for @dev, remove them from sysfs and
* free their resources.
*/
static
void
pci_remove_resource_files
(
struct
pci_dev
*
pdev
)
{
int
i
;
for
(
i
=
0
;
i
<
PCI_ROM_RESOURCE
;
i
++
)
{
struct
bin_attribute
*
res_attr
;
res_attr
=
pdev
->
res_attr
[
i
];
if
(
res_attr
)
{
sysfs_remove_bin_file
(
&
pdev
->
dev
.
kobj
,
res_attr
);
kfree
(
res_attr
);
retval
=
sysfs_create_bin_file
(
&
pdev
->
dev
.
kobj
,
res_attr
);
if
(
retval
)
{
pci_remove_resource_files
(
pdev
);
return
retval
;
}
}
else
{
return
-
ENOMEM
;
}
}
return
0
;
}
#else
/* !HAVE_PCI_MMAP */
static
inline
void
pci_create_resource_files
(
struct
pci_dev
*
dev
)
{
return
;
}
static
inline
int
pci_create_resource_files
(
struct
pci_dev
*
dev
)
{
return
0
;
}
static
inline
void
pci_remove_resource_files
(
struct
pci_dev
*
dev
)
{
return
;
}
#endif
/* HAVE_PCI_MMAP */
...
...
@@ -570,22 +580,27 @@ static struct bin_attribute pcie_config_attr = {
.
write
=
pci_write_config
,
};
int
pci_create_sysfs_dev_files
(
struct
pci_dev
*
pdev
)
int
__must_check
pci_create_sysfs_dev_files
(
struct
pci_dev
*
pdev
)
{
struct
bin_attribute
*
rom_attr
=
NULL
;
int
retval
;
if
(
!
sysfs_initialized
)
return
-
EACCES
;
if
(
pdev
->
cfg_size
<
4096
)
sysfs_create_bin_file
(
&
pdev
->
dev
.
kobj
,
&
pci_config_attr
);
retval
=
sysfs_create_bin_file
(
&
pdev
->
dev
.
kobj
,
&
pci_config_attr
);
else
sysfs_create_bin_file
(
&
pdev
->
dev
.
kobj
,
&
pcie_config_attr
);
retval
=
sysfs_create_bin_file
(
&
pdev
->
dev
.
kobj
,
&
pcie_config_attr
);
if
(
retval
)
goto
err
;
pci_create_resource_files
(
pdev
);
retval
=
pci_create_resource_files
(
pdev
);
if
(
retval
)
goto
err_bin_file
;
/* If the device has a ROM, try to expose it in sysfs. */
if
(
pci_resource_len
(
pdev
,
PCI_ROM_RESOURCE
))
{
struct
bin_attribute
*
rom_attr
;
rom_attr
=
kzalloc
(
sizeof
(
*
rom_attr
),
GFP_ATOMIC
);
if
(
rom_attr
)
{
pdev
->
rom_attr
=
rom_attr
;
...
...
@@ -595,13 +610,28 @@ int pci_create_sysfs_dev_files (struct pci_dev *pdev)
rom_attr
->
attr
.
owner
=
THIS_MODULE
;
rom_attr
->
read
=
pci_read_rom
;
rom_attr
->
write
=
pci_write_rom
;
sysfs_create_bin_file
(
&
pdev
->
dev
.
kobj
,
rom_attr
);
retval
=
sysfs_create_bin_file
(
&
pdev
->
dev
.
kobj
,
rom_attr
);
if
(
retval
)
goto
err_rom
;
}
else
{
retval
=
-
ENOMEM
;
goto
err_bin_file
;
}
}
/* add platform-specific attributes */
pcibios_add_platform_entries
(
pdev
);
return
0
;
err_rom:
kfree
(
rom_attr
);
err_bin_file:
if
(
pdev
->
cfg_size
<
4096
)
sysfs_remove_bin_file
(
&
pdev
->
dev
.
kobj
,
&
pci_config_attr
);
else
sysfs_remove_bin_file
(
&
pdev
->
dev
.
kobj
,
&
pcie_config_attr
);
err:
return
retval
;
}
/**
...
...
@@ -630,10 +660,14 @@ void pci_remove_sysfs_dev_files(struct pci_dev *pdev)
static
int
__init
pci_sysfs_init
(
void
)
{
struct
pci_dev
*
pdev
=
NULL
;
int
retval
;
sysfs_initialized
=
1
;
for_each_pci_dev
(
pdev
)
pci_create_sysfs_dev_files
(
pdev
);
for_each_pci_dev
(
pdev
)
{
retval
=
pci_create_sysfs_dev_files
(
pdev
);
if
(
retval
)
return
retval
;
}
return
0
;
}
...
...
drivers/pci/pcie/aer/aerdrv_core.c
浏览文件 @
b19441af
...
...
@@ -357,7 +357,8 @@ static int find_aer_service_iter(struct device *device, void *data)
static
void
find_aer_service
(
struct
pci_dev
*
dev
,
struct
find_aer_service_data
*
data
)
{
device_for_each_child
(
&
dev
->
dev
,
data
,
find_aer_service_iter
);
int
retval
;
retval
=
device_for_each_child
(
&
dev
->
dev
,
data
,
find_aer_service_iter
);
}
static
pci_ers_result_t
reset_link
(
struct
pcie_device
*
aerdev
,
...
...
drivers/pci/pcie/portdrv_core.c
浏览文件 @
b19441af
...
...
@@ -340,8 +340,7 @@ static int suspend_iter(struct device *dev, void *data)
int
pcie_port_device_suspend
(
struct
pci_dev
*
dev
,
pm_message_t
state
)
{
device_for_each_child
(
&
dev
->
dev
,
&
state
,
suspend_iter
);
return
0
;
return
device_for_each_child
(
&
dev
->
dev
,
&
state
,
suspend_iter
);
}
static
int
resume_iter
(
struct
device
*
dev
,
void
*
data
)
...
...
@@ -359,8 +358,7 @@ static int resume_iter(struct device *dev, void *data)
int
pcie_port_device_resume
(
struct
pci_dev
*
dev
)
{
device_for_each_child
(
&
dev
->
dev
,
NULL
,
resume_iter
);
return
0
;
return
device_for_each_child
(
&
dev
->
dev
,
NULL
,
resume_iter
);
}
#endif
...
...
drivers/pci/pcie/portdrv_pci.c
浏览文件 @
b19441af
...
...
@@ -147,8 +147,10 @@ static pci_ers_result_t pcie_portdrv_error_detected(struct pci_dev *dev,
{
struct
aer_broadcast_data
result_data
=
{
error
,
PCI_ERS_RESULT_CAN_RECOVER
};
int
retval
;
device_for_each_child
(
&
dev
->
dev
,
&
result_data
,
error_detected_iter
);
/* can not fail */
retval
=
device_for_each_child
(
&
dev
->
dev
,
&
result_data
,
error_detected_iter
);
return
result_data
.
result
;
}
...
...
@@ -181,8 +183,10 @@ static int mmio_enabled_iter(struct device *device, void *data)
static
pci_ers_result_t
pcie_portdrv_mmio_enabled
(
struct
pci_dev
*
dev
)
{
pci_ers_result_t
status
=
PCI_ERS_RESULT_RECOVERED
;
int
retval
;
device_for_each_child
(
&
dev
->
dev
,
&
status
,
mmio_enabled_iter
);
/* get true return value from &status */
retval
=
device_for_each_child
(
&
dev
->
dev
,
&
status
,
mmio_enabled_iter
);
return
status
;
}
...
...
@@ -214,6 +218,7 @@ static int slot_reset_iter(struct device *device, void *data)
static
pci_ers_result_t
pcie_portdrv_slot_reset
(
struct
pci_dev
*
dev
)
{
pci_ers_result_t
status
;
int
retval
;
/* If fatal, restore cfg space for possible link reset at upstream */
if
(
dev
->
error_state
==
pci_channel_io_frozen
)
{
...
...
@@ -221,7 +226,8 @@ static pci_ers_result_t pcie_portdrv_slot_reset(struct pci_dev *dev)
pci_enable_pcie_error_reporting
(
dev
);
}
device_for_each_child
(
&
dev
->
dev
,
&
status
,
slot_reset_iter
);
/* get true return value from &status */
retval
=
device_for_each_child
(
&
dev
->
dev
,
&
status
,
slot_reset_iter
);
return
status
;
}
...
...
@@ -248,7 +254,9 @@ static int resume_iter(struct device *device, void *data)
static
void
pcie_portdrv_err_resume
(
struct
pci_dev
*
dev
)
{
device_for_each_child
(
&
dev
->
dev
,
NULL
,
resume_iter
);
int
retval
;
/* nothing to do with error value, if it ever happens */
retval
=
device_for_each_child
(
&
dev
->
dev
,
NULL
,
resume_iter
);
}
/*
...
...
drivers/pci/probe.c
浏览文件 @
b19441af
...
...
@@ -339,6 +339,7 @@ pci_alloc_child_bus(struct pci_bus *parent, struct pci_dev *bridge, int busnr)
{
struct
pci_bus
*
child
;
int
i
;
int
retval
;
/*
* Allocate a new bus, and inherit stuff from the parent..
...
...
@@ -356,8 +357,13 @@ pci_alloc_child_bus(struct pci_bus *parent, struct pci_dev *bridge, int busnr)
child
->
class_dev
.
class
=
&
pcibus_class
;
sprintf
(
child
->
class_dev
.
class_id
,
"%04x:%02x"
,
pci_domain_nr
(
child
),
busnr
);
class_device_register
(
&
child
->
class_dev
);
class_device_create_file
(
&
child
->
class_dev
,
&
class_device_attr_cpuaffinity
);
retval
=
class_device_register
(
&
child
->
class_dev
);
if
(
retval
)
goto
error_register
;
retval
=
class_device_create_file
(
&
child
->
class_dev
,
&
class_device_attr_cpuaffinity
);
if
(
retval
)
goto
error_file_create
;
/*
* Set up the primary, secondary and subordinate
...
...
@@ -375,6 +381,12 @@ pci_alloc_child_bus(struct pci_bus *parent, struct pci_dev *bridge, int busnr)
bridge
->
subordinate
=
child
;
return
child
;
error_file_create:
class_device_unregister
(
&
child
->
class_dev
);
error_register:
kfree
(
child
);
return
NULL
;
}
struct
pci_bus
*
__devinit
pci_add_new_bus
(
struct
pci_bus
*
parent
,
struct
pci_dev
*
dev
,
int
busnr
)
...
...
include/linux/pci.h
浏览文件 @
b19441af
...
...
@@ -431,7 +431,7 @@ int pci_scan_slot(struct pci_bus *bus, int devfn);
struct
pci_dev
*
pci_scan_single_device
(
struct
pci_bus
*
bus
,
int
devfn
);
void
pci_device_add
(
struct
pci_dev
*
dev
,
struct
pci_bus
*
bus
);
unsigned
int
pci_scan_child_bus
(
struct
pci_bus
*
bus
);
void
pci_bus_add_device
(
struct
pci_dev
*
dev
);
int
__must_check
pci_bus_add_device
(
struct
pci_dev
*
dev
);
void
pci_read_bridge_bases
(
struct
pci_bus
*
child
);
struct
resource
*
pci_find_parent_resource
(
const
struct
pci_dev
*
dev
,
struct
resource
*
res
);
int
pci_get_interrupt_pin
(
struct
pci_dev
*
dev
,
struct
pci_dev
**
bridge
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录