diff options
Diffstat (limited to 'drivers/hwmon/hwmon.c')
-rw-r--r-- | drivers/hwmon/hwmon.c | 27 |
1 files changed, 13 insertions, 14 deletions
diff --git a/drivers/hwmon/hwmon.c b/drivers/hwmon/hwmon.c index affcc00764d3..3db28450a3b3 100644 --- a/drivers/hwmon/hwmon.c +++ b/drivers/hwmon/hwmon.c | |||
@@ -28,17 +28,17 @@ static DEFINE_IDR(hwmon_idr); | |||
28 | static DEFINE_SPINLOCK(idr_lock); | 28 | static DEFINE_SPINLOCK(idr_lock); |
29 | 29 | ||
30 | /** | 30 | /** |
31 | * hwmon_device_register - register w/ hwmon sysfs class | 31 | * hwmon_device_register - register w/ hwmon |
32 | * @dev: the device to register | 32 | * @dev: the device to register |
33 | * | 33 | * |
34 | * hwmon_device_unregister() must be called when the class device is no | 34 | * hwmon_device_unregister() must be called when the device is no |
35 | * longer needed. | 35 | * longer needed. |
36 | * | 36 | * |
37 | * Returns the pointer to the new struct class device. | 37 | * Returns the pointer to the new device. |
38 | */ | 38 | */ |
39 | struct class_device *hwmon_device_register(struct device *dev) | 39 | struct device *hwmon_device_register(struct device *dev) |
40 | { | 40 | { |
41 | struct class_device *cdev; | 41 | struct device *hwdev; |
42 | int id, err; | 42 | int id, err; |
43 | 43 | ||
44 | again: | 44 | again: |
@@ -55,34 +55,33 @@ again: | |||
55 | return ERR_PTR(err); | 55 | return ERR_PTR(err); |
56 | 56 | ||
57 | id = id & MAX_ID_MASK; | 57 | id = id & MAX_ID_MASK; |
58 | cdev = class_device_create(hwmon_class, NULL, MKDEV(0,0), dev, | 58 | hwdev = device_create(hwmon_class, dev, MKDEV(0,0), HWMON_ID_FORMAT, id); |
59 | HWMON_ID_FORMAT, id); | ||
60 | 59 | ||
61 | if (IS_ERR(cdev)) { | 60 | if (IS_ERR(hwdev)) { |
62 | spin_lock(&idr_lock); | 61 | spin_lock(&idr_lock); |
63 | idr_remove(&hwmon_idr, id); | 62 | idr_remove(&hwmon_idr, id); |
64 | spin_unlock(&idr_lock); | 63 | spin_unlock(&idr_lock); |
65 | } | 64 | } |
66 | 65 | ||
67 | return cdev; | 66 | return hwdev; |
68 | } | 67 | } |
69 | 68 | ||
70 | /** | 69 | /** |
71 | * hwmon_device_unregister - removes the previously registered class device | 70 | * hwmon_device_unregister - removes the previously registered class device |
72 | * | 71 | * |
73 | * @cdev: the class device to destroy | 72 | * @dev: the class device to destroy |
74 | */ | 73 | */ |
75 | void hwmon_device_unregister(struct class_device *cdev) | 74 | void hwmon_device_unregister(struct device *dev) |
76 | { | 75 | { |
77 | int id; | 76 | int id; |
78 | 77 | ||
79 | if (likely(sscanf(cdev->class_id, HWMON_ID_FORMAT, &id) == 1)) { | 78 | if (likely(sscanf(dev->bus_id, HWMON_ID_FORMAT, &id) == 1)) { |
80 | class_device_unregister(cdev); | 79 | device_unregister(dev); |
81 | spin_lock(&idr_lock); | 80 | spin_lock(&idr_lock); |
82 | idr_remove(&hwmon_idr, id); | 81 | idr_remove(&hwmon_idr, id); |
83 | spin_unlock(&idr_lock); | 82 | spin_unlock(&idr_lock); |
84 | } else | 83 | } else |
85 | dev_dbg(cdev->dev, | 84 | dev_dbg(dev->parent, |
86 | "hwmon_device_unregister() failed: bad class ID!\n"); | 85 | "hwmon_device_unregister() failed: bad class ID!\n"); |
87 | } | 86 | } |
88 | 87 | ||