Skip to content

Commit 0d77a12

Browse files
committed
Merge tag 'hwmon-for-linus-v4.4-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/groeck/linux-staging
Pull hwmon fixes from Guenter Roeck: "Fix build issues in scpi and ina2xx drivers, update scpi driver to support recent firmware, and fix an uninitialized variable warning in applesmc driver" * tag 'hwmon-for-linus-v4.4-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/groeck/linux-staging: hwmon: (scpi) skip unsupported sensors properly hwmon: (scpi) add thermal-of dependency hwmon : (applesmc) Fix uninitialized variables warnings hwmon: (ina2xx) Fix build issue by selecting REGMAP_I2C
2 parents 7f151f1 + cef03d7 commit 0d77a12

File tree

3 files changed

+14
-11
lines changed

3 files changed

+14
-11
lines changed

drivers/hwmon/Kconfig

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -324,6 +324,7 @@ config SENSORS_APPLESMC
324324
config SENSORS_ARM_SCPI
325325
tristate "ARM SCPI Sensors"
326326
depends on ARM_SCPI_PROTOCOL
327+
depends on THERMAL || !THERMAL_OF
327328
help
328329
This driver provides support for temperature, voltage, current
329330
and power sensors available on ARM Ltd's SCP based platforms. The
@@ -1471,6 +1472,7 @@ config SENSORS_INA209
14711472
config SENSORS_INA2XX
14721473
tristate "Texas Instruments INA219 and compatibles"
14731474
depends on I2C
1475+
select REGMAP_I2C
14741476
help
14751477
If you say yes here you get support for INA219, INA220, INA226,
14761478
INA230, and INA231 power monitor chips.

drivers/hwmon/applesmc.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -537,7 +537,7 @@ static int applesmc_init_index(struct applesmc_registers *s)
537537
static int applesmc_init_smcreg_try(void)
538538
{
539539
struct applesmc_registers *s = &smcreg;
540-
bool left_light_sensor, right_light_sensor;
540+
bool left_light_sensor = 0, right_light_sensor = 0;
541541
unsigned int count;
542542
u8 tmp[1];
543543
int ret;

drivers/hwmon/scpi-hwmon.c

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ static int scpi_hwmon_probe(struct platform_device *pdev)
117117
struct scpi_ops *scpi_ops;
118118
struct device *hwdev, *dev = &pdev->dev;
119119
struct scpi_sensors *scpi_sensors;
120-
int ret;
120+
int ret, idx;
121121

122122
scpi_ops = get_scpi_ops();
123123
if (!scpi_ops)
@@ -146,8 +146,8 @@ static int scpi_hwmon_probe(struct platform_device *pdev)
146146

147147
scpi_sensors->scpi_ops = scpi_ops;
148148

149-
for (i = 0; i < nr_sensors; i++) {
150-
struct sensor_data *sensor = &scpi_sensors->data[i];
149+
for (i = 0, idx = 0; i < nr_sensors; i++) {
150+
struct sensor_data *sensor = &scpi_sensors->data[idx];
151151

152152
ret = scpi_ops->sensor_get_info(i, &sensor->info);
153153
if (ret)
@@ -183,7 +183,7 @@ static int scpi_hwmon_probe(struct platform_device *pdev)
183183
num_power++;
184184
break;
185185
default:
186-
break;
186+
continue;
187187
}
188188

189189
sensor->dev_attr_input.attr.mode = S_IRUGO;
@@ -194,11 +194,12 @@ static int scpi_hwmon_probe(struct platform_device *pdev)
194194
sensor->dev_attr_label.show = scpi_show_label;
195195
sensor->dev_attr_label.attr.name = sensor->label;
196196

197-
scpi_sensors->attrs[i << 1] = &sensor->dev_attr_input.attr;
198-
scpi_sensors->attrs[(i << 1) + 1] = &sensor->dev_attr_label.attr;
197+
scpi_sensors->attrs[idx << 1] = &sensor->dev_attr_input.attr;
198+
scpi_sensors->attrs[(idx << 1) + 1] = &sensor->dev_attr_label.attr;
199199

200-
sysfs_attr_init(scpi_sensors->attrs[i << 1]);
201-
sysfs_attr_init(scpi_sensors->attrs[(i << 1) + 1]);
200+
sysfs_attr_init(scpi_sensors->attrs[idx << 1]);
201+
sysfs_attr_init(scpi_sensors->attrs[(idx << 1) + 1]);
202+
idx++;
202203
}
203204

204205
scpi_sensors->group.attrs = scpi_sensors->attrs;
@@ -236,8 +237,8 @@ static int scpi_hwmon_probe(struct platform_device *pdev)
236237

237238
zone->sensor_id = i;
238239
zone->scpi_sensors = scpi_sensors;
239-
zone->tzd = thermal_zone_of_sensor_register(dev, i, zone,
240-
&scpi_sensor_ops);
240+
zone->tzd = thermal_zone_of_sensor_register(dev,
241+
sensor->info.sensor_id, zone, &scpi_sensor_ops);
241242
/*
242243
* The call to thermal_zone_of_sensor_register returns
243244
* an error for sensors that are not associated with

0 commit comments

Comments
 (0)