811-v6.4-0019-nvmem-Add-macro-to-register-nvmem-layout-drivers.patch 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. From 814c978f02db17f16e6aa2efa2a929372f06da09 Mon Sep 17 00:00:00 2001
  2. From: Miquel Raynal <[email protected]>
  3. Date: Tue, 4 Apr 2023 18:21:44 +0100
  4. Subject: [PATCH] nvmem: Add macro to register nvmem layout drivers
  5. MIME-Version: 1.0
  6. Content-Type: text/plain; charset=UTF-8
  7. Content-Transfer-Encoding: 8bit
  8. Provide a module_nvmem_layout_driver() macro at the end of the
  9. nvmem-provider.h header to reduce the boilerplate when registering nvmem
  10. layout drivers.
  11. Suggested-by: Srinivas Kandagatla <[email protected]>
  12. Signed-off-by: Miquel Raynal <[email protected]>
  13. Acked-by: Rafał Miłecki <[email protected]>
  14. Signed-off-by: Srinivas Kandagatla <[email protected]>
  15. Link: https://lore.kernel.org/r/[email protected]
  16. Signed-off-by: Greg Kroah-Hartman <[email protected]>
  17. ---
  18. include/linux/nvmem-provider.h | 6 ++++++
  19. 1 file changed, 6 insertions(+)
  20. --- a/include/linux/nvmem-provider.h
  21. +++ b/include/linux/nvmem-provider.h
  22. @@ -9,6 +9,7 @@
  23. #ifndef _LINUX_NVMEM_PROVIDER_H
  24. #define _LINUX_NVMEM_PROVIDER_H
  25. +#include <linux/device/driver.h>
  26. #include <linux/err.h>
  27. #include <linux/errno.h>
  28. #include <linux/gpio/consumer.h>
  29. @@ -242,4 +243,9 @@ nvmem_layout_get_match_data(struct nvmem
  30. }
  31. #endif /* CONFIG_NVMEM */
  32. +
  33. +#define module_nvmem_layout_driver(__layout_driver) \
  34. + module_driver(__layout_driver, nvmem_layout_register, \
  35. + nvmem_layout_unregister)
  36. +
  37. #endif /* ifndef _LINUX_NVMEM_PROVIDER_H */