From patchwork Sat Dec 15 02:30:05 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marek Vasut X-Patchwork-Id: 10731977 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 1FBA81399 for ; Sat, 15 Dec 2018 02:30:27 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E27C52D1B7 for ; Sat, 15 Dec 2018 02:30:26 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D733F2D1DC; Sat, 15 Dec 2018 02:30:26 +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 48A762D1B7 for ; Sat, 15 Dec 2018 02:30:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727778AbeLOCa0 (ORCPT ); Fri, 14 Dec 2018 21:30:26 -0500 Received: from mail-wr1-f66.google.com ([209.85.221.66]:36596 "EHLO mail-wr1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726890AbeLOCaZ (ORCPT ); Fri, 14 Dec 2018 21:30:25 -0500 Received: by mail-wr1-f66.google.com with SMTP id u4so6170040wrp.3; Fri, 14 Dec 2018 18:30:24 -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=kqYHpaHX9SnIcZdI2imac77gyXJ3aSrfZwdKHTyCWK0=; b=CKIuGNncGHczD7geq3NDoOXnNoU3B76NkJ3pv7hUAhEGG02v9PeJjE9Gq5oTKM2WoO HzPWoUH8KHHucYLO6L5OQs5VZsAg7/V71+9PfwTAw0bggh/MCYsY9tc95ipZBKIamBZ3 KzTw4y7nan5t0OcK778hfR9LFOeI95km3naccC71ak2CzEvuWry91Tf/pty8lZwX+tSD MEtYmnKPOd7kqVTuyYnTbXLWW8PCncB83gYxb7HJCGidV6SONhWJk9SBfCHxfJ6V2Jwb XqsGvYNoJHZN03U5njYOb7wTC/iQolypFw+6MNvB6XIe3TWZ9DWX0h8pFpsUK2nBzCCX Oe3w== 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=kqYHpaHX9SnIcZdI2imac77gyXJ3aSrfZwdKHTyCWK0=; b=cJ3C/ipKBtgDpZyftZj7sCApZkHLLcXd1vcRNLG8vJltCzfz/EESXvAJAM403zICmY YK4fFqBGjCGMyxWZy7oPlDylWxCX4JCR5oKBdXdH9VwT5cJ7mnsELI/XuDAUx3Q3FYS5 BIF55x33+bINAcvqI6KQyv9vLMjUQbOagttggogl9WHrzcYkWzCbBKWECvcw3xBZjw/3 toz/E4M2oCY6Bx675c8CwTxHKIIBCQY1gtqCkdIPMVkGSwuPF0LSfcBuTr16HGtB8+f6 gBpblJ8YtGgx494uVkOu9O4/a9W8SYgn0NToiP2edAmrXcnUPTXt5pr70bDWDPylDSlw JAtw== X-Gm-Message-State: AA+aEWYIicYk9n9b51uJg0q2DUU/3YYwr9TuHwLVVCkzSwlOJgm0o7c1 Kck81fjJNPlmIN+LRsFXBD6Y4xoi X-Google-Smtp-Source: AFSGD/WlysQ22DwBuuhBYwMyYv+GwG+FrBIwrWL/SqlTNszhLbEH0frBLDqAVUpTfu63cCg0BWgHTw== X-Received: by 2002:adf:fb0d:: with SMTP id c13mr4658639wrr.285.1544841022929; Fri, 14 Dec 2018 18:30:22 -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 v19sm12151423wrd.46.2018.12.14.18.30.21 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 14 Dec 2018 18:30:21 -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 V2 1/6] thermal: split thermal_zone_of_sensor_register{,_param}() Date: Sat, 15 Dec 2018 03:30:05 +0100 Message-Id: <20181215023010.2857-2-marek.vasut+renesas@gmail.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20181215023010.2857-1-marek.vasut+renesas@gmail.com> References: <20181215023010.2857-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 Reviewed-by: Simon Horman --- V2: Add EXPORT_SYMBOL_GPL() to fix build as a module --- drivers/thermal/of-thermal.c | 51 +++++++++++++++++++++++++++++++++--- include/linux/thermal.h | 12 +++++++++ 2 files changed, 60 insertions(+), 3 deletions(-) diff --git a/drivers/thermal/of-thermal.c b/drivers/thermal/of-thermal.c index 4bfdb4a1e47d..1fb450d02ab5 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,48 @@ thermal_zone_of_sensor_register(struct device *dev, int sensor_id, void *data, return tzd; } +EXPORT_SYMBOL_GPL(thermal_zone_of_sensor_register_params); + +/** + * 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 Sat Dec 15 02:30:06 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marek Vasut X-Patchwork-Id: 10731981 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 77CF06C5 for ; Sat, 15 Dec 2018 02:30:28 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 488382D1B7 for ; Sat, 15 Dec 2018 02:30:28 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3CCC02D1DC; Sat, 15 Dec 2018 02:30:28 +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 AFB162D1B7 for ; Sat, 15 Dec 2018 02:30:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728184AbeLOCa1 (ORCPT ); Fri, 14 Dec 2018 21:30:27 -0500 Received: from mail-wm1-f65.google.com ([209.85.128.65]:32995 "EHLO mail-wm1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727757AbeLOCa1 (ORCPT ); Fri, 14 Dec 2018 21:30:27 -0500 Received: by mail-wm1-f65.google.com with SMTP id r24so426462wmh.0; Fri, 14 Dec 2018 18:30:25 -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=WZyz/Mi3K7VXg98ytLeGLi+HoTbZnk/9YYcnRzNRzqM=; b=SeqaQkgVT+GfRBrn/86u/qPkYTOnRya4hMgrZvWbiPkuwUL1DqPvKhDfSVM/lUH1ZC RjlkhgCp7cXsdQXD5UXVYL2y55AhVnQovHTFDiTaH2zaDRTXT2RciExSc1F41YFbeoDR VJcO55VpVgBi8cnoOic1niSm36ECaqjN8iUbvMt5W1cbULF0oCwC/YlbBOEuJ2pZVxo6 fv0/z+TmeWJkLci0zOEuTtUtpncukYKcb3NAw06SNT8W9dwVGmMB9Xh1PqCkTNWEzOwk 78np4RLRdw2H/4RvcnVGPEK7uDTY5sLMRlW+0mbSxIymqAM4iAiYlkWKHqUFuMcuQ8xg sH/Q== 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=WZyz/Mi3K7VXg98ytLeGLi+HoTbZnk/9YYcnRzNRzqM=; b=J8BIxXJ5sHwtMDNNoSq7V1prDN82sDY5Y5vmkLhGGhHStIVUVxZA6ZiJDD5ZrBmpgD yS8/s0Bj0yPch0Gu9MqthIj8dIBf7Nve+MWCpJ+f8hobhklbvZoNPyd9/MT2rtAw3jUn TnprTWPM/KT/gGu4MJ2eDT2mS/qzKb+AI5yS47YQYtoNi5JtwGiTv73BfXw0pKLokQFy yad0ohS5MOcPc8YQqALs8I9fa8nsDHKaxVsTcAqY5dR/ZiQJfzo62GTAbPLdyDcbQyun f/gAmr6eGOzjovnyo5qoThMlKDEAwtfyTS5o+p2dSQ0ofnuo7ElYEpgXkWSlAMXxVPiq 7svw== X-Gm-Message-State: AA+aEWY3B7ot4GF4SVXHJ1GeGEU9liFiq7g6WZeo3+brz9bI4rvamqXT p1pVZ7I10ZdChxQlm5lKiyojTxnq X-Google-Smtp-Source: AFSGD/UeKmpp/JARjm++v/3Jz5kRtoPfyAufshn+imHg8jL8/p8Uqz/D197wPA7GWlr9SAEe7tLz/g== X-Received: by 2002:a1c:d988:: with SMTP id q130mr5139612wmg.41.1544841024280; Fri, 14 Dec 2018 18:30:24 -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 v19sm12151423wrd.46.2018.12.14.18.30.22 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 14 Dec 2018 18:30:23 -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 V2 2/6] thermal: split devm_thermal_zone_of_sensor_register{,_param}() Date: Sat, 15 Dec 2018 03:30:06 +0100 Message-Id: <20181215023010.2857-3-marek.vasut+renesas@gmail.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20181215023010.2857-1-marek.vasut+renesas@gmail.com> References: <20181215023010.2857-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 Reviewed-by: Simon Horman --- V2: Add EXPORT_SYMBOL_GPL() to fix build as a module --- drivers/thermal/of-thermal.c | 43 +++++++++++++++++++++++++++++++----- include/linux/thermal.h | 13 +++++++++++ 2 files changed, 50 insertions(+), 6 deletions(-) diff --git a/drivers/thermal/of-thermal.c b/drivers/thermal/of-thermal.c index 1fb450d02ab5..e1a303a5698c 100644 --- a/drivers/thermal/of-thermal.c +++ b/drivers/thermal/of-thermal.c @@ -638,8 +638,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 @@ -647,8 +647,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 @@ -656,9 +657,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; @@ -667,7 +669,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; @@ -678,6 +681,34 @@ struct thermal_zone_device *devm_thermal_zone_of_sensor_register( return tzd; } +EXPORT_SYMBOL_GPL(devm_thermal_zone_of_sensor_register_params); + +/** + * 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 Sat Dec 15 02:30:07 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marek Vasut X-Patchwork-Id: 10731985 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 1A10C158E for ; Sat, 15 Dec 2018 02:30:29 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id DF04A2D1D3 for ; Sat, 15 Dec 2018 02:30:28 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D36A82D1DC; Sat, 15 Dec 2018 02:30:28 +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 589D32D1D9 for ; Sat, 15 Dec 2018 02:30:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726609AbeLOCa2 (ORCPT ); Fri, 14 Dec 2018 21:30:28 -0500 Received: from mail-wm1-f67.google.com ([209.85.128.67]:53393 "EHLO mail-wm1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726890AbeLOCa1 (ORCPT ); Fri, 14 Dec 2018 21:30:27 -0500 Received: by mail-wm1-f67.google.com with SMTP id y1so7304899wmi.3; Fri, 14 Dec 2018 18:30:26 -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=c/SOfhnXTHNzrhCwcwT2EGj15Au3UhYZoE6SZGEvqrQ=; b=qrElCr9ioJBIDbg/abQ1mT9wHA3yuXYLn9j/WyU/7rdBxHkdP83dv8Tkv19rfWalAL 5FO4hDlIcVxUP3xPIdORjUGkgHW8CnT5V0L6LAFO+znUDjTi1QBgHbWYSJ86yNl+JogU 994HLO5odiTdPZwZRoOacSi63V8hQWBUkYmfGSWOKIjQ9t9kwYeoI6ocfGZh0J48Lvhd pkymIf+mjxQKHrGVQfwKdB/5LpW5f6hitSnaMPfaoq8vKgaVNvc8RJUhmmiUrojf2PHL R+bjTqy9TduM+/qd7ayYb7CxYtY3tX1aJsaex40yWtewZc14kgIpsK6laCkJRvLRMZHR isrQ== 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=c/SOfhnXTHNzrhCwcwT2EGj15Au3UhYZoE6SZGEvqrQ=; b=Ao+VcnctsmHEhmLMuiMvwSXGBLFGrn6oR6C+ANez/JzKXb9sR5WyuFmqLILQNI9kye Ir4E+GSFjl9dn/QYO9iwxEGQsWbooLtdRidKcksJ+D7CCoNm6awRq3Z+J/Zg7Epgxx76 9gEZPdv+HpsJYlEHk8KTIM0fXAlsazI6o3kTLrOKtQLYp4PZx7a35FBhqSvr30TaEd11 jeACnMEOjIkEFtP6+lDJePdM8ukxPpX2E8wNoKW39jXI8Q8PXNJ5f3EJgIZ5fHDojVlL ojyPsRkPxBAuM6wLloQrhD193FxB5VtJxQyIM2yjzoYFizP3Mfwj8YfjbmlfRT1t2S3F I9Og== X-Gm-Message-State: AA+aEWb0GLOd9qvxAOyDajwa+rtCZfpLqxrsfZSE7jkZSfUFJabeeOaB kXb5J1ZjQAQiOfgnTH1p4A35zZb9 X-Google-Smtp-Source: AFSGD/Wxkv1KrrB42XoM1LrTv+LmOhEdEoHjTxfhSdhf7Ai1KHnmbplR/o/nZder09bO4Rfhl9pKfQ== X-Received: by 2002:a1c:dc02:: with SMTP id t2mr4832917wmg.78.1544841025581; Fri, 14 Dec 2018 18:30:25 -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 v19sm12151423wrd.46.2018.12.14.18.30.24 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 14 Dec 2018 18:30:24 -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 V2 3/6] thermal: Register hwmon in thermal_zone_of_sensor_register_param() Date: Sat, 15 Dec 2018 03:30:07 +0100 Message-Id: <20181215023010.2857-4-marek.vasut+renesas@gmail.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20181215023010.2857-1-marek.vasut+renesas@gmail.com> References: <20181215023010.2857-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 Reviewed-by: Simon Horman --- V2: No change --- 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 e1a303a5698c..5ccff7b678de 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); @@ -605,6 +613,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 Sat Dec 15 02:30:08 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marek Vasut X-Patchwork-Id: 10731989 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 3D03C6C5 for ; Sat, 15 Dec 2018 02:30:31 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0D5072D1B7 for ; Sat, 15 Dec 2018 02:30:31 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 018D92D1DC; Sat, 15 Dec 2018 02:30:30 +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 755162D1B7 for ; Sat, 15 Dec 2018 02:30:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728552AbeLOCaa (ORCPT ); Fri, 14 Dec 2018 21:30:30 -0500 Received: from mail-wr1-f65.google.com ([209.85.221.65]:34352 "EHLO mail-wr1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726890AbeLOCaa (ORCPT ); Fri, 14 Dec 2018 21:30:30 -0500 Received: by mail-wr1-f65.google.com with SMTP id j2so7164652wrw.1; Fri, 14 Dec 2018 18:30:28 -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=Qj2+h8G03LIN+7xOpir1PaBR4t8vEWcRFLgdzSWTPss=; b=loQn1WLYAmkd3WPJ6PFQz1Gk+gPcoFi/GbkeZk2MBNLmcxZoc4MV2AmuVTG3JfLtw4 Cm1BGy9o5Lxp3NN3Fdo+riC68oGlqq1o0U9e8WGqiLGZ0pbCAVsoMe6oyUmqKyfDZnCB dsfsiMvnEbVgbkrLvOcqZcNlmNjv/HVEarBMjqmgV7ctc4aXTm8FkHO+QeHxvmZGCzrr rfaVM1hIUyDZLeXASUesnkkW/2UMVPStRBE5i45oBSADqQHMd5qjcRQtsBCYnXoaa+bH bXIbAS1aPctO0V5bTyIxY2g3gOAOfBsFb4nME2u4z7h95cbG2zjTqIayyzKAMIy/1+1I tRVA== 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=Qj2+h8G03LIN+7xOpir1PaBR4t8vEWcRFLgdzSWTPss=; b=hS9bHWtQtiRcB6gJ96F0UyFnlaKJPTBYj0JI8r7b8M9gs1hPL6GIY1bcQrjUq7NYII bkDp2noixZ054Qf039nwVQojbzA/jRaBkhJBAnEMRk4vAA81ljmlZphknqSFdwn82z03 cRBG2J+VFDQporDTjIzlioseIsLa6Rh5lHPdArZqtrdu6mPZCr+26NvJADS17K309I6z XTli3fOFLkxS5OAog2Lfya/02YExiWWyl1V7ldWYlFz3Ck816sFzFzhi7SzFqKioIrJK CpS6i2eZHPpW/AHo0C8C3l/upKYrq/Ges6o8SNV4aDo2ZBICGeoWFc5AesWAknXsSjej NK3w== X-Gm-Message-State: AA+aEWZUGOw2D188q3sKOizg63hFq47VIz3Jols77pGOtV6PTlD8HIgd jaPU2g2qjBGpjDjpjgNXKhbKrgm7 X-Google-Smtp-Source: AFSGD/VtxH3ZmanZ01crNLsBX4vFt/1Qw7NNKVfn0/3b1/bt6N/41xgcFRtgMsTKR3+0pAkRiL2puQ== X-Received: by 2002:adf:f504:: with SMTP id q4mr4484350wro.321.1544841027374; Fri, 14 Dec 2018 18:30:27 -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 v19sm12151423wrd.46.2018.12.14.18.30.25 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 14 Dec 2018 18:30:26 -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 V2 4/6] thermal: stm32: Convert to devm_thermal_zone_of_sensor_register_params() Date: Sat, 15 Dec 2018 03:30:08 +0100 Message-Id: <20181215023010.2857-5-marek.vasut+renesas@gmail.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20181215023010.2857-1-marek.vasut+renesas@gmail.com> References: <20181215023010.2857-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 Reviewed-by: Simon Horman --- V2: Rename stm_tz_ops to stm_tz_parms to avoid duplicate symbol name --- 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..827565d94c20 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_parms = { + .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_parms); 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 Sat Dec 15 02:30:09 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marek Vasut X-Patchwork-Id: 10731993 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 E66636C5 for ; Sat, 15 Dec 2018 02:30:31 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B69FA2D1B7 for ; Sat, 15 Dec 2018 02:30:31 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id AAE2F2D1DC; Sat, 15 Dec 2018 02:30:31 +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 44F642D1B7 for ; Sat, 15 Dec 2018 02:30:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728675AbeLOCab (ORCPT ); Fri, 14 Dec 2018 21:30:31 -0500 Received: from mail-wm1-f65.google.com ([209.85.128.65]:37759 "EHLO mail-wm1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728260AbeLOCaa (ORCPT ); Fri, 14 Dec 2018 21:30:30 -0500 Received: by mail-wm1-f65.google.com with SMTP id g67so7496646wmd.2; Fri, 14 Dec 2018 18:30:29 -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=mBLnsG24NLVnQZgnf1qFAA0DRrofVID098FjM7rJwVs=; b=oTW9cjRWOi5OwR3PQ+Z/ijeugszAcfc/TvdhOroehZ850zRd6WxjRZEst3y0RcT0NK pxzs6AgI3TzMy7Ffdjzlfbv5C8hzs3vXHnrW1wpcd1uXNrBySkWgsEGcayljsKjE/K+l b1cCMUzuuZXvaPaAGTJgftkW9tPyaWd6SOCzTtHq0WQ1LIlAYuAlHyyynUhvz+q/VaDr cjDhrJO7jrcLF4bMQgPzfX40PVj9VO46GeMdnw6pubm33jVjBRFFDpWGFRA6kOCtVCSS sxAB3tGHuwQuotaTwfm7ITnNl/6YdDjm3DKCybpQSXJoIhX9zTdDgXlIPutxwHA3+TtO JGHg== 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=mBLnsG24NLVnQZgnf1qFAA0DRrofVID098FjM7rJwVs=; b=cXqRQ6ArUWIq3FAzNR3yJgp/p0zDvQaA5ltq1bv10TpW+6tX8ceWe9cN4bHwjPHRXT i0FNduxmkrgj3YbipJLDzLiRsqs+DI1Oyb5TW6bSLXu3sd34KmZ02eql30YpmxHDelWZ i5hO2WnXuWq5JWogULxsbqNLbhjS6y85+VTYP0h/5C3i0/0HHnrmSrOou/H/53G9Sls2 59j6nS24vXRRTzZj4DunUfWCMbewiXeSdIoSHXgIlOxmRNO/qQvWjENgivtu/UWUCUf+ fLHxW8WRkyvkvhVSixP2hP+AtUWBssG7ehGXUZmX6GGBKPmvBOaOZ52YMl4l005cKHB/ nfiw== X-Gm-Message-State: AA+aEWaf02YPPNiWP9K3oOssj5qqx6V1Wb91r68rBBwJm5PYNIE30JPN 8S64YF8sD+djDbnzeYw33ZiezWrl X-Google-Smtp-Source: AFSGD/WkPLpuR2u09XHBK1rJWZpnGQJDFA7guI3IAyLudkj2oOniVVtXKyTYuYaIbJmK73wNSsn6ag== X-Received: by 2002:a1c:8302:: with SMTP id f2mr5257840wmd.9.1544841028596; Fri, 14 Dec 2018 18:30:28 -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 v19sm12151423wrd.46.2018.12.14.18.30.27 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 14 Dec 2018 18:30:27 -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 V2 5/6] thermal: rcar_thermal: Convert to devm_thermal_zone_of_sensor_register_params() Date: Sat, 15 Dec 2018 03:30:09 +0100 Message-Id: <20181215023010.2857-6-marek.vasut+renesas@gmail.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20181215023010.2857-1-marek.vasut+renesas@gmail.com> References: <20181215023010.2857-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 Reviewed-by: Simon Horman --- V2: No change --- 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 Sat Dec 15 02:30:10 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marek Vasut X-Patchwork-Id: 10731997 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 4BAE91399 for ; Sat, 15 Dec 2018 02:30:33 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1C7D32D1B7 for ; Sat, 15 Dec 2018 02:30:33 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 110B62D1DC; Sat, 15 Dec 2018 02:30:33 +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 B261C2D1B7 for ; Sat, 15 Dec 2018 02:30:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728881AbeLOCac (ORCPT ); Fri, 14 Dec 2018 21:30:32 -0500 Received: from mail-wr1-f68.google.com ([209.85.221.68]:38489 "EHLO mail-wr1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728260AbeLOCac (ORCPT ); Fri, 14 Dec 2018 21:30:32 -0500 Received: by mail-wr1-f68.google.com with SMTP id v13so7144140wrw.5; Fri, 14 Dec 2018 18:30:31 -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=aQbx7jHeLdrZi77zfUAhpDLl6y52o114PGIMmWCV/yo=; b=pZE66pnQKjYaoMQge0sJcI8iqm3PNXhf0/SMyVnzykqg0WlhGOCsXvIAwIHs0OsC8L Us7JPIv2Ek6PedhX00sKO+9orxCJNyEpCBQ1NJCsrrd0uQUGXw6FtyI9fwuGvJRzeZvy 8x+JnfJzKH/NumRsyLIH+cjuuUHbxH+4q2jnyR72f0tMX74PBw1iEPli9erqiHlTX9VA Bq+8INV76tRFl+rrR3CBMb3SGY0hnxzZURffXr5c4rLQsm8Bf8y7HZLNytgdF96joQ7d YU36pGa5YjvvqKSHhcPwvaSXsQkYZ5y9/1mrwEm+xHIhc9XKneLvMKT9jXfBwhMcOtcr ck/g== 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=aQbx7jHeLdrZi77zfUAhpDLl6y52o114PGIMmWCV/yo=; b=oFeZA2KqqHXRsFQsDsQ1+X2GkNtfL14GlGmlFhirEI7P6X9+J7I9a7/ZZbpCwdfRbZ X1ihCtqYS6MOSWNGug+UFKkfb6BL8tdIurA4e07gPvko4NvyAbQv0toI/o2Wb4g1OjI4 9kcajG5wYsNoASjB+MNu1TdVTGjhEmUpKqI9T+5kzNabJxmbyLg3PCBgYGaeCxSU1t2f EydeHdG8bASfqvwxrHQ3Iz7moEopdNZsORLX+KhBGmgXSZbgW1VKSYxisGSEAW+wubl3 qd1VZM+J1ArvIIzfVa+jAoKwGLMLrRCvdQBFwO193TmpKweJ1WC/A93mGhSXJyMFoDg6 yGZA== X-Gm-Message-State: AA+aEWbxQ8Xx1uHKNrEUA+jUlgal60+UesoKvZ7faGFZw6LswaHHlwpb cKTu3Z4FVmrQHUqElU+1lZqtrzUR X-Google-Smtp-Source: AFSGD/XDNQld1kOOKU4oIR6Trq0tliJSALupfczSMddJkfU7C31kPqMXO0eYN9+/uVIeF1UJDMDjgw== X-Received: by 2002:adf:ecc8:: with SMTP id s8mr4186550wro.208.1544841030075; Fri, 14 Dec 2018 18:30:30 -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 v19sm12151423wrd.46.2018.12.14.18.30.28 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 14 Dec 2018 18:30:29 -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 V2 6/6] thermal: rcar_gen3_thermal: Register hwmon sysfs interface Date: Sat, 15 Dec 2018 03:30:10 +0100 Message-Id: <20181215023010.2857-7-marek.vasut+renesas@gmail.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20181215023010.2857-1-marek.vasut+renesas@gmail.com> References: <20181215023010.2857-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 Reviewed-by: Simon Horman --- V2: No change --- 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);