diff mbox

[1/4] net: rfkill: gpio: remove unused and obsolete platform parameters

Message ID 1392900697-27577-2-git-send-email-heikki.krogerus@linux.intel.com (mailing list archive)
State Not Applicable, archived
Headers show

Commit Message

Heikki Krogerus Feb. 20, 2014, 12:51 p.m. UTC
After upgrading to descriptor based gpios, the gpio numbers
are not used anymore. The power_clk_name and the platform
specific setup and close hooks are not used by anybody, and
we should not encourage use of such things, so removing them.

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

Comments

Marc Dietrich Feb. 21, 2014, 1:55 p.m. UTC | #1
Hi Heikki,

Am Donnerstag, 20. Februar 2014, 14:51:34 schrieb Heikki Krogerus:
> After upgrading to descriptor based gpios, the gpio numbers
> are not used anymore. The power_clk_name and the platform
> specific setup and close hooks are not used by anybody, and
> we should not encourage use of such things, so removing them.

arch/arm/mach-tegra/board-paz00.c is still using platform data. Is there some 
prerequisite patch I'm missing (3.14-rc3) or how can this file be converted? 
We are waiting for DT support to arrive so we can finally remove this file.

Marc

> 
> Signed-off-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
> ---
>  include/linux/rfkill-gpio.h | 10 ----------
>  net/rfkill/rfkill-gpio.c    | 15 +--------------
>  2 files changed, 1 insertion(+), 24 deletions(-)
> 
> diff --git a/include/linux/rfkill-gpio.h b/include/linux/rfkill-gpio.h
> index 4d09f6e..20bcb55 100644
> --- a/include/linux/rfkill-gpio.h
> +++ b/include/linux/rfkill-gpio.h
> @@ -27,21 +27,11 @@
>   * 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
>   */
> 
>  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..0adda44 100644
> --- a/net/rfkill/rfkill-gpio.c
> +++ b/net/rfkill/rfkill-gpio.c
> @@ -87,7 +87,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 +100,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,7 +118,7 @@ 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);
> +	rfkill->clk = devm_clk_get(&pdev->dev, NULL);
> 
>  	gpio = devm_gpiod_get_index(&pdev->dev, rfkill->reset_name, 0);
>  	if (!IS_ERR(gpio)) {
> @@ -146,14 +144,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 +164,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);

--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Heikki Krogerus Feb. 21, 2014, 2:23 p.m. UTC | #2
Hi,

On Fri, Feb 21, 2014 at 02:55:14PM +0100, Marc Dietrich wrote:
> Am Donnerstag, 20. Februar 2014, 14:51:34 schrieb Heikki Krogerus:
> > After upgrading to descriptor based gpios, the gpio numbers
> > are not used anymore. The power_clk_name and the platform
> > specific setup and close hooks are not used by anybody, and
> > we should not encourage use of such things, so removing them.
> 
> arch/arm/mach-tegra/board-paz00.c is still using platform data. Is there some 
> prerequisite patch I'm missing (3.14-rc3) or how can this file be converted? 
> We are waiting for DT support to arrive so we can finally remove this file.

True! It still set's the shutdown_gpio and reset_gpio members. I think
I'll leave the header untouched and just clean net/rfkill/rfkill-gpio.c
in this patch. We can remove the whole header after you guys have moved
to DT.

I'll prepare v2 next week.

Thanks!
Marc Dietrich Feb. 22, 2014, 10:32 p.m. UTC | #3
On Friday 21 February 2014 16:23:49 Heikki Krogerus wrote:
> Hi,
> 
> On Fri, Feb 21, 2014 at 02:55:14PM +0100, Marc Dietrich wrote:
> > Am Donnerstag, 20. Februar 2014, 14:51:34 schrieb Heikki Krogerus:
> > > After upgrading to descriptor based gpios, the gpio numbers
> > > are not used anymore. The power_clk_name and the platform
> > > specific setup and close hooks are not used by anybody, and
> > > we should not encourage use of such things, so removing them.
> > 
> > arch/arm/mach-tegra/board-paz00.c is still using platform data. Is there
> > some prerequisite patch I'm missing (3.14-rc3) or how can this file be
> > converted? We are waiting for DT support to arrive so we can finally
> > remove this file.
> True! It still set's the shutdown_gpio and reset_gpio members. I think
> I'll leave the header untouched and just clean net/rfkill/rfkill-gpio.c
> in this patch. We can remove the whole header after you guys have moved
> to DT.

