From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id BB5BEC433F5 for ; Fri, 29 Apr 2022 13:25:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Subject:CC:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=HJuGDBeeXnmLj2z5S6weJWr3kP4TKxRfvS+eCdVCzyI=; b=Fx1ry8AwWAOhWA 7EMGS3XtCCRWD2MUuEj+RYbs5FoutG/tT2uS2okG8/Kn7SJAGp1m+uHIRv6eS9KyvjbaOLUB3ded9 AEGs5iVTBXYS5J3ESedPZANIIAn4klC0RhSvYU55FSiwbTbCor0295AzFf/lirEZ4w+T9NQOS+qIy U/gE1WT00gd2StENGIGO/BnAf1rx+IJI9v1isBXJYB/us4aPN9vUHJ3boRugrwxoHpX4uigZCG0Mk SGIMEgUhlaUh8d0qxedymmEP9SrPXqtvdFtW4mirbDH4sIQ+OuX+gTfZAFiy1ZVokN3QSoNt1Jd4R kNq+pyX1q5TBdTMp8tQQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nkQbk-00BM9F-DL; Fri, 29 Apr 2022 13:24:28 +0000 Received: from frasgout.his.huawei.com ([185.176.79.56]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1nkQbf-00BM6f-Mr for linux-arm-kernel@lists.infradead.org; Fri, 29 Apr 2022 13:24:26 +0000 Received: from fraeml743-chm.china.huawei.com (unknown [172.18.147.201]) by frasgout.his.huawei.com (SkyGuard) with ESMTP id 4KqY4j5gxhz67NKJ; Fri, 29 Apr 2022 21:20:05 +0800 (CST) Received: from lhreml710-chm.china.huawei.com (10.201.108.61) by fraeml743-chm.china.huawei.com (10.206.15.224) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.24; Fri, 29 Apr 2022 15:24:14 +0200 Received: from localhost (10.81.206.67) by lhreml710-chm.china.huawei.com (10.201.108.61) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.24; Fri, 29 Apr 2022 14:24:13 +0100 Date: Fri, 29 Apr 2022 14:24:12 +0100 From: Jonathan Cameron To: Guenter Roeck CC: Ruslan Zalata , Jean Delvare , "Chen-Yu Tsai" , Jernej Skrabec , "Samuel Holland" , , , , Subject: Re: [PATCH v2] hwmon: (sun4i-lradc) Add driver for LRADC found on Allwinner A13/A20 SoC Message-ID: <20220429142412.00001e43@Huawei.com> In-Reply-To: References: <20220428210906.29527-1-rz@fabmicro.ru> Organization: Huawei Technologies Research and Development (UK) Ltd. X-Mailer: Claws Mail 4.0.0 (GTK+ 3.24.29; i686-w64-mingw32) MIME-Version: 1.0 X-Originating-IP: [10.81.206.67] X-ClientProxiedBy: lhreml720-chm.china.huawei.com (10.201.108.71) To lhreml710-chm.china.huawei.com (10.201.108.61) X-CFilter-Loop: Reflected X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220429_062424_090116_10DAA34C X-CRM114-Status: GOOD ( 21.15 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Thu, 28 Apr 2022 14:30:06 -0700 Guenter Roeck 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 > > 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 "); > > +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