summaryrefslogtreecommitdiff
path: root/include/linux/device.h
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2026-04-17 21:24:00 +0300
committerLinus Torvalds <torvalds@linux-foundation.org>2026-04-17 21:24:00 +0300
commitd97e7d7c304f87419921f740743f7baa99f40539 (patch)
treeaf6b5ff258e9854490e205fb4ea348e08c6c125f /include/linux/device.h
parent87768582a440e7049a04e8af7383b86738d15b38 (diff)
parentb8a5774cd49996e8ef83b1637a9b547158f18de9 (diff)
downloadlinux-d97e7d7c304f87419921f740743f7baa99f40539.tar.xz
Merge tag 'hid-for-linus-2026041601' of git://git.kernel.org/pub/scm/linux/kernel/git/hid/hid
Pull HID updates from Jiri Kosina: "Core: - fixed handling of 0-sized reports (Dmitry Torokhov) - convert core code to __free() (Dmitry Torokhov) - support for multiple batteries per HID device (Lucas Zampieri) Drivers: - support for rumble effects in winwing driver (Ivan Gorinov) - new support for a variety of Sony Rock Band and Sony DJ Hero Turntable devices (Rosalie Wanders) - new driver for Lenovo Legion Go / S devices (Derek J. Clark) - power management improvements to intel-thc-hid driver (Even Xu) ... other assorted cleanups, fixes and device-specific quirks" * tag 'hid-for-linus-2026041601' of git://git.kernel.org/pub/scm/linux/kernel/git/hid/hid: (73 commits) HID: core: clamp report_size in s32ton() to avoid undefined shift HID: logitech-dj: fix wrong detection of bad DJ_SHORT output report HID: logitech-hidpp: fix race condition when accessing stale stack pointer HID: winwing: Enable rumble effects HID: core: do not allow parsing 0-sized reports HID: usbhid: refactor endpoint lookup HID: huawei: fix CD30 keyboard report descriptor issue HID: playstation: validate num_touch_reports in DualShock 4 reports HID: drop 'default !EXPERT' from tristate symbols HID: usbhid: fix deadlock in hid_post_reset() HID: apple: ensure the keyboard backlight is off if suspending HID: quirks: Set ALWAYS_POLL for LOGITECH_BOLT_RECEIVER HID: alps: fix NULL pointer dereference in alps_raw_event() HID: logitech-dj: Prevent REPORT_ID_DJ_SHORT related user initiated OOB write HID: logitech-dj: Standardise hid_report_enum variable nomenclature HID: sony: update module description HID: logitech-hidpp: Check bounds when deleting force-feedback effects HID: sony: add battery status support for Rock Band 4 PS5 guitars HID: sony: fix style issues HID: quirks: update hid-sony supported devices ...
Diffstat (limited to 'include/linux/device.h')
-rw-r--r--include/linux/device.h46
1 files changed, 46 insertions, 0 deletions
diff --git a/include/linux/device.h b/include/linux/device.h
index f0d52e1a6e07..67cec9ec0cd0 100644
--- a/include/linux/device.h
+++ b/include/linux/device.h
@@ -190,6 +190,22 @@ ssize_t device_show_string(struct device *dev, struct device_attribute *attr,
struct device_attribute dev_attr_##_name = __ATTR_RW_MODE(_name, 0600)
/**
+ * DEVICE_ATTR_RW_NAMED - Define a read-write device attribute with a sysfs name
+ * that differs from the function name.
+ * @_name: Attribute function preface
+ * @_attrname: Attribute name as it wil be exposed in the sysfs.
+ *
+ * Like DEVICE_ATTR_RW(), but allows for reusing names under separate paths in
+ * the same driver.
+ */
+#define DEVICE_ATTR_RW_NAMED(_name, _attrname) \
+ struct device_attribute dev_attr_##_name = { \
+ .attr = { .name = _attrname, .mode = 0644 }, \
+ .show = _name##_show, \
+ .store = _name##_store, \
+ }
+
+/**
* DEVICE_ATTR_RO - Define a readable device attribute.
* @_name: Attribute name.
*
@@ -208,6 +224,21 @@ ssize_t device_show_string(struct device *dev, struct device_attribute *attr,
struct device_attribute dev_attr_##_name = __ATTR_RO_MODE(_name, 0400)
/**
+ * DEVICE_ATTR_RO_NAMED - Define a read-only device attribute with a sysfs name
+ * that differs from the function name.
+ * @_name: Attribute function preface
+ * @_attrname: Attribute name as it wil be exposed in the sysfs.
+ *
+ * Like DEVICE_ATTR_RO(), but allows for reusing names under separate paths in
+ * the same driver.
+ */
+#define DEVICE_ATTR_RO_NAMED(_name, _attrname) \
+ struct device_attribute dev_attr_##_name = { \
+ .attr = { .name = _attrname, .mode = 0444 }, \
+ .show = _name##_show, \
+ }
+
+/**
* DEVICE_ATTR_WO - Define an admin-only writable device attribute.
* @_name: Attribute name.
*
@@ -217,6 +248,21 @@ ssize_t device_show_string(struct device *dev, struct device_attribute *attr,
struct device_attribute dev_attr_##_name = __ATTR_WO(_name)
/**
+ * DEVICE_ATTR_WO_NAMED - Define a read-only device attribute with a sysfs name
+ * that differs from the function name.
+ * @_name: Attribute function preface
+ * @_attrname: Attribute name as it wil be exposed in the sysfs.
+ *
+ * Like DEVICE_ATTR_WO(), but allows for reusing names under separate paths in
+ * the same driver.
+ */
+#define DEVICE_ATTR_WO_NAMED(_name, _attrname) \
+ struct device_attribute dev_attr_##_name = { \
+ .attr = { .name = _attrname, .mode = 0200 }, \
+ .store = _name##_store, \
+ }
+
+/**
* DEVICE_ULONG_ATTR - Define a device attribute backed by an unsigned long.
* @_name: Attribute name.
* @_mode: File mode.