Re: [PATCH net-next 2/2] net: ethernet: enc28j60: add device tree support

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




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
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Device Tree Compilter]     [Device Tree Spec]     [Linux Driver Backports]     [Video for Linux]     [Linux USB Devel]     [Linux PCI Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Yosemite Backpacking]
  Powered by Linux