Commit 6e117339 authored by Linus Torvalds's avatar Linus Torvalds

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
parents 461c1491 d7ee1115
...@@ -391,6 +391,7 @@ static ssize_t show_str(struct device *dev, ...@@ -391,6 +391,7 @@ static ssize_t show_str(struct device *dev,
break; break;
default: default:
BUG(); BUG();
val = "";
} }
return sprintf(buf, "%s\n", val); return sprintf(buf, "%s\n", val);
......
...@@ -710,13 +710,13 @@ static u16 pmbus_data2reg(struct pmbus_data *data, ...@@ -710,13 +710,13 @@ static u16 pmbus_data2reg(struct pmbus_data *data,
* If a negative value is stored in any of the referenced registers, this value * If a negative value is stored in any of the referenced registers, this value
* reflects an error code which will be returned. * reflects an error code which will be returned.
*/ */
static int pmbus_get_boolean(struct pmbus_data *data, int index, int *val) static int pmbus_get_boolean(struct pmbus_data *data, int index)
{ {
u8 s1 = (index >> 24) & 0xff; u8 s1 = (index >> 24) & 0xff;
u8 s2 = (index >> 16) & 0xff; u8 s2 = (index >> 16) & 0xff;
u8 reg = (index >> 8) & 0xff; u8 reg = (index >> 8) & 0xff;
u8 mask = index & 0xff; u8 mask = index & 0xff;
int status; int ret, status;
u8 regval; u8 regval;
status = data->status[reg]; status = data->status[reg];
...@@ -725,7 +725,7 @@ static int pmbus_get_boolean(struct pmbus_data *data, int index, int *val) ...@@ -725,7 +725,7 @@ static int pmbus_get_boolean(struct pmbus_data *data, int index, int *val)
regval = status & mask; regval = status & mask;
if (!s1 && !s2) if (!s1 && !s2)
*val = !!regval; ret = !!regval;
else { else {
long v1, v2; long v1, v2;
struct pmbus_sensor *sensor1, *sensor2; struct pmbus_sensor *sensor1, *sensor2;
...@@ -739,9 +739,9 @@ static int pmbus_get_boolean(struct pmbus_data *data, int index, int *val) ...@@ -739,9 +739,9 @@ static int pmbus_get_boolean(struct pmbus_data *data, int index, int *val)
v1 = pmbus_reg2data(data, sensor1); v1 = pmbus_reg2data(data, sensor1);
v2 = pmbus_reg2data(data, sensor2); v2 = pmbus_reg2data(data, sensor2);
*val = !!(regval && v1 >= v2); ret = !!(regval && v1 >= v2);
} }
return 0; return ret;
} }
static ssize_t pmbus_show_boolean(struct device *dev, static ssize_t pmbus_show_boolean(struct device *dev,
...@@ -750,11 +750,10 @@ static ssize_t pmbus_show_boolean(struct device *dev, ...@@ -750,11 +750,10 @@ static ssize_t pmbus_show_boolean(struct device *dev,
struct sensor_device_attribute *attr = to_sensor_dev_attr(da); struct sensor_device_attribute *attr = to_sensor_dev_attr(da);
struct pmbus_data *data = pmbus_update_device(dev); struct pmbus_data *data = pmbus_update_device(dev);
int val; int val;
int err;
err = pmbus_get_boolean(data, attr->index, &val); val = pmbus_get_boolean(data, attr->index);
if (err) if (val < 0)
return err; return val;
return snprintf(buf, PAGE_SIZE, "%d\n", val); return snprintf(buf, PAGE_SIZE, "%d\n", val);
} }
......
...@@ -343,10 +343,11 @@ static int __init smsc47b397_device_add(unsigned short address) ...@@ -343,10 +343,11 @@ static int __init smsc47b397_device_add(unsigned short address)
return err; return err;
} }
static int __init smsc47b397_find(unsigned short *addr) static int __init smsc47b397_find(void)
{ {
u8 id, rev; u8 id, rev;
char *name; char *name;
unsigned short addr;
superio_enter(); superio_enter();
id = force_id ? force_id : superio_inb(SUPERIO_REG_DEVID); id = force_id ? force_id : superio_inb(SUPERIO_REG_DEVID);
...@@ -370,14 +371,14 @@ static int __init smsc47b397_find(unsigned short *addr) ...@@ -370,14 +371,14 @@ static int __init smsc47b397_find(unsigned short *addr)
rev = superio_inb(SUPERIO_REG_DEVREV); rev = superio_inb(SUPERIO_REG_DEVREV);
superio_select(SUPERIO_REG_LD8); superio_select(SUPERIO_REG_LD8);
*addr = (superio_inb(SUPERIO_REG_BASE_MSB) << 8) addr = (superio_inb(SUPERIO_REG_BASE_MSB) << 8)
| superio_inb(SUPERIO_REG_BASE_LSB); | superio_inb(SUPERIO_REG_BASE_LSB);
pr_info("found SMSC %s (base address 0x%04x, revision %u)\n", pr_info("found SMSC %s (base address 0x%04x, revision %u)\n",
name, *addr, rev); name, addr, rev);
superio_exit(); superio_exit();
return 0; return addr;
} }
static int __init smsc47b397_init(void) static int __init smsc47b397_init(void)
...@@ -385,9 +386,10 @@ static int __init smsc47b397_init(void) ...@@ -385,9 +386,10 @@ static int __init smsc47b397_init(void)
unsigned short address; unsigned short address;
int ret; int ret;
ret = smsc47b397_find(&address); ret = smsc47b397_find();
if (ret) if (ret < 0)
return ret; return ret;
address = ret;
ret = platform_driver_register(&smsc47b397_driver); ret = platform_driver_register(&smsc47b397_driver);
if (ret) if (ret)
......
...@@ -491,10 +491,10 @@ static const struct attribute_group smsc47m1_group = { ...@@ -491,10 +491,10 @@ static const struct attribute_group smsc47m1_group = {
.attrs = smsc47m1_attributes, .attrs = smsc47m1_attributes,
}; };
static int __init smsc47m1_find(unsigned short *addr, static int __init smsc47m1_find(struct smsc47m1_sio_data *sio_data)
struct smsc47m1_sio_data *sio_data)
{ {
u8 val; u8 val;
unsigned short addr;
superio_enter(); superio_enter();
val = force_id ? force_id : superio_inb(SUPERIO_REG_DEVID); val = force_id ? force_id : superio_inb(SUPERIO_REG_DEVID);
...@@ -546,9 +546,9 @@ static int __init smsc47m1_find(unsigned short *addr, ...@@ -546,9 +546,9 @@ static int __init smsc47m1_find(unsigned short *addr,
} }
superio_select(); superio_select();
*addr = (superio_inb(SUPERIO_REG_BASE) << 8) addr = (superio_inb(SUPERIO_REG_BASE) << 8)
| superio_inb(SUPERIO_REG_BASE + 1); | superio_inb(SUPERIO_REG_BASE + 1);
if (*addr == 0) { if (addr == 0) {
pr_info("Device address not set, will not use\n"); pr_info("Device address not set, will not use\n");
superio_exit(); superio_exit();
return -ENODEV; return -ENODEV;
...@@ -565,7 +565,7 @@ static int __init smsc47m1_find(unsigned short *addr, ...@@ -565,7 +565,7 @@ static int __init smsc47m1_find(unsigned short *addr,
} }
superio_exit(); superio_exit();
return 0; return addr;
} }
/* Restore device to its initial state */ /* Restore device to its initial state */
...@@ -938,13 +938,15 @@ static int __init sm_smsc47m1_init(void) ...@@ -938,13 +938,15 @@ static int __init sm_smsc47m1_init(void)
unsigned short address; unsigned short address;
struct smsc47m1_sio_data sio_data; struct smsc47m1_sio_data sio_data;
if (smsc47m1_find(&address, &sio_data)) err = smsc47m1_find(&sio_data);
return -ENODEV; if (err < 0)
return err;
address = err;
/* Sets global pdev as a side effect */ /* Sets global pdev as a side effect */
err = smsc47m1_device_add(address, &sio_data); err = smsc47m1_device_add(address, &sio_data);
if (err) if (err)
goto exit; return err;
err = platform_driver_probe(&smsc47m1_driver, smsc47m1_probe); err = platform_driver_probe(&smsc47m1_driver, smsc47m1_probe);
if (err) if (err)
...@@ -955,7 +957,6 @@ static int __init sm_smsc47m1_init(void) ...@@ -955,7 +957,6 @@ static int __init sm_smsc47m1_init(void)
exit_device: exit_device:
platform_device_unregister(pdev); platform_device_unregister(pdev);
smsc47m1_restore(&sio_data); smsc47m1_restore(&sio_data);
exit:
return err; return err;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment