aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/hwmon/atxp1.c
diff options
context:
space:
mode:
authorSteven Whitehouse <swhiteho@redhat.com>2006-10-02 08:45:08 -0400
committerSteven Whitehouse <swhiteho@redhat.com>2006-10-02 08:45:08 -0400
commit59458f40e25915a355d8b1d701425fe9f4f9ea23 (patch)
treef1c9a2934df686e36d75f759ab7313b6f0e0e5f9 /drivers/hwmon/atxp1.c
parent825f9075d74028d11d7f5932f04e1b5db3022b51 (diff)
parentd834c16516d1ebec4766fc58c059bf01311e6045 (diff)
Merge branch 'master' into gfs2
Diffstat (limited to 'drivers/hwmon/atxp1.c')
-rw-r--r--drivers/hwmon/atxp1.c28
1 files changed, 21 insertions, 7 deletions
diff --git a/drivers/hwmon/atxp1.c b/drivers/hwmon/atxp1.c
index 728a1e8b9190..0ccdd0750c44 100644
--- a/drivers/hwmon/atxp1.c
+++ b/drivers/hwmon/atxp1.c
@@ -27,6 +27,7 @@
27#include <linux/hwmon-vid.h> 27#include <linux/hwmon-vid.h>
28#include <linux/err.h> 28#include <linux/err.h>
29#include <linux/mutex.h> 29#include <linux/mutex.h>
30#include <linux/sysfs.h>
30 31
31MODULE_LICENSE("GPL"); 32MODULE_LICENSE("GPL");
32MODULE_DESCRIPTION("System voltages control via Attansic ATXP1"); 33MODULE_DESCRIPTION("System voltages control via Attansic ATXP1");
@@ -116,8 +117,7 @@ static ssize_t atxp1_storevcore(struct device *dev, struct device_attribute *att
116{ 117{
117 struct atxp1_data *data; 118 struct atxp1_data *data;
118 struct i2c_client *client; 119 struct i2c_client *client;
119 char vid; 120 int vid, cvid;
120 char cvid;
121 unsigned int vcore; 121 unsigned int vcore;
122 122
123 client = to_i2c_client(dev); 123 client = to_i2c_client(dev);
@@ -251,6 +251,17 @@ static ssize_t atxp1_storegpio2(struct device *dev, struct device_attribute *att
251*/ 251*/
252static DEVICE_ATTR(gpio2, S_IRUGO | S_IWUSR, atxp1_showgpio2, atxp1_storegpio2); 252static DEVICE_ATTR(gpio2, S_IRUGO | S_IWUSR, atxp1_showgpio2, atxp1_storegpio2);
253 253
254static struct attribute *atxp1_attributes[] = {
255 &dev_attr_gpio1.attr,
256 &dev_attr_gpio2.attr,
257 &dev_attr_cpu0_vid.attr,
258 NULL
259};
260
261static const struct attribute_group atxp1_group = {
262 .attrs = atxp1_attributes,
263};
264
254 265
255static int atxp1_attach_adapter(struct i2c_adapter *adapter) 266static int atxp1_attach_adapter(struct i2c_adapter *adapter)
256{ 267{
@@ -320,21 +331,23 @@ static int atxp1_detect(struct i2c_adapter *adapter, int address, int kind)
320 goto exit_free; 331 goto exit_free;
321 } 332 }
322 333
334 /* Register sysfs hooks */
335 if ((err = sysfs_create_group(&new_client->dev.kobj, &atxp1_group)))
336 goto exit_detach;
337
323 data->class_dev = hwmon_device_register(&new_client->dev); 338 data->class_dev = hwmon_device_register(&new_client->dev);
324 if (IS_ERR(data->class_dev)) { 339 if (IS_ERR(data->class_dev)) {
325 err = PTR_ERR(data->class_dev); 340 err = PTR_ERR(data->class_dev);
326 goto exit_detach; 341 goto exit_remove_files;
327 } 342 }
328 343
329 device_create_file(&new_client->dev, &dev_attr_gpio1);
330 device_create_file(&new_client->dev, &dev_attr_gpio2);
331 device_create_file(&new_client->dev, &dev_attr_cpu0_vid);
332
333 dev_info(&new_client->dev, "Using VRM: %d.%d\n", 344 dev_info(&new_client->dev, "Using VRM: %d.%d\n",
334 data->vrm / 10, data->vrm % 10); 345 data->vrm / 10, data->vrm % 10);
335 346
336 return 0; 347 return 0;
337 348
349exit_remove_files:
350 sysfs_remove_group(&new_client->dev.kobj, &atxp1_group);
338exit_detach: 351exit_detach:
339 i2c_detach_client(new_client); 352 i2c_detach_client(new_client);
340exit_free: 353exit_free:
@@ -349,6 +362,7 @@ static int atxp1_detach_client(struct i2c_client * client)
349 int err; 362 int err;
350 363
351 hwmon_device_unregister(data->class_dev); 364 hwmon_device_unregister(data->class_dev);
365 sysfs_remove_group(&client->dev.kobj, &atxp1_group);
352 366
353 err = i2c_detach_client(client); 367 err = i2c_detach_client(client);
354 368