[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAHLCerNYO+srv4codxKqbOgtaUBr3WKV460jpry-Ppn1mf0Nug@mail.gmail.com>
Date: Wed, 31 Oct 2018 18:10:00 +0530
From: Amit Kucheria <amit.kucheria@...aro.org>
To: Bartlomiej Zolnierkiewicz <b.zolnierkie@...sung.com>
Cc: Zhang Rui <rui.zhang@...el.com>,
Eduardo Valentin <edubezval@...il.com>,
Eric Anholt <eric@...olt.net>,
Stefan Wahren <stefan.wahren@...e.com>,
Markus Mayer <mmayer@...adcom.com>,
bcm-kernel-feedback-list@...adcom.com,
Heiko Stuebner <heiko@...ech.de>,
Thierry Reding <thierry.reding@...il.com>,
Jonathan Hunter <jonathanh@...dia.com>,
Keerthy <j-keerthy@...com>,
Masahiro Yamada <yamada.masahiro@...ionext.com>,
Jun Nie <jun.nie@...aro.org>,
Baoyou Xie <baoyou.xie@...aro.org>,
Shawn Guo <shawnguo@...nel.org>,
Linux PM list <linux-pm@...r.kernel.org>,
LKML <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH v2 04/17] thermal: separate sensor registration and
enable+check operations
<snip>
> --- a/drivers/hwmon/hwmon.c
> +++ b/drivers/hwmon/hwmon.c
> @@ -161,6 +161,11 @@ static int hwmon_thermal_add_sensor(struct device *dev,
> if (IS_ERR(tzd) && (PTR_ERR(tzd) != -ENODEV))
> return PTR_ERR(tzd);
>
> + if (!IS_ERR(tzd)) {
> + thermal_zone_set_mode(tzd, THERMAL_DEVICE_ENABLED);
> + thermal_zone_device_check(tzd);
> + }
> +
> return 0;
> }
> #else
> diff --git a/drivers/hwmon/ntc_thermistor.c b/drivers/hwmon/ntc_thermistor.c
> index c52d07c..d423b0f 100644
> --- a/drivers/hwmon/ntc_thermistor.c
> +++ b/drivers/hwmon/ntc_thermistor.c
> @@ -647,6 +647,10 @@ static int ntc_thermistor_probe(struct platform_device *pdev)
> &ntc_of_thermal_ops);
> if (IS_ERR(tz))
> dev_dbg(dev, "Failed to register to thermal fw.\n");
> + else {
> + thermal_zone_set_mode(tz, THERMAL_DEVICE_ENABLED);
> + thermal_zone_device_check(tz);
> + }
Use the negative check here as above to get rid of the 'else' statement?
> return 0;
> }
> diff --git a/drivers/hwmon/scpi-hwmon.c b/drivers/hwmon/scpi-hwmon.c
> index 111d521..ad5c5d7 100644
> --- a/drivers/hwmon/scpi-hwmon.c
> +++ b/drivers/hwmon/scpi-hwmon.c
> @@ -288,6 +288,10 @@ static int scpi_hwmon_probe(struct platform_device *pdev)
> */
> if (IS_ERR(z))
> devm_kfree(dev, zone);
> + else {
> + thermal_zone_set_mode(z, THERMAL_DEVICE_ENABLED);
> + thermal_zone_device_check(z);
> + }
Use the negative check here (!IS_ERR(z)) as above to get rid of the
'else' statement? The memory is allocated through devm_kzalloc so it
doesn't need to be explicitly freed.
> }
>
> return 0;
> diff --git a/drivers/iio/adc/sun4i-gpadc-iio.c b/drivers/iio/adc/sun4i-gpadc-iio.c
> index 04d7147..ff67f72 100644
> --- a/drivers/iio/adc/sun4i-gpadc-iio.c
> +++ b/drivers/iio/adc/sun4i-gpadc-iio.c
> @@ -659,6 +659,11 @@ static int sun4i_gpadc_probe(struct platform_device *pdev)
> PTR_ERR(info->tzd));
> return PTR_ERR(info->tzd);
> }
> + if (!IS_ERR(info->tzd)) {
> + thermal_zone_set_mode(info->tzd,
> + THERMAL_DEVICE_ENABLED);
> + thermal_zone_device_check(info->tzd);
> + }
> }
Powered by blists - more mailing lists