On Thu, 28 Apr 2022 14:30:06 -0700 Guenter Roeck <linux@xxxxxxxxxxxx> wrote: > On 4/28/22 14:09, Ruslan Zalata wrote: > > Some Allwinner SoCs like A13, A20 or T2 are equipped with two-channel > > low rate (6 bit) ADC that is often used for extra keys. There's a driver > > for that already implementing standard input device, but it has these > > limitations: 1) it cannot be used for general ADC data equisition, and > > acquisition > > > 2) it uses only one LRADC channel of two available. > > > > This driver provides basic hwmon interface to both channels of LRADC on > > such Allwinner SoCs. > > > > Signed-off-by: Ruslan Zalata <rz@xxxxxxxxxxx> > > Ok, next phase of review. > One thing noticed whilst randomly glancing at this patch. > > +#ifdef CONFIG_PM > > +static int sun4i_lradc_resume(struct device *dev) > > +{ > > + struct sun4i_lradc_data *lradc = dev_get_drvdata(dev); > > + > > + return sun4i_lradc_start(lradc); > > +} > > + > > +static int sun4i_lradc_suspend(struct device *dev) > > +{ > > + struct sun4i_lradc_data *lradc = dev_get_drvdata(dev); > > + > > + sun4i_lradc_stop(lradc); > > + return 0; > > +} > > + > > +#define SUN4I_LRADC_DEV_PM_OPS (&sun4i_lradc_dev_pm_ops) > > +#else > > +#define SUN4I_LRADC_DEV_PM_OPS NULL > > +#endif /* CONFIG_PM */ > > + > > +static const struct dev_pm_ops sun4i_lradc_dev_pm_ops = { We have much better infrastructure for this these days. Take a look at DEFINE_SIMPLE_DEV_PM_OPS() and pm_sleep_ptr() Those two in combination will let you get rid of all the ifdef stuff here by letting the compiler remove the unused code automatically. > > + .suspend = sun4i_lradc_suspend, > > + .resume = sun4i_lradc_resume, > > +}; > > + > > +static const struct of_device_id sun4i_lradc_of_match[] = { > > + { .compatible = "allwinner,sun4i-a10-lradc-keys", .data = &variant_sun4i_a10_lradc}, > > + { /* sentinel */ } > > +}; > > +MODULE_DEVICE_TABLE(of, sun4i_lradc_of_match); > > + > > +static struct platform_driver sun4i_lradc_driver = { > > + .driver = { > > + .name = "sun4i-lradc-hwmon", > > + .of_match_table = of_match_ptr(sun4i_lradc_of_match), > > + .pm = SUN4I_LRADC_DEV_PM_OPS, > > + }, > > + .probe = sun4i_lradc_probe, > > +}; > > + > > +module_platform_driver(sun4i_lradc_driver); > > + > > +MODULE_DESCRIPTION("Allwinner A13/A20 LRADC hwmon driver"); > > +MODULE_AUTHOR("Ruslan Zalata <rz@xxxxxxxxxxx>"); > > +MODULE_LICENSE("GPL"); > > +No empty line at end, please > > > _______________________________________________ > linux-arm-kernel mailing list > linux-arm-kernel@xxxxxxxxxxxxxxxxxxx > http://lists.infradead.org/mailman/listinfo/linux-arm-kernel