2
0

819-v6.8-0002-nvmem-Create-a-header-for-internal-sharing.patch 2.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. From ec9c08a1cb8dc5e8e003f95f5f62de41dde235bb Mon Sep 17 00:00:00 2001
  2. From: Miquel Raynal <[email protected]>
  3. Date: Fri, 15 Dec 2023 11:15:29 +0000
  4. Subject: [PATCH] nvmem: Create a header for internal sharing
  5. Before adding all the NVMEM layout bus infrastructure to the core, let's
  6. move the main nvmem_device structure in an internal header, only
  7. available to the core. This way all the additional code can be added in
  8. a dedicated file in order to keep the current core file tidy.
  9. Signed-off-by: Miquel Raynal <[email protected]>
  10. Signed-off-by: Srinivas Kandagatla <[email protected]>
  11. Link: https://lore.kernel.org/r/[email protected]
  12. Signed-off-by: Greg Kroah-Hartman <[email protected]>
  13. ---
  14. drivers/nvmem/core.c | 24 +-----------------------
  15. drivers/nvmem/internals.h | 35 +++++++++++++++++++++++++++++++++++
  16. 2 files changed, 36 insertions(+), 23 deletions(-)
  17. create mode 100644 drivers/nvmem/internals.h
  18. --- a/drivers/nvmem/core.c
  19. +++ b/drivers/nvmem/core.c
  20. @@ -19,29 +19,7 @@
  21. #include <linux/of.h>
  22. #include <linux/slab.h>
  23. -struct nvmem_device {
  24. - struct module *owner;
  25. - struct device dev;
  26. - int stride;
  27. - int word_size;
  28. - int id;
  29. - struct kref refcnt;
  30. - size_t size;
  31. - bool read_only;
  32. - bool root_only;
  33. - int flags;
  34. - enum nvmem_type type;
  35. - struct bin_attribute eeprom;
  36. - struct device *base_dev;
  37. - struct list_head cells;
  38. - const struct nvmem_keepout *keepout;
  39. - unsigned int nkeepout;
  40. - nvmem_reg_read_t reg_read;
  41. - nvmem_reg_write_t reg_write;
  42. - struct gpio_desc *wp_gpio;
  43. - struct nvmem_layout *layout;
  44. - void *priv;
  45. -};
  46. +#include "internals.h"
  47. #define to_nvmem_device(d) container_of(d, struct nvmem_device, dev)
  48. --- /dev/null
  49. +++ b/drivers/nvmem/internals.h
  50. @@ -0,0 +1,35 @@
  51. +/* SPDX-License-Identifier: GPL-2.0 */
  52. +
  53. +#ifndef _LINUX_NVMEM_INTERNALS_H
  54. +#define _LINUX_NVMEM_INTERNALS_H
  55. +
  56. +#include <linux/device.h>
  57. +#include <linux/nvmem-consumer.h>
  58. +#include <linux/nvmem-provider.h>
  59. +
  60. +struct nvmem_device {
  61. + struct module *owner;
  62. + struct device dev;
  63. + struct list_head node;
  64. + int stride;
  65. + int word_size;
  66. + int id;
  67. + struct kref refcnt;
  68. + size_t size;
  69. + bool read_only;
  70. + bool root_only;
  71. + int flags;
  72. + enum nvmem_type type;
  73. + struct bin_attribute eeprom;
  74. + struct device *base_dev;
  75. + struct list_head cells;
  76. + const struct nvmem_keepout *keepout;
  77. + unsigned int nkeepout;
  78. + nvmem_reg_read_t reg_read;
  79. + nvmem_reg_write_t reg_write;
  80. + struct gpio_desc *wp_gpio;
  81. + struct nvmem_layout *layout;
  82. + void *priv;
  83. +};
  84. +
  85. +#endif /* ifndef _LINUX_NVMEM_INTERNALS_H */