aboutsummaryrefslogtreecommitdiff
path: root/driver/platform.h
diff options
context:
space:
mode:
authorlonkaars <loek@pipeframe.xyz>2024-05-20 15:41:29 +0200
committerlonkaars <loek@pipeframe.xyz>2024-05-20 15:41:29 +0200
commit8de1733ca506dc7b7d4b66dca1b33c22e76dc855 (patch)
tree8a4eb4529f580adc2e62b5182ecc7df40b35aff3 /driver/platform.h
parentf8d802918da5f898f6466bd59bc15f6a4157d514 (diff)
add device class attributes (9.6)week-4
Diffstat (limited to 'driver/platform.h')
-rw-r--r--driver/platform.h39
1 files changed, 31 insertions, 8 deletions
diff --git a/driver/platform.h b/driver/platform.h
index cee82a7..ecac681 100644
--- a/driver/platform.h
+++ b/driver/platform.h
@@ -2,19 +2,42 @@
#include <linux/types.h>
#include <linux/platform_device.h>
+#include <linux/slab.h>
-ssize_t attr_show(struct device_driver*, char*);
-ssize_t attr_store(struct device_driver*, const char*, size_t);
+int lork_probe(struct platform_device*);
+int lork_remove(struct platform_device*);
-static struct driver_attribute attr = {
+
+ssize_t drv_attr_int_show(struct device_driver*, char*);
+ssize_t drv_attr_int_store(struct device_driver*, const char*, size_t);
+static const struct driver_attribute drv_attr_int = {
.attr = {
- .name = "attr",
+ .name = "int",
.mode = 0644,
},
- .show = attr_show,
- .store = attr_store,
+ .show = drv_attr_int_show,
+ .store = drv_attr_int_store,
};
-int lork_probe(struct platform_device*);
-int lork_remove(struct platform_device*);
+ssize_t dev_attr_int_show(struct device*, struct device_attribute*, char*);
+ssize_t dev_attr_int_store(struct device*, struct device_attribute*, const char*, size_t);
+static const struct device_attribute dev_attr_int = {
+ .attr = {
+ .name = "int",
+ .mode = 0644,
+ },
+ .show = dev_attr_int_show,
+ .store = dev_attr_int_store,
+};
+
+ssize_t dev_attr_str_show(struct device*, struct device_attribute*, char*);
+ssize_t dev_attr_str_store(struct device*, struct device_attribute*, const char*, size_t);
+static const struct device_attribute dev_attr_str = {
+ .attr = {
+ .name = "str",
+ .mode = 0644,
+ },
+ .show = dev_attr_str_show,
+ .store = dev_attr_str_store,
+};