On Thu, Nov 16, 2023 at 11:29 AM Simon Horman <horms@xxxxxxxxxx> wrote: > > On Wed, Nov 15, 2023 at 03:01:28PM -0600, Rob Herring wrote: > > Use preferred device_get_match_data() instead of of_match_device() to > > get the driver match data. With this, adjust the includes to explicitly > > include the correct headers. > > > > Signed-off-by: Rob Herring <robh@xxxxxxxxxx> > > ... > > > diff --git a/drivers/net/can/xilinx_can.c b/drivers/net/can/xilinx_can.c > > index abe58f103043..f17fd43d03c0 100644 > > --- a/drivers/net/can/xilinx_can.c > > +++ b/drivers/net/can/xilinx_can.c > > @@ -20,8 +20,8 @@ > > #include <linux/module.h> > > #include <linux/netdevice.h> > > #include <linux/of.h> > > -#include <linux/of_device.h> > > #include <linux/platform_device.h> > > +#include <linux/property.h> > > #include <linux/skbuff.h> > > #include <linux/spinlock.h> > > #include <linux/string.h> > > @@ -1726,7 +1726,6 @@ static int xcan_probe(struct platform_device *pdev) > > struct net_device *ndev; > > struct xcan_priv *priv; > > struct phy *transceiver; > > - const struct of_device_id *of_id; > > const struct xcan_devtype_data *devtype = &xcan_axi_data; > > Hi Rob, > > Here devtype is initialised. > > > void __iomem *addr; > > int ret; > > @@ -1741,9 +1740,7 @@ static int xcan_probe(struct platform_device *pdev) > > goto err; > > } > > > > - of_id = of_match_device(xcan_of_match, &pdev->dev); > > - if (of_id && of_id->data) > > - devtype = of_id->data; > > And in the old code devtype was conditionally re-initialised here, > if a match with data was found. > > But in the new code devtype is re-initialised unconditionally. > > Possibly I am missing something obvious, but it seems that either this > should somehow be made conditional, or the initialisation to &xcan_axi_data > should be dropped. of_match_device() would never fail because we only match with DT for this driver and if we didn't match, we wouldn't be in probe. So I'll drop the initialization. Rob