042-0005-mtd-bcm47xxsflash-use-platform_-set-get-_drvdata.patch 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. From be5e5099183301fb7920f8f6b66bd3ac1f820a97 Mon Sep 17 00:00:00 2001
  2. From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <rafal@milecki.pl>
  3. Date: Mon, 16 Jan 2017 17:28:18 +0100
  4. Subject: [PATCH] mtd: bcm47xxsflash: use platform_(set|get)_drvdata
  5. MIME-Version: 1.0
  6. Content-Type: text/plain; charset=UTF-8
  7. Content-Transfer-Encoding: 8bit
  8. We have generic place & helpers for storing platform driver data so
  9. there is no reason for using custom priv pointer.
  10. This allows cleaning up struct bcma_sflash from unneeded fields.
  11. Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
  12. Acked-by: Kalle Valo <kvalo@codeaurora.org>
  13. Acked-by: Boris Brezillon <boris.brezillon@free-electrons.com>
  14. Signed-off-by: Brian Norris <computersforpeace@gmail.com>
  15. ---
  16. drivers/mtd/devices/bcm47xxsflash.c | 6 +++---
  17. include/linux/bcma/bcma_driver_chipcommon.h | 3 ---
  18. 2 files changed, 3 insertions(+), 6 deletions(-)
  19. --- a/drivers/mtd/devices/bcm47xxsflash.c
  20. +++ b/drivers/mtd/devices/bcm47xxsflash.c
  21. @@ -284,7 +284,6 @@ static int bcm47xxsflash_bcma_probe(stru
  22. b47s = devm_kzalloc(dev, sizeof(*b47s), GFP_KERNEL);
  23. if (!b47s)
  24. return -ENOMEM;
  25. - sflash->priv = b47s;
  26. res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
  27. if (!res) {
  28. @@ -334,6 +333,8 @@ static int bcm47xxsflash_bcma_probe(stru
  29. b47s->size = sflash->size;
  30. bcm47xxsflash_fill_mtd(b47s, &pdev->dev);
  31. + platform_set_drvdata(pdev, b47s);
  32. +
  33. err = mtd_device_parse_register(&b47s->mtd, probes, NULL, NULL, 0);
  34. if (err) {
  35. pr_err("Failed to register MTD device: %d\n", err);
  36. @@ -349,8 +350,7 @@ static int bcm47xxsflash_bcma_probe(stru
  37. static int bcm47xxsflash_bcma_remove(struct platform_device *pdev)
  38. {
  39. - struct bcma_sflash *sflash = dev_get_platdata(&pdev->dev);
  40. - struct bcm47xxsflash *b47s = sflash->priv;
  41. + struct bcm47xxsflash *b47s = platform_get_drvdata(pdev);
  42. mtd_device_unregister(&b47s->mtd);
  43. iounmap(b47s->window);
  44. --- a/include/linux/bcma/bcma_driver_chipcommon.h
  45. +++ b/include/linux/bcma/bcma_driver_chipcommon.h
  46. @@ -591,9 +591,6 @@ struct bcma_sflash {
  47. u32 blocksize;
  48. u16 numblocks;
  49. u32 size;
  50. -
  51. - struct mtd_info *mtd;
  52. - void *priv;
  53. };
  54. #endif