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,
break;
default:
BUG();
val = "";
}
return sprintf(buf, "%s\n", val);
......
......@@ -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
* 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 s2 = (index >> 16) & 0xff;
u8 reg = (index >> 8) & 0xff;
u8 mask = index & 0xff;
int status;
int ret, status;
u8 regval;
status = data->status[reg];
......@@ -725,7 +725,7 @@ static int pmbus_get_boolean(struct pmbus_data *data, int index, int *val)
regval = status & mask;
if (!s1 && !s2)
*val = !!regval;
ret = !!regval;
else {
long v1, v2;
struct pmbus_sensor *sensor1, *sensor2;
......@@ -739,9 +739,9 @@ static int pmbus_get_boolean(struct pmbus_data *data, int index, int *val)
v1 = pmbus_reg2data(data, sensor1);
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,
......@@ -750,11 +750,10 @@ static ssize_t pmbus_show_boolean(struct device *dev,
struct sensor_device_attribute *attr = to_sensor_dev_attr(da);
struct pmbus_data *data = pmbus_update_device(dev);
int val;
int err;
err = pmbus_get_boolean(data, attr->index, &val);
if (err)
return err;
val = pmbus_get_boolean(data, attr->index);
if (val < 0)
return val;
return snprintf(buf, PAGE_SIZE, "%d\n", val);
}
......
......@@ -343,10 +343,11 @@ static int __init smsc47b397_device_add(unsigned short address)
return err;
}
static int __init smsc47b397_find(unsigned short *addr)
static int __init smsc47b397_find(void)
{
u8 id, rev;
char *name;
unsigned short addr;
superio_enter();
id = force_id ? force_id : superio_inb(SUPERIO_REG_DEVID);
......@@ -370,14 +371,14 @@ static int __init smsc47b397_find(unsigned short *addr)
rev = superio_inb(SUPERIO_REG_DEVREV);
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);
pr_info("found SMSC %s (base address 0x%04x, revision %u)\n",
name, *addr, rev);
name, addr, rev);
superio_exit();
return 0;
return addr;
}
static int __init smsc47b397_init(void)
......@@ -385,9 +386,10 @@ static int __init smsc47b397_init(void)
unsigned short address;
int ret;
ret = smsc47b397_find(&address);
if (ret)
ret = smsc47b397_find();
if (ret < 0)
return ret;
address = ret;
ret = platform_driver_register(&smsc47b397_driver);
if (ret)
......
......@@ -491,10 +491,10 @@ static const struct attribute_group smsc47m1_group = {
.attrs = smsc47m1_attributes,
};
static int __init smsc47m1_find(unsigned short *addr,
struct smsc47m1_sio_data *sio_data)
static int __init smsc47m1_find(struct smsc47m1_sio_data *sio_data)
{
u8 val;
unsigned short addr;
superio_enter();
val = force_id ? force_id : superio_inb(SUPERIO_REG_DEVID);
......@@ -546,9 +546,9 @@ static int __init smsc47m1_find(unsigned short *addr,
}
superio_select();
*addr = (superio_inb(SUPERIO_REG_BASE) << 8)
addr = (superio_inb(SUPERIO_REG_BASE) << 8)
| superio_inb(SUPERIO_REG_BASE + 1);
if (*addr == 0) {
if (addr == 0) {
pr_info("Device address not set, will not use\n");
superio_exit();
return -ENODEV;
......@@ -565,7 +565,7 @@ static int __init smsc47m1_find(unsigned short *addr,
}
superio_exit();
return 0;
return addr;
}
/* Restore device to its initial state */
......@@ -938,13 +938,15 @@ static int __init sm_smsc47m1_init(void)
unsigned short address;
struct smsc47m1_sio_data sio_data;
if (smsc47m1_find(&address, &sio_data))
return -ENODEV;
err = smsc47m1_find(&sio_data);
if (err < 0)
return err;
address = err;
/* Sets global pdev as a side effect */
err = smsc47m1_device_add(address, &sio_data);
if (err)
goto exit;
return err;
err = platform_driver_probe(&smsc47m1_driver, smsc47m1_probe);
if (err)
......@@ -955,7 +957,6 @@ static int __init sm_smsc47m1_init(void)
exit_device:
platform_device_unregister(pdev);
smsc47m1_restore(&sio_data);
exit:
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