All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jonathan Cameron <Jonathan.Cameron@Huawei.com>
To: Guenter Roeck <linux@roeck-us.net>
Cc: Ruslan Zalata <rz@fabmicro.ru>, Jean Delvare <jdelvare@suse.com>,
	"Chen-Yu Tsai" <wens@csie.org>,
	Jernej Skrabec <jernej.skrabec@gmail.com>,
	"Samuel Holland" <samuel@sholland.org>,
	<linux-kernel@vger.kernel.org>, <linux-hwmon@vger.kernel.org>,
	<linux-arm-kernel@lists.infradead.org>,
	<linux-sunxi@lists.linux.dev>
Subject: Re: [PATCH v2] hwmon: (sun4i-lradc) Add driver for LRADC found on Allwinner A13/A20 SoC
Date: Fri, 29 Apr 2022 14:24:12 +0100	[thread overview]
Message-ID: <20220429142412.00001e43@Huawei.com> (raw)
In-Reply-To: <f79a8edf-36d4-02af-da8f-32b4e491bd47@roeck-us.net>

On Thu, 28 Apr 2022 14:30:06 -0700
Guenter Roeck <linux@roeck-us.net> 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@fabmicro.ru>  
> 
> 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@fabmicro.ru>");
> > +MODULE_LICENSE("GPL");
> > +No empty line at end, please  
> 
> 
> _______________________________________________
> linux-arm-kernel mailing list
> linux-arm-kernel@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel


WARNING: multiple messages have this Message-ID (diff)
From: Jonathan Cameron <Jonathan.Cameron@Huawei.com>
To: Guenter Roeck <linux@roeck-us.net>
Cc: Ruslan Zalata <rz@fabmicro.ru>, Jean Delvare <jdelvare@suse.com>,
	"Chen-Yu Tsai" <wens@csie.org>,
	Jernej Skrabec <jernej.skrabec@gmail.com>,
	"Samuel Holland" <samuel@sholland.org>,
	<linux-kernel@vger.kernel.org>, <linux-hwmon@vger.kernel.org>,
	<linux-arm-kernel@lists.infradead.org>,
	<linux-sunxi@lists.linux.dev>
Subject: Re: [PATCH v2] hwmon: (sun4i-lradc) Add driver for LRADC found on Allwinner A13/A20 SoC
Date: Fri, 29 Apr 2022 14:24:12 +0100	[thread overview]
Message-ID: <20220429142412.00001e43@Huawei.com> (raw)
In-Reply-To: <f79a8edf-36d4-02af-da8f-32b4e491bd47@roeck-us.net>

On Thu, 28 Apr 2022 14:30:06 -0700
Guenter Roeck <linux@roeck-us.net> 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@fabmicro.ru>  
> 
> 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@fabmicro.ru>");
> > +MODULE_LICENSE("GPL");
> > +No empty line at end, please  
> 
> 
> _______________________________________________
> linux-arm-kernel mailing list
> linux-arm-kernel@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

  parent reply	other threads:[~2022-04-29 13:43 UTC|newest]

Thread overview: 43+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-04-28 21:09 [PATCH v2] hwmon: (sun4i-lradc) Add driver for LRADC found on Allwinner A13/A20 SoC Ruslan Zalata
2022-04-28 21:30 ` Guenter Roeck
2022-04-28 21:30   ` Guenter Roeck
2022-04-29  0:28   ` Ruslan Zalata
2022-04-29  0:28     ` Ruslan Zalata
2022-04-29  5:32     ` Guenter Roeck
2022-04-29  5:32       ` Guenter Roeck
2022-04-29  6:03       ` Guenter Roeck
2022-04-29  6:03         ` Guenter Roeck
2022-05-02 23:47         ` Ruslan Zalata
2022-05-02 23:47           ` Ruslan Zalata
2022-04-29 13:24   ` Jonathan Cameron [this message]
2022-04-29 13:24     ` Jonathan Cameron
2022-05-02 23:20     ` Ruslan Zalata
2022-05-02 23:20       ` Ruslan Zalata
2022-05-02 11:00 ` Maxime Ripard
2022-05-02 11:00   ` Maxime Ripard
2022-05-02 11:15   ` Icenowy Zheng
2022-05-02 11:15     ` Icenowy Zheng
2022-05-02 11:21     ` Maxime Ripard
2022-05-02 11:21       ` Maxime Ripard
2022-05-03  2:02       ` Guenter Roeck
2022-05-03  2:02         ` Guenter Roeck
2022-05-03 15:26         ` Ruslan Zalata
2022-05-03 15:26           ` Ruslan Zalata
2022-05-03 16:14           ` Maxime Ripard
2022-05-03 16:14             ` Maxime Ripard
2022-05-03 21:37             ` Ruslan Zalata
2022-05-03 21:37               ` Ruslan Zalata
2022-05-04 14:12               ` Maxime Ripard
2022-05-04 14:12                 ` Maxime Ripard
2022-05-02 13:31   ` Guenter Roeck
2022-05-02 13:31     ` Guenter Roeck
2022-05-02 13:39     ` Maxime Ripard
2022-05-02 13:39       ` Maxime Ripard
2022-05-02 16:21       ` Guenter Roeck
2022-05-02 16:21         ` Guenter Roeck
2022-05-03  8:50   ` Ruslan Zalata
2022-05-03  8:50     ` Ruslan Zalata
2022-05-03 16:07     ` Maxime Ripard
2022-05-03 16:07       ` Maxime Ripard
2022-05-04 19:33 Jamie Cuthbert
2022-05-04 19:33 Jamie Cuthbert

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220429142412.00001e43@Huawei.com \
    --to=jonathan.cameron@huawei.com \
    --cc=jdelvare@suse.com \
    --cc=jernej.skrabec@gmail.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-hwmon@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-sunxi@lists.linux.dev \
    --cc=linux@roeck-us.net \
    --cc=rz@fabmicro.ru \
    --cc=samuel@sholland.org \
    --cc=wens@csie.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.