diff options
Diffstat (limited to 'drivers/extcon')
| -rw-r--r-- | drivers/extcon/extcon.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/drivers/extcon/extcon.c b/drivers/extcon/extcon.c index 4c9f165e4a04..1a932292d6c8 100644 --- a/drivers/extcon/extcon.c +++ b/drivers/extcon/extcon.c | |||
| @@ -163,7 +163,7 @@ static ssize_t name_show(struct device *dev, struct device_attribute *attr, | |||
| 163 | return ret; | 163 | return ret; |
| 164 | } | 164 | } |
| 165 | 165 | ||
| 166 | return sprintf(buf, "%s\n", dev_name(&edev->dev)); | 166 | return sprintf(buf, "%s\n", edev->name); |
| 167 | } | 167 | } |
| 168 | static DEVICE_ATTR_RO(name); | 168 | static DEVICE_ATTR_RO(name); |
| 169 | 169 | ||
| @@ -701,6 +701,7 @@ EXPORT_SYMBOL_GPL(devm_extcon_dev_free); | |||
| 701 | int extcon_dev_register(struct extcon_dev *edev) | 701 | int extcon_dev_register(struct extcon_dev *edev) |
| 702 | { | 702 | { |
| 703 | int ret, index = 0; | 703 | int ret, index = 0; |
| 704 | static atomic_t edev_no = ATOMIC_INIT(-1); | ||
| 704 | 705 | ||
| 705 | if (!extcon_class) { | 706 | if (!extcon_class) { |
| 706 | ret = create_extcon_class(); | 707 | ret = create_extcon_class(); |
| @@ -725,13 +726,14 @@ int extcon_dev_register(struct extcon_dev *edev) | |||
| 725 | edev->dev.class = extcon_class; | 726 | edev->dev.class = extcon_class; |
| 726 | edev->dev.release = extcon_dev_release; | 727 | edev->dev.release = extcon_dev_release; |
| 727 | 728 | ||
| 728 | edev->name = edev->name ? edev->name : dev_name(edev->dev.parent); | 729 | edev->name = dev_name(edev->dev.parent); |
| 729 | if (IS_ERR_OR_NULL(edev->name)) { | 730 | if (IS_ERR_OR_NULL(edev->name)) { |
| 730 | dev_err(&edev->dev, | 731 | dev_err(&edev->dev, |
| 731 | "extcon device name is null\n"); | 732 | "extcon device name is null\n"); |
| 732 | return -EINVAL; | 733 | return -EINVAL; |
| 733 | } | 734 | } |
| 734 | dev_set_name(&edev->dev, "%s", edev->name); | 735 | dev_set_name(&edev->dev, "extcon%lu", |
| 736 | (unsigned long)atomic_inc_return(&edev_no)); | ||
| 735 | 737 | ||
| 736 | if (edev->max_supported) { | 738 | if (edev->max_supported) { |
| 737 | char buf[10]; | 739 | char buf[10]; |
