From patchwork Sun Feb 26 22:53:47 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Lezcano X-Patchwork-Id: 61669 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp2130942wrd; Sun, 26 Feb 2023 14:55:37 -0800 (PST) X-Google-Smtp-Source: AK7set9T/Ku1tLrKQA26l9TWL+DAmWppRkZ/pwLxUq7e3nt2enfbEqRL1RW9HhtxfXQFuL1gQ/1M X-Received: by 2002:aa7:83cc:0:b0:5db:aa2d:9ea0 with SMTP id j12-20020aa783cc000000b005dbaa2d9ea0mr11996542pfn.2.1677452137064; Sun, 26 Feb 2023 14:55:37 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1677452137; cv=none; d=google.com; s=arc-20160816; b=GRzpob5ZJJ4TOd9l0M8NIhVjO+zgCEcByqkVdjuH9HubvHzFUESc/4IxLgONIB9f7Q dIE0A4mRtehHAWuvv+q0xHVdtSNwX5LUDiF6MtzcA83y2vOCKIZEses0RQgFrI1jjvqt 7DLUiM5DSpK2V+3BC22+k00iD4qTzUqZPdYoi7cAVLeUtK3ZIJBVt8W3Tf7yC9LiZhF3 rBv+P3DHWKAnW4CTGqoAfOrQLfDg3ytFIE576J+T41oeAUybbWLpeBi3sVi7utVmEIne tmjUEobrQ1OYbmm/OYWGkol8B1DRX7v4KZ0zV9vbV9FwldGNahJl4YbVih3PMd7l/zfy jg5A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=XAtw1U/BTDOrZHgBLIQAFfpKcmyk/l+MkBAEZzxdNlo=; b=my9MNQSqOfah8fBKhNL5pHb3z2V4T/m7QBc4qxV2dHgXpY6yTrGvzhF0p+fL4ahC6r fcIUcGiQEl4rkY1uCb8BRiUGX796BR9UYvY7P1iEKvVzVlMxYPfcPZXllu2gfS+H4OWn LkAMXJ+x8pZMdLXmcXtwFmQnaQe8Bq7Yy+ZEhVlaMBQJt3TfEkTC6mevIdtTZ/5807N+ aTJWqT2EQGGAE5icCySb94GeO5d5LQgVoeSUpAJheRExMXySkgdyqJwlPH3A7EXvn/in IyBe/zkcUn434GPOXHr/bgrVBdwZgDA8JnXX5n7X1Aucfr89qsx5SPG5S7HCBay1W9ph X8/A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=O1nUAvNu; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id j184-20020a6380c1000000b004b353c89e27si5469044pgd.429.2023.02.26.14.55.23; Sun, 26 Feb 2023 14:55:37 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=O1nUAvNu; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229641AbjBZWym (ORCPT + 99 others); Sun, 26 Feb 2023 17:54:42 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:32794 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229635AbjBZWyh (ORCPT ); Sun, 26 Feb 2023 17:54:37 -0500 Received: from mail-wr1-x42e.google.com (mail-wr1-x42e.google.com [IPv6:2a00:1450:4864:20::42e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 302E8EF94 for ; Sun, 26 Feb 2023 14:54:24 -0800 (PST) Received: by mail-wr1-x42e.google.com with SMTP id bx12so1258979wrb.11 for ; Sun, 26 Feb 2023 14:54:24 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=XAtw1U/BTDOrZHgBLIQAFfpKcmyk/l+MkBAEZzxdNlo=; b=O1nUAvNuzXyl2MlL+QjZlnWfvovXA7TLZNj3oxW25yIo3NprmRry63nVZKcYm8NzHy mWrRId1xU+OTYEIlg2jJ33vtpZKKi75k25g4/QMs0gAUFibDANMCgzkJWt6XrE3HpQVn ZqMUWVdx8Gwgpw64fto+TOSGjM+P9k2+s3IbYTPD8UCCdFLqqazB/a7FW6ftCfV9nD3V mbwaaAevY6xE+QyV9E0AJ/6caP2v5hapVCQrLDOfEbOXNOgyFWm934ynQ/CSHPW7o7DL nulbVxtnjO7+Bec8DszgArZiUvG00pp0A9MK9aBNsf1tC7Omr1iGiCegNqELN3gWsE9f rvFg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=XAtw1U/BTDOrZHgBLIQAFfpKcmyk/l+MkBAEZzxdNlo=; b=gS/0bwQa2czfwPd04IMdzP3NnxadrUwgAQmVhgsz9OMsluv7UZLsM3XnUw5y9cQ/bQ /qcRFsWTQUiB/3A08PD4xqL9T9XPGOhapVBFsQWyyFWa1+mjPHWJ2Rv73B4yeVhSYgL3 e5Tky5zaNPn1QYJUCCTxzar34wyiV+E1wO9ZOimF7anDIEsYn1w+ZB4xCOxq0tKjPWy2 pIb3HI/WIUu09aZA/vgVWzN7oRSLY1j+Mv2YFI+1gnS59vMSyaeVaL3ozFaXMKe6ZGNw cYKamomEx8O5snIjMHFba6Ka52v5+5E/Ye0/dgOjxJgTUb6N7CV9hrsJfIp7mFCz8iaJ MKBA== X-Gm-Message-State: AO0yUKVPhCzvhw5RmV6vSOUZRmpHRX5JHXER+QOr8V2/UPClntzJGvGJ lMN/pYN4IE/Y92fqsJee0FQXMw== X-Received: by 2002:adf:f5d2:0:b0:2c7:bbe:456e with SMTP id k18-20020adff5d2000000b002c70bbe456emr12321845wrp.56.1677452062545; Sun, 26 Feb 2023 14:54:22 -0800 (PST) Received: from mai.box.freepro.com ([2a05:6e02:1041:c10:8baa:6b32:391b:62de]) by smtp.gmail.com with ESMTPSA id d10-20020a05600c3aca00b003eb369abd92sm6138074wms.2.2023.02.26.14.54.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 26 Feb 2023 14:54:22 -0800 (PST) From: Daniel Lezcano To: rafael@kernel.org, daniel.lezcano@linaro.org Cc: linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, "Rafael J . Wysocki" , Mark Brown , Amit Kucheria , Zhang Rui Subject: [PATCH v3 01/20] thermal/core: Add a thermal zone 'devdata' accessor Date: Sun, 26 Feb 2023 23:53:47 +0100 Message-Id: <20230226225406.979703-2-daniel.lezcano@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230226225406.979703-1-daniel.lezcano@linaro.org> References: <20230226225406.979703-1-daniel.lezcano@linaro.org> MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1758936052165971924?= X-GMAIL-MSGID: =?utf-8?q?1758936052165971924?= The thermal zone device structure is exposed to the different drivers and obviously they access the internals while that should be restricted to the core thermal code. In order to self-encapsulate the thermal core code, we need to prevent the drivers accessing directly the thermal zone structure and provide accessor functions to deal with. Provide an accessor to the 'devdata' structure and make use of it in the different drivers. No functional changes intended. Signed-off-by: Daniel Lezcano Acked-by: Rafael J. Wysocki Acked-by: Mark Brown --- drivers/thermal/thermal_core.c | 6 ++++++ include/linux/thermal.h | 7 +++++++ 2 files changed, 13 insertions(+) diff --git a/drivers/thermal/thermal_core.c b/drivers/thermal/thermal_core.c index 0675df54c8e6..9fa12147fead 100644 --- a/drivers/thermal/thermal_core.c +++ b/drivers/thermal/thermal_core.c @@ -1378,6 +1378,12 @@ struct thermal_zone_device *thermal_zone_device_register(const char *type, int n } EXPORT_SYMBOL_GPL(thermal_zone_device_register); +void *thermal_zone_device_priv(struct thermal_zone_device *tzd) +{ + return tzd->devdata; +} +EXPORT_SYMBOL_GPL(thermal_zone_device_priv); + /** * thermal_zone_device_unregister - removes the registered thermal zone device * @tz: the thermal zone device to remove diff --git a/include/linux/thermal.h b/include/linux/thermal.h index 2bb4bf33f4f3..7dbb5712434c 100644 --- a/include/linux/thermal.h +++ b/include/linux/thermal.h @@ -365,6 +365,8 @@ thermal_zone_device_register_with_trips(const char *, struct thermal_trip *, int void *, struct thermal_zone_device_ops *, struct thermal_zone_params *, int, int); +void *thermal_zone_device_priv(struct thermal_zone_device *tzd); + int thermal_zone_bind_cooling_device(struct thermal_zone_device *, int, struct thermal_cooling_device *, unsigned long, unsigned long, @@ -436,6 +438,11 @@ static inline int thermal_zone_get_offset( struct thermal_zone_device *tz) { return -ENODEV; } +static inline void *thermal_zone_device_priv(struct thermal_zone_device *tz) +{ + return NULL; +} + static inline int thermal_zone_device_enable(struct thermal_zone_device *tz) { return -ENODEV; } From patchwork Sun Feb 26 22:53:48 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Daniel Lezcano X-Patchwork-Id: 61671 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp2131018wrd; Sun, 26 Feb 2023 14:55:54 -0800 (PST) X-Google-Smtp-Source: AK7set8VTV9ygxJBfdBt5mvQNvSeo+YGFGoLquul/Rfs8ugUrGMBwqnhb7We4rAjOCMgNhNIh4sJ X-Received: by 2002:a17:902:680e:b0:19c:13d2:44c5 with SMTP id h14-20020a170902680e00b0019c13d244c5mr22636542plk.3.1677452154327; Sun, 26 Feb 2023 14:55:54 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1677452154; cv=none; d=google.com; s=arc-20160816; b=bZs5q9IYEFBVT+dsqiGfBgEV19BLHkUWWbqkRV4oz/Im8xBxFCosjeashC6QxJ0njt y8X9P+Zp/LFKV8NKUX7HWzUqSp9V6JSn+imM6KCQIV7r4nSureZ8gH8rev6ny8e8ciUm IZd5FzjsQoYu+Cx8raQkZfmomeCJKx7ru5iKHW1n6EhKNG6w9aWKGulPsilrOCc0JNv0 ra68PqKxViZr+uSBUKGVMJHwEJel7B5XTz74pecmGIKFp8kv/ArvZV0BYLoKazEW6l6P p7+V9LQ+/PEJg/sLYGhaB/T1pib3hR9BTpmydsPkRMUA58DmFufG7prZL1cRG3JfcHgz R6iA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=dU6ZwUsV+1vPfrDcdZNiADbV8jceZGcLkY6sCJA8sDM=; b=Irt8VF32IvcGEZXD0oI3GEIRnW/kiNE8LPHXMSMFmITiySYThbSr2DKJcXlhlsjv35 rEbT+Tog8+EV95epBr0Q518RaJwZblS0FmNZrUnknBsxaNQGo6PYojQUzHrE+ryo1hsB B7g+pa/CtQ1Ntk1HbExbtSsi8wTr/50FJUl5OnzDSFKH8V+yBQWTYsrAFlWG5gpJ4HA4 toMfw2VoT5QFx8VsT4asVxAkByyq3f9/JIc/gdn6M4K8QrpVpbj85SczVHXVm6bOLwGz 4OePDiD4SRmEBCCRztEV5PZs2lMZuMwGQCujOL8DCesmQIZAZEYsn0z4UESRb/NQSovE MPmQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=uW1QmW8e; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id li14-20020a170903294e00b0019ace4c5bd5si5012802plb.513.2023.02.26.14.55.41; Sun, 26 Feb 2023 14:55:54 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=uW1QmW8e; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229635AbjBZWzB (ORCPT + 99 others); Sun, 26 Feb 2023 17:55:01 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33542 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229703AbjBZWy5 (ORCPT ); Sun, 26 Feb 2023 17:54:57 -0500 Received: from mail-wm1-x32f.google.com (mail-wm1-x32f.google.com [IPv6:2a00:1450:4864:20::32f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 02CCFEFAE for ; Sun, 26 Feb 2023 14:54:45 -0800 (PST) Received: by mail-wm1-x32f.google.com with SMTP id d41-20020a05600c4c2900b003e9e066550fso2781617wmp.4 for ; Sun, 26 Feb 2023 14:54:44 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=dU6ZwUsV+1vPfrDcdZNiADbV8jceZGcLkY6sCJA8sDM=; b=uW1QmW8eBHhqsH1ijFi4qgwUmB7TVRK70bPx+Z2mxrn0eG+v83BaXqDvrH2YgvYm89 C7tspjTGigV6/eT3zLwrc5eTQWP1jQNSuiZCwfqDlgfcpzNs04eW5L3cipInJjBNunEK hMX861JOutQtI8NJREoU2KEAbaalXX/27hyqH5HBIaaBRV4oB+uDz8pa+mSuOYUWts0R TU5lLISPOu9kRocXFK4Rq3y6OJTmkPZnM64sucGgRibM0fPhSbYuTFK8s/BbKZOvOVLL HZ1dmJ/BJg0zVNN68Rg6aQTcaItjqNeIt6QGsZqdF2sF3hRqmYf1jDDF4d/ZZM0lUPZM OggQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=dU6ZwUsV+1vPfrDcdZNiADbV8jceZGcLkY6sCJA8sDM=; b=HqMuCVKor+45KUIobGh2IP8gpzW08+VafmZrHqnbX3DEO46x5Q4OWk1JMzUk47Y7cL d/9CfO7c68f+9gP8/l0RK1XRBfF3k7Q80EK8GXgnbMUQYtmxCLYmI94BwiaTqPr1u+JL 8E49HxajJoi18zxArnJI4Pq8hqOCx+DO70XpYKI6PoeG6QLH2sIZ9sAdf50No6rXrjR5 ADTs0uLReTq3Npg0XRErky0yWsnEW6oTfVkhDr2vbXJ7HoonH/fKibuT2rRT8phO/dU7 YDaBuccFlGsqPZZI+Nrx9FYPycjQs7ixEOtQqDwDFBDaL+3Y9Akq9KqasxlFHk0R46UW 93OQ== X-Gm-Message-State: AO0yUKW21SfmTbBhc9Ll4ESoqQUKPhuKiMDKx7O9yep54jyjf8kXf/hZ 1b517xuKWD6sxFs3f54N1fE//g== X-Received: by 2002:a05:600c:a4c:b0:3ea:e667:b1ee with SMTP id c12-20020a05600c0a4c00b003eae667b1eemr8782478wmq.38.1677452083204; Sun, 26 Feb 2023 14:54:43 -0800 (PST) Received: from mai.box.freepro.com ([2a05:6e02:1041:c10:8baa:6b32:391b:62de]) by smtp.gmail.com with ESMTPSA id d10-20020a05600c3aca00b003eb369abd92sm6138074wms.2.2023.02.26.14.54.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 26 Feb 2023 14:54:42 -0800 (PST) From: Daniel Lezcano To: rafael@kernel.org, daniel.lezcano@linaro.org Cc: linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, =?utf-8?q?Niklas?= =?utf-8?q?_S=C3=B6derlund?= , Mark Brown , AngeloGioacchino Del Regno , Balsam CHIHI , Adam Ward , Baolin Wang , Jernej Skrabec , "Rafael J . Wysocki" , Florian Fainelli , Guillaume La Roque , Amit Kucheria , Zhang Rui , Miquel Raynal , Broadcom internal kernel review list , Ray Jui , Scott Branden , Markus Mayer , Support Opensource , Shawn Guo , Sascha Hauer , Pengutronix Kernel Team , Fabio Estevam , NXP Linux Team , Thara Gopinath , Andy Gross , Bjorn Andersson , Konrad Dybcio , =?utf-8?q?Niklas_S=C3=B6derlund?= , Heiko Stuebner , Bartlomiej Zolnierkiewicz , Krzysztof Kozlowski , Alim Akhtar , Orson Zhai , Chunyan Zhang , Maxime Coquelin , Alexandre Torgue , Vasily Khoruzhick , Yangtao Li , Chen-Yu Tsai , Samuel Holland , Thierry Reding , Jonathan Hunter , Talel Shenhar , Eduardo Valentin , Keerthy , Kunihiko Hayashi , Masami Hiramatsu , Matthias Brugger , Stefan Wahren , ye xingchen , Zheng Yongjun , Srinivas Pandruvada , Davidlohr Bueso , Kees Cook , Sumeet Pawnikar , Shang XiaoJing , Tim Zimmermann , Yang Li , Jiang Jian , Daniel Golle , Randy Dunlap , Ido Schimmel , Minghao Chi , Johan Hovold , Mikko Perttunen , linux-amlogic@lists.infradead.org (open list:THERMAL DRIVER FOR AMLOGIC SOCS), linux-rpi-kernel@lists.infradead.org (moderated list:BROADCOM BCM2711/BCM2835 ARM ARCHITECTURE), linux-arm-kernel@lists.infradead.org (moderated list:BROADCOM BCM2711/BCM2835 ARM ARCHITECTURE), linux-arm-msm@vger.kernel.org (open list:QUALCOMM TSENS THERMAL DRIVER), linux-renesas-soc@vger.kernel.org (open list:RENESAS R-CAR THERMAL DRIVERS), linux-rockchip@lists.infradead.org (open list:ARM/Rockchip SoC support), linux-samsung-soc@vger.kernel.org (open list:SAMSUNG THERMAL DRIVER), linux-stm32@st-md-mailman.stormreply.com (moderated list:ARM/STM32 ARCHITECTURE), linux-sunxi@lists.linux.dev (open list:ARM/Allwinner sunXi SoC support), linux-tegra@vger.kernel.org (open list:TEGRA ARCHITECTURE SUPPORT), linux-omap@vger.kernel.org (open list:TI BANDGAP AND THERMAL DRIVER), linux-mediatek@lists.infradead.org (moderated list:ARM/Mediatek SoC support) Subject: [PATCH v3 02/20] thermal/core: Use the thermal zone 'devdata' accessor in thermal located drivers Date: Sun, 26 Feb 2023 23:53:48 +0100 Message-Id: <20230226225406.979703-3-daniel.lezcano@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230226225406.979703-1-daniel.lezcano@linaro.org> References: <20230226225406.979703-1-daniel.lezcano@linaro.org> MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1758936070003950080?= X-GMAIL-MSGID: =?utf-8?q?1758936070003950080?= The thermal zone device structure is exposed to the different drivers and obviously they access the internals while that should be restricted to the core thermal code. In order to self-encapsulate the thermal core code, we need to prevent the drivers accessing directly the thermal zone structure and provide accessor functions to deal with. Use the devdata accessor introduced in the previous patch. No functional changes intended. Signed-off-by: Daniel Lezcano Reviewed-by: Niklas Söderlund #R-Car Acked-by: Mark Brown Reviewed-by: AngeloGioacchino Del Regno #MediaTek auxadc and lvts Reviewed-by: Balsam CHIHI #Mediatek lvts Reviewed-by: Adam Ward #da9062 Reviewed-by: Baolin Wang #spread Acked-by: Jernej Skrabec #sun8i_thermal Acked-by: Rafael J. Wysocki Acked-by: Florian Fainelli #Broadcom --- drivers/thermal/amlogic_thermal.c | 2 +- drivers/thermal/armada_thermal.c | 4 ++-- drivers/thermal/broadcom/bcm2711_thermal.c | 2 +- drivers/thermal/broadcom/bcm2835_thermal.c | 2 +- drivers/thermal/broadcom/brcmstb_thermal.c | 4 ++-- drivers/thermal/broadcom/ns-thermal.c | 2 +- drivers/thermal/broadcom/sr-thermal.c | 2 +- drivers/thermal/da9062-thermal.c | 2 +- drivers/thermal/db8500_thermal.c | 2 +- drivers/thermal/dove_thermal.c | 2 +- drivers/thermal/hisi_thermal.c | 2 +- drivers/thermal/imx8mm_thermal.c | 2 +- drivers/thermal/imx_sc_thermal.c | 2 +- drivers/thermal/imx_thermal.c | 6 +++--- .../thermal/intel/int340x_thermal/int3400_thermal.c | 2 +- .../intel/int340x_thermal/int340x_thermal_zone.c | 4 ++-- .../int340x_thermal/processor_thermal_device_pci.c | 4 ++-- drivers/thermal/intel/intel_pch_thermal.c | 2 +- drivers/thermal/intel/intel_quark_dts_thermal.c | 6 +++--- drivers/thermal/intel/intel_soc_dts_iosf.c | 13 +++++-------- drivers/thermal/intel/x86_pkg_temp_thermal.c | 4 ++-- drivers/thermal/k3_bandgap.c | 2 +- drivers/thermal/k3_j72xx_bandgap.c | 2 +- drivers/thermal/kirkwood_thermal.c | 2 +- drivers/thermal/max77620_thermal.c | 2 +- drivers/thermal/mediatek/auxadc_thermal.c | 2 +- drivers/thermal/mediatek/lvts_thermal.c | 4 ++-- drivers/thermal/qcom/qcom-spmi-adc-tm5.c | 4 ++-- drivers/thermal/qcom/qcom-spmi-temp-alarm.c | 4 ++-- drivers/thermal/qcom/tsens.c | 4 ++-- drivers/thermal/qoriq_thermal.c | 2 +- drivers/thermal/rcar_gen3_thermal.c | 4 ++-- drivers/thermal/rcar_thermal.c | 3 +-- drivers/thermal/rockchip_thermal.c | 4 ++-- drivers/thermal/rzg2l_thermal.c | 2 +- drivers/thermal/samsung/exynos_tmu.c | 4 ++-- drivers/thermal/spear_thermal.c | 8 ++++---- drivers/thermal/sprd_thermal.c | 2 +- drivers/thermal/st/st_thermal.c | 2 +- drivers/thermal/st/stm_thermal.c | 4 ++-- drivers/thermal/sun8i_thermal.c | 2 +- drivers/thermal/tegra/soctherm.c | 6 +++--- drivers/thermal/tegra/tegra-bpmp-thermal.c | 6 ++++-- drivers/thermal/tegra/tegra30-tsensor.c | 4 ++-- drivers/thermal/thermal-generic-adc.c | 2 +- drivers/thermal/thermal_mmio.c | 2 +- drivers/thermal/ti-soc-thermal/ti-thermal-common.c | 4 ++-- drivers/thermal/uniphier_thermal.c | 2 +- 48 files changed, 79 insertions(+), 81 deletions(-) diff --git a/drivers/thermal/amlogic_thermal.c b/drivers/thermal/amlogic_thermal.c index 9235fda4ec1e..dfcc93e45cdd 100644 --- a/drivers/thermal/amlogic_thermal.c +++ b/drivers/thermal/amlogic_thermal.c @@ -181,7 +181,7 @@ static int amlogic_thermal_disable(struct amlogic_thermal *data) static int amlogic_thermal_get_temp(struct thermal_zone_device *tz, int *temp) { unsigned int tval; - struct amlogic_thermal *pdata = tz->devdata; + struct amlogic_thermal *pdata = thermal_zone_device_priv(tz); if (!pdata) return -EINVAL; diff --git a/drivers/thermal/armada_thermal.c b/drivers/thermal/armada_thermal.c index 2efc222a379b..ebd606861a61 100644 --- a/drivers/thermal/armada_thermal.c +++ b/drivers/thermal/armada_thermal.c @@ -398,7 +398,7 @@ static int armada_read_sensor(struct armada_thermal_priv *priv, int *temp) static int armada_get_temp_legacy(struct thermal_zone_device *thermal, int *temp) { - struct armada_thermal_priv *priv = thermal->devdata; + struct armada_thermal_priv *priv = thermal_zone_device_priv(thermal); int ret; /* Valid check */ @@ -420,7 +420,7 @@ static struct thermal_zone_device_ops legacy_ops = { static int armada_get_temp(struct thermal_zone_device *tz, int *temp) { - struct armada_thermal_sensor *sensor = tz->devdata; + struct armada_thermal_sensor *sensor = thermal_zone_device_priv(tz); struct armada_thermal_priv *priv = sensor->priv; int ret; diff --git a/drivers/thermal/broadcom/bcm2711_thermal.c b/drivers/thermal/broadcom/bcm2711_thermal.c index 1f8651d15160..fcfcbbf044a4 100644 --- a/drivers/thermal/broadcom/bcm2711_thermal.c +++ b/drivers/thermal/broadcom/bcm2711_thermal.c @@ -33,7 +33,7 @@ struct bcm2711_thermal_priv { static int bcm2711_get_temp(struct thermal_zone_device *tz, int *temp) { - struct bcm2711_thermal_priv *priv = tz->devdata; + struct bcm2711_thermal_priv *priv = thermal_zone_device_priv(tz); int slope = thermal_zone_get_slope(tz); int offset = thermal_zone_get_offset(tz); u32 val; diff --git a/drivers/thermal/broadcom/bcm2835_thermal.c b/drivers/thermal/broadcom/bcm2835_thermal.c index 23918bb76ae6..86aaf459de37 100644 --- a/drivers/thermal/broadcom/bcm2835_thermal.c +++ b/drivers/thermal/broadcom/bcm2835_thermal.c @@ -90,7 +90,7 @@ static int bcm2835_thermal_temp2adc(int temp, int offset, int slope) static int bcm2835_thermal_get_temp(struct thermal_zone_device *tz, int *temp) { - struct bcm2835_thermal_data *data = tz->devdata; + struct bcm2835_thermal_data *data = thermal_zone_device_priv(tz); u32 val = readl(data->regs + BCM2835_TS_TSENSSTAT); if (!(val & BCM2835_TS_TSENSSTAT_VALID)) diff --git a/drivers/thermal/broadcom/brcmstb_thermal.c b/drivers/thermal/broadcom/brcmstb_thermal.c index 4d02c28331e3..60173cc83c46 100644 --- a/drivers/thermal/broadcom/brcmstb_thermal.c +++ b/drivers/thermal/broadcom/brcmstb_thermal.c @@ -152,7 +152,7 @@ static inline u32 avs_tmon_temp_to_code(struct brcmstb_thermal_priv *priv, static int brcmstb_get_temp(struct thermal_zone_device *tz, int *temp) { - struct brcmstb_thermal_priv *priv = tz->devdata; + struct brcmstb_thermal_priv *priv = thermal_zone_device_priv(tz); u32 val; long t; @@ -262,7 +262,7 @@ static irqreturn_t brcmstb_tmon_irq_thread(int irq, void *data) static int brcmstb_set_trips(struct thermal_zone_device *tz, int low, int high) { - struct brcmstb_thermal_priv *priv = tz->devdata; + struct brcmstb_thermal_priv *priv = thermal_zone_device_priv(tz); dev_dbg(priv->dev, "set trips %d <--> %d\n", low, high); diff --git a/drivers/thermal/broadcom/ns-thermal.c b/drivers/thermal/broadcom/ns-thermal.c index 07a8a3f49bd0..d255aa879fc0 100644 --- a/drivers/thermal/broadcom/ns-thermal.c +++ b/drivers/thermal/broadcom/ns-thermal.c @@ -16,7 +16,7 @@ static int ns_thermal_get_temp(struct thermal_zone_device *tz, int *temp) { - void __iomem *pvtmon = tz->devdata; + void __iomem *pvtmon = thermal_zone_device_priv(tz); int offset = thermal_zone_get_offset(tz); int slope = thermal_zone_get_slope(tz); u32 val; diff --git a/drivers/thermal/broadcom/sr-thermal.c b/drivers/thermal/broadcom/sr-thermal.c index 2b93502543ff..747915890022 100644 --- a/drivers/thermal/broadcom/sr-thermal.c +++ b/drivers/thermal/broadcom/sr-thermal.c @@ -32,7 +32,7 @@ struct sr_thermal { static int sr_get_temp(struct thermal_zone_device *tz, int *temp) { - struct sr_tmon *tmon = tz->devdata; + struct sr_tmon *tmon = thermal_zone_device_priv(tz); struct sr_thermal *sr_thermal = tmon->priv; *temp = readl(sr_thermal->regs + SR_TMON_TEMP_BASE(tmon->tmon_id)); diff --git a/drivers/thermal/da9062-thermal.c b/drivers/thermal/da9062-thermal.c index a805a6666c44..e7097f354750 100644 --- a/drivers/thermal/da9062-thermal.c +++ b/drivers/thermal/da9062-thermal.c @@ -123,7 +123,7 @@ static irqreturn_t da9062_thermal_irq_handler(int irq, void *data) static int da9062_thermal_get_temp(struct thermal_zone_device *z, int *temp) { - struct da9062_thermal *thermal = z->devdata; + struct da9062_thermal *thermal = thermal_zone_device_priv(z); mutex_lock(&thermal->lock); *temp = thermal->temperature; diff --git a/drivers/thermal/db8500_thermal.c b/drivers/thermal/db8500_thermal.c index cb10e280681f..607c10a712ec 100644 --- a/drivers/thermal/db8500_thermal.c +++ b/drivers/thermal/db8500_thermal.c @@ -60,7 +60,7 @@ struct db8500_thermal_zone { /* Callback to get current temperature */ static int db8500_thermal_get_temp(struct thermal_zone_device *tz, int *temp) { - struct db8500_thermal_zone *th = tz->devdata; + struct db8500_thermal_zone *th = therma_zone_device_priv(tz); /* * TODO: There is no PRCMU interface to get temperature data currently, diff --git a/drivers/thermal/dove_thermal.c b/drivers/thermal/dove_thermal.c index 056622a58d00..6db1882e8229 100644 --- a/drivers/thermal/dove_thermal.c +++ b/drivers/thermal/dove_thermal.c @@ -87,7 +87,7 @@ static int dove_get_temp(struct thermal_zone_device *thermal, int *temp) { unsigned long reg; - struct dove_thermal_priv *priv = thermal->devdata; + struct dove_thermal_priv *priv = thermal_zone_device_priv(thermal); /* Valid check */ reg = readl_relaxed(priv->control + PMU_TEMP_DIOD_CTRL1_REG); diff --git a/drivers/thermal/hisi_thermal.c b/drivers/thermal/hisi_thermal.c index 32a7c3cf073d..f3a374266fa0 100644 --- a/drivers/thermal/hisi_thermal.c +++ b/drivers/thermal/hisi_thermal.c @@ -431,7 +431,7 @@ static int hi3660_thermal_probe(struct hisi_thermal_data *data) static int hisi_thermal_get_temp(struct thermal_zone_device *tz, int *temp) { - struct hisi_thermal_sensor *sensor = tz->devdata; + struct hisi_thermal_sensor *sensor = thermal_zone_device_priv(tz); struct hisi_thermal_data *data = sensor->data; *temp = data->ops->get_temp(sensor); diff --git a/drivers/thermal/imx8mm_thermal.c b/drivers/thermal/imx8mm_thermal.c index 72b5d6f319c1..efa1a4ffc368 100644 --- a/drivers/thermal/imx8mm_thermal.c +++ b/drivers/thermal/imx8mm_thermal.c @@ -141,7 +141,7 @@ static int imx8mp_tmu_get_temp(void *data, int *temp) static int tmu_get_temp(struct thermal_zone_device *tz, int *temp) { - struct tmu_sensor *sensor = tz->devdata; + struct tmu_sensor *sensor = thermal_zone_device_priv(tz); struct imx8mm_tmu *tmu = sensor->priv; return tmu->socdata->get_temp(sensor, temp); diff --git a/drivers/thermal/imx_sc_thermal.c b/drivers/thermal/imx_sc_thermal.c index f32e59e74623..ddde4bdfc94a 100644 --- a/drivers/thermal/imx_sc_thermal.c +++ b/drivers/thermal/imx_sc_thermal.c @@ -46,7 +46,7 @@ static int imx_sc_thermal_get_temp(struct thermal_zone_device *tz, int *temp) { struct imx_sc_msg_misc_get_temp msg; struct imx_sc_rpc_msg *hdr = &msg.hdr; - struct imx_sc_sensor *sensor = tz->devdata; + struct imx_sc_sensor *sensor = thermal_zone_device_priv(tz); int ret; msg.data.req.resource_id = sensor->resource_id; diff --git a/drivers/thermal/imx_thermal.c b/drivers/thermal/imx_thermal.c index fb0d5cab70af..a22b8086a209 100644 --- a/drivers/thermal/imx_thermal.c +++ b/drivers/thermal/imx_thermal.c @@ -252,7 +252,7 @@ static void imx_set_alarm_temp(struct imx_thermal_data *data, static int imx_get_temp(struct thermal_zone_device *tz, int *temp) { - struct imx_thermal_data *data = tz->devdata; + struct imx_thermal_data *data = thermal_zone_device_priv(tz); const struct thermal_soc_data *soc_data = data->socdata; struct regmap *map = data->tempmon; unsigned int n_meas; @@ -311,7 +311,7 @@ static int imx_get_temp(struct thermal_zone_device *tz, int *temp) static int imx_change_mode(struct thermal_zone_device *tz, enum thermal_device_mode mode) { - struct imx_thermal_data *data = tz->devdata; + struct imx_thermal_data *data = thermal_zone_device_priv(tz); if (mode == THERMAL_DEVICE_ENABLED) { pm_runtime_get(data->dev); @@ -342,7 +342,7 @@ static int imx_get_crit_temp(struct thermal_zone_device *tz, int *temp) static int imx_set_trip_temp(struct thermal_zone_device *tz, int trip, int temp) { - struct imx_thermal_data *data = tz->devdata; + struct imx_thermal_data *data = thermal_zone_device_priv(tz); int ret; ret = pm_runtime_resume_and_get(data->dev); diff --git a/drivers/thermal/intel/int340x_thermal/int3400_thermal.c b/drivers/thermal/intel/int340x_thermal/int3400_thermal.c index d0295123cc3e..810231b59dcd 100644 --- a/drivers/thermal/intel/int340x_thermal/int3400_thermal.c +++ b/drivers/thermal/intel/int340x_thermal/int3400_thermal.c @@ -497,7 +497,7 @@ static int int3400_thermal_get_temp(struct thermal_zone_device *thermal, static int int3400_thermal_change_mode(struct thermal_zone_device *thermal, enum thermal_device_mode mode) { - struct int3400_thermal_priv *priv = thermal->devdata; + struct int3400_thermal_priv *priv = thermal_zone_device_priv(thermal); int result = 0; if (!priv) diff --git a/drivers/thermal/intel/int340x_thermal/int340x_thermal_zone.c b/drivers/thermal/intel/int340x_thermal/int340x_thermal_zone.c index 00665967ca52..89cf007146ea 100644 --- a/drivers/thermal/intel/int340x_thermal/int340x_thermal_zone.c +++ b/drivers/thermal/intel/int340x_thermal/int340x_thermal_zone.c @@ -14,7 +14,7 @@ static int int340x_thermal_get_zone_temp(struct thermal_zone_device *zone, int *temp) { - struct int34x_thermal_zone *d = zone->devdata; + struct int34x_thermal_zone *d = thermal_zone_device_priv(zone); unsigned long long tmp; acpi_status status; @@ -41,7 +41,7 @@ static int int340x_thermal_get_zone_temp(struct thermal_zone_device *zone, static int int340x_thermal_set_trip_temp(struct thermal_zone_device *zone, int trip, int temp) { - struct int34x_thermal_zone *d = zone->devdata; + struct int34x_thermal_zone *d = thermal_zone_device_priv(zone); char name[] = {'P', 'A', 'T', '0' + trip, '\0'}; acpi_status status; diff --git a/drivers/thermal/intel/int340x_thermal/processor_thermal_device_pci.c b/drivers/thermal/intel/int340x_thermal/processor_thermal_device_pci.c index 40725cbc6eb0..0404d4db70f0 100644 --- a/drivers/thermal/intel/int340x_thermal/processor_thermal_device_pci.c +++ b/drivers/thermal/intel/int340x_thermal/processor_thermal_device_pci.c @@ -135,7 +135,7 @@ static irqreturn_t proc_thermal_irq_handler(int irq, void *devid) static int sys_get_curr_temp(struct thermal_zone_device *tzd, int *temp) { - struct proc_thermal_pci *pci_info = tzd->devdata; + struct proc_thermal_pci *pci_info = thermal_zone_device_priv(tzd); u32 _temp; proc_thermal_mmio_read(pci_info, PROC_THERMAL_MMIO_PKG_TEMP, &_temp); @@ -146,7 +146,7 @@ static int sys_get_curr_temp(struct thermal_zone_device *tzd, int *temp) static int sys_set_trip_temp(struct thermal_zone_device *tzd, int trip, int temp) { - struct proc_thermal_pci *pci_info = tzd->devdata; + struct proc_thermal_pci *pci_info = thermal_zone_device_priv(tzd); int tjmax, _temp; if (temp <= 0) { diff --git a/drivers/thermal/intel/intel_pch_thermal.c b/drivers/thermal/intel/intel_pch_thermal.c index b855d031a855..dce50d239357 100644 --- a/drivers/thermal/intel/intel_pch_thermal.c +++ b/drivers/thermal/intel/intel_pch_thermal.c @@ -119,7 +119,7 @@ static int pch_wpt_add_acpi_psv_trip(struct pch_thermal_device *ptd, int trip) static int pch_thermal_get_temp(struct thermal_zone_device *tzd, int *temp) { - struct pch_thermal_device *ptd = tzd->devdata; + struct pch_thermal_device *ptd = thermal_zone_device_priv(tzd); *temp = GET_WPT_TEMP(WPT_TEMP_TSR & readw(ptd->hw_base + WPT_TEMP)); return 0; diff --git a/drivers/thermal/intel/intel_quark_dts_thermal.c b/drivers/thermal/intel/intel_quark_dts_thermal.c index 97b843fa7568..63569185ed82 100644 --- a/drivers/thermal/intel/intel_quark_dts_thermal.c +++ b/drivers/thermal/intel/intel_quark_dts_thermal.c @@ -120,7 +120,7 @@ static DEFINE_MUTEX(dts_update_mutex); static int soc_dts_enable(struct thermal_zone_device *tzd) { u32 out; - struct soc_sensor_entry *aux_entry = tzd->devdata; + struct soc_sensor_entry *aux_entry = thermal_zone_device_priv(tzd); int ret; ret = iosf_mbi_read(QRK_MBI_UNIT_RMU, MBI_REG_READ, @@ -148,7 +148,7 @@ static int soc_dts_enable(struct thermal_zone_device *tzd) static int soc_dts_disable(struct thermal_zone_device *tzd) { u32 out; - struct soc_sensor_entry *aux_entry = tzd->devdata; + struct soc_sensor_entry *aux_entry = thermal_zone_device_priv(tzd); int ret; ret = iosf_mbi_read(QRK_MBI_UNIT_RMU, MBI_REG_READ, @@ -250,7 +250,7 @@ static int update_trip_temp(struct soc_sensor_entry *aux_entry, static inline int sys_set_trip_temp(struct thermal_zone_device *tzd, int trip, int temp) { - return update_trip_temp(tzd->devdata, trip, temp); + return update_trip_temp(thermal_zone_device_priv(tzd), trip, temp); } static int sys_get_curr_temp(struct thermal_zone_device *tzd, diff --git a/drivers/thermal/intel/intel_soc_dts_iosf.c b/drivers/thermal/intel/intel_soc_dts_iosf.c index 8c26f7b2316b..f99dc7e4ae89 100644 --- a/drivers/thermal/intel/intel_soc_dts_iosf.c +++ b/drivers/thermal/intel/intel_soc_dts_iosf.c @@ -54,7 +54,7 @@ static int sys_get_trip_temp(struct thermal_zone_device *tzd, int trip, struct intel_soc_dts_sensor_entry *dts; struct intel_soc_dts_sensors *sensors; - dts = tzd->devdata; + dts = thermal_zone_device_priv(tzd); sensors = dts->sensors; mutex_lock(&sensors->dts_update_lock); status = iosf_mbi_read(BT_MBI_UNIT_PMC, MBI_REG_READ, @@ -168,7 +168,7 @@ static int update_trip_temp(struct intel_soc_dts_sensor_entry *dts, static int sys_set_trip_temp(struct thermal_zone_device *tzd, int trip, int temp) { - struct intel_soc_dts_sensor_entry *dts = tzd->devdata; + struct intel_soc_dts_sensor_entry *dts = thermal_zone_device_priv(tzd); struct intel_soc_dts_sensors *sensors = dts->sensors; int status; @@ -176,7 +176,7 @@ static int sys_set_trip_temp(struct thermal_zone_device *tzd, int trip, return -EINVAL; mutex_lock(&sensors->dts_update_lock); - status = update_trip_temp(tzd->devdata, trip, temp, + status = update_trip_temp(dts, trip, temp, dts->trip_types[trip]); mutex_unlock(&sensors->dts_update_lock); @@ -186,9 +186,7 @@ static int sys_set_trip_temp(struct thermal_zone_device *tzd, int trip, static int sys_get_trip_type(struct thermal_zone_device *tzd, int trip, enum thermal_trip_type *type) { - struct intel_soc_dts_sensor_entry *dts; - - dts = tzd->devdata; + struct intel_soc_dts_sensor_entry *dts = thermal_zone_device_priv(tzd); *type = dts->trip_types[trip]; @@ -200,11 +198,10 @@ static int sys_get_curr_temp(struct thermal_zone_device *tzd, { int status; u32 out; - struct intel_soc_dts_sensor_entry *dts; + struct intel_soc_dts_sensor_entry *dts = thermal_zone_device_priv(tzd); struct intel_soc_dts_sensors *sensors; unsigned long raw; - dts = tzd->devdata; sensors = dts->sensors; status = iosf_mbi_read(BT_MBI_UNIT_PMC, MBI_REG_READ, SOC_DTS_OFFSET_TEMP, &out); diff --git a/drivers/thermal/intel/x86_pkg_temp_thermal.c b/drivers/thermal/intel/x86_pkg_temp_thermal.c index 1c2de84742df..c4ec314441be 100644 --- a/drivers/thermal/intel/x86_pkg_temp_thermal.c +++ b/drivers/thermal/intel/x86_pkg_temp_thermal.c @@ -107,7 +107,7 @@ static struct zone_device *pkg_temp_thermal_get_dev(unsigned int cpu) static int sys_get_curr_temp(struct thermal_zone_device *tzd, int *temp) { - struct zone_device *zonedev = tzd->devdata; + struct zone_device *zonedev = thermal_zone_device_priv(tzd); int val; val = intel_tcc_get_temp(zonedev->cpu, true); @@ -122,7 +122,7 @@ static int sys_get_curr_temp(struct thermal_zone_device *tzd, int *temp) static int sys_set_trip_temp(struct thermal_zone_device *tzd, int trip, int temp) { - struct zone_device *zonedev = tzd->devdata; + struct zone_device *zonedev = thermal_zone_device_priv(tzd); u32 l, h, mask, shift, intr; int tj_max, ret; diff --git a/drivers/thermal/k3_bandgap.c b/drivers/thermal/k3_bandgap.c index 22c9bcb899c3..b5cd2c85e0c3 100644 --- a/drivers/thermal/k3_bandgap.c +++ b/drivers/thermal/k3_bandgap.c @@ -141,7 +141,7 @@ static int k3_bgp_read_temp(struct k3_thermal_data *devdata, static int k3_thermal_get_temp(struct thermal_zone_device *tz, int *temp) { - struct k3_thermal_data *data = tz->devdata; + struct k3_thermal_data *data = thermal_zone_device_priv(tz); int ret = 0; ret = k3_bgp_read_temp(data, temp); diff --git a/drivers/thermal/k3_j72xx_bandgap.c b/drivers/thermal/k3_j72xx_bandgap.c index 031ea1091909..5be1f09eeb2c 100644 --- a/drivers/thermal/k3_j72xx_bandgap.c +++ b/drivers/thermal/k3_j72xx_bandgap.c @@ -248,7 +248,7 @@ static inline int k3_bgp_read_temp(struct k3_thermal_data *devdata, /* Get temperature callback function for thermal zone */ static int k3_thermal_get_temp(struct thermal_zone_device *tz, int *temp) { - return k3_bgp_read_temp(tz->devdata, temp); + return k3_bgp_read_temp(thermal_zone_device_priv(tz), temp); } static const struct thermal_zone_device_ops k3_of_thermal_ops = { diff --git a/drivers/thermal/kirkwood_thermal.c b/drivers/thermal/kirkwood_thermal.c index bec7ec20e79d..92b3ce426b9d 100644 --- a/drivers/thermal/kirkwood_thermal.c +++ b/drivers/thermal/kirkwood_thermal.c @@ -27,7 +27,7 @@ static int kirkwood_get_temp(struct thermal_zone_device *thermal, int *temp) { unsigned long reg; - struct kirkwood_thermal_priv *priv = thermal->devdata; + struct kirkwood_thermal_priv *priv = thermal_zone_device_priv(thermal); reg = readl_relaxed(priv->sensor); diff --git a/drivers/thermal/max77620_thermal.c b/drivers/thermal/max77620_thermal.c index 6451a55eb582..bf1679765f1b 100644 --- a/drivers/thermal/max77620_thermal.c +++ b/drivers/thermal/max77620_thermal.c @@ -46,7 +46,7 @@ struct max77620_therm_info { static int max77620_thermal_read_temp(struct thermal_zone_device *tz, int *temp) { - struct max77620_therm_info *mtherm = tz->devdata; + struct max77620_therm_info *mtherm = thermal_zone_device_priv(tz); unsigned int val; int ret; diff --git a/drivers/thermal/mediatek/auxadc_thermal.c b/drivers/thermal/mediatek/auxadc_thermal.c index ab730f9552d0..755baa4e5bd2 100644 --- a/drivers/thermal/mediatek/auxadc_thermal.c +++ b/drivers/thermal/mediatek/auxadc_thermal.c @@ -763,7 +763,7 @@ static int mtk_thermal_bank_temperature(struct mtk_thermal_bank *bank) static int mtk_read_temp(struct thermal_zone_device *tz, int *temperature) { - struct mtk_thermal *mt = tz->devdata; + struct mtk_thermal *mt = thermal_zone_device_priv(tz); int i; int tempmax = INT_MIN; diff --git a/drivers/thermal/mediatek/lvts_thermal.c b/drivers/thermal/mediatek/lvts_thermal.c index 84ba65a27acf..fb4b1b4db245 100644 --- a/drivers/thermal/mediatek/lvts_thermal.c +++ b/drivers/thermal/mediatek/lvts_thermal.c @@ -252,7 +252,7 @@ static u32 lvts_temp_to_raw(int temperature) static int lvts_get_temp(struct thermal_zone_device *tz, int *temp) { - struct lvts_sensor *lvts_sensor = tz->devdata; + struct lvts_sensor *lvts_sensor = thermal_zone_device_priv(tz); void __iomem *msr = lvts_sensor->msr; u32 value; @@ -290,7 +290,7 @@ static int lvts_get_temp(struct thermal_zone_device *tz, int *temp) static int lvts_set_trips(struct thermal_zone_device *tz, int low, int high) { - struct lvts_sensor *lvts_sensor = tz->devdata; + struct lvts_sensor *lvts_sensor = thermal_zone_device_priv(tz); void __iomem *base = lvts_sensor->base; u32 raw_low = lvts_temp_to_raw(low); u32 raw_high = lvts_temp_to_raw(high); diff --git a/drivers/thermal/qcom/qcom-spmi-adc-tm5.c b/drivers/thermal/qcom/qcom-spmi-adc-tm5.c index 31164ade2dd1..ed204489a950 100644 --- a/drivers/thermal/qcom/qcom-spmi-adc-tm5.c +++ b/drivers/thermal/qcom/qcom-spmi-adc-tm5.c @@ -360,7 +360,7 @@ static irqreturn_t adc_tm5_gen2_isr(int irq, void *data) static int adc_tm5_get_temp(struct thermal_zone_device *tz, int *temp) { - struct adc_tm5_channel *channel = tz->devdata; + struct adc_tm5_channel *channel = thermal_zone_device_priv(tz); int ret; if (!channel || !channel->iio) @@ -642,7 +642,7 @@ static int adc_tm5_gen2_configure(struct adc_tm5_channel *channel, int low, int static int adc_tm5_set_trips(struct thermal_zone_device *tz, int low, int high) { - struct adc_tm5_channel *channel = tz->devdata; + struct adc_tm5_channel *channel = thermal_zone_device_priv(tz); struct adc_tm5_chip *chip; int ret; diff --git a/drivers/thermal/qcom/qcom-spmi-temp-alarm.c b/drivers/thermal/qcom/qcom-spmi-temp-alarm.c index 101c75d0e13f..b196d8d01726 100644 --- a/drivers/thermal/qcom/qcom-spmi-temp-alarm.c +++ b/drivers/thermal/qcom/qcom-spmi-temp-alarm.c @@ -187,7 +187,7 @@ static int qpnp_tm_update_temp_no_adc(struct qpnp_tm_chip *chip) static int qpnp_tm_get_temp(struct thermal_zone_device *tz, int *temp) { - struct qpnp_tm_chip *chip = tz->devdata; + struct qpnp_tm_chip *chip = thermal_zone_device_priv(tz); int ret, mili_celsius; if (!temp) @@ -265,7 +265,7 @@ static int qpnp_tm_update_critical_trip_temp(struct qpnp_tm_chip *chip, static int qpnp_tm_set_trip_temp(struct thermal_zone_device *tz, int trip_id, int temp) { - struct qpnp_tm_chip *chip = tz->devdata; + struct qpnp_tm_chip *chip = thermal_zone_device_priv(tz); struct thermal_trip trip; int ret; diff --git a/drivers/thermal/qcom/tsens.c b/drivers/thermal/qcom/tsens.c index 8020ead2794e..6cc935379f00 100644 --- a/drivers/thermal/qcom/tsens.c +++ b/drivers/thermal/qcom/tsens.c @@ -673,7 +673,7 @@ static irqreturn_t tsens_combined_irq_thread(int irq, void *data) static int tsens_set_trips(struct thermal_zone_device *tz, int low, int high) { - struct tsens_sensor *s = tz->devdata; + struct tsens_sensor *s = thermal_zone_device_priv(tz); struct tsens_priv *priv = s->priv; struct device *dev = priv->dev; struct tsens_irq_data d; @@ -1057,7 +1057,7 @@ int __init init_common(struct tsens_priv *priv) static int tsens_get_temp(struct thermal_zone_device *tz, int *temp) { - struct tsens_sensor *s = tz->devdata; + struct tsens_sensor *s = thermal_zone_device_priv(tz); struct tsens_priv *priv = s->priv; return priv->ops->get_temp(s, temp); diff --git a/drivers/thermal/qoriq_thermal.c b/drivers/thermal/qoriq_thermal.c index 431c29c0898a..d2dc99247f61 100644 --- a/drivers/thermal/qoriq_thermal.c +++ b/drivers/thermal/qoriq_thermal.c @@ -83,7 +83,7 @@ static struct qoriq_tmu_data *qoriq_sensor_to_data(struct qoriq_sensor *s) static int tmu_get_temp(struct thermal_zone_device *tz, int *temp) { - struct qoriq_sensor *qsensor = tz->devdata; + struct qoriq_sensor *qsensor = thermal_zone_device_priv(tz); struct qoriq_tmu_data *qdata = qoriq_sensor_to_data(qsensor); u32 val; /* diff --git a/drivers/thermal/rcar_gen3_thermal.c b/drivers/thermal/rcar_gen3_thermal.c index d6b5b59c5c53..2b7537ef141d 100644 --- a/drivers/thermal/rcar_gen3_thermal.c +++ b/drivers/thermal/rcar_gen3_thermal.c @@ -167,7 +167,7 @@ static int rcar_gen3_thermal_round(int temp) static int rcar_gen3_thermal_get_temp(struct thermal_zone_device *tz, int *temp) { - struct rcar_gen3_thermal_tsc *tsc = tz->devdata; + struct rcar_gen3_thermal_tsc *tsc = thermal_zone_device_priv(tz); int mcelsius, val; int reg; @@ -206,7 +206,7 @@ static int rcar_gen3_thermal_mcelsius_to_temp(struct rcar_gen3_thermal_tsc *tsc, static int rcar_gen3_thermal_set_trips(struct thermal_zone_device *tz, int low, int high) { - struct rcar_gen3_thermal_tsc *tsc = tz->devdata; + struct rcar_gen3_thermal_tsc *tsc = thermal_zone_device_priv(tz); u32 irqmsk = 0; if (low != -INT_MAX) { diff --git a/drivers/thermal/rcar_thermal.c b/drivers/thermal/rcar_thermal.c index 436f5f9cf729..e0440f63ae77 100644 --- a/drivers/thermal/rcar_thermal.c +++ b/drivers/thermal/rcar_thermal.c @@ -101,7 +101,6 @@ struct rcar_thermal_priv { list_for_each_entry(pos, &common->head, list) #define MCELSIUS(temp) ((temp) * 1000) -#define rcar_zone_to_priv(zone) ((zone)->devdata) #define rcar_priv_to_dev(priv) ((priv)->common->dev) #define rcar_has_irq_support(priv) ((priv)->common->base) #define rcar_id_to_shift(priv) ((priv)->id * 8) @@ -273,7 +272,7 @@ static int rcar_thermal_get_current_temp(struct rcar_thermal_priv *priv, static int rcar_thermal_get_temp(struct thermal_zone_device *zone, int *temp) { - struct rcar_thermal_priv *priv = rcar_zone_to_priv(zone); + struct rcar_thermal_priv *priv = thermal_zone_device_priv(zone); return rcar_thermal_get_current_temp(priv, temp); } diff --git a/drivers/thermal/rockchip_thermal.c b/drivers/thermal/rockchip_thermal.c index 4b7c43f34d1a..8a51eb26e798 100644 --- a/drivers/thermal/rockchip_thermal.c +++ b/drivers/thermal/rockchip_thermal.c @@ -1213,7 +1213,7 @@ static irqreturn_t rockchip_thermal_alarm_irq_thread(int irq, void *dev) static int rockchip_thermal_set_trips(struct thermal_zone_device *tz, int low, int high) { - struct rockchip_thermal_sensor *sensor = tz->devdata; + struct rockchip_thermal_sensor *sensor = thermal_zone_device_priv(tz); struct rockchip_thermal_data *thermal = sensor->thermal; const struct rockchip_tsadc_chip *tsadc = thermal->chip; @@ -1226,7 +1226,7 @@ static int rockchip_thermal_set_trips(struct thermal_zone_device *tz, int low, i static int rockchip_thermal_get_temp(struct thermal_zone_device *tz, int *out_temp) { - struct rockchip_thermal_sensor *sensor = tz->devdata; + struct rockchip_thermal_sensor *sensor = thermal_zone_device_priv(tz); struct rockchip_thermal_data *thermal = sensor->thermal; const struct rockchip_tsadc_chip *tsadc = sensor->thermal->chip; int retval; diff --git a/drivers/thermal/rzg2l_thermal.c b/drivers/thermal/rzg2l_thermal.c index 2e0649f38506..7631430ce8a9 100644 --- a/drivers/thermal/rzg2l_thermal.c +++ b/drivers/thermal/rzg2l_thermal.c @@ -75,7 +75,7 @@ static inline void rzg2l_thermal_write(struct rzg2l_thermal_priv *priv, u32 reg, static int rzg2l_thermal_get_temp(struct thermal_zone_device *tz, int *temp) { - struct rzg2l_thermal_priv *priv = tz->devdata; + struct rzg2l_thermal_priv *priv = thermal_zone_device_priv(tz); u32 result = 0, dsensor, ts_code_ave; int val, i; diff --git a/drivers/thermal/samsung/exynos_tmu.c b/drivers/thermal/samsung/exynos_tmu.c index 527d1eb0663a..45e5c840d130 100644 --- a/drivers/thermal/samsung/exynos_tmu.c +++ b/drivers/thermal/samsung/exynos_tmu.c @@ -645,7 +645,7 @@ static void exynos7_tmu_control(struct platform_device *pdev, bool on) static int exynos_get_temp(struct thermal_zone_device *tz, int *temp) { - struct exynos_tmu_data *data = tz->devdata; + struct exynos_tmu_data *data = thermal_zone_device_priv(tz); int value, ret = 0; if (!data || !data->tmu_read) @@ -723,7 +723,7 @@ static void exynos4412_tmu_set_emulation(struct exynos_tmu_data *data, static int exynos_tmu_set_emulation(struct thermal_zone_device *tz, int temp) { - struct exynos_tmu_data *data = tz->devdata; + struct exynos_tmu_data *data = thermal_zone_device_priv(tz); int ret = -EINVAL; if (data->soc == SOC_ARCH_EXYNOS4210) diff --git a/drivers/thermal/spear_thermal.c b/drivers/thermal/spear_thermal.c index 6a722b10d738..653439b965c8 100644 --- a/drivers/thermal/spear_thermal.c +++ b/drivers/thermal/spear_thermal.c @@ -31,7 +31,7 @@ struct spear_thermal_dev { static inline int thermal_get_temp(struct thermal_zone_device *thermal, int *temp) { - struct spear_thermal_dev *stdev = thermal->devdata; + struct spear_thermal_dev *stdev = thermal_zone_device_priv(thermal); /* * Data are ready to be read after 628 usec from POWERDOWN signal @@ -48,7 +48,7 @@ static struct thermal_zone_device_ops ops = { static int __maybe_unused spear_thermal_suspend(struct device *dev) { struct thermal_zone_device *spear_thermal = dev_get_drvdata(dev); - struct spear_thermal_dev *stdev = spear_thermal->devdata; + struct spear_thermal_dev *stdev = thermal_zone_device_priv(spear_thermal); unsigned int actual_mask = 0; /* Disable SPEAr Thermal Sensor */ @@ -64,7 +64,7 @@ static int __maybe_unused spear_thermal_suspend(struct device *dev) static int __maybe_unused spear_thermal_resume(struct device *dev) { struct thermal_zone_device *spear_thermal = dev_get_drvdata(dev); - struct spear_thermal_dev *stdev = spear_thermal->devdata; + struct spear_thermal_dev *stdev = thermal_zone_device_priv(spear_thermal); unsigned int actual_mask = 0; int ret = 0; @@ -154,7 +154,7 @@ static int spear_thermal_exit(struct platform_device *pdev) { unsigned int actual_mask = 0; struct thermal_zone_device *spear_thermal = platform_get_drvdata(pdev); - struct spear_thermal_dev *stdev = spear_thermal->devdata; + struct spear_thermal_dev *stdev = thermal_zone_device_priv(spear_thermal); thermal_zone_device_unregister(spear_thermal); diff --git a/drivers/thermal/sprd_thermal.c b/drivers/thermal/sprd_thermal.c index ac884514f116..2fb90fdad76e 100644 --- a/drivers/thermal/sprd_thermal.c +++ b/drivers/thermal/sprd_thermal.c @@ -206,7 +206,7 @@ static int sprd_thm_temp_to_rawdata(int temp, struct sprd_thermal_sensor *sen) static int sprd_thm_read_temp(struct thermal_zone_device *tz, int *temp) { - struct sprd_thermal_sensor *sen = tz->devdata; + struct sprd_thermal_sensor *sen = thermal_zone_device_priv(tz); u32 data; data = readl(sen->data->base + SPRD_THM_TEMP(sen->id)) & diff --git a/drivers/thermal/st/st_thermal.c b/drivers/thermal/st/st_thermal.c index 1009f08e64e3..6ed393218eb8 100644 --- a/drivers/thermal/st/st_thermal.c +++ b/drivers/thermal/st/st_thermal.c @@ -108,7 +108,7 @@ static int st_thermal_calibration(struct st_thermal_sensor *sensor) /* Callback to get temperature from HW*/ static int st_thermal_get_temp(struct thermal_zone_device *th, int *temperature) { - struct st_thermal_sensor *sensor = th->devdata; + struct st_thermal_sensor *sensor = thermal_zone_device_priv(th); struct device *dev = sensor->dev; unsigned int temp; unsigned int overflow; diff --git a/drivers/thermal/st/stm_thermal.c b/drivers/thermal/st/stm_thermal.c index 735401958f01..6f2bad8ef82f 100644 --- a/drivers/thermal/st/stm_thermal.c +++ b/drivers/thermal/st/stm_thermal.c @@ -303,7 +303,7 @@ static int stm_disable_irq(struct stm_thermal_sensor *sensor) static int stm_thermal_set_trips(struct thermal_zone_device *tz, int low, int high) { - struct stm_thermal_sensor *sensor = tz->devdata; + struct stm_thermal_sensor *sensor = thermal_zone_device_priv(tz); u32 itr1, th; int ret; @@ -351,7 +351,7 @@ static int stm_thermal_set_trips(struct thermal_zone_device *tz, int low, int hi /* Callback to get temperature from HW */ static int stm_thermal_get_temp(struct thermal_zone_device *tz, int *temp) { - struct stm_thermal_sensor *sensor = tz->devdata; + struct stm_thermal_sensor *sensor = thermal_zone_device_priv(tz); u32 periods; int freqM, ret; diff --git a/drivers/thermal/sun8i_thermal.c b/drivers/thermal/sun8i_thermal.c index 497beac63e5d..6b550f0f90bf 100644 --- a/drivers/thermal/sun8i_thermal.c +++ b/drivers/thermal/sun8i_thermal.c @@ -110,7 +110,7 @@ static int sun50i_h5_calc_temp(struct ths_device *tmdev, static int sun8i_ths_get_temp(struct thermal_zone_device *tz, int *temp) { - struct tsensor *s = tz->devdata; + struct tsensor *s = thermal_zone_device_priv(tz); struct ths_device *tmdev = s->tmdev; int val = 0; diff --git a/drivers/thermal/tegra/soctherm.c b/drivers/thermal/tegra/soctherm.c index 220873298d77..ea66cba09e56 100644 --- a/drivers/thermal/tegra/soctherm.c +++ b/drivers/thermal/tegra/soctherm.c @@ -423,7 +423,7 @@ static int translate_temp(u16 val) static int tegra_thermctl_get_temp(struct thermal_zone_device *tz, int *out_temp) { - struct tegra_thermctl_zone *zone = tz->devdata; + struct tegra_thermctl_zone *zone = thermal_zone_device_priv(tz); u32 val; val = readl(zone->reg); @@ -584,7 +584,7 @@ static int tsensor_group_thermtrip_get(struct tegra_soctherm *ts, int id) static int tegra_thermctl_set_trip_temp(struct thermal_zone_device *tz, int trip_id, int temp) { - struct tegra_thermctl_zone *zone = tz->devdata; + struct tegra_thermctl_zone *zone = thermal_zone_device_priv(tz); struct tegra_soctherm *ts = zone->ts; struct thermal_trip trip; const struct tegra_tsensor_group *sg = zone->sg; @@ -658,7 +658,7 @@ static void thermal_irq_disable(struct tegra_thermctl_zone *zn) static int tegra_thermctl_set_trips(struct thermal_zone_device *tz, int lo, int hi) { - struct tegra_thermctl_zone *zone = tz->devdata; + struct tegra_thermctl_zone *zone = thermal_zone_device_priv(tz); u32 r; thermal_irq_disable(zone); diff --git a/drivers/thermal/tegra/tegra-bpmp-thermal.c b/drivers/thermal/tegra/tegra-bpmp-thermal.c index 0b7a1a1948cb..7bd8ea770fa1 100644 --- a/drivers/thermal/tegra/tegra-bpmp-thermal.c +++ b/drivers/thermal/tegra/tegra-bpmp-thermal.c @@ -62,12 +62,14 @@ static int __tegra_bpmp_thermal_get_temp(struct tegra_bpmp_thermal_zone *zone, static int tegra_bpmp_thermal_get_temp(struct thermal_zone_device *tz, int *out_temp) { - return __tegra_bpmp_thermal_get_temp(tz->devdata, out_temp); + struct tegra_bpmp_thermal_zone *zone = thermal_zone_device_priv(tz); + + return __tegra_bpmp_thermal_get_temp(zone, out_temp); } static int tegra_bpmp_thermal_set_trips(struct thermal_zone_device *tz, int low, int high) { - struct tegra_bpmp_thermal_zone *zone = tz->devdata; + struct tegra_bpmp_thermal_zone *zone = thermal_zone_device_priv(tz); struct mrq_thermal_host_to_bpmp_request req; struct tegra_bpmp_message msg; int err; diff --git a/drivers/thermal/tegra/tegra30-tsensor.c b/drivers/thermal/tegra/tegra30-tsensor.c index b3218b71b6d9..42c6fb494dd9 100644 --- a/drivers/thermal/tegra/tegra30-tsensor.c +++ b/drivers/thermal/tegra/tegra30-tsensor.c @@ -160,7 +160,7 @@ static void devm_tegra_tsensor_hw_disable(void *data) static int tegra_tsensor_get_temp(struct thermal_zone_device *tz, int *temp) { - const struct tegra_tsensor_channel *tsc = tz->devdata; + const struct tegra_tsensor_channel *tsc = thermal_zone_device_priv(tz); const struct tegra_tsensor *ts = tsc->ts; int err, c1, c2, c3, c4, counter; u32 val; @@ -218,7 +218,7 @@ static int tegra_tsensor_temp_to_counter(const struct tegra_tsensor *ts, int tem static int tegra_tsensor_set_trips(struct thermal_zone_device *tz, int low, int high) { - const struct tegra_tsensor_channel *tsc = tz->devdata; + const struct tegra_tsensor_channel *tsc = thermal_zone_device_priv(tz); const struct tegra_tsensor *ts = tsc->ts; u32 val; diff --git a/drivers/thermal/thermal-generic-adc.c b/drivers/thermal/thermal-generic-adc.c index 323e273e3298..2c283e762d81 100644 --- a/drivers/thermal/thermal-generic-adc.c +++ b/drivers/thermal/thermal-generic-adc.c @@ -54,7 +54,7 @@ static int gadc_thermal_adc_to_temp(struct gadc_thermal_info *gti, int val) static int gadc_thermal_get_temp(struct thermal_zone_device *tz, int *temp) { - struct gadc_thermal_info *gti = tz->devdata; + struct gadc_thermal_info *gti = thermal_zone_device_priv(tz); int val; int ret; diff --git a/drivers/thermal/thermal_mmio.c b/drivers/thermal/thermal_mmio.c index ea616731066c..6845756ad5e7 100644 --- a/drivers/thermal/thermal_mmio.c +++ b/drivers/thermal/thermal_mmio.c @@ -23,7 +23,7 @@ static u32 thermal_mmio_readb(void __iomem *mmio_base) static int thermal_mmio_get_temperature(struct thermal_zone_device *tz, int *temp) { int t; - struct thermal_mmio *sensor = tz->devdata; + struct thermal_mmio *sensor = thermal_zone_device_priv(tz); t = sensor->read_mmio(sensor->mmio_base) & sensor->mask; t *= sensor->factor; diff --git a/drivers/thermal/ti-soc-thermal/ti-thermal-common.c b/drivers/thermal/ti-soc-thermal/ti-thermal-common.c index 8a9055bd376e..3e998c9799bb 100644 --- a/drivers/thermal/ti-soc-thermal/ti-thermal-common.c +++ b/drivers/thermal/ti-soc-thermal/ti-thermal-common.c @@ -68,7 +68,7 @@ static inline int ti_thermal_hotspot_temperature(int t, int s, int c) static inline int __ti_thermal_get_temp(struct thermal_zone_device *tz, int *temp) { struct thermal_zone_device *pcb_tz = NULL; - struct ti_thermal_data *data = tz->devdata; + struct ti_thermal_data *data = thermal_zone_device_priv(tz); struct ti_bandgap *bgp; const struct ti_temp_sensor *s; int ret, tmp, slope, constant; @@ -109,7 +109,7 @@ static inline int __ti_thermal_get_temp(struct thermal_zone_device *tz, int *tem static int __ti_thermal_get_trend(struct thermal_zone_device *tz, int trip, enum thermal_trend *trend) { - struct ti_thermal_data *data = tz->devdata; + struct ti_thermal_data *data = thermal_zone_device_priv(tz); struct ti_bandgap *bgp; int id, tr, ret = 0; diff --git a/drivers/thermal/uniphier_thermal.c b/drivers/thermal/uniphier_thermal.c index 47801841b3f5..aef6119cc004 100644 --- a/drivers/thermal/uniphier_thermal.c +++ b/drivers/thermal/uniphier_thermal.c @@ -187,7 +187,7 @@ static void uniphier_tm_disable_sensor(struct uniphier_tm_dev *tdev) static int uniphier_tm_get_temp(struct thermal_zone_device *tz, int *out_temp) { - struct uniphier_tm_dev *tdev = tz->devdata; + struct uniphier_tm_dev *tdev = thermal_zone_device_priv(tz); struct regmap *map = tdev->regmap; int ret; u32 temp; From patchwork Sun Feb 26 22:53:49 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Lezcano X-Patchwork-Id: 61670 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp2130969wrd; Sun, 26 Feb 2023 14:55:45 -0800 (PST) X-Google-Smtp-Source: AK7set/xqNapg1ZgWGwqF9sKPWrN7fsNenmArhYdQTpNRhYqvuDWNQFYjCevuqV7irwRuzzEPSc5 X-Received: by 2002:a17:90b:148a:b0:233:6d76:27b7 with SMTP id js10-20020a17090b148a00b002336d7627b7mr19625972pjb.3.1677452145062; Sun, 26 Feb 2023 14:55:45 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1677452145; cv=none; d=google.com; s=arc-20160816; b=r+QCNm5hcXtzERrsG2CNLxe4KTd03viurUIuZfxmMraOGnvs/Lc9ZTC2sq9lSO9wJ+ V8GBIacy6F3quMN8TRyoCzUGRtcDZab+awqxitkadyi1ui9NQuBWew9QM9LWqhf9fIRc OtWjbhMdRgDuVaO76PIVAzw1DKp+QGyRJtJH+1OVrQgdbppjvS8m7Sj2QYmNT0odDfSq Db1SDw2g+1GI8/DwbbM1/oTSO6CGM3mv6uqPJkhlZCuC9T7jQeHGO2W29CQ3kA4OmVVL v1Vpc6Fgvh8uYdJoW6hUagzhocxoNQA4qGtp83t5T6JThwgT18cIrYYTvNjrw7poJxZ1 k8qg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=664mQufj36GAinUsmDVRemqvXpqdvf+x4ah+LNp4umE=; b=moiGbpB6fvRmmB1Tjf6YQyJ+Olq5zBO/VlL6sQ9LdioYBPATvNfBATxrh4jvTpGtM7 yrB4zzu2FQobEIrqem3g5C+K5UbOECVn/aMZfJsRS1IPnUphBr4tgf0LtiLr610GGh+e T5P3uwvTx6+GawORVwMR1NhDHnKCXNqGcEvGcm0+XTvE467XbZJgInm5MVi2yXsH4o++ 1Lsi+tvSCfjY5ZM94opZLSbatULCoenICXSO5o6lRC2dlrJXrl6gR5OLI3Aw27nDHSfF A3GqoJ/+0cneLtk30pPqAFe6ARQFLS5Muo514rsJXzF+Kd6yRtvwxz5OS37Ryjm/yFnl eWAQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="Xi1i/CqW"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id x4-20020a63fe44000000b004facc8ab172si5667523pgj.846.2023.02.26.14.55.32; Sun, 26 Feb 2023 14:55:45 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="Xi1i/CqW"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229679AbjBZWy7 (ORCPT + 99 others); Sun, 26 Feb 2023 17:54:59 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33484 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229690AbjBZWy4 (ORCPT ); Sun, 26 Feb 2023 17:54:56 -0500 Received: from mail-wr1-x436.google.com (mail-wr1-x436.google.com [IPv6:2a00:1450:4864:20::436]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 07B3F126CF for ; Sun, 26 Feb 2023 14:54:45 -0800 (PST) Received: by mail-wr1-x436.google.com with SMTP id v16so1610929wrn.0 for ; Sun, 26 Feb 2023 14:54:44 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=664mQufj36GAinUsmDVRemqvXpqdvf+x4ah+LNp4umE=; b=Xi1i/CqWZ9XDyFCiLm1jEzGg1dxTPicCiAjJxOkq5GDsATuyvyV8Y7sK4AyK/MKLrt L3/ZuVg5LlKPrXAtcFdgW4DIhU0lqMEugxT76bLJTM1aQ011rQG3mVxbLvjSumaichLn W6RO2XT48xK58xTU+imWZ5EXauLjSjQ0IAQPtJWaGJa6g95u72fF6mMNYRYB8Wp/PQfR iJ00ypajR6u+JlX6p8Phostq3dMYooDvxeqZQ8s7vwMeC7DcAS+j2xBXxV9oC/OHCUSD /Evp9b7ZJDXeG96mUGeeeDJ8A4OfnaQ6B3akTIPxP7y460jcsNAXlM1UuVyYiBR3OX6w /MpA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=664mQufj36GAinUsmDVRemqvXpqdvf+x4ah+LNp4umE=; b=5l3c8uW8F3CkWXCWTs5VObnbrU8+o+XrDGqLjf8Z6osYt/er8Uqo7wEE6M9WnHrv9Q aHA8Yx6iAuWB6Rlj54IR+fDn/YSNdM5AWPWf46GX3l2Xy84lePgExpDXC+PfTlt3jLCJ 3Z6XTp1deSOLr2T8AGdpGoZiqjx6NZZGJI+nR6vOZSnAfi27n4jjmcCmTa+g7hYH0GlM SYTJ3O/k/zds1xDf4OY5z+rxMl3dBiTx/cg6k78iHRr+oRyn4XhrVU3njCy+xzfX1iNG iB08kVTy8ucK9t5LIImA9OioKtwOSJuW1gsZ5Q0Rf82EWvTw7oBVbpgWXG2GzujIMaWb 26Uw== X-Gm-Message-State: AO0yUKUdUSJI0+KUus5QOxLybgrFTaXNPzPyfjxjMUhpYY/HO0X3kWLx MFwm5235FNIEJ8yElbC2vcA/Dw== X-Received: by 2002:a5d:4e47:0:b0:2c8:840:26ea with SMTP id r7-20020a5d4e47000000b002c8084026eamr6703396wrt.12.1677452084449; Sun, 26 Feb 2023 14:54:44 -0800 (PST) Received: from mai.box.freepro.com ([2a05:6e02:1041:c10:8baa:6b32:391b:62de]) by smtp.gmail.com with ESMTPSA id d10-20020a05600c3aca00b003eb369abd92sm6138074wms.2.2023.02.26.14.54.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 26 Feb 2023 14:54:44 -0800 (PST) From: Daniel Lezcano To: rafael@kernel.org, daniel.lezcano@linaro.org Cc: linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, Guenter Roeck , Mark Brown , "Rafael J . Wysocki" , Jean Delvare , linux-hwmon@vger.kernel.org (open list:HARDWARE MONITORING) Subject: [PATCH v3 03/20] thermal/core: Use the thermal zone 'devdata' accessor in hwmon located drivers Date: Sun, 26 Feb 2023 23:53:49 +0100 Message-Id: <20230226225406.979703-4-daniel.lezcano@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230226225406.979703-1-daniel.lezcano@linaro.org> References: <20230226225406.979703-1-daniel.lezcano@linaro.org> MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1758936060240098561?= X-GMAIL-MSGID: =?utf-8?q?1758936060240098561?= The thermal zone device structure is exposed to the different drivers and obviously they access the internals while that should be restricted to the core thermal code. In order to self-encapsulate the thermal core code, we need to prevent the drivers accessing directly the thermal zone structure and provide accessor functions to deal with. Use the devdata accessor introduced in the previous patch. No functional changes intended. Signed-off-by: Daniel Lezcano Acked-by: Guenter Roeck #hwmon Acked-by: Mark Brown Acked-by: Rafael J. Wysocki --- drivers/hwmon/hwmon.c | 4 ++-- drivers/hwmon/pmbus/pmbus_core.c | 2 +- drivers/hwmon/scmi-hwmon.c | 2 +- drivers/hwmon/scpi-hwmon.c | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/hwmon/hwmon.c b/drivers/hwmon/hwmon.c index 33edb5c02f7d..3adf5c3c75ed 100644 --- a/drivers/hwmon/hwmon.c +++ b/drivers/hwmon/hwmon.c @@ -154,7 +154,7 @@ static DEFINE_IDA(hwmon_ida); #ifdef CONFIG_THERMAL_OF static int hwmon_thermal_get_temp(struct thermal_zone_device *tz, int *temp) { - struct hwmon_thermal_data *tdata = tz->devdata; + struct hwmon_thermal_data *tdata = thermal_zone_device_priv(tz); struct hwmon_device *hwdev = to_hwmon_device(tdata->dev); int ret; long t; @@ -171,7 +171,7 @@ static int hwmon_thermal_get_temp(struct thermal_zone_device *tz, int *temp) static int hwmon_thermal_set_trips(struct thermal_zone_device *tz, int low, int high) { - struct hwmon_thermal_data *tdata = tz->devdata; + struct hwmon_thermal_data *tdata = thermal_zone_device_priv(tz); struct hwmon_device *hwdev = to_hwmon_device(tdata->dev); const struct hwmon_chip_info *chip = hwdev->chip; const struct hwmon_channel_info **info = chip->info; diff --git a/drivers/hwmon/pmbus/pmbus_core.c b/drivers/hwmon/pmbus/pmbus_core.c index 95e95783972a..e39a327ac2a1 100644 --- a/drivers/hwmon/pmbus/pmbus_core.c +++ b/drivers/hwmon/pmbus/pmbus_core.c @@ -1272,7 +1272,7 @@ struct pmbus_thermal_data { static int pmbus_thermal_get_temp(struct thermal_zone_device *tz, int *temp) { - struct pmbus_thermal_data *tdata = tz->devdata; + struct pmbus_thermal_data *tdata = thermal_zone_device_priv(tz); struct pmbus_sensor *sensor = tdata->sensor; struct pmbus_data *pmbus_data = tdata->pmbus_data; struct i2c_client *client = to_i2c_client(pmbus_data->dev); diff --git a/drivers/hwmon/scmi-hwmon.c b/drivers/hwmon/scmi-hwmon.c index e192f0c67146..046ac157749d 100644 --- a/drivers/hwmon/scmi-hwmon.c +++ b/drivers/hwmon/scmi-hwmon.c @@ -141,7 +141,7 @@ static int scmi_hwmon_thermal_get_temp(struct thermal_zone_device *tz, { int ret; long value; - struct scmi_thermal_sensor *th_sensor = tz->devdata; + struct scmi_thermal_sensor *th_sensor = thermal_zone_device_priv(tz); ret = scmi_hwmon_read_scaled_value(th_sensor->ph, th_sensor->info, &value); diff --git a/drivers/hwmon/scpi-hwmon.c b/drivers/hwmon/scpi-hwmon.c index 4d75385f7d5e..121e5e9f487f 100644 --- a/drivers/hwmon/scpi-hwmon.c +++ b/drivers/hwmon/scpi-hwmon.c @@ -64,7 +64,7 @@ static void scpi_scale_reading(u64 *value, struct sensor_data *sensor) static int scpi_read_temp(struct thermal_zone_device *tz, int *temp) { - struct scpi_thermal_zone *zone = tz->devdata; + struct scpi_thermal_zone *zone = thermal_zone_device_priv(tz); struct scpi_sensors *scpi_sensors = zone->scpi_sensors; struct scpi_ops *scpi_ops = scpi_sensors->scpi_ops; struct sensor_data *sensor = &scpi_sensors->data[zone->sensor_id]; From patchwork Sun Feb 26 22:53:50 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Lezcano X-Patchwork-Id: 61672 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp2131074wrd; Sun, 26 Feb 2023 14:56:08 -0800 (PST) X-Google-Smtp-Source: AK7set/LxDp5iH9c6rUZsSx3J9UvAzbQs+X8tuKjR3VSNEoag3vgt3OUu+P2rqwirxJhPV6kQMTp X-Received: by 2002:a17:902:da83:b0:19a:af51:c27b with SMTP id j3-20020a170902da8300b0019aaf51c27bmr24273055plx.2.1677452167641; Sun, 26 Feb 2023 14:56:07 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1677452167; cv=none; d=google.com; s=arc-20160816; b=V4QfSop+g/WEDMpb7NhOskHo61TCj5dyfyjVjT9Y1Iv5eZKsG4JO2FPW4k+C4zJfjk L4IdmjZisV9xC0n60noUbJtHFr7Gvg4BEuWM6892yBUDobJ458q9+e0KLL+91BdOQxAP kr1H7+npveWFoV6PzRGxZsaKpyH5ttG9MMNLwodAfaLAAxf1tlmUllKls3F/iYpB+shE wHnFdoxO4yWfDExqLBXzBxyraswi8B4qZbLjawYozJ2NR21OiUA02YVRtPqJepPeTtOv yLLMPIq4MhJ6H8/r+vO6zXUeuoEfBfmGGFT9Z/FKhi7/IiRndyrRdmhMAKrK932q2YXC 7OHg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=oIfl5ecpE8cMxQAnIWz+2/cYoWx8q+m0Q2auH1OfSio=; b=h5H8vvDTtUG1bTgXaa74PHgtklkDqvKc0AZgdiL/iv9z/Pk5VY1D+23/GGMwT7WCYG 6M80UbK71mlxISgxWO6ho9pYUZsh4EwQQQwHFbRMHbJm6wvEX292Dzv6dSwQl7G/Pxbp UsAmmOsVGhtHffaHwkVHb0xrYKaWnA9ptQmAn6hPcU+c3aq99TR7FJ2vxPGTOiPHcxTR ZeJCKgSFmI/1NgOYjBeJpL5i3p1JdsvJ/dgLKECze5u0E05I8LpODcU2BRTj3+cCipuB RRHJrlEv/5x3YuYDvPAguqeOHJ/vzGQJ5pHe2Ph1YRVY4AAzm2AxEyX+TnAnEOuvn1Ju to5w== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=wKhGC5zK; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id ko3-20020a17090307c300b00196263e2942si5444956plb.497.2023.02.26.14.55.54; Sun, 26 Feb 2023 14:56:07 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=wKhGC5zK; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229671AbjBZWzQ (ORCPT + 99 others); Sun, 26 Feb 2023 17:55:16 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33858 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229701AbjBZWzN (ORCPT ); Sun, 26 Feb 2023 17:55:13 -0500 Received: from mail-wm1-x333.google.com (mail-wm1-x333.google.com [IPv6:2a00:1450:4864:20::333]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B8E8418ABB for ; Sun, 26 Feb 2023 14:54:50 -0800 (PST) Received: by mail-wm1-x333.google.com with SMTP id o11-20020a05600c4fcb00b003eb33ea29a8so2284337wmq.1 for ; Sun, 26 Feb 2023 14:54:50 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=oIfl5ecpE8cMxQAnIWz+2/cYoWx8q+m0Q2auH1OfSio=; b=wKhGC5zK0RhMS7a2WDVuw7YBZuJZ6Axd7LEZEkJdJOlk6AHYhMZvqjNjVmMCzcKSKu 1xZ3hb6UM7TVWpZfy2n9PRJIZeQYiGqQ/DsM0zZ4YnZe8XW/ypDwErLiC4G+kHl0z3QN eV7mXlJmp5XPPO0B7oSfi9tyzBKCHo89wrEQzcrA8i7XCnt3PkCHsJzshnUkCd6BJbgh yZK5Z45BzhLXwzUYrTnaATk9bIIf2rpjajI71GMTwkgVezA4QeO18jJk+3vlNIfxOZYS /+Y3rSxKSC+ZNc6DtLZ4bLkNgml7GZjHpgLpLCzp1C4ZNaWoV4e17WM9oUleVsgjjokW VdMQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=oIfl5ecpE8cMxQAnIWz+2/cYoWx8q+m0Q2auH1OfSio=; b=p7zxwWJt+Ol46gNB11uTOLd0WBVMIuYKRYVLH6RJW8QZ3eUQX7uEmEJxgACQBk9bNZ dVptLqV92GYUPer8Naf9d+G+FrFLg+PvRzWQJxngnHTf5jwomwnDusd76/zop9Vkjf9E W3Rzt4KTmop9qun8WUq+Ifzm2mxLiqlgSLBoHFaGl3QnuXMRSLUAxIVHvlc4XXfBLWIB 68Kq3udFFmJeRjtqBKQnED0pHCiflhYWToQAQMG1mNfLqUNSpd6vVlzOWtlemSywiZOx grdY4VtkvS2VsqLmH/C6iAXdU23+Dd2/iJZ/v1prksTborFAoGno9I11vK+Hq8uZJm5T 2HLQ== X-Gm-Message-State: AO0yUKWQBwwP6Dr7D5k9QWeTFx2jTUM6rFnzixowKLiYMMGCTSoVsbvw PfF3gWKuAoGR5RUAdhI3iqKozw== X-Received: by 2002:a05:600c:331b:b0:3eb:2da4:f32d with SMTP id q27-20020a05600c331b00b003eb2da4f32dmr6406441wmp.26.1677452088585; Sun, 26 Feb 2023 14:54:48 -0800 (PST) Received: from mai.box.freepro.com ([2a05:6e02:1041:c10:8baa:6b32:391b:62de]) by smtp.gmail.com with ESMTPSA id d10-20020a05600c3aca00b003eb369abd92sm6138074wms.2.2023.02.26.14.54.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 26 Feb 2023 14:54:48 -0800 (PST) From: Daniel Lezcano To: rafael@kernel.org, daniel.lezcano@linaro.org Cc: linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, Mark Brown , Ido Schimmel , Gregory Greenman , Sebastian Reichel , "Rafael J . Wysocki" , Zhang Rui , Len Brown , Damien Le Moal , Shawn Guo , Sascha Hauer , Pengutronix Kernel Team , Fabio Estevam , NXP Linux Team , Jonathan Cameron , Lars-Peter Clausen , Chen-Yu Tsai , Jernej Skrabec , Samuel Holland , Dmitry Torokhov , Raju Rangoju , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Petr Machata , Kalle Valo , Sebastian Reichel , Liam Girdwood , linux-acpi@vger.kernel.org (open list:ACPI THERMAL DRIVER), linux-ide@vger.kernel.org (open list:LIBATA SUBSYSTEM (Serial and Parallel ATA drivers)), linux-arm-kernel@lists.infradead.org (moderated list:ARM/FREESCALE IMX / MXC ARM ARCHITECTURE), linux-iio@vger.kernel.org (open list:IIO SUBSYSTEM AND DRIVERS), linux-sunxi@lists.linux.dev (open list:ARM/Allwinner sunXi SoC support), linux-input@vger.kernel.org (open list:INPUT (KEYBOARD, MOUSE, JOYSTICK , TOUCHSCREEN)...), netdev@vger.kernel.org (open list:CXGB4 ETHERNET DRIVER (CXGB4)), linux-wireless@vger.kernel.org (open list:INTEL WIRELESS WIFI LINK (iwlwifi)) Subject: [PATCH v3 04/20] thermal/core: Use the thermal zone 'devdata' accessor in remaining drivers Date: Sun, 26 Feb 2023 23:53:50 +0100 Message-Id: <20230226225406.979703-5-daniel.lezcano@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230226225406.979703-1-daniel.lezcano@linaro.org> References: <20230226225406.979703-1-daniel.lezcano@linaro.org> MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1758936083706949063?= X-GMAIL-MSGID: =?utf-8?q?1758936083706949063?= The thermal zone device structure is exposed to the different drivers and obviously they access the internals while that should be restricted to the core thermal code. In order to self-encapsulate the thermal core code, we need to prevent the drivers accessing directly the thermal zone structure and provide accessor functions to deal with. Use the devdata accessor introduced in the previous patch. No functional changes intended. Signed-off-by: Daniel Lezcano Acked-by: Mark Brown Reviewed-by: Ido Schimmel #mlxsw Acked-by: Gregory Greenman #iwlwifi Acked-by: Sebastian Reichel #power_supply Acked-by: Rafael J. Wysocki Acked-by: Damien Le Moal --- drivers/acpi/thermal.c | 16 ++++++++-------- drivers/ata/ahci_imx.c | 2 +- drivers/iio/adc/sun4i-gpadc-iio.c | 2 +- drivers/input/touchscreen/sun4i-ts.c | 2 +- .../net/ethernet/chelsio/cxgb4/cxgb4_thermal.c | 2 +- .../net/ethernet/mellanox/mlxsw/core_thermal.c | 14 +++++++------- drivers/net/wireless/intel/iwlwifi/mvm/tt.c | 4 ++-- drivers/power/supply/power_supply_core.c | 2 +- drivers/regulator/max8973-regulator.c | 2 +- 9 files changed, 23 insertions(+), 23 deletions(-) diff --git a/drivers/acpi/thermal.c b/drivers/acpi/thermal.c index 0b4b844f9d4c..392b73b3e269 100644 --- a/drivers/acpi/thermal.c +++ b/drivers/acpi/thermal.c @@ -498,7 +498,7 @@ static int acpi_thermal_get_trip_points(struct acpi_thermal *tz) static int thermal_get_temp(struct thermal_zone_device *thermal, int *temp) { - struct acpi_thermal *tz = thermal->devdata; + struct acpi_thermal *tz = thermal_zone_device_priv(thermal); int result; if (!tz) @@ -516,7 +516,7 @@ static int thermal_get_temp(struct thermal_zone_device *thermal, int *temp) static int thermal_get_trip_type(struct thermal_zone_device *thermal, int trip, enum thermal_trip_type *type) { - struct acpi_thermal *tz = thermal->devdata; + struct acpi_thermal *tz = thermal_zone_device_priv(thermal); int i; if (!tz || trip < 0) @@ -560,7 +560,7 @@ static int thermal_get_trip_type(struct thermal_zone_device *thermal, static int thermal_get_trip_temp(struct thermal_zone_device *thermal, int trip, int *temp) { - struct acpi_thermal *tz = thermal->devdata; + struct acpi_thermal *tz = thermal_zone_device_priv(thermal); int i; if (!tz || trip < 0) @@ -613,7 +613,7 @@ static int thermal_get_trip_temp(struct thermal_zone_device *thermal, static int thermal_get_crit_temp(struct thermal_zone_device *thermal, int *temperature) { - struct acpi_thermal *tz = thermal->devdata; + struct acpi_thermal *tz = thermal_zone_device_priv(thermal); if (tz->trips.critical.flags.valid) { *temperature = deci_kelvin_to_millicelsius_with_offset( @@ -628,7 +628,7 @@ static int thermal_get_crit_temp(struct thermal_zone_device *thermal, static int thermal_get_trend(struct thermal_zone_device *thermal, int trip, enum thermal_trend *trend) { - struct acpi_thermal *tz = thermal->devdata; + struct acpi_thermal *tz = thermal_zone_device_priv(thermal); enum thermal_trip_type type; int i; @@ -670,7 +670,7 @@ static int thermal_get_trend(struct thermal_zone_device *thermal, static void acpi_thermal_zone_device_hot(struct thermal_zone_device *thermal) { - struct acpi_thermal *tz = thermal->devdata; + struct acpi_thermal *tz = thermal_zone_device_priv(thermal); acpi_bus_generate_netlink_event(tz->device->pnp.device_class, dev_name(&tz->device->dev), @@ -679,7 +679,7 @@ static void acpi_thermal_zone_device_hot(struct thermal_zone_device *thermal) static void acpi_thermal_zone_device_critical(struct thermal_zone_device *thermal) { - struct acpi_thermal *tz = thermal->devdata; + struct acpi_thermal *tz = thermal_zone_device_priv(thermal); acpi_bus_generate_netlink_event(tz->device->pnp.device_class, dev_name(&tz->device->dev), @@ -693,7 +693,7 @@ static int acpi_thermal_cooling_device_cb(struct thermal_zone_device *thermal, bool bind) { struct acpi_device *device = cdev->devdata; - struct acpi_thermal *tz = thermal->devdata; + struct acpi_thermal *tz = thermal_zone_device_priv(thermal); struct acpi_device *dev; acpi_handle handle; int i; diff --git a/drivers/ata/ahci_imx.c b/drivers/ata/ahci_imx.c index a950767f7948..e45e91f5e703 100644 --- a/drivers/ata/ahci_imx.c +++ b/drivers/ata/ahci_imx.c @@ -418,7 +418,7 @@ static int __sata_ahci_read_temperature(void *dev, int *temp) static int sata_ahci_read_temperature(struct thermal_zone_device *tz, int *temp) { - return __sata_ahci_read_temperature(tz->devdata, temp); + return __sata_ahci_read_temperature(thermal_zone_device_priv(tz), temp); } static ssize_t sata_ahci_show_temp(struct device *dev, diff --git a/drivers/iio/adc/sun4i-gpadc-iio.c b/drivers/iio/adc/sun4i-gpadc-iio.c index a6ade70dedf8..a5322550c422 100644 --- a/drivers/iio/adc/sun4i-gpadc-iio.c +++ b/drivers/iio/adc/sun4i-gpadc-iio.c @@ -414,7 +414,7 @@ static int sun4i_gpadc_runtime_resume(struct device *dev) static int sun4i_gpadc_get_temp(struct thermal_zone_device *tz, int *temp) { - struct sun4i_gpadc_iio *info = tz->devdata; + struct sun4i_gpadc_iio *info = thermal_zone_device_priv(tz); int val, scale, offset; if (sun4i_gpadc_temp_read(info->indio_dev, &val)) diff --git a/drivers/input/touchscreen/sun4i-ts.c b/drivers/input/touchscreen/sun4i-ts.c index 73eb8f80be6e..1117fba30020 100644 --- a/drivers/input/touchscreen/sun4i-ts.c +++ b/drivers/input/touchscreen/sun4i-ts.c @@ -194,7 +194,7 @@ static int sun4i_get_temp(const struct sun4i_ts_data *ts, int *temp) static int sun4i_get_tz_temp(struct thermal_zone_device *tz, int *temp) { - return sun4i_get_temp(tz->devdata, temp); + return sun4i_get_temp(thermal_zone_device_priv(tz), temp); } static const struct thermal_zone_device_ops sun4i_ts_tz_ops = { diff --git a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_thermal.c b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_thermal.c index 95e1b415ba13..dea9d2907666 100644 --- a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_thermal.c +++ b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_thermal.c @@ -12,7 +12,7 @@ static int cxgb4_thermal_get_temp(struct thermal_zone_device *tzdev, int *temp) { - struct adapter *adap = tzdev->devdata; + struct adapter *adap = thermal_zone_device_priv(tzdev); u32 param, val; int ret; diff --git a/drivers/net/ethernet/mellanox/mlxsw/core_thermal.c b/drivers/net/ethernet/mellanox/mlxsw/core_thermal.c index c5240d38c9db..722e4a40afef 100644 --- a/drivers/net/ethernet/mellanox/mlxsw/core_thermal.c +++ b/drivers/net/ethernet/mellanox/mlxsw/core_thermal.c @@ -201,7 +201,7 @@ mlxsw_thermal_module_trips_update(struct device *dev, struct mlxsw_core *core, static int mlxsw_thermal_bind(struct thermal_zone_device *tzdev, struct thermal_cooling_device *cdev) { - struct mlxsw_thermal *thermal = tzdev->devdata; + struct mlxsw_thermal *thermal = thermal_zone_device_priv(tzdev); struct device *dev = thermal->bus_info->dev; int i, err; @@ -227,7 +227,7 @@ static int mlxsw_thermal_bind(struct thermal_zone_device *tzdev, static int mlxsw_thermal_unbind(struct thermal_zone_device *tzdev, struct thermal_cooling_device *cdev) { - struct mlxsw_thermal *thermal = tzdev->devdata; + struct mlxsw_thermal *thermal = thermal_zone_device_priv(tzdev); struct device *dev = thermal->bus_info->dev; int i; int err; @@ -249,7 +249,7 @@ static int mlxsw_thermal_unbind(struct thermal_zone_device *tzdev, static int mlxsw_thermal_get_temp(struct thermal_zone_device *tzdev, int *p_temp) { - struct mlxsw_thermal *thermal = tzdev->devdata; + struct mlxsw_thermal *thermal = thermal_zone_device_priv(tzdev); struct device *dev = thermal->bus_info->dev; char mtmp_pl[MLXSW_REG_MTMP_LEN]; int temp; @@ -281,7 +281,7 @@ static struct thermal_zone_device_ops mlxsw_thermal_ops = { static int mlxsw_thermal_module_bind(struct thermal_zone_device *tzdev, struct thermal_cooling_device *cdev) { - struct mlxsw_thermal_module *tz = tzdev->devdata; + struct mlxsw_thermal_module *tz = thermal_zone_device_priv(tzdev); struct mlxsw_thermal *thermal = tz->parent; int i, j, err; @@ -310,7 +310,7 @@ static int mlxsw_thermal_module_bind(struct thermal_zone_device *tzdev, static int mlxsw_thermal_module_unbind(struct thermal_zone_device *tzdev, struct thermal_cooling_device *cdev) { - struct mlxsw_thermal_module *tz = tzdev->devdata; + struct mlxsw_thermal_module *tz = thermal_zone_device_priv(tzdev); struct mlxsw_thermal *thermal = tz->parent; int i; int err; @@ -356,7 +356,7 @@ mlxsw_thermal_module_temp_and_thresholds_get(struct mlxsw_core *core, static int mlxsw_thermal_module_temp_get(struct thermal_zone_device *tzdev, int *p_temp) { - struct mlxsw_thermal_module *tz = tzdev->devdata; + struct mlxsw_thermal_module *tz = thermal_zone_device_priv(tzdev); struct mlxsw_thermal *thermal = tz->parent; int temp, crit_temp, emerg_temp; struct device *dev; @@ -391,7 +391,7 @@ static struct thermal_zone_device_ops mlxsw_thermal_module_ops = { static int mlxsw_thermal_gearbox_temp_get(struct thermal_zone_device *tzdev, int *p_temp) { - struct mlxsw_thermal_module *tz = tzdev->devdata; + struct mlxsw_thermal_module *tz = thermal_zone_device_priv(tzdev); struct mlxsw_thermal *thermal = tz->parent; char mtmp_pl[MLXSW_REG_MTMP_LEN]; u16 index; diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/tt.c b/drivers/net/wireless/intel/iwlwifi/mvm/tt.c index 232c200af38f..354d95222b1b 100644 --- a/drivers/net/wireless/intel/iwlwifi/mvm/tt.c +++ b/drivers/net/wireless/intel/iwlwifi/mvm/tt.c @@ -615,7 +615,7 @@ int iwl_mvm_send_temp_report_ths_cmd(struct iwl_mvm *mvm) static int iwl_mvm_tzone_get_temp(struct thermal_zone_device *device, int *temperature) { - struct iwl_mvm *mvm = (struct iwl_mvm *)device->devdata; + struct iwl_mvm *mvm = thermal_zone_device_priv(device); int ret; int temp; @@ -641,7 +641,7 @@ static int iwl_mvm_tzone_get_temp(struct thermal_zone_device *device, static int iwl_mvm_tzone_set_trip_temp(struct thermal_zone_device *device, int trip, int temp) { - struct iwl_mvm *mvm = (struct iwl_mvm *)device->devdata; + struct iwl_mvm *mvm = thermal_zone_device_priv(device); struct iwl_mvm_thermal_device *tzone; int ret; diff --git a/drivers/power/supply/power_supply_core.c b/drivers/power/supply/power_supply_core.c index 7c790c41e2fe..83fd19079d8b 100644 --- a/drivers/power/supply/power_supply_core.c +++ b/drivers/power/supply/power_supply_core.c @@ -1142,7 +1142,7 @@ static int power_supply_read_temp(struct thermal_zone_device *tzd, int ret; WARN_ON(tzd == NULL); - psy = tzd->devdata; + psy = thermal_zone_device_priv(tzd); ret = power_supply_get_property(psy, POWER_SUPPLY_PROP_TEMP, &val); if (ret) return ret; diff --git a/drivers/regulator/max8973-regulator.c b/drivers/regulator/max8973-regulator.c index 7e00a45db26a..303426135276 100644 --- a/drivers/regulator/max8973-regulator.c +++ b/drivers/regulator/max8973-regulator.c @@ -436,7 +436,7 @@ static int max8973_init_dcdc(struct max8973_chip *max, static int max8973_thermal_read_temp(struct thermal_zone_device *tz, int *temp) { - struct max8973_chip *mchip = tz->devdata; + struct max8973_chip *mchip = thermal_zone_device_priv(tz); unsigned int val; int ret; From patchwork Sun Feb 26 22:53:51 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Lezcano X-Patchwork-Id: 61673 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp2131103wrd; Sun, 26 Feb 2023 14:56:13 -0800 (PST) X-Google-Smtp-Source: AK7set+KgVkITaOE/J0S8979A+ZblvVDNFItzrgOJKrePDvkRd2QJjdd6oG5asMLfesXpLFpEGGE X-Received: by 2002:a17:902:e741:b0:19c:f005:92d5 with SMTP id p1-20020a170902e74100b0019cf00592d5mr5991179plf.5.1677452173113; Sun, 26 Feb 2023 14:56:13 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1677452173; cv=none; d=google.com; s=arc-20160816; b=BN2IrBaxLlSuTKoTSVi8TQ1erE+VbueYrwUSYhWRf9bK/eZ94VXx7503NTh7fxHUQb MTNtm9N1vQiRlsLS1eB/Da/bLotymjjFHq/RTqDjMTpCzZNxhnzc7yOzHIvQpkVSbyHc owkNVj1t0uWKsI09gIeO2GHRO7LCOrT2CYDxa/nxQqmGdlUpXsbCR0MJ7GGT8uJlZDtA YzWQDYYFrI25AIEMLgs/zsfiqJoUCM111wpZiwybjJSwmCPJApwnaG2kjlCJFERUc7mI o78Wk8NOkGVHZRfJz/9G6r6nIWFnCSvaHTG2Q9/hxPC3kEua6m8QQ36VSFYFyfOM30i8 u4mg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=8cRPoTQKkI6Vh2gx5bELOPsRnRzqaEtxSxLlrGiyoRc=; b=SUTUYm/TaNdypDhLBh3NdIDVL/0FXuAbKqhBUIRpFr6yssk2c3SS1oWQFjBkWzLZtt BkOlch0AQ/c6tKqRDrpg/3o0MelL31HepJltofkZxwAsOz+BufD0OfhNLYwo2/OKoW6P R1JfFZi+EwnlIDej8AMzdgUaonNE7TKF0Zn6t6YfypmnwUS0ciYImmvF4Ats3rJ1vUKo PI6lJTCzjI105MtGn3qCOEkakb/UEI+haCHU2dMBIIRyL3bhxU3UqzeuE4S223B9GSFX TPk9SBXLm8tF0DSMpNwbZF1+fGqADqsq/svRhnE6oKdOZHHejpoYCm/K6QR6vKUHgjrd 7wNg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=AwlI9+h3; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id k2-20020a170902d58200b0019cd6d089b7si5706398plh.385.2023.02.26.14.55.59; Sun, 26 Feb 2023 14:56:13 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=AwlI9+h3; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229780AbjBZWzk (ORCPT + 99 others); Sun, 26 Feb 2023 17:55:40 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33896 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229698AbjBZWzP (ORCPT ); Sun, 26 Feb 2023 17:55:15 -0500 Received: from mail-wm1-x32b.google.com (mail-wm1-x32b.google.com [IPv6:2a00:1450:4864:20::32b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E654516AE7 for ; Sun, 26 Feb 2023 14:54:52 -0800 (PST) Received: by mail-wm1-x32b.google.com with SMTP id p26so3144006wmc.4 for ; Sun, 26 Feb 2023 14:54:52 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=8cRPoTQKkI6Vh2gx5bELOPsRnRzqaEtxSxLlrGiyoRc=; b=AwlI9+h33C/jXhy9hGSXpoqDifHlXB8N01uteX63jb4g3pYnKDNsjEM+g14J292EY4 0ifvKScwydnHi5F0t1xAVhPNiB9YcSaXLOWwFt4i540arg/Vz2izeTM58KqljbHjJwtm ZdO1l9lACbRH1MhmytHdH5lMDDN7rLpvv5tHlx6Rv0jz3+JCgCcXBrvrKpJgNp6yIvOF mgf1fLSCbnzdYAG9xELuDZgPJArkFTFx1FN8LNAyDegDEYewE0oprXkWD7JAzDT32Ogv PV9EP3MD5djjxLq6NlXU1o7gn7HuaRtRjcKEfPz5OLgBblTwzpj8WIWQjeUnuEUH8yOv rXPA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=8cRPoTQKkI6Vh2gx5bELOPsRnRzqaEtxSxLlrGiyoRc=; b=LmngzSwW9tfcrrVwXJU7G1QLo1lw/bVaNrd/pc9hKTJOypn4PTkZq9fY8lK62D+khf XLQvypS0hC2P08pm0bV+SXFOvIVfkP/TFsiy5vv1d22z01zZYIkgGkBlFO2GLK1bhdrP L2GFhMEh6nqnvHQb+XxNZE0D2UrbAFTpg5s40etTr29Wihm6669ZkVFbt5Bgb3xSogV9 r4xGPbORf5tgklBEH/558VcsoA1DhKse3dKLWwxVoLTANQ1lEnm2J7xDK+4Bj5GYncfd j3hTNnM/2d141uJO+kCMReobSmScfa1iP/ZANK3Qw1SIcdsjgK2Jb0NlpiqumUJnACE5 dW/A== X-Gm-Message-State: AO0yUKVDCqZ9ymvwnjP2wIpulZHYad7svhFTkgxvrS/VJtmMflBqbb2L qw0QX3Lg5VKaXjRJ+kT+1axcpg== X-Received: by 2002:a05:600c:4aa7:b0:3e2:66b:e90e with SMTP id b39-20020a05600c4aa700b003e2066be90emr12139451wmp.10.1677452089802; Sun, 26 Feb 2023 14:54:49 -0800 (PST) Received: from mai.box.freepro.com ([2a05:6e02:1041:c10:8baa:6b32:391b:62de]) by smtp.gmail.com with ESMTPSA id d10-20020a05600c3aca00b003eb369abd92sm6138074wms.2.2023.02.26.14.54.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 26 Feb 2023 14:54:49 -0800 (PST) From: Daniel Lezcano To: rafael@kernel.org, daniel.lezcano@linaro.org Cc: linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, "Rafael J . Wysocki" , Amit Kucheria , Zhang Rui Subject: [PATCH v3 05/20] thermal/core: Show a debug message when get_temp() fails Date: Sun, 26 Feb 2023 23:53:51 +0100 Message-Id: <20230226225406.979703-6-daniel.lezcano@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230226225406.979703-1-daniel.lezcano@linaro.org> References: <20230226225406.979703-1-daniel.lezcano@linaro.org> MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1758936089587210219?= X-GMAIL-MSGID: =?utf-8?q?1758936089587210219?= The different thermal drivers are showing an error in case the get_temp() fails. Actually no traces should be displayed in the backend ops but in the call site of this ops. Furthermore, the message is often a dev_dbg message where the tz->device is used, thus using the internal of the structure from the driver. Show a debug message if the thermal_zone_get_temp() fails to read the sensor temperature, so code showing the message is factored out and the tz->device accesss is in the scope of the thermal core framework. Signed-off-by: Daniel Lezcano Acked-by: Rafael J. Wysocki --- drivers/thermal/thermal_helpers.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/thermal/thermal_helpers.c b/drivers/thermal/thermal_helpers.c index 0f648131b0b5..9558339f5633 100644 --- a/drivers/thermal/thermal_helpers.c +++ b/drivers/thermal/thermal_helpers.c @@ -107,6 +107,9 @@ int __thermal_zone_get_temp(struct thermal_zone_device *tz, int *temp) *temp = tz->emul_temperature; } + if (ret) + dev_dbg(&tz->device, "Failed to get temperature: %d\n", ret); + return ret; } From patchwork Sun Feb 26 22:53:52 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Lezcano X-Patchwork-Id: 61676 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp2131200wrd; Sun, 26 Feb 2023 14:56:30 -0800 (PST) X-Google-Smtp-Source: AK7set82LLuXNkwyU43jaAGlhHjOrU/yPRq1lo8BR6RMqkAR2OG4ZB83B7um3foPq2t7uIumaXWP X-Received: by 2002:a05:6a00:2a7:b0:5d1:bbd2:7604 with SMTP id q7-20020a056a0002a700b005d1bbd27604mr18118712pfs.2.1677452190226; Sun, 26 Feb 2023 14:56:30 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1677452190; cv=none; d=google.com; s=arc-20160816; b=ZqLThxXXeGpqqOdTA2w1VwD4y1Ue3aKVOssDVQGyx+ygS3oP0PUUh1j1qzAf9Rd+Df ChwV05ksa2j9xC4X1gqPp2qO8q6zMR2+rIVTt3CYQNffCeDvTef8icnj0rmwhQqyMsDm uERJA1fUW86I7HzVFuPRKpFK5o3dDiMeaFhNXoxpkWgvFYdc5gf/xBisw3a/Mt7UwYCv 3Y1wXbFlqY4KxlpnpF8V7ZG7WrLS8YWvQIF93hqdEc4wIR5JKZjJKB26gKcl2dGueRDN PjHWYhaXGZckVITGPPXlia+56FEPbIvdpqD1F/JGWQpAC5vog+zVceIS2NK0PTHdIYoT UgjQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=mJAcPQCfOIHAL+8wWJqUVZlzdFUPTSOR65Nvh+pIwYw=; b=qEOn0yV3QyXSo8i/Qexqo/aFGDWcLnjevDTurQFUMaEiUQui5Fcb1at+oyTZUQ3mtz PkjsikkyutGQiFrjK/B/ayFCxQtGe5ndq8BxG0oY45jW/ZLzXfnZdhSfzadLKAhNfy7s 2z9yfvnf7AXvqUYLyJVnPcEkFZ179HoqgiAhrwkq0iB61obZLGSAkZ/IghE9hG82ZOig f1S7x+Ehufy2gS1YjOjd+k1CqQaIOynBFEVugCy/m5BAno7s72gEyvSHf6yD9XtoK5+9 To82/admESh+46NWzEws3bmsLDs8caWVvZ6VG+3vfDEPRX84/KCjYZ0pmrXyYdax2xnc 4YCg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Ck0GBCWF; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id f81-20020a623854000000b005a8d595767asi5021096pfa.252.2023.02.26.14.56.17; Sun, 26 Feb 2023 14:56:30 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Ck0GBCWF; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229846AbjBZWzp (ORCPT + 99 others); Sun, 26 Feb 2023 17:55:45 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34170 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229753AbjBZWzY (ORCPT ); Sun, 26 Feb 2023 17:55:24 -0500 Received: from mail-wm1-x335.google.com (mail-wm1-x335.google.com [IPv6:2a00:1450:4864:20::335]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1926212BC3 for ; Sun, 26 Feb 2023 14:55:01 -0800 (PST) Received: by mail-wm1-x335.google.com with SMTP id d41-20020a05600c4c2900b003e9e066550fso2781716wmp.4 for ; Sun, 26 Feb 2023 14:55:01 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=mJAcPQCfOIHAL+8wWJqUVZlzdFUPTSOR65Nvh+pIwYw=; b=Ck0GBCWFUKvZcM8aMAvmQ1gmDDRzcNfhxuTh4fijR6uuJeBz/N5Y0jmlM98ori2M5u ZB+BVuT63iSLQ68pSEwgxzc2TASacYu4p2ejGbp0rpG1UibvnmTzGSL0a/zAbTIhZR/4 XpoQYS0Z67YQQDQy7L9ObLVARiCN3R0TFGenN61sgcGnXYmDfoky93/BUDcmU6zjYrf7 ULTV3nGedqzM9w4ZZPOJ7oRNuc0HjWoLct9vffDwCI5UR1N/BALSHpKycHgMeE8n1Kha d6akWud9oT3mXbAhOFW4fNq4/XPi619Va+fl06hQZhPX+rDp1Snh6WfcgfU1QQG9Mo/z SfmQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=mJAcPQCfOIHAL+8wWJqUVZlzdFUPTSOR65Nvh+pIwYw=; b=pSsig4SrAuVui+dgW0OqeewSxQzTa1FdXGn3pDPKcPwE6d7R3UWiAkHPvQGPJtceIp xC5nfdvvUSLx3qyUK/oRNyEfo26ac2/FUKu5NdaUfb2u251VZ8GmCn50EbrwgHOuNCLo M9k/aamBlbfATsjkxiOuW4E4L1+aYdqkfTd10w+zLxTTKvWeVAX91xG+OIPHXOJiCy61 F3CIETr2SqCwXNhsPrNUFkAm3ABDQZ0mMTaX7/UnXFWOnmKQgxdsWDiPIhyEdzybju2r S0ogwEL1SIqWQv3oOGVPhKKX418yE5M3tMRyCiFmgpkWRM5cVgEIpBEZBt8+wetwoCk2 YyCA== X-Gm-Message-State: AO0yUKXgZjEGUbq44bqbtxMUvs8pKlAzLvHk380UcMr9qB3l9fh1tv5m db6soj+QRbVOUjOl16sD+pPv0w== X-Received: by 2002:a05:600c:990:b0:3eb:2f3b:4478 with SMTP id w16-20020a05600c099000b003eb2f3b4478mr4596101wmp.15.1677452092274; Sun, 26 Feb 2023 14:54:52 -0800 (PST) Received: from mai.box.freepro.com ([2a05:6e02:1041:c10:8baa:6b32:391b:62de]) by smtp.gmail.com with ESMTPSA id d10-20020a05600c3aca00b003eb369abd92sm6138074wms.2.2023.02.26.14.54.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 26 Feb 2023 14:54:51 -0800 (PST) From: Daniel Lezcano To: rafael@kernel.org, daniel.lezcano@linaro.org Cc: linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, Miquel Raynal , Florian Fainelli , Amit Kucheria , Zhang Rui , Markus Mayer , Broadcom internal kernel review list , Shawn Guo , Sascha Hauer , Pengutronix Kernel Team , Fabio Estevam , NXP Linux Team , Heiko Stuebner , Mark Brown , Adam Ward , linux-arm-kernel@lists.infradead.org (moderated list:BROADCOM BCM7XXX ARM ARCHITECTURE), linux-rockchip@lists.infradead.org (open list:ARM/Rockchip SoC support) Subject: [PATCH v3 06/20] thermal: Remove debug or error messages in get_temp() ops Date: Sun, 26 Feb 2023 23:53:52 +0100 Message-Id: <20230226225406.979703-7-daniel.lezcano@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230226225406.979703-1-daniel.lezcano@linaro.org> References: <20230226225406.979703-1-daniel.lezcano@linaro.org> MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1758936107394376828?= X-GMAIL-MSGID: =?utf-8?q?1758936107394376828?= Some get_temp() ops implementation are showing an error or a debug message if the reading of the sensor fails. The debug message is already displayed from the call site of this ops. So we can remove it. On the other side, the error should not be displayed because in production that can raise tons of messages. Finally, some drivers are showing a debug message with the temperature, this is also accessible through the trace from the core code in the temperature_update() function. Another benefit is the dev_* messages are accessing the thermal zone device field from the structure, so we encapsulate even more the code by preventing these accesses. Remove those messages. Signed-off-by: Daniel Lezcano Reviewed-by: Miquel Raynal #Armada Acked-by: Florian Fainelli #brcmstb_thermal.c --- drivers/thermal/armada_thermal.c | 10 ++-------- drivers/thermal/broadcom/brcmstb_thermal.c | 4 +--- drivers/thermal/dove_thermal.c | 5 +---- drivers/thermal/hisi_thermal.c | 3 --- drivers/thermal/imx_sc_thermal.c | 5 +---- drivers/thermal/imx_thermal.c | 4 +--- drivers/thermal/kirkwood_thermal.c | 5 +---- drivers/thermal/max77620_thermal.c | 4 +--- drivers/thermal/rockchip_thermal.c | 3 --- drivers/thermal/st/st_thermal.c | 2 -- drivers/thermal/thermal-generic-adc.c | 5 ++--- 11 files changed, 10 insertions(+), 40 deletions(-) diff --git a/drivers/thermal/armada_thermal.c b/drivers/thermal/armada_thermal.c index ebd606861a61..0e8dfa6a7757 100644 --- a/drivers/thermal/armada_thermal.c +++ b/drivers/thermal/armada_thermal.c @@ -360,11 +360,8 @@ static int armada_select_channel(struct armada_thermal_priv *priv, int channel) * we must absolutely wait for the sensor validity bit to ensure we read * actual data. */ - if (armada_wait_sensor_validity(priv)) { - dev_err(priv->dev, - "Temperature sensor reading not valid\n"); + if (armada_wait_sensor_validity(priv)) return -EIO; - } return 0; } @@ -402,11 +399,8 @@ static int armada_get_temp_legacy(struct thermal_zone_device *thermal, int ret; /* Valid check */ - if (!armada_is_valid(priv)) { - dev_err(priv->dev, - "Temperature sensor reading not valid\n"); + if (!armada_is_valid(priv)) return -EIO; - } /* Do the actual reading */ ret = armada_read_sensor(priv, temp); diff --git a/drivers/thermal/broadcom/brcmstb_thermal.c b/drivers/thermal/broadcom/brcmstb_thermal.c index 60173cc83c46..72d1dbe60b8f 100644 --- a/drivers/thermal/broadcom/brcmstb_thermal.c +++ b/drivers/thermal/broadcom/brcmstb_thermal.c @@ -158,10 +158,8 @@ static int brcmstb_get_temp(struct thermal_zone_device *tz, int *temp) val = __raw_readl(priv->tmon_base + AVS_TMON_STATUS); - if (!(val & AVS_TMON_STATUS_valid_msk)) { - dev_err(priv->dev, "reading not valid\n"); + if (!(val & AVS_TMON_STATUS_valid_msk)) return -EIO; - } val = (val & AVS_TMON_STATUS_data_msk) >> AVS_TMON_STATUS_data_shift; diff --git a/drivers/thermal/dove_thermal.c b/drivers/thermal/dove_thermal.c index 6db1882e8229..9954040d1d2c 100644 --- a/drivers/thermal/dove_thermal.c +++ b/drivers/thermal/dove_thermal.c @@ -91,11 +91,8 @@ static int dove_get_temp(struct thermal_zone_device *thermal, /* Valid check */ reg = readl_relaxed(priv->control + PMU_TEMP_DIOD_CTRL1_REG); - if ((reg & PMU_TDC1_TEMP_VALID_MASK) == 0x0) { - dev_err(&thermal->device, - "Temperature sensor reading not valid\n"); + if ((reg & PMU_TDC1_TEMP_VALID_MASK) == 0x0) return -EIO; - } /* * Calculate temperature. According to Marvell internal diff --git a/drivers/thermal/hisi_thermal.c b/drivers/thermal/hisi_thermal.c index f3a374266fa0..0d135b8a5b62 100644 --- a/drivers/thermal/hisi_thermal.c +++ b/drivers/thermal/hisi_thermal.c @@ -436,9 +436,6 @@ static int hisi_thermal_get_temp(struct thermal_zone_device *tz, int *temp) *temp = data->ops->get_temp(sensor); - dev_dbg(&data->pdev->dev, "tzd=%p, id=%d, temp=%d, thres=%d\n", - sensor->tzd, sensor->id, *temp, sensor->thres_temp); - return 0; } diff --git a/drivers/thermal/imx_sc_thermal.c b/drivers/thermal/imx_sc_thermal.c index ddde4bdfc94a..2d7a6bd2846b 100644 --- a/drivers/thermal/imx_sc_thermal.c +++ b/drivers/thermal/imx_sc_thermal.c @@ -58,11 +58,8 @@ static int imx_sc_thermal_get_temp(struct thermal_zone_device *tz, int *temp) hdr->size = 2; ret = imx_scu_call_rpc(thermal_ipc_handle, &msg, true); - if (ret) { - dev_err(&sensor->tzd->device, "read temp sensor %d failed, ret %d\n", - sensor->resource_id, ret); + if (ret) return ret; - } *temp = msg.data.resp.celsius * 1000 + msg.data.resp.tenths * 100; diff --git a/drivers/thermal/imx_thermal.c b/drivers/thermal/imx_thermal.c index a22b8086a209..a0b8de269986 100644 --- a/drivers/thermal/imx_thermal.c +++ b/drivers/thermal/imx_thermal.c @@ -265,10 +265,8 @@ static int imx_get_temp(struct thermal_zone_device *tz, int *temp) regmap_read(map, soc_data->temp_data, &val); - if ((val & soc_data->temp_valid_mask) == 0) { - dev_dbg(&tz->device, "temp measurement never finished\n"); + if ((val & soc_data->temp_valid_mask) == 0) return -EAGAIN; - } n_meas = (val & soc_data->temp_value_mask) >> soc_data->temp_value_shift; diff --git a/drivers/thermal/kirkwood_thermal.c b/drivers/thermal/kirkwood_thermal.c index 92b3ce426b9d..668747bd86ef 100644 --- a/drivers/thermal/kirkwood_thermal.c +++ b/drivers/thermal/kirkwood_thermal.c @@ -33,11 +33,8 @@ static int kirkwood_get_temp(struct thermal_zone_device *thermal, /* Valid check */ if (!((reg >> KIRKWOOD_THERMAL_VALID_OFFSET) & - KIRKWOOD_THERMAL_VALID_MASK)) { - dev_err(&thermal->device, - "Temperature sensor reading not valid\n"); + KIRKWOOD_THERMAL_VALID_MASK)) return -EIO; - } /* * Calculate temperature. According to Marvell internal diff --git a/drivers/thermal/max77620_thermal.c b/drivers/thermal/max77620_thermal.c index bf1679765f1b..61c7622d9945 100644 --- a/drivers/thermal/max77620_thermal.c +++ b/drivers/thermal/max77620_thermal.c @@ -51,10 +51,8 @@ static int max77620_thermal_read_temp(struct thermal_zone_device *tz, int *temp) int ret; ret = regmap_read(mtherm->rmap, MAX77620_REG_STATLBT, &val); - if (ret < 0) { - dev_err(mtherm->dev, "Failed to read STATLBT: %d\n", ret); + if (ret < 0) return ret; - } if (val & MAX77620_IRQ_TJALRM2_MASK) *temp = MAX77620_TJALARM2_TEMP; diff --git a/drivers/thermal/rockchip_thermal.c b/drivers/thermal/rockchip_thermal.c index 8a51eb26e798..71e533df563a 100644 --- a/drivers/thermal/rockchip_thermal.c +++ b/drivers/thermal/rockchip_thermal.c @@ -1233,9 +1233,6 @@ static int rockchip_thermal_get_temp(struct thermal_zone_device *tz, int *out_te retval = tsadc->get_temp(&tsadc->table, sensor->id, thermal->regs, out_temp); - dev_dbg(&thermal->pdev->dev, "sensor %d - temp: %d, retval: %d\n", - sensor->id, *out_temp, retval); - return retval; } diff --git a/drivers/thermal/st/st_thermal.c b/drivers/thermal/st/st_thermal.c index 6ed393218eb8..42fa0b80e149 100644 --- a/drivers/thermal/st/st_thermal.c +++ b/drivers/thermal/st/st_thermal.c @@ -127,8 +127,6 @@ static int st_thermal_get_temp(struct thermal_zone_device *th, int *temperature) temp += sensor->cdata->temp_adjust_val; temp = mcelsius(temp); - dev_dbg(dev, "temperature: %d\n", temp); - *temperature = temp; return 0; diff --git a/drivers/thermal/thermal-generic-adc.c b/drivers/thermal/thermal-generic-adc.c index 2c283e762d81..017b0ce52122 100644 --- a/drivers/thermal/thermal-generic-adc.c +++ b/drivers/thermal/thermal-generic-adc.c @@ -59,10 +59,9 @@ static int gadc_thermal_get_temp(struct thermal_zone_device *tz, int *temp) int ret; ret = iio_read_channel_processed(gti->channel, &val); - if (ret < 0) { - dev_err(gti->dev, "IIO channel read failed %d\n", ret); + if (ret < 0) return ret; - } + *temp = gadc_thermal_adc_to_temp(gti, val); return 0; From patchwork Sun Feb 26 22:53:53 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Daniel Lezcano X-Patchwork-Id: 61674 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp2131116wrd; Sun, 26 Feb 2023 14:56:15 -0800 (PST) X-Google-Smtp-Source: AK7set8O+FYiq5LFN6/4+5FhjGN/osUj6E6cGT+bMa4kTfsdij9WTlg8spSoQIX98tSstyS0ixsJ X-Received: by 2002:a17:902:ab57:b0:19a:839d:b67a with SMTP id ij23-20020a170902ab5700b0019a839db67amr24373691plb.5.1677452175523; Sun, 26 Feb 2023 14:56:15 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1677452175; cv=none; d=google.com; s=arc-20160816; b=ubmrYpbg8mjPteP/IysuGCzQ2X03Lo3BQdQ1e7Da91Zl8FQwW/c0gXf9MCXxTuhmzi 3xH7ej0YknJvInh4Us3R1ujO2DA+iKTJTyEq/u6Kv6fHuHRPxkWahpLCP+4tq1Ac0ZvS 5DnaK4n7edAMHsXsFJOUrskHZzMRSxDLxc7r82sZeWavchdShy6KRdMpHWoM3HcgFWQF XviZmNIAJD18W1JUjf6SQt+hV9zOnb9llB+2ftPXdy/kb35BrE22D6A5fDgaQLnUHAeT Bk80TE1oit38IOS2V2lo2hzSX/BueEOHQORiX1qdgNvtZjc/ob5K4AXPmXZLeHBP0HZQ +A1A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=l/7e8N8b7gEax6Mp/tnE3jBK1MXlLnukXxRJZ25cEfk=; b=GN+M5RFM2X0rjSTf3ws+kVDcIk+aoWQ46IFydoJmTHGTHwtuNYmokrXMjTN9eIPo8K ePK4j4T/sPlXOLOb84OmhwQRaSHRVsmzAwpU52FffOFlxPWc3JB2ddP7U0rt2cKl4FXY CkX9+1S4vqHDR7kuu74/OgPoY94q1waJ/LlwShmawwnnLPbRtrXIjgtB7U/A3e7piGrV wx9vlozsLOP4fVjT5L1SgPp4gYc40zyw2PMpMWoiixiAkwUHVVsKbesiHN09QX9YUeYU k8vr24Cv7m31/aQBVsepKDnzsAIOvtZk9a3QfcHAYeneiLDWrxatV1wKOsiepofAYOeD eVIA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=LV1q16a8; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id q6-20020a170902788600b0017a0e7aaf6bsi5662685pll.128.2023.02.26.14.56.02; Sun, 26 Feb 2023 14:56:15 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=LV1q16a8; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229762AbjBZWzm (ORCPT + 99 others); Sun, 26 Feb 2023 17:55:42 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33920 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229677AbjBZWzR (ORCPT ); Sun, 26 Feb 2023 17:55:17 -0500 Received: from mail-wm1-x335.google.com (mail-wm1-x335.google.com [IPv6:2a00:1450:4864:20::335]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D6A2BC15C for ; Sun, 26 Feb 2023 14:54:55 -0800 (PST) Received: by mail-wm1-x335.google.com with SMTP id o11-20020a05600c4fcb00b003eb33ea29a8so2284431wmq.1 for ; Sun, 26 Feb 2023 14:54:55 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=l/7e8N8b7gEax6Mp/tnE3jBK1MXlLnukXxRJZ25cEfk=; b=LV1q16a8ufrWjrmUJWYiSM4vEBzFe69sHVoWSyIy6D8gP9rVoeaZ8SGGg4yMAwhBuf sC3dmJ92HjERa9/xr/Npl0xlO/JnqfdENLQ6LoHuJxWUxuXf+vQEHug3HSgqaSrA1l/v tZ3yPw9HmNxE0Vjn3QCZ+tTAETRcV0qpdurISi9lJAMaBJ/JJC7bxTEeffYmaNI0sVvU MxQ5jxSuO4kgZbC0JhwKprVOU6jtjcopKJBF4OODGpcPO2ERLidTZnlyiWV1vDIZ9+Km IhrWVvwE0drF0YPzEg23GNQI8/y76u8qGdPeuTCht9kuLqmNdjo6vr8z7+5pcqawQ7zv rbOA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=l/7e8N8b7gEax6Mp/tnE3jBK1MXlLnukXxRJZ25cEfk=; b=yLG1pySs8wGjLt3tklw8I7mqzYvxO86q7+NNHE3sExyFawAQ2/o+XVf+D9Co6NsPi7 kvgsErPLQW879CSpRYTMp+ExPrXvnqMMysCj4MMighAKZ3WY56i6OJnpmOTwAAfGQ0pm d9HGNfFWXzLaLPSe8R9AQmA39yyH9lcWTIqMDTGIVQ7M0QA0kIrttO8EDi7UgrWeMJm3 ctHBCwpB17CnWqMdIOePXnqsF/nNLydiMpclTy3Xb4sBWILlA6sA2PBf5Pi14M5OpTwj xYgmp0F45kRu6ia+ezGtaRHBgyZHkQxBbGUtC3HLbNR+UxU81GofYrmNn0qXesYuR9Kk F40A== X-Gm-Message-State: AO0yUKWEbhv9p7Ngzv9ND8V8NO+uDtDXTHCcinP4YPKaGhAvW0xmVdrL wunwyFJz31QqznQOMfEARJeJIw== X-Received: by 2002:a05:600c:a692:b0:3db:2858:db84 with SMTP id ip18-20020a05600ca69200b003db2858db84mr17311911wmb.34.1677452095318; Sun, 26 Feb 2023 14:54:55 -0800 (PST) Received: from mai.box.freepro.com ([2a05:6e02:1041:c10:8baa:6b32:391b:62de]) by smtp.gmail.com with ESMTPSA id d10-20020a05600c3aca00b003eb369abd92sm6138074wms.2.2023.02.26.14.54.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 26 Feb 2023 14:54:54 -0800 (PST) From: Daniel Lezcano To: rafael@kernel.org, daniel.lezcano@linaro.org Cc: linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, =?utf-8?q?Niklas?= =?utf-8?q?_S=C3=B6derlund?= , Florian Fainelli , Amit Kucheria , Zhang Rui , Broadcom internal kernel review list , Ray Jui , Scott Branden , =?utf-8?q?Niklas_S=C3=B6derlund?= , Heiko Stuebner , Jernej Skrabec , Mark Brown , Stefan Wahren , Balsam CHIHI , Adam Ward , ye xingchen , linux-rpi-kernel@lists.infradead.org (moderated list:BROADCOM BCM2711/BCM2835 ARM ARCHITECTURE), linux-arm-kernel@lists.infradead.org (moderated list:BROADCOM BCM2711/BCM2835 ARM ARCHITECTURE), linux-renesas-soc@vger.kernel.org (open list:RENESAS R-CAR THERMAL DRIVERS), linux-rockchip@lists.infradead.org (open list:ARM/Rockchip SoC support) Subject: [PATCH v3 07/20] thermal/hwmon: Do not set no_hwmon before calling thermal_add_hwmon_sysfs() Date: Sun, 26 Feb 2023 23:53:53 +0100 Message-Id: <20230226225406.979703-8-daniel.lezcano@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230226225406.979703-1-daniel.lezcano@linaro.org> References: <20230226225406.979703-1-daniel.lezcano@linaro.org> MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1758936092608717149?= X-GMAIL-MSGID: =?utf-8?q?1758936092608717149?= The thermal->tzp->no_hwmon parameter is only used when calling thermal_zone_device_register(). Setting it to 'false' before calling thermal_add_hwmon_sysfs() has no effect. Remove the call and again prevent the drivers to access the thermal internals. Reviewed-by: Niklas Söderlund #R-Car Signed-off-by: Daniel Lezcano Acked-by: Florian Fainelli #Broadcom --- drivers/thermal/broadcom/bcm2711_thermal.c | 1 - drivers/thermal/broadcom/bcm2835_thermal.c | 1 - drivers/thermal/rcar_gen3_thermal.c | 1 - drivers/thermal/rcar_thermal.c | 5 ----- drivers/thermal/rockchip_thermal.c | 1 - drivers/thermal/rzg2l_thermal.c | 1 - 6 files changed, 10 deletions(-) diff --git a/drivers/thermal/broadcom/bcm2711_thermal.c b/drivers/thermal/broadcom/bcm2711_thermal.c index fcfcbbf044a4..c243a76a3471 100644 --- a/drivers/thermal/broadcom/bcm2711_thermal.c +++ b/drivers/thermal/broadcom/bcm2711_thermal.c @@ -98,7 +98,6 @@ static int bcm2711_thermal_probe(struct platform_device *pdev) priv->thermal = thermal; - thermal->tzp->no_hwmon = false; return thermal_add_hwmon_sysfs(thermal); } diff --git a/drivers/thermal/broadcom/bcm2835_thermal.c b/drivers/thermal/broadcom/bcm2835_thermal.c index 86aaf459de37..a217d832f24e 100644 --- a/drivers/thermal/broadcom/bcm2835_thermal.c +++ b/drivers/thermal/broadcom/bcm2835_thermal.c @@ -267,7 +267,6 @@ static int bcm2835_thermal_probe(struct platform_device *pdev) * Thermal_zone doesn't enable hwmon as default, * enable it here */ - tz->tzp->no_hwmon = false; err = thermal_add_hwmon_sysfs(tz); if (err) goto err_tz; diff --git a/drivers/thermal/rcar_gen3_thermal.c b/drivers/thermal/rcar_gen3_thermal.c index 2b7537ef141d..3df00c9d55ab 100644 --- a/drivers/thermal/rcar_gen3_thermal.c +++ b/drivers/thermal/rcar_gen3_thermal.c @@ -527,7 +527,6 @@ static int rcar_gen3_thermal_probe(struct platform_device *pdev) } tsc->zone = zone; - tsc->zone->tzp->no_hwmon = false; ret = thermal_add_hwmon_sysfs(tsc->zone); if (ret) goto error_unregister; diff --git a/drivers/thermal/rcar_thermal.c b/drivers/thermal/rcar_thermal.c index e0440f63ae77..b8571f7090aa 100644 --- a/drivers/thermal/rcar_thermal.c +++ b/drivers/thermal/rcar_thermal.c @@ -509,11 +509,6 @@ static int rcar_thermal_probe(struct platform_device *pdev) } 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; diff --git a/drivers/thermal/rockchip_thermal.c b/drivers/thermal/rockchip_thermal.c index 71e533df563a..bb254bdff043 100644 --- a/drivers/thermal/rockchip_thermal.c +++ b/drivers/thermal/rockchip_thermal.c @@ -1451,7 +1451,6 @@ static int rockchip_thermal_probe(struct platform_device *pdev) for (i = 0; i < thermal->chip->chn_num; i++) { rockchip_thermal_toggle_sensor(&thermal->sensors[i], true); - thermal->sensors[i].tzd->tzp->no_hwmon = false; error = thermal_add_hwmon_sysfs(thermal->sensors[i].tzd); if (error) dev_warn(&pdev->dev, diff --git a/drivers/thermal/rzg2l_thermal.c b/drivers/thermal/rzg2l_thermal.c index 7631430ce8a9..b56981f85306 100644 --- a/drivers/thermal/rzg2l_thermal.c +++ b/drivers/thermal/rzg2l_thermal.c @@ -216,7 +216,6 @@ static int rzg2l_thermal_probe(struct platform_device *pdev) } priv->zone = zone; - priv->zone->tzp->no_hwmon = false; ret = thermal_add_hwmon_sysfs(priv->zone); if (ret) goto err; From patchwork Sun Feb 26 22:53:54 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Lezcano X-Patchwork-Id: 61678 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp2131253wrd; Sun, 26 Feb 2023 14:56:41 -0800 (PST) X-Google-Smtp-Source: AK7set+5l0WZWrakadxwnLqhkOkNx5qlK0rdVOL5YCw98zoyoLLZxPRiplDofZRVg+Yk1y1yw1EZ X-Received: by 2002:aa7:84da:0:b0:5e3:f20a:b670 with SMTP id x26-20020aa784da000000b005e3f20ab670mr9553050pfn.2.1677452201469; Sun, 26 Feb 2023 14:56:41 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1677452201; cv=none; d=google.com; s=arc-20160816; b=k1JHUI2sSJvIXsj45Wa659SyHSkTpu9iWB00bPQ/siKWuEnHPPkbZUF2wbIOX61+Me LjAdvzufU6euJhRpcXxKgRGPlalaQZdFSf298CVTTv71ssLILFT8/PuMFhRNl6eaRHAV vR/WGp/Er/D7tRJLrtJsINyX9F3JD1lYnNUlg/n24hfP6SxXc8ki3cHRVch6cjYJ54hq EOBmytLtG1rZgvy9NlThSlfMtnARPgbwSUDSvHF+FZ+lAkbPIPvssPZmtctX0VoNcujB 9Hr2CTuKfWwKYATyveTIVyYYk4ICIWm1WH3aDpOSRrl6KyuPDHZLNJhWES7qOpNzbIhQ ZkQA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=noGAcNm9i/TJIg+l6poaaVPqMFcIQlGqlbm0Xx4JGsg=; b=nbxdKcufeTbbC124L6Xwv1zqv02rXw/nwI4aNy8waJQTkntmZA8iEf1yEPn8nQET0Y FRvkQlSNCH41GWcYmpE+OepY//A0Vv2WKq7xgUbVcGG4aBi8nYf+n+ym9ly/v+M+zQN7 90zp4P43onQ+5slgNesK+zUeZTP1bUWifzvrKjPJRZXaBk3X38h/zQLPRBDvYCqhF1BZ qhTCnzNuH8ODBi9BQ3G/1Gz9RSk36op7EIbxaJAj6enro2Ca8cTdO7g9+9uViU6ZMqsU fw9ZT+tdKLiE3kV+ODKK/05xeU7obUfqAjjKYK2asJRv0ebs4CYh/XQMcjwmzNRHM9OF 6Vkw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="Atf/Nqa5"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id 29-20020a63125d000000b00502d7941026si4823834pgs.442.2023.02.26.14.56.28; Sun, 26 Feb 2023 14:56:41 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="Atf/Nqa5"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229894AbjBZW4C (ORCPT + 99 others); Sun, 26 Feb 2023 17:56:02 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34530 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229839AbjBZWzn (ORCPT ); Sun, 26 Feb 2023 17:55:43 -0500 Received: from mail-wm1-x335.google.com (mail-wm1-x335.google.com [IPv6:2a00:1450:4864:20::335]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DED42D306 for ; Sun, 26 Feb 2023 14:55:11 -0800 (PST) Received: by mail-wm1-x335.google.com with SMTP id ay29-20020a05600c1e1d00b003e9f4c2b623so5934526wmb.3 for ; Sun, 26 Feb 2023 14:55:11 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=noGAcNm9i/TJIg+l6poaaVPqMFcIQlGqlbm0Xx4JGsg=; b=Atf/Nqa5UNuh+s6fLpEF6QW87xZW5fN+C69FaTOwwqTO74TOa3Vd4QEaT5qHUMzRFj Qal/rqygkcPbMJ0B2CIvJ/RjFbis+CoP9PldKHVB+HGEQouF+OFnVx8brKwxb26XCVMR 6Oxlbc8fkMI03L6nR7xzavw9DNyPetuIhD3FpFCC46+zl1rWZdD6aDirBltiJQOaQR4v HmIFRmU2agvAy+tDrnjRgh3HKyTb8ygSgp54lZhFZN8oV2FGZ3XKTtFUgX9ciLT5fZyk RfdE/nc+ffafr84jKxbnPDAVu2840n9hs59IILpkDltxmhCqdtjQd15E7ndbQpb7fYPK g7gQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=noGAcNm9i/TJIg+l6poaaVPqMFcIQlGqlbm0Xx4JGsg=; b=GAvk2WeqBlpEHNwrmkT9Uf4lhQ2XYhP0wK6z4tJZGZHwRqUqyrK3VOXu5xxth7pHlW 1gBAMSJf1u7xY68kMJIcU0RNADqmLripi/BWWNDpFINy1j8Uk1hel4JxT899nyRtJa7d x0VH7wyphq+nnoNstgJ+5v/6twU80DrslN1N2b5FNCN4eDoEnL9EtY2h49AKpuYUf/2x /TpkDd1EirTux+1CckYNZ3tu5GO6chIYZGJ8vPnm+LTd0Mmnmyb4q1f0eQQYcXNyixHw 1Eh0wNl99Xpl29ZH8MKBgN6ER+J3AmacmX4oiDdI1GctlSBug6YfA49E5FfAqSp7QY3k XqNg== X-Gm-Message-State: AO0yUKWvPejEVZASirxVlQFQxdAjoD6yEyB5E0zyLWeShNwwdpVPTnUN XM2CHa+wJiy+L7I9ZQXl+78hpQ== X-Received: by 2002:a05:600c:154e:b0:3eb:29fe:f91e with SMTP id f14-20020a05600c154e00b003eb29fef91emr8135692wmg.21.1677452101887; Sun, 26 Feb 2023 14:55:01 -0800 (PST) Received: from mai.box.freepro.com ([2a05:6e02:1041:c10:8baa:6b32:391b:62de]) by smtp.gmail.com with ESMTPSA id d10-20020a05600c3aca00b003eb369abd92sm6138074wms.2.2023.02.26.14.54.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 26 Feb 2023 14:55:01 -0800 (PST) From: Daniel Lezcano To: rafael@kernel.org, daniel.lezcano@linaro.org Cc: linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, Martin Blumenstingl , Jernej Skrabec , AngeloGioacchino Del Regno , Guillaume La Roque , Amit Kucheria , Zhang Rui , Shawn Guo , Sascha Hauer , Pengutronix Kernel Team , Fabio Estevam , NXP Linux Team , Andy Gross , Bjorn Andersson , Konrad Dybcio , Thara Gopinath , Vasily Khoruzhick , Yangtao Li , Chen-Yu Tsai , Samuel Holland , Thierry Reding , Jonathan Hunter , Eduardo Valentin , Keerthy , Matthias Brugger , Daniel Golle , Balsam CHIHI , ye xingchen , Randy Dunlap , Florian Fainelli , =?utf-8?q?Niklas_S=C3=B6derlund?= , linux-amlogic@lists.infradead.org (open list:THERMAL DRIVER FOR AMLOGIC SOCS), linux-arm-kernel@lists.infradead.org (moderated list:ARM/FREESCALE IMX / MXC ARM ARCHITECTURE), linux-arm-msm@vger.kernel.org (open list:ARM/QUALCOMM SUPPORT), linux-sunxi@lists.linux.dev (open list:ARM/Allwinner sunXi SoC support), linux-tegra@vger.kernel.org (open list:TEGRA ARCHITECTURE SUPPORT), linux-omap@vger.kernel.org (open list:TI BANDGAP AND THERMAL DRIVER), linux-mediatek@lists.infradead.org (moderated list:ARM/Mediatek SoC support) Subject: [PATCH v3 08/20] thermal/hwmon: Use the right device for devm_thermal_add_hwmon_sysfs() Date: Sun, 26 Feb 2023 23:53:54 +0100 Message-Id: <20230226225406.979703-9-daniel.lezcano@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230226225406.979703-1-daniel.lezcano@linaro.org> References: <20230226225406.979703-1-daniel.lezcano@linaro.org> MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1758936119172820028?= X-GMAIL-MSGID: =?utf-8?q?1758936119172820028?= The devres variant of thermal_add_hwmon_sysfs() only takes the thermal zone structure pointer as parameter. Actually, it uses the tz->device to add it in the devres list. It is preferable to use the device registering the thermal zone instead of the thermal zone device itself. That prevents the driver accessing the thermal zone structure internals and it is from my POV more correct regarding how devm_ is used. Signed-off-by: Daniel Lezcano Acked-by: Martin Blumenstingl #amlogic_thermal Acked-by: Jernej Skrabec #sun8i_thermal Reviewed-by: AngeloGioacchino Del Regno #MediaTek auxadc --- drivers/thermal/amlogic_thermal.c | 2 +- drivers/thermal/imx8mm_thermal.c | 2 +- drivers/thermal/imx_sc_thermal.c | 2 +- drivers/thermal/k3_bandgap.c | 2 +- drivers/thermal/mediatek/auxadc_thermal.c | 2 +- drivers/thermal/qcom/qcom-spmi-adc-tm5.c | 2 +- drivers/thermal/qcom/qcom-spmi-temp-alarm.c | 2 +- drivers/thermal/qcom/tsens.c | 2 +- drivers/thermal/qoriq_thermal.c | 2 +- drivers/thermal/sun8i_thermal.c | 2 +- drivers/thermal/tegra/tegra30-tsensor.c | 2 +- drivers/thermal/thermal_hwmon.c | 4 ++-- drivers/thermal/thermal_hwmon.h | 4 ++-- drivers/thermal/ti-soc-thermal/ti-thermal-common.c | 2 +- 14 files changed, 16 insertions(+), 16 deletions(-) diff --git a/drivers/thermal/amlogic_thermal.c b/drivers/thermal/amlogic_thermal.c index dfcc93e45cdd..4bf36386462f 100644 --- a/drivers/thermal/amlogic_thermal.c +++ b/drivers/thermal/amlogic_thermal.c @@ -285,7 +285,7 @@ static int amlogic_thermal_probe(struct platform_device *pdev) return ret; } - if (devm_thermal_add_hwmon_sysfs(pdata->tzd)) + if (devm_thermal_add_hwmon_sysfs(&pdev->dev, pdata->tzd)) dev_warn(&pdev->dev, "Failed to add hwmon sysfs attributes\n"); ret = amlogic_thermal_initialize(pdata); diff --git a/drivers/thermal/imx8mm_thermal.c b/drivers/thermal/imx8mm_thermal.c index efa1a4ffc368..e0de6ac49469 100644 --- a/drivers/thermal/imx8mm_thermal.c +++ b/drivers/thermal/imx8mm_thermal.c @@ -343,7 +343,7 @@ static int imx8mm_tmu_probe(struct platform_device *pdev) } tmu->sensors[i].hw_id = i; - if (devm_thermal_add_hwmon_sysfs(tmu->sensors[i].tzd)) + if (devm_thermal_add_hwmon_sysfs(&pdev->dev, tmu->sensors[i].tzd)) dev_warn(&pdev->dev, "failed to add hwmon sysfs attributes\n"); } diff --git a/drivers/thermal/imx_sc_thermal.c b/drivers/thermal/imx_sc_thermal.c index 2d7a6bd2846b..839bb9958f60 100644 --- a/drivers/thermal/imx_sc_thermal.c +++ b/drivers/thermal/imx_sc_thermal.c @@ -116,7 +116,7 @@ static int imx_sc_thermal_probe(struct platform_device *pdev) return ret; } - if (devm_thermal_add_hwmon_sysfs(sensor->tzd)) + if (devm_thermal_add_hwmon_sysfs(&pdev->dev, sensor->tzd)) dev_warn(&pdev->dev, "failed to add hwmon sysfs attributes\n"); } diff --git a/drivers/thermal/k3_bandgap.c b/drivers/thermal/k3_bandgap.c index b5cd2c85e0c3..791210458606 100644 --- a/drivers/thermal/k3_bandgap.c +++ b/drivers/thermal/k3_bandgap.c @@ -222,7 +222,7 @@ static int k3_bandgap_probe(struct platform_device *pdev) goto err_alloc; } - if (devm_thermal_add_hwmon_sysfs(data[id].tzd)) + if (devm_thermal_add_hwmon_sysfs(dev, data[id].tzd)) dev_warn(dev, "Failed to add hwmon sysfs attributes\n"); } diff --git a/drivers/thermal/mediatek/auxadc_thermal.c b/drivers/thermal/mediatek/auxadc_thermal.c index 755baa4e5bd2..7b146350050d 100644 --- a/drivers/thermal/mediatek/auxadc_thermal.c +++ b/drivers/thermal/mediatek/auxadc_thermal.c @@ -1210,7 +1210,7 @@ static int mtk_thermal_probe(struct platform_device *pdev) goto err_disable_clk_peri_therm; } - ret = devm_thermal_add_hwmon_sysfs(tzdev); + ret = devm_thermal_add_hwmon_sysfs(&pdev->dev, tzdev); if (ret) dev_warn(&pdev->dev, "error in thermal_add_hwmon_sysfs"); diff --git a/drivers/thermal/qcom/qcom-spmi-adc-tm5.c b/drivers/thermal/qcom/qcom-spmi-adc-tm5.c index ed204489a950..5749149ae2e4 100644 --- a/drivers/thermal/qcom/qcom-spmi-adc-tm5.c +++ b/drivers/thermal/qcom/qcom-spmi-adc-tm5.c @@ -689,7 +689,7 @@ static int adc_tm5_register_tzd(struct adc_tm5_chip *adc_tm) return PTR_ERR(tzd); } adc_tm->channels[i].tzd = tzd; - if (devm_thermal_add_hwmon_sysfs(tzd)) + if (devm_thermal_add_hwmon_sysfs(adc_tm->dev, tzd)) dev_warn(adc_tm->dev, "Failed to add hwmon sysfs attributes\n"); } diff --git a/drivers/thermal/qcom/qcom-spmi-temp-alarm.c b/drivers/thermal/qcom/qcom-spmi-temp-alarm.c index b196d8d01726..0f88e98428ac 100644 --- a/drivers/thermal/qcom/qcom-spmi-temp-alarm.c +++ b/drivers/thermal/qcom/qcom-spmi-temp-alarm.c @@ -459,7 +459,7 @@ static int qpnp_tm_probe(struct platform_device *pdev) return ret; } - if (devm_thermal_add_hwmon_sysfs(chip->tz_dev)) + if (devm_thermal_add_hwmon_sysfs(&pdev->dev, chip->tz_dev)) dev_warn(&pdev->dev, "Failed to add hwmon sysfs attributes\n"); diff --git a/drivers/thermal/qcom/tsens.c b/drivers/thermal/qcom/tsens.c index 6cc935379f00..d3218127e617 100644 --- a/drivers/thermal/qcom/tsens.c +++ b/drivers/thermal/qcom/tsens.c @@ -1189,7 +1189,7 @@ static int tsens_register(struct tsens_priv *priv) if (priv->ops->enable) priv->ops->enable(priv, i); - if (devm_thermal_add_hwmon_sysfs(tzd)) + if (devm_thermal_add_hwmon_sysfs(priv->dev, tzd)) dev_warn(priv->dev, "Failed to add hwmon sysfs attributes\n"); } diff --git a/drivers/thermal/qoriq_thermal.c b/drivers/thermal/qoriq_thermal.c index d2dc99247f61..e58756323457 100644 --- a/drivers/thermal/qoriq_thermal.c +++ b/drivers/thermal/qoriq_thermal.c @@ -157,7 +157,7 @@ static int qoriq_tmu_register_tmu_zone(struct device *dev, return ret; } - if (devm_thermal_add_hwmon_sysfs(tzd)) + if (devm_thermal_add_hwmon_sysfs(dev, tzd)) dev_warn(dev, "Failed to add hwmon sysfs attributes\n"); diff --git a/drivers/thermal/sun8i_thermal.c b/drivers/thermal/sun8i_thermal.c index 6b550f0f90bf..793ddce72132 100644 --- a/drivers/thermal/sun8i_thermal.c +++ b/drivers/thermal/sun8i_thermal.c @@ -475,7 +475,7 @@ static int sun8i_ths_register(struct ths_device *tmdev) if (IS_ERR(tmdev->sensor[i].tzd)) return PTR_ERR(tmdev->sensor[i].tzd); - if (devm_thermal_add_hwmon_sysfs(tmdev->sensor[i].tzd)) + if (devm_thermal_add_hwmon_sysfs(tmdev->dev, tmdev->sensor[i].tzd)) dev_warn(tmdev->dev, "Failed to add hwmon sysfs attributes\n"); } diff --git a/drivers/thermal/tegra/tegra30-tsensor.c b/drivers/thermal/tegra/tegra30-tsensor.c index 42c6fb494dd9..4b2ea17910cd 100644 --- a/drivers/thermal/tegra/tegra30-tsensor.c +++ b/drivers/thermal/tegra/tegra30-tsensor.c @@ -528,7 +528,7 @@ static int tegra_tsensor_register_channel(struct tegra_tsensor *ts, return 0; } - if (devm_thermal_add_hwmon_sysfs(tsc->tzd)) + if (devm_thermal_add_hwmon_sysfs(ts->dev, tsc->tzd)) dev_warn(ts->dev, "failed to add hwmon sysfs attributes\n"); return 0; diff --git a/drivers/thermal/thermal_hwmon.c b/drivers/thermal/thermal_hwmon.c index c594c42bea6d..964db7941e31 100644 --- a/drivers/thermal/thermal_hwmon.c +++ b/drivers/thermal/thermal_hwmon.c @@ -263,7 +263,7 @@ static void devm_thermal_hwmon_release(struct device *dev, void *res) thermal_remove_hwmon_sysfs(*(struct thermal_zone_device **)res); } -int devm_thermal_add_hwmon_sysfs(struct thermal_zone_device *tz) +int devm_thermal_add_hwmon_sysfs(struct device *dev, struct thermal_zone_device *tz) { struct thermal_zone_device **ptr; int ret; @@ -280,7 +280,7 @@ int devm_thermal_add_hwmon_sysfs(struct thermal_zone_device *tz) } *ptr = tz; - devres_add(&tz->device, ptr); + devres_add(dev, ptr); return ret; } diff --git a/drivers/thermal/thermal_hwmon.h b/drivers/thermal/thermal_hwmon.h index 1a9d65f6a6a8..b429f6e7abdb 100644 --- a/drivers/thermal/thermal_hwmon.h +++ b/drivers/thermal/thermal_hwmon.h @@ -17,7 +17,7 @@ #ifdef CONFIG_THERMAL_HWMON int thermal_add_hwmon_sysfs(struct thermal_zone_device *tz); -int devm_thermal_add_hwmon_sysfs(struct thermal_zone_device *tz); +int devm_thermal_add_hwmon_sysfs(struct device *dev, struct thermal_zone_device *tz); void thermal_remove_hwmon_sysfs(struct thermal_zone_device *tz); #else static inline int @@ -27,7 +27,7 @@ thermal_add_hwmon_sysfs(struct thermal_zone_device *tz) } static inline int -devm_thermal_add_hwmon_sysfs(struct thermal_zone_device *tz) +devm_thermal_add_hwmon_sysfs(struct device *dev, struct thermal_zone_device *tz) { return 0; } diff --git a/drivers/thermal/ti-soc-thermal/ti-thermal-common.c b/drivers/thermal/ti-soc-thermal/ti-thermal-common.c index 3e998c9799bb..216b29068b08 100644 --- a/drivers/thermal/ti-soc-thermal/ti-thermal-common.c +++ b/drivers/thermal/ti-soc-thermal/ti-thermal-common.c @@ -182,7 +182,7 @@ int ti_thermal_expose_sensor(struct ti_bandgap *bgp, int id, ti_bandgap_set_sensor_data(bgp, id, data); ti_bandgap_write_update_interval(bgp, data->sensor_id, interval); - if (devm_thermal_add_hwmon_sysfs(data->ti_thermal)) + if (devm_thermal_add_hwmon_sysfs(bgp->dev, data->ti_thermal)) dev_warn(bgp->dev, "failed to add hwmon sysfs attributes\n"); return 0; From patchwork Sun Feb 26 22:53:55 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Lezcano X-Patchwork-Id: 61677 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp2131226wrd; Sun, 26 Feb 2023 14:56:37 -0800 (PST) X-Google-Smtp-Source: AK7set8uUt5ygeoCnCUnaf44d6lH6qJwYF8v5bFMEqcGEuCWE4gr2KavTMtvHP5DFCtR4rgO6Gqx X-Received: by 2002:a05:6a21:789d:b0:cd:c79:5124 with SMTP id bf29-20020a056a21789d00b000cd0c795124mr3450188pzc.6.1677452196836; Sun, 26 Feb 2023 14:56:36 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1677452196; cv=none; d=google.com; s=arc-20160816; b=Ntew86jhBdgAn8vST24O7w+s4QsoazdsWNegMW+hHcIFTFdHD5Mk1+nGeZ9R5bVza0 hV82kehfnbd19x2yhrykyKOAkeu2aysAZAq8TXfKUVtvHrcyV97ecFPcMgrE8P0ZOona op2hSJFhKhULUc9y2oUdMmJ1iMvHRkdvQFojCda9wxJcL6TZg9f29OsHJ0F5U8GEFzdC 2m5XLrRaVDmZD+kMcsT2WEoH9/7/2J2u8QnoGUK16ZRjxr0XDBhptlJfVuXJ3B7IXFl6 5KNmIwk7uPcjFiYb+ri1ACYX5s7EUbq2pqMqrTtkvKbKzw8Smu7b32JFjlXzQjF5bY1z 0/Vw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=gNKZqTSfik6kbKLTg6DAWWxGUvdMh+G/qh4G7aDUg+w=; b=g6PtM7gZU/SZ4kUfJ58WG+/MY851aTBWYayZz/lE2tZrGVGPpsLFA0REZ+ilkwt8pR FQkwpP3LX24jszCfMv8XhIAvYn86fjncvf2g/1lcny+NM1Mn7lLgpgUBmqqjqohZ5T+M lZCD5pTUoWcnF7/V0yfX+z/YfpfawG2FXQ64DA+clU0xzYNJhgDAWXh4TEEOWcyNWZMe wlQT6eaNfOREBCSNRAx+fxAcIG7bNhy2JH8t7zuhwnDd9+wlO2DCV+7kxYmvbtDef6F0 nZ/hoUT2yWLJunHWNuBI/aYLd4Cg/vOKTMb45Nkrpen4n/zFBlAdgZFULkL5mq9ZuoBZ kbog== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=M+kajm71; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id y18-20020a63b512000000b004fb2685a0d4si4945085pge.621.2023.02.26.14.56.23; Sun, 26 Feb 2023 14:56:36 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=M+kajm71; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229888AbjBZWz7 (ORCPT + 99 others); Sun, 26 Feb 2023 17:55:59 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34824 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229849AbjBZWzu (ORCPT ); Sun, 26 Feb 2023 17:55:50 -0500 Received: from mail-wm1-x32b.google.com (mail-wm1-x32b.google.com [IPv6:2a00:1450:4864:20::32b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B5F55C16E for ; Sun, 26 Feb 2023 14:55:17 -0800 (PST) Received: by mail-wm1-x32b.google.com with SMTP id bg16-20020a05600c3c9000b003eb34e21bdfso2501485wmb.0 for ; Sun, 26 Feb 2023 14:55:17 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=gNKZqTSfik6kbKLTg6DAWWxGUvdMh+G/qh4G7aDUg+w=; b=M+kajm71sV2/+hG0mzVDxeFBLGVBb3eqiFilcuXFmZah1cJmbp/LNKdf0gLj3siBVs uks2L8ORHstwNxGgJ/YT5p6LjlPK437wUX0UUc2WbZrxyqHvkAUNxny1dfLi+Nh0+D4u 2PIS6jADXN9arxgZzFXaebMexqLRQVZnaOlkcISCMFAVVNU7SBVk9nKBYMoUuFhTvxnB msKqCdsQcHuiJ63mTRxiP7zb7zzLovtxG+bXWsmw9Qq1wjetOg50yv/1GoYBlZEods72 ov2/j04v003tOgp+HP7/DfOObSfUmWoFxm6lm9jbvnhjV20vXIeXsHJ16FoHu1NVaF31 SL5g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=gNKZqTSfik6kbKLTg6DAWWxGUvdMh+G/qh4G7aDUg+w=; b=PN31iORroToXa2VRwgUq4WiatJ14E98Jhboi97Ut+XCyYrNTBOnAeFThE/ENRGJK4x +emWXoJRXVlyUzja4IOW7h2NxLwkO5pN+EpJdNdOWSvjs8S/Prm51gqKnvTXq7R5NLrP 8bpEzYifm6tovQNN8FiIz4sIyA2WWqNfNHrgdbYQss1Zmiartr2uQD6I53w8ekv4dbfn FFB+tnn+86KM82Jf1DMU3hU3QLXx/ftC8nuTnMsBjaYVbwSmj8N9BScwjsA7Rzjr92AC QrBcmWNgj4wIonS325fJu46onRt5N9cqSpUdUqTzn9jeBy0kmR5mNuGon/AKHFiIkskW MdUQ== X-Gm-Message-State: AO0yUKWOA9d5nH5bb1n0sgWkFwbW5HOaDh7lnBJP7sKLDF4LDgXUlSAw 1K7mhVu5lz31hw950G2H9wKIZw== X-Received: by 2002:a05:600c:a293:b0:3eb:2b88:5af2 with SMTP id hu19-20020a05600ca29300b003eb2b885af2mr6384327wmb.20.1677452106844; Sun, 26 Feb 2023 14:55:06 -0800 (PST) Received: from mai.box.freepro.com ([2a05:6e02:1041:c10:8baa:6b32:391b:62de]) by smtp.gmail.com with ESMTPSA id d10-20020a05600c3aca00b003eb369abd92sm6138074wms.2.2023.02.26.14.55.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 26 Feb 2023 14:55:06 -0800 (PST) From: Daniel Lezcano To: rafael@kernel.org, daniel.lezcano@linaro.org Cc: linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, Balsam CHIHI , AngeloGioacchino Del Regno , Amit Kucheria , Zhang Rui , Shawn Guo , Sascha Hauer , Pengutronix Kernel Team , Fabio Estevam , NXP Linux Team , Eduardo Valentin , Keerthy , Matthias Brugger , Adam Ward , Ido Schimmel , linux-arm-kernel@lists.infradead.org (moderated list:ARM/FREESCALE IMX / MXC ARM ARCHITECTURE), linux-omap@vger.kernel.org (open list:TI BANDGAP AND THERMAL DRIVER), linux-mediatek@lists.infradead.org (moderated list:ARM/Mediatek SoC support) Subject: [PATCH v3 09/20] thermal: Don't use 'device' internal thermal zone structure field Date: Sun, 26 Feb 2023 23:53:55 +0100 Message-Id: <20230226225406.979703-10-daniel.lezcano@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230226225406.979703-1-daniel.lezcano@linaro.org> References: <20230226225406.979703-1-daniel.lezcano@linaro.org> MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1758936114549275677?= X-GMAIL-MSGID: =?utf-8?q?1758936114549275677?= Some drivers are directly using the thermal zone's 'device' structure field. Use the driver device pointer instead of the thermal zone device when it is available. Remove the traces when they are duplicate with the traces in the core code. Signed-off-by: Daniel Lezcano Reviewed-by: Balsam CHIHI #Mediatek LVTS Reviewed-by: AngeloGioacchino Del Regno #MediaTek LVTS --- drivers/thermal/imx_thermal.c | 37 ++++--------------- drivers/thermal/mediatek/lvts_thermal.c | 4 +- drivers/thermal/thermal_hwmon.c | 4 +- .../ti-soc-thermal/ti-thermal-common.c | 2 +- 4 files changed, 13 insertions(+), 34 deletions(-) diff --git a/drivers/thermal/imx_thermal.c b/drivers/thermal/imx_thermal.c index a0b8de269986..c3136978adee 100644 --- a/drivers/thermal/imx_thermal.c +++ b/drivers/thermal/imx_thermal.c @@ -285,13 +285,13 @@ static int imx_get_temp(struct thermal_zone_device *tz, int *temp) if (data->alarm_temp == trips[IMX_TRIP_CRITICAL].temperature && *temp < trips[IMX_TRIP_PASSIVE].temperature) { imx_set_alarm_temp(data, trips[IMX_TRIP_PASSIVE].temperature); - dev_dbg(&tz->device, "thermal alarm off: T < %d\n", + dev_dbg(data->dev, "thermal alarm off: T < %d\n", data->alarm_temp / 1000); } } if (*temp != data->last_temp) { - dev_dbg(&tz->device, "millicelsius: %d\n", *temp); + dev_dbg(data->dev, "millicelsius: %d\n", *temp); data->last_temp = *temp; } @@ -367,36 +367,16 @@ static int imx_set_trip_temp(struct thermal_zone_device *tz, int trip, static int imx_bind(struct thermal_zone_device *tz, struct thermal_cooling_device *cdev) { - int ret; - - ret = thermal_zone_bind_cooling_device(tz, IMX_TRIP_PASSIVE, cdev, - THERMAL_NO_LIMIT, - THERMAL_NO_LIMIT, - THERMAL_WEIGHT_DEFAULT); - if (ret) { - dev_err(&tz->device, - "binding zone %s with cdev %s failed:%d\n", - tz->type, cdev->type, ret); - return ret; - } - - return 0; + return thermal_zone_bind_cooling_device(tz, IMX_TRIP_PASSIVE, cdev, + THERMAL_NO_LIMIT, + THERMAL_NO_LIMIT, + THERMAL_WEIGHT_DEFAULT); } static int imx_unbind(struct thermal_zone_device *tz, struct thermal_cooling_device *cdev) { - int ret; - - ret = thermal_zone_unbind_cooling_device(tz, IMX_TRIP_PASSIVE, cdev); - if (ret) { - dev_err(&tz->device, - "unbinding zone %s with cdev %s failed:%d\n", - tz->type, cdev->type, ret); - return ret; - } - - return 0; + return thermal_zone_unbind_cooling_device(tz, IMX_TRIP_PASSIVE, cdev); } static struct thermal_zone_device_ops imx_tz_ops = { @@ -558,8 +538,7 @@ static irqreturn_t imx_thermal_alarm_irq_thread(int irq, void *dev) { struct imx_thermal_data *data = dev; - dev_dbg(&data->tz->device, "THERMAL ALARM: T > %d\n", - data->alarm_temp / 1000); + dev_dbg(data->dev, "THERMAL ALARM: T > %d\n", data->alarm_temp / 1000); thermal_zone_device_update(data->tz, THERMAL_EVENT_UNSPECIFIED); diff --git a/drivers/thermal/mediatek/lvts_thermal.c b/drivers/thermal/mediatek/lvts_thermal.c index fb4b1b4db245..beb835d644e2 100644 --- a/drivers/thermal/mediatek/lvts_thermal.c +++ b/drivers/thermal/mediatek/lvts_thermal.c @@ -305,7 +305,7 @@ static int lvts_set_trips(struct thermal_zone_device *tz, int low, int high) * 14-0 : Raw temperature for threshold */ if (low != -INT_MAX) { - dev_dbg(&tz->device, "Setting low limit temperature interrupt: %d\n", low); + pr_debug("%s: Setting low limit temperature interrupt: %d\n", tz->type, low); writel(raw_low, LVTS_H2NTHRE(base)); } @@ -318,7 +318,7 @@ static int lvts_set_trips(struct thermal_zone_device *tz, int low, int high) * * 14-0 : Raw temperature for threshold */ - dev_dbg(&tz->device, "Setting high limit temperature interrupt: %d\n", high); + pr_debug("%s: Setting high limit temperature interrupt: %d\n", tz->type, high); writel(raw_high, LVTS_HTHRE(base)); return 0; diff --git a/drivers/thermal/thermal_hwmon.c b/drivers/thermal/thermal_hwmon.c index 964db7941e31..bc02095b314c 100644 --- a/drivers/thermal/thermal_hwmon.c +++ b/drivers/thermal/thermal_hwmon.c @@ -228,14 +228,14 @@ void thermal_remove_hwmon_sysfs(struct thermal_zone_device *tz) hwmon = thermal_hwmon_lookup_by_type(tz); if (unlikely(!hwmon)) { /* Should never happen... */ - dev_dbg(&tz->device, "hwmon device lookup failed!\n"); + dev_dbg(hwmon->device, "hwmon device lookup failed!\n"); return; } temp = thermal_hwmon_lookup_temp(hwmon, tz); if (unlikely(!temp)) { /* Should never happen... */ - dev_dbg(&tz->device, "temperature input lookup failed!\n"); + dev_dbg(hwmon->device, "temperature input lookup failed!\n"); return; } diff --git a/drivers/thermal/ti-soc-thermal/ti-thermal-common.c b/drivers/thermal/ti-soc-thermal/ti-thermal-common.c index 216b29068b08..060f46cea5ff 100644 --- a/drivers/thermal/ti-soc-thermal/ti-thermal-common.c +++ b/drivers/thermal/ti-soc-thermal/ti-thermal-common.c @@ -43,7 +43,7 @@ static void ti_thermal_work(struct work_struct *work) thermal_zone_device_update(data->ti_thermal, THERMAL_EVENT_UNSPECIFIED); - dev_dbg(&data->ti_thermal->device, "updated thermal zone %s\n", + dev_dbg(data->bgp->dev, "updated thermal zone %s\n", data->ti_thermal->type); } From patchwork Sun Feb 26 22:53:56 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Lezcano X-Patchwork-Id: 61679 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp2131271wrd; Sun, 26 Feb 2023 14:56:45 -0800 (PST) X-Google-Smtp-Source: AK7set/VSU1n3qr5UxQ2LVcc8HqwysqEsjSqC5me620ggIHhMgIRQPLvrNx5JRvYwdiYgCiY+xnL X-Received: by 2002:a17:902:e84b:b0:19a:723a:8405 with SMTP id t11-20020a170902e84b00b0019a723a8405mr22126112plg.6.1677452205485; Sun, 26 Feb 2023 14:56:45 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1677452205; cv=none; d=google.com; s=arc-20160816; b=buRrnmYz/Qm1jpyGBBOcE7KS2JobVJcN0K6GLywBMWQlk0iTc7vYzfENyzCG9TeJtP pbp3YiG4rW0U21u0tPUhWFsvDfChTKY2idd25KoTP23D6W5kcZfXPIXqA8Iajaoannik 5LSB2FXtA6tZ619atZZ60gDC/Z6XmgBgSDcj3qeeLNuUN3wyqQ9Zk59MZK/+8y9hNG6y KMi3HoaPMgH2wvSFCUYUjZ8X2IcLeA8rJ4zJkv4SNcEmaeNOe9GD0HyKAbC0wcZavD2U jVri762DIMUec3hCyq4GyJd8zGkK6zzBhZIwY1eZ68le50YOLQerUPQa65yR0DU4AeEL VZLw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=/h75YgLAzThWP+FOpMQKnxnohte85PKa1jrYzQU01Og=; b=heOpIx0aG5Xu/Hcr3ktr3FmyEV35l1YzKPbmozKTeWV1PzhK80+naIATBZB+EPwdT8 GIu5+JV4iwm4OPU4Ciby1ggakIlOxEXQy7+k2x9+R+p96a476uyDq0eNd7r5h4hkxhJl q4aS6rcE4HdbVGe9p6TBFDPaMOCO+iCQ+UDaHqll+zPnrMhVm4stbFFUTPehwHzL7ZUc gvA5lMO1VzxpFI0yfBYgsAuR8RCvz+4BnFPgj1/l9U7Qw/acdKXnWknFdzs0BFz0BVz0 9hkmTWC2QB3JCQ4IMVEqjVVGXxmbTokXveL9lE4/RtISF6M5ZUR73KZGJcvrJCQmIM96 KOBg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=szdvHvEQ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id p18-20020a170902ead200b0019955f0dc48si5116639pld.527.2023.02.26.14.56.32; Sun, 26 Feb 2023 14:56:45 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=szdvHvEQ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229640AbjBZW4I (ORCPT + 99 others); Sun, 26 Feb 2023 17:56:08 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34848 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229854AbjBZWzv (ORCPT ); Sun, 26 Feb 2023 17:55:51 -0500 Received: from mail-wm1-x32b.google.com (mail-wm1-x32b.google.com [IPv6:2a00:1450:4864:20::32b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BF2EA199D4 for ; Sun, 26 Feb 2023 14:55:19 -0800 (PST) Received: by mail-wm1-x32b.google.com with SMTP id r19-20020a05600c459300b003eb3e2a5e7bso1147594wmo.0 for ; Sun, 26 Feb 2023 14:55:19 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=/h75YgLAzThWP+FOpMQKnxnohte85PKa1jrYzQU01Og=; b=szdvHvEQFacto3jfDsgXs69woDlNj6Qfat9BZZMO7Mhjhb44Hfv/5UR2NpHEpMnhUb fZWPxUTwb/RHMVbBtUDkqpmKWuWvxSFMB4NFBhTeLmMIs80SINsioOvnX9Tt/UME7CzQ rBATD1N6LkwX/YB8ZQj5a7bP5wkFex+TJUklEkXWoEIPSOw0TSekPh3P+8QYtObVFUg0 WXheRumCQrJM72MVT9iU8ySciJrN3ofjghGY6n3Al0orLiBaoIlsbVY9U7kSVylFYqTt 3/s1Hbf0Vccv0l6RE5Nlj7IgJr5eMBC5LWE8kg2XKntoDaq9pxpVQ8Y5ArqbO8+GoCWO TI6A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=/h75YgLAzThWP+FOpMQKnxnohte85PKa1jrYzQU01Og=; b=JrxZPwXN7HQ3lhFGyr5IdP361Bd0ciq2GlOld5wToQ7YKXBm46p7NGnA5I9bxo2rdo 8mORta//nJFrQvvDtfoUW/2Y+bz6e0qu1oGxS4ofWgrdy+rF7ZzUO8Jt5nSWXT7m+aVB zR0V+j6QRWQl2uzvRBuXGs4l7P6atPOI2His7TlpjZxtPMKPmnzNhpRJJnWrf1ud3plm W4GoVC3A+bbkRpebxCGvmLefIYXb1yikaioCfjJbO/hUvkBXrz6LbsascWMGhUT3wYIF VEKgLWeRpyPTiewOg9CP4O4aLpY9i4/rjKqUAoFdIBcs4rdbO9zn+fxb+u3h97s9CK8U uFOA== X-Gm-Message-State: AO0yUKVVBoOwUzwO5EeK9Za5dfxVsuyhd3+arGDEmqUZuiqVKErak+ii SpAcoCMdtPo29+UQFjOX6ANMLg== X-Received: by 2002:a05:600c:16c7:b0:3de:e8c5:d826 with SMTP id l7-20020a05600c16c700b003dee8c5d826mr11260810wmn.28.1677452107900; Sun, 26 Feb 2023 14:55:07 -0800 (PST) Received: from mai.box.freepro.com ([2a05:6e02:1041:c10:8baa:6b32:391b:62de]) by smtp.gmail.com with ESMTPSA id d10-20020a05600c3aca00b003eb369abd92sm6138074wms.2.2023.02.26.14.55.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 26 Feb 2023 14:55:07 -0800 (PST) From: Daniel Lezcano To: rafael@kernel.org, daniel.lezcano@linaro.org Cc: linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, Amit Kucheria , Zhang Rui Subject: [PATCH v3 10/20] thermal/core: Add thermal_zone_device structure 'type' accessor Date: Sun, 26 Feb 2023 23:53:56 +0100 Message-Id: <20230226225406.979703-11-daniel.lezcano@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230226225406.979703-1-daniel.lezcano@linaro.org> References: <20230226225406.979703-1-daniel.lezcano@linaro.org> MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1758936123485896070?= X-GMAIL-MSGID: =?utf-8?q?1758936123485896070?= The thermal zone device structure is exposed via the exported thermal.h header. This structure should stay private the thermal core code. In order to encapsulate the structure, let's add an accessor to get the 'type' of the thermal zone. Signed-off-by: Daniel Lezcano --- drivers/thermal/thermal_core.c | 6 ++++++ include/linux/thermal.h | 6 ++++++ 2 files changed, 12 insertions(+) diff --git a/drivers/thermal/thermal_core.c b/drivers/thermal/thermal_core.c index 9fa12147fead..913ba9ca9792 100644 --- a/drivers/thermal/thermal_core.c +++ b/drivers/thermal/thermal_core.c @@ -1384,6 +1384,12 @@ void *thermal_zone_device_priv(struct thermal_zone_device *tzd) } EXPORT_SYMBOL_GPL(thermal_zone_device_priv); +const char *thermal_zone_device_type(struct thermal_zone_device *tzd) +{ + return tzd->type; +} +EXPORT_SYMBOL_GPL(thermal_zone_device_type); + /** * thermal_zone_device_unregister - removes the registered thermal zone device * @tz: the thermal zone device to remove diff --git a/include/linux/thermal.h b/include/linux/thermal.h index 7dbb5712434c..21686e676b3d 100644 --- a/include/linux/thermal.h +++ b/include/linux/thermal.h @@ -366,6 +366,7 @@ thermal_zone_device_register_with_trips(const char *, struct thermal_trip *, int struct thermal_zone_params *, int, int); void *thermal_zone_device_priv(struct thermal_zone_device *tzd); +const char *thermal_zone_device_type(struct thermal_zone_device *tzd); int thermal_zone_bind_cooling_device(struct thermal_zone_device *, int, struct thermal_cooling_device *, @@ -443,6 +444,11 @@ static inline void *thermal_zone_device_priv(struct thermal_zone_device *tz) return NULL; } +static inline const char *thermal_zone_device_type(struct thermal_zone_device *tzd) +{ + return NULL; +} + static inline int thermal_zone_device_enable(struct thermal_zone_device *tz) { return -ENODEV; } From patchwork Sun Feb 26 22:53:57 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Lezcano X-Patchwork-Id: 61681 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp2131304wrd; Sun, 26 Feb 2023 14:56:52 -0800 (PST) X-Google-Smtp-Source: AK7set+TdKHFP+LFjChWXOKe+6pEInAa87oqdF1HvEX0ej7sefNtGxHqNCZv2eqfaQyRB01+7KG6 X-Received: by 2002:a17:902:ecd0:b0:19a:9269:7d1 with SMTP id a16-20020a170902ecd000b0019a926907d1mr24392561plh.4.1677452212415; Sun, 26 Feb 2023 14:56:52 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1677452212; cv=none; d=google.com; s=arc-20160816; b=ImVxV9jQAmRx/oIpAE9vyQicM6OJb9JBtfwGnDqCqZtNw/tyQ4hVhNjBJ1OqUWo1UX ok5CUyQvlg53vbYpgvFEDAdb3sj4GtT55hutOxKJM9xeuzufaEhQEZE+5JIuOO+eWpxo zfNe93jqOX5sNauUPPpVY0BuZF1PQkyOQQ0yUB3RewA6RcA4wcqyVefhN2CgMR4jaX9h zJbdodGnls1WkQ497U2HdIJPPsep7iJdLUnoT1DK19iCBgL8nTsQXCOlbkoHXSnrQf4t KzMgidnjtUw3UEDbnsxVyLWaN8BCc1KZWGZUB4RhNO3R9NmB3u8Cx//8hFOXalioAI+R zlGg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=MVdgWpAFCojRfEmtrK5jCjMCpct5NgUpVAZqrr++Uhs=; b=WsjJR43c81DFk96tEXOOaoXe4arcYEG8gYveb9PoV6kWxdbZHn4T+f95FGq0J+6ZsU ySc8m8RVnAQP7+XvF3MAkMRxO1JGVXRswljBnax5eTrNeCSdptAddA239QPK81BA1bLj WkXO5mVU/5VgRUG4ApHztw//mDTuNBRU6zRbKLgTiCnzArskFinc3qjZHQYsoOgn10uC bCu5m9loKMSzNI0aiTNf3gR9ICIzGrCfVO4IG2Bcbeyjk5DTR8FaL7xebszZx61O7xHv xk53CGNLcGdwPw9mtx7iA4EkeOqVlShdpUQ4QczOPHCGvhKiyLom6oo2WQF6T/2VvTMY kpFQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="r35ft/Rk"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id ks14-20020a170903084e00b0019cd68a1387si5540503plb.336.2023.02.26.14.56.39; Sun, 26 Feb 2023 14:56:52 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="r35ft/Rk"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229925AbjBZW4P (ORCPT + 99 others); Sun, 26 Feb 2023 17:56:15 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34566 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229868AbjBZWzw (ORCPT ); Sun, 26 Feb 2023 17:55:52 -0500 Received: from mail-wr1-x431.google.com (mail-wr1-x431.google.com [IPv6:2a00:1450:4864:20::431]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 075ED193FD for ; Sun, 26 Feb 2023 14:55:22 -0800 (PST) Received: by mail-wr1-x431.google.com with SMTP id r7so4412821wrz.6 for ; Sun, 26 Feb 2023 14:55:21 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=MVdgWpAFCojRfEmtrK5jCjMCpct5NgUpVAZqrr++Uhs=; b=r35ft/RkMStRpSVCURhPhaJIBRgTCDbZd5rsRy1lzDSGaJBVu0JesPbExfdnAl/Tac QJ/E2clO5AUJL6xFwDUY9RC+A1+OZ8/Ktob+21s2izraLFBE/7fmafkLEY0518MtAHZd Dd5jx9S5N52SF0D5hzj8gJtK39sVZoN849y19ktumbjZdg8NlfvCgp2PZWWQ/kmJVqjI 98yOquyeMyGgAQPGzm3PpoI+0CzPODzVr9MfACHMTXcQtQi1oP1HYT0DQsY/3u25YO2R RhX2csnfPKk7g/qLUsN78CZm6qO/s/63714iS7J9O9zC18XL6/AEAXippjNmsrsJULo1 WB2Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=MVdgWpAFCojRfEmtrK5jCjMCpct5NgUpVAZqrr++Uhs=; b=TbylKbjErn/jl2EGqYVch6xI9xUW2L0DaE2CgXs0uWk8NbFFrzfOmxTFCgjV833AIK pT3DGHEyJmS2FigIvuhoBDL+EOucZOx49+IrP1bX9uXRHd08rylGTcueJlwQ1spOrwYv mXKmKyJIRQPQjZRJfelTTWXfW/MA044KICKpSrXmscv7ysdlS0WvS3ECDstp8tDmDSRr 9I8/AqC65cbjtW7NvjZbWHpHVCvC9wpZFcHP1ZXYF5az0w+quUNVMoNAqisygVAd+FRR CMNFB6RiHWglxVLHWkFf7DBk2jRil6M+wqO7UkIE3GEopwu/P8GAu5Dla9LG+SvLDsAI SotA== X-Gm-Message-State: AO0yUKXas1F4wd8WonXRqNA6o7EbIo4zLIRaxb/pIG+fvCN6599pFGMW Pw9TvAaJMNFTtT+Sd5UIoealkw== X-Received: by 2002:adf:cd0c:0:b0:2c7:454:cee8 with SMTP id w12-20020adfcd0c000000b002c70454cee8mr17637194wrm.1.1677452108846; Sun, 26 Feb 2023 14:55:08 -0800 (PST) Received: from mai.box.freepro.com ([2a05:6e02:1041:c10:8baa:6b32:391b:62de]) by smtp.gmail.com with ESMTPSA id d10-20020a05600c3aca00b003eb369abd92sm6138074wms.2.2023.02.26.14.55.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 26 Feb 2023 14:55:08 -0800 (PST) From: Daniel Lezcano To: rafael@kernel.org, daniel.lezcano@linaro.org Cc: linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, Amit Kucheria , Zhang Rui Subject: [PATCH v3 11/20] thermal/drivers/spear: Don't use tz->device but pdev->dev Date: Sun, 26 Feb 2023 23:53:57 +0100 Message-Id: <20230226225406.979703-12-daniel.lezcano@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230226225406.979703-1-daniel.lezcano@linaro.org> References: <20230226225406.979703-1-daniel.lezcano@linaro.org> MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1758936131420147732?= X-GMAIL-MSGID: =?utf-8?q?1758936131420147732?= Use the spear associated device instead of the thermal zone device which belongs to the thermal framework internals. Signed-off-by: Daniel Lezcano --- drivers/thermal/spear_thermal.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/thermal/spear_thermal.c b/drivers/thermal/spear_thermal.c index 653439b965c8..6e78616a576e 100644 --- a/drivers/thermal/spear_thermal.c +++ b/drivers/thermal/spear_thermal.c @@ -137,7 +137,7 @@ static int spear_thermal_probe(struct platform_device *pdev) platform_set_drvdata(pdev, spear_thermal); - dev_info(&spear_thermal->device, "Thermal Sensor Loaded at: 0x%p.\n", + dev_info(&pdev->dev, "Thermal Sensor Loaded at: 0x%p.\n", stdev->thermal_base); return 0; From patchwork Sun Feb 26 22:53:58 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Lezcano X-Patchwork-Id: 61675 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp2131191wrd; Sun, 26 Feb 2023 14:56:27 -0800 (PST) X-Google-Smtp-Source: AK7set+Vb6HnLyfWqeWGmhQjPpVa1ZKKaGEt/5N2LgRyW50lV1h7meXzdGWFsT+wDuVbCx7PGQRe X-Received: by 2002:a05:6a00:4c8c:b0:5e9:5b99:da9a with SMTP id eb12-20020a056a004c8c00b005e95b99da9amr5095594pfb.3.1677452187520; Sun, 26 Feb 2023 14:56:27 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1677452187; cv=none; d=google.com; s=arc-20160816; b=dktPMB2Fifmt2y/Ut6AZj4j2/rcBU0xKf48zZAaHv5tZ3M0fa1VG0Fo6TTLXpbN+jq 5ZclvOR2E05Sck4segd54khaQ6XupRJ4A1g0o3kxh7XpIzw90dFL2T/58iocaIbW8liU GVkPEd+wQ+xDDbmljHigLgpKPpxwJEsBtc11OxgRePSlt1zcZ3Grb4JmiqNpEUPBuJB4 1o/iep43b2CDrg1QImJfBy9VrltFOeUR+RdTwODx8fg2FpIz/TMYhjriHPu62iZHfeIM rbKBPuMtRLO4n4IstClfr7gL7El8l/PoLy2bXFI3tNWnluqpJ++c90y8oVpV3z/xlYAx zpSA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=BXmjkOh9eXvrRm2J04oJvypw5mYaRO/S2JmWwbjlE4k=; b=eSMMrugI26yu1y47V+8MejJYM1v/FB3jOmGf/6FJzkB2eZCB3Do1Ig/Axm2cg2+cgh x8lLEX4XDQgXJBUp43W17/L6N8v1GpdsUKKPoYY/sI9URuRLlEKv1uRVMo3xRa/WYzk7 O5X3po9zVqvpB/7WmMht7IaLHrT4pktRnWKH5AcQYL1jDB0o8COJ/E/UZWcm60BC2/rl 9k4kX6P/FZ1orSWiLnCyG1bfkirFY5z9dEwLa79HapB9rwzvXMLvgfmOxt6XZ/QfysLz GIQtb95ZjxfzefB9OlHGTQyxXgNxD6L8kDIxs47Cf+n/TvwDvzlC/EREzrN2Z3TCTmGy geBw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Ulq4K5wY; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id d7-20020a056a0010c700b005a8e1cc59bfsi5627242pfu.295.2023.02.26.14.56.14; Sun, 26 Feb 2023 14:56:27 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Ulq4K5wY; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229676AbjBZWz5 (ORCPT + 99 others); Sun, 26 Feb 2023 17:55:57 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33896 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229530AbjBZWzm (ORCPT ); Sun, 26 Feb 2023 17:55:42 -0500 Received: from mail-wr1-x429.google.com (mail-wr1-x429.google.com [IPv6:2a00:1450:4864:20::429]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CAB7F1A485 for ; Sun, 26 Feb 2023 14:55:10 -0800 (PST) Received: by mail-wr1-x429.google.com with SMTP id l25so4426289wrb.3 for ; Sun, 26 Feb 2023 14:55:10 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=BXmjkOh9eXvrRm2J04oJvypw5mYaRO/S2JmWwbjlE4k=; b=Ulq4K5wYfUCqgbuDpFdoU/FOsRM5gdvtGGJkxmOE5wTgsg8FIIYuLq5AnAAeMVFuX1 LuOO09UYlRBUpR9mb09CAXegY4XZVnLCEy6RM6jyf7fWlzG+Kpg3svI+D8616y86Pr0F sxLGOI83muyWQyyhbDjOZeKdZj1XUykI3vRTYNWyfd3Xkdunxi96Zfb1Zew/OnNkIcG9 617PBpyvxp/npDLo+QPrUpDIwqYgJl4vPYKpkjLL7uxXa1lk950fT9tkG6kIeOaDvC3x uIgyvdHhCUzuCQnhd8yWU6ttAi/z56grDblwBPnCwVgPK3xZj6gF3wqDme7D0C97Bkne 15qA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=BXmjkOh9eXvrRm2J04oJvypw5mYaRO/S2JmWwbjlE4k=; b=c1xTr1G7UyBJI8VKGv03F49r0FNXlJYumixWrUKaqBc7d5om3gmUWJPeKeSE00UuOo OIUIPvs/j/YrSxap/iySnCA7rq/LDzmF63tLqJ7xf69BHBmVmL/sNhANQ4ZnZuRqleiM 9XyUEH34Hy1cTqFd8unUKgp/DVvS1t86pIYdTaSxHf6TPw7P1qAadqMIHClwUBJLfqHi SLvHLG/N4Z//vt4P1qiMuGAkMFYqaaZnDXmff/5YRxAlpzJ0eB8LMJ7d02Ww3ZAcMUgJ UuMUgQ1OYwDtRevJPd4gT8eypxnhMnTPmOJwl5ULKjWPFQdBmDQ+VoYAMX1bw9R/C8Ux EaKA== X-Gm-Message-State: AO0yUKVRCUMIG8I5/V2RJ+mbCTKFzk59rFviuxLcPl2Brr9uZPD1uUPB GNsFluhlseQknagVBzng9LN11Q== X-Received: by 2002:a05:6000:1801:b0:2c7:7701:2578 with SMTP id m1-20020a056000180100b002c777012578mr7274267wrh.54.1677452110349; Sun, 26 Feb 2023 14:55:10 -0800 (PST) Received: from mai.box.freepro.com ([2a05:6e02:1041:c10:8baa:6b32:391b:62de]) by smtp.gmail.com with ESMTPSA id d10-20020a05600c3aca00b003eb369abd92sm6138074wms.2.2023.02.26.14.55.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 26 Feb 2023 14:55:09 -0800 (PST) From: Daniel Lezcano To: rafael@kernel.org, daniel.lezcano@linaro.org Cc: linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, Guenter Roeck , "Rafael J . Wysocki" , Zhang Rui , Len Brown , Jean Delvare , Amit Kucheria , linux-acpi@vger.kernel.org (open list:ACPI THERMAL DRIVER), linux-hwmon@vger.kernel.org (open list:HARDWARE MONITORING) Subject: [PATCH v3 12/20] thermal: Add a thermal zone id accessor Date: Sun, 26 Feb 2023 23:53:58 +0100 Message-Id: <20230226225406.979703-13-daniel.lezcano@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230226225406.979703-1-daniel.lezcano@linaro.org> References: <20230226225406.979703-1-daniel.lezcano@linaro.org> MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1758936105106410068?= X-GMAIL-MSGID: =?utf-8?q?1758936105106410068?= In order to get the thermal zone id but without directly accessing the thermal zone device structure, add an accessor. Use the accessor in the hwmon_scmi and acpi_thermal. No functional change intented. Signed-off-by: Daniel Lezcano Acked-by: Guenter Roeck Acked-by: Rafael J. Wysocki --- drivers/acpi/thermal.c | 2 +- drivers/hwmon/scmi-hwmon.c | 2 +- drivers/thermal/thermal_core.c | 6 ++++++ include/linux/thermal.h | 6 ++++++ 4 files changed, 14 insertions(+), 2 deletions(-) diff --git a/drivers/acpi/thermal.c b/drivers/acpi/thermal.c index 392b73b3e269..255efa73ed70 100644 --- a/drivers/acpi/thermal.c +++ b/drivers/acpi/thermal.c @@ -842,7 +842,7 @@ static int acpi_thermal_register_thermal_zone(struct acpi_thermal *tz) goto acpi_bus_detach; dev_info(&tz->device->dev, "registered as thermal_zone%d\n", - tz->thermal_zone->id); + thermal_zone_device_id(tz->thermal_zone)); return 0; diff --git a/drivers/hwmon/scmi-hwmon.c b/drivers/hwmon/scmi-hwmon.c index 046ac157749d..364199b332c0 100644 --- a/drivers/hwmon/scmi-hwmon.c +++ b/drivers/hwmon/scmi-hwmon.c @@ -220,7 +220,7 @@ static int scmi_thermal_sensor_register(struct device *dev, sensor->name); } else { dev_dbg(dev, "Sensor '%s' attached to thermal zone ID:%d\n", - sensor->name, tzd->id); + sensor->name, thermal_zone_device_id(tzd)); } return 0; diff --git a/drivers/thermal/thermal_core.c b/drivers/thermal/thermal_core.c index 913ba9ca9792..46dedfe061df 100644 --- a/drivers/thermal/thermal_core.c +++ b/drivers/thermal/thermal_core.c @@ -1390,6 +1390,12 @@ const char *thermal_zone_device_type(struct thermal_zone_device *tzd) } EXPORT_SYMBOL_GPL(thermal_zone_device_type); +int thermal_zone_device_id(struct thermal_zone_device *tzd) +{ + return tzd->id; +} +EXPORT_SYMBOL_GPL(thermal_zone_device_id); + /** * thermal_zone_device_unregister - removes the registered thermal zone device * @tz: the thermal zone device to remove diff --git a/include/linux/thermal.h b/include/linux/thermal.h index 21686e676b3d..eb80cee4f64f 100644 --- a/include/linux/thermal.h +++ b/include/linux/thermal.h @@ -367,6 +367,7 @@ thermal_zone_device_register_with_trips(const char *, struct thermal_trip *, int void *thermal_zone_device_priv(struct thermal_zone_device *tzd); const char *thermal_zone_device_type(struct thermal_zone_device *tzd); +int thermal_zone_device_id(struct thermal_zone_device *tzd); int thermal_zone_bind_cooling_device(struct thermal_zone_device *, int, struct thermal_cooling_device *, @@ -449,6 +450,11 @@ static inline const char *thermal_zone_device_type(struct thermal_zone_device *t return NULL; } +static inline int thermal_zone_device_id(struct thermal_zone_device *tzd) +{ + return -ENODEV; +} + static inline int thermal_zone_device_enable(struct thermal_zone_device *tz) { return -ENODEV; } From patchwork Sun Feb 26 22:53:59 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Lezcano X-Patchwork-Id: 61682 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp2131326wrd; Sun, 26 Feb 2023 14:56:58 -0800 (PST) X-Google-Smtp-Source: AK7set9AQSGAmqvDEAiESydamjAlRaV91sxyQ5XnjNZ0LXJyP9T0VopVk1YHPhDtUbZIcdcamNkx X-Received: by 2002:a17:902:ecd0:b0:19a:9269:7d1 with SMTP id a16-20020a170902ecd000b0019a926907d1mr24392766plh.4.1677452218330; Sun, 26 Feb 2023 14:56:58 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1677452218; cv=none; d=google.com; s=arc-20160816; b=YwO8JPt4pE5iO+UEROz1U7Qt2GxHdf3hqNIy2em+JtS9O7qDLw8Gt2+kzQCgn3iB4e mWdmfdDg5SzFBb3Bkwx7LJpUit/xEDHuZUlddwcEdsiuP7DfIAKkYo1p88+txD1fLNfI 5N/8M1YObEvlWyJxRnbme2hqaBizwgEoUFzYVrGrElKKyI11KHVtw8gzkLwBKllapdGC 2qkoLK8+ssCDV3TQl22mDeSrEWW8x8VxsvPeZMkMSWY99pnwkuhBOi1DDVjRtecuWCtv eP83HuMe7FjvdtGkn5cVVPRlipc1sQlUZs2jk37yFM0dfIsLmcUOgNLO5Nlc1K9NLbBe Z46g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=dexA46MbFD/1LJf//eW76xTgHB+gKrlRAfZ8jnkaOvM=; b=W0q2TB/+EeXCwSBRoMo3pE2zRMzLOEEKopmS5CaYAcD8C+CozoHXoUqRSEwxI/s97P znb0O35084fsC5jkP4UqIuSQK8FKYSlar4A/DLnAVlIVas/3K7zuiardGfx6IHv+BkGL 26FxcXBuaYN12sSRd0wkIAp7Vla2u5HMP5RlAmea1amh/nA45RKED/LDfCWrTp0BUnnv K1k3u551//+LbmG30U9yh9q6aU8LYoUO+k5x4nEW7SXtFJItEvQrXFO4yMUBJbvSVvzk q+VUEhuxYsTqIS1q5LOsIrtlDPvUdy7ZCXY1dYqLGeT55olnoV/tIY4hmDoXcIdbDbcF gsqg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=OHQGVxYU; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id v13-20020a1709028d8d00b0019aa305e360si5541528plo.241.2023.02.26.14.56.45; Sun, 26 Feb 2023 14:56:58 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=OHQGVxYU; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229786AbjBZW42 (ORCPT + 99 others); Sun, 26 Feb 2023 17:56:28 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34576 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229696AbjBZWzw (ORCPT ); Sun, 26 Feb 2023 17:55:52 -0500 Received: from mail-wr1-x42e.google.com (mail-wr1-x42e.google.com [IPv6:2a00:1450:4864:20::42e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 453791A497 for ; Sun, 26 Feb 2023 14:55:26 -0800 (PST) Received: by mail-wr1-x42e.google.com with SMTP id t15so4409890wrz.7 for ; Sun, 26 Feb 2023 14:55:26 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=dexA46MbFD/1LJf//eW76xTgHB+gKrlRAfZ8jnkaOvM=; b=OHQGVxYUDNZxeRnZqcRN+uMUSgX2YZfaD26tyEg/q5/y5/W8rIqtESjkMaDxMvTyXM 14fXI+DfYB1jlOG85VuFrAvlgnZnGQzr3a+bCM025odzMOonRnE0+5erpzWFbT4beu1O uFy6JmlEH8UqFlEgmgLJulXxxEu2M7bXfEDcMOa8SYeqTJXe07+SeHPQaWW8NfompTht vlrsbABafmS0ubMqA0WJ+IQzOLnyqAGxcxQgbf0x7Bw5iybB0k0HSE+JYdGnFSumzUYO u7gZmzF4hWOi3QiL+4/5p1eCUxVvfeVNa/zOgO15PdO5qpcmFAYqGJwWccswC8JHnBIa IO1A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=dexA46MbFD/1LJf//eW76xTgHB+gKrlRAfZ8jnkaOvM=; b=dDQg3TGOOk9knARafM3RxxZsaw28FBtSsxdWSN43z6dFT4ohpkA1nrU37vb7k0QJQy hKi6r+5qdOarMDf+fYazdd2tw4rAgNP0zUIBwvLhSC69X56OsPv4mYCulcfbwVEbySA4 pKCEEWFYk3xSwXX/aMTay07U9WsuxCosEOHWs0Rt7zaitlBzMLjKj2n98IEUbVmTulCd JTGIPPRTDOAEwN2q5Pap09zA/TVqIcyc661qR7aXUbuR7rbDj9ebTpyizU1LS7LbMcLq DCiHRWMRGoXg/jydjD6IYhkGMloP7nwYOL4VGpHJD1VFwwei7Hh8Dl8LLLaT+yMlpQtI BMKQ== X-Gm-Message-State: AO0yUKV7pdlTjC1utvvIObiR2AN/k8wrp5R7L0F/2S5Mt9KEgjlQLId0 JsS5SGWej2fFLdijO7u+ABAgcw== X-Received: by 2002:adf:ed0b:0:b0:2c7:1e16:57cf with SMTP id a11-20020adfed0b000000b002c71e1657cfmr7898234wro.67.1677452115247; Sun, 26 Feb 2023 14:55:15 -0800 (PST) Received: from mai.box.freepro.com ([2a05:6e02:1041:c10:8baa:6b32:391b:62de]) by smtp.gmail.com with ESMTPSA id d10-20020a05600c3aca00b003eb369abd92sm6138074wms.2.2023.02.26.14.55.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 26 Feb 2023 14:55:14 -0800 (PST) From: Daniel Lezcano To: rafael@kernel.org, daniel.lezcano@linaro.org Cc: linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, Ido Schimmel , AngeloGioacchino Del Regno , Petr Machata , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Amit Kucheria , Zhang Rui , Eduardo Valentin , Keerthy , Matthias Brugger , Balsam CHIHI , Mark Brown , =?utf-8?q?Niklas_S=C3=B6derlund?= , netdev@vger.kernel.org (open list:MELLANOX ETHERNET SWITCH DRIVERS), linux-omap@vger.kernel.org (open list:TI BANDGAP AND THERMAL DRIVER), linux-arm-kernel@lists.infradead.org (moderated list:ARM/Mediatek SoC support), linux-mediatek@lists.infradead.org (moderated list:ARM/Mediatek SoC support) Subject: [PATCH v3 13/20] thermal: Use thermal_zone_device_type() accessor Date: Sun, 26 Feb 2023 23:53:59 +0100 Message-Id: <20230226225406.979703-14-daniel.lezcano@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230226225406.979703-1-daniel.lezcano@linaro.org> References: <20230226225406.979703-1-daniel.lezcano@linaro.org> MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1758936136798063419?= X-GMAIL-MSGID: =?utf-8?q?1758936136798063419?= Replace the accesses to 'tz->type' by its accessor version in order to self-encapsulate the thermal_zone_device structure. Signed-off-by: Daniel Lezcano Reviewed-by: Ido Schimmel #mlxsw Reviewed-by: AngeloGioacchino Del Regno #MediaTek LVTS --- drivers/net/ethernet/mellanox/mlxsw/core_thermal.c | 2 +- drivers/thermal/mediatek/lvts_thermal.c | 6 ++++-- drivers/thermal/ti-soc-thermal/ti-thermal-common.c | 2 +- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/drivers/net/ethernet/mellanox/mlxsw/core_thermal.c b/drivers/net/ethernet/mellanox/mlxsw/core_thermal.c index 722e4a40afef..b0a169e68df9 100644 --- a/drivers/net/ethernet/mellanox/mlxsw/core_thermal.c +++ b/drivers/net/ethernet/mellanox/mlxsw/core_thermal.c @@ -177,7 +177,7 @@ mlxsw_thermal_module_trips_update(struct device *dev, struct mlxsw_core *core, if (crit_temp > emerg_temp) { dev_warn(dev, "%s : Critical threshold %d is above emergency threshold %d\n", - tz->tzdev->type, crit_temp, emerg_temp); + thermal_zone_device_type(tz->tzdev), crit_temp, emerg_temp); return 0; } diff --git a/drivers/thermal/mediatek/lvts_thermal.c b/drivers/thermal/mediatek/lvts_thermal.c index beb835d644e2..216f53eb1385 100644 --- a/drivers/thermal/mediatek/lvts_thermal.c +++ b/drivers/thermal/mediatek/lvts_thermal.c @@ -305,7 +305,8 @@ static int lvts_set_trips(struct thermal_zone_device *tz, int low, int high) * 14-0 : Raw temperature for threshold */ if (low != -INT_MAX) { - pr_debug("%s: Setting low limit temperature interrupt: %d\n", tz->type, low); + pr_debug("%s: Setting low limit temperature interrupt: %d\n", + thermal_zone_device_type(tz), low); writel(raw_low, LVTS_H2NTHRE(base)); } @@ -318,7 +319,8 @@ static int lvts_set_trips(struct thermal_zone_device *tz, int low, int high) * * 14-0 : Raw temperature for threshold */ - pr_debug("%s: Setting high limit temperature interrupt: %d\n", tz->type, high); + pr_debug("%s: Setting high limit temperature interrupt: %d\n", + thermal_zone_device_type(tz), high); writel(raw_high, LVTS_HTHRE(base)); return 0; diff --git a/drivers/thermal/ti-soc-thermal/ti-thermal-common.c b/drivers/thermal/ti-soc-thermal/ti-thermal-common.c index 060f46cea5ff..0c8914017c18 100644 --- a/drivers/thermal/ti-soc-thermal/ti-thermal-common.c +++ b/drivers/thermal/ti-soc-thermal/ti-thermal-common.c @@ -44,7 +44,7 @@ static void ti_thermal_work(struct work_struct *work) thermal_zone_device_update(data->ti_thermal, THERMAL_EVENT_UNSPECIFIED); dev_dbg(data->bgp->dev, "updated thermal zone %s\n", - data->ti_thermal->type); + thermal_zone_device_type(data->ti_thermal)); } /** From patchwork Sun Feb 26 22:54:00 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Lezcano X-Patchwork-Id: 61683 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp2131352wrd; Sun, 26 Feb 2023 14:57:02 -0800 (PST) X-Google-Smtp-Source: AK7set/AGai2lwaEg2vW6+IRbEfAPbmB+SnTtpH1FwBfBFek7jUp47TodLqmKz+rxKJzmfm/eyWm X-Received: by 2002:a17:902:ab0c:b0:19a:b1ac:45d4 with SMTP id ik12-20020a170902ab0c00b0019ab1ac45d4mr24645768plb.3.1677452222134; Sun, 26 Feb 2023 14:57:02 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1677452222; cv=none; d=google.com; s=arc-20160816; b=JK7mMFsS4adoqi76vaIOIm6iRPAqNtfGLhtGWBoOXvtko2D2YmNeILi/w7Ysmxskzk +RVU8pXTmRpGStv5wgYRzgf1FWdm9WbCzPlVZsmmp1mR6UvTVfpomGnqqa7vwjs2Jcj3 AOIEF0HRgS+uHjZjisD3eajxkFUMAEjMkXyDtiG4WtjYyYCZzCPqsanZ06zRceRE2RUg 4GvD4tHX/Rim/zl+P5Un7XPrt+Btq2Hy4DRRAUeJjI2lMB/z1rofsopovL6uZ8N5gcMm 3bkGWWNtPsjCqFU+M7Uc9OmFXbylS05WIW+AxlAziO+M0jkIJUFGnpS8kj8nadG2OA7q veug== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=2PLESKqLcdlyFOxotfZU1hq7qJ9ZRCDMy4R1xbT74Go=; b=k36eK1klNvfwsJyPpy0vu2M0bAg8wDQqHouQLXUmu5qTN8oZsgne7Dqb6BV6u8OiFE GU1psSgDIxwQ1X3IMBfJUJB/CD6E+Oh8oOkWVZ/xXZHxRpzv6futYddH7Acfevh3SBeT ttQ6KKUj8vahN8mxpKgwG7CZSraPcQanC4o4THRvNH4b+oV8qU/3tnJNNJHT1n8Ekor1 e8DT6ZoBi9IG/vcK/9qQDe3zjJr3awsR2wsUqOlgyXhHQVRcx+o6fIwRLTbPEUjzdViA xyX895HLKg/D9pWGzdDhaG0IKukke4KdumbPK/9yOQ+7P55PQHBYfcKOYWf1EXnNK0gq p8jA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=t3fT9qy1; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id o15-20020a170902778f00b00192d6fb649dsi5143859pll.242.2023.02.26.14.56.49; Sun, 26 Feb 2023 14:57:02 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=t3fT9qy1; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229877AbjBZW4a (ORCPT + 99 others); Sun, 26 Feb 2023 17:56:30 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34898 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229706AbjBZWzx (ORCPT ); Sun, 26 Feb 2023 17:55:53 -0500 Received: from mail-wm1-x32b.google.com (mail-wm1-x32b.google.com [IPv6:2a00:1450:4864:20::32b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B81DF1A667 for ; Sun, 26 Feb 2023 14:55:28 -0800 (PST) Received: by mail-wm1-x32b.google.com with SMTP id az36so3173500wmb.1 for ; Sun, 26 Feb 2023 14:55:28 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=2PLESKqLcdlyFOxotfZU1hq7qJ9ZRCDMy4R1xbT74Go=; b=t3fT9qy1TXS8sFM4s0T5OGMJRogHttzdL/RLTWctsvHEvGWqXkkAMlfD/YUZHGZXhc JXvQR38z3UoJqNZBcS5YQysMXqLw9O5Y1t1MLojSdbF79hffoFec+5bPoWwwki0Ae/N7 Xs2UBiJRgLrRdbIF/FDD4nlluojuXIqvOxSL1b3ZJq4zduqp24dGXoYi/PR5IKlFa7OJ 8YZNOWo5vPShfecsNZbyHWEJm1AZCEKcVxtlQPEWztJAPQv8fP35icaSvu4jVscOYLnB 9pfjtd61wAHy1q1Zq2qlDdnitnRsruigHDR8VJnrHrL2cR1hY+ZrVPHpwi8gy9F4EVQZ h4AA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=2PLESKqLcdlyFOxotfZU1hq7qJ9ZRCDMy4R1xbT74Go=; b=3Bn6R0g9IIwqGmKNRZ8E1S2AgtIpRDYq2PKCVPWrhdqOFbkdW1tAW3m39SB3+rfrGL QaP4YjADfXv7SEw+b4Caof0Qo/Jf1NjEteyoY5jgbkvzVDveJWFP5zG+IJGpfVgkb7te x7MLnmSKC/M2GExoE0lXQiSnHtJ1W6odtxG9pJyhP11OzRSVLZ1g/kQWgQeMJlrnN2tN NFVH9V6bvxKwuctwL9fNODBiRXWWE6mNwcnvrZxzlp0WMqoLkWaaCors5isuW+t0lYOg 64bmHcmdXWcJSUbRrxNMg5AJtmZLMIQU/zq3vb2gLn+8IKu4okknsMdiY0YKPimuny+k Y0FQ== X-Gm-Message-State: AO0yUKXaRDHLmpZoSxMVmHCzVI9GqN2YthGcHHSs/QRX+yyWb4pmBRa0 fvvz2tf9jY9/yRY3Ucc5jIeSe14Hn3PrHIt6 X-Received: by 2002:a05:600c:43ca:b0:3dc:557f:6129 with SMTP id f10-20020a05600c43ca00b003dc557f6129mr11400366wmn.2.1677452116251; Sun, 26 Feb 2023 14:55:16 -0800 (PST) Received: from mai.box.freepro.com ([2a05:6e02:1041:c10:8baa:6b32:391b:62de]) by smtp.gmail.com with ESMTPSA id d10-20020a05600c3aca00b003eb369abd92sm6138074wms.2.2023.02.26.14.55.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 26 Feb 2023 14:55:15 -0800 (PST) From: Daniel Lezcano To: rafael@kernel.org, daniel.lezcano@linaro.org Cc: linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, Support Opensource , Amit Kucheria , Zhang Rui Subject: [PATCH v3 14/20] thermal/drivers/da9062: Don't access the thermal zone device fields Date: Sun, 26 Feb 2023 23:54:00 +0100 Message-Id: <20230226225406.979703-15-daniel.lezcano@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230226225406.979703-1-daniel.lezcano@linaro.org> References: <20230226225406.979703-1-daniel.lezcano@linaro.org> MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1758936141270050510?= X-GMAIL-MSGID: =?utf-8?q?1758936141270050510?= The driver is reading the passive polling rate in the thermal zone structure. We want to prevent the drivers to rummage around in the thermal zone structure. On the other side, the delay is what the driver passed to the thermal_zone_device_register() function, so it has already the information. Reuse the information we have instead of reading the information we set. Signed-off-by: Daniel Lezcano Reviewed-by: Adam Ward --- drivers/thermal/da9062-thermal.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/drivers/thermal/da9062-thermal.c b/drivers/thermal/da9062-thermal.c index e7097f354750..2d31b1f73423 100644 --- a/drivers/thermal/da9062-thermal.c +++ b/drivers/thermal/da9062-thermal.c @@ -41,6 +41,8 @@ #define DA9062_MILLI_CELSIUS(t) ((t) * 1000) +static unsigned int pp_tmp = DA9062_DEFAULT_POLLING_MS_PERIOD; + struct da9062_thermal_config { const char *name; }; @@ -95,7 +97,10 @@ static void da9062_thermal_poll_on(struct work_struct *work) thermal_zone_device_update(thermal->zone, THERMAL_EVENT_UNSPECIFIED); - delay = thermal->zone->passive_delay_jiffies; + /* + * pp_tmp is between 1s and 10s, so we can round the jiffies + */ + delay = round_jiffies(msecs_to_jiffies(pp_tmp)); queue_delayed_work(system_freezable_wq, &thermal->work, delay); return; } @@ -155,7 +160,6 @@ static int da9062_thermal_probe(struct platform_device *pdev) { struct da9062 *chip = dev_get_drvdata(pdev->dev.parent); struct da9062_thermal *thermal; - unsigned int pp_tmp = DA9062_DEFAULT_POLLING_MS_PERIOD; const struct of_device_id *match; int ret = 0; @@ -208,8 +212,7 @@ static int da9062_thermal_probe(struct platform_device *pdev) } dev_dbg(&pdev->dev, - "TJUNC temperature polling period set at %d ms\n", - jiffies_to_msecs(thermal->zone->passive_delay_jiffies)); + "TJUNC temperature polling period set at %d ms\n", pp_tmp); ret = platform_get_irq_byname(pdev, "THERMAL"); if (ret < 0) From patchwork Sun Feb 26 22:54:01 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Lezcano X-Patchwork-Id: 61684 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp2131435wrd; Sun, 26 Feb 2023 14:57:18 -0800 (PST) X-Google-Smtp-Source: AK7set+VwsMximLCr2CbQ7z5+7YktA7fw6+GxFKfcIsyGR3AJdRA5Q0mCHURKaowIbfpXBRinikL X-Received: by 2002:a17:90b:948:b0:236:7f67:8338 with SMTP id dw8-20020a17090b094800b002367f678338mr20098774pjb.4.1677452238132; Sun, 26 Feb 2023 14:57:18 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1677452238; cv=none; d=google.com; s=arc-20160816; b=wKHG6DQcqZDzX3x7By/fMKs+HcMVN614BAE9Z9zNt3cXZLE10Km4tWtJx0PYWCiQ/s QfoZUPXOzKEhisLVKKvzeGwPrgV0c/g1f+/1G5xacxtq7t/XqvXVClfii9eahes3OvkP lpZbM6qJ1hif0gwEEYabbdA8SPnC3b8GB37o1CLxFjoIAZL/oT7SqYIgGuMsUKXd7bBy +0oqIi3BT4c8jT2E3MGWyxZL3HMtCIuxMRvfr0XmdsfXRScu6YJI2f6dK1Cgk9CHIIkN e/ZqexNmGo1qMKBkYfKSfnxtEvtVXVsCbRWo3egvYrXWPi400e74mB908zUdjhPllrXI UfTw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=5G2AExiy4m1JD3VdlFvbqMiJd37t4DGUXITJCS9H4qI=; b=zuKZNNh0RwW8kdR+Br7TFQyJjJUnw2vZahyz7jQ+6y2HnvlORnkqN+ILxtd/2uF/tv StmuGJYWwUWtqrqIhHxTIESuPctTsC86K+diPC36AdX+bBMGlvL0wGrGBH+zRjt0B0+e jhjXlCTTrSWmXZABcyuL2PuDb7puTP9YGaVKSqneGIvm+zuWsGX+RNS52kLtLLNDQmN3 KXf8oUkG0a2eaAZN4PswCn49TGIjvr9oScIU1dlzIfQcN4azXMd9zDp7iekbhS3fcfAu 45DUy04F8ORE02q/zB5hZMxNZvb+hGW/iJaIebw8gf4h+a2RN5sUCmnBTXMTdv9Oq70Y Bz9Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=pxoj8LH7; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id a7-20020a17090a854700b0023750b6960csi5338678pjw.156.2023.02.26.14.57.05; Sun, 26 Feb 2023 14:57:18 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=pxoj8LH7; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229965AbjBZW4e (ORCPT + 99 others); Sun, 26 Feb 2023 17:56:34 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34110 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229875AbjBZWzx (ORCPT ); Sun, 26 Feb 2023 17:55:53 -0500 Received: from mail-wr1-x430.google.com (mail-wr1-x430.google.com [IPv6:2a00:1450:4864:20::430]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 06C33193C8 for ; Sun, 26 Feb 2023 14:55:30 -0800 (PST) Received: by mail-wr1-x430.google.com with SMTP id bx12so1260100wrb.11 for ; Sun, 26 Feb 2023 14:55:29 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=5G2AExiy4m1JD3VdlFvbqMiJd37t4DGUXITJCS9H4qI=; b=pxoj8LH76UCWOvpu+joi5qun8KjfDjYuYrKonUey/icQQfWFMlmNYyAej8zms6M7uk mv9HJqzgF+YBGkOjVLtdnOwYjzuYd4v6bUeha/htprPlI71Jdbe8zqqnpfkN/VpIxten JM+MXaFB5/z3Wf1cnGWro0y5lk85K4UCaG5hHOZRErsHoy2XrxMxwVybgLWfNKTyOBiP 2/d8s3Mqip6n5twohuw+QLZXQTP9T9IMFx1/I0AFj5XftbLSBCQBG8Ppv/9z96rddmqy Fuc5AQZ/YV/IH72ik+OWUERExy1ltUny6YLOLs//Pd/L/bygRji72EaIyrHpcgE5k6qf wJSA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=5G2AExiy4m1JD3VdlFvbqMiJd37t4DGUXITJCS9H4qI=; b=2KawCv/XAf7M7YckN8+SPOERH37Jj4K5jm8DkqnLEPiaHxxW5dqxCO3a0M/klb0YoD tquNUXpjkyWKl1+t+JPevo3OYVOXLEW99itArQgXe0z7hlNEPvx1n+EB4lgg0qhk7Hye v2qrCeuOhBqhuh8xAHh0kvXB5VPTjMbvc1tmiJ/tTUpokNgkw0JpFuLd85MFKPZtuH8L CfOTgHjXjfZdmu0axXVcOvQqwR6fzLN6kHr6PrUMROBazSuZAbhqKOOkG28kxNdzUiW2 oF1oG8iYFZvZF1ddorYtvtbUBDICm0zKZycj6WCGI0ZjaYd58pDTjWQIDT972fvw7SGg 6gBQ== X-Gm-Message-State: AO0yUKWPlhFIUOZU5IMxtm9+NMg7DE6H4DQErythoQnGZcwVoCfoCXo/ +n55IGregc5X8HnNocZr5CsjMA== X-Received: by 2002:adf:fc0e:0:b0:2c5:98f2:5b1d with SMTP id i14-20020adffc0e000000b002c598f25b1dmr16746929wrr.63.1677452117251; Sun, 26 Feb 2023 14:55:17 -0800 (PST) Received: from mai.box.freepro.com ([2a05:6e02:1041:c10:8baa:6b32:391b:62de]) by smtp.gmail.com with ESMTPSA id d10-20020a05600c3aca00b003eb369abd92sm6138074wms.2.2023.02.26.14.55.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 26 Feb 2023 14:55:16 -0800 (PST) From: Daniel Lezcano To: rafael@kernel.org, daniel.lezcano@linaro.org Cc: linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, Jean Delvare , Guenter Roeck , Amit Kucheria , Zhang Rui Subject: [PATCH v3 15/20] thermal/hwmon: Use the thermal_core.h header Date: Sun, 26 Feb 2023 23:54:01 +0100 Message-Id: <20230226225406.979703-16-daniel.lezcano@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230226225406.979703-1-daniel.lezcano@linaro.org> References: <20230226225406.979703-1-daniel.lezcano@linaro.org> MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1758936158024340428?= X-GMAIL-MSGID: =?utf-8?q?1758936158024340428?= The thermal_hwmon is playing with the thermal core code internals. Changing the code would be too invasive for now. We can consider the thermal_hwmon.c is part of the thermal core code as it provides a glue to tie the hwmon and the thermal zones. Let's include the thermal_core.h header. No functional change intended. Cc: Jean Delvare Cc: Guenter Roeck Signed-off-by: Daniel Lezcano Acked-by: Guenter Roeck Reviewed-by: Jean Delvare --- drivers/thermal/thermal_hwmon.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/thermal/thermal_hwmon.c b/drivers/thermal/thermal_hwmon.c index bc02095b314c..c59db17dddd6 100644 --- a/drivers/thermal/thermal_hwmon.c +++ b/drivers/thermal/thermal_hwmon.c @@ -17,6 +17,7 @@ #include #include "thermal_hwmon.h" +#include "thermal_core.h" /* hwmon sys I/F */ /* thermal zone devices with the same type share one hwmon device */ From patchwork Sun Feb 26 22:54:02 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Lezcano X-Patchwork-Id: 61685 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp2131674wrd; Sun, 26 Feb 2023 14:58:10 -0800 (PST) X-Google-Smtp-Source: AK7set9XoNoSsjhHfJk45VTwp0/FELtUGDvagwgqeK5f6z55smaR9pSXrsCAcF9tKi1eM4ePzqtj X-Received: by 2002:a05:6a20:6914:b0:cc:bf13:7b1c with SMTP id q20-20020a056a20691400b000ccbf137b1cmr5559008pzj.0.1677452290625; Sun, 26 Feb 2023 14:58:10 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1677452290; cv=none; d=google.com; s=arc-20160816; b=zu+iMu0V1aKcpJbLn/Cc6l7nyLCnFOdVBWevAzyKfmRHhs9m9HbEuHrlutSC8N4oFJ F9C/M6xJFsZl5KIiZknwt1gd+lilYW3uDeUVhKIPBs9iuyQn8jnQmAEiBR9kyGEFj/KZ 1VguxbSWPipRpd0nkCB6xisHrXbKsmQqL6G1jx5Ih2RwSZeK9ivKxDkyauBza403uQTL MY2/9oBNel6sTFFSTtFcYm+sLX+MYWA7pg9Mf+nOQ2C2T4AEnEugE7NLXfDA7SqsejYi AHcgHVLSjcZ38YaWj6K1QSK+KHfwbpfdCEALcEr+ub786T487Th42o0KfaH+Xdk9tP4d AAhw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=pyXE7dTHWFCFp1MXqwgdHIOsHgvb6Bb+CE7d2W8RwzE=; b=b+okksaH2e6gOHiay+GfU73ldRoW1m8xFCNDc4pUT/UsQQr6irzeo+G2t/XdvRYuxt ir/cD3qZoBxHHL9z4W0tU7/jUDxNFk5wvF7UC/XRY9vV5CmYejeE/BxMhrmqSVUWrg8+ qjqn/il0pwov6nyGyj6/qdIdthZcjIbmQFwYZzlPllsJFsutwTqKp4vLLcrI1QmWT9Co 790PRBsYGcCEFuAexGIuntPbhff/oZXRLdD6qj286cdaeTKSbuL16xiex8DiecLIqAGp iL/1fM1Ps03yjtJRtjfKo2+MNHi+UweNPd5/D34SzO4Y/JVLFCxnI0dEpagM551fHZLc Krbw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=j6cWgriM; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id c6-20020a6566c6000000b004fc205aa2adsi5482199pgw.65.2023.02.26.14.57.56; Sun, 26 Feb 2023 14:58:10 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=j6cWgriM; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229978AbjBZW4i (ORCPT + 99 others); Sun, 26 Feb 2023 17:56:38 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34918 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229797AbjBZWzx (ORCPT ); Sun, 26 Feb 2023 17:55:53 -0500 Received: from mail-wm1-x32e.google.com (mail-wm1-x32e.google.com [IPv6:2a00:1450:4864:20::32e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9C7531A4B9 for ; Sun, 26 Feb 2023 14:55:30 -0800 (PST) Received: by mail-wm1-x32e.google.com with SMTP id l7-20020a05600c4f0700b003e79fa98ce1so2796975wmq.2 for ; Sun, 26 Feb 2023 14:55:30 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=pyXE7dTHWFCFp1MXqwgdHIOsHgvb6Bb+CE7d2W8RwzE=; b=j6cWgriM44yIlkbnJMBl/LIF4DBN7K6sDq72ct5XO1gZhaT3JIxDgnr+g9hYq6D7T0 Vyz+spEgxahy83vuWL1RVBGN8w5RXhwOL9XlOts6Fm+PBKePIzzye1/OOUaDEKrKEydi hrpNFPGUHHEiuFh60nTc1FMwGsTsdjyq7Bnx9I0QQg5fA83wsAUmerRnXgbRVUaIS8Sl mHYKa8RNX8+Rayot/nUhsgSj3uJlORnBlF3RODAi5Ab8d75eg92iuz+BjKfF5oGKJ5aD iRCj349olk+3brNKo+p9Od/3XA45oZkFM/gwC9cTj5RnYQHayoOMHCIg+YPziH8rKN3T u8PA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=pyXE7dTHWFCFp1MXqwgdHIOsHgvb6Bb+CE7d2W8RwzE=; b=aIFXeNofHa4cbjqWAIMIRfYR+s6UalDE0uevxBeb+zxCikmAfc7bKmQPR3FM3NDs2W TC8MDRjywKUxxdvLmkmQk83vWyj5jBZbV093bKfQQzWnX6HrDFMUwXJ1YVrBURs31m7t lCbVUK0h54g0Vcnj7a708CR5Sf0StQgkntDVvbx1KJjUT89Ho1mNPKCNCQrubgIh33tp SiXlY9aVCFSIH6lHizTjWwSO3CQqfsC1Z5aqQhOWNapbrUPitzdzYf9B5DisWZCbN6e8 NCZamXptKShfxTgE6grf7iVWmMXTezIS40dqJ73niG2jyxWCBAXh6agg+PhFG66doLOM FRHA== X-Gm-Message-State: AO0yUKULbJjFHH7ezKUR3mkQNLxJPZLM67o3fGbdrrP4Q84R2O12ZaJF thA0tG1h+QiyB/3MUi9d/XaQTQ== X-Received: by 2002:a05:600c:70a:b0:3df:eecc:de2b with SMTP id i10-20020a05600c070a00b003dfeeccde2bmr13952434wmn.11.1677452119106; Sun, 26 Feb 2023 14:55:19 -0800 (PST) Received: from mai.box.freepro.com ([2a05:6e02:1041:c10:8baa:6b32:391b:62de]) by smtp.gmail.com with ESMTPSA id d10-20020a05600c3aca00b003eb369abd92sm6138074wms.2.2023.02.26.14.55.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 26 Feb 2023 14:55:18 -0800 (PST) From: Daniel Lezcano To: rafael@kernel.org, daniel.lezcano@linaro.org Cc: linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, Amit Kucheria , Zhang Rui , Thierry Reding , Jonathan Hunter , Jernej Skrabec , AngeloGioacchino Del Regno , Florian Fainelli , =?utf-8?q?Niklas_S=C3=B6derlund?= , linux-tegra@vger.kernel.org (open list:TEGRA ARCHITECTURE SUPPORT) Subject: [PATCH v3 16/20] thermal/drivers/tegra: Remove unneeded lock when setting a trip point Date: Sun, 26 Feb 2023 23:54:02 +0100 Message-Id: <20230226225406.979703-17-daniel.lezcano@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230226225406.979703-1-daniel.lezcano@linaro.org> References: <20230226225406.979703-1-daniel.lezcano@linaro.org> MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1758936213204746920?= X-GMAIL-MSGID: =?utf-8?q?1758936213204746920?= The function tegra_tsensor_enable_hw_channel() takes the thermal zone lock to prevent "a potential" race with a call to set_trips() callback. The driver must not play with the thermal framework core code internals. The tegra_tsensor_enable_hw_channel() is called by: - the suspend / resume callbacks - the probe function after the thermal zones are registered The thermal zone lock taken in this function is supposed to protect from a call to the set_trips() callback which writes in the same register. The potential race is when suspend / resume are called at the same time as set_trips. This one is called only in thermal_zone_device_update(). - At suspend time, the 'in_suspend' is set, thus the thermal_zone_device_update() bails out immediately and set_trips is not called during this moment. - At resume time, the thermal zone is updated at PM_POST_SUSPEND, thus the driver has already set the TH2 temperature. - At probe time, we register the thermal zone and then we set the TH2. The only scenario I can see so far is the interrupt fires, the thermal_zone_update() is called exactly at the moment tegra_tsensor_enable_hw_channel() a few lines after registering it. Disable the interrupt before setting up the hw channels and then enable it. We close the potential race window without using the thermal zone's lock. Signed-off-by: Daniel Lezcano --- drivers/thermal/tegra/tegra30-tsensor.c | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/drivers/thermal/tegra/tegra30-tsensor.c b/drivers/thermal/tegra/tegra30-tsensor.c index 4b2ea17910cd..3506c3f3c474 100644 --- a/drivers/thermal/tegra/tegra30-tsensor.c +++ b/drivers/thermal/tegra/tegra30-tsensor.c @@ -359,9 +359,6 @@ static int tegra_tsensor_enable_hw_channel(const struct tegra_tsensor *ts, tegra_tsensor_get_hw_channel_trips(tzd, &hot_trip, &crit_trip); - /* prevent potential racing with tegra_tsensor_set_trips() */ - mutex_lock(&tzd->lock); - dev_info_once(ts->dev, "ch%u: PMC emergency shutdown trip set to %dC\n", id, DIV_ROUND_CLOSEST(crit_trip, 1000)); @@ -404,8 +401,6 @@ static int tegra_tsensor_enable_hw_channel(const struct tegra_tsensor *ts, val |= FIELD_PREP(TSENSOR_SENSOR0_CONFIG0_INTR_THERMAL_RST_EN, 1); writel_relaxed(val, tsc->regs + TSENSOR_SENSOR0_CONFIG0); - mutex_unlock(&tzd->lock); - err = thermal_zone_device_enable(tzd); if (err) { dev_err(ts->dev, "ch%u: failed to enable zone: %d\n", id, err); @@ -592,12 +587,24 @@ static int tegra_tsensor_probe(struct platform_device *pdev) return dev_err_probe(&pdev->dev, err, "failed to request interrupt\n"); + /* + * Disable the interrupt so set_trips() can not be called + * while we are setting up the register + * TSENSOR_SENSOR0_CONFIG1. With this we close a potential + * race window where we are setting up the TH2 and the + * temperature hits TH1 resulting to an update of the + * TSENSOR_SENSOR0_CONFIG1 register in the ISR. + */ + disable_irq(irq); + for (i = 0; i < ARRAY_SIZE(ts->ch); i++) { err = tegra_tsensor_enable_hw_channel(ts, i); if (err) return err; } + enable_irq(irq); + return 0; } From patchwork Sun Feb 26 22:54:03 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Lezcano X-Patchwork-Id: 61680 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp2131281wrd; Sun, 26 Feb 2023 14:56:48 -0800 (PST) X-Google-Smtp-Source: AK7set/c5O8V+iqntoQEXg9qJ5ul1FTi4V2mrrRT3pWxgKLxqSqL2egYDe+eavRBC0GfTkY6+t11 X-Received: by 2002:a05:6a00:2ca:b0:5de:a362:ecf1 with SMTP id b10-20020a056a0002ca00b005dea362ecf1mr12415270pft.0.1677452207726; Sun, 26 Feb 2023 14:56:47 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1677452207; cv=none; d=google.com; s=arc-20160816; b=PrCS250rS1FsNN/WEjKdVKGXR6Smhbx2h5dRqCYwDMbd3yBRP8i9drGofJ6KqtHiwW lbh/M9LrnklgujaWg4WzeDjda+YGkJECb3fnz1ObBUaUVTgtV3nbUsP4P/g9Wkd0X8Xa nQlEoDzCqj6FcCte1rpmQpBJ1iNCpZVSEk0hb6iCL4eYQTXZSluVRU7L2cKAz/Kq+qdD Jm8jJQD46eSTYXC8BolG1vvCWDjWpHxA5EvLVz6kk2zEFVY5pprS/1vINha5V4laPE/n RLG2roSaQuBVE6/ZWVezxULK7TdhVGjH8/xCC8CTjH/w96CFlJHr4eI4RB5603el1jUI hY+A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=C2s/AS9OMV5i6t0w60QjnkUP8k7sKtqb93EMncEZug0=; b=Bzakk70zzTKwWP2gKwXnXL27lXtco6+EEKQQLdQhVXqBeSKCPIFrFS3Dcdkw+j0AOE dV739JbN3oiU9KtVsTA1sA58kfQAz0VGN0mRqhFoqmWh0dx8M0HiagomCynRV1tRDBLr U91iwDCAcbDurZkIk6aPP3UFtmELAQ727HYktSxVIERfjLGC7doleTROkEMUHbBakCWS vzRUfHMgmIDdrWkQJrAygVroVF9tRLPz761l9dELdzUqF1sltG/aYF2XXhSrIXCzAuNV y4z0V/f2Cac55MDFdTkwjapdBQM5IV/HFYUSTcBmu7C+U3cWa/83yrJTGOhwYvlhBxcv QK5A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=RrXcIqzc; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id 66-20020a621845000000b00593ac87bbadsi4942863pfy.202.2023.02.26.14.56.34; Sun, 26 Feb 2023 14:56:47 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=RrXcIqzc; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229915AbjBZW4M (ORCPT + 99 others); Sun, 26 Feb 2023 17:56:12 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34562 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229719AbjBZWzw (ORCPT ); Sun, 26 Feb 2023 17:55:52 -0500 Received: from mail-wm1-x32a.google.com (mail-wm1-x32a.google.com [IPv6:2a00:1450:4864:20::32a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9026318B2E for ; Sun, 26 Feb 2023 14:55:21 -0800 (PST) Received: by mail-wm1-x32a.google.com with SMTP id fm20-20020a05600c0c1400b003ead37e6588so5920877wmb.5 for ; Sun, 26 Feb 2023 14:55:21 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=C2s/AS9OMV5i6t0w60QjnkUP8k7sKtqb93EMncEZug0=; b=RrXcIqzcrWf2lNRMsPY+D8nUU5rGWSM/ctrK4w2nFXbnQIS281ZCN9hQiySwkMaUmg upw/yejus11mTRnMf9kyQ8gqoPpRUayc7Le6DAYr8ShIyNEV8dg63GJFOplB+8exl3wJ Em6nycsPTYfFl+zDoWh5qQ9+mHwo48EJhqJK0rjys+U3DHccFifM5dHgsYx+C/EWFYRc cbKjrnTFV1f9nQ4eHFai6JIqCKWyRn/dQWMKYr/8MrIJLqCcfaP4SlVyfdiQOaLEvGGb cVnH3W/4JRlsSbhTSaUAhTampVjDhPKyEAtrQ7rClYMgA3/L96CQykGpc6QpVg+ie+VQ ICRA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=C2s/AS9OMV5i6t0w60QjnkUP8k7sKtqb93EMncEZug0=; b=BcCNETphevytZiiVaU1jV/Izgk6NX+EdBM4hyQcERI0I0oJpJMlrgqZi/q8cA6ohQ/ 9DYiuo0jHo4DOKdreXk/JQ6aZVKPjStSGPeS6m3cQuNDct3V7wT3vZDaOj50FH2Kw9T6 ZjiUQqL2fb9Cjp6iNY5YfxXgyMov6UEJdZ65O2RnCPmcE+FpFtIREvoQ30fVOltesJX6 4sw3rM/+Tx8pB8iw7Lcqr9j1pdMVrbJatky3H6Es7H0P+crDU3Zf5sKMkvAlTKeOXcxv XCODvg+bABQWqjBTIMEv7KeqzgZNO6FeQHo3asEfpK1uc9pIkRBmVrWKJGwTl2Wd3DrB /26g== X-Gm-Message-State: AO0yUKXaLn+fV+Rf5EVzkSWqyl19zinXIy2NrnB5HfS++7dLeL+W4sDj 8PodgqtQ/bfeIbaS9D0fWnItcA== X-Received: by 2002:a05:600c:3089:b0:3eb:29fe:734a with SMTP id g9-20020a05600c308900b003eb29fe734amr6436608wmn.39.1677452121129; Sun, 26 Feb 2023 14:55:21 -0800 (PST) Received: from mai.box.freepro.com ([2a05:6e02:1041:c10:8baa:6b32:391b:62de]) by smtp.gmail.com with ESMTPSA id d10-20020a05600c3aca00b003eb369abd92sm6138074wms.2.2023.02.26.14.55.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 26 Feb 2023 14:55:20 -0800 (PST) From: Daniel Lezcano To: rafael@kernel.org, daniel.lezcano@linaro.org Cc: linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, Amit Kucheria , Zhang Rui , Thierry Reding , Jonathan Hunter , =?utf-8?q?Niklas_S=C3=B6derlund?= , AngeloGioacchino Del Regno , Jernej Skrabec , Florian Fainelli , linux-tegra@vger.kernel.org (open list:TEGRA ARCHITECTURE SUPPORT) Subject: [PATCH v3 17/20] thermal/tegra: Do not enable the thermal zone, it is already enabled Date: Sun, 26 Feb 2023 23:54:03 +0100 Message-Id: <20230226225406.979703-18-daniel.lezcano@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230226225406.979703-1-daniel.lezcano@linaro.org> References: <20230226225406.979703-1-daniel.lezcano@linaro.org> MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1758936126207789603?= X-GMAIL-MSGID: =?utf-8?q?1758936126207789603?= The code enables the thermal zone after setting it up. But the thermal zone is already enabled by thermal_of_zone_register() function. Signed-off-by: Daniel Lezcano --- drivers/thermal/tegra/tegra30-tsensor.c | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/drivers/thermal/tegra/tegra30-tsensor.c b/drivers/thermal/tegra/tegra30-tsensor.c index 3506c3f3c474..e38902abf207 100644 --- a/drivers/thermal/tegra/tegra30-tsensor.c +++ b/drivers/thermal/tegra/tegra30-tsensor.c @@ -346,7 +346,7 @@ static int tegra_tsensor_enable_hw_channel(const struct tegra_tsensor *ts, { const struct tegra_tsensor_channel *tsc = &ts->ch[id]; struct thermal_zone_device *tzd = tsc->tzd; - int err, hot_trip = 0, crit_trip = 0; + int hot_trip = 0, crit_trip = 0; u32 val; if (!tzd) { @@ -401,12 +401,6 @@ static int tegra_tsensor_enable_hw_channel(const struct tegra_tsensor *ts, val |= FIELD_PREP(TSENSOR_SENSOR0_CONFIG0_INTR_THERMAL_RST_EN, 1); writel_relaxed(val, tsc->regs + TSENSOR_SENSOR0_CONFIG0); - err = thermal_zone_device_enable(tzd); - if (err) { - dev_err(ts->dev, "ch%u: failed to enable zone: %d\n", id, err); - return err; - } - return 0; } From patchwork Sun Feb 26 22:54:04 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Lezcano X-Patchwork-Id: 61686 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp2133008wrd; Sun, 26 Feb 2023 15:01:43 -0800 (PST) X-Google-Smtp-Source: AK7set+JUE6kWJHnWPpv0rfvP5qFwZXsmMcHVL9mziS8QMHJm6UaElq1IF7OUOk+54eaTBHxwl2m X-Received: by 2002:a17:90a:c915:b0:234:175:839a with SMTP id v21-20020a17090ac91500b002340175839amr19654003pjt.4.1677452503396; Sun, 26 Feb 2023 15:01:43 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1677452503; cv=none; d=google.com; s=arc-20160816; b=Dxw7gTXXLl0TY6ZleIYBBp6955Envz/X+TBtdtsw5/D1N6jb6W2pa32RCU7id7jke6 u4P1NjXOC/NecOEYGnO5cp10Y15hkIWnvGxgvE+LE4cnZNcZDDFZZ6JAiB3varJIg5E9 28FL/+WUczOO1klt4hp1H5O8V4apbZvjh1FKYD3mkWXd4AhQvwMkxln3A1Y1R4yx0AKq wUsEKs4D5occJWr3EjxFvRFcKG48ncsj8thLp/iW4D0cMzolVJC8irgZC6vkw2foCQxj OWprp0aQtHTfEX/sLL5ZzbaSqpEiz+jXyyteZrrBqonUiBULd11BIwGmv+Xjgk7EzSpN 9bxg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=GP9BUpkAAnItZXgZisVn1kO1oz9qmtA+bV8jqWpOtJM=; b=h+xAnOFOP1SlZIhqF2DoPj7ys8wl2X+TOsA0v2y1OxQ2l7rZR/LEQ7ATxwtdJyw1Kz 8KsMjHoV40zqV9qNQTGj5qLjTWKVbQpuACe2IjDmZXq5OPcbCcPzy2NukyosevVCxMR3 vXhozqPCirNEw1id3oe7MhTBSwgxk2neGkBVk0osWI2/w9eu4a5OqiFdmnGq7WqLmZnR 7B+ImjMiqk3/FQrGn6GXmuC5GzT0EkwT8/vBEy6xquS1Xe0FSiBZ8VLlDUan0OceyLs1 lH+LPQ2FNSNajwjwHUuZ01xnOI8dBFZRxFlHwZ08zln2t8Jd+Mvn7pkAIypf7OV+Qpft xWzg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=xNF00HDi; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id ce17-20020a17090aff1100b002291da0e5efsi5550341pjb.132.2023.02.26.15.01.29; Sun, 26 Feb 2023 15:01:43 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=xNF00HDi; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229987AbjBZW4n (ORCPT + 99 others); Sun, 26 Feb 2023 17:56:43 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34934 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229815AbjBZWzx (ORCPT ); Sun, 26 Feb 2023 17:55:53 -0500 Received: from mail-wm1-x332.google.com (mail-wm1-x332.google.com [IPv6:2a00:1450:4864:20::332]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AE5931A4BC for ; Sun, 26 Feb 2023 14:55:32 -0800 (PST) Received: by mail-wm1-x332.google.com with SMTP id l7-20020a05600c4f0700b003e79fa98ce1so2797038wmq.2 for ; Sun, 26 Feb 2023 14:55:32 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=GP9BUpkAAnItZXgZisVn1kO1oz9qmtA+bV8jqWpOtJM=; b=xNF00HDit8Cyi0Oy7Ym4GIPyk2UGsV3BL68mxgXoc22L7UD8alc5G6Ga556KC7e1XR R2B16kLw4VKmDDtmePz91xiBdYvL11ag+ZZuL5MtrYAKENpv9Dg/oFKh+Rke2nO6aUAE OVL2qNQa5GCxSHHxR6HoQiHCPJsrkIBW7QX98P51B+UpYkC3nOqI5pe9lkbpNtq1FA8/ St07IP5TR7zECP7DRXto6y2rhvcwMuScPZjhXPJl4XDCRc9g/XjR060oVex8dxnu9Gi3 03rrGV9ZCbF1iImOCrl81nKrjm8xCMcqPzKEZ6/KHLob9r3o/1gk8SwJGQTcZ777zACv z2rw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=GP9BUpkAAnItZXgZisVn1kO1oz9qmtA+bV8jqWpOtJM=; b=VHhjKcBW6mo4jcH01T4HJDvkGl8yBvnfU2wcbq2aYAAq8EgTxjxU8A8UjNbP+YmAgY MubEATAz9LQFV24yt33f1oY48jAoC6z0ivrMf3yV8orA3negcswyOQbYqEoc+XY7PqLh rasNOK56jsQbenLPsZEp47OqvCBTGfhungzcz/jqnU3wqfNokp/Ij33j8np2BB17BHBc 2xcAXR4FrscXQWhk2NzuJXb87y95rm4N9yjG8plddjB5WSAJYDHXid4UvHCsSbaPWqUn 31858nGtxi8kG+xgC2c1p9Mq+fwcTaQTzEuTMy3TIBwSNkMJ2G2ZTni/3cvM4MhEP0Bp sfcg== X-Gm-Message-State: AO0yUKUhQ73rOceN9XrPgXG6GoF7nwdtosAefhippXMHnJ5UEBRMPUII m0MM0GWaCORc6jm+H+EJWW8q5Q== X-Received: by 2002:a05:600c:3416:b0:3eb:3cc9:9f85 with SMTP id y22-20020a05600c341600b003eb3cc99f85mr2580319wmp.26.1677452122423; Sun, 26 Feb 2023 14:55:22 -0800 (PST) Received: from mai.box.freepro.com ([2a05:6e02:1041:c10:8baa:6b32:391b:62de]) by smtp.gmail.com with ESMTPSA id d10-20020a05600c3aca00b003eb369abd92sm6138074wms.2.2023.02.26.14.55.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 26 Feb 2023 14:55:21 -0800 (PST) From: Daniel Lezcano To: rafael@kernel.org, daniel.lezcano@linaro.org Cc: linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, Peter Kaestle , Hans de Goede , Mark Gross , platform-driver-x86@vger.kernel.org (open list:ACER ASPIRE ONE TEMPERATURE AND FAN DRIVER) Subject: [PATCH v3 18/20] thermal/drivers/acerhdf: Make interval setting only at module load time Date: Sun, 26 Feb 2023 23:54:04 +0100 Message-Id: <20230226225406.979703-19-daniel.lezcano@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230226225406.979703-1-daniel.lezcano@linaro.org> References: <20230226225406.979703-1-daniel.lezcano@linaro.org> MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1758936436071291338?= X-GMAIL-MSGID: =?utf-8?q?1758936436071291338?= The thermal zone device structure is in the process of being private to the thermal framework core code. This driver is directly accessing and changing the monitoring polling rate. After discussing with the maintainers of this driver, having the polling interval at module loading time is enough for their purpose. Change the code to take into account the interval when the module is loaded but restrict the permissions so the value can not be changed afterwards. Signed-off-by: Daniel Lezcano Acked-by: Peter Kaestle Reviewed-by: Hans de Goede --- drivers/platform/x86/acerhdf.c | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/drivers/platform/x86/acerhdf.c b/drivers/platform/x86/acerhdf.c index 1956469c3457..61f1c3090867 100644 --- a/drivers/platform/x86/acerhdf.c +++ b/drivers/platform/x86/acerhdf.c @@ -79,7 +79,6 @@ static unsigned int list_supported; static unsigned int fanstate = ACERHDF_FAN_AUTO; static char force_bios[16]; static char force_product[16]; -static unsigned int prev_interval; static struct thermal_zone_device *thz_dev; static struct thermal_cooling_device *cl_dev; static struct platform_device *acerhdf_dev; @@ -346,20 +345,15 @@ static void acerhdf_check_param(struct thermal_zone_device *thermal) trips[0].temperature = fanon; trips[0].hysteresis = fanon - fanoff; - if (kernelmode && prev_interval != interval) { + if (kernelmode) { if (interval > ACERHDF_MAX_INTERVAL) { pr_err("interval too high, set to %d\n", ACERHDF_MAX_INTERVAL); interval = ACERHDF_MAX_INTERVAL; } + if (verbose) pr_notice("interval changed to: %d\n", interval); - - if (thermal) - thermal->polling_delay_jiffies = - round_jiffies(msecs_to_jiffies(interval * 1000)); - - prev_interval = interval; } } @@ -807,5 +801,5 @@ static const struct kernel_param_ops interval_ops = { .get = param_get_uint, }; -module_param_cb(interval, &interval_ops, &interval, 0600); +module_param_cb(interval, &interval_ops, &interval, 0000); MODULE_PARM_DESC(interval, "Polling interval of temperature check"); From patchwork Sun Feb 26 22:54:05 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Lezcano X-Patchwork-Id: 61688 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp2147075wrd; Sun, 26 Feb 2023 15:49:52 -0800 (PST) X-Google-Smtp-Source: AK7set+O9M80BcVakjvpaVsIk338dWK1eO3eVlNZ1uIlDJUb5f0ZXu7keqExsnh3EnVAOF29k03z X-Received: by 2002:a17:902:bb0f:b0:197:8e8e:f15 with SMTP id im15-20020a170902bb0f00b001978e8e0f15mr24460335plb.6.1677455392017; Sun, 26 Feb 2023 15:49:52 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1677455392; cv=none; d=google.com; s=arc-20160816; b=NiT5pEGiPmZ7VqNoxbhWO39c2cQyI+un+bv157lv9BDKb2NCn2cAqSp3+qlP7e2ya4 OmnMXFueUB2gvOQyqgExcfPlt/MYe1qKT0cahx7seRc3HGZfabxzefKq6uTDGcCZGV/j U1LJ0yc3LKc1WKfJQl367P3y7JzAdFXxKdFX6bTkT0k3BCd/VtQE5cHj20K1jqAzb3aE J5TaaugCaJ5nKl2oe0DKWlcEx5AkY8wosptOKVm8p4p5HgC5mGNMw9zPUHVEH6Zn+EaF 3eExU3PT2GK6k1rhvQGg/Q2LfYtAZF6IfS/9ukDGv/0210RDI7Gt89UUCLjW71wp9n84 3mkA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=FS5MMzUrtYY5N2w5QCadh2L/6Lyuv9jfcaqNKoRqTRU=; b=wavPZvGsmX40PyYH0MV1omqXRknam8WucJv4q/VhmQ34Yd9PU8JUmk8Su40Nm4YSFh xDZ5cWVbB3L5iooj3iGVisZ+1mN6n2/ml7XuRgfMuh5Pds8snYtnLn2e8lsnTw89VElp xb9BbaMlKfZ0CsmoZVR0qSPEdnk4h28v4MYjqw2UYICzP1mgoNv3H+oEUhXMxgsHodqy 6pHvD97IMI6Mjs50hWRbk1kzb3yVfiQiJE62VCzbm1mqh4R3ErPoDnJxfEpnkVIn2jG8 NJPN2Y+IqwbV5/8OaZCUypRUrs2p6P4QsA0bD60TqXnE9dPOyXSxfQ8m6Ly5mvw7Yo4D flpQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=DgprYmeH; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id u6-20020a170902b28600b0019ced5b1a21si5341145plr.482.2023.02.26.15.49.36; Sun, 26 Feb 2023 15:49:51 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=DgprYmeH; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230001AbjBZW4v (ORCPT + 99 others); Sun, 26 Feb 2023 17:56:51 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34594 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229701AbjBZWzx (ORCPT ); Sun, 26 Feb 2023 17:55:53 -0500 Received: from mail-wr1-x42f.google.com (mail-wr1-x42f.google.com [IPv6:2a00:1450:4864:20::42f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6E8E51A649 for ; Sun, 26 Feb 2023 14:55:33 -0800 (PST) Received: by mail-wr1-x42f.google.com with SMTP id bt28so4408526wrb.8 for ; Sun, 26 Feb 2023 14:55:33 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=FS5MMzUrtYY5N2w5QCadh2L/6Lyuv9jfcaqNKoRqTRU=; b=DgprYmeHBjj1QzTvylKGYwPam1q6cXCND0PzN/JHv1fIlxg+oS9gS+MrmgNuKZAI+1 O0pEW4qREyxsNftF17Uw8vvkC+iavEQR9LTDHma6fBAAyP36KS2OJNzs/bhwnmNz8TH6 3CFZBmKkQA2h6kzBDu5TuqiyoaFEthZxnHPJNj5QLUWeprwFH7S/p8ZP3z9iQceNrZTv E8vzBjUCBo2dogzXpNgzLOy4cJkNhNk8YRP7IG8g3OKyfPto5PBgvwl88Mtkg2D53HP5 8mRk5vBC6uc9vttrEFYbzXzvaTZnKXgYxFHXX4P9LEItr7jTuyw3BusYV0zir1MY1pYQ /9iQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=FS5MMzUrtYY5N2w5QCadh2L/6Lyuv9jfcaqNKoRqTRU=; b=OH2xIQRSiFIAhvM+YmAvVetEpSqRMMM54hIsCgFSBt+fWzIfochVa8bWYFcdhhneTJ yGzwKqawb39kVmvjhSxQqaqOUcLj0sHuBOuUsXqEv1qvmLntXh047ozb/Sekskto7ZfB kUAJrhNGeFwDoUHRgoQ44F/3HTtOOHeeP50qP4+yzv0TMeKeQgl4LKo/qmJKh8UxPrLt jwKCRBswcZulXdBbKMVM1yiT7H50oZkByo4frbZO+kBVMCW/RF0TVY9jIHo2xOwrqA77 fn3JXyUoXbG3PfWwQP94rSvQ0Ayqpj/BnH33xyNSEGuJDKSUU2LfpSKiRjt2gspI2oLr T50A== X-Gm-Message-State: AO0yUKVo8KtaeviomwGwI4YY1PsdozuB7qqOq1YRo3nTdnWPQxkTOToz ELUYj95K8y5dYzHkjCp5JO77qA== X-Received: by 2002:a05:6000:1110:b0:2c8:42b5:8030 with SMTP id z16-20020a056000111000b002c842b58030mr6254219wrw.62.1677452123541; Sun, 26 Feb 2023 14:55:23 -0800 (PST) Received: from mai.box.freepro.com ([2a05:6e02:1041:c10:8baa:6b32:391b:62de]) by smtp.gmail.com with ESMTPSA id d10-20020a05600c3aca00b003eb369abd92sm6138074wms.2.2023.02.26.14.55.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 26 Feb 2023 14:55:23 -0800 (PST) From: Daniel Lezcano To: rafael@kernel.org, daniel.lezcano@linaro.org Cc: linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, Peter Kaestle , Hans de Goede , Mark Gross , platform-driver-x86@vger.kernel.org (open list:ACER ASPIRE ONE TEMPERATURE AND FAN DRIVER) Subject: [PATCH v3 19/20] thermal/drivers/acerhdf: Remove pointless governor test Date: Sun, 26 Feb 2023 23:54:05 +0100 Message-Id: <20230226225406.979703-20-daniel.lezcano@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230226225406.979703-1-daniel.lezcano@linaro.org> References: <20230226225406.979703-1-daniel.lezcano@linaro.org> MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1758939465161248277?= X-GMAIL-MSGID: =?utf-8?q?1758939465161248277?= The thermal zone parameter specifies the bang-bang governor. The Kconfig selects the bang-bang governor. So it is pointless to test if the governor was set for the thermal zone assuming it may not have been compiled-in. Remove the test and prevent another access into the thermal internals. Signed-off-by: Daniel Lezcano Acked-by: Peter Kaestle --- drivers/platform/x86/acerhdf.c | 7 ------- 1 file changed, 7 deletions(-) diff --git a/drivers/platform/x86/acerhdf.c b/drivers/platform/x86/acerhdf.c index 61f1c3090867..71b9c1f922d9 100644 --- a/drivers/platform/x86/acerhdf.c +++ b/drivers/platform/x86/acerhdf.c @@ -697,13 +697,6 @@ static int __init acerhdf_register_thermal(void) if (ret) return ret; - if (strcmp(thz_dev->governor->name, - acerhdf_zone_params.governor_name)) { - pr_err("Didn't get thermal governor %s, perhaps not compiled into thermal subsystem.\n", - acerhdf_zone_params.governor_name); - return -EINVAL; - } - return 0; } From patchwork Sun Feb 26 22:54:06 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Lezcano X-Patchwork-Id: 61687 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp2133703wrd; Sun, 26 Feb 2023 15:03:11 -0800 (PST) X-Google-Smtp-Source: AK7set9i1JkE8tcWVEIVamtuFoZCUOakFISB22K01Un2vyePzq31E81kxo+Uc9kvfA6yMiZRpq6A X-Received: by 2002:a05:6402:274c:b0:4af:81f1:5b02 with SMTP id z12-20020a056402274c00b004af81f15b02mr10463308edd.2.1677452591734; Sun, 26 Feb 2023 15:03:11 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1677452591; cv=none; d=google.com; s=arc-20160816; b=vrPMk9Awe1s2R+VkUS0YFRbKCPa0XaElXdVts5C8SDYPyuM8gyIbuRxfPJvzjIvCnw x2tOBAL8zyke72zhqeWHJ4AGOaWRLhOtKPrXFuZi/5G5FV4gG5e3jZGWo1gmb6rl2VUK w+m867uWKNDl2deN3TAp48y+k5FtadfjbY6qzOY2Sw0WUCIVTDE8g4w5TGDFeuSd7EHY khYsNnIbNQoWECf7TdJoJVYcuqFl3DoTej/HT6zTIW0AU64L6Xm8HBEv5dRtDJbr1JMh /MkCsVjWRXlOvRYctDtFFCa/4uCpZl7CASCU+i9CPHQC1vcAv+3KVtYxNyvThTKogUWr cGgg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=1vHRlE4gW0G0XPdoOjf4Phl247vZu3Xaj6GOQBk8A4E=; b=s5Pawh6U4/JAmcWW1X9aMf5HYXi/gt+CSWBWFyJor75IMCZNgtYfukLwEILZQJFso9 Bnf1K+MZd3op0iajbB4psStoxpXLj62f3xRw8mpTXNU+CVnfz8qwiIw7R9fPO1Z6Wyih UXUfWHBusnHmXroPJHxLA90ufLh5hqFma1ekZYrAloPuELlERT/cf/gvL7fQfX01WUyY lQUQZGlWQtq5Ikd+6y7iFL9TPcK05YgeYspUaznoni6EcWl8Sm9SVNFfHRDCt8zwTA9A Pg6KyU5Pjofv8ZaLZtrBaou83sev2zKrir2G1HmLTxi69qfJ7kBHbS8vQKsOG8uffJaJ snKw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=A6LZOrlA; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id gf17-20020a170906e21100b008b85ed1bbc1si5638667ejb.206.2023.02.26.15.02.47; Sun, 26 Feb 2023 15:03:11 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=A6LZOrlA; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229767AbjBZW4s (ORCPT + 99 others); Sun, 26 Feb 2023 17:56:48 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34618 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229883AbjBZWz4 (ORCPT ); Sun, 26 Feb 2023 17:55:56 -0500 Received: from mail-wm1-x334.google.com (mail-wm1-x334.google.com [IPv6:2a00:1450:4864:20::334]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D72451A672 for ; Sun, 26 Feb 2023 14:55:37 -0800 (PST) Received: by mail-wm1-x334.google.com with SMTP id bg16-20020a05600c3c9000b003eb34e21bdfso2501724wmb.0 for ; Sun, 26 Feb 2023 14:55:37 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=1vHRlE4gW0G0XPdoOjf4Phl247vZu3Xaj6GOQBk8A4E=; b=A6LZOrlAVN+GzHJYwJ06W4bRMQ9VCiWoajvXTzMG6CK2hj1Xi/Vmqc5+jSO91pwHqw 0EZY7wMul0fbcveD+eaGXc+qs/kpcSD792PXEEG7SlS3zlwDWuqrQny7lVWrB4LejVdD bCKWWLF8BPcJUf3F2a/XiMK0ehZXd2IXW6/WCtkaOswQ+BG4V1ENuzI1w/iD/zGUmBaj RwhJVijlWaAjzD/IkHStv1kf7kmA8D4En9TshN1wnxnODCUO+7uKzmYYmGDBIIWVQshd SGsA4pF/C1yyuVXZLbE5IoTVaIy6efJFsamL7oC6IhtVW7XqC4n3MTKJrih31HdUlb6h CEIg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=1vHRlE4gW0G0XPdoOjf4Phl247vZu3Xaj6GOQBk8A4E=; b=QdVNVMu3FeLs7RcdJlr3ctqUIYsYwMu50f1W3Ty2DUsbSjT+0p1LZr7hMwZNzFjZ4B /G7vxflPoLQSoz4Rsbgu0qn9IcamqR6OPckrpA5O7QxN1eCwyn94HY9kIAl4+qBYz2dk p+xSELMOsRzzvYzbVQvSVpxaWhi+1EoO6jLkYTy7SNhvjctNNTrjRzyw4Ycd1gof7vqs VyN1BNNq/masp0ppfXclI2vxMrmAN9Ghrh2x51aFlhzatTgprHNIwTk+iVHPZjUr83cb xiEHq9hj4VZD8lvIqFN+oRCp6unebY4S2WB5Rzh0BnXFEhYV+9iKQU395s8PLg5Vwxa9 TVbg== X-Gm-Message-State: AO0yUKVTc1GpDqf7/Ez8k8ch9xiJoa5HntrFipXPBOCwWdEUo09TT0iD Wbs3JlG5mDk0maSdIjb1EmH9HQ== X-Received: by 2002:a05:600c:1d10:b0:3e7:b17f:9af1 with SMTP id l16-20020a05600c1d1000b003e7b17f9af1mr15546106wms.22.1677452125225; Sun, 26 Feb 2023 14:55:25 -0800 (PST) Received: from mai.box.freepro.com ([2a05:6e02:1041:c10:8baa:6b32:391b:62de]) by smtp.gmail.com with ESMTPSA id d10-20020a05600c3aca00b003eb369abd92sm6138074wms.2.2023.02.26.14.55.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 26 Feb 2023 14:55:24 -0800 (PST) From: Daniel Lezcano To: rafael@kernel.org, daniel.lezcano@linaro.org Cc: linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, Amit Kucheria , Zhang Rui , Lukasz Luba , Steven Rostedt , Masami Hiramatsu , Viresh Kumar , linux-trace-kernel@vger.kernel.org (open list:TRACING) Subject: [PATCH v3 20/20] thermal/traces: Replace the thermal zone structure parameter with the field value Date: Sun, 26 Feb 2023 23:54:06 +0100 Message-Id: <20230226225406.979703-21-daniel.lezcano@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230226225406.979703-1-daniel.lezcano@linaro.org> References: <20230226225406.979703-1-daniel.lezcano@linaro.org> MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1758936529087278927?= X-GMAIL-MSGID: =?utf-8?q?1758936529087278927?= In the work of the thermal zone device self-encapsulation, let's pass the field value instead of dereferencing them in the traces which force us to export publicly the thermal_zone_device structure. No fonctionnal change intended. Signed-off-by: Daniel Lezcano --- drivers/thermal/gov_fair_share.c | 4 +++- drivers/thermal/gov_power_allocator.c | 6 +++-- drivers/thermal/gov_step_wise.c | 4 +++- drivers/thermal/thermal_core.c | 8 +++++-- include/trace/events/thermal.h | 24 +++++++++---------- .../trace/events/thermal_power_allocator.h | 12 +++++----- 6 files changed, 34 insertions(+), 24 deletions(-) diff --git a/drivers/thermal/gov_fair_share.c b/drivers/thermal/gov_fair_share.c index aad7d5fe3a14..cdddd593021d 100644 --- a/drivers/thermal/gov_fair_share.c +++ b/drivers/thermal/gov_fair_share.c @@ -35,7 +35,9 @@ static int get_trip_level(struct thermal_zone_device *tz) * point, in which case, trip_point = count - 1 */ if (count > 0) - trace_thermal_zone_trip(tz, count - 1, trip.type); + trace_thermal_zone_trip(thermal_zone_device_type(tz), + thermal_zone_device_id(tz), + count - 1, trip.type); return count; } diff --git a/drivers/thermal/gov_power_allocator.c b/drivers/thermal/gov_power_allocator.c index 0eaf1527d3e3..bebab8b8694b 100644 --- a/drivers/thermal/gov_power_allocator.c +++ b/drivers/thermal/gov_power_allocator.c @@ -266,7 +266,8 @@ static u32 pid_controller(struct thermal_zone_device *tz, power_range = clamp(power_range, (s64)0, (s64)max_allocatable_power); - trace_thermal_power_allocator_pid(tz, frac_to_int(err), + trace_thermal_power_allocator_pid(thermal_zone_device_id(tz), + frac_to_int(err), frac_to_int(params->err_integral), frac_to_int(p), frac_to_int(i), frac_to_int(d), power_range); @@ -481,7 +482,8 @@ static int allocate_power(struct thermal_zone_device *tz, i++; } - trace_thermal_power_allocator(tz, req_power, total_req_power, + trace_thermal_power_allocator(thermal_zone_device_id(tz), + req_power, total_req_power, granted_power, total_granted_power, num_actors, power_range, max_allocatable_power, tz->temperature, diff --git a/drivers/thermal/gov_step_wise.c b/drivers/thermal/gov_step_wise.c index 31235e169c5a..81ef43a40f98 100644 --- a/drivers/thermal/gov_step_wise.c +++ b/drivers/thermal/gov_step_wise.c @@ -109,7 +109,9 @@ static void thermal_zone_trip_update(struct thermal_zone_device *tz, int trip_id if (tz->temperature >= trip.temperature) { throttle = true; - trace_thermal_zone_trip(tz, trip_id, trip.type); + trace_thermal_zone_trip(thermal_zone_device_type(tz), + thermal_zone_device_id(tz), + trip_id, trip.type); } dev_dbg(&tz->device, "Trip%d[type=%d,temp=%d]:trend=%d,throttle=%d\n", diff --git a/drivers/thermal/thermal_core.c b/drivers/thermal/thermal_core.c index 46dedfe061df..c856ab911149 100644 --- a/drivers/thermal/thermal_core.c +++ b/drivers/thermal/thermal_core.c @@ -336,7 +336,9 @@ static void handle_critical_trips(struct thermal_zone_device *tz, if (trip_temp <= 0 || tz->temperature < trip_temp) return; - trace_thermal_zone_trip(tz, trip, trip_type); + trace_thermal_zone_trip(thermal_zone_device_type(tz), + thermal_zone_device_id(tz), + trip, trip_type); if (trip_type == THERMAL_TRIP_HOT && tz->ops->hot) tz->ops->hot(tz); @@ -387,7 +389,9 @@ static void update_temperature(struct thermal_zone_device *tz) tz->last_temperature = tz->temperature; tz->temperature = temp; - trace_thermal_temperature(tz); + trace_thermal_temperature(thermal_zone_device_type(tz), + thermal_zone_device_id(tz), + tz->last_temperature, tz->temperature); thermal_genl_sampling_temp(tz->id, temp); } diff --git a/include/trace/events/thermal.h b/include/trace/events/thermal.h index e58bf3072f32..50c7d2e1526d 100644 --- a/include/trace/events/thermal.h +++ b/include/trace/events/thermal.h @@ -23,22 +23,22 @@ TRACE_DEFINE_ENUM(THERMAL_TRIP_ACTIVE); TRACE_EVENT(thermal_temperature, - TP_PROTO(struct thermal_zone_device *tz), + TP_PROTO(const char *type, int id, int temp_prev, int temp), - TP_ARGS(tz), + TP_ARGS(type, id, temp_prev, temp), TP_STRUCT__entry( - __string(thermal_zone, tz->type) + __string(thermal_zone, type) __field(int, id) __field(int, temp_prev) __field(int, temp) ), TP_fast_assign( - __assign_str(thermal_zone, tz->type); - __entry->id = tz->id; - __entry->temp_prev = tz->last_temperature; - __entry->temp = tz->temperature; + __assign_str(thermal_zone, type); + __entry->id = id; + __entry->temp_prev = temp_prev; + __entry->temp = temp; ), TP_printk("thermal_zone=%s id=%d temp_prev=%d temp=%d", @@ -67,21 +67,21 @@ TRACE_EVENT(cdev_update, TRACE_EVENT(thermal_zone_trip, - TP_PROTO(struct thermal_zone_device *tz, int trip, + TP_PROTO(const char *type, int id, int trip, enum thermal_trip_type trip_type), - TP_ARGS(tz, trip, trip_type), + TP_ARGS(type, id, trip, trip_type), TP_STRUCT__entry( - __string(thermal_zone, tz->type) + __string(thermal_zone, type) __field(int, id) __field(int, trip) __field(enum thermal_trip_type, trip_type) ), TP_fast_assign( - __assign_str(thermal_zone, tz->type); - __entry->id = tz->id; + __assign_str(thermal_zone, type); + __entry->id = id; __entry->trip = trip; __entry->trip_type = trip_type; ), diff --git a/include/trace/events/thermal_power_allocator.h b/include/trace/events/thermal_power_allocator.h index 1c8fb95544f9..7ac049e7e3cf 100644 --- a/include/trace/events/thermal_power_allocator.h +++ b/include/trace/events/thermal_power_allocator.h @@ -8,12 +8,12 @@ #include TRACE_EVENT(thermal_power_allocator, - TP_PROTO(struct thermal_zone_device *tz, u32 *req_power, + TP_PROTO(int id, u32 *req_power, u32 total_req_power, u32 *granted_power, u32 total_granted_power, size_t num_actors, u32 power_range, u32 max_allocatable_power, int current_temp, s32 delta_temp), - TP_ARGS(tz, req_power, total_req_power, granted_power, + TP_ARGS(id, req_power, total_req_power, granted_power, total_granted_power, num_actors, power_range, max_allocatable_power, current_temp, delta_temp), TP_STRUCT__entry( @@ -29,7 +29,7 @@ TRACE_EVENT(thermal_power_allocator, __field(s32, delta_temp ) ), TP_fast_assign( - __entry->tz_id = tz->id; + __entry->tz_id = id; memcpy(__get_dynamic_array(req_power), req_power, num_actors * sizeof(*req_power)); __entry->total_req_power = total_req_power; @@ -56,9 +56,9 @@ TRACE_EVENT(thermal_power_allocator, ); TRACE_EVENT(thermal_power_allocator_pid, - TP_PROTO(struct thermal_zone_device *tz, s32 err, s32 err_integral, + TP_PROTO(int id, s32 err, s32 err_integral, s64 p, s64 i, s64 d, s32 output), - TP_ARGS(tz, err, err_integral, p, i, d, output), + TP_ARGS(id, err, err_integral, p, i, d, output), TP_STRUCT__entry( __field(int, tz_id ) __field(s32, err ) @@ -69,7 +69,7 @@ TRACE_EVENT(thermal_power_allocator_pid, __field(s32, output ) ), TP_fast_assign( - __entry->tz_id = tz->id; + __entry->tz_id = id; __entry->err = err; __entry->err_integral = err_integral; __entry->p = p;