mtd: bcm47xxsflash: use platform_(set|get)_drvdata
Linux-MTD Mailing List
linux-mtd at lists.infradead.org
Sun Feb 12 18:59:01 PST 2017
Gitweb: http://git.infradead.org/?p=mtd-2.6.git;a=commit;h=be5e5099183301fb7920f8f6b66bd3ac1f820a97
Commit: be5e5099183301fb7920f8f6b66bd3ac1f820a97
Parent: 7a308bb3016f57e5be11a677d15b821536419d36
Author: Rafał Miłecki <rafal at milecki.pl>
AuthorDate: Mon Jan 16 17:28:18 2017 +0100
Committer: Brian Norris <computersforpeace at gmail.com>
CommitDate: Wed Feb 8 11:19:43 2017 -0800
mtd: bcm47xxsflash: use platform_(set|get)_drvdata
We have generic place & helpers for storing platform driver data so
there is no reason for using custom priv pointer.
This allows cleaning up struct bcma_sflash from unneeded fields.
Signed-off-by: Rafał Miłecki <rafal at milecki.pl>
Acked-by: Kalle Valo <kvalo at codeaurora.org>
Acked-by: Boris Brezillon <boris.brezillon at free-electrons.com>
Signed-off-by: Brian Norris <computersforpeace at gmail.com>
---
drivers/mtd/devices/bcm47xxsflash.c | 6 +++---
include/linux/bcma/bcma_driver_chipcommon.h | 3 ---
2 files changed, 3 insertions(+), 6 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);
diff --git a/include/linux/bcma/bcma_driver_chipcommon.h b/include/linux/bcma/bcma_driver_chipcommon.h
index b20e3d5..2f1c690 100644
--- a/include/linux/bcma/bcma_driver_chipcommon.h
+++ b/include/linux/bcma/bcma_driver_chipcommon.h
@@ -593,9 +593,6 @@ struct bcma_sflash {
u32 blocksize;
u16 numblocks;
u32 size;
-
- struct mtd_info *mtd;
- void *priv;
};
#endif
More information about the linux-mtd-cvs
mailing list