diff options
Diffstat (limited to 'drivers/base/core.c')
-rw-r--r-- | drivers/base/core.c | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/drivers/base/core.c b/drivers/base/core.c index f1290cbd1350..282025770429 100644 --- a/drivers/base/core.c +++ b/drivers/base/core.c | |||
@@ -446,7 +446,8 @@ struct kset *devices_kset; | |||
446 | * @dev: device. | 446 | * @dev: device. |
447 | * @attr: device attribute descriptor. | 447 | * @attr: device attribute descriptor. |
448 | */ | 448 | */ |
449 | int device_create_file(struct device *dev, struct device_attribute *attr) | 449 | int device_create_file(struct device *dev, |
450 | const struct device_attribute *attr) | ||
450 | { | 451 | { |
451 | int error = 0; | 452 | int error = 0; |
452 | if (dev) | 453 | if (dev) |
@@ -459,7 +460,8 @@ int device_create_file(struct device *dev, struct device_attribute *attr) | |||
459 | * @dev: device. | 460 | * @dev: device. |
460 | * @attr: device attribute descriptor. | 461 | * @attr: device attribute descriptor. |
461 | */ | 462 | */ |
462 | void device_remove_file(struct device *dev, struct device_attribute *attr) | 463 | void device_remove_file(struct device *dev, |
464 | const struct device_attribute *attr) | ||
463 | { | 465 | { |
464 | if (dev) | 466 | if (dev) |
465 | sysfs_remove_file(&dev->kobj, &attr->attr); | 467 | sysfs_remove_file(&dev->kobj, &attr->attr); |
@@ -470,7 +472,8 @@ void device_remove_file(struct device *dev, struct device_attribute *attr) | |||
470 | * @dev: device. | 472 | * @dev: device. |
471 | * @attr: device binary attribute descriptor. | 473 | * @attr: device binary attribute descriptor. |
472 | */ | 474 | */ |
473 | int device_create_bin_file(struct device *dev, struct bin_attribute *attr) | 475 | int device_create_bin_file(struct device *dev, |
476 | const struct bin_attribute *attr) | ||
474 | { | 477 | { |
475 | int error = -EINVAL; | 478 | int error = -EINVAL; |
476 | if (dev) | 479 | if (dev) |
@@ -484,7 +487,8 @@ EXPORT_SYMBOL_GPL(device_create_bin_file); | |||
484 | * @dev: device. | 487 | * @dev: device. |
485 | * @attr: device binary attribute descriptor. | 488 | * @attr: device binary attribute descriptor. |
486 | */ | 489 | */ |
487 | void device_remove_bin_file(struct device *dev, struct bin_attribute *attr) | 490 | void device_remove_bin_file(struct device *dev, |
491 | const struct bin_attribute *attr) | ||
488 | { | 492 | { |
489 | if (dev) | 493 | if (dev) |
490 | sysfs_remove_bin_file(&dev->kobj, attr); | 494 | sysfs_remove_bin_file(&dev->kobj, attr); |
@@ -905,8 +909,10 @@ int device_add(struct device *dev) | |||
905 | dev->init_name = NULL; | 909 | dev->init_name = NULL; |
906 | } | 910 | } |
907 | 911 | ||
908 | if (!dev_name(dev)) | 912 | if (!dev_name(dev)) { |
913 | error = -EINVAL; | ||
909 | goto name_error; | 914 | goto name_error; |
915 | } | ||
910 | 916 | ||
911 | pr_debug("device: '%s': %s\n", dev_name(dev), __func__); | 917 | pr_debug("device: '%s': %s\n", dev_name(dev), __func__); |
912 | 918 | ||