Re: [PATCH net-next 2/2] net: ethernet: enc28j60: add device tree support
From: Arnd Bergmann <arnd@arndb.de>
Date: 2016-04-23 22:20:24
Also in:
linux-devicetree
From: Arnd Bergmann <arnd@arndb.de>
Date: 2016-04-23 22:20:24
Also in:
linux-devicetree
On Saturday 23 April 2016 23:43:20 Michael Heimpold wrote:
diff --git a/drivers/net/ethernet/microchip/enc28j60.c b/drivers/net/ethernet/microchip/enc28j60.c index b723622..49635d7 100644 --- a/drivers/net/ethernet/microchip/enc28j60.c +++ b/drivers/net/ethernet/microchip/enc28j60.c@@ -1634,9 +1634,20 @@ static int enc28j60_remove(struct spi_device *spi) return 0; } +#ifdef CONFIG_OF +static const struct of_device_id enc28j60_dt_ids[] = { + { .compatible = "microchip,enc28j60" }, + { /* sentinel */ } +}; +MODULE_DEVICE_TABLE(of, enc28j60_dt_ids); +#else +#define enc28j60_dt_ids NULL +#endif + static struct spi_driver enc28j60_driver = { .driver = { - .name = DRV_NAME, + .name = DRV_NAME, + .of_match_table = enc28j60_dt_ids, }, .probe = enc28j60_probe, .remove = enc28j60_remove,--
You probably also want to add support for calling of_get_mac_address() here, to allow giving the device a fixed address from the boot loader. I think you can drop the #ifdef and just define the device table unconditionally. Arnd