--- zzzz-none-000/linux-3.10.107/include/linux/device.h 2017-06-27 09:49:32.000000000 +0000 +++ vr9-7490-729/linux-3.10.107/include/linux/device.h 2021-11-10 11:53:56.000000000 +0000 @@ -46,8 +46,19 @@ ssize_t (*store)(struct bus_type *bus, const char *buf, size_t count); }; +/* AVM: backported from 3.15 + * + * commits: + * ced321bf9151535f85779b0004c93529f860b2a4 driver core: device.h: add RW and RO attribute macros + * 1130c55c757660ac83bd2de220f08580c56b6855 driver core: create write-only attribute macros for devices and drivers + */ + #define BUS_ATTR(_name, _mode, _show, _store) \ -struct bus_attribute bus_attr_##_name = __ATTR(_name, _mode, _show, _store) + struct bus_attribute bus_attr_##_name = __ATTR(_name, _mode, _show, _store) +#define BUS_ATTR_RW(_name) \ + struct bus_attribute bus_attr_##_name = __ATTR_RW(_name) +#define BUS_ATTR_RO(_name) \ + struct bus_attribute bus_attr_##_name = __ATTR_RO(_name) extern int __must_check bus_create_file(struct bus_type *, struct bus_attribute *); @@ -253,9 +264,14 @@ size_t count); }; -#define DRIVER_ATTR(_name, _mode, _show, _store) \ -struct driver_attribute driver_attr_##_name = \ - __ATTR(_name, _mode, _show, _store) +#define DRIVER_ATTR(_name, _mode, _show, _store) \ + struct driver_attribute driver_attr_##_name = __ATTR(_name, _mode, _show, _store) +#define DRIVER_ATTR_RW(_name) \ + struct driver_attribute driver_attr_##_name = __ATTR_RW(_name) +#define DRIVER_ATTR_RO(_name) \ + struct driver_attribute driver_attr_##_name = __ATTR_RO(_name) +#define DRIVER_ATTR_WO(_name) \ + struct driver_attribute driver_attr_##_name = __ATTR_WO(_name) extern int __must_check driver_create_file(struct device_driver *driver, const struct driver_attribute *attr); @@ -406,8 +422,12 @@ const struct class_attribute *attr); }; -#define CLASS_ATTR(_name, _mode, _show, _store) \ -struct class_attribute class_attr_##_name = __ATTR(_name, _mode, _show, _store) +#define CLASS_ATTR(_name, _mode, _show, _store) \ + struct class_attribute class_attr_##_name = __ATTR(_name, _mode, _show, _store) +#define CLASS_ATTR_RW(_name) \ + struct class_attribute class_attr_##_name = __ATTR_RW(_name) +#define CLASS_ATTR_RO(_name) \ + struct class_attribute class_attr_##_name = __ATTR_RO(_name) extern int __must_check class_create_file(struct class *class, const struct class_attribute *attr); @@ -415,7 +435,6 @@ const struct class_attribute *attr); /* Simple class attribute that is just a static string */ - struct class_attribute_string { struct class_attribute attr; char *str; @@ -504,6 +523,12 @@ #define DEVICE_ATTR(_name, _mode, _show, _store) \ struct device_attribute dev_attr_##_name = __ATTR(_name, _mode, _show, _store) +#define DEVICE_ATTR_RW(_name) \ + struct device_attribute dev_attr_##_name = __ATTR_RW(_name) +#define DEVICE_ATTR_RO(_name) \ + struct device_attribute dev_attr_##_name = __ATTR_RO(_name) +#define DEVICE_ATTR_WO(_name) \ + struct device_attribute dev_attr_##_name = __ATTR_WO(_name) #define DEVICE_ULONG_ATTR(_name, _mode, _var) \ struct dev_ext_attribute dev_attr_##_name = \ { __ATTR(_name, _mode, device_show_ulong, device_store_ulong), &(_var) } @@ -760,11 +785,12 @@ dev->numa_node = node; } #else -static inline int dev_to_node(struct device *dev) +static inline int dev_to_node(struct device *dev __maybe_unused) { return -1; } -static inline void set_dev_node(struct device *dev, int node) +static inline void set_dev_node(struct device *dev __maybe_unused, + int node __maybe_unused) { } #endif @@ -811,7 +837,8 @@ dev->power.ignore_children = enable; } -static inline void dev_pm_syscore_device(struct device *dev, bool val) +static inline void dev_pm_syscore_device(struct device *dev __maybe_unused, + bool val __maybe_unused) { #ifdef CONFIG_PM_SLEEP dev->power.syscore = val; @@ -924,9 +951,18 @@ extern int devtmpfs_delete_node(struct device *dev); extern int devtmpfs_mount(const char *mntdir); #else -static inline int devtmpfs_create_node(struct device *dev) { return 0; } -static inline int devtmpfs_delete_node(struct device *dev) { return 0; } -static inline int devtmpfs_mount(const char *mountpoint) { return 0; } +static inline int devtmpfs_create_node(struct device *dev __maybe_unused) +{ + return 0; +} +static inline int devtmpfs_delete_node(struct device *dev __maybe_unused) +{ + return 0; +} +static inline int devtmpfs_mount(const char *mountpoint __maybe_unused) +{ + return 0; +} #endif /* drivers/base/power/shutdown.c */ @@ -965,41 +1001,54 @@ #else static inline __printf(3, 0) -int dev_vprintk_emit(int level, const struct device *dev, - const char *fmt, va_list args) +int dev_vprintk_emit(int level __maybe_unused, + const struct device *dev __maybe_unused, + const char *fmt __maybe_unused, + va_list args __maybe_unused) { return 0; } static inline __printf(3, 4) -int dev_printk_emit(int level, const struct device *dev, const char *fmt, ...) +int dev_printk_emit(int level __maybe_unused, + const struct device *dev __maybe_unused, + const char *fmt __maybe_unused, ...) { return 0; } -static inline int __dev_printk(const char *level, const struct device *dev, - struct va_format *vaf) +static inline int __dev_printk(const char *level __maybe_unused, + const struct device *dev __maybe_unused, + struct va_format *vaf __maybe_unused) { return 0; } static inline __printf(3, 4) -int dev_printk(const char *level, const struct device *dev, - const char *fmt, ...) +int dev_printk(const char *level __maybe_unused, + const struct device *dev __maybe_unused, + const char *fmt __maybe_unused, ...) { return 0; } static inline __printf(2, 3) -int dev_emerg(const struct device *dev, const char *fmt, ...) +int dev_emerg(const struct device *dev __maybe_unused, + const char *fmt __maybe_unused, ...) { return 0; } static inline __printf(2, 3) -int dev_crit(const struct device *dev, const char *fmt, ...) +int dev_crit(const struct device *dev __maybe_unused, + const char *fmt __maybe_unused, ...) { return 0; } static inline __printf(2, 3) -int dev_alert(const struct device *dev, const char *fmt, ...) +int dev_alert(const struct device *dev __maybe_unused, + const char *fmt __maybe_unused, ...) { return 0; } static inline __printf(2, 3) -int dev_err(const struct device *dev, const char *fmt, ...) +int dev_err(const struct device *dev __maybe_unused, + const char *fmt __maybe_unused, ...) { return 0; } static inline __printf(2, 3) -int dev_warn(const struct device *dev, const char *fmt, ...) +int dev_warn(const struct device *dev __maybe_unused, + const char *fmt __maybe_unused, ...) { return 0; } static inline __printf(2, 3) -int dev_notice(const struct device *dev, const char *fmt, ...) +int dev_notice(const struct device *dev __maybe_unused, + const char *fmt __maybe_unused, ...) { return 0; } static inline __printf(2, 3) -int _dev_info(const struct device *dev, const char *fmt, ...) +int _dev_info(const struct device *dev __maybe_unused, + const char *fmt __maybe_unused, ...) { return 0; } #endif