lkml.org 
[lkml]   [2013]   [Nov]   [22]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
SubjectRe: [PATCH v2 3/7] net: rfkill: gpio: remove gpio conversion support
On Fri, Nov 22, 2013 at 11:40:32AM -0700, Stephen Warren wrote:
> On 11/22/2013 05:14 AM, Mika Westerberg wrote:
> > From: Heikki Krogerus <heikki.krogerus@linux.intel.com>
> >
> > All platforms using this driver are now converted to the new
> > descriptor-based GPIO interface.
>
> Don't you want to remove the fields from the pdata structure too, since
> it's pointless to set them anymore IIUC?

Agreed. We should have removed them in this patch.

I have prepared a separate patch where I remove those and some other
unused fields from the pdata structure (attachment). Would it be OK to
add that to this patch set? Or should this patch simply be updated?

--
heikki
From 1c561787e04361b2a6a8114df99b6a2854834684 Mon Sep 17 00:00:00 2001
From: Heikki Krogerus <heikki.krogerus@linux.intel.com>
Date: Fri, 22 Nov 2013 15:35:10 +0200
Subject: [PATCH] net: rfkill: gpio: remove obsolete fields from platform data

The driver does not support the legacy GPIO API any more and
there are no users for the clock.

The platform setup hooks were apparently designed to be
used if platform specific configurations like pin
multiplexing needed handling. Now there is the pin control
subsystem that is designed to cover such things. In any
case, there are no users for those either.

Signed-off-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
---
include/linux/rfkill-gpio.h | 15 ++-------------
net/rfkill/rfkill-gpio.c | 25 -------------------------
2 files changed, 2 insertions(+), 38 deletions(-)

diff --git a/include/linux/rfkill-gpio.h b/include/linux/rfkill-gpio.h
index 4d09f6e..2c65e5d 100644
--- a/include/linux/rfkill-gpio.h
+++ b/include/linux/rfkill-gpio.h
@@ -20,28 +20,17 @@
#ifndef __RFKILL_GPIO_H
#define __RFKILL_GPIO_H

-#include <linux/types.h>
#include <linux/rfkill.h>

/**
* struct rfkill_gpio_platform_data - platform data for rfkill gpio device.
- * for unused gpio's, the expected value is -1.
- * @name: name for the gpio rf kill instance
- * @reset_gpio: GPIO which is used for reseting rfkill switch
- * @shutdown_gpio: GPIO which is used for shutdown of rfkill switch
- * @power_clk_name: [optional] name of clk to turn off while blocked
- * @gpio_runtime_close: clean up platform specific gpio configuration
- * @gpio_runtime_setup: set up platform specific gpio configuration
+ * @name: name for the gpio rfkill instance
+ * @type: rfkill type for the instance
*/

struct rfkill_gpio_platform_data {
char *name;
- int reset_gpio;
- int shutdown_gpio;
- const char *power_clk_name;
enum rfkill_type type;
- void (*gpio_runtime_close)(struct platform_device *);
- int (*gpio_runtime_setup)(struct platform_device *);
};

#endif /* __RFKILL_GPIO_H */
diff --git a/net/rfkill/rfkill-gpio.c b/net/rfkill/rfkill-gpio.c
index bd2a5b9..829da11 100644
--- a/net/rfkill/rfkill-gpio.c
+++ b/net/rfkill/rfkill-gpio.c
@@ -22,7 +22,6 @@
#include <linux/module.h>
#include <linux/rfkill.h>
#include <linux/platform_device.h>
-#include <linux/clk.h>
#include <linux/slab.h>
#include <linux/acpi.h>
#include <linux/gpio/consumer.h>
@@ -38,9 +37,6 @@ struct rfkill_gpio_data {
struct rfkill *rfkill_dev;
char *reset_name;
char *shutdown_name;
- struct clk *clk;
-
- bool clk_enabled;
};

static int rfkill_gpio_set_power(void *data, bool blocked)
@@ -50,17 +46,11 @@ static int rfkill_gpio_set_power(void *data, bool blocked)
if (blocked) {
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);
gpiod_set_value(rfkill->reset_gpio, 1);
gpiod_set_value(rfkill->shutdown_gpio, 1);
}

- rfkill->clk_enabled = blocked;
-
return 0;
}

@@ -87,7 +77,6 @@ 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;
struct gpio_desc *gpio;
int ret;
int len;
@@ -101,7 +90,6 @@ static int rfkill_gpio_probe(struct platform_device *pdev)
if (ret)
return ret;
} else if (pdata) {
- clk_name = pdata->power_clk_name;
rfkill->name = pdata->name;
rfkill->type = pdata->type;
} else {
@@ -120,8 +108,6 @@ static int rfkill_gpio_probe(struct platform_device *pdev)
snprintf(rfkill->reset_name, len + 6 , "%s_reset", rfkill->name);
snprintf(rfkill->shutdown_name, len + 9, "%s_shutdown", rfkill->name);

- rfkill->clk = devm_clk_get(&pdev->dev, clk_name);
-
gpio = devm_gpiod_get_index(&pdev->dev, rfkill->reset_name, 0);
if (!IS_ERR(gpio)) {
ret = gpiod_direction_output(gpio, 0);
@@ -146,14 +132,6 @@ static int rfkill_gpio_probe(struct platform_device *pdev)
return -EINVAL;
}

- if (pdata && pdata->gpio_runtime_setup) {
- ret = pdata->gpio_runtime_setup(pdev);
- if (ret) {
- dev_err(&pdev->dev, "can't set up gpio\n");
- return ret;
- }
- }
-
rfkill->rfkill_dev = rfkill_alloc(rfkill->name, &pdev->dev,
rfkill->type, &rfkill_gpio_ops,
rfkill);
@@ -174,10 +152,7 @@ static int rfkill_gpio_probe(struct platform_device *pdev)
static int rfkill_gpio_remove(struct platform_device *pdev)
{
struct rfkill_gpio_data *rfkill = platform_get_drvdata(pdev);
- struct rfkill_gpio_platform_data *pdata = pdev->dev.platform_data;

- if (pdata && pdata->gpio_runtime_close)
- pdata->gpio_runtime_close(pdev);
rfkill_unregister(rfkill->rfkill_dev);
rfkill_destroy(rfkill->rfkill_dev);

--
1.8.4.3
\
 
 \ /
  Last update: 2013-11-22 22:21    [W:0.115 / U:0.128 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site