Why? Just update the board file to remove those entries. I just checked that 
it's working fine without. So if you don't mind, add a patch to remove the 
entries as the first patch in your series.

Thanks

Marc
--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Heikki Krogerus Feb. 24, 2014, 8:38 a.m. UTC | #4
On Sat, Feb 22, 2014 at 11:32:04PM +0100, Marc Dietrich wrote:
> On Friday 21 February 2014 16:23:49 Heikki Krogerus wrote:
> > On Fri, Feb 21, 2014 at 02:55:14PM +0100, Marc Dietrich wrote:
> > > arch/arm/mach-tegra/board-paz00.c is still using platform data. Is there
> > > some prerequisite patch I'm missing (3.14-rc3) or how can this file be
> > > converted? We are waiting for DT support to arrive so we can finally
> > > remove this file.
> > True! It still set's the shutdown_gpio and reset_gpio members. I think
> > I'll leave the header untouched and just clean net/rfkill/rfkill-gpio.c
> > in this patch. We can remove the whole header after you guys have moved
> > to DT.
> 
> Why? Just update the board file to remove those entries. I just checked that 
> it's working fine without. So if you don't mind, add a patch to remove the 
> entries as the first patch in your series.

I was hoping I wouldn't have to touch arch/arm/mach-tegra/board-paz00.c
any more. But OK, I'll add a patch and remove the entries.

Thanks,
Marc Dietrich Feb. 24, 2014, 8:42 a.m. UTC | #5
Hi,

Am Montag, 24. Februar 2014, 10:38:20 schrieb Heikki Krogerus:
> On Sat, Feb 22, 2014 at 11:32:04PM +0100, Marc Dietrich wrote:
> > On Friday 21 February 2014 16:23:49 Heikki Krogerus wrote:
> > > On Fri, Feb 21, 2014 at 02:55:14PM +0100, Marc Dietrich wrote:
> > > > arch/arm/mach-tegra/board-paz00.c is still using platform data. Is
> > > > there
> > > > some prerequisite patch I'm missing (3.14-rc3) or how can this file be
> > > > converted? We are waiting for DT support to arrive so we can finally
> > > > remove this file.
> > > 
> > > True! It still set's the shutdown_gpio and reset_gpio members. I think
> > > I'll leave the header untouched and just clean net/rfkill/rfkill-gpio.c
> > > in this patch. We can remove the whole header after you guys have moved
> > > to DT.
> > 
> > Why? Just update the board file to remove those entries. I just checked
> > that it's working fine without. So if you don't mind, add a patch to
> > remove the entries as the first patch in your series.
> 
> I was hoping I wouldn't have to touch arch/arm/mach-tegra/board-paz00.c
> any more. But OK, I'll add a patch and remove the entries.

hey, someone has to do it :-) I wouldn't mind to do it myself, but you are 
trying to break it, so I think it's your reponsibility to fix it.

Marc

--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/include/linux/rfkill-gpio.h b/include/linux/rfkill-gpio.h
index 4d09f6e..20bcb55 100644
--- a/include/linux/rfkill-gpio.h
+++ b/include/linux/rfkill-gpio.h
@@ -27,21 +27,11 @@ 
  * 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
  */
 
 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..0adda44 100644
--- a/net/rfkill/rfkill-gpio.c
+++ b/net/rfkill/rfkill-gpio.c
@@ -87,7 +87,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 +100,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,7 +118,7 @@  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);
+	rfkill->clk = devm_clk_get(&pdev->dev, NULL);
 
 	gpio = devm_gpiod_get_index(&pdev->dev, rfkill->reset_name, 0);
 	if (!IS_ERR(gpio)) {
@@ -146,14 +144,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 +164,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);