Reputation: 586
The PCI-IFIFD CAN implementation (drivers/net/can) of the linux mainline kernel (link) is using the platform_driver structure instead of the pci_driver structure.
I have some trouble differentiating between those two structures. Therefor I informed myself:
- platform driver vs normal device driver
- platform_driver
- pci_driver
According to the first source:
Unlike PCI or USB devices, I2C devices are not enumerated at the hardware level (at run time). Instead, the software must know (at compile time) which devices are connected on each I2C bus segment. So USB and PCI are not platform devices.
If this is the case, why is the PCI ififd implementation using the platform_driver struct?
Additionally how can someone use this driver for pci-cards using ififd?
Upvotes: 1
Views: 285
Reputation: 802
You have to differentiate platform_driver
, which is bus (controller) driver and pci_driver
which is PCI device driver (client on the bus).
This is CAN Bus driver CAN bus driver for IFI CANFD controller
Bus controlers (adapters) are registered to kernel as platform_devices
PCI driver provides hooks (callbacks) and structures to register PCI device to kernel PCI layer and bind it to device.
pci_register_driver()
is used to register pci_driver
structure for a existing PCI device on the PCI bus defined in struct pci_device_id xxx_pci_tbl[]
table with Class, Vendor and Device ID to match against a device.
struct pci_driver xxx_driver = {
.name = DRV_NAME,
.probe = xxx_pci_probe,
.remove = xxx_pci_remove,
.id_table = xxx_pci_tbl
Upvotes: 2