From: Peter Korsgaard <peter@korsgaard.com>
To: Maxime Ripard <maxime.ripard@free-electrons.com>
Cc: Linus Walleij <linus.walleij@linaro.org>,
Alexandre Courbot <gnurou@gmail.com>,
Lee Jones <lee.jones@linaro.org>, Chen-Yu Tsai <wens@csie.org>,
devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org,
linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-sunxi@googlegroups.com, Hans de Goede <hdegoede@redhat.com>
Subject: Re: [linux-sunxi] [PATCH 1/4] gpio: Add AXP209 GPIO driver
Date: Wed, 09 Mar 2016 14:20:16 +0100 [thread overview]
Message-ID: <87io0v23fz.fsf@dell.be.48ers.dk> (raw)
In-Reply-To: <1457520614-32239-2-git-send-email-maxime.ripard@free-electrons.com> (Maxime Ripard's message of "Wed, 9 Mar 2016 11:50:11 +0100")
>>>>> "Maxime" == Maxime Ripard <maxime.ripard@free-electrons.com> writes:
> The AXP209 PMIC has a bunch of GPIOs accessible, that are usually used to
> control LEDs or backlight.
Do you find 3 'a bunch'? ;)
> +static int axp20x_gpio_probe(struct platform_device *pdev)
> +{
> + struct axp20x_dev *axp20x = dev_get_drvdata(pdev->dev.parent);
> + struct axp20x_gpio *gpio;
> + int ret;
> +
> + if (!of_device_is_available(pdev->dev.of_node))
> + return -ENODEV;
> +
> + if (!axp20x) {
> + dev_err(&pdev->dev, "Parent drvdata not set\n");
> + return -EINVAL;
> + }
> +
> + gpio = devm_kzalloc(&pdev->dev, sizeof(*gpio), GFP_KERNEL);
> + if (!gpio)
> + return -ENOMEM;
> +
> + gpio->chip.base = -1;
> + gpio->chip.can_sleep = true;
> + gpio->chip.dev = &pdev->dev;
> + gpio->chip.label = dev_name(&pdev->dev);
> + gpio->chip.owner = THIS_MODULE;
> + gpio->chip.get = axp20x_gpio_get;
> + gpio->chip.set = axp20x_gpio_set;
> + gpio->chip.direction_input = axp20x_gpio_input;
> + gpio->chip.direction_output = axp20x_gpio_output;
> + gpio->chip.ngpio = 3;
> +
> + gpio->regmap = axp20x->regmap;
This could just use dev_get_regmap(pdev.dev->parent, NULL) instead of
fiddling in the parent driver data.
> +
> + ret = gpiochip_add(&gpio->chip);
> + if (ret) {
> + dev_err(&pdev->dev, "Failed to register GPIO chip\n");
> + return ret;
> + }
> +
> + dev_info(&pdev->dev, "AXP209 GPIO driver loaded\n");
Any reason to be so noisy?
--
Bye, Peter Korsgaard
next prev parent reply other threads:[~2016-03-09 13:20 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-03-09 10:50 [PATCH 0/4] " Maxime Ripard
2016-03-09 10:50 ` [PATCH 1/4] gpio: " Maxime Ripard
2016-03-09 13:07 ` kbuild test robot
2016-03-09 13:20 ` Peter Korsgaard [this message]
2016-03-16 9:57 ` [linux-sunxi] " Linus Walleij
2016-03-16 9:56 ` Linus Walleij
2016-03-17 19:10 ` Rob Herring
2016-03-09 10:50 ` [PATCH 2/4] mfd: axp20x: Add AXP209 GPIO driver to the mfd Maxime Ripard
2016-03-16 10:03 ` Linus Walleij
2016-03-21 11:54 ` Lee Jones
2016-03-29 9:58 ` Maxime Ripard
2016-03-29 10:10 ` Lee Jones
2016-03-09 10:50 ` [PATCH 3/4] ARM: dt: axp209: Add AXP209 GPIO driver Maxime Ripard
2016-03-16 10:04 ` Linus Walleij
2016-03-09 10:50 ` [PATCH 4/4] ARM: sun5i: chip: Add status LED Maxime Ripard
2016-03-09 12:17 ` [PATCH 0/4] Add AXP209 GPIO driver Hans de Goede
2016-03-09 15:28 ` Maxime Ripard
2016-03-09 15:44 ` [linux-sunxi] " Hans de Goede
2016-03-16 10:10 ` Linus Walleij
2016-03-16 10:38 ` Hans de Goede
2016-03-22 7:22 ` Maxime Ripard
2016-03-22 7:33 ` Chen-Yu Tsai
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=87io0v23fz.fsf@dell.be.48ers.dk \
--to=peter@korsgaard.com \
--cc=devicetree@vger.kernel.org \
--cc=gnurou@gmail.com \
--cc=hdegoede@redhat.com \
--cc=lee.jones@linaro.org \
--cc=linus.walleij@linaro.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-gpio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-sunxi@googlegroups.com \
--cc=maxime.ripard@free-electrons.com \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Powered by JetHome