public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Daniel Lezcano <daniel.lezcano@linaro.org>
To: rui.zhang@intel.com, edubezval@gmail.com
Cc: linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org,
	Jean Delvare <jdelvare@suse.com>,
	Guenter Roeck <linux@roeck-us.net>,
	linux-hwmon@vger.kernel.org (open list:HARDWARE MONITORING)
Subject: [PATCH 7/7] hwmon/drivers/core: Simplify complex dependency
Date: Tue,  2 Apr 2019 18:12:50 +0200	[thread overview]
Message-ID: <20190402161256.11044-7-daniel.lezcano@linaro.org> (raw)
In-Reply-To: <20190402161256.11044-1-daniel.lezcano@linaro.org>

As the thermal framework does not longer compile as a module, we can
simplify this condition below:

 if IS_REACHABLE(CONFIG_THERMAL) && defined(CONFIG_THERMAL_OF) && \
       (!defined(CONFIG_THERMAL_HWMON) || \
        !(defined(MODULE) && IS_MODULE(CONFIG_THERMAL)))

 if IS_REACHABLE(CONFIG_THERMAL) && defined(CONFIG_THERMAL_OF) && \
       (!defined(CONFIG_THERMAL_HWMON) || \
        !(defined(MODULE) && 0))

=> (whatever && 0) = 0

 if IS_REACHABLE(CONFIG_THERMAL) && defined(CONFIG_THERMAL_OF) && \
       (!defined(CONFIG_THERMAL_HWMON) || !(0))

 if IS_REACHABLE(CONFIG_THERMAL) && defined(CONFIG_THERMAL_OF) && \
       (!defined(CONFIG_THERMAL_HWMON) || 1)

=> (whatever || 1) = 1

 if IS_REACHABLE(CONFIG_THERMAL) && defined(CONFIG_THERMAL_OF) && \
       (1)

=> (whatever && 1) = whatever

 if IS_REACHABLE(CONFIG_THERMAL) && defined(CONFIG_THERMAL_OF)

CONFIG_THERMAL can not be a module anymore, then:

 if defined(CONFIG_THERMAL) && defined(CONFIG_THERMAL_OF)

And CONFIG_THERMAL_OF already depends on CONFIG_THERMAL, so:

 if defined(CONFIG_THERMAL_OF)

Thus,

 ifdef CONFIG_THERMAL_OF

Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
---
 drivers/hwmon/hwmon.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/hwmon/hwmon.c b/drivers/hwmon/hwmon.c
index c22dc1e07911..6f76f2484db0 100644
--- a/drivers/hwmon/hwmon.c
+++ b/drivers/hwmon/hwmon.c
@@ -118,9 +118,7 @@ static DEFINE_IDA(hwmon_ida);
  * The complex conditional is necessary to avoid a cyclic dependency
  * between hwmon and thermal_sys modules.
  */
-#if IS_REACHABLE(CONFIG_THERMAL) && defined(CONFIG_THERMAL_OF) && \
-	(!defined(CONFIG_THERMAL_HWMON) || \
-	 !(defined(MODULE) && IS_MODULE(CONFIG_THERMAL)))
+#ifdef CONFIG_THERMAL_OF
 static int hwmon_thermal_get_temp(void *data, int *temp)
 {
 	struct hwmon_thermal_data *tdata = data;
-- 
2.17.1


  parent reply	other threads:[~2019-04-02 16:14 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-04-02 16:12 [PATCH 1/7] thermal/drivers/core: Remove the module Kconfig's option Daniel Lezcano
2019-04-02 16:12 ` [PATCH 2/7] thermal/drivers/core: Remove module unload code Daniel Lezcano
2019-04-02 16:12 ` [PATCH 3/7] thermal/drivers/core: Add init section table for self-encapsulation Daniel Lezcano
2019-04-22  8:43   ` Zhang Rui
2019-04-22 12:11     ` Daniel Lezcano
2019-04-23  5:59       ` Zhang Rui
2019-04-28 23:23         ` Daniel Lezcano
2019-04-30 13:25           ` Arnd Bergmann
2019-05-03 20:28         ` Daniel Lezcano
2019-05-06 12:44           ` Zhang Rui
2019-04-02 16:12 ` [PATCH 4/7] thermal/drivers/core: Use governor table to initialize Daniel Lezcano
2019-04-23 10:33   ` Amit Kucheria
2019-04-02 16:12 ` [PATCH 5/7] thermal/drivers/core: Remove depends on THERMAL in Kconfig Daniel Lezcano
2019-04-02 18:51   ` Amit Kucheria
2019-04-03  3:32     ` Daniel Lezcano
2019-04-23 10:35       ` Amit Kucheria
2019-04-02 16:12 ` [PATCH 6/7] thermal/drivers/core: Fix typo in the option name Daniel Lezcano
2019-04-02 16:12 ` Daniel Lezcano [this message]
2019-04-02 18:23   ` [PATCH 7/7] hwmon/drivers/core: Simplify complex dependency Guenter Roeck
2019-04-03 22:55 ` [PATCH 1/7] thermal/drivers/core: Remove the module Kconfig's option Paul Burton
2019-04-04 20:40 ` Robert Jarzmik
2019-04-23 15:52 ` Eduardo Valentin
2019-04-24  5:45   ` Amit Kucheria
2019-04-24 13:02   ` Zhang Rui

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190402161256.11044-7-daniel.lezcano@linaro.org \
    --to=daniel.lezcano@linaro.org \
    --cc=edubezval@gmail.com \
    --cc=jdelvare@suse.com \
    --cc=linux-hwmon@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=linux@roeck-us.net \
    --cc=rui.zhang@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox