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
f45d069a
Commit
f45d069a
authored
May 05, 2003
by
Matt Domsch
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
PCI dynids - documentation fixes, id_table NULL check
parent
59bcc720
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
26 additions
and
4 deletions
+26
-4
Documentation/pci.txt
Documentation/pci.txt
+22
-2
drivers/pci/pci-driver.c
drivers/pci/pci-driver.c
+3
-1
include/linux/pci.h
include/linux/pci.h
+1
-1
No files found.
Documentation/pci.txt
View file @
f45d069a
...
...
@@ -45,8 +45,6 @@ contains:
id_table Pointer to table of device ID's the driver is
interested in. Most drivers should export this
table using MODULE_DEVICE_TABLE(pci,...).
Set to NULL to call probe() function for every
PCI device known to the system.
probe Pointer to a probing function which gets called (during
execution of pci_register_driver for already existing
devices or later if a new device gets inserted) for all
...
...
@@ -83,6 +81,28 @@ Each entry consists of:
class_mask of the class are honored during the comparison.
driver_data Data private to the driver.
Most drivers don't need to use the driver_data field. Best practice
for use of driver_data is to use it as an index into a static list of
equivalant device types, not to use it as a pointer.
Have a table entry {PCI_ANY_ID, PCI_ANY_ID, PCI_ANY_ID, PCI_ANY_ID}
to have probe() called for every PCI device known to the system.
New PCI IDs may be added to a device driver at runtime by writing
to the file /sys/bus/pci/drivers/{driver}/new_id. When added, the
driver will probe for all devices it can support.
echo "vendor device subvendor subdevice class class_mask driver_data" > \
/sys/bus/pci/drivers/{driver}/new_id
where all fields are passed in as hexadecimal values (no leading 0x).
Users need pass only as many fields as necessary; vendor, device,
subvendor, and subdevice fields default to PCI_ANY_ID (FFFFFFFF),
class and classmask fields default to 0, and driver_data defaults to
0UL. Device drivers must call
pci_dynids_set_use_driver_data(pci_driver *, 1)
in order for the driver_data field to get passed to the driver.
Otherwise, only a 0 is passed in that field.
When the driver exits, it just calls pci_unregister_driver() and the PCI layer
automatically calls the remove hook for all devices handled by the driver.
...
...
drivers/pci/pci-driver.c
View file @
f45d069a
...
...
@@ -66,6 +66,8 @@ pci_device_probe_static(struct pci_driver *drv,
int
error
=
-
ENODEV
;
const
struct
pci_device_id
*
id
;
if
(
!
drv
->
id_table
)
return
error
;
id
=
pci_match_device
(
drv
->
id_table
,
pci_dev
);
if
(
id
)
error
=
drv
->
probe
(
pci_dev
,
id
);
...
...
include/linux/pci.h
View file @
f45d069a
...
...
@@ -499,7 +499,7 @@ struct pci_dynids {
struct
pci_driver
{
struct
list_head
node
;
char
*
name
;
const
struct
pci_device_id
*
id_table
;
/*
NULL if wants all devices
*/
const
struct
pci_device_id
*
id_table
;
/*
must be non-NULL for probe to be called
*/
int
(
*
probe
)
(
struct
pci_dev
*
dev
,
const
struct
pci_device_id
*
id
);
/* New device inserted */
void
(
*
remove
)
(
struct
pci_dev
*
dev
);
/* Device removed (NULL if not a hot-plug capable driver) */
int
(
*
save_state
)
(
struct
pci_dev
*
dev
,
u32
state
);
/* Save Device Context */
...
...
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