RE: [PATCH V2 08/10] watchdog: da9062/61: watchdog driver
From: Steve Twiss
Date: Thu Oct 27 2016 - 09:59:39 EST
On 26 October 2016 19:59 Guenter Roeck wrote:
> On Wed, Oct 26, 2016 at 05:56:39PM +0100, Steve Twiss wrote:
> > From: Steve Twiss <stwiss.opensource@xxxxxxxxxxx>
> >
> > +static const struct of_device_id da9062_compatible_id_table[] = {
> > + { .compatible = "dlg,da9062-watchdog", .data = &da9062_watchdog_info },
> > + { },
> > +};
> > +
> > static int da9062_wdt_probe(struct platform_device *pdev)
> > {
> > int ret;
> > struct da9062 *chip;
> > struct da9062_watchdog *wdt;
> > + const struct of_device_id *match;
> >
> > chip = dev_get_drvdata(pdev->dev.parent);
> > if (!chip)
> > return -EINVAL;
> >
> > + match = of_match_node(da9062_compatible_id_table,
> > + pdev->dev.of_node);
> > + if (!match)
> > + return -ENXIO;
> > +
> > wdt = devm_kzalloc(&pdev->dev, sizeof(*wdt), GFP_KERNEL);
> > if (!wdt)
> > return -ENOMEM;
> >
> > wdt->hw = chip;
> >
> > - wdt->wdtdev.info = &da9062_watchdog_info;
> > + wdt->wdtdev.info = (const struct watchdog_info *)match->data;
>
> I don't see why you would need match->data or of_match_node above.
Hi Guenter,
True. I do not need to do any matching on the table any more if the assumption is
to use a fall-back compatible string for DA9061 devices (to use the da9062 device
driver).
I can erase most of that content. Including the .data = &da9062_watchdog_info.
Regards,
Steve