All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] mtd: bcm47xxsflash: use platform_(set|get)_drvdata
@ 2017-01-16 13:04 Rafał Miłecki
  2017-01-16 13:31 ` Marek Vasut
  2017-01-16 14:21 ` Boris Brezillon
  0 siblings, 2 replies; 4+ messages in thread
From: Rafał Miłecki @ 2017-01-16 13:04 UTC (permalink / raw)
  To: David Woodhouse, Brian Norris, Boris Brezillon, Marek Vasut,
	Richard Weinberger, Cyrille Pitchen
  Cc: linux-mtd, Hauke Mehrtens, Rafał Miłecki

From: Rafał Miłecki <rafal@milecki.pl>

We have generic place & helpers for storing platform driver data so
there is no reason for using custom priv pointer.

This patch will be followed by cleaning struct bcma_sflash which will go
through another tree where bcma development happens.

Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
---
 drivers/mtd/devices/bcm47xxsflash.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/mtd/devices/bcm47xxsflash.c b/drivers/mtd/devices/bcm47xxsflash.c
index 514be04..4decd8c 100644
--- a/drivers/mtd/devices/bcm47xxsflash.c
+++ b/drivers/mtd/devices/bcm47xxsflash.c
@@ -284,7 +284,6 @@ static int bcm47xxsflash_bcma_probe(struct platform_device *pdev)
 	b47s = devm_kzalloc(dev, sizeof(*b47s), GFP_KERNEL);
 	if (!b47s)
 		return -ENOMEM;
