* Re: [PATCH v3 2/6] net: rfkill: gpio: convert to descriptor-based GPIO interface
[not found] ` <1385460350-17543-3-git-send-email-mika.westerberg@linux.intel.com>
@ 2013-12-11 12:00 ` Linus Walleij
2013-12-23 10:54 ` Mika Westerberg
0 siblings, 1 reply; 4+ messages in thread
From: Linus Walleij @ 2013-12-11 12:00 UTC (permalink / raw)
To: Mika Westerberg, linux-netdev, netdev@vger.kernel.org,
David S. Miller
Cc: ACPI Devel Maling List, Rafael J. Wysocki, Chris Ball,
Johannes Berg, Rhyland Klein, Adrian Hunter, Alexandre Courbot,
Mathias Nyman, Rob Landley, Heikki Krogerus, Stephen Warren,
Thierry Reding, linux-gpio@vger.kernel.org,
linux-kernel@vger.kernel.org
On Tue, Nov 26, 2013 at 11:05 AM, Mika Westerberg
<mika.westerberg@linux.intel.com> wrote:
> From: Heikki Krogerus <heikki.krogerus@linux.intel.com>
>
> Convert to the safer gpiod_* family of API functions.
>
> Signed-off-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
> Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
> Tested-by: Stephen Warren <swarren@nvidia.com>
> ---
> net/rfkill/rfkill-gpio.c | 77 +++++++++++++++++++++---------------------------
> 1 file changed, 34 insertions(+), 43 deletions(-)
>
> diff --git a/net/rfkill/rfkill-gpio.c b/net/rfkill/rfkill-gpio.c
> index 5620d3c07479..bd2a5b90400c 100644
> --- a/net/rfkill/rfkill-gpio.c
> +++ b/net/rfkill/rfkill-gpio.c
> @@ -25,15 +25,15 @@
> #include <linux/clk.h>
> #include <linux/slab.h>
> #include <linux/acpi.h>
> -#include <linux/acpi_gpio.h>
> +#include <linux/gpio/consumer.h>
>
> #include <linux/rfkill-gpio.h>
>
> struct rfkill_gpio_data {
> const char *name;
> enum rfkill_type type;
> - int reset_gpio;
> - int shutdown_gpio;
> + struct gpio_desc *reset_gpio;
> + struct gpio_desc *shutdown_gpio;
>
> struct rfkill *rfkill_dev;
> char *reset_name;
> @@ -48,19 +48,15 @@ static int rfkill_gpio_set_power(void *data, bool blocked)
> struct rfkill_gpio_data *rfkill = data;
>
> if (blocked) {
> - if (gpio_is_valid(rfkill->shutdown_gpio))
> - gpio_set_value(rfkill->shutdown_gpio, 0);
> - if (gpio_is_valid(rfkill->reset_gpio))
> - gpio_set_value(rfkill->reset_gpio, 0);
> + gpiod_set_value(rfkill->shutdown_gpio, 0);
> + gpiod_set_value(rfkill->reset_gpio, 0);
> if (!IS_ERR(rfkill->clk) && rfkill->clk_enabled)
> clk_disable(rfkill->clk);
> } else {
> if (!IS_ERR(rfkill->clk) && !rfkill->clk_enabled)
> clk_enable(rfkill->clk);
> - if (gpio_is_valid(rfkill->reset_gpio))
> - gpio_set_value(rfkill->reset_gpio, 1);
> - if (gpio_is_valid(rfkill->shutdown_gpio))
> - gpio_set_value(rfkill->shutdown_gpio, 1);
> + gpiod_set_value(rfkill->reset_gpio, 1);
> + gpiod_set_value(rfkill->shutdown_gpio, 1);
> }
>
> rfkill->clk_enabled = blocked;
> @@ -83,8 +79,6 @@ static int rfkill_gpio_acpi_probe(struct device *dev,
>
> rfkill->name = dev_name(dev);
> rfkill->type = (unsigned)id->driver_data;
> - rfkill->reset_gpio = acpi_get_gpio_by_index(dev, 0, NULL);
> - rfkill->shutdown_gpio = acpi_get_gpio_by_index(dev, 1, NULL);
>
> return 0;
> }
> @@ -94,8 +88,9 @@ static int rfkill_gpio_probe(struct platform_device *pdev)
> struct rfkill_gpio_platform_data *pdata = pdev->dev.platform_data;
> struct rfkill_gpio_data *rfkill;
> const char *clk_name = NULL;
> - int ret = 0;
> - int len = 0;
> + struct gpio_desc *gpio;
> + int ret;
> + int len;
>
> rfkill = devm_kzalloc(&pdev->dev, sizeof(*rfkill), GFP_KERNEL);
> if (!rfkill)
> @@ -109,28 +104,10 @@ static int rfkill_gpio_probe(struct platform_device *pdev)
> clk_name = pdata->power_clk_name;
> rfkill->name = pdata->name;
> rfkill->type = pdata->type;
> - rfkill->reset_gpio = pdata->reset_gpio;
> - rfkill->shutdown_gpio = pdata->shutdown_gpio;
> } else {
> return -ENODEV;
> }
>
> - /* make sure at-least one of the GPIO is defined and that
> - * a name is specified for this instance */
> - if ((!gpio_is_valid(rfkill->reset_gpio) &&
> - !gpio_is_valid(rfkill->shutdown_gpio)) || !rfkill->name) {
> - pr_warn("%s: invalid platform data\n", __func__);
> - return -EINVAL;
> - }
> -
> - if (pdata && pdata->gpio_runtime_setup) {
> - ret = pdata->gpio_runtime_setup(pdev);
> - if (ret) {
> - pr_warn("%s: can't set up gpio\n", __func__);
> - return ret;
> - }
> - }
> -
> len = strlen(rfkill->name);
> rfkill->reset_name = devm_kzalloc(&pdev->dev, len + 7, GFP_KERNEL);
> if (!rfkill->reset_name)
> @@ -145,20 +122,34 @@ static int rfkill_gpio_probe(struct platform_device *pdev)
>
> rfkill->clk = devm_clk_get(&pdev->dev, clk_name);
>
> - if (gpio_is_valid(rfkill->reset_gpio)) {
> - ret = devm_gpio_request_one(&pdev->dev, rfkill->reset_gpio,
> - 0, rfkill->reset_name);
> - if (ret) {
> - pr_warn("%s: failed to get reset gpio.\n", __func__);
> + gpio = devm_gpiod_get_index(&pdev->dev, rfkill->reset_name, 0);
> + if (!IS_ERR(gpio)) {
> + ret = gpiod_direction_output(gpio, 0);
> + if (ret)
> return ret;
> - }
> + rfkill->reset_gpio = gpio;
> + }
> +
> + gpio = devm_gpiod_get_index(&pdev->dev, rfkill->shutdown_name, 1);
> + if (!IS_ERR(gpio)) {
> + ret = gpiod_direction_output(gpio, 0);
> + if (ret)
> + return ret;
> + rfkill->shutdown_gpio = gpio;
> }
>
> - if (gpio_is_valid(rfkill->shutdown_gpio)) {
> - ret = devm_gpio_request_one(&pdev->dev, rfkill->shutdown_gpio,
> - 0, rfkill->shutdown_name);
> + /* Make sure at-least one of the GPIO is defined and that
> + * a name is specified for this instance
> + */
> + if ((!rfkill->reset_gpio && !rfkill->shutdown_gpio) || !rfkill->name) {
> + dev_err(&pdev->dev, "invalid platform data\n");
> + return -EINVAL;
> + }
> +
> + if (pdata && pdata->gpio_runtime_setup) {
> + ret = pdata->gpio_runtime_setup(pdev);
> if (ret) {
> - pr_warn("%s: failed to get shutdown gpio.\n", __func__);
> + dev_err(&pdev->dev, "can't set up gpio\n");
> return ret;
> }
> }
DavidM: can I have an ACK from you to apply this patch through the GPIO
tree?
Yours,
Linus Walleij
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH v3 2/6] net: rfkill: gpio: convert to descriptor-based GPIO interface
2013-12-11 12:00 ` [PATCH v3 2/6] net: rfkill: gpio: convert to descriptor-based GPIO interface Linus Walleij
@ 2013-12-23 10:54 ` Mika Westerberg
2013-12-23 21:14 ` Johannes Berg
0 siblings, 1 reply; 4+ messages in thread
From: Mika Westerberg @ 2013-12-23 10:54 UTC (permalink / raw)
To: Linus Walleij, Johannes Berg, David S. Miller
Cc: linux-netdev, netdev@vger.kernel.org, ACPI Devel Maling List,
Rafael J. Wysocki, Chris Ball, Rhyland Klein, Adrian Hunter,
Alexandre Courbot, Mathias Nyman, Rob Landley, Heikki Krogerus,
Stephen Warren, Thierry Reding, linux-gpio@vger.kernel.org,
linux-kernel@vger.kernel.org
On Wed, Dec 11, 2013 at 01:00:18PM +0100, Linus Walleij wrote:
> On Tue, Nov 26, 2013 at 11:05 AM, Mika Westerberg
> <mika.westerberg@linux.intel.com> wrote:
>
> > From: Heikki Krogerus <heikki.krogerus@linux.intel.com>
> >
> > Convert to the safer gpiod_* family of API functions.
> >
> > Signed-off-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
> > Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
> > Tested-by: Stephen Warren <swarren@nvidia.com>
Johannes B, David M,
Are you fine with this patch? If yes, could you ack it so that we could get
it merged for 3.14.
Thanks!
Here's a link to this series:
https://lkml.org/lkml/2013/11/26/104
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH v3 2/6] net: rfkill: gpio: convert to descriptor-based GPIO interface
2013-12-23 10:54 ` Mika Westerberg
@ 2013-12-23 21:14 ` Johannes Berg
2014-01-07 17:43 ` Linus Walleij
0 siblings, 1 reply; 4+ messages in thread
From: Johannes Berg @ 2013-12-23 21:14 UTC (permalink / raw)
To: Mika Westerberg
Cc: Linus Walleij, David S. Miller, linux-netdev,
netdev@vger.kernel.org, ACPI Devel Maling List, Rafael J. Wysocki,
Chris Ball, Rhyland Klein, Adrian Hunter, Alexandre Courbot,
Mathias Nyman, Rob Landley, Heikki Krogerus, Stephen Warren,
Thierry Reding, linux-gpio@vger.kernel.org,
linux-kernel@vger.kernel.org
On Mon, 2013-12-23 at 12:54 +0200, Mika Westerberg wrote:
> On Wed, Dec 11, 2013 at 01:00:18PM +0100, Linus Walleij wrote:
> > On Tue, Nov 26, 2013 at 11:05 AM, Mika Westerberg
> > <mika.westerberg@linux.intel.com> wrote:
> >
> > > From: Heikki Krogerus <heikki.krogerus@linux.intel.com>
> > >
> > > Convert to the safer gpiod_* family of API functions.
> > >
> > > Signed-off-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
> > > Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
> > > Tested-by: Stephen Warren <swarren@nvidia.com>
>
> Johannes B, David M,
>
> Are you fine with this patch? If yes, could you ack it so that we could get
> it merged for 3.14.
I have no objection to this particular patch. I can't really comment on
it, but I never really delved too deeply into the rfkill-gpio thing - I
guess it works for whoever needed it :)
johannes
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH v3 2/6] net: rfkill: gpio: convert to descriptor-based GPIO interface
2013-12-23 21:14 ` Johannes Berg
@ 2014-01-07 17:43 ` Linus Walleij
0 siblings, 0 replies; 4+ messages in thread
From: Linus Walleij @ 2014-01-07 17:43 UTC (permalink / raw)
To: Johannes Berg
Cc: Mika Westerberg, David S. Miller, linux-netdev,
netdev@vger.kernel.org, ACPI Devel Maling List, Rafael J. Wysocki,
Chris Ball, Rhyland Klein, Adrian Hunter, Alexandre Courbot,
Mathias Nyman, Rob Landley, Heikki Krogerus, Stephen Warren,
Thierry Reding, linux-gpio@vger.kernel.org,
linux-kernel@vger.kernel.org
On Mon, Dec 23, 2013 at 10:14 PM, Johannes Berg
<johannes@sipsolutions.net> wrote:
> On Mon, 2013-12-23 at 12:54 +0200, Mika Westerberg wrote:
>> On Wed, Dec 11, 2013 at 01:00:18PM +0100, Linus Walleij wrote:
>> > On Tue, Nov 26, 2013 at 11:05 AM, Mika Westerberg
>> > <mika.westerberg@linux.intel.com> wrote:
>> >
>> > > From: Heikki Krogerus <heikki.krogerus@linux.intel.com>
>> > >
>> > > Convert to the safer gpiod_* family of API functions.
>> > >
>> > > Signed-off-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
>> > > Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
>> > > Tested-by: Stephen Warren <swarren@nvidia.com>
>>
>> Johannes B, David M,
>>
>> Are you fine with this patch? If yes, could you ack it so that we could get
>> it merged for 3.14.
>
> I have no objection to this particular patch. I can't really comment on
> it, but I never really delved too deeply into the rfkill-gpio thing - I
> guess it works for whoever needed it :)
I take that as an ACK ;-)
Patch applied.
Yours,
Linus Walleij
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2014-01-07 17:43 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <1385460350-17543-1-git-send-email-mika.westerberg@linux.intel.com>
[not found] ` <1385460350-17543-3-git-send-email-mika.westerberg@linux.intel.com>
2013-12-11 12:00 ` [PATCH v3 2/6] net: rfkill: gpio: convert to descriptor-based GPIO interface Linus Walleij
2013-12-23 10:54 ` Mika Westerberg
2013-12-23 21:14 ` Johannes Berg
2014-01-07 17:43 ` Linus Walleij
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).