June 2017
Intermediate to advanced
478 pages
13h 14m
English
You have seen in the preceding section how an Ethernet adapter is described using a device tree and using platform data. The corresponding driver code is in drivers/net/ethernet/smsc/smc91x.c, and it works with both the device tree and platform data. Here is the initialization code, once again edited for clarity:
static const struct of_device_id smc91x_match[] = { { .compatible = "smsc,lan91c94", }, { .compatible = "smsc,lan91c111", }, {}, }; MODULE_DEVICE_TABLE(of, smc91x_match); static struct platform_driver smc_driver = { .probe = smc_drv_probe, .remove = smc_drv_remove, .driver = { .name = "smc91x", .of_match_table = of_match_ptr(smc91x_match), }, }; static int __init smc_driver_init(void) ...Read now
Unlock full access