aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2012-04-13 15:19:41 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2012-04-13 15:19:41 -0400
commit6e1173399d09aa7ab5db613911e38700b2307ece (patch)
treea86e7a294f5648dbc531c9590094492b887fea90 /drivers
parent461c14917e04f76d5efc63ce079798d4ca6c297f (diff)
parentd7ee11157f1fce02632e2f3a56b99b2afd9e5f93 (diff)
Merge tag 'hwmon-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/groeck/linux-staging
Pull hwmon patches from Guenter Roeck: "Fix build warnings in four drivers" * tag 'hwmon-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/groeck/linux-staging: hwmon: (pmbus_core) Fix compiler warning hwmon: (smsc47m1) Fix compiler warning hwmon: (acpi_power_meter) Fix compiler warning seen in some configurations hwmon: (smsc47b397) Fix compiler warning
Diffstat (limited to 'drivers')
-rw-r--r--drivers/hwmon/acpi_power_meter.c1
-rw-r--r--drivers/hwmon/pmbus/pmbus_core.c17
-rw-r--r--drivers/hwmon/smsc47b397.c14
-rw-r--r--drivers/hwmon/smsc47m1.c19
4 files changed, 27 insertions, 24 deletions
diff --git a/drivers/hwmon/acpi_power_meter.c b/drivers/hwmon/acpi_power_meter.c
index 145f13580ff0..9140236a0182 100644
--- a/drivers/hwmon/acpi_power_meter.c
+++ b/drivers/hwmon/acpi_power_meter.c
@@ -391,6 +391,7 @@ static ssize_t show_str(struct device *dev,
391 break; 391 break;
392 default: 392 default:
393 BUG(); 393 BUG();
394 val = "";
394 } 395 }
395 396
396 return sprintf(buf, "%s\n", val); 397 return sprintf(buf, "%s\n", val);
diff --git a/drivers/hwmon/pmbus/pmbus_core.c b/drivers/hwmon/pmbus/pmbus_core.c
index be51037363c8..29b319db573e 100644
--- a/drivers/hwmon/pmbus/pmbus_core.c
+++ b/drivers/hwmon/pmbus/pmbus_core.c
@@ -710,13 +710,13 @@ static u16 pmbus_data2reg(struct pmbus_data *data,
710 * If a negative value is stored in any of the referenced registers, this value 710 * If a negative value is stored in any of the referenced registers, this value
711 * reflects an error code which will be returned. 711 * reflects an error code which will be returned.
712 */ 712 */
713static int pmbus_get_boolean(struct pmbus_data *data, int index, int *val) 713static int pmbus_get_boolean(struct pmbus_data *data, int index)
714{ 714{
715 u8 s1 = (index >> 24) & 0xff; 715 u8 s1 = (index >> 24) & 0xff;
716 u8 s2 = (index >> 16) & 0xff; 716 u8 s2 = (index >> 16) & 0xff;
717 u8 reg = (index >> 8) & 0xff; 717 u8 reg = (index >> 8) & 0xff;
718 u8 mask = index & 0xff; 718 u8 mask = index & 0xff;
719 int status; 719 int ret, status;
720 u8 regval; 720 u8 regval;
721 721
722 status = data->status[reg]; 722 status = data->status[reg];
@@ -725,7 +725,7 @@ static int pmbus_get_boolean(struct pmbus_data *data, int index, int *val)
725 725
726 regval = status & mask; 726 regval = status & mask;
727 if (!s1 && !s2) 727 if (!s1 && !s2)
728 *val = !!regval; 728 ret = !!regval;
729 else { 729 else {
730 long v1, v2; 730 long v1, v2;
731 struct pmbus_sensor *sensor1, *sensor2; 731 struct pmbus_sensor *sensor1, *sensor2;
@@ -739,9 +739,9 @@ static int pmbus_get_boolean(struct pmbus_data *data, int index, int *val)
739 739
740 v1 = pmbus_reg2data(data, sensor1); 740 v1 = pmbus_reg2data(data, sensor1);
741 v2 = pmbus_reg2data(data, sensor2); 741 v2 = pmbus_reg2data(data, sensor2);
742 *val = !!(regval && v1 >= v2); 742 ret = !!(regval && v1 >= v2);
743 } 743 }
744 return 0; 744 return ret;
745} 745}
746 746
747static ssize_t pmbus_show_boolean(struct device *dev, 747static ssize_t pmbus_show_boolean(struct device *dev,
@@ -750,11 +750,10 @@ static ssize_t pmbus_show_boolean(struct device *dev,
750 struct sensor_device_attribute *attr = to_sensor_dev_attr(da); 750 struct sensor_device_attribute *attr = to_sensor_dev_attr(da);
751 struct pmbus_data *data = pmbus_update_device(dev); 751 struct pmbus_data *data = pmbus_update_device(dev);
752 int val; 752 int val;
753 int err;
754 753
755 err = pmbus_get_boolean(data, attr->index, &val); 754 val = pmbus_get_boolean(data, attr->index);
756 if (err) 755 if (val < 0)
757 return err; 756 return val;
758 return snprintf(buf, PAGE_SIZE, "%d\n", val); 757 return snprintf(buf, PAGE_SIZE, "%d\n", val);
759} 758}
760 759
diff --git a/drivers/hwmon/smsc47b397.c b/drivers/hwmon/smsc47b397.c
index d3b778da3f86..c5f6be478bad 100644
--- a/drivers/hwmon/smsc47b397.c
+++ b/drivers/hwmon/smsc47b397.c
@@ -343,10 +343,11 @@ exit:
343 return err; 343 return err;
344} 344}
345 345
346static int __init smsc47b397_find(unsigned short *addr) 346static int __init smsc47b397_find(void)
347{ 347{
348 u8 id, rev; 348 u8 id, rev;
349 char *name; 349 char *name;
350 unsigned short addr;
350 351
351 superio_enter(); 352 superio_enter();
352 id = force_id ? force_id : superio_inb(SUPERIO_REG_DEVID); 353 id = force_id ? force_id : superio_inb(SUPERIO_REG_DEVID);
@@ -370,14 +371,14 @@ static int __init smsc47b397_find(unsigned short *addr)
370 rev = superio_inb(SUPERIO_REG_DEVREV); 371 rev = superio_inb(SUPERIO_REG_DEVREV);
371 372
372 superio_select(SUPERIO_REG_LD8); 373 superio_select(SUPERIO_REG_LD8);
373 *addr = (superio_inb(SUPERIO_REG_BASE_MSB) << 8) 374 addr = (superio_inb(SUPERIO_REG_BASE_MSB) << 8)
374 | superio_inb(SUPERIO_REG_BASE_LSB); 375 | superio_inb(SUPERIO_REG_BASE_LSB);
375 376
376 pr_info("found SMSC %s (base address 0x%04x, revision %u)\n", 377 pr_info("found SMSC %s (base address 0x%04x, revision %u)\n",
377 name, *addr, rev); 378 name, addr, rev);
378 379
379 superio_exit(); 380 superio_exit();
380 return 0; 381 return addr;
381} 382}
382 383
383static int __init smsc47b397_init(void) 384static int __init smsc47b397_init(void)
@@ -385,9 +386,10 @@ static int __init smsc47b397_init(void)
385 unsigned short address; 386 unsigned short address;
386 int ret; 387 int ret;
387 388
388 ret = smsc47b397_find(&address); 389 ret = smsc47b397_find();
389 if (ret) 390 if (ret < 0)
390 return ret; 391 return ret;
392 address = ret;
391 393
392 ret = platform_driver_register(&smsc47b397_driver); 394 ret = platform_driver_register(&smsc47b397_driver);
393 if (ret) 395 if (ret)
diff --git a/drivers/hwmon/smsc47m1.c b/drivers/hwmon/smsc47m1.c
index c590c1469793..b5aa38dd7ab9 100644
--- a/drivers/hwmon/smsc47m1.c
+++ b/drivers/hwmon/smsc47m1.c
@@ -491,10 +491,10 @@ static const struct attribute_group smsc47m1_group = {
491 .attrs = smsc47m1_attributes, 491 .attrs = smsc47m1_attributes,
492}; 492};
493 493
494static int __init smsc47m1_find(unsigned short *addr, 494static int __init smsc47m1_find(struct smsc47m1_sio_data *sio_data)
495 struct smsc47m1_sio_data *sio_data)
496{ 495{
497 u8 val; 496 u8 val;
497 unsigned short addr;
498 498
499 superio_enter(); 499 superio_enter();
500 val = force_id ? force_id : superio_inb(SUPERIO_REG_DEVID); 500 val = force_id ? force_id : superio_inb(SUPERIO_REG_DEVID);
@@ -546,9 +546,9 @@ static int __init smsc47m1_find(unsigned short *addr,
546 } 546 }
547 547
548 superio_select(); 548 superio_select();
549 *addr = (superio_inb(SUPERIO_REG_BASE) << 8) 549 addr = (superio_inb(SUPERIO_REG_BASE) << 8)
550 | superio_inb(SUPERIO_REG_BASE + 1); 550 | superio_inb(SUPERIO_REG_BASE + 1);
551 if (*addr == 0) { 551 if (addr == 0) {
552 pr_info("Device address not set, will not use\n"); 552 pr_info("Device address not set, will not use\n");
553 superio_exit(); 553 superio_exit();
554 return -ENODEV; 554 return -ENODEV;
@@ -565,7 +565,7 @@ static int __init smsc47m1_find(unsigned short *addr,
565 } 565 }
566 566
567 superio_exit(); 567 superio_exit();
568 return 0; 568 return addr;
569} 569}
570 570
571/* Restore device to its initial state */ 571/* Restore device to its initial state */
@@ -938,13 +938,15 @@ static int __init sm_smsc47m1_init(void)
938 unsigned short address; 938 unsigned short address;
939 struct smsc47m1_sio_data sio_data; 939 struct smsc47m1_sio_data sio_data;
940 940
941 if (smsc47m1_find(&address, &sio_data)) 941 err = smsc47m1_find(&sio_data);
942 return -ENODEV; 942 if (err < 0)
943 return err;
944 address = err;
943 945
944 /* Sets global pdev as a side effect */ 946 /* Sets global pdev as a side effect */
945 err = smsc47m1_device_add(address, &sio_data); 947 err = smsc47m1_device_add(address, &sio_data);
946 if (err) 948 if (err)
947 goto exit; 949 return err;
948 950
949 err = platform_driver_probe(&smsc47m1_driver, smsc47m1_probe); 951 err = platform_driver_probe(&smsc47m1_driver, smsc47m1_probe);
950 if (err) 952 if (err)
@@ -955,7 +957,6 @@ static int __init sm_smsc47m1_init(void)
955exit_device: 957exit_device:
956 platform_device_unregister(pdev); 958 platform_device_unregister(pdev);
957 smsc47m1_restore(&sio_data); 959 smsc47m1_restore(&sio_data);
958exit:
959 return err; 960 return err;
960} 961}
961 962