acpi_power_meter: drop meter_rw_attrs, use common meter_attrs
We always register these two together, so move meter_rw_attrs into meter_ro_attrs and use the same for both since we no longer have two register_attr paths. Signed-off-by: Kyle McMartin <kyle@redhat.com> Signed-off-by: Guenter Roeck <guenter.roeck@ericsson.com>
This commit is contained in:
parent
f49d6a7ed2
commit
9fe789f88a
|
@ -477,16 +477,12 @@ static ssize_t show_name(struct device *dev,
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Sensor descriptions. If you add a sensor, update NUM_SENSORS above! */
|
/* Sensor descriptions. If you add a sensor, update NUM_SENSORS above! */
|
||||||
static struct sensor_template meter_ro_attrs[] = {
|
static struct sensor_template meter_attrs[] = {
|
||||||
RO_SENSOR_TEMPLATE(POWER_AVERAGE_NAME, show_power, 0),
|
RO_SENSOR_TEMPLATE(POWER_AVERAGE_NAME, show_power, 0),
|
||||||
RO_SENSOR_TEMPLATE("power1_accuracy", show_accuracy, 0),
|
RO_SENSOR_TEMPLATE("power1_accuracy", show_accuracy, 0),
|
||||||
RO_SENSOR_TEMPLATE("power1_average_interval_min", show_val, 0),
|
RO_SENSOR_TEMPLATE("power1_average_interval_min", show_val, 0),
|
||||||
RO_SENSOR_TEMPLATE("power1_average_interval_max", show_val, 1),
|
RO_SENSOR_TEMPLATE("power1_average_interval_max", show_val, 1),
|
||||||
RO_SENSOR_TEMPLATE("power1_is_battery", show_val, 5),
|
RO_SENSOR_TEMPLATE("power1_is_battery", show_val, 5),
|
||||||
{},
|
|
||||||
};
|
|
||||||
|
|
||||||
static struct sensor_template meter_rw_attrs[] = {
|
|
||||||
RW_SENSOR_TEMPLATE(POWER_AVG_INTERVAL_NAME, show_avg_interval,
|
RW_SENSOR_TEMPLATE(POWER_AVG_INTERVAL_NAME, show_avg_interval,
|
||||||
set_avg_interval, 0),
|
set_avg_interval, 0),
|
||||||
{},
|
{},
|
||||||
|
@ -689,10 +685,7 @@ static int setup_attrs(struct acpi_power_meter_resource *resource)
|
||||||
return res;
|
return res;
|
||||||
|
|
||||||
if (resource->caps.flags & POWER_METER_CAN_MEASURE) {
|
if (resource->caps.flags & POWER_METER_CAN_MEASURE) {
|
||||||
res = register_attrs(resource, meter_ro_attrs);
|
res = register_attrs(resource, meter_attrs);
|
||||||
if (res)
|
|
||||||
goto error;
|
|
||||||
res = register_attrs(resource, meter_rw_attrs);
|
|
||||||
if (res)
|
if (res)
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue