diff options
Diffstat (limited to 'include/linux/device.h')
| -rw-r--r-- | include/linux/device.h | 37 |
1 files changed, 29 insertions, 8 deletions
diff --git a/include/linux/device.h b/include/linux/device.h index bcf8c0d4cd98..22b546a58591 100644 --- a/include/linux/device.h +++ b/include/linux/device.h | |||
| @@ -47,7 +47,11 @@ struct bus_attribute { | |||
| 47 | }; | 47 | }; |
| 48 | 48 | ||
| 49 | #define BUS_ATTR(_name, _mode, _show, _store) \ | 49 | #define BUS_ATTR(_name, _mode, _show, _store) \ |
| 50 | struct bus_attribute bus_attr_##_name = __ATTR(_name, _mode, _show, _store) | 50 | struct bus_attribute bus_attr_##_name = __ATTR(_name, _mode, _show, _store) |
| 51 | #define BUS_ATTR_RW(_name) \ | ||
| 52 | struct bus_attribute bus_attr_##_name = __ATTR_RW(_name) | ||
| 53 | #define BUS_ATTR_RO(_name) \ | ||
| 54 | struct bus_attribute bus_attr_##_name = __ATTR_RO(_name) | ||
| 51 | 55 | ||
| 52 | extern int __must_check bus_create_file(struct bus_type *, | 56 | extern int __must_check bus_create_file(struct bus_type *, |
| 53 | struct bus_attribute *); | 57 | struct bus_attribute *); |
| @@ -261,9 +265,12 @@ struct driver_attribute { | |||
| 261 | size_t count); | 265 | size_t count); |
| 262 | }; | 266 | }; |
| 263 | 267 | ||
| 264 | #define DRIVER_ATTR(_name, _mode, _show, _store) \ | 268 | #define DRIVER_ATTR(_name, _mode, _show, _store) \ |
| 265 | struct driver_attribute driver_attr_##_name = \ | 269 | struct driver_attribute driver_attr_##_name = __ATTR(_name, _mode, _show, _store) |
| 266 | __ATTR(_name, _mode, _show, _store) | 270 | #define DRIVER_ATTR_RW(_name) \ |
| 271 | struct driver_attribute driver_attr_##_name = __ATTR_RW(_name) | ||
| 272 | #define DRIVER_ATTR_RO(_name) \ | ||
| 273 | struct driver_attribute driver_attr_##_name = __ATTR_RO(_name) | ||
| 267 | 274 | ||
| 268 | extern int __must_check driver_create_file(struct device_driver *driver, | 275 | extern int __must_check driver_create_file(struct device_driver *driver, |
| 269 | const struct driver_attribute *attr); | 276 | const struct driver_attribute *attr); |
| @@ -313,6 +320,7 @@ int subsys_virtual_register(struct bus_type *subsys, | |||
| 313 | * @name: Name of the class. | 320 | * @name: Name of the class. |
| 314 | * @owner: The module owner. | 321 | * @owner: The module owner. |
| 315 | * @class_attrs: Default attributes of this class. | 322 | * @class_attrs: Default attributes of this class. |
| 323 | * @dev_groups: Default attributes of the devices that belong to the class. | ||
| 316 | * @dev_attrs: Default attributes of the devices belong to the class. | 324 | * @dev_attrs: Default attributes of the devices belong to the class. |
| 317 | * @dev_bin_attrs: Default binary attributes of the devices belong to the class. | 325 | * @dev_bin_attrs: Default binary attributes of the devices belong to the class. |
| 318 | * @dev_kobj: The kobject that represents this class and links it into the hierarchy. | 326 | * @dev_kobj: The kobject that represents this class and links it into the hierarchy. |
| @@ -342,7 +350,8 @@ struct class { | |||
| 342 | struct module *owner; | 350 | struct module *owner; |
| 343 | 351 | ||
| 344 | struct class_attribute *class_attrs; | 352 | struct class_attribute *class_attrs; |
| 345 | struct device_attribute *dev_attrs; | 353 | struct device_attribute *dev_attrs; /* use dev_groups instead */ |
| 354 | const struct attribute_group **dev_groups; | ||
| 346 | struct bin_attribute *dev_bin_attrs; | 355 | struct bin_attribute *dev_bin_attrs; |
| 347 | struct kobject *dev_kobj; | 356 | struct kobject *dev_kobj; |
| 348 | 357 | ||
| @@ -414,8 +423,12 @@ struct class_attribute { | |||
| 414 | const struct class_attribute *attr); | 423 | const struct class_attribute *attr); |
| 415 | }; | 424 | }; |
| 416 | 425 | ||
| 417 | #define CLASS_ATTR(_name, _mode, _show, _store) \ | 426 | #define CLASS_ATTR(_name, _mode, _show, _store) \ |
| 418 | struct class_attribute class_attr_##_name = __ATTR(_name, _mode, _show, _store) | 427 | struct class_attribute class_attr_##_name = __ATTR(_name, _mode, _show, _store) |
| 428 | #define CLASS_ATTR_RW(_name) \ | ||
| 429 | struct class_attribute class_attr_##_name = __ATTR_RW(_name) | ||
| 430 | #define CLASS_ATTR_RO(_name) \ | ||
| 431 | struct class_attribute class_attr_##_name = __ATTR_RO(_name) | ||
| 419 | 432 | ||
| 420 | extern int __must_check class_create_file(struct class *class, | 433 | extern int __must_check class_create_file(struct class *class, |
| 421 | const struct class_attribute *attr); | 434 | const struct class_attribute *attr); |
| @@ -423,7 +436,6 @@ extern void class_remove_file(struct class *class, | |||
| 423 | const struct class_attribute *attr); | 436 | const struct class_attribute *attr); |
| 424 | 437 | ||
| 425 | /* Simple class attribute that is just a static string */ | 438 | /* Simple class attribute that is just a static string */ |
| 426 | |||
| 427 | struct class_attribute_string { | 439 | struct class_attribute_string { |
| 428 | struct class_attribute attr; | 440 | struct class_attribute attr; |
| 429 | char *str; | 441 | char *str; |
| @@ -512,6 +524,10 @@ ssize_t device_store_bool(struct device *dev, struct device_attribute *attr, | |||
| 512 | 524 | ||
| 513 | #define DEVICE_ATTR(_name, _mode, _show, _store) \ | 525 | #define DEVICE_ATTR(_name, _mode, _show, _store) \ |
| 514 | struct device_attribute dev_attr_##_name = __ATTR(_name, _mode, _show, _store) | 526 | struct device_attribute dev_attr_##_name = __ATTR(_name, _mode, _show, _store) |
| 527 | #define DEVICE_ATTR_RW(_name) \ | ||
| 528 | struct device_attribute dev_attr_##_name = __ATTR_RW(_name) | ||
| 529 | #define DEVICE_ATTR_RO(_name) \ | ||
| 530 | struct device_attribute dev_attr_##_name = __ATTR_RO(_name) | ||
| 515 | #define DEVICE_ULONG_ATTR(_name, _mode, _var) \ | 531 | #define DEVICE_ULONG_ATTR(_name, _mode, _var) \ |
| 516 | struct dev_ext_attribute dev_attr_##_name = \ | 532 | struct dev_ext_attribute dev_attr_##_name = \ |
| 517 | { __ATTR(_name, _mode, device_show_ulong, device_store_ulong), &(_var) } | 533 | { __ATTR(_name, _mode, device_show_ulong, device_store_ulong), &(_var) } |
| @@ -924,6 +940,11 @@ extern __printf(5, 6) | |||
| 924 | struct device *device_create(struct class *cls, struct device *parent, | 940 | struct device *device_create(struct class *cls, struct device *parent, |
| 925 | dev_t devt, void *drvdata, | 941 | dev_t devt, void *drvdata, |
| 926 | const char *fmt, ...); | 942 | const char *fmt, ...); |
| 943 | extern __printf(6, 7) | ||
| 944 | struct device *device_create_with_groups(struct class *cls, | ||
| 945 | struct device *parent, dev_t devt, void *drvdata, | ||
| 946 | const struct attribute_group **groups, | ||
| 947 | const char *fmt, ...); | ||
| 927 | extern void device_destroy(struct class *cls, dev_t devt); | 948 | extern void device_destroy(struct class *cls, dev_t devt); |
| 928 | 949 | ||
| 929 | /* | 950 | /* |
