Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934759AbcKOTeN (ORCPT ); Tue, 15 Nov 2016 14:34:13 -0500 Received: from mout.kundenserver.de ([217.72.192.75]:65433 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932407AbcKOTeK (ORCPT ); Tue, 15 Nov 2016 14:34:10 -0500 Date: Tue, 15 Nov 2016 20:33:41 +0100 (CET) From: Stefan Wahren To: Ksenija Stanojevic , linux-kernel@vger.kernel.org Cc: lee.jones@linaro.org, linux-input@vger.kernel.org, pmeerw@pmeerw.net, jic23@kernel.org, knaack.h@gmx.de, lars@metafoo.de, dmitry.torokhov@gmail.com, harald@ccbib.org, fabio.estevam@freescale.com, linux-iio@vger.kernel.org, marex@denx.de Message-ID: <657653985.202232.6f7a3a9a-5120-4cc2-a76b-92a516ab6500.open-xchange@email.1und1.de> In-Reply-To: References: Subject: Re: [PATCH v9 1/5] mfd: mxs-lradc: Add support for mxs-lradc MFD MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Priority: 3 Importance: Medium X-Mailer: Open-Xchange Mailer v7.8.0-Rev40 X-Originating-Client: open-xchange-appsuite X-Provags-ID: V03:K0:5uJOqcx6cPkd/DN/F2MWeDH6K3W7OoK2VLaly0wQo6lpyMsGOjr 5/unhRToyonzE6OjdjfWz+j6MdYaq0pTKjiBNRkOk3nn04w/7B8u6UG+NBjPVKO5lZUuEMs ox8uhtE2t82PVp2ATLp6OncQl5phe+IT4oCwBKtrz8Z42FRtIdy/7Y8PnJneprONW9FNaM4 /QO66shHk/lAkMP0yLqNw== X-UI-Out-Filterresults: notjunk:1;V01:K0:DIaKZ1zSs68=:iyx34YvxXMfKcGsrZk0Vsk BuRvdnT0KH6RQ6Sz64HPUKdAYtPHwE0f/Zw6GyrxpA3Io+nZ4VfIAWKA5Qdpdnf5nWOLQUK5n /Jpu2f77o+X8jH2VWHmCKmr74Mquv7cZwIzq9dGM7A7iaIQ6X9mTSlZgfZqAOHldsJBLskW4H GH01N7Gpmg+5hY3qLAAsxa//FWzKkhP5r9lPxd0Kve2HvZmttj88PwniC7U/z9H9kn9lIF5QT H51XGgkc4do6BZaosbpLvO9Ct+Plb3nDuhXSdN16HigQws4SRa2jfooiE/WhTIoRbTbOI1in0 0hLMXVcXrHGS6PglBDMcmHukt3TN6rSO9kj4xsRuabZCVtgES3ZNk9MbgD0CfI+WEcT5ajVz+ JtqqL9YvBntDbjjgTd7lTz1XHKfvUE4z5kuXyPPL1zqIbry2BMb+JfutvtcBuBpGlZ/xn+GNM Xa/8mxcA63h59IpDbabUrUOsJcZy4NOG2vQvhkiynvuN6k3YXrbAGWMpGgYovy6nh9kCHQs2+ PKpp7Y5VXZ1RCf4sCDPuacYmO7Qno1IyVkVvNjK37J4mj5ZKpYTvvtyBFr7L8Y2RVWB9T/Tql 7lD7llYAc4rKwzyg+pmFZjro82mRWVwKFf9CYFreC5A6aDf3FjbCBJe0FmWNJcuphzJnc5aAO LnQUr3CRRxEIZJYBmiqGVud8e3RJvGUNAMHgi8lyAdT3n+EFmxNul4X1iqurasjzXhPfRmgFI 7cFpXlo0x/JUZIgF Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 3893 Lines: 128 Hi Ksenija, > Ksenija Stanojevic hat am 2. November 2016 um > 08:38 geschrieben: > > > Add core files for low resolution analog-to-digital converter (mxs-lradc) > MFD driver. > > Signed-off-by: Ksenija Stanojevic > --- > Changes in v9: > - improve commit message. > > Changes in v8: > - rebase onto 4.9-rc1 > > Changes in v7: > - define macros ADC_CELL and TSC_CELL > - remove one cell and dynamically set them in the switch() > - fail in the touchscreen driver instead of mfd driver if > hardware doesn't contain a touchscreen > > Changes in v6: > - update copyright > - add kernel-doc header for struct mxs-lradc > - add error message > - change EINVAL to ENODEV > - use PLATFORM_DEVID_NONE instead -1 > - cosmetic fixes > > Changes in v5: > - use DEFINE_RES_MEM > - don't pass ioreammaped adress to platform cells > - move comment outside of struct mxs_lradc > - change type of argument in mxs_lradc_reg_set, mxs_lradc_reg_clear, > mxs_lradc_reg_wrt (struct mxs_lradc * -> void __iomem *) > > Changes in v4: > - update copyright > - use DEFINE_RES_IRQ_NAMED > - remove mxs_lradc_add_device function > - use struct mfd_cell in static form > - improve spacing > - remove unnecessary comment > - remove platform_get_irq > - remove touch_ret and use ret instead > - rename use_touchscreen to touchscreen_wire > - use goto statements > - remove irq[13], irq_count and irq_name from struct mxs_lradc > - remove all defines from inside the struct definition > > Changes in v3: > - add note to commit message > - move switch statement into if(touch_ret == 0) branch > - add MODULE_AUTHOR > > Changes in v2: > - do not change spacing in Kconfig > - make struct mfd_cell part of struct mxs_lradc > - use switch instead of if in mxs_lradc_irq_mask > - use only necessary header files in mxs_lradc.h > - use devm_mfd_add_device > - use separate function to register mfd device > - change licence to GPL > - add copyright > > drivers/mfd/Kconfig | 17 +++ > drivers/mfd/Makefile | 1 + > drivers/mfd/mxs-lradc.c | 249 > ++++++++++++++++++++++++++++++++++++++++++ > include/linux/mfd/mxs-lradc.h | 203 ++++++++++++++++++++++++++++++++++ > 4 files changed, 470 insertions(+) > create mode 100644 drivers/mfd/mxs-lradc.c > create mode 100644 include/linux/mfd/mxs-lradc.h > > ... > diff --git a/drivers/mfd/mxs-lradc.c b/drivers/mfd/mxs-lradc.c > new file mode 100644 > index 0000000..ffc8f2e > --- /dev/null > +++ b/drivers/mfd/mxs-lradc.c > @@ -0,0 +1,249 @@ > ... > + > +static const struct of_device_id mxs_lradc_dt_ids[] = { > + { .compatible = "fsl,imx23-lradc", .data = (void *)IMX23_LRADC, }, > + { .compatible = "fsl,imx28-lradc", .data = (void *)IMX28_LRADC, }, > + { /* sentinel */ } > +}; > +MODULE_DEVICE_TABLE(of, mxs_lradc_dt_ids); > + > +static int mxs_lradc_probe(struct platform_device *pdev) > +{ > + const struct of_device_id *of_id; > + struct device *dev = &pdev->dev; > + struct device_node *node = dev->of_node; > + struct mxs_lradc *lradc; > + struct mfd_cell *cells = mxs_cells; > + int ret = 0; > + u32 ts_wires = 0; > + > + lradc = devm_kzalloc(&pdev->dev, sizeof(*lradc), GFP_KERNEL); > + if (!lradc) > + return -ENOMEM; > + > + of_id = of_match_device(mxs_lradc_dt_ids, &pdev->dev); since you already plan to make a V10, please add a NULL check here. So we can avoid a possible NULL pointer dereference in the following line. Thanks Stefan > + lradc->soc = (enum mxs_lradc_id)of_id->data; > + > + lradc->clk = devm_clk_get(&pdev->dev, NULL); > + if (IS_ERR(lradc->clk)) { > + dev_err(dev, "Failed to get the delay unit clock\n"); > + return PTR_ERR(lradc->clk); > + } > + > + ret = clk_prepare_enable(lradc->clk); > + if (ret) { > + dev_err(dev, "Failed to enable the delay unit clock\n"); > + return ret; > + } > +