-	sflash->priv = b47s;
 
 	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
 	if (!res) {
@@ -334,6 +333,8 @@ static int bcm47xxsflash_bcma_probe(struct platform_device *pdev)
 	b47s->size = sflash->size;
 	bcm47xxsflash_fill_mtd(b47s, &pdev->dev);
 
+	platform_set_drvdata(pdev, b47s);
+
 	err = mtd_device_parse_register(&b47s->mtd, probes, NULL, NULL, 0);
 	if (err) {
 		pr_err("Failed to register MTD device: %d\n", err);
@@ -349,8 +350,7 @@ static int bcm47xxsflash_bcma_probe(struct platform_device *pdev)
 
 static int bcm47xxsflash_bcma_remove(struct platform_device *pdev)
 {
-	struct bcma_sflash *sflash = dev_get_platdata(&pdev->dev);
-	struct bcm47xxsflash *b47s = sflash->priv;
+	struct bcm47xxsflash *b47s = platform_get_drvdata(pdev);
 
 	mtd_device_unregister(&b47s->mtd);
 	iounmap(b47s->window);
-- 
2.10.1

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] mtd: bcm47xxsflash: use platform_(set|get)_drvdata
  2017-01-16 13:04 [PATCH] mtd: bcm47xxsflash: use platform_(set|get)_drvdata Rafał Miłecki
@ 2017-01-16 13:31 ` Marek Vasut
  2017-01-16 14:21 ` Boris Brezillon
  1 sibling, 0 replies; 4+ messages in thread
From: Marek Vasut @ 2017-01-16 13:31 UTC (permalink / raw)
  To: Rafał Miłecki, David Woodhouse, Brian Norris,
	Boris Brezillon, Richard Weinberger, Cyrille Pitchen
  Cc: linux-mtd, Hauke Mehrtens, Rafał Miłecki

On 01/16/2017 02:04 PM, Rafał Miłecki wrote:
> From: Rafał Miłecki <rafal@milecki.pl>
> 
> We have generic place & helpers for storing platform driver data so
> there is no reason for using custom priv pointer.
> 
> This patch will be followed by cleaning struct bcma_sflash which will go
> through another tree where bcma development happens.
> 
> Signed-off-by: Rafał Miłecki <rafal@milecki.pl>

Acked-by: Marek Vasut <marek.vasut@gmail.com>

> ---
>  drivers/mtd/devices/bcm47xxsflash.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/mtd/devices/bcm47xxsflash.c b/drivers/mtd/devices/bcm47xxsflash.c
> index 514be04..4decd8c 100644
> --- a/drivers/mtd/devices/bcm47xxsflash.c
> +++ b/drivers/mtd/devices/bcm47xxsflash.c
> @@ -284,7 +284,6 @@ static int bcm47xxsflash_bcma_probe(struct platform_device *pdev)
>  	b47s = devm_kzalloc(dev, sizeof(*b47s), GFP_KERNEL);
>  	if (!b47s)
>  		return -ENOMEM;
> -	sflash->priv = b47s;
>  
>  	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
>  	if (!res) {
> @@ -334,6 +333,8 @@ static int bcm47xxsflash_bcma_probe(struct platform_device *pdev)
>  	b47s->size = sflash->size;
>  	bcm47xxsflash_fill_mtd(b47s, &pdev->dev);
>  
> +	platform_set_drvdata(pdev, b47s);
> +
>  	err = mtd_device_parse_register(&b47s->mtd, probes, NULL, NULL, 0);
>  	if (err) {
>  		pr_err("Failed to register MTD device: %d\n", err);
> @@ -349,8 +350,7 @@ static int bcm47xxsflash_bcma_probe(struct platform_device *pdev)
>  
>  static int bcm47xxsflash_bcma_remove(struct platform_device *pdev)
>  {
> -	struct bcma_sflash *sflash = dev_get_platdata(&pdev->dev);
> -	struct bcm47xxsflash *b47s = sflash->priv;
> +	struct bcm47xxsflash *b47s = platform_get_drvdata(pdev);
>  
>  	mtd_device_unregister(&b47s->mtd);
>  	iounmap(b47s->window);
> 


-- 
Best regards,
Marek Vasut

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] mtd: bcm47xxsflash: use platform_(set|get)_drvdata
  2017-01-16 13:04 [PATCH] mtd: bcm47xxsflash: use platform_(set|get)_drvdata Rafał Miłecki
  2017-01-16 13:31 ` Marek Vasut
@ 2017-01-16 14:21 ` Boris Brezillon
  2017-01-16 16:12   ` Rafał Miłecki
  1 sibling, 1 reply; 4+ messages in thread
From: Boris Brezillon @ 2017-01-16 14:21 UTC (permalink / raw)
  To: Rafał Miłecki
  Cc: David Woodhouse, Brian Norris, Marek Vasut, Richard Weinberger,
	Cyrille Pitchen, linux-mtd, Hauke Mehrtens,
	Rafał Miłecki

On Mon, 16 Jan 2017 14:04:09 +0100
Rafał Miłecki <zajec5@gmail.com> wrote:

> From: Rafał Miłecki <rafal@milecki.pl>
> 
> We have generic place & helpers for storing platform driver data so
> there is no reason for using custom priv pointer.
> 
> This patch will be followed by cleaning struct bcma_sflash which will go
> through another tree where bcma development happens.

Why not removing the ->priv field from the bcma_sflash struct
definition in this patch?
If it needs to go through a different tree we can ack the patch and let
the other maintainer(s) take the whole series.

Note that ->mtd seems to be unused, and should probably be removed as
well (in a separate patch of course). But I guess you already know that.

> 
> Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
> ---
>  drivers/mtd/devices/bcm47xxsflash.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/mtd/devices/bcm47xxsflash.c b/drivers/mtd/devices/bcm47xxsflash.c
> index 514be04..4decd8c 100644
> --- a/drivers/mtd/devices/bcm47xxsflash.c
> +++ b/drivers/mtd/devices/bcm47xxsflash.c
> @@ -284,7 +284,6 @@ static int bcm47xxsflash_bcma_probe(struct platform_device *pdev)
>  	b47s = devm_kzalloc(dev, sizeof(*b47s), GFP_KERNEL);
>  	if (!b47s)
>  		return -ENOMEM;
> -	sflash->priv = b47s;
>  
>  	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
>  	if (!res) {
> @@ -334,6 +333,8 @@ static int bcm47xxsflash_bcma_probe(struct platform_device *pdev)
>  	b47s->size = sflash->size;
>  	bcm47xxsflash_fill_mtd(b47s, &pdev->dev);
>  
> +	platform_set_drvdata(pdev, b47s);
> +
>  	err = mtd_device_parse_register(&b47s->mtd, probes, NULL, NULL, 0);
>  	if (err) {
>  		pr_err("Failed to register MTD device: %d\n", err);
> @@ -349,8 +350,7 @@ static int bcm47xxsflash_bcma_probe(struct platform_device *pdev)
>  
>  static int bcm47xxsflash_bcma_remove(struct platform_device *pdev)
>  {
> -	struct bcma_sflash *sflash = dev_get_platdata(&pdev->dev);
> -	struct bcm47xxsflash *b47s = sflash->priv;
> +	struct bcm47xxsflash *b47s = platform_get_drvdata(pdev);
>  
>  	mtd_device_unregister(&b47s->mtd);
>  	iounmap(b47s->window);

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] mtd: bcm47xxsflash: use platform_(set|get)_drvdata
  2017-01-16 14:21 ` Boris Brezillon
@ 2017-01-16 16:12   ` Rafał Miłecki
  0 siblings, 0 replies; 4+ messages in thread
From: Rafał Miłecki @ 2017-01-16 16:12 UTC (permalink / raw)
  To: Boris Brezillon
  Cc: David Woodhouse, Brian Norris, Marek Vasut, Richard Weinberger,
	Cyrille Pitchen, linux-mtd, Hauke Mehrtens,
	Rafał Miłecki

On 16 January 2017 at 15:21, Boris Brezillon
<boris.brezillon@free-electrons.com> wrote:
> On Mon, 16 Jan 2017 14:04:09 +0100
> Rafał Miłecki <zajec5@gmail.com> wrote:
>
>> From: Rafał Miłecki <rafal@milecki.pl>
>>
>> We have generic place & helpers for storing platform driver data so
>> there is no reason for using custom priv pointer.
>>
>> This patch will be followed by cleaning struct bcma_sflash which will go
>> through another tree where bcma development happens.
>
> Why not removing the ->priv field from the bcma_sflash struct
> definition in this patch?
> If it needs to go through a different tree we can ack the patch and let
> the other maintainer(s) take the whole series.

I can try that. As this will be more mtd-focused, I guess I should
rather get Kalle's ack. I'll work on that.

-- 
Rafał

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2017-01-16 16:12 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-01-16 13:04 [PATCH] mtd: bcm47xxsflash: use platform_(set|get)_drvdata Rafał Miłecki
2017-01-16 13:31 ` Marek Vasut
2017-01-16 14:21 ` Boris Brezillon
2017-01-16 16:12   ` Rafał Miłecki

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.