hwmon patches for 3.4-rc3
Fix build warnings in four drivers -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.10 (GNU/Linux) iQIcBAABAgAGBQJPiERHAAoJEMsfJm/On5mBglMP/3eIijeFZqsSiSDfuc3QwW81 E4W6jXUMT+8QdPiygwDknewUZFkqzyjPi5PQ/JPde2DEvUhhgCH5tSP8a75pBMvu CH3gooUbUp7SyzClgdYB5qeC9S6ps31Y6liOqkAqCfbw4gRq7VyE+D+YGpD1mqVL r8PvJ3tFVbjUyAduKuVrHfAjZXAxXIhUStzFT5Wn/jTnWpYlPK5xqspJUhz8yyjh D1dtrxdlOeNwB6895ww99cQhEp3BWAwItQpIUtegP6rnjh6+BsBLT0zTzVBYz5ts XJBDuUHGsCgh/Y306pUSbFiOfSqMMPD1kG6+/V+gRb6VZAGK9I1zR9sZhoAvb99d SSyn5FK7Wg4OxzOTLD/V4unSeWIujXebZEl2KSv9fBh0I57aMYc7hG98t0WN4ydV iXxgw7yxWjL1pfD7r/6KTvrixqltdCaaWVrl+ldmhQ7KOATqMt6ZTYZkQkF7kGpm IWwuXhQEo6/2Qk6g4ngIJbo58e7TA5mM4qKNeLKJclM69NSt81qiA5Fk1cn1SV+j nK05OagmAvIlI3LsVuhDmWjs1VwRFRTbAQIbOK3dLgPoBuvFg3EFT3DP6qifNY8a 0Nv4PYwuM4Zl66Zg2I8yeZW/xkaTOxbzZSsTIKRLqc+TdRQ0NsF/TqwdeI1oEBMx 21T8nnmU8NYSurrQWPR8 =JQfl -----END PGP SIGNATURE----- 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
This commit is contained in:
commit
6e1173399d
|
@ -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 @@ exit:
|
|||
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;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue