816-v6.7-0003-nvmem-Use-device_get_match_data.patch 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. From 0720219f4d34a88a9badb4de70cfad7585687d48 Mon Sep 17 00:00:00 2001
  2. From: Rob Herring <[email protected]>
  3. Date: Fri, 20 Oct 2023 11:55:45 +0100
  4. Subject: [PATCH] nvmem: Use device_get_match_data()
  5. Use preferred device_get_match_data() instead of of_match_device() to
  6. get the driver match data. With this, adjust the includes to explicitly
  7. include the correct headers.
  8. Signed-off-by: Rob Herring <[email protected]>
  9. Signed-off-by: Srinivas Kandagatla <[email protected]>
  10. Link: https://lore.kernel.org/r/[email protected]
  11. Signed-off-by: Greg Kroah-Hartman <[email protected]>
  12. ---
  13. drivers/nvmem/mxs-ocotp.c | 10 ++++------
  14. drivers/nvmem/stm32-romem.c | 7 ++++---
  15. 2 files changed, 8 insertions(+), 9 deletions(-)
  16. --- a/drivers/nvmem/mxs-ocotp.c
  17. +++ b/drivers/nvmem/mxs-ocotp.c
  18. @@ -13,8 +13,9 @@
  19. #include <linux/io.h>
  20. #include <linux/module.h>
  21. #include <linux/nvmem-provider.h>
  22. -#include <linux/of_device.h>
  23. +#include <linux/of.h>
  24. #include <linux/platform_device.h>
  25. +#include <linux/property.h>
  26. #include <linux/slab.h>
  27. #include <linux/stmp_device.h>
  28. @@ -140,11 +141,10 @@ static int mxs_ocotp_probe(struct platfo
  29. struct device *dev = &pdev->dev;
  30. const struct mxs_data *data;
  31. struct mxs_ocotp *otp;
  32. - const struct of_device_id *match;
  33. int ret;
  34. - match = of_match_device(dev->driver->of_match_table, dev);
  35. - if (!match || !match->data)
  36. + data = device_get_match_data(dev);
  37. + if (!data)
  38. return -EINVAL;
  39. otp = devm_kzalloc(dev, sizeof(*otp), GFP_KERNEL);
  40. @@ -169,8 +169,6 @@ static int mxs_ocotp_probe(struct platfo
  41. if (ret)
  42. return ret;
  43. - data = match->data;
  44. -
  45. ocotp_config.size = data->size;
  46. ocotp_config.priv = otp;
  47. ocotp_config.dev = dev;
  48. --- a/drivers/nvmem/stm32-romem.c
  49. +++ b/drivers/nvmem/stm32-romem.c
  50. @@ -10,7 +10,9 @@
  51. #include <linux/io.h>
  52. #include <linux/module.h>
  53. #include <linux/nvmem-provider.h>
  54. -#include <linux/of_device.h>
  55. +#include <linux/of.h>
  56. +#include <linux/platform_device.h>
  57. +#include <linux/property.h>
  58. #include <linux/tee_drv.h>
  59. #include "stm32-bsec-optee-ta.h"
  60. @@ -211,8 +213,7 @@ static int stm32_romem_probe(struct plat
  61. priv->lower = 0;
  62. - cfg = (const struct stm32_romem_cfg *)
  63. - of_match_device(dev->driver->of_match_table, dev)->data;
  64. + cfg = device_get_match_data(dev);
  65. if (!cfg) {
  66. priv->cfg.read_only = true;
  67. priv->cfg.size = resource_size(res);