[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAEUmHyaNEO_kZ1+m2JKbWEwMvujkkQRdQqKwbZyad_8eqWvM8Q@mail.gmail.com>
Date: Wed, 28 Jan 2015 09:14:29 +0530
From: Varka Bhadram <varkabhadram@...il.com>
To: Chao Xie <chao.xie@...vell.com>
Cc: Linus Walleij <linus.walleij@...aro.org>,
Alexandre Courbot <gnurou@...il.com>,
"linux-gpio@...r.kernel.org" <linux-gpio@...r.kernel.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
xiechao_mail@....com, haojian.zhuang@...il.com
Subject: Re: [PATCH] gpio: mmp: add GPIO driver for Marvell MMP series
On Wed, Jan 28, 2015 at 8:00 AM, Chao Xie <chao.xie@...vell.com> wrote:
> From: Chao Xie <chao.xie@...vell.com>
>
> For some old PXA series, they used PXA GPIO driver.
> The IP of GPIO changes since PXA988 which is Marvell MMP
> series.
> It will use new way to control the GPIO level, direction
> and edge status.
>
> Signed-off-by: Chao Xie <chao.xie@...vell.com>
> ---
> drivers/gpio/Kconfig | 7 +
> drivers/gpio/Makefile | 1 +
> drivers/gpio/gpio-mmp.c | 444 ++++++++++++++++++++++++++++++++++++++++++++++++
> 3 files changed, 452 insertions(+)
> create mode 100644 drivers/gpio/gpio-mmp.c
(...)
> +static int mmp_gpio_probe(struct platform_device *pdev)
> +{
> + struct device *dev = &pdev->dev;
> + struct mmp_gpio_platform_data *pdata;
> + struct device_node *np;
> + struct mmp_gpio_chip *mmp_chip;
> + struct mmp_gpio_bank *bank;
> + struct resource *res;
> + struct irq_domain *domain;
> + struct clk *clk;
> + int irq, i, ret;
> + void __iomem *base;
> +
> + pdata = dev_get_platdata(dev);
> + np = pdev->dev.of_node;
> + if (!np && !pdata)
> + return -EINVAL;
> +
> + mmp_chip = devm_kzalloc(dev, sizeof(*mmp_chip), GFP_KERNEL);
> + if (mmp_chip == NULL)
> + return -ENOMEM;
> +
Using ! operator preffred instead of comparing with NULL.
> + irq = platform_get_irq(pdev, 0);
> + if (irq < 0)
> + return irq;
> +
> + res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
> + if (!res)
> + return -EINVAL;
This check is not required.. Check on resource happenning with
devm_ioremap_resource.
> + base = devm_ioremap_resource(dev, res);
> + if (!base)
> + return -EINVAL;
I dont think this the correct return value.. return PTR_ERR(base)
> +
> + mmp_chip->irq = irq;
> + mmp_chip->reg_base = base;
> +
> + if (pdata)
> + ret = mmp_gpio_probe_pdata(pdev, mmp_chip, pdata);
> + else
> + ret = mmp_gpio_probe_dt(pdev, mmp_chip);
> +
> + if (ret) {
> + dev_err(dev, "Fail to initialize gpio unit, error %d.\n", ret);
> + return ret;
> + }
> +
> + clk = devm_clk_get(dev, NULL);
> + if (IS_ERR(clk)) {
> + dev_err(dev, "Fail to get gpio clock, error %ld.\n",
> + PTR_ERR(clk));
> + return PTR_ERR(clk);
> + }
> + ret = clk_prepare_enable(clk);
> + if (ret) {
> + dev_err(dev, "Fail to enable gpio clock, error %d.\n", ret);
> + return ret;
> + }
> +
> + domain = irq_domain_add_linear(np, mmp_chip->ngpio,
> + &mmp_gpio_irq_domain_ops, mmp_chip);
> + if (domain == NULL)
Using ! operator preferred instead of comparing with NULL.
--
Thanks and Regards,
Varka Bhadram.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists