kgsl_sysfs.h 856 B

12345678910111213141516171819202122232425262728293031
  1. /* SPDX-License-Identifier: GPL-2.0-only */
  2. /*
  3. * Copyright (c) 2020, The Linux Foundation. All rights reserved.
  4. */
  5. #ifndef _KGSL_SYSFS_H_
  6. #define _KGSL_SYSFS_H_
  7. struct kgsl_device;
  8. /**
  9. * struct kgsl_gpu_sysfs_attr - Attribute definition for sysfs objects in the
  10. * /sys/kernel/gpu kobject
  11. */
  12. struct kgsl_gpu_sysfs_attr {
  13. /** @attr: Attribute for the sysfs node */
  14. struct attribute attr;
  15. /** @show: Show function for the node */
  16. ssize_t (*show)(struct kgsl_device *device, char *buf);
  17. /** @store: Store function for the node */
  18. ssize_t (*store)(struct kgsl_device *device, const char *buf,
  19. size_t count);
  20. };
  21. #define GPU_SYSFS_ATTR(_name, _mode, _show, _store) \
  22. const struct kgsl_gpu_sysfs_attr gpu_sysfs_attr_##_name = { \
  23. .attr = { .name = __stringify(_name), .mode = _mode }, \
  24. .show = _show, \
  25. .store = _store, \
  26. }
  27. #endif