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
e7414910
Commit
e7414910
authored
Jun 03, 2004
by
Greg Kroah-Hartman
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
PCI: convert to using dev_attrs for all PCI devices.
Signed-off-by:
Greg Kroah-Hartman
<
greg@kroah.com
>
parent
5823eb40
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
17 additions
and
18 deletions
+17
-18
drivers/pci/pci-driver.c
drivers/pci/pci-driver.c
+1
-0
drivers/pci/pci-sysfs.c
drivers/pci/pci-sysfs.c
+15
-18
drivers/pci/pci.h
drivers/pci/pci.h
+1
-0
No files found.
drivers/pci/pci-driver.c
View file @
e7414910
...
@@ -539,6 +539,7 @@ struct bus_type pci_bus_type = {
...
@@ -539,6 +539,7 @@ struct bus_type pci_bus_type = {
.
hotplug
=
pci_hotplug
,
.
hotplug
=
pci_hotplug
,
.
suspend
=
pci_device_suspend
,
.
suspend
=
pci_device_suspend
,
.
resume
=
pci_device_resume
,
.
resume
=
pci_device_resume
,
.
dev_attrs
=
pci_dev_attrs
,
};
};
static
int
__init
pci_driver_init
(
void
)
static
int
__init
pci_driver_init
(
void
)
...
...
drivers/pci/pci-sysfs.c
View file @
e7414910
...
@@ -23,14 +23,13 @@
...
@@ -23,14 +23,13 @@
/* show configuration fields */
/* show configuration fields */
#define pci_config_attr(field, format_string) \
#define pci_config_attr(field, format_string) \
static ssize_t \
static ssize_t \
show_##field
(struct device *dev, char *buf) \
field##_show
(struct device *dev, char *buf) \
{ \
{ \
struct pci_dev *pdev; \
struct pci_dev *pdev; \
\
\
pdev = to_pci_dev (dev); \
pdev = to_pci_dev (dev); \
return sprintf (buf, format_string, pdev->field); \
return sprintf (buf, format_string, pdev->field); \
} \
}
static DEVICE_ATTR(field, S_IRUGO, show_##field, NULL);
pci_config_attr
(
vendor
,
"0x%04x
\n
"
);
pci_config_attr
(
vendor
,
"0x%04x
\n
"
);
pci_config_attr
(
device
,
"0x%04x
\n
"
);
pci_config_attr
(
device
,
"0x%04x
\n
"
);
...
@@ -41,7 +40,7 @@ pci_config_attr(irq, "%u\n");
...
@@ -41,7 +40,7 @@ pci_config_attr(irq, "%u\n");
/* show resources */
/* show resources */
static
ssize_t
static
ssize_t
pci_show_resources
(
struct
device
*
dev
,
char
*
buf
)
resource_show
(
struct
device
*
dev
,
char
*
buf
)
{
{
struct
pci_dev
*
pci_dev
=
to_pci_dev
(
dev
);
struct
pci_dev
*
pci_dev
=
to_pci_dev
(
dev
);
char
*
str
=
buf
;
char
*
str
=
buf
;
...
@@ -60,7 +59,16 @@ pci_show_resources(struct device * dev, char * buf)
...
@@ -60,7 +59,16 @@ pci_show_resources(struct device * dev, char * buf)
return
(
str
-
buf
);
return
(
str
-
buf
);
}
}
static
DEVICE_ATTR
(
resource
,
S_IRUGO
,
pci_show_resources
,
NULL
);
struct
device_attribute
pci_dev_attrs
[]
=
{
__ATTR_RO
(
resource
),
__ATTR_RO
(
vendor
),
__ATTR_RO
(
device
),
__ATTR_RO
(
subsystem_vendor
),
__ATTR_RO
(
subsystem_device
),
__ATTR_RO
(
class
),
__ATTR_RO
(
irq
),
__ATTR_NULL
,
};
static
ssize_t
static
ssize_t
pci_read_config
(
struct
kobject
*
kobj
,
char
*
buf
,
loff_t
off
,
size_t
count
)
pci_read_config
(
struct
kobject
*
kobj
,
char
*
buf
,
loff_t
off
,
size_t
count
)
...
@@ -180,21 +188,10 @@ static struct bin_attribute pcie_config_attr = {
...
@@ -180,21 +188,10 @@ static struct bin_attribute pcie_config_attr = {
void
pci_create_sysfs_dev_files
(
struct
pci_dev
*
pdev
)
void
pci_create_sysfs_dev_files
(
struct
pci_dev
*
pdev
)
{
{
struct
device
*
dev
=
&
pdev
->
dev
;
/* current configuration's attributes */
device_create_file
(
dev
,
&
dev_attr_vendor
);
device_create_file
(
dev
,
&
dev_attr_device
);
device_create_file
(
dev
,
&
dev_attr_subsystem_vendor
);
device_create_file
(
dev
,
&
dev_attr_subsystem_device
);
device_create_file
(
dev
,
&
dev_attr_class
);
device_create_file
(
dev
,
&
dev_attr_irq
);
device_create_file
(
dev
,
&
dev_attr_resource
);
if
(
pdev
->
cfg_size
<
4096
)
if
(
pdev
->
cfg_size
<
4096
)
sysfs_create_bin_file
(
&
dev
->
kobj
,
&
pci_config_attr
);
sysfs_create_bin_file
(
&
pdev
->
dev
.
kobj
,
&
pci_config_attr
);
else
else
sysfs_create_bin_file
(
&
dev
->
kobj
,
&
pcie_config_attr
);
sysfs_create_bin_file
(
&
pdev
->
dev
.
kobj
,
&
pcie_config_attr
);
/* add platform-specific attributes */
/* add platform-specific attributes */
pcibios_add_platform_entries
(
pdev
);
pcibios_add_platform_entries
(
pdev
);
...
...
drivers/pci/pci.h
View file @
e7414910
...
@@ -62,3 +62,4 @@ extern int pci_visit_dev(struct pci_visit *fn,
...
@@ -62,3 +62,4 @@ extern int pci_visit_dev(struct pci_visit *fn,
extern
spinlock_t
pci_bus_lock
;
extern
spinlock_t
pci_bus_lock
;
extern
int
pciehp_msi_quirk
;
extern
int
pciehp_msi_quirk
;
extern
struct
device_attribute
pci_dev_attrs
[];
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