Browse Source

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
Linus Torvalds 9 years ago
parent
commit
0d77a123ff
3 changed files with 14 additions and 11 deletions
  1. 2 0
      drivers/hwmon/Kconfig
  2. 1 1
      drivers/hwmon/applesmc.c
  3. 11 10
      drivers/hwmon/scpi-hwmon.c

+ 2 - 0
drivers/hwmon/Kconfig

@@ -324,6 +324,7 @@ config SENSORS_APPLESMC
 config SENSORS_ARM_SCPI
 config SENSORS_ARM_SCPI
 	tristate "ARM SCPI Sensors"
 	tristate "ARM SCPI Sensors"
 	depends on ARM_SCPI_PROTOCOL
 	depends on ARM_SCPI_PROTOCOL
+	depends on THERMAL || !THERMAL_OF
 	help
 	help
 	  This driver provides support for temperature, voltage, current
 	  This driver provides support for temperature, voltage, current
 	  and power sensors available on ARM Ltd's SCP based platforms. The
 	  and power sensors available on ARM Ltd's SCP based platforms. The
@@ -1471,6 +1472,7 @@ config SENSORS_INA209
 config SENSORS_INA2XX
 config SENSORS_INA2XX
 	tristate "Texas Instruments INA219 and compatibles"
 	tristate "Texas Instruments INA219 and compatibles"
 	depends on I2C
 	depends on I2C
+	select REGMAP_I2C
 	help
 	help
 	  If you say yes here you get support for INA219, INA220, INA226,
 	  If you say yes here you get support for INA219, INA220, INA226,
 	  INA230, and INA231 power monitor chips.
 	  INA230, and INA231 power monitor chips.

+ 1 - 1
drivers/hwmon/applesmc.c

@@ -537,7 +537,7 @@ static int applesmc_init_index(struct applesmc_registers *s)
 static int applesmc_init_smcreg_try(void)
 static int applesmc_init_smcreg_try(void)
 {
 {
 	struct applesmc_registers *s = &smcreg;
 	struct applesmc_registers *s = &smcreg;
-	bool left_light_sensor, right_light_sensor;
+	bool left_light_sensor = 0, right_light_sensor = 0;
 	unsigned int count;
 	unsigned int count;
 	u8 tmp[1];
 	u8 tmp[1];
 	int ret;
 	int ret;

+ 11 - 10
drivers/hwmon/scpi-hwmon.c

@@ -117,7 +117,7 @@ static int scpi_hwmon_probe(struct platform_device *pdev)
 	struct scpi_ops *scpi_ops;
 	struct scpi_ops *scpi_ops;
 	struct device *hwdev, *dev = &pdev->dev;
 	struct device *hwdev, *dev = &pdev->dev;
 	struct scpi_sensors *scpi_sensors;
 	struct scpi_sensors *scpi_sensors;
-	int ret;
+	int ret, idx;
 
 
 	scpi_ops = get_scpi_ops();
 	scpi_ops = get_scpi_ops();
 	if (!scpi_ops)
 	if (!scpi_ops)
@@ -146,8 +146,8 @@ static int scpi_hwmon_probe(struct platform_device *pdev)
 
 
 	scpi_sensors->scpi_ops = scpi_ops;
 	scpi_sensors->scpi_ops = scpi_ops;
 
 
-	for (i = 0; i < nr_sensors; i++) {
-		struct sensor_data *sensor = &scpi_sensors->data[i];
+	for (i = 0, idx = 0; i < nr_sensors; i++) {
+		struct sensor_data *sensor = &scpi_sensors->data[idx];
 
 
 		ret = scpi_ops->sensor_get_info(i, &sensor->info);
 		ret = scpi_ops->sensor_get_info(i, &sensor->info);
 		if (ret)
 		if (ret)
@@ -183,7 +183,7 @@ static int scpi_hwmon_probe(struct platform_device *pdev)
 			num_power++;
 			num_power++;
 			break;
 			break;
 		default:
 		default:
-			break;
+			continue;
 		}
 		}
 
 
 		sensor->dev_attr_input.attr.mode = S_IRUGO;
 		sensor->dev_attr_input.attr.mode = S_IRUGO;
@@ -194,11 +194,12 @@ static int scpi_hwmon_probe(struct platform_device *pdev)
 		sensor->dev_attr_label.show = scpi_show_label;
 		sensor->dev_attr_label.show = scpi_show_label;
 		sensor->dev_attr_label.attr.name = sensor->label;
 		sensor->dev_attr_label.attr.name = sensor->label;
 
 
-		scpi_sensors->attrs[i << 1] = &sensor->dev_attr_input.attr;
-		scpi_sensors->attrs[(i << 1) + 1] = &sensor->dev_attr_label.attr;
+		scpi_sensors->attrs[idx << 1] = &sensor->dev_attr_input.attr;
+		scpi_sensors->attrs[(idx << 1) + 1] = &sensor->dev_attr_label.attr;
 
 
-		sysfs_attr_init(scpi_sensors->attrs[i << 1]);
-		sysfs_attr_init(scpi_sensors->attrs[(i << 1) + 1]);
+		sysfs_attr_init(scpi_sensors->attrs[idx << 1]);
+		sysfs_attr_init(scpi_sensors->attrs[(idx << 1) + 1]);
+		idx++;
 	}
 	}
 
 
 	scpi_sensors->group.attrs = scpi_sensors->attrs;
 	scpi_sensors->group.attrs = scpi_sensors->attrs;
@@ -236,8 +237,8 @@ static int scpi_hwmon_probe(struct platform_device *pdev)
 
 
 		zone->sensor_id = i;
 		zone->sensor_id = i;
 		zone->scpi_sensors = scpi_sensors;
 		zone->scpi_sensors = scpi_sensors;
-		zone->tzd = thermal_zone_of_sensor_register(dev, i, zone,
-							    &scpi_sensor_ops);
+		zone->tzd = thermal_zone_of_sensor_register(dev,
+				sensor->info.sensor_id, zone, &scpi_sensor_ops);
 		/*
 		/*
 		 * The call to thermal_zone_of_sensor_register returns
 		 * The call to thermal_zone_of_sensor_register returns
 		 * an error for sensors that are not associated with
 		 * an error for sensors that are not associated with