From patchwork Wed Dec 12 01:49:22 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marek Vasut X-Patchwork-Id: 10725479 X-Patchwork-Delegate: geert@linux-m68k.org Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 5227D1751 for ; Wed, 12 Dec 2018 01:49:53 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4386E2A0CE for ; Wed, 12 Dec 2018 01:49:53 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 37BA42A0FF; Wed, 12 Dec 2018 01:49:53 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9F4E72A0CE for ; Wed, 12 Dec 2018 01:49:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726275AbeLLBtw (ORCPT ); Tue, 11 Dec 2018 20:49:52 -0500 Received: from mail-wm1-f68.google.com ([209.85.128.68]:40203 "EHLO mail-wm1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726201AbeLLBtw (ORCPT ); Tue, 11 Dec 2018 20:49:52 -0500 Received: by mail-wm1-f68.google.com with SMTP id q26so4201451wmf.5; Tue, 11 Dec 2018 17:49:49 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=E5/XHxyZIlHBRuK6HftNxAREyZX/VMjB/BexH0nigiQ=; b=UbJ5+csHtJAThvN8iOOaEwtmu9KVltscl11pKG0AY/mMQRnKBNkQZuq1V3t3Vgm7W8 l4R+iPS/uSDBSFFgUlSWCx6SywdWMnybzw6ZOhtFlL61cRW6zsHwBOI0SpjquN5i5Ccx jNLKPvJt9jhnBP1gR22veGCZG1E35xHz7PTOTqUAdr7WG/+nScpP2P5LvVYboupeGowi 0soDipzDMIwqXKah6YwsJXIuAKRJZk1TVTM0BRzzGIvhuvr6h48NVxQEuBrXstzZf54W z+JeeNBI7PqMZYytUvhuKzXQBHGvCqyx9FPkNOHkhJjrsnkAt+NiiU6N7eevuQH349AL OqWw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=E5/XHxyZIlHBRuK6HftNxAREyZX/VMjB/BexH0nigiQ=; b=lLFFjBWZL2W/vwYTK//jf/0yH8ocEgPquE2bx6Qv5Dl58Rsgwzy5RMk4ihytTEkFW1 xu8nySLrHS6yVIS/RjRECpnoDGo5Tpm5bnoZ8LhlRU7PUOJ2fnhg21+WeekXiRnnVSxu uB4D05S9VjfLFzVfYFIfNB5h/X0LywPimJs7mPkLNyRYNokBMLOMNps1eNG2AbDwuifi zxY9F97llD2fWIFGF6DiVbTnJ5qer7ZBHXSRY3tIddPsoZulIkbWOmFseAxMEvwmJ5oF we/YQ1OnBAnwj4CPTH49x7hl3lD4NFbr+Efr7drkE6k21JpOd6C9MOhJlr5Z2QhjNYjy IzLA== X-Gm-Message-State: AA+aEWYoN2tDYN2Q+G8KbiajSnXe648870nGPAmkenYesYqj7lk6FkHD qiGwkcTf3ktgW3HoXy5M4/rMztH4 X-Google-Smtp-Source: AFSGD/X7yV3CvHLGHNPlaDBvJ/dXYZ8We0K63s9Yq6QRBx6h+Sbun/dSuUl7Rrj9gvNmyXWcK+7EVg== X-Received: by 2002:a1c:6e01:: with SMTP id j1mr4360489wmc.103.1544579388717; Tue, 11 Dec 2018 17:49:48 -0800 (PST) Received: from kurokawa.lan (ip-86-49-110-70.net.upcbroadband.cz. [86.49.110.70]) by smtp.gmail.com with ESMTPSA id v8sm12887250wrq.53.2018.12.11.17.49.47 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 11 Dec 2018 17:49:47 -0800 (PST) From: Marek Vasut X-Google-Original-From: Marek Vasut To: linux-pm@vger.kernel.org Cc: linux-renesas-soc@vger.kernel.org, Marek Vasut , Daniel Lezcano , Eduardo Valentin , Wolfram Sang , Zhang Rui Subject: [PATCH 1/6] thermal: split thermal_zone_of_sensor_register{,_param}() Date: Wed, 12 Dec 2018 02:49:22 +0100 Message-Id: <20181212014927.25840-2-marek.vasut+renesas@gmail.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20181212014927.25840-1-marek.vasut+renesas@gmail.com> References: <20181212014927.25840-1-marek.vasut+renesas@gmail.com> Sender: linux-renesas-soc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-renesas-soc@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Introduce new thermal_zone_of_sensor_register_params() function, which allows passing struct thermal_zone_params into it and convert original thermal_zone_of_sensor_register() to call it with params set to NULL. Signed-off-by: Marek Vasut Cc: Daniel Lezcano Cc: Eduardo Valentin Cc: Wolfram Sang Cc: Zhang Rui Cc: linux-renesas-soc@vger.kernel.org To: linux-pm@vger.kernel.org --- drivers/thermal/of-thermal.c | 50 +++++++++++++++++++++++++++++++++--- include/linux/thermal.h | 12 +++++++++ 2 files changed, 59 insertions(+), 3 deletions(-) diff --git a/drivers/thermal/of-thermal.c b/drivers/thermal/of-thermal.c index 4bfdb4a1e47d..eb0ef7a21035 100644 --- a/drivers/thermal/of-thermal.c +++ b/drivers/thermal/of-thermal.c @@ -446,7 +446,8 @@ thermal_zone_of_add_sensor(struct device_node *zone, } /** - * thermal_zone_of_sensor_register - registers a sensor to a DT thermal zone + * thermal_zone_of_sensor_register_params - registers a sensor to a DT thermal + * zone with thermal zone parameters * @dev: a valid struct device pointer of a sensor device. Must contain * a valid .of_node, for the sensor node. * @sensor_id: a sensor identifier, in case the sensor IP has more @@ -454,6 +455,7 @@ thermal_zone_of_add_sensor(struct device_node *zone, * @data: a private pointer (owned by the caller) that will be passed * back, when a temperature reading is needed. * @ops: struct thermal_zone_of_device_ops *. Must contain at least .get_temp. + * @tzp: thermal zone platform parameters * * This function will search the list of thermal zones described in device * tree and look for the zone that refer to the sensor device pointed by @@ -478,8 +480,9 @@ thermal_zone_of_add_sensor(struct device_node *zone, * check the return value with help of IS_ERR() helper. */ struct thermal_zone_device * -thermal_zone_of_sensor_register(struct device *dev, int sensor_id, void *data, - const struct thermal_zone_of_device_ops *ops) +thermal_zone_of_sensor_register_params(struct device *dev, int sensor_id, + void *data, const struct thermal_zone_of_device_ops *ops, + struct thermal_zone_params *tzp) { struct device_node *np, *child, *sensor_np; struct thermal_zone_device *tzd = ERR_PTR(-ENODEV); @@ -533,6 +536,47 @@ thermal_zone_of_sensor_register(struct device *dev, int sensor_id, void *data, return tzd; } + +/** + * thermal_zone_of_sensor_register - registers a sensor to a DT thermal zone + * @dev: a valid struct device pointer of a sensor device. Must contain + * a valid .of_node, for the sensor node. + * @sensor_id: a sensor identifier, in case the sensor IP has more + * than one sensors + * @data: a private pointer (owned by the caller) that will be passed + * back, when a temperature reading is needed. + * @ops: struct thermal_zone_of_device_ops *. Must contain at least .get_temp. + * + * This function will search the list of thermal zones described in device + * tree and look for the zone that refer to the sensor device pointed by + * @dev->of_node as temperature providers. For the zone pointing to the + * sensor node, the sensor will be added to the DT thermal zone device. + * + * The thermal zone temperature is provided by the @get_temp function + * pointer. When called, it will have the private pointer @data back. + * + * The thermal zone temperature trend is provided by the @get_trend function + * pointer. When called, it will have the private pointer @data back. + * + * TODO: + * 01 - This function must enqueue the new sensor instead of using + * it as the only source of temperature values. + * + * 02 - There must be a way to match the sensor with all thermal zones + * that refer to it. + * + * Return: On success returns a valid struct thermal_zone_device, + * otherwise, it returns a corresponding ERR_PTR(). Caller must + * check the return value with help of IS_ERR() helper. + */ + +struct thermal_zone_device * +thermal_zone_of_sensor_register(struct device *dev, int sensor_id, void *data, + const struct thermal_zone_of_device_ops *ops) +{ + return thermal_zone_of_sensor_register_params(dev, sensor_id, data, + ops, NULL); +} EXPORT_SYMBOL_GPL(thermal_zone_of_sensor_register); /** diff --git a/include/linux/thermal.h b/include/linux/thermal.h index 5f4705f46c2f..922034eae74b 100644 --- a/include/linux/thermal.h +++ b/include/linux/thermal.h @@ -378,6 +378,10 @@ struct thermal_trip { struct thermal_zone_device * thermal_zone_of_sensor_register(struct device *dev, int id, void *data, const struct thermal_zone_of_device_ops *ops); +struct thermal_zone_device * +thermal_zone_of_sensor_register_params(struct device *dev, int id, void *data, + const struct thermal_zone_of_device_ops *ops, + struct thermal_zone_params *tzp); void thermal_zone_of_sensor_unregister(struct device *dev, struct thermal_zone_device *tz); struct thermal_zone_device *devm_thermal_zone_of_sensor_register( @@ -393,6 +397,14 @@ thermal_zone_of_sensor_register(struct device *dev, int id, void *data, return ERR_PTR(-ENODEV); } +static inline struct thermal_zone_device * +thermal_zone_of_sensor_register_params(struct device *dev, int id, void *data, + const struct thermal_zone_of_device_ops *ops, + struct thermal_zone_params *tzp) +{ + return ERR_PTR(-ENODEV); +} + static inline void thermal_zone_of_sensor_unregister(struct device *dev, struct thermal_zone_device *tz) From patchwork Wed Dec 12 01:49:23 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marek Vasut X-Patchwork-Id: 10725481 X-Patchwork-Delegate: geert@linux-m68k.org Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 79CF018A7 for ; Wed, 12 Dec 2018 01:49:53 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6C14E2A0CE for ; Wed, 12 Dec 2018 01:49:53 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 607892A0FD; Wed, 12 Dec 2018 01:49:53 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D53EE2A0D3 for ; Wed, 12 Dec 2018 01:49:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726201AbeLLBtw (ORCPT ); Tue, 11 Dec 2018 20:49:52 -0500 Received: from mail-wr1-f67.google.com ([209.85.221.67]:41378 "EHLO mail-wr1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726272AbeLLBtw (ORCPT ); Tue, 11 Dec 2018 20:49:52 -0500 Received: by mail-wr1-f67.google.com with SMTP id x10so16007381wrs.8; Tue, 11 Dec 2018 17:49:51 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=QXLDufqRXvG7o62lPyI68QyNfPzXBGucSuLu2gNoT4w=; b=IeECvwMOnRQnQDius/py4Y4mhI2bvyDiSznOBSQzar7ORHNmu+CWyzKTXNdMkOL/96 V4RW/7vbZycUL6K61znfRtBO5tWNi45bmxyMGpdmihftsbqLvfh6l2CQvJzCsx2tUeKT LGB3oeuTvMJXZNI4DgjRtu1iJBY75gxqaO9aDEazglzgOEVRM4LRgSaCyvKKeusnaC5J bUF18mWECmNgnOV7DSE6Zx8r18AOjkLxpfAX6k/HidEr+rBumHrbz+4px8jBzYyyJsxK e3KE45cpkFtRUDns5i3Y0Js2h8AFgWomsM6etbHYdqeamZv+hmRXyywozf+9zKcMJ22l be6w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=QXLDufqRXvG7o62lPyI68QyNfPzXBGucSuLu2gNoT4w=; b=QnG+C0g2onnLpXU6LesIj8zGFlWtPhbWGgAfaGgjX5iPFyf9gZCrMl3KHfzkM1u3vk zrxzDsiiogyUdg0QjhmhXdHs3WIzDgOS/YFg2zwNWaYOePyltp/yU1du8F2EQTSgDO87 A2WDtmUNOVs8yFnFGWoS0Md8z9ZpwMCByqLZgOF5WwU79QsiKsEncv1qJJJpzyxNqVjT IpHYjVrHBXLllI8ujsWujNpLyPRUYIrQQM9BiqF+hMBIF0GWCxvI2PeY9lyZGNu5t3r2 dp0KI8Ox6Nvw7mKaymBs4Hf1zMEwXppAXr5LSbPib6yLpIF06wOnCjYjIrPzh9BZnRzW /CEg== X-Gm-Message-State: AA+aEWbM/5IRPD7VWKUjus/W7ZD1rAJjG9MieoB1Aq0Lf0RwkNV/K65g g2oRGYGyqXqP0JXbviTFZ/D8Q+eG X-Google-Smtp-Source: AFSGD/UQi0P54HiEr/l7lIFPDrS3W8b9XbXoN73np/Sh6b1PzfsGoH+aZstpbCOYI28H7nfubnBTRw== X-Received: by 2002:adf:e407:: with SMTP id g7mr14944861wrm.277.1544579390037; Tue, 11 Dec 2018 17:49:50 -0800 (PST) Received: from kurokawa.lan (ip-86-49-110-70.net.upcbroadband.cz. [86.49.110.70]) by smtp.gmail.com with ESMTPSA id v8sm12887250wrq.53.2018.12.11.17.49.48 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 11 Dec 2018 17:49:49 -0800 (PST) From: Marek Vasut X-Google-Original-From: Marek Vasut To: linux-pm@vger.kernel.org Cc: linux-renesas-soc@vger.kernel.org, Marek Vasut , Daniel Lezcano , Eduardo Valentin , Wolfram Sang , Zhang Rui Subject: [PATCH 2/6] thermal: split devm_thermal_zone_of_sensor_register{,_param}() Date: Wed, 12 Dec 2018 02:49:23 +0100 Message-Id: <20181212014927.25840-3-marek.vasut+renesas@gmail.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20181212014927.25840-1-marek.vasut+renesas@gmail.com> References: <20181212014927.25840-1-marek.vasut+renesas@gmail.com> Sender: linux-renesas-soc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-renesas-soc@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Introduce new split:devm_thermal_zone_of_sensor_register_params() function, which allows passing struct thermal_zone_params into it and convert original devm_thermal_zone_of_sensor_register() to call it with params set to NULL. Signed-off-by: Marek Vasut Cc: Daniel Lezcano Cc: Eduardo Valentin Cc: Wolfram Sang Cc: Zhang Rui Cc: linux-renesas-soc@vger.kernel.org To: linux-pm@vger.kernel.org --- drivers/thermal/of-thermal.c | 42 ++++++++++++++++++++++++++++++------ include/linux/thermal.h | 13 +++++++++++ 2 files changed, 49 insertions(+), 6 deletions(-) diff --git a/drivers/thermal/of-thermal.c b/drivers/thermal/of-thermal.c index eb0ef7a21035..901d8799587a 100644 --- a/drivers/thermal/of-thermal.c +++ b/drivers/thermal/of-thermal.c @@ -637,8 +637,8 @@ static int devm_thermal_zone_of_sensor_match(struct device *dev, void *res, } /** - * devm_thermal_zone_of_sensor_register - Resource managed version of - * thermal_zone_of_sensor_register() + * devm_thermal_zone_of_sensor_register_params - Resource managed version of + * thermal_zone_of_sensor_register_params() * @dev: a valid struct device pointer of a sensor device. Must contain * a valid .of_node, for the sensor node. * @sensor_id: a sensor identifier, in case the sensor IP has more @@ -646,8 +646,9 @@ static int devm_thermal_zone_of_sensor_match(struct device *dev, void *res, * @data: a private pointer (owned by the caller) that will be passed * back, when a temperature reading is needed. * @ops: struct thermal_zone_of_device_ops *. Must contain at least .get_temp. + * @tzp: thermal zone platform parameters * - * Refer thermal_zone_of_sensor_register() for more details. + * Refer thermal_zone_of_sensor_register_params() for more details. * * Return: On success returns a valid struct thermal_zone_device, * otherwise, it returns a corresponding ERR_PTR(). Caller must @@ -655,9 +656,10 @@ static int devm_thermal_zone_of_sensor_match(struct device *dev, void *res, * Registered thermal_zone_device device will automatically be * released when device is unbounded. */ -struct thermal_zone_device *devm_thermal_zone_of_sensor_register( +struct thermal_zone_device *devm_thermal_zone_of_sensor_register_params( struct device *dev, int sensor_id, - void *data, const struct thermal_zone_of_device_ops *ops) + void *data, const struct thermal_zone_of_device_ops *ops, + struct thermal_zone_params *tzp) { struct thermal_zone_device **ptr, *tzd; @@ -666,7 +668,8 @@ struct thermal_zone_device *devm_thermal_zone_of_sensor_register( if (!ptr) return ERR_PTR(-ENOMEM); - tzd = thermal_zone_of_sensor_register(dev, sensor_id, data, ops); + tzd = thermal_zone_of_sensor_register_params(dev, sensor_id, data, + ops, tzp); if (IS_ERR(tzd)) { devres_free(ptr); return tzd; @@ -677,6 +680,33 @@ struct thermal_zone_device *devm_thermal_zone_of_sensor_register( return tzd; } + +/** + * devm_thermal_zone_of_sensor_register - Resource managed version of + * thermal_zone_of_sensor_register() + * @dev: a valid struct device pointer of a sensor device. Must contain + * a valid .of_node, for the sensor node. + * @sensor_id: a sensor identifier, in case the sensor IP has more + * than one sensors + * @data: a private pointer (owned by the caller) that will be passed + * back, when a temperature reading is needed. + * @ops: struct thermal_zone_of_device_ops *. Must contain at least .get_temp. + * + * Refer thermal_zone_of_sensor_register() for more details. + * + * Return: On success returns a valid struct thermal_zone_device, + * otherwise, it returns a corresponding ERR_PTR(). Caller must + * check the return value with help of IS_ERR() helper. + * Registered thermal_zone_device device will automatically be + * released when device is unbounded. + */ +struct thermal_zone_device *devm_thermal_zone_of_sensor_register( + struct device *dev, int sensor_id, + void *data, const struct thermal_zone_of_device_ops *ops) +{ + return devm_thermal_zone_of_sensor_register_params(dev, sensor_id, + data, ops, NULL); +} EXPORT_SYMBOL_GPL(devm_thermal_zone_of_sensor_register); /** diff --git a/include/linux/thermal.h b/include/linux/thermal.h index 922034eae74b..a9e7bdeea1bb 100644 --- a/include/linux/thermal.h +++ b/include/linux/thermal.h @@ -387,6 +387,10 @@ void thermal_zone_of_sensor_unregister(struct device *dev, struct thermal_zone_device *devm_thermal_zone_of_sensor_register( struct device *dev, int id, void *data, const struct thermal_zone_of_device_ops *ops); +struct thermal_zone_device *devm_thermal_zone_of_sensor_register_params( + struct device *dev, int id, void *data, + const struct thermal_zone_of_device_ops *ops, + struct thermal_zone_params *tzp); void devm_thermal_zone_of_sensor_unregister(struct device *dev, struct thermal_zone_device *tz); #else @@ -418,6 +422,15 @@ static inline struct thermal_zone_device *devm_thermal_zone_of_sensor_register( return ERR_PTR(-ENODEV); } +static inline struct thermal_zone_device * + devm_thermal_zone_of_sensor_register_params( + struct device *dev, int id, void *data, + const struct thermal_zone_of_device_ops *ops, + struct thermal_zone_params *tzp) +{ + return ERR_PTR(-ENODEV); +} + static inline void devm_thermal_zone_of_sensor_unregister(struct device *dev, struct thermal_zone_device *tz) From patchwork Wed Dec 12 01:49:24 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marek Vasut X-Patchwork-Id: 10725487 X-Patchwork-Delegate: geert@linux-m68k.org Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id E08E817FE for ; Wed, 12 Dec 2018 01:49:55 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D25D82A0CE for ; Wed, 12 Dec 2018 01:49:55 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C5FA22A0FD; Wed, 12 Dec 2018 01:49:55 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 623F02A0CE for ; Wed, 12 Dec 2018 01:49:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726287AbeLLBtz (ORCPT ); Tue, 11 Dec 2018 20:49:55 -0500 Received: from mail-wm1-f68.google.com ([209.85.128.68]:51955 "EHLO mail-wm1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726272AbeLLBty (ORCPT ); Tue, 11 Dec 2018 20:49:54 -0500 Received: by mail-wm1-f68.google.com with SMTP id s14so4162401wmh.1; Tue, 11 Dec 2018 17:49:52 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=yh/87MsAyMZuM65dC4lqX/V1S2sCGEaq/hZp5hi9gQU=; b=evM8jCEr9b6lWqwqHMKxpM/X3L1L88yoNwCkG229JtuHwbdl29a3lNRm84rtpSw/bk GAGe1opqsKYg17ucDFfILUSxjFKWMlDKN2/dp9n1GaXNGI8VpqUx5IU/wafl0aLGNg8d ujQjk8faLGU63lHNBgd9X0J+SKCKycXHBbNXfYpOV8AAa1wjl/BfmIiz8yqS/tun+Ubl c6eWI4t9oB0QIc/PmpSx3NHJxdwHFPrlraej3gBxzJEs9hhSfzAxvRqNJhr/bUHK/s2X 7hJqxaIQJH8645EzOMaljVW5cd4CxWo57UznfcYUddikF+3LTQINs6zfeuRIUUPRgGUy u+xw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=yh/87MsAyMZuM65dC4lqX/V1S2sCGEaq/hZp5hi9gQU=; b=X3GAUsBgFIdQmjagxbo8CpZyN11mogLa14g3vGWoWuTX3sTHrmZsG6QqHveL1872T/ 893qejtNsJ5IuWLQa3YzcVY1WG8QsyK1ZaRH9SkltVsVsiLaIn4g17osaNKq6nprkudT g3omil/qZd8fNBODKiAh39N/9+Rxluj4/x3pHh7Q5a4g3/5MNIQM5+G7ES/l//J5RN4l ErM0gZcfTxm1Rgy4vY9b3U9+DZzxa0NhSoa1fLq60T59FrMB7auscpZyIVMxu76IUnYy EtFz71VB8w+hIBVPdNcP0QI04jyuUz86EqFgKZRNqZMP/noEEytEh/A+FAaQlKUYfa2k /yPw== X-Gm-Message-State: AA+aEWZcKLfscwM9jhIFPdGTEStFI3Iq7DOYyeoVI6UTwQwcTAPwbeR5 54qncxIDG4plP0zgJKrd9ArsmHBd X-Google-Smtp-Source: AFSGD/UB5a2Ie7pl8GzrmF/Os56KXaMXcXr9bAqFV4Ykz9flP9+kCdBqjrhezbXH73LbpjG/MVDkoQ== X-Received: by 2002:a1c:e287:: with SMTP id z129mr4371188wmg.71.1544579391365; Tue, 11 Dec 2018 17:49:51 -0800 (PST) Received: from kurokawa.lan (ip-86-49-110-70.net.upcbroadband.cz. [86.49.110.70]) by smtp.gmail.com with ESMTPSA id v8sm12887250wrq.53.2018.12.11.17.49.50 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 11 Dec 2018 17:49:50 -0800 (PST) From: Marek Vasut X-Google-Original-From: Marek Vasut To: linux-pm@vger.kernel.org Cc: linux-renesas-soc@vger.kernel.org, Marek Vasut , Daniel Lezcano , Eduardo Valentin , Wolfram Sang , Zhang Rui Subject: [PATCH 3/6] thermal: Register hwmon in thermal_zone_of_sensor_register_param() Date: Wed, 12 Dec 2018 02:49:24 +0100 Message-Id: <20181212014927.25840-4-marek.vasut+renesas@gmail.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20181212014927.25840-1-marek.vasut+renesas@gmail.com> References: <20181212014927.25840-1-marek.vasut+renesas@gmail.com> Sender: linux-renesas-soc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-renesas-soc@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Register hwmon sysfs interface in thermal_zone_of_sensor_register_param() in case thermal_zone_params->no_hwmon is set to false. This behavior is the same as thermal_zone_device_register(). Signed-off-by: Marek Vasut Cc: Daniel Lezcano Cc: Eduardo Valentin Cc: Wolfram Sang Cc: Zhang Rui Cc: linux-renesas-soc@vger.kernel.org To: linux-pm@vger.kernel.org --- drivers/thermal/of-thermal.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/drivers/thermal/of-thermal.c b/drivers/thermal/of-thermal.c index 901d8799587a..39b2f2105d0b 100644 --- a/drivers/thermal/of-thermal.c +++ b/drivers/thermal/of-thermal.c @@ -15,6 +15,7 @@ #include #include "thermal_core.h" +#include "thermal_hwmon.h" /*** Private data structures to represent thermal device tree data ***/ @@ -521,8 +522,15 @@ thermal_zone_of_sensor_register_params(struct device *dev, int sensor_id, if (sensor_specs.np == sensor_np && id == sensor_id) { tzd = thermal_zone_of_add_sensor(child, sensor_np, data, ops); - if (!IS_ERR(tzd)) + if (!IS_ERR(tzd)) { + tzd->tzp = tzp; tzd->ops->set_mode(tzd, THERMAL_DEVICE_ENABLED); + if (!tzp || !tzp->no_hwmon) { + ret = thermal_add_hwmon_sysfs(tzd); + if (ret) + tzd = ERR_PTR(ret); + } + } of_node_put(sensor_specs.np); of_node_put(child); @@ -604,6 +612,8 @@ void thermal_zone_of_sensor_unregister(struct device *dev, tz = tzd->devdata; + thermal_remove_hwmon_sysfs(tzd); + /* no __thermal_zone, nothing to be done */ if (!tz) return; From patchwork Wed Dec 12 01:49:25 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marek Vasut X-Patchwork-Id: 10725491 X-Patchwork-Delegate: geert@linux-m68k.org Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 939FE3E9D for ; Wed, 12 Dec 2018 01:49:56 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8551A2A0CE for ; Wed, 12 Dec 2018 01:49:56 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 79D432A0FD; Wed, 12 Dec 2018 01:49:56 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 162E92A0CE for ; Wed, 12 Dec 2018 01:49:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726296AbeLLBtz (ORCPT ); Tue, 11 Dec 2018 20:49:55 -0500 Received: from mail-wm1-f65.google.com ([209.85.128.65]:39236 "EHLO mail-wm1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726285AbeLLBtz (ORCPT ); Tue, 11 Dec 2018 20:49:55 -0500 Received: by mail-wm1-f65.google.com with SMTP id f81so4201030wmd.4; Tue, 11 Dec 2018 17:49:54 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=sZSxFpQkw2E4qWQFOzkloCvXbAyVW6y0ebILJ0r+z8g=; b=aCTgncSbxjqmZTz8wLUFBbD5dP9ZPZ426O0C9V4RM9R1kLEqhvXC5Xk6o1EEvUFg8i GbGoGHHyCck0vLPRZle65do36AwAGwo9hGHldCWOdeV3pgXL6iD7LTdP66oB1Mp9o6Tw VVlyWT8Qk6IUVvJW79vtfpRiOBwx+k8cUNO8CB8Pgqqp9EKqQS/dH5X7t1YTdo0FKKiR bfLtweAxbzQEoMVfIoHCB4WnJgBPelJ3j1FYAiUaDpICtaabixIzpKXrffbA69s5N8XH pw2gkUvypWOORZyXwvGKY7iI1RHD2TO1yjXTGDicIJN4fCvOJM32N4CxAWnyPqSkGDEK 3zLA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=sZSxFpQkw2E4qWQFOzkloCvXbAyVW6y0ebILJ0r+z8g=; b=N+4/cw5hptd9Ar/iw6d7etJcCGOZ59MPZWnaiAYq5HLw/7keRD5xIboIT/Gl8BThbt pfbEmuKHTBMXoXR8pil9W1tNWU9djU1bkf4T8JhaG3CbKYIFliB8ivWBmStO6ia1q/E4 cxzw+F8qpLD+OwXqVAtDVpzCin/ELvD0mNm7RyKBOhFF2z4AY/9rSnMjlOt9hswTpMNk dWUkWA7tpWsuhnCRS+t+Wg2PMnfIZoAnaox3Q48Gb+ZMt4aZApEW6KPtepeLJkx8Oo6G JpE+3RzCkGtWkHdMRjNvnCHHv8x3nj+EC8PtAy+DkWGFCX/IWKJ7QnjRUVEAb1oxRsgm dz0Q== X-Gm-Message-State: AA+aEWZci+B71hWb2Akc13IJmsXx4GTaz2iTZyMpbRlwMv+rSJnEmjTh 7m0lUUYKTXWEtSQxmY8i6xgEknIt X-Google-Smtp-Source: AFSGD/WYH7os2LmN6Q8NnJ9ECACav5knS/feiAzpE6/hEc7oNYDGo60ote6i6t58Uebh2l9qO9AcJg== X-Received: by 2002:a1c:934e:: with SMTP id v75mr4486894wmd.126.1544579393038; Tue, 11 Dec 2018 17:49:53 -0800 (PST) Received: from kurokawa.lan (ip-86-49-110-70.net.upcbroadband.cz. [86.49.110.70]) by smtp.gmail.com with ESMTPSA id v8sm12887250wrq.53.2018.12.11.17.49.51 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 11 Dec 2018 17:49:52 -0800 (PST) From: Marek Vasut X-Google-Original-From: Marek Vasut To: linux-pm@vger.kernel.org Cc: linux-renesas-soc@vger.kernel.org, Marek Vasut , Alexandre Torgue , Daniel Lezcano , David HERNANDEZ SANCHEZ , Eduardo Valentin , Maxime Coquelin , Wolfram Sang , Zhang Rui , linux-stm32@st-md-mailman.stormreply.com Subject: [PATCH 4/6] thermal: stm32: Convert to devm_thermal_zone_of_sensor_register_params() Date: Wed, 12 Dec 2018 02:49:25 +0100 Message-Id: <20181212014927.25840-5-marek.vasut+renesas@gmail.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20181212014927.25840-1-marek.vasut+renesas@gmail.com> References: <20181212014927.25840-1-marek.vasut+renesas@gmail.com> Sender: linux-renesas-soc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-renesas-soc@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Convert the stm32 code to devm_thermal_zone_of_sensor_register_params(), no functional change. Signed-off-by: Marek Vasut Cc: Alexandre Torgue Cc: Daniel Lezcano Cc: David HERNANDEZ SANCHEZ Cc: Eduardo Valentin Cc: Maxime Coquelin Cc: Wolfram Sang Cc: Zhang Rui Cc: linux-renesas-soc@vger.kernel.org Cc: linux-stm32@st-md-mailman.stormreply.com To: linux-pm@vger.kernel.org --- drivers/thermal/st/stm_thermal.c | 20 ++++++-------------- 1 file changed, 6 insertions(+), 14 deletions(-) diff --git a/drivers/thermal/st/stm_thermal.c b/drivers/thermal/st/stm_thermal.c index 47623da0f91b..ee0915dfe96a 100644 --- a/drivers/thermal/st/stm_thermal.c +++ b/drivers/thermal/st/stm_thermal.c @@ -20,7 +20,6 @@ #include #include "../thermal_core.h" -#include "../thermal_hwmon.h" /* DTS register offsets */ #define DTS_CFGR1_OFFSET 0x0 @@ -103,6 +102,10 @@ struct stm_thermal_sensor { int t0, fmt0, ramp_coeff; }; +static struct thermal_zone_params stm_tz_ops = { + .no_hwmon = false, +}; + static irqreturn_t stm_thermal_alarm_irq(int irq, void *sdata) { struct stm_thermal_sensor *sensor = sdata; @@ -652,9 +655,8 @@ static int stm_thermal_probe(struct platform_device *pdev) if (ret) return ret; - sensor->th_dev = devm_thermal_zone_of_sensor_register(&pdev->dev, 0, - sensor, - &stm_tz_ops); + sensor->th_dev = devm_thermal_zone_of_sensor_register_params(&pdev->dev, + 0, sensor, &stm_tz_ops, &stm_tz_ops); if (IS_ERR(sensor->th_dev)) { dev_err(&pdev->dev, "%s: thermal zone sensor registering KO\n", @@ -711,15 +713,6 @@ static int stm_thermal_probe(struct platform_device *pdev) goto err_tz; } - /* - * Thermal_zone doesn't enable hwmon as default, - * enable it here - */ - sensor->th_dev->tzp->no_hwmon = false; - ret = thermal_add_hwmon_sysfs(sensor->th_dev); - if (ret) - goto err_tz; - sensor->mode = THERMAL_DEVICE_ENABLED; dev_info(&pdev->dev, "%s: Driver initialized successfully\n", @@ -737,7 +730,6 @@ static int stm_thermal_remove(struct platform_device *pdev) struct stm_thermal_sensor *sensor = platform_get_drvdata(pdev); stm_thermal_sensor_off(sensor); - thermal_remove_hwmon_sysfs(sensor->th_dev); thermal_zone_of_sensor_unregister(&pdev->dev, sensor->th_dev); return 0; From patchwork Wed Dec 12 01:49:26 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marek Vasut X-Patchwork-Id: 10725495 X-Patchwork-Delegate: geert@linux-m68k.org Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 9D5A017FE for ; Wed, 12 Dec 2018 01:49:58 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8F4252A0CE for ; Wed, 12 Dec 2018 01:49:58 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 83D672A101; Wed, 12 Dec 2018 01:49:58 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0C4EC2A0CE for ; Wed, 12 Dec 2018 01:49:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726305AbeLLBt5 (ORCPT ); Tue, 11 Dec 2018 20:49:57 -0500 Received: from mail-wr1-f65.google.com ([209.85.221.65]:37093 "EHLO mail-wr1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726285AbeLLBt5 (ORCPT ); Tue, 11 Dec 2018 20:49:57 -0500 Received: by mail-wr1-f65.google.com with SMTP id j10so16031944wru.4; Tue, 11 Dec 2018 17:49:55 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=RwtxODIw1b1nCC2W4Bu2P+/BrexgHxjZyGy4vXVT3i8=; b=cRcKsKpcaDilG34rJ0t2rgOTCt+RpMvUsd17Y+SsUB2uL2EIpsZjEVaeuioJpY+3fG DYh2M3HQA+zCzM1qMNob2xFjQBL7PpzRKmVH6Z/+G02jXDRty328xvaXbE8ZX2I4C8E0 iAzNwq292Wzamn4AVeRwCpkHIpdHA2BRcwvAVb3k2oT0YkBADvnG5s0sZn3TonjJIMPC 6rMrC6usm7saRbZysJ6tBfIwLNze4eboMPpst8FYAegQJH7z0e2LnIEagk/2sLCWBfLL bjAHgUP9HBne2bSFlayIweQfBkSdvoZE+dzrn3jyrntjVpkogcrTiKFfnNanrJefNn9V a/lA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=RwtxODIw1b1nCC2W4Bu2P+/BrexgHxjZyGy4vXVT3i8=; b=cpNcqgA0yJtGMm42voXrpZ+2yuyks9PMGFVMNF0cPrTmOFq7Awydw05MluUpbRKJDP 7JVZNOKIrO3BzBHeyGNIKTrQgDt0/slH84Xo03OCVEV+SqWvEMh1dc6vbiO+8To0Al1P hxUW4HmCNo+eVUx37oGTIdV0reNmcMEDNpZrBBKfFUBOJ94k2C56TrQQAqHXYb2UbRF3 2BkOcIzdefED0ozS1Fzg4Lt1rQJvbLS1Pp6iFQQVlzsrMRdlg5xvKd9mXmRYJtm7UofD kQb3H2d4Gqf99U2ogqYzlLW9A9OZgWwiCxmUvseJ0jx/gaa7mqxVvyazOskg8StKmscy Nbrg== X-Gm-Message-State: AA+aEWb9Nlom8BlqT5o95SxE9JdwTRWaExvIypF46ent30XmJX69gdvw GCc99AI/C2TofJC8RjbGJsStq7wK X-Google-Smtp-Source: AFSGD/UaDBimHP8fNn6n3EXUri/B26xtK+9PoVDcKteoQtSILORhygtA51otyAqlc9tCezx9z0TUQg== X-Received: by 2002:adf:82a8:: with SMTP id 37mr14525290wrc.252.1544579394389; Tue, 11 Dec 2018 17:49:54 -0800 (PST) Received: from kurokawa.lan (ip-86-49-110-70.net.upcbroadband.cz. [86.49.110.70]) by smtp.gmail.com with ESMTPSA id v8sm12887250wrq.53.2018.12.11.17.49.53 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 11 Dec 2018 17:49:53 -0800 (PST) From: Marek Vasut X-Google-Original-From: Marek Vasut To: linux-pm@vger.kernel.org Cc: linux-renesas-soc@vger.kernel.org, Marek Vasut , Daniel Lezcano , Eduardo Valentin , Wolfram Sang , Zhang Rui Subject: [PATCH 5/6] thermal: rcar_thermal: Convert to devm_thermal_zone_of_sensor_register_params() Date: Wed, 12 Dec 2018 02:49:26 +0100 Message-Id: <20181212014927.25840-6-marek.vasut+renesas@gmail.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20181212014927.25840-1-marek.vasut+renesas@gmail.com> References: <20181212014927.25840-1-marek.vasut+renesas@gmail.com> Sender: linux-renesas-soc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-renesas-soc@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Convert the rcar code to devm_thermal_zone_of_sensor_register_params(), no functional change. Signed-off-by: Marek Vasut Cc: Daniel Lezcano Cc: Eduardo Valentin Cc: Wolfram Sang Cc: Zhang Rui Cc: linux-renesas-soc@vger.kernel.org To: linux-pm@vger.kernel.org --- drivers/thermal/rcar_thermal.c | 33 +++++++++++++-------------------- 1 file changed, 13 insertions(+), 20 deletions(-) diff --git a/drivers/thermal/rcar_thermal.c b/drivers/thermal/rcar_thermal.c index 8014a207d8d9..ec70c2119c77 100644 --- a/drivers/thermal/rcar_thermal.c +++ b/drivers/thermal/rcar_thermal.c @@ -19,8 +19,6 @@ #include #include -#include "thermal_hwmon.h" - #define IDLE_INTERVAL 5000 #define COMMON_STR 0x00 @@ -54,6 +52,10 @@ struct rcar_thermal_chip { unsigned int nirqs; }; +static struct thermal_zone_params rcar_thermal_params = { + .no_hwmon = false, +}; + static const struct rcar_thermal_chip rcar_thermal = { .use_of_thermal = 0, .has_filonoff = 1, @@ -458,9 +460,7 @@ static int rcar_thermal_remove(struct platform_device *pdev) rcar_thermal_for_each_priv(priv, common) { rcar_thermal_irq_disable(priv); cancel_delayed_work_sync(&priv->work); - if (priv->chip->use_of_thermal) - thermal_remove_hwmon_sysfs(priv->zone); - else + if (!priv->chip->use_of_thermal) thermal_zone_device_unregister(priv->zone); } @@ -554,16 +554,20 @@ static int rcar_thermal_probe(struct platform_device *pdev) if (ret < 0) goto error_unregister; - if (chip->use_of_thermal) - priv->zone = devm_thermal_zone_of_sensor_register( + if (chip->use_of_thermal) { + priv->zone = + devm_thermal_zone_of_sensor_register_params( dev, i, priv, - &rcar_thermal_zone_of_ops); - else + &rcar_thermal_zone_of_ops, + &rcar_thermal_params); + } else { priv->zone = thermal_zone_device_register( "rcar_thermal", 1, 0, priv, &rcar_thermal_zone_ops, NULL, 0, idle); + } + if (IS_ERR(priv->zone)) { dev_err(dev, "can't register thermal zone\n"); ret = PTR_ERR(priv->zone); @@ -571,17 +575,6 @@ static int rcar_thermal_probe(struct platform_device *pdev) goto error_unregister; } - if (chip->use_of_thermal) { - /* - * thermal_zone doesn't enable hwmon as default, - * but, enable it here to keep compatible - */ - priv->zone->tzp->no_hwmon = false; - ret = thermal_add_hwmon_sysfs(priv->zone); - if (ret) - goto error_unregister; - } - rcar_thermal_irq_enable(priv); list_move_tail(&priv->list, &common->head); From patchwork Wed Dec 12 01:49:27 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marek Vasut X-Patchwork-Id: 10725499 X-Patchwork-Delegate: geert@linux-m68k.org Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id DBE7C1751 for ; Wed, 12 Dec 2018 01:49:58 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id CC1902A0CE for ; Wed, 12 Dec 2018 01:49:58 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C06D92A0D3; Wed, 12 Dec 2018 01:49:58 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 69E7A2A0FD for ; Wed, 12 Dec 2018 01:49:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726285AbeLLBt6 (ORCPT ); Tue, 11 Dec 2018 20:49:58 -0500 Received: from mail-wr1-f67.google.com ([209.85.221.67]:32873 "EHLO mail-wr1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726298AbeLLBt6 (ORCPT ); Tue, 11 Dec 2018 20:49:58 -0500 Received: by mail-wr1-f67.google.com with SMTP id c14so16076306wrr.0; Tue, 11 Dec 2018 17:49:56 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=TNxxsz9LREn38i/Xzq2fxnYulveSptldEh/3Spdlf/U=; b=kcPYTqnCYW77BA1Fzo4OxGGsWGZGLGJq1itfK1wUsY8GgbD/LO13CmzKqdePvw6jnX gqNCdgnQ9MKyo96Hk+8DyqZZXvvrdVSgh/fhIO6JqeTvrzdx60ogzUaNZmcJUSBxiq37 hoxl4Xb/ajszb/JFv8QYLwoL31bJK5thuaIAqvuBHdCWV9CP+1atVghycqzN9vUWXgTx /TfZvJGDKA1iWkjdf0BS1PQL3criDCucR0Y8t8oD3yjHws7T+auK0fT0DhUW4BmJOwWJ aOD0iqyNc3niUu+88ryH6vpxyTQYvjvUUQt0twTbqd4g0Cc5G6fGWcWxsnZ7urKKGK+/ tTOA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=TNxxsz9LREn38i/Xzq2fxnYulveSptldEh/3Spdlf/U=; b=ODKua0IXv9k8Mntu/Mha7AKHsHxunwC5FpD73rncDS7xrPMzLEf9NJeHf++FlMIbTA 6pEQGlC9wK2E/UC+nzlMhwUfAUCTwOOx2dv/J+lGZsJ9uga66RbAfyXeSIMWC4NQxZC8 UN6NM8XxF/NRCe385pCr6UuFBSz2WPvZ0yR4oNprJlmO47bXWLQeEixRNo4xLQyZR6nl TQo6L2XlQdKC75CDL3cRAqIewHs3S5ycdQdTKHffnM+g3rv5m4+qSDe0Jz9v09FP6GSL 54dkiuu8lXIGlOwbEz9orv+nHXwNLTg1RCN4ZYK75y3UM52/teqZu43ajU/C3/arFNXi Upmg== X-Gm-Message-State: AA+aEWZ2gxJWS0sqc1xuejLB5SaSvs3N7nLWDUkRN+YxWvBzTOb+xQIt x534wCe8jaESaMXbM0mDeq4LeU0L X-Google-Smtp-Source: AFSGD/UXxjWjY/6RuRpbIY9qBdIcKC6QtMz3FX5lnOuI94Pz84ovgASpIx7q6HdDmNVeRZ0WddeY0g== X-Received: by 2002:adf:cf0f:: with SMTP id o15mr15915038wrj.253.1544579395788; Tue, 11 Dec 2018 17:49:55 -0800 (PST) Received: from kurokawa.lan (ip-86-49-110-70.net.upcbroadband.cz. [86.49.110.70]) by smtp.gmail.com with ESMTPSA id v8sm12887250wrq.53.2018.12.11.17.49.54 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 11 Dec 2018 17:49:54 -0800 (PST) From: Marek Vasut X-Google-Original-From: Marek Vasut To: linux-pm@vger.kernel.org Cc: linux-renesas-soc@vger.kernel.org, Marek Vasut , Daniel Lezcano , Eduardo Valentin , Wolfram Sang , Zhang Rui Subject: [PATCH 6/6] thermal: rcar_gen3_thermal: Register hwmon sysfs interface Date: Wed, 12 Dec 2018 02:49:27 +0100 Message-Id: <20181212014927.25840-7-marek.vasut+renesas@gmail.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20181212014927.25840-1-marek.vasut+renesas@gmail.com> References: <20181212014927.25840-1-marek.vasut+renesas@gmail.com> Sender: linux-renesas-soc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-renesas-soc@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Use devm_thermal_zone_of_sensor_register_params() with thermal zone params to enable the hwmon sysfs interface. Signed-off-by: Marek Vasut Cc: Daniel Lezcano Cc: Eduardo Valentin Cc: Wolfram Sang Cc: Zhang Rui Cc: linux-renesas-soc@vger.kernel.org To: linux-pm@vger.kernel.org --- drivers/thermal/rcar_gen3_thermal.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/drivers/thermal/rcar_gen3_thermal.c b/drivers/thermal/rcar_gen3_thermal.c index 75786cc8e2f9..d86b8e746313 100644 --- a/drivers/thermal/rcar_gen3_thermal.c +++ b/drivers/thermal/rcar_gen3_thermal.c @@ -85,6 +85,10 @@ struct rcar_gen3_thermal_priv { void (*thermal_init)(struct rcar_gen3_thermal_tsc *tsc); }; +static struct thermal_zone_params rcar_gen3_tz_of_params = { + .no_hwmon = false, +}; + static inline u32 rcar_gen3_thermal_read(struct rcar_gen3_thermal_tsc *tsc, u32 reg) { @@ -416,8 +420,8 @@ static int rcar_gen3_thermal_probe(struct platform_device *pdev) priv->thermal_init(tsc); rcar_gen3_thermal_calc_coefs(&tsc->coef, ptat, thcode[i]); - zone = devm_thermal_zone_of_sensor_register(dev, i, tsc, - &rcar_gen3_tz_of_ops); + zone = devm_thermal_zone_of_sensor_register_params(dev, i, tsc, + &rcar_gen3_tz_of_ops, &rcar_gen3_tz_of_params); if (IS_ERR(zone)) { dev_err(dev, "Can't register thermal zone\n"); ret = PTR_ERR(zone);