819-v6.8-0003-nvmem-Simplify-the-add_cells-hook.patch 3.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. From 1b7c298a4ecbc28cc6ee94005734bff55eb83d22 Mon Sep 17 00:00:00 2001
  2. From: Miquel Raynal <[email protected]>
  3. Date: Fri, 15 Dec 2023 11:15:30 +0000
  4. Subject: [PATCH] nvmem: Simplify the ->add_cells() hook
  5. The layout entry is not used and will anyway be made useless by the new
  6. layout bus infrastructure coming next, so drop it. While at it, clarify
  7. the kdoc entry.
  8. Signed-off-by: Miquel Raynal <[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/core.c | 2 +-
  14. drivers/nvmem/layouts/onie-tlv.c | 3 +--
  15. drivers/nvmem/layouts/sl28vpd.c | 3 +--
  16. include/linux/nvmem-provider.h | 8 +++-----
  17. 4 files changed, 6 insertions(+), 10 deletions(-)
  18. --- a/drivers/nvmem/core.c
  19. +++ b/drivers/nvmem/core.c
  20. @@ -816,7 +816,7 @@ static int nvmem_add_cells_from_layout(s
  21. int ret;
  22. if (layout && layout->add_cells) {
  23. - ret = layout->add_cells(&nvmem->dev, nvmem, layout);
  24. + ret = layout->add_cells(&nvmem->dev, nvmem);
  25. if (ret)
  26. return ret;
  27. }
  28. --- a/drivers/nvmem/layouts/onie-tlv.c
  29. +++ b/drivers/nvmem/layouts/onie-tlv.c
  30. @@ -182,8 +182,7 @@ static bool onie_tlv_crc_is_valid(struct
  31. return true;
  32. }
  33. -static int onie_tlv_parse_table(struct device *dev, struct nvmem_device *nvmem,
  34. - struct nvmem_layout *layout)
  35. +static int onie_tlv_parse_table(struct device *dev, struct nvmem_device *nvmem)
  36. {
  37. struct onie_tlv_hdr hdr;
  38. size_t table_len, data_len, hdr_len;
  39. --- a/drivers/nvmem/layouts/sl28vpd.c
  40. +++ b/drivers/nvmem/layouts/sl28vpd.c
  41. @@ -80,8 +80,7 @@ static int sl28vpd_v1_check_crc(struct d
  42. return 0;
  43. }
  44. -static int sl28vpd_add_cells(struct device *dev, struct nvmem_device *nvmem,
  45. - struct nvmem_layout *layout)
  46. +static int sl28vpd_add_cells(struct device *dev, struct nvmem_device *nvmem)
  47. {
  48. const struct nvmem_cell_info *pinfo;
  49. struct nvmem_cell_info info = {0};
  50. --- a/include/linux/nvmem-provider.h
  51. +++ b/include/linux/nvmem-provider.h
  52. @@ -156,9 +156,8 @@ struct nvmem_cell_table {
  53. *
  54. * @name: Layout name.
  55. * @of_match_table: Open firmware match table.
  56. - * @add_cells: Will be called if a nvmem device is found which
  57. - * has this layout. The function will add layout
  58. - * specific cells with nvmem_add_one_cell().
  59. + * @add_cells: Called to populate the layout using
  60. + * nvmem_add_one_cell().
  61. * @fixup_cell_info: Will be called before a cell is added. Can be
  62. * used to modify the nvmem_cell_info.
  63. * @owner: Pointer to struct module.
  64. @@ -172,8 +171,7 @@ struct nvmem_cell_table {
  65. struct nvmem_layout {
  66. const char *name;
  67. const struct of_device_id *of_match_table;
  68. - int (*add_cells)(struct device *dev, struct nvmem_device *nvmem,
  69. - struct nvmem_layout *layout);
  70. + int (*add_cells)(struct device *dev, struct nvmem_device *nvmem);
  71. void (*fixup_cell_info)(struct nvmem_device *nvmem,
  72. struct nvmem_layout *layout,
  73. struct nvmem_cell_info *cell);