From patchwork Tue Feb 28 11:22:20 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Lezcano X-Patchwork-Id: 62432 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp2954888wrd; Tue, 28 Feb 2023 03:24:27 -0800 (PST) X-Google-Smtp-Source: AK7set9mPFnPt7xJA+fcCzRMqo/xF1wMM2NQam84w4ErS3cGNVkBm7k15zSHxk3jaKrtKVgWwuoj X-Received: by 2002:a17:90b:4f8d:b0:237:373e:9dfa with SMTP id qe13-20020a17090b4f8d00b00237373e9dfamr2824587pjb.20.1677583467148; Tue, 28 Feb 2023 03:24:27 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1677583467; cv=none; d=google.com; s=arc-20160816; b=EHhNuGLDTBv0nBH2U/S2iKSPjCqpSNv/6ZOJ0G6QTILNRl65LL4jav4fSYccCExtvl dt2Z5xab0Co4z//jvJPLShbI6nmfwHTrFLwkFjCD4TceytWo7mnJ5ccWVaN9NrUbX3jt lnjEYyvkbZExse1+r0jX0Sb0IUTCqP2kGjBT0c6jiK+V0rRZbX3Mffzmhp9asPsw6tIB XWpgLMTbtAy/uUYdPoAIDpRswfHaUoygEmclEhS7Ret1wBW30+fXlcUrPMf/qGqsYjT1 wGPZUVKYE+620V2veFw2msMevvxMZoKT6Ws51GDs9thf2CyxR1RMLsCz66VYMmxDNMdA VmjQ== 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=UpqgTULnM5GgkaGGCMZC9+zheXNf00pZQAoLQxi8WlU4Ebj9VSjFgrET8WtF6gS7h2 A7gdLiXLYqgxWqUB/4XHSLOUsWxeP7wxBRINFKePWH5EMbrl/o0qfxcMYiUyZmxvj481 VlhRYY1X7PoIn2DVzhZNWUIfAagkkMGdl3vlDn8CmF92hfnCZF8jckzd4x1zlXWykNrO eL7fDET15g6/WbMuOOUmTPX29hQ+BJERY9ASnjcUzVp2uwuBiO+o3JJLC6qwhzsS9aMz Lgr1E1gZkVbomyLrUB7HLQPXDZWgOleRcg3256pE7h8RIYJoRUAaiV+sjtBvMmLV3xJ4 sIZg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=vVUSFi+b; 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 gt21-20020a17090af2d500b00233e301c780si13327535pjb.31.2023.02.28.03.24.14; Tue, 28 Feb 2023 03:24: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=vVUSFi+b; 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 S231501AbjB1LXC (ORCPT + 99 others); Tue, 28 Feb 2023 06:23:02 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42448 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231273AbjB1LW6 (ORCPT ); Tue, 28 Feb 2023 06:22:58 -0500 Received: from mail-wr1-x433.google.com (mail-wr1-x433.google.com [IPv6:2a00:1450:4864:20::433]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4C22DA3 for ; Tue, 28 Feb 2023 03:22:51 -0800 (PST) Received: by mail-wr1-x433.google.com with SMTP id v16so6526624wrn.0 for ; Tue, 28 Feb 2023 03:22:51 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1677583369; 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=vVUSFi+bHE1gez+bGnBMUsIOJ/M0sRmZZHuuZZv56KTBUEfP3KgbfDZds399wxHWVi L7rnrQODeLDclBWPp+2sfnax1FVupEbgMdfQb7kQW6flA/XEdj4hSJCrIL6SKa7QN/Ai CRE8k/qw4pcN64xEE5cr5d15wXFcZbd9SHvH1z0JxkYqVdebvGa9P/UdK5Weo4rBpZqJ 5waptRF3DKKS4736KUpw/FZhmy28hfPoxktObEQEQrp3RYO2bWFJ2mlYaW184bOtjmCW IKlIbaEUfNVXG9qbh9YF2lCyO0GYBmAoWshQ2NDO3XkqYVBrlwgRWkGxaoAnXuWlB1AL +S1w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1677583369; 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=k9n6YRbtJwoW8EFVnFCsN6OBP+dzyL9X6jL1fdNd5eyUDVpbvG3698uU8WLHHWdllA 2jynhm8eagDOIpSrsW2GUHLDqRaZRoilqg4+wJDGCbY4XHGxyOLvV7AeK5obVTQFgRFo grpBe2MUG9yJT/+B+MsazHSxToqCyFXC933anyjm8NSBNQdgF6CoC2KoJgTTcZaMRzmA 6pVWQlXORSDmxkHUH3o+6CxlKMzYU9c3n7uzlBrkZ4PeKCy+fjGoeYkOEvXMT8bFEi8y TmSEIJyOyv0nbIvQEtrTK+YI92rYuWkX2cWhGVRg31FlENmXFYHqtogaOXvTPW+oPbNM Jp5w== X-Gm-Message-State: AO0yUKURqnBythqBQaMNIgFaMFDQcSqKSswcaKEif40qN/w2HPjksw1H Oj0k6IVCCwGdzh9VX6X+5au2GA== X-Received: by 2002:adf:ce0a:0:b0:2c7:aed:b97b with SMTP id p10-20020adfce0a000000b002c70aedb97bmr1779397wrn.62.1677583369629; Tue, 28 Feb 2023 03:22:49 -0800 (PST) Received: from mai.box.freepro.com ([2a05:6e02:1041:c10:6830:6390:2815:b6a5]) by smtp.gmail.com with ESMTPSA id z5-20020a5d6545000000b002c5501a5803sm9598130wrv.65.2023.02.28.03.22.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 28 Feb 2023 03:22: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" , Mark Brown , Amit Kucheria , Zhang Rui Subject: [PATCH v4 01/19] thermal/core: Add a thermal zone 'devdata' accessor Date: Tue, 28 Feb 2023 12:22:20 +0100 Message-Id: <20230228112238.2312273-2-daniel.lezcano@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230228112238.2312273-1-daniel.lezcano@linaro.org> References: <20230228112238.2312273-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?1759073762032914149?= X-GMAIL-MSGID: =?utf-8?q?1759073762032914149?= 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 Tue Feb 28 11:22:21 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Daniel Lezcano X-Patchwork-Id: 62436 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp2955014wrd; Tue, 28 Feb 2023 03:24:47 -0800 (PST) X-Google-Smtp-Source: AK7set/Rjv8BLq7kxcEKsh+cXSQ28dcgW7sVKrI5ILaVMmh+9Y/fue7KaitezM/jSUOFB3IhzgeW X-Received: by 2002:a17:90b:4a07:b0:233:cffb:1cc9 with SMTP id kk7-20020a17090b4a0700b00233cffb1cc9mr2796508pjb.46.1677583487444; Tue, 28 Feb 2023 03:24:47 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1677583487; cv=none; d=google.com; s=arc-20160816; b=SCiyheF0NAhyBWqCCHFEBOpDc9c42RXaYpEmNsSklg2olTLgBkhJ0JQiy2MILIyPEt 9BKJcuRpXj7sgSJznCJV+J4Utkqvs+P1mpWbDIF4QRxcVXpmd/a4W+9atkxfXcWQmbaJ 0DAuS+ryoOdGmPSedtvnq6Sg7miOFrqJBhBF4n4LgCA6vpE2uZQm7K1vS5w4j1WPyOyJ HwPGT5HOGTNbMK+R5Xj1HmUhlWoRJtF13sF+QpQO72MgpVkNXMOrvr+rsf/QVecgAOPf y9iKB0CbtfMpJMPkU0YFFBcn77fCaX7QVBHpjq+hKmew0rLnLwQxhAM09Yz6EiIsFfJq 4PnA== 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=fd/txMs7LSSUOqvjw5UVJFK6TPR235QoSrDvWMN7cfo=; b=NOtNum4D5ptb5nbcPx+1O+0F2kyzKH9/l65iLQNl1CH9mu7m+vnXmE3gHxY5BI5tep lP5M4W6yjj5eOnjCm9PCd+Son7VnWwHCoJg0K+kwmOL/HRkLA2OUo1xtlGKa5Tl0pW5C dyPk+jqnfzO/y3SwVpcDVazITc1Wxw4JHoTw5Uh1XsBdqXDqxwd3iQ31fep5u+8bAokz Q6guEM1I8+9YYlO8K8EzfBqg901dbaVbDzZQbU8NsGw3bpbv5n6qM1BplMxWtfxR2If/ E2NwVq9KOQRqQkIlV6Edc+qTjKYn1j/HXagGfSU95aZel7tiCAomM+0PXs4lEcuw9vGx TEzQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=LrpgnAeX; 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 w70-20020a638249000000b005030a000860si9411752pgd.602.2023.02.28.03.24.34; Tue, 28 Feb 2023 03:24: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=LrpgnAeX; 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 S231222AbjB1LXr (ORCPT + 99 others); Tue, 28 Feb 2023 06:23:47 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43404 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231521AbjB1LX3 (ORCPT ); Tue, 28 Feb 2023 06:23:29 -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 80DE012F01 for ; Tue, 28 Feb 2023 03:23:10 -0800 (PST) Received: by mail-wr1-x431.google.com with SMTP id bv17so9340175wrb.5 for ; Tue, 28 Feb 2023 03:23:10 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1677583389; 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=fd/txMs7LSSUOqvjw5UVJFK6TPR235QoSrDvWMN7cfo=; b=LrpgnAeXcE72c9Rt0AXr0yi+uf54rCE4GH6zXys/cXqsYsph879t0N/McAb94jLH+d DaaRJJetEasnRuutVzM2RoNMXq19Kyj5JPbxZk1QyyOlUj00FMcN/+k4M0R4lzcEtepR TpDMPSEYCwum3pw61kWOZ21Q5appvWw8viJ5745l+VdSg4W7YEr3nfJ65zy5r03S1CRP Jdm4sOlM3+KK08ESbV8ZzNI8m1dt/+TSLrxcpob3mLlY+Aqzf+4FUQgUZ3Sh7Zjz958N c0i84e1c2l+mYTG7ILvW1EXfc9DeMmZ+vNCs6SnYlN7I0I9MfxxFEcndNZtM0aKcEf4e RK9Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1677583389; 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=fd/txMs7LSSUOqvjw5UVJFK6TPR235QoSrDvWMN7cfo=; b=nHH+43Ylo8kDccleQrxqu1nDYLkyHS6L8Z/Ji2J5TyafqBz2h2O6VGFd0+ILBR+HUt cfjAhkgKCl7b+EvSUSxKZRJ3waqIFNS6ufMrxAcsYY3DZr/w4RKbp5Yp4TY1G2oq4FFL dnaZCOJAbTTNyiCKO89Bvf3jSEsBh2zgOXmP8XuT8Hg9VRy259Wjk/JQ+JQAsA0p5FRp GrDMJ8T/ky5NJY+YVElWWaG5cr7TLkCbr1EeiOWIfnYe3awjlD35XWscipkyTWVBUhSg YdWq0QgXQoQUDJQSEsAPt9sK3ZC9Ck/Cn9deql3NGWP3cF7/4r2tvOFDen9p639pTOHO Lm9Q== X-Gm-Message-State: AO0yUKWH9U+yzEwD0dj9BY0PdPVQ74whdKX0kG55CS4EApXld6b/03PE wiRPHWwGkVRfdmNbpU/RfoZkxg== X-Received: by 2002:a05:6000:2ca:b0:2c5:561f:fda with SMTP id o10-20020a05600002ca00b002c5561f0fdamr2234741wry.5.1677583388786; Tue, 28 Feb 2023 03:23:08 -0800 (PST) Received: from mai.box.freepro.com ([2a05:6e02:1041:c10:6830:6390:2815:b6a5]) by smtp.gmail.com with ESMTPSA id z5-20020a5d6545000000b002c5501a5803sm9598130wrv.65.2023.02.28.03.23.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 28 Feb 2023 03:23: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, =?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 , Sumeet Pawnikar , Kees Cook , Shang XiaoJing , Tim Zimmermann , Yang Li , Jiang Jian , Daniel Golle , Randy Dunlap , 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 v4 02/19] thermal/core: Use the thermal zone 'devdata' accessor in thermal located drivers Date: Tue, 28 Feb 2023 12:22:21 +0100 Message-Id: <20230228112238.2312273-3-daniel.lezcano@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230228112238.2312273-1-daniel.lezcano@linaro.org> References: <20230228112238.2312273-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?1759073782871181445?= X-GMAIL-MSGID: =?utf-8?q?1759073782871181445?= 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 Reviewed-by: Dhruva Gole --- 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..c0418497520c 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 = thermal_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 Tue Feb 28 11:22:22 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Lezcano X-Patchwork-Id: 62433 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp2954971wrd; Tue, 28 Feb 2023 03:24:38 -0800 (PST) X-Google-Smtp-Source: AK7set/DR5PraLRJI7613jlhsva+sOk5BvFw0nOxst59yVbBTGOnE88TmawgFYCk6AOO/3n/M42W X-Received: by 2002:a17:90b:1d0e:b0:237:9858:ebbf with SMTP id on14-20020a17090b1d0e00b002379858ebbfmr2866516pjb.30.1677583478266; Tue, 28 Feb 2023 03:24:38 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1677583478; cv=none; d=google.com; s=arc-20160816; b=ghKsH0td5CeLSMC47AMnXkviRVcNIGga8XZXov2AWI6xyWyrwu4kf2TJGLjdOQCzkG e1DJW2r+qWdrtbh2U137e/xZeR3gk0x4c2Gs61/iI8a/UYAI1MbN1WrHL/kEhMv+zp9q F6b4Zi8fXsmkQqT4gDj11RK9K2rrdQqFWOe7maQJHeaqILWvJ4ou1M1G1K9itbKmrGDN T+C4rXdI0j3Gx+IbcK0DxsHWCKZ77j0f3fFyxaoKa2rqBIeR4/vOsJbrnlhR0dMAJcpE kCDYyKycWhq3ZRb3g3sfeRhJibj9W9ihYHgGp4ftj6OYvABcLMvdHnAxUSOJLOOg9At3 FsQw== 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=JHpEM3xajJT6Y+kOX0hc1BhTDJ3oHZjSp2bIv1qj1/ZnZx640WzJ7xfz9ecW/JJXJC 7KGEJwDd3dHRj5a8EYnfXQ8fQLt6MUHaFldRYQgelAAF2HI04jwpheWk3AaJ/uFcm0wY 3qrGdR0Ih3uFLihjWXFTUSq5MOXZUoNHEd7aU5LNgeoVKm9KFpqxZC7vZw0U0Mcc+MI9 RAJ3AtWe8X3YLK4+fMtndAK/BMjkd4pptXuuPhhk+Zg83LsQjt8H6zmNeA8UNviJAhaJ Cq33jcWNkj4qLGHreq2nl44phBPOHVsIWeYLewe1daTfmH/xfRDygnlw0bN/c/Me30wm Djvw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=UlM5mZ3k; 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 z17-20020a63e111000000b004fc24104f36si9761436pgh.132.2023.02.28.03.24.25; Tue, 28 Feb 2023 03:24:38 -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=UlM5mZ3k; 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 S231549AbjB1LXh (ORCPT + 99 others); Tue, 28 Feb 2023 06:23:37 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43506 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231518AbjB1LX3 (ORCPT ); Tue, 28 Feb 2023 06:23:29 -0500 Received: from mail-wr1-x433.google.com (mail-wr1-x433.google.com [IPv6:2a00:1450:4864:20::433]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5F9871B339 for ; Tue, 28 Feb 2023 03:23:11 -0800 (PST) Received: by mail-wr1-x433.google.com with SMTP id g3so453551wri.6 for ; Tue, 28 Feb 2023 03:23:11 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1677583390; 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=UlM5mZ3kJrAok/fetBNqilnPJs5MtyFy0gYgd2S0uwaV+3wPD/XR+hypoBCsNYNSHt +os9lWNK2cwjkn5Dm+80SKltylmVtq4EfOBVPldmrPkZU8KX3mLK2WuGlEXphbWEL/in LCjKNbiMx+IANOgV4Xc0viB+mhJiTrV5+8CcXYC3wwevvjJUqRWCqmjlLJ3xJ3VjtFHD aBsRXJRrhtPB1ZVbrs/IW3mtMP0ewx0fRzAJnJ3Ul5ID7y5KTZVFkqTpj8WYnhZqGANk Lu0bRURjuvSHjusYiGcN0782OEOBqAielBWwKfwtCtjSDRQpY/1wCVgqHurK9kk4MPeO pf8g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1677583390; 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=NaiTDzKCFdP+WuKdVg+ER38ccFo9oNlJN3BwDT749Plk4nF+VOVi9XJhcxWXAr5r6p vygPxHt5CXSnEWJGhT2VGEDDttAG2x0FuJqKsu+5j6mn97kbw61TdYdJT8/Crj9JwYaR ePnooJV5g1X4JqBT3tiT6vXKDc9CPfPWE5k/Jujo2JkWQ3y8ZVt4ZZ40wkohTp/z14s5 2ktbLdm4t1lSBtURTi/hWBQn0eOlb59EdjHaHROwy3YB7TG13H7EWC7S6QY7E5iA4yDg M1VjLkX13llk7h/fl7hYN72lDFw30ubvnWa1l8hvE8+rR+SjJPTcXkIZ2DDuDGQpEVe4 Fi6A== X-Gm-Message-State: AO0yUKWjcD+pFNy5Q2UyQG84vMiNFLVXW5B8LfvK+sDuYcmDBAMyGdLh 7RmAyDVZr4HomVt3G/nrKi42Gw== X-Received: by 2002:a5d:4a0d:0:b0:2c3:f026:9085 with SMTP id m13-20020a5d4a0d000000b002c3f0269085mr1794435wrq.13.1677583389751; Tue, 28 Feb 2023 03:23:09 -0800 (PST) Received: from mai.box.freepro.com ([2a05:6e02:1041:c10:6830:6390:2815:b6a5]) by smtp.gmail.com with ESMTPSA id z5-20020a5d6545000000b002c5501a5803sm9598130wrv.65.2023.02.28.03.23.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 28 Feb 2023 03:23: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 , Mark Brown , "Rafael J . Wysocki" , Jean Delvare , linux-hwmon@vger.kernel.org (open list:HARDWARE MONITORING) Subject: [PATCH v4 03/19] thermal/core: Use the thermal zone 'devdata' accessor in hwmon located drivers Date: Tue, 28 Feb 2023 12:22:22 +0100 Message-Id: <20230228112238.2312273-4-daniel.lezcano@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230228112238.2312273-1-daniel.lezcano@linaro.org> References: <20230228112238.2312273-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?1759073773137582140?= X-GMAIL-MSGID: =?utf-8?q?1759073773137582140?= 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 Tue Feb 28 11:22:23 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Lezcano X-Patchwork-Id: 62434 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp2954984wrd; Tue, 28 Feb 2023 03:24:41 -0800 (PST) X-Google-Smtp-Source: AK7set/y1/oH11fRJGU2J+qKwQ5UsVMZQM50T9+bCobugMy/rhuTUMrC1oLMLsq2F+f3poQMbQXn X-Received: by 2002:a62:7911:0:b0:5a9:4af:b05b with SMTP id u17-20020a627911000000b005a904afb05bmr2812800pfc.12.1677583480814; Tue, 28 Feb 2023 03:24:40 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1677583480; cv=none; d=google.com; s=arc-20160816; b=vN53LVdPyqTTnHmO66oUJ/a8YKLfXj03H1WNLwUDPzNkOwpgMpqh8a3ADheukC+UO4 J5o5/443vUNLUIHmrR+8OMhhe7ppUqVXT5uRtyxfid6XuFsdAMheLSvJeRqcreBUBuL9 cy4Viw1rGfb462aBsNmWiMnWvV2n7M0vgi8vpsBo48W3U2wrwZBDAlFHozRzvIoA/eOn UfzMKVIhvGl5gOe1aSEQ2Rev3g26iUAV8dVtWcbaDcBSY6KnfKZyOoOJd8k6OGfhSds2 P5+tKvQJFAqpzZR17rErDsND99kjqaadNodaD2RNy7aAjuK48hzprqpWFzozuyGC7nBO DwcQ== 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=msTNvGByW6wnSBM4h7Lzte8/9XtB6qDrvbyiJrlnYaU=; b=PHlM8V9N29Ni/Fdp783t1/POcoBcPXQo41nY2Tg/ho3yBx8kXqO7BpNPsj7yX6KbWl aN0wASuHkN8QwQph84ZXTwcm/R4ApJDynF6+GQM61zlpbQRcD808gWvYKM7INxs5Rm1A bmAQPhHapXK6movwUhtJsIadgw0nz+zwVi1/0rYOjT8wGTHljgYGb54/jkoayJIocC1b Hp32hhF0UVDA+XPeyK4J8ftv1MfxNbt7o5P9STT8FTRoxY77ZxUVQ3zMSKGYnO0gOUVC AJRiumcNE5l1+OS6mS2xj6HqHaSF6CE308Z1DMmKRrCVbaSSVPrhLTON1rZhi+dQRdOe Wt2g== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=YKQQ0B6H; 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 w189-20020a6382c6000000b004d422660ff7si9852135pgd.244.2023.02.28.03.24.27; Tue, 28 Feb 2023 03:24:40 -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=YKQQ0B6H; 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 S231419AbjB1LXk (ORCPT + 99 others); Tue, 28 Feb 2023 06:23:40 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43356 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231526AbjB1LXc (ORCPT ); Tue, 28 Feb 2023 06:23:32 -0500 Received: from mail-wr1-x42a.google.com (mail-wr1-x42a.google.com [IPv6:2a00:1450:4864:20::42a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A88C910255 for ; Tue, 28 Feb 2023 03:23:14 -0800 (PST) Received: by mail-wr1-x42a.google.com with SMTP id bw19so9295535wrb.13 for ; Tue, 28 Feb 2023 03:23:14 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1677583393; 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=msTNvGByW6wnSBM4h7Lzte8/9XtB6qDrvbyiJrlnYaU=; b=YKQQ0B6H86bZgv8j3DgnF2AtQJCvA145VIxwFfUEK7+OFSrQFhWn6Z+FO1FbzDXmc7 tezTe8SjarJXiAh5GSoO/UHL3lIQQiy8OJG6+CawvM4xwhUNtx2JfY3j+BXjgpXKNgUq J1R7rvUcw6nh5bFI7jvRn7uQ+jg1picGCFM9kKYmjU6lc9FhNrrZnbgNQ1WOJm4NLADv 8YXWAfgIq6fMhgj5pk91qyPgW+syl8emZPa8F+gi3vOP6+q/6m9Hxv9CREQlCwDq12KI je/vwDctD1L/a2PrLPlXQetXzCEMnbq7uyZMI390Yw7YRX6AUPulCVDwW0YaQrMCPz0V PjfQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1677583393; 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=msTNvGByW6wnSBM4h7Lzte8/9XtB6qDrvbyiJrlnYaU=; b=Rftl2ZFEeKi9GgP3D0PvCKBHrsW14neaNH+ZtJPnWZDoeq1b6ISkoWBCCkJIaZSXoL 55nCSykEI9vvH6axNSH9/hUW/Yf9J9hsyUU73bCVEEov7Hu2aztl/IWyZ44rF30h7fvM gMEtKs7Hs34BT4VLewSFKLlLHmcq0eozw0NNnE3SeSOSChVqN8lps3x5DjkylzVYWmxV nFtabi441N87IcUV6hSKj8F4nv1LlhJC3ILe44tI1kIv3mUZJkaaXEfBmNu/tscJ4+IU TdWwa0KQZF8wSI+6LFNx3GpQJ90/NQd5SZokNIBYiKOAzGq7ezS0xUrES4RQrpfo5jHU mf+A== X-Gm-Message-State: AO0yUKVSmxovOPbDudHBF7E5klepQHw3JwTwqKov+asVaBNc4B6qklR3 MVZHah08fufiPMCxYPv2cidc0w== X-Received: by 2002:a5d:6d45:0:b0:2c7:851:c0bf with SMTP id k5-20020a5d6d45000000b002c70851c0bfmr1899592wri.0.1677583392984; Tue, 28 Feb 2023 03:23:12 -0800 (PST) Received: from mai.box.freepro.com ([2a05:6e02:1041:c10:6830:6390:2815:b6a5]) by smtp.gmail.com with ESMTPSA id z5-20020a5d6545000000b002c5501a5803sm9598130wrv.65.2023.02.28.03.23.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 28 Feb 2023 03:23:12 -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 , Damien Le Moal , "Rafael J . Wysocki" , Zhang Rui , Len Brown , 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 v4 04/19] thermal/core: Use the thermal zone 'devdata' accessor in remaining drivers Date: Tue, 28 Feb 2023 12:22:23 +0100 Message-Id: <20230228112238.2312273-5-daniel.lezcano@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230228112238.2312273-1-daniel.lezcano@linaro.org> References: <20230228112238.2312273-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?1759073775514362371?= X-GMAIL-MSGID: =?utf-8?q?1759073775514362371?= 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: Damien Le Moal #ahci Acked-by: Rafael J. Wysocki --- 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 Tue Feb 28 11:22:24 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Lezcano X-Patchwork-Id: 62435 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp2955007wrd; Tue, 28 Feb 2023 03:24:46 -0800 (PST) X-Google-Smtp-Source: AK7set+oqbUG4rB8P+tKTBQtwNJYKjyj5ntqoi08fyZbgY/3buvRzQlJWBL737ncuey1kHnx3750 X-Received: by 2002:a17:90b:2248:b0:237:d867:222c with SMTP id hk8-20020a17090b224800b00237d867222cmr2884499pjb.42.1677583486564; Tue, 28 Feb 2023 03:24:46 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1677583486; cv=none; d=google.com; s=arc-20160816; b=B5u2TFtaxu2wYQbT4iT5dlpfE8dpW8pS92HIMUYSxk8UCh+TubDMTsOQnu24Ewkfzs BjHwOary8kUQHTaWS2tQvwNw3tDbt+WC3OMTjIdBufItp1+SKWSExKb2JbsKGiFROIEU lmXLXiBsHjVaS0h60Sg76lSDlZuG9klNQycdnnOS6a3kFFD4/hp/6ZrZD4SfZ+mvLcRc ta4E48JntsBVFz143CRoyIIBwcHfm7KMkCHQsMZPBzLPmcVX4oxWlOxlOqvQX6UViGhj FAUmATVZMTeIVGAV4387HFQMlJ/8tfEmuYcLmxV+MAayfVw52r+CpnyyTDAYu3Wn4cdK fyoA== 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=PFAVaVAjSTjzt59jZtf/qm8YllLRpCi77KTHCmDfI3h/Alax26k7pxBZ5VQ/dVHNwf 5yxGFv7mBnu4yqSG2zc3vG74yUw7elEbCNPHhwz9KbOGgvPCRRd/NnHiAb82FLLABbVs E/vnXLOk74KZ1uYRWnYfmLT0rp0RWV+XkDjzjijf38BuSvo8emGTDd8ZUwNb6Gi83rGi CWygWz+t9957kgwkiiuwfgrPDKwpVNjk9NSOwahh37IwRpR1oWONVdIcxGTp0teh5cUD FsLzHk/rX3k8HI3g/fahyk+SLRuFpawpwQl2ev4p8O5ioABmZ/3YzZ1WV0khSBgecoIq ixKg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=UTo1WZIh; 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 ck14-20020a17090afe0e00b00230cb79e2b3si12560395pjb.104.2023.02.28.03.24.33; Tue, 28 Feb 2023 03:24:46 -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=UTo1WZIh; 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 S231560AbjB1LXn (ORCPT + 99 others); Tue, 28 Feb 2023 06:23:43 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43488 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229953AbjB1LXf (ORCPT ); Tue, 28 Feb 2023 06:23:35 -0500 Received: from mail-wm1-x329.google.com (mail-wm1-x329.google.com [IPv6:2a00:1450:4864:20::329]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8BC0E166CA for ; Tue, 28 Feb 2023 03:23:15 -0800 (PST) Received: by mail-wm1-x329.google.com with SMTP id c18so6141426wmr.3 for ; Tue, 28 Feb 2023 03:23:15 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1677583394; 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=UTo1WZIhqmcN7wwdxDBuiP6Ftgr+rLh5SArLgTbxPKLwp5MOgvHozjAy8Ai4QkqCIM +aWGs5earODOd3p4flLKDkVaXo/AIwY/pi340K/DWcSJPQoXz/sDRCEAHH3Jk6I3riaf cu3Ps1D/MNc8KWplvUJ5lDHXS5K1katSy6g2pGWwZn82crh13WpZozVvDNn69OgudtbB zNhv/Iek36bGxNE25wdNREu4DLO4EVTex7JEj5oHWh8oskMHI0tUtgN3D+H+yBBzSCqq DDopp/fMXoyvAI2fxSVcwAIE2P09zMKanRy8aFQ4dTZyHeuPIQT5oy7lgHF9HzQrMLke RsZw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1677583394; 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=GQ6jYdT1MnjIOx7jyaJ5h6tOr+X89NnOcH75UxUKLzMxpRQBz36ZKKtSNEej92L9Go EuNo56Wy3qYM0aJXdkeoqZr52kkvJEhdf6JOtB5aRhCSOQHAycTEgF7G7tK6AXJ19vwv Ipj6U6PhNDu1vHsbDOS+MilTs3tTOE8DAXnHI8JOGLe6IEyfiaGiTIu3OBTezmbFi6JF uNGPRkRDcqmZaBGgSQxA4Lz+6uz0zIvv+8RihGSD3ObwVQz/sB/g1LjeGe0WCoLRMraW JXiuMKYx3U/QUY+oj4V42KxzkMSbr87T1nHHcQrECmu9xEnduk19hT0hjZDiwZb/yBQn pbUg== X-Gm-Message-State: AO0yUKWKpRwl3wR0CGqsvRC5saHVKmPGvy68UiQJ9r9oe6jEZlQZoFqP tgDKPIX+3DgtNn70i8vF3C/mfg== X-Received: by 2002:a05:600c:43d6:b0:3ea:f710:bdad with SMTP id f22-20020a05600c43d600b003eaf710bdadmr1863338wmn.29.1677583393866; Tue, 28 Feb 2023 03:23:13 -0800 (PST) Received: from mai.box.freepro.com ([2a05:6e02:1041:c10:6830:6390:2815:b6a5]) by smtp.gmail.com with ESMTPSA id z5-20020a5d6545000000b002c5501a5803sm9598130wrv.65.2023.02.28.03.23.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 28 Feb 2023 03:23:13 -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 v4 05/19] thermal/core: Show a debug message when get_temp() fails Date: Tue, 28 Feb 2023 12:22:24 +0100 Message-Id: <20230228112238.2312273-6-daniel.lezcano@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230228112238.2312273-1-daniel.lezcano@linaro.org> References: <20230228112238.2312273-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?1759073782047009470?= X-GMAIL-MSGID: =?utf-8?q?1759073782047009470?= 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 Tue Feb 28 11:22:25 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Lezcano X-Patchwork-Id: 62437 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp2955041wrd; Tue, 28 Feb 2023 03:24:51 -0800 (PST) X-Google-Smtp-Source: AK7set/LVRTp6bAoFDRfANUBqk5Ue/xJU9DOt6gOaeKgOv2W/kdgICmiQsfk47uh6s+mxvAJKjf3 X-Received: by 2002:aa7:999a:0:b0:5d4:e4c8:2ecb with SMTP id k26-20020aa7999a000000b005d4e4c82ecbmr2222348pfh.18.1677583491351; Tue, 28 Feb 2023 03:24:51 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1677583491; cv=none; d=google.com; s=arc-20160816; b=DaLYY72uboH5wyM6YGmcYJaWrfAgazm2YTgCBZusu5RmGB8M4pYoSpA2RshYrYZpVk d95+UcSjJ0f+Xhz24qnpPqE1OffI99tRZR+Fl1zAdebEbaLkq7vtSM3o6uVwLWxP3SXv HiS6oDE3prEPjTF7H4A9Pi2lSjQyL+Wou1eMv9On5+IKzZ9zaNi02l3Wog9BjNnC3bas oyctqcX23RVFoigLWO6JOr9d1C9nCOpMue3qkeYbFRhtF+FMvqqmpZ54aSLSajXCXmK4 IxP4QOtggyaTxag7pBs8y5EBPTFvZQWjMdDV/SN0K9NlMUU03n0T3n4nieVMkWx4c+Tb mZww== 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=QZORbJEC0KXh3smLya7JMCOQlYUfz0b2RxRCc6FiOfI=; b=YzcgPnl9HsqlCCEGO2a00sX9EypaOWNT/ChnmecQHumI2h2X+dNOJwy38Lso7AGu9s NfisyRJQlMd25bmemstV96ifFGCTytLBbkKcKbgThrNJ4KAY441S79qW3AYBD/Ewg7xN yHfoFTy2Gz3sYRy4w2TWaoh8hSB16fWe1JKZdDnDnB3BE9HfTFO6ZIgCLUWRLsOOuXq0 uoJr8rAR5VOO6SsmPGtES7axr2ueA+T7A+ammod+TdK+IEPDeMnzIgs9qFLjogFK1f2F 2CVEactVJPVOliwdGsd4UqmLfPx5iylpuXg3fU/9BNMFtKlXDU+7aufceN4Kd9mS6n2N DqJA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=OUmVNKtM; 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 x21-20020a63fe55000000b004fbacd1a872si8745619pgj.853.2023.02.28.03.24.38; Tue, 28 Feb 2023 03:24: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=OUmVNKtM; 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 S231617AbjB1LYK (ORCPT + 99 others); Tue, 28 Feb 2023 06:24:10 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43752 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231553AbjB1LXm (ORCPT ); Tue, 28 Feb 2023 06:23:42 -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 62C282E0D2 for ; Tue, 28 Feb 2023 03:23:17 -0800 (PST) Received: by mail-wr1-x42f.google.com with SMTP id t15so9331560wrz.7 for ; Tue, 28 Feb 2023 03:23:17 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1677583396; 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=QZORbJEC0KXh3smLya7JMCOQlYUfz0b2RxRCc6FiOfI=; b=OUmVNKtMZy71Xb4OafKHzvY+yBTEGHp3AaOzBwqcRrPW48VcxfRdVgL/WocBCGzJtz ZxQZ89JaSnLN4vzAPy4oXSbV76UCAWq6MwnoYU7Xt98ccVgnXFSSB+W8eFo/4JBWRun4 5RTjaXDyWYx9fcEt65xJdSBDso413BDd9UoqgSnXfJqQV++pALJj6fvkD3QeTsDehRms xiheHBWgBHZoxcKhGn/kKC96ggbS29KumVuYitYyqx+cegoPvxUnZ6incz5Zupgh8gqH in0/1P9bBUTVbg22Iima50actI1DwZsTKDD52gNVPfI6FvyQJtk1R/YCL6cRpq106uRr QfFA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1677583396; 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=QZORbJEC0KXh3smLya7JMCOQlYUfz0b2RxRCc6FiOfI=; b=d6Jj/h2/6rYokAJl3V6eq9S5F5592g5rRJMcIB9UQ9MhokN/tQ8oTpcf6ArIWz2Idx ajzdgw6XbG84icDP36NmFdzFNk+7eGEHdBxk/ry72dMydehZbL4FAS29IvXXAEXFf98h ftuWDaRlLLbOruMrg+UzHY9G7y8dyJ+9S9klFW33DcDKX8brgtX6d3/LAIVrpPI7UoMZ dIOZAa3XepNeZD8SvOIYiRX7LcW+Wi9OoLEet/eoLpyohcyGa/vv7PnS1ywrixSea6MQ NX1/63oid+3KrKWxxE632sV0sxEJNqhr6SiItkmDhGx/dz++nAeQQYUmIzAEseIpSJa4 agfQ== X-Gm-Message-State: AO0yUKXHFwkas0v3ibLugajVC3sAyL1gre1OyCvj7wVtrE/M4WMLr2oH qbINTood9dU4ikbgQmiDP3k+YA== X-Received: by 2002:a5d:5049:0:b0:2cb:5b58:75e with SMTP id h9-20020a5d5049000000b002cb5b58075emr2255214wrt.5.1677583395936; Tue, 28 Feb 2023 03:23:15 -0800 (PST) Received: from mai.box.freepro.com ([2a05:6e02:1041:c10:6830:6390:2815:b6a5]) by smtp.gmail.com with ESMTPSA id z5-20020a5d6545000000b002c5501a5803sm9598130wrv.65.2023.02.28.03.23.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 28 Feb 2023 03:23: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, 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 , AngeloGioacchino Del Regno , 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 v4 06/19] thermal: Remove debug or error messages in get_temp() ops Date: Tue, 28 Feb 2023 12:22:25 +0100 Message-Id: <20230228112238.2312273-7-daniel.lezcano@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230228112238.2312273-1-daniel.lezcano@linaro.org> References: <20230228112238.2312273-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?1759073786835007385?= X-GMAIL-MSGID: =?utf-8?q?1759073786835007385?= 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 | 3 --- drivers/thermal/thermal-generic-adc.c | 5 ++--- 11 files changed, 10 insertions(+), 41 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..2d3042098445 100644 --- a/drivers/thermal/st/st_thermal.c +++ b/drivers/thermal/st/st_thermal.c @@ -109,7 +109,6 @@ static int st_thermal_calibration(struct st_thermal_sensor *sensor) static int st_thermal_get_temp(struct thermal_zone_device *th, int *temperature) { struct st_thermal_sensor *sensor = thermal_zone_device_priv(th); - struct device *dev = sensor->dev; unsigned int temp; unsigned int overflow; int ret; @@ -127,8 +126,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 Tue Feb 28 11:22:26 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Daniel Lezcano X-Patchwork-Id: 62440 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp2955160wrd; Tue, 28 Feb 2023 03:25:10 -0800 (PST) X-Google-Smtp-Source: AK7set+3mgHEi32xNZiwyeG8TXnMpFtrOdh4fHAmlLDnqCQg5ZMwO0oMRMQBBp4vGfJbRuYWgkO1 X-Received: by 2002:a17:903:2291:b0:199:a0c:1221 with SMTP id b17-20020a170903229100b001990a0c1221mr3098931plh.14.1677583509716; Tue, 28 Feb 2023 03:25:09 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1677583509; cv=none; d=google.com; s=arc-20160816; b=i938qgMnnmDhHoePfvddOx4he6TgTct6bqwJq6s4vtJdyLM0XzThkjb2Gv7lv+eecJ APmfRgIWDC7DxD2DOwc8KhvzwMTCWF3Zf+UCovM0pGeQG5c0ODNjapwqGxmBzWm4Jehw DMmtSBz2OUo4WNB7l9G0Bgdfs3/Wnxt4YuRMb0nTlWcS9462bZodBkKkryOHxCJWvcum LizjRO6UHIwANcsQaeUa5qJuoI+l993OX4+mrffeY+3VSAFCTdKLVxojTDMvb53EyysR aVM8x2pxkZefsdEoIeN6bUB+MjLp5NwNMdvXm0qypiUCjft1IIrRhtt4RE8lGec8RLMn 9cqg== 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=lRhOanEQ6mhtjWlEf9mLn4qoyhqFylpuBxzgwFtlajCWeJh8aCHIL9vkyAMkKuy4sf 0Gr/zsE/q7b4lNJfAHYoIoTj1XDXW68HmnF3PskrShecuQiXvqACJFxTsLssthRzMjOE X2ZSgv2CMlg5gIBLvkcZ/rVEihu60FaLwNJQ/kSTo/ehrWCZTfeANwE45Xtqk3z9dBvg 4N6fq6ZbFBnU4Am7QfE1dmBiPfaNFX4zg/4viAHtGB3Yko7JdxxOuX/ufEyJ1aMALDA9 x/DLsiTwYKsXMAbgybrQWdWRK7QW6ZuTKTESTXqo+ceM53YoEZ3KoBeIfErjJkDqS65W //pw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="ugP/qb79"; 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 iw15-20020a170903044f00b0019a84b88f81si8916750plb.435.2023.02.28.03.24.39; Tue, 28 Feb 2023 03:25:09 -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="ugP/qb79"; 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 S231627AbjB1LYM (ORCPT + 99 others); Tue, 28 Feb 2023 06:24:12 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43932 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231571AbjB1LXr (ORCPT ); Tue, 28 Feb 2023 06:23:47 -0500 Received: from mail-wm1-x329.google.com (mail-wm1-x329.google.com [IPv6:2a00:1450:4864:20::329]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0D0DE2E82E for ; Tue, 28 Feb 2023 03:23:19 -0800 (PST) Received: by mail-wm1-x329.google.com with SMTP id o11-20020a05600c4fcb00b003eb33ea29a8so5125824wmq.1 for ; Tue, 28 Feb 2023 03:23:19 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1677583398; 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=ugP/qb79XHWui7cXoByzxM7H5Ndd6EHD4As17TTDz/sL0vxrreM6S0Rd5mZjO36jhS bkOCyiQBq6LshL55L2+LTtMrsSbvyQL8VFoIy5+OV9OaJw8jw6HilSIlnp+Gn9I8AhP8 PVpBfzKVNC2sDg+aBEiDVs7F277a5MBZff+hEOHwrdOLr6Q1yQJKU4DvzdNkeArp1ra5 0OfptdKpeXlwk6HSTURpPqGYvwrHZIJOaShMYz2MTMQB2BhUcQM8/U/NAnsxFeb8TPaJ e3oAkyn41d2BMaRwTwUsPZUhU+mhjERUjjUTEgkKa/9Vh4xkCtDLkIDACp+pqwpYuch9 nBmw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1677583398; 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=78wFWadiX9g2EOAZuDpM32Fs4nawXasugO5M/rToXlMbRbaXqFh3OoiHRGWcAkAnds se5GTerqsyqPWITocWjgj20dT5k3zuMZIBls2kaicPe/o//Gyc4SGUGdIEWp2bc3XBuJ d9mslkfT3wMbbxkZQqc0p0Svjsryw+F/QndWT/qoxUMMl+CyvxC946lZHQxSRPG4z6oo sll0M8MQI6ObkKJyJ6FeLambqID07Vtxi88yYZlZELvFj3EJvgFyd4M//eRWIHhpKcqc 4BWQyxhqNtqbbzYXISmbQabs+Qw3pExAhUBk7QB86YEgc5H0kB7VQ5PBcPFVwGffWk+d ldhw== X-Gm-Message-State: AO0yUKXM4wMe6hM8sioeNns5rZFBvCs4oQbmzwAN+1Rwl7lHJ17K7ei5 lks2ypiVJMaoS9sjU/ryFzshsg== X-Received: by 2002:a05:600c:19d4:b0:3e1:bfc:d16e with SMTP id u20-20020a05600c19d400b003e10bfcd16emr1866787wmq.39.1677583398360; Tue, 28 Feb 2023 03:23:18 -0800 (PST) Received: from mai.box.freepro.com ([2a05:6e02:1041:c10:6830:6390:2815:b6a5]) by smtp.gmail.com with ESMTPSA id z5-20020a5d6545000000b002c5501a5803sm9598130wrv.65.2023.02.28.03.23.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 28 Feb 2023 03:23:17 -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 , Mark Brown , AngeloGioacchino Del Regno , Stefan Wahren , Baolin Wang , 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 v4 07/19] thermal/hwmon: Do not set no_hwmon before calling thermal_add_hwmon_sysfs() Date: Tue, 28 Feb 2023 12:22:26 +0100 Message-Id: <20230228112238.2312273-8-daniel.lezcano@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230228112238.2312273-1-daniel.lezcano@linaro.org> References: <20230228112238.2312273-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?1759073806489736001?= X-GMAIL-MSGID: =?utf-8?q?1759073806489736001?= 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 Tue Feb 28 11:22:27 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Lezcano X-Patchwork-Id: 62438 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp2955076wrd; Tue, 28 Feb 2023 03:24:58 -0800 (PST) X-Google-Smtp-Source: AK7set+cqqiqwHdJEMV0EQUhWCNu2sJmCR4KycIgzpDFl8+PIaRgmlHbmgfHxxlsWFa5QY/iObn7 X-Received: by 2002:a62:790d:0:b0:5a9:c75f:bcc4 with SMTP id u13-20020a62790d000000b005a9c75fbcc4mr2418725pfc.25.1677583497957; Tue, 28 Feb 2023 03:24:57 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1677583497; cv=none; d=google.com; s=arc-20160816; b=BTk2at1zImWACSQIChjeqeQ3gF1VVVEqruQw0hVz6p1AdrTwTR+RS/qB0U6XuREdiN SD5Q38xvH87FbJg37Rszw0wk+CNnIEKTwt/VtNTRUpjFvrxtUc0OqVOieOy+FWr33Eky DQASq3MakqYdUiUQHaJv7gkUNkPrab6Z/PL5MGV9P/st8Ymg7KKPRI1DWzc6/hnbSdDU 4dYQc9YENB0o68vszEYUEwSpkLfoT90+PYFB8oKS0OLt/cfU0bYv+ShvZjLr6fjYKW29 saw+H/K0b4VX1v+l5kwrY3WFFkRqSo+6AvZh3J6KQ4n5fY2OAyyPrdzmaI4wTWV7qiXs GQBQ== 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=g+IfJxnjSTh6N3wFFIjnLu0SzCKGi0RpcoOno5UWwpBYSXEwCOKD6h+OZBvL+z5gW7 etuN44t885KxCNRY9TTs6+myYIL4pzZO/2eStKe4YBfRELHJc2+8vNBOAFeQvPvhi31L BBuy4rwlosc+Q6jQk7tkqeBmhAiJGFvfvlNu01BvyA51yGILcnE2Dhy9OkxJDj5nRPmE OiLYubbjrGPosRhUQirCZ9jwvG64YC6NyN59YAaQXWdOh8nBK5InQwOfzg97hIKftfoX U8Qz5b7Cx4mvNGT9Q2G07lLRZ+yVLeBQUfbsCC3D7IeJD19PQOGJOtmXLHUXG2yXSbPH cvKg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=kYRVRekP; 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 q76-20020a632a4f000000b004fc21b8bd98si9835940pgq.328.2023.02.28.03.24.43; Tue, 28 Feb 2023 03:24:57 -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=kYRVRekP; 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 S231651AbjB1LY0 (ORCPT + 99 others); Tue, 28 Feb 2023 06:24:26 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43484 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231524AbjB1LYH (ORCPT ); Tue, 28 Feb 2023 06:24:07 -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 B1FE7559B for ; Tue, 28 Feb 2023 03:23:25 -0800 (PST) Received: by mail-wr1-x42e.google.com with SMTP id l1so6285273wry.12 for ; Tue, 28 Feb 2023 03:23:25 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1677583404; 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=kYRVRekPxRZJ16QGfWmv1vr0J1ER/skpTOxrzhhxuXoGrOxizxbJf40BF1BydnU7Xd qjE6gYyZkgwNphgBThbNGOpfsFYzvxT+cC4H0zt0qGJsS3A7cPC8IyMf0l5kxrc9LTkd y85XoNAwPT/28jVPPdq8nEgpgDQiojj2813jVsd3g1cXg51O3p0Jak2vODGCl0KrXzxa I7p+roWfORMQHoBWlx5HhCeDkZ+chr3RCW8eJtQqaSPPAQPbdhnv/ZpUyicM5qNeNi+Z 7JLFTFH02RlrEc5wV/Tc45VTPVX+yL09vNpRUcU0Tj/nc5t3JMXeoVO2kcmt1aEfYwcD y8Dw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1677583404; 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=N7/lpCbuwsxau2MYn0zwxX0rM0Ng6B5kUel4GBiCvnm8HMhULQ63qQauksUtSJbxi5 Bg0F4aOq3APD7TxAvR+NJ6/auoEta2gRq+dD41JMJht8cXqd5+ehMPMwLim9IIxkdqJZ g0KcefzsbgT2G7vwtXGxyZEGV3Myjo4sGeJ5B2kIoGdct68bZiYV+LWBM7JapzOAq8gS ghqOMv5kTRlhLUNae3GbgPScQoVtAOqICvrQ54ZkcOWkfBhgcsMuqno+xgI9riIaEZVR QlFpGF1BF1VxKI0efkL36ujzSV89iXv4lJ6Ql8qRYos5x9zlw6CdAlau5/rvQFlHT+JP NXpw== X-Gm-Message-State: AO0yUKXKU963CLuxUFF/KRL4QqQtO6G8S9Q3epfCWkB57lwRDmyba9yL /pd3eaRowpcOmwBicHM4zuktlw== X-Received: by 2002:a05:6000:2ca:b0:2c5:561f:fda with SMTP id o10-20020a05600002ca00b002c5561f0fdamr2235400wry.5.1677583404108; Tue, 28 Feb 2023 03:23:24 -0800 (PST) Received: from mai.box.freepro.com ([2a05:6e02:1041:c10:6830:6390:2815:b6a5]) by smtp.gmail.com with ESMTPSA id z5-20020a5d6545000000b002c5501a5803sm9598130wrv.65.2023.02.28.03.23.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 28 Feb 2023 03:23: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, 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 , Balsam CHIHI , Daniel Golle , Randy Dunlap , ye xingchen , =?utf-8?q?Niklas_S=C3=B6derlund?= , Florian Fainelli , 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 v4 08/19] thermal/hwmon: Use the right device for devm_thermal_add_hwmon_sysfs() Date: Tue, 28 Feb 2023 12:22:27 +0100 Message-Id: <20230228112238.2312273-9-daniel.lezcano@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230228112238.2312273-1-daniel.lezcano@linaro.org> References: <20230228112238.2312273-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?1759073793981277498?= X-GMAIL-MSGID: =?utf-8?q?1759073793981277498?= 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 Tue Feb 28 11:22:28 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Lezcano X-Patchwork-Id: 62442 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp2955205wrd; Tue, 28 Feb 2023 03:25:15 -0800 (PST) X-Google-Smtp-Source: AK7set8Y3aGGVGx56P0/BNN5UjiklzzEicvbSSntj23HIuhwaUI4f6unjrFSrSnELRo38yxluBTo X-Received: by 2002:a05:6a00:c8:b0:5a8:ecb1:bf1 with SMTP id e8-20020a056a0000c800b005a8ecb10bf1mr1895699pfj.19.1677583515245; Tue, 28 Feb 2023 03:25:15 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1677583515; cv=none; d=google.com; s=arc-20160816; b=REFoDGoVZ0Y4/7FoZo59rn4RwYYH4zvRbNjbPR09iMwa8/8Q9oOCwNDFiZkGlv0vqd F2iZVRNkNBDPMJsEWUaEBe3ikr54nkgho2njiE39Pza55m3cGSTZ+iLWM6s7L1GwMTpX /nDrmKZOlXj4GU8oq4lhW5UZhG6e+1duZ7jfGLksXqBvxcTSKcQlw5TZphbj4uPAcKxy rQsjidrkQU5kS6+l1/3uHX4MRq7u+89ep7ae5HdNIZfbsrPLiohArpi1SgQRAmV/HAa4 mcGLA5FTf1Nyh+37HgeCK3TBO2yKmrDnEyCJAzGOY9HzgILf17y1W+vPJoe8bD/2mUs9 I24w== 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=z5TNBgwzcNn8XOHOn6st8yuQO/6LLEF2KjrUZiKffUexv2b69SmnBwVHY404ergNWv /T/mT0m1gEQFxNlnPsg5yDTx+LDLvYlMWSwgx2+L5E55vhFzj4YoWVIQERsog1GzQ7d+ r27S6eJtXCZe9SfI+55qs0KFOJsPT7kikYuw1NptSjpPAMRafh7ns90i/YynJo/WLGN7 +z1dB5LqsrBarxjtZ2DC4xSF5tmgzEw1pW9vrNXh68yZhlAWHl+BYMAsh5qkRReNClwe 1b0votuLg9TzfbDaf5ThQzf+upWYaFS2g/DdvEdhDYG3pCdnk+BNIspBUE4+qwz18BqB gyhA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="wV/L9wxm"; 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 fd7-20020a056a002e8700b005dc44c567a0si10782009pfb.24.2023.02.28.03.25.02; Tue, 28 Feb 2023 03:25: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="wV/L9wxm"; 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 S231680AbjB1LYg (ORCPT + 99 others); Tue, 28 Feb 2023 06:24:36 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43810 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231534AbjB1LYJ (ORCPT ); Tue, 28 Feb 2023 06:24:09 -0500 Received: from mail-wr1-x42c.google.com (mail-wr1-x42c.google.com [IPv6:2a00:1450:4864:20::42c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0FE39527A for ; Tue, 28 Feb 2023 03:23:32 -0800 (PST) Received: by mail-wr1-x42c.google.com with SMTP id l25so9348766wrb.3 for ; Tue, 28 Feb 2023 03:23:31 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1677583408; 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=wV/L9wxmkG0QFszeQY1rP/fmvWNtWBgOWQ20k9R2NIz3qAgL1Z4s5U/m2fUhZvZiJ2 LjJ+RiJ45DjHzwzE1kV7pc2FAdY2sC2YY9b4xzu8w/WOwX8vsh+e5Br7OcC/XiVBTiEq uTdyoRJq75pO8YU5osAVYSdkJzIBvJI2QJOclFm6K0nT9vCARArHdfhyAJ1o8dERlvn8 QSZ079y3ywulzSBvnFrMvkIKKPKiVZY5yq8KPPI0RzzdtyMbwFf9rFMCVMBVJrFsxwF4 C+3672ei+T1SK+whbLakvxiA9AR/QVGlhNMKoqGJ45lzPsGwnDt3op3yGk4bJZTWOPpK VFXg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1677583408; 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=aqkzdnMWZYxB2rgSly69aGxK+lWkBbGwPJdiQEFzKkUUFuAAxBt33A1WXjj8utO8qo eIl1RS3QtrO7Kx/J2Oo+Kmq0NLtsmKxvM+1+YwCEI+c7Hfk41td+wcT29NACA8Y2rHtK 3Yybt5rJnzd/2oBC0gAmGNCcI4vBmFkdFmJld4x9D5UGds9YuPeB7eF9ogCxzn3fG3oN jxaPSyqCSr9fynXGyQL3AriBfhx7Wa2xWIDk+NM1+Y7p04RvkrLM/wFwtnu1jFTx3V/T i7D3UDVa4655XOuu6ZTRa4kj9uIqi/omwbBACOuNkabAhxHtxSQLW7aPIe23qASULe5d Se3Q== X-Gm-Message-State: AO0yUKVnFb1xU6LizFobYJ0HmPclWm7JpBgx1+4pdDKrBNXqzi4yRyjL Hypoj65ukmb0i8BUKYDq+yGy3g== X-Received: by 2002:a5d:4a44:0:b0:2c9:9b81:11de with SMTP id v4-20020a5d4a44000000b002c99b8111demr1679350wrs.20.1677583408590; Tue, 28 Feb 2023 03:23:28 -0800 (PST) Received: from mai.box.freepro.com ([2a05:6e02:1041:c10:6830:6390:2815:b6a5]) by smtp.gmail.com with ESMTPSA id z5-20020a5d6545000000b002c5501a5803sm9598130wrv.65.2023.02.28.03.23.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 28 Feb 2023 03:23:28 -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 , Baolin Wang , 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 v4 09/19] thermal: Don't use 'device' internal thermal zone structure field Date: Tue, 28 Feb 2023 12:22:28 +0100 Message-Id: <20230228112238.2312273-10-daniel.lezcano@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230228112238.2312273-1-daniel.lezcano@linaro.org> References: <20230228112238.2312273-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?1759073812423793290?= X-GMAIL-MSGID: =?utf-8?q?1759073812423793290?= 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 Tue Feb 28 11:22:29 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Lezcano X-Patchwork-Id: 62439 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp2955094wrd; Tue, 28 Feb 2023 03:25:00 -0800 (PST) X-Google-Smtp-Source: AK7set/sqa7CZbBzM3m8WrfrsPX9gDCjCXkmu6fqEToFkyzJ3qXdLTczMJ6vBGuTNqCGrVXqZW/V X-Received: by 2002:aa7:956f:0:b0:5e5:6eea:5956 with SMTP id x15-20020aa7956f000000b005e56eea5956mr2316557pfq.3.1677583500358; Tue, 28 Feb 2023 03:25:00 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1677583500; cv=none; d=google.com; s=arc-20160816; b=wkO4nP5iy19S/8U9Xf2UhgSbgyJsghjU0m2Bz4JIwGGlEv57mqL781OKUuFnEXOFqc P6S8XuqlDmeUmRk1fNbHEe7ivxKY5S1k76f6Vq4SZjr7GNnx4T54tgTrnZsG68IYunVc 3VgFPIQ4+SfjR4Rygw5PjDTlm4TE8+/CnRQebcIWek5uSWzG+02Eraa7JH9YzyXD1wnv zkgebJEhRmhmCdmQ4WzpNKJ2WgxMMyK+0q/5kH0LBzVFh/hZB881ZWou6+SMw1SHYhgq xWkApX+7W+3T7FPL2ucVG9u0cbDwk7ZV7MPiUBhXDi9H5+my/9KXKUWAM7pT9p5ppjQR Y1ew== 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=WEeCvkyDsjnLtMbC4eeI8roog+sW0gvv2mFc96lyEmdDOEm+iOgWeY9Jwvqh7ZcuaB 6M5Et0fHSlVr5k/ok2Jp6yJAzNZAzfZFgC+8siPYjeVK7RXw5m5aKZnNeaB+DWDXlxhX 8mZz/j+PtF2Ej+0QGRlBCY14tAak47K03eGEi/bdyEuqU9Gh1vCnjN6I1SZw2A7sEPTw 3uvZVEvgvVsSqA2z+KrV7XwvjVoKQtAglVDiyR2x1VoguZufyaYZoeK/Dih6yUoZRNFl aSROyvdjgcz//26r3wICqmg3493REH/tjyip+1sDJ3b0BkNJaN+w4amaIuLCZ8l0vRIR MbxA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=EoPFM3nX; 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 z18-20020a63e112000000b004a68aefb7b0si9814471pgh.173.2023.02.28.03.24.47; Tue, 28 Feb 2023 03:25:00 -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=EoPFM3nX; 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 S231530AbjB1LY3 (ORCPT + 99 others); Tue, 28 Feb 2023 06:24:29 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44516 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231600AbjB1LYI (ORCPT ); Tue, 28 Feb 2023 06:24:08 -0500 Received: from mail-wr1-x433.google.com (mail-wr1-x433.google.com [IPv6:2a00:1450:4864:20::433]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 173CCA3 for ; Tue, 28 Feb 2023 03:23:30 -0800 (PST) Received: by mail-wr1-x433.google.com with SMTP id bx12so6178554wrb.11 for ; Tue, 28 Feb 2023 03:23:30 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1677583409; 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=EoPFM3nXOOVR3R9zMG/bqeRFGOggehpwTgel7J0QSyd9r9qjGkmkhXtuT3hSdMaD/n 8QCUYF5zzqN3LGiu6czsKP1mNpEoQyT3w025nGAMiVA0RkHThb7QbL6Za2gZExEFb0OP KI1PdtT+75sKVg8TzLFM0WYj/ud2bkxRy7L+pTAY/LH6OvbvbnZPqiYBUUF97HS1EKqP o66HEBOa0s82DwD8H4GNnaW2KF/psP13Crp1FEcrYqqXdSHxingmCYOeDzF5xKXUDTmG U86j7g23P+ZRFEVwjqpTfSCZrfNQRRbKtJ+r6tLPSwIoEcnRrURV28VeHa4w2afSaMR2 xDSw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1677583409; 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=W7hZp4XwaqSrjyV5v0JFnKYjznf/9nWvw4kjBRayoLqLeeKLxRi+IbeC06THAN4nlR NX0Bs6++113k4MXaB5d/HTJjPq9EPXUfjQwmpUHcjGDGrmgJVPy8RoCqxCPV/1HFJrgZ pRn4StfQUBCPQ7XQx3Sk7wDGF77yrCfcnCt2dmDRxmFY3yUyZagOi9FLyX3f/wz6omjT 4tnmvPIiecAP2WWYkXsduFKQwAQmQcbU39kE4hRpqiC40H4c6huxduSILa3+2+w9OujL FOKc6fbZgs32E6/1JtVxmRWzDUXLYX6VZcwd6YUMflbA7g7rdhiJCv12COvFXeyzzp/g 9m1A== X-Gm-Message-State: AO0yUKWXh0JLllAQrhTvjQWyOI8eQx+7ZV1PneV4tsmPMA3qN7hkMz1j y8teDmBAlKjgjs+LF3mACTomHw== X-Received: by 2002:a05:6000:1705:b0:2c6:c9f1:e444 with SMTP id n5-20020a056000170500b002c6c9f1e444mr8212787wrc.16.1677583409540; Tue, 28 Feb 2023 03:23:29 -0800 (PST) Received: from mai.box.freepro.com ([2a05:6e02:1041:c10:6830:6390:2815:b6a5]) by smtp.gmail.com with ESMTPSA id z5-20020a5d6545000000b002c5501a5803sm9598130wrv.65.2023.02.28.03.23.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 28 Feb 2023 03:23:29 -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 v4 10/19] thermal/core: Add thermal_zone_device structure 'type' accessor Date: Tue, 28 Feb 2023 12:22:29 +0100 Message-Id: <20230228112238.2312273-11-daniel.lezcano@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230228112238.2312273-1-daniel.lezcano@linaro.org> References: <20230228112238.2312273-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?1759073796408076848?= X-GMAIL-MSGID: =?utf-8?q?1759073796408076848?= 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 Tue Feb 28 11:22:30 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Lezcano X-Patchwork-Id: 62441 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp2955184wrd; Tue, 28 Feb 2023 03:25:13 -0800 (PST) X-Google-Smtp-Source: AK7set/6XUjoIDIyO28HCL9bcLvmg3f/4PVU80zNUxxTNyJCVvtJwcF+xLed8NPUoPFP0v10nb1S X-Received: by 2002:a17:902:db09:b0:19c:171a:d346 with SMTP id m9-20020a170902db0900b0019c171ad346mr3049774plx.44.1677583512901; Tue, 28 Feb 2023 03:25:12 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1677583512; cv=none; d=google.com; s=arc-20160816; b=hQaD+QI7XVsAp+pvzEc02gbWOfNi/jJPDz4rqP6zd1hVgZFVkYX943YOd2wy2NbS/Z 0AnYd8l4/FUe8HU+1phcPyoHdanqO6ybX741rLGUSAxLwdgj+/IVORPRA53Oh0MHxhxi /W+vwfpljwpheGPH0atM9w/pM0k9gwyhYGh5WHRhYef9EUizopadz6F8fceUoybp8CHp P9yAawtjbwMsnaYq1eyfW6Hlh3Jt4qdrOLN6tKY+81Ar26WLH6izplb2FnXYcH9CXAW3 bLnQtAUNvPrChRvlZBY65aL67yQDAQXVAolkIi7SfubE+V1PfNUeSa+WFfSo6fmnq16J usZQ== 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=ir/vqJTTfWljCgxtu9VATfnLKwqN23tAt8crdOzDXKqa8wecp18mLd3lmY5UKV58Mz PZhIeo90U+MlKFuOJk8EcDWLVmzCQdbhVU7Z+Am/rZxuqgQ0gqhaoM1eYCN94gf2kmm9 Zwd3KnV9ChEmgiYd0X3l2tbLO42x794CdBqcnnx5hUWYrkUQdW9/6uyuqdYRQb3kmonu Kl44lnIy/+/QbA0D0EKlFFVsDyA5nHovbsyPgWIZ3ZezkDxLLxPapMmZYoSLfUMz86kY Gms1Z53A2q+NhyJs97Lx5ihwDVKJsFtUYUmD13Q9F/Mg5Ey3fNmUW0mlBMUdv+qVNjaC IGfg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=GBsd0NXN; 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 p3-20020a170903248300b001967d895ce0si9081128plw.213.2023.02.28.03.24.59; Tue, 28 Feb 2023 03:25:12 -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=GBsd0NXN; 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 S231668AbjB1LYc (ORCPT + 99 others); Tue, 28 Feb 2023 06:24:32 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43778 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231555AbjB1LYJ (ORCPT ); Tue, 28 Feb 2023 06:24:09 -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 C785B55AA for ; Tue, 28 Feb 2023 03:23:30 -0800 (PST) Received: by mail-wr1-x436.google.com with SMTP id v16so6528716wrn.0 for ; Tue, 28 Feb 2023 03:23:30 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1677583410; 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=GBsd0NXNUhijxeivp3xGCAeUf73T7L6PKR4bCS5NvI/hSzveAraHZExaJQ6eSdvL0p CCk/GCypFfO/BKSb8RDnPRl43C4TTnUrHGeG0YiJ6qYWLdvpH9IqnHDBELKadVvv+fdW zmEt7DqPl7XIK1GVjZ9SRo51pthKNx3qye9N5MsR+x2SWD7ccn49oggJYYQr2ddjz2r4 r5yvaZ8KGHhywMSJrWS9a0qRxxCWOrNKnDL136X558eLDSldq7nd2dAUGVW7CBuhO0d3 cFBF11QxpLcnLF70DFiFjUyDU0WikxilpXJDwe9A6A754G2sb5YOnSm1mQgO+a3qkc1x JTxg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1677583410; 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=rEChwFiuj7eM65OeyR6fJff+MySuuNP/9vJlu5nM5pP3WDttvP66Wn3lH1gIWder6S Wjtrk251L5imzedvUIBveu3IRKyl+tTklwspT/decT1wCqrn9fzOIPY3peY5Ow7gwzAA xH6bvt2H/mEzbIZaRHuAhQzpYHfXLPHpQd4q6E8pPY+s7L36OjDzLZmRxOn+LdKAZbHi 5G20lpngIoIPmFlsK8wVksDHGNHJodpmFEghuRcn7+lgwS9bvuGAArdRanKgzfr6uCrw 5kGTkAbRUFe1SbGYQM+z5Z8yS4UAUiy7IQKWBV43/o5O2DTi66jzOlJIBaXcKx686mKm PqRA== X-Gm-Message-State: AO0yUKVev5wtkoVZwo51XOP7PYdWGaQ1X7zDOTHwaUkAVx9XNn0ijxqq qGe3hJ/3atUZ0lcVBA0NGgnmPw== X-Received: by 2002:adf:e545:0:b0:2c7:cdf:e296 with SMTP id z5-20020adfe545000000b002c70cdfe296mr1758873wrm.66.1677583410296; Tue, 28 Feb 2023 03:23:30 -0800 (PST) Received: from mai.box.freepro.com ([2a05:6e02:1041:c10:6830:6390:2815:b6a5]) by smtp.gmail.com with ESMTPSA id z5-20020a5d6545000000b002c5501a5803sm9598130wrv.65.2023.02.28.03.23.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 28 Feb 2023 03:23:29 -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 v4 11/19] thermal/drivers/spear: Don't use tz->device but pdev->dev Date: Tue, 28 Feb 2023 12:22:30 +0100 Message-Id: <20230228112238.2312273-12-daniel.lezcano@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230228112238.2312273-1-daniel.lezcano@linaro.org> References: <20230228112238.2312273-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?1759073809463953033?= X-GMAIL-MSGID: =?utf-8?q?1759073809463953033?= 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 Tue Feb 28 11:22:31 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Lezcano X-Patchwork-Id: 62444 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp2955309wrd; Tue, 28 Feb 2023 03:25:28 -0800 (PST) X-Google-Smtp-Source: AK7set9uxjN1oKVUlzp2ebBVpoZU6L2KvzePX0VcTik+4BtrZ5uSIz65fI+x9H8Z+REj0+LUGfRa X-Received: by 2002:a17:90b:1d0a:b0:234:13a3:6e67 with SMTP id on10-20020a17090b1d0a00b0023413a36e67mr2880848pjb.12.1677583528354; Tue, 28 Feb 2023 03:25:28 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1677583528; cv=none; d=google.com; s=arc-20160816; b=gb5Y+f9bXkVMZpu3rwwITDcLueZ+4Y7r91hBWusVRRYuYAe8phXIJ5bZ7QV6OJ8WHG BqM6wskSkzO6eUaf7DHKjZ9qH5sREeJ9sAFgF+Z8SDLDwbx6mYyHJxXblcHJzUHEjvNe teBvvW6MmRARCOpreUT3Qa5HBCH3qqUJlGX23fBrFA7LvFypw5VI33UpeC3mp3QsGQb0 +XNSqwTqHXp5lb97R8eEGI8QWkGjcUljFDkm23UsHZdeA93K5Yf1BsBTg6N2Y6c4QD9Z Oh+1WodNUc+fi5QLacTK/TZdAb2506K6lHAaUDECnqjjm0vZhrl4LCPVfs/c5Ptfqxiv Q9dw== 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=U6ElhO5ciiXkA8K20O9wNUACD1j4bIFlpMzR/7f7Ymt+fsut6z5UsAj3NIJYl/xTc9 qebf7LRS1n/7IUyQlDVwAeFH98b3KZIeFrmiwjHLjCMZ9v6vF70zd60Ucv2qB0i6NwAL f8UZE4qsMLBVw2rxEj5ctnHVoLzaS6EYT118FIDQ44PuDtkMgsk0qbNRdAgNJ4b/ivHg ceaG0EcY6Hz64pI1L2O+OBVZjLofjEEGE9JjXZ/Im4te1bwJQs74+xjuP9nJk/J2cqP0 A5gfAggc8l7/1rN9Kg88VKhKN2f6Vlv2xMTa++PKQ5olCeJ4b4rJ4vMSNC9J9D4qJK44 NC/A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=soFl3x2m; 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 cq2-20020a17090af98200b002239c987051si1639750pjb.128.2023.02.28.03.25.15; Tue, 28 Feb 2023 03:25:28 -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=soFl3x2m; 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 S231699AbjB1LYn (ORCPT + 99 others); Tue, 28 Feb 2023 06:24:43 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44564 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231622AbjB1LYK (ORCPT ); Tue, 28 Feb 2023 06:24:10 -0500 Received: from mail-wm1-x32c.google.com (mail-wm1-x32c.google.com [IPv6:2a00:1450:4864:20::32c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6C11815C9E for ; Tue, 28 Feb 2023 03:23:40 -0800 (PST) Received: by mail-wm1-x32c.google.com with SMTP id o11-20020a05600c4fcb00b003eb33ea29a8so5126174wmq.1 for ; Tue, 28 Feb 2023 03:23:40 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1677583411; 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=soFl3x2mfMMF67I1FvokputhjZuMW2otf4WTnRYVuV+k0mQ/OS+fZdLqmnd3H6OG40 OkwqOSBW3UecWgcNxcHsSeCNOPkN1GE9jymZncVh/LfB3gXEkvPKtCEDXHmZbBtHL11x Pthf2ZgB5Afbg/MXm18ge1cBvHUlXy9yVwciggl7ITvUnVO6U2Knf767eVqWTuBWrL8Z Iei3Mwbk5rYDseKP50HVTiX9cc1nSZoXlH7oeuJ2Oz7Qpi1n/IPHb1eOsrQDtDPYSz13 /AbZBMJaTOhBkSIKA+bULSgW/pDu5a9ttyNypyLnA0wPkjPWc4j/4KkdeUHED+PvokAK mInw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1677583411; 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=wsEHDRGb2cQrQcabbWPEFud9vjRNEJgHZq3L9cw5mLhMWpAPfGmAR48qnlL5nZXCv7 GgG5MxNjKP9oMrVb0Z8FRLBAxDTrffIMDzkV55IeGL2EicX6ZMYXPquREdb4f10j73m3 8T2BitHes2E34XGYA/vy/3HZ6yUpV/CB2UZepnqYQk8/uZiGxZBDcN6Cl1rP6UumEKZC 1v3Th2Fth6f6dQWpstufJQRkbQekk4yJvNzp46vDExGv9cwi2kTMRS8f6e0SDVwaL++h tM21Apv73g7xwFMRAEZbppw98VK0BZp6le3dvBfwTY3Bewi6O3SI4+akwi4U0SGV3q9J hh9g== X-Gm-Message-State: AO0yUKXn2qYIbYYkOsgzMgeMQFhjHkFgPc6pICK2K73L/VIiSgML9xBp ObZKlmiYwy8S5R5M8HO3+1yRpg== X-Received: by 2002:a05:600c:1ca3:b0:3ea:e7f6:fc2e with SMTP id k35-20020a05600c1ca300b003eae7f6fc2emr1742726wms.6.1677583411474; Tue, 28 Feb 2023 03:23:31 -0800 (PST) Received: from mai.box.freepro.com ([2a05:6e02:1041:c10:6830:6390:2815:b6a5]) by smtp.gmail.com with ESMTPSA id z5-20020a5d6545000000b002c5501a5803sm9598130wrv.65.2023.02.28.03.23.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 28 Feb 2023 03:23:31 -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 v4 12/19] thermal: Add a thermal zone id accessor Date: Tue, 28 Feb 2023 12:22:31 +0100 Message-Id: <20230228112238.2312273-13-daniel.lezcano@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230228112238.2312273-1-daniel.lezcano@linaro.org> References: <20230228112238.2312273-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?1759073825757993645?= X-GMAIL-MSGID: =?utf-8?q?1759073825757993645?= 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 Tue Feb 28 11:22:32 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Lezcano X-Patchwork-Id: 62446 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp2955423wrd; Tue, 28 Feb 2023 03:25:46 -0800 (PST) X-Google-Smtp-Source: AK7set/BEezIXIu2BbOLg/Q6ntyrTijfqq7euvKbIm438+a4k3YeqwV1Jf+klEM5nx80ARxvVvdM X-Received: by 2002:a17:90b:4b4c:b0:233:b849:7e8f with SMTP id mi12-20020a17090b4b4c00b00233b8497e8fmr2855249pjb.47.1677583546030; Tue, 28 Feb 2023 03:25:46 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1677583546; cv=none; d=google.com; s=arc-20160816; b=ppRjdQHv+hvAznIkteehlqM8jD220jtPvIWso8PiIMLS7tNANT716MIxqyyT8Hnc8q jL6RDcJ+5WtFNxDx6lP6hHGuWzrKWlZWTbXqPA1FIUbisa9QoFfEwAdRbczXENcypXFQ +yUwB6XD0dPxBJp2mMEVVu4SLmkKYdrwFSiTR/A5h3XQdbb9MBj9LsUboNUQaTVwbtag ne4z68SlfHvBQrH7JTVbuRD37nWCwuyperj+yc8iKyv6PI5y/iRcKSywgJdoL6KkVsgF ypqMPt8QdcGS/kKC0boR6pUr0zz4fWc7ukQmhvSE1YxtYUlp2av3O1yMKCVnsM2Bw+C2 8KLQ== 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=fTsEaSbw0VDJotSC87YKiChaPJrfSsV4q8qAOuE6eIstEqbMPoewqUBTZdYCEc+HlH kiVPyNtIQPayKJAffoGj2pYYRAX8ByfkLet4b/YBwCVUc0bmWb/TbnhN3v5X00FVoJr4 3bDSF6VAihEgmefw2kM2RV0X++k0S01XLk1GSLXhfK7k+M0dFEGhOlKyJdoMpUX3HGM0 t+QRTKUcEOoqr9K+dlxb7IYB2HYQFW9FxhD/29x2bTbEK0c2ji0KJuw6uxOLH2+XoYrs yfFMGBfN8H/kCtGEEckzuPidHAYKepJaKu9XNdiisVmY9PU3083p60hcRIzPCMdAH9Ih I8KQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=D7degXSL; 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 z9-20020a17090a1fc900b0022c0049ab90si13193996pjz.95.2023.02.28.03.25.30; Tue, 28 Feb 2023 03:25:46 -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=D7degXSL; 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 S231705AbjB1LYs (ORCPT + 99 others); Tue, 28 Feb 2023 06:24:48 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44026 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231579AbjB1LYM (ORCPT ); Tue, 28 Feb 2023 06:24:12 -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 03AB46A4C for ; Tue, 28 Feb 2023 03:23:43 -0800 (PST) Received: by mail-wm1-x335.google.com with SMTP id p16so6134741wmq.5 for ; Tue, 28 Feb 2023 03:23:42 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1677583416; 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=D7degXSLzdHyyuLQSEez+rs6OoplckklX0y3yoGvzMO+5YqTBk/bkHm2mQ/ivXNeYn lBJBIkAZMz0AuuAE6FxYOQ0bRdPYrEnl0df5rs6DhgYUh5u7gLvmcwEaI34LezA0l8KQ xZ77ztBIa8JhuumE7fBQfx+YWQJoc/P2QIOm8KuT0OKc4ldLXhQs+q6mY4qBJSNux6Oq I4ZHZEAownLfC+fI/GvQCjOJL/heOBr7Z1nzpFnF6lF2RvcWgdLYaPpQGLFnuCk8tQDX eoBlkmPVM0bUl4tnXttpCRBxR3e050yQszSgWxgc3rev6xCmFM6jEItkfQjocVW3fi1Z uFpg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1677583416; 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=0H8/xzOPxfk46wNh1JYfkR7Kd/4uFLYXB64l6w1O4HqCbc7+1aiFzGdPS8Bpjv3THF SAcnKVMbP5TWr1rJPK39Vz9EAq12dXKWtLHtWxg6TQOMeYRDIrlcFgKwlDevN7ifircN 8JJawfOyrSVCRRvhKNYJeAUpb0DVltuYDe2IoFkgGenxLIv0hX0VUwz3nbSoqKH5Oi8e 3mXlspeUHMldyFyZw6CiqVPi9+lY9Fesdc1tBYwBt/dE3LCFHvVcu37S348ICsxQQ2ah +FsIPT5llYpt4Wym6QjcB3fkNS0Ez4ND75N1gOovCqPN4FmCZcnuTN8lJoRHREjtl5ky YVHg== X-Gm-Message-State: AO0yUKUcVByschoSgk47tAiPzhXJFvhwsQx9ulzsngLHaRxsSFKQ5bCl NKWM0INHk49eVs5ofT2FUVn5rg== X-Received: by 2002:a05:600c:1f0e:b0:3e7:95ba:e1c7 with SMTP id bd14-20020a05600c1f0e00b003e795bae1c7mr1982176wmb.32.1677583416101; Tue, 28 Feb 2023 03:23:36 -0800 (PST) Received: from mai.box.freepro.com ([2a05:6e02:1041:c10:6830:6390:2815:b6a5]) by smtp.gmail.com with ESMTPSA id z5-20020a5d6545000000b002c5501a5803sm9598130wrv.65.2023.02.28.03.23.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 28 Feb 2023 03:23:35 -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 , =?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 v4 13/19] thermal: Use thermal_zone_device_type() accessor Date: Tue, 28 Feb 2023 12:22:32 +0100 Message-Id: <20230228112238.2312273-14-daniel.lezcano@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230228112238.2312273-1-daniel.lezcano@linaro.org> References: <20230228112238.2312273-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?1759073844371430019?= X-GMAIL-MSGID: =?utf-8?q?1759073844371430019?= 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 Tue Feb 28 11:22:33 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Lezcano X-Patchwork-Id: 62443 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp2955252wrd; Tue, 28 Feb 2023 03:25:19 -0800 (PST) X-Google-Smtp-Source: AK7set+WkDT1tJ/xNFMHtbZul3qnzqhd7onuUWgWHxim2YshQK1z7w3ci8j/pqKA9jHJkUyyGgNv X-Received: by 2002:a62:1aca:0:b0:5e1:a3b1:966a with SMTP id a193-20020a621aca000000b005e1a3b1966amr2119433pfa.34.1677583518965; Tue, 28 Feb 2023 03:25:18 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1677583518; cv=none; d=google.com; s=arc-20160816; b=sQ4bUmKnCOnmpfQwAXK/th66Z1zkoJ1nsXSycRBgZLRxhUPwj6YRF/To6l09jtnQHW Qyub7//cZANd4JMEAkJ7bjczY20jRp4/KgGur0Tpk5gykEMMZdlVDREJMWgLVAR1Z31K I/ENia7td6V4EZqggIEDk1J+v4l3AC8R17s3IqCeWWSTPCV7NiUzQ7lGxO83wFmFa47+ DkxfoL+JI5T6kazzcf0IWb/4PzgwQ4CeikbS9AzyP0B7i3IFVqNAYRhbYfQaxkIYiDWi sSAO+ilfarJq7uG6HqRaKLCmjc2AKYT8KVEqTNjStTURbvaYu7KLq0/Tm++9YO0jANQ3 Mu4g== 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=B+RTeMjiH2Yk42W57PYAK6Mb85gdhTfPcaFRy4giwH0=; b=mL+UL2HajtUiLXJ5fBM8zhdMsJoxdkl3I/Xr6wRsht+/lOo6Ku7sHBaukcABEzl00R 3tzi88UzLg4D1xaHNNNczMcM037Fd122djpPVWd8asfv7221pYqq0Tmcue8PGqrNTBmg IIoP2gfusID5JqcwAq+sAhODtMUwERC7AQS5Ipcf6q9caaBjxGk9MpYD7nnXpNgHLSDu KK9l30OXhi4kPR6RgiZFeBhfC8v2SMTxFxueZj53RIZqdJ1oOZ8/hRbF4jSa3wsEpDOh ZdR7WGlKUWINlug9OHnJA8BA/y3weBZb2YftqzgAPZEkWx1swtx+3exZbim1YrX9BUZx I9CA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=EmQXnQts; 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 q17-20020aa79831000000b005a8bfc8e18dsi8898704pfl.323.2023.02.28.03.25.06; Tue, 28 Feb 2023 03:25: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=EmQXnQts; 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 S231633AbjB1LYk (ORCPT + 99 others); Tue, 28 Feb 2023 06:24:40 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44554 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231566AbjB1LYK (ORCPT ); Tue, 28 Feb 2023 06:24:10 -0500 Received: from mail-wr1-x42d.google.com (mail-wr1-x42d.google.com [IPv6:2a00:1450:4864:20::42d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 877D6D33B for ; Tue, 28 Feb 2023 03:23:37 -0800 (PST) Received: by mail-wr1-x42d.google.com with SMTP id bx12so6178890wrb.11 for ; Tue, 28 Feb 2023 03:23:37 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1677583417; 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=B+RTeMjiH2Yk42W57PYAK6Mb85gdhTfPcaFRy4giwH0=; b=EmQXnQtsDg+56Wuq6ewQRNDc28TLYzPGy1X89Ssg0MochaT9hmPr0KireBQjSDQ6E7 bjvuyvug9z81Yd9EbbXOOxBwJg1i3N1ZuXnZgmm+0Upk0EiUbSe5UZTvyAjiPCCohQTx 1EPy2RiGpQVVKptvZtAiTydYryNJwyZR8OcG5veCR1GjT8UnWQ5ba0ialhHB+H/0BqEJ bHdStmGGKz34GeGA2WXBKwEO9HSHUmh8FYElsvfQYZPEweZc9I9E7Gf6lM9m6RZS6uu9 dRPJHrbvPaJdQureGjN6HrS9w/znb8n6nZaDYcDiRPipyO6tIE47bRCzCMEymz21NUqI FT8A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1677583417; 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=B+RTeMjiH2Yk42W57PYAK6Mb85gdhTfPcaFRy4giwH0=; b=GhEB2YqN/sPuCJFzXJGlzgTHlEs3Fa/ZHVvu0EITl/XMznVpRRPXuZtI2sJbIrvw+P oIAzV8x5p+FnyoJtatWo1q6MJRlBTrsZQCIuOG4nI92I1++q9I2HOVOrZausAEBzvIWU IuARllgf2OHvmgRx9YzfuIgXajds/QlPlzQh2TjLYUFfvx1BQ1BxHRIa1MRvYomjgSfC Kt9Xedjklr1tib2oQqBDGPkpVVyS35d1+yegsBIQqZ0rsOHu3BjvX5dom84tUY+2q0Td m1sG7zdHcmPQgKo7e3pGqE/a7RaKRyY3Ze52Ke1QmJf6XhKWPFcjlN0AmYNhsPbqsLB5 oscQ== X-Gm-Message-State: AO0yUKXTeo0I14hkRijn8zODz6SoercwvVcOZzeqPDE5TC3RImRf1RPH A18YqsEOv5bTXLv1rACTZTlQFw== X-Received: by 2002:a5d:44cf:0:b0:2c7:107c:e172 with SMTP id z15-20020a5d44cf000000b002c7107ce172mr2119658wrr.41.1677583417089; Tue, 28 Feb 2023 03:23:37 -0800 (PST) Received: from mai.box.freepro.com ([2a05:6e02:1041:c10:6830:6390:2815:b6a5]) by smtp.gmail.com with ESMTPSA id z5-20020a5d6545000000b002c5501a5803sm9598130wrv.65.2023.02.28.03.23.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 28 Feb 2023 03:23:36 -0800 (PST) From: Daniel Lezcano To: rafael@kernel.org, daniel.lezcano@linaro.org Cc: linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, Adam Ward , Support Opensource , Amit Kucheria , Zhang Rui Subject: [PATCH v4 14/19] thermal/drivers/da9062: Don't access the thermal zone device fields Date: Tue, 28 Feb 2023 12:22:33 +0100 Message-Id: <20230228112238.2312273-15-daniel.lezcano@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230228112238.2312273-1-daniel.lezcano@linaro.org> References: <20230228112238.2312273-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?1759073815819549652?= X-GMAIL-MSGID: =?utf-8?q?1759073815819549652?= 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 Tue Feb 28 11:22:34 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Lezcano X-Patchwork-Id: 62447 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp2955781wrd; Tue, 28 Feb 2023 03:26:49 -0800 (PST) X-Google-Smtp-Source: AK7set+hEgOp7WZe3Ni8GiEfser166xaFZ/uWy8RwCNKWSC0L74J3nJhDrt5HC5u8Ry1QMJIwYmC X-Received: by 2002:a17:902:d54d:b0:19e:2298:c53d with SMTP id z13-20020a170902d54d00b0019e2298c53dmr2183039plf.10.1677583609122; Tue, 28 Feb 2023 03:26:49 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1677583609; cv=none; d=google.com; s=arc-20160816; b=uqHvutUs6nX97ZCou8wu3HeE8+hereFrmiNT4z/ToaE5ArhZARj1pbarZ7mihpF5Kf aUBiiglwFkLVQQZIgKacObq2OZFrCLzdJb3cgE7Uwe7xbJyo+Dawa0j0ZVOqZPu32pFR MiNuvfu5zcXc9ZnQU9AObg4tlFHu239OECkaJxnH71cOxTH9UQQRxdjJtvbpAOi83Xw2 EGkVOdl9fqQqGEyrWN1UXbr/oGFj1Kc1b7erdIlyc+yS9h6YVbYGxuJy5CuwjkpBYv6F 4DNeT3pkkicCgMPYN+KWMCF4fwvCHkkuwsHQPvHrmkF4RVndGbYTs0OVjALEYzhYHpx+ q/kA== 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=tS0guMTDp+HnyAw7+AQL4Z1IASYNHpKANmt65sLAMFo=; b=hVvr0La0Qx4b1Da4XMrfXBqYERGZE6MgkfK0E2wRL0WbxUcMFLhFBKwhbF5rdqYSJh VKrnVOKJYu6ucz2J3M3Pa2NGM4heFbFKyzy1gjTdNWHfXlNRBGyWONBnkhBQhp3HGlbG L4lzdRYY5JpFS9IIv92u+BYiA5mhIegCP7ndvAPBpHYvFCWzR03FVObtsvJ3uyc7fog8 0FILuobAe3JWX4W1Z+Sge7K29VynGlSFgW7QCNW4zB225sOdreP+eRWc4iFQ2zu6u8J1 qdLPFYziWK4aqqPiM4iy2I1NGvKIJt4uB9V9RFv5zoi+SMEIm2Q5HV2LWmzVjJeoi+gt N41g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=As5cnEs6; 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 l1-20020a170903244100b00198fca8211bsi10187788pls.57.2023.02.28.03.26.35; Tue, 28 Feb 2023 03:26:49 -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=As5cnEs6; 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 S231548AbjB1LZB (ORCPT + 99 others); Tue, 28 Feb 2023 06:25:01 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44696 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231629AbjB1LYN (ORCPT ); Tue, 28 Feb 2023 06:24:13 -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 A067D20577 for ; Tue, 28 Feb 2023 03:23:43 -0800 (PST) Received: by mail-wr1-x429.google.com with SMTP id bt28so9332120wrb.8 for ; Tue, 28 Feb 2023 03:23:43 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1677583418; 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=tS0guMTDp+HnyAw7+AQL4Z1IASYNHpKANmt65sLAMFo=; b=As5cnEs6KbgFzz64hQ+xg783ZBl8nVKUvbDG3lsn7Xxbsgc+d5VLgBw9h8c2bEVmYD Q0heWRMa2Z0RnelgQzMkmiEu+6pZfz6z6lZNnPeSpSW29d/425F+G7wPhR3AjBALI9Fp LoLvyYA+Ae7tnAxSxdZ8lls8x4a0Vy/y/4AHj/sjTk4H4x5/afakN2wU3/8SsQlR1nQ9 75wqnM/NAkWSDsqp89Nr/sYttZBTCYCXLCdnG3OGCk13jiI/uOOBmCCQLTZoy7KlmE40 jLrMIP8BAx1wwJfjDna2h+qWZRhY6xh+d1qOA3hNheEgO0PYKNUGGrXcLdz/DQ/hFh8U nmjg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1677583418; 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=tS0guMTDp+HnyAw7+AQL4Z1IASYNHpKANmt65sLAMFo=; b=lTFC36lTy+H4TQRsLizzEu+CUQmF8UEGGazZaXG4B0WObvNob+7yKH+yc3F1kU/TDC OpBCwCp1B0DB+uSMDnYOZACSVdXG5RUdc2tNpdR4tfGEyHsvh6Z4HUx/oZvfb4vCy0hR BhrClQRagIYPtWMnN9ZLGMXcrHtAI4qho9dGwPVSM3VKqHHArKOJB6LaZRO/yPFe8kx2 RnNY+vbdxEqfp5CpmrIp3P+9XHVf2Eo43exahL3X+C+AGp2C6qAcQp7sS2HTWgjpAFrM nuMLwL/2vXYeSEKGQreFE+x6G5M2z5OR0TtrHhVuTFPdfiLDqj2BhsstM9OtXvj3a9qn 7gkg== X-Gm-Message-State: AO0yUKXuxFLC9mavQ5wk25LEstcgVoLPtySkTUxWwHPwbtlpn2Doshxc yPa6LziHuViD4F02x+5MNCND9A== X-Received: by 2002:a05:6000:18f:b0:2bd:d34e:5355 with SMTP id p15-20020a056000018f00b002bdd34e5355mr1611428wrx.20.1677583418047; Tue, 28 Feb 2023 03:23:38 -0800 (PST) Received: from mai.box.freepro.com ([2a05:6e02:1041:c10:6830:6390:2815:b6a5]) by smtp.gmail.com with ESMTPSA id z5-20020a5d6545000000b002c5501a5803sm9598130wrv.65.2023.02.28.03.23.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 28 Feb 2023 03:23:37 -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 , Jean Delvare , Amit Kucheria , Zhang Rui Subject: [PATCH v4 15/19] thermal/hwmon: Use the thermal_core.h header Date: Tue, 28 Feb 2023 12:22:34 +0100 Message-Id: <20230228112238.2312273-16-daniel.lezcano@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230228112238.2312273-1-daniel.lezcano@linaro.org> References: <20230228112238.2312273-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?1759073910318904565?= X-GMAIL-MSGID: =?utf-8?q?1759073910318904565?= 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 Tue Feb 28 11:22:35 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Lezcano X-Patchwork-Id: 62450 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp2959507wrd; Tue, 28 Feb 2023 03:36:10 -0800 (PST) X-Google-Smtp-Source: AK7set9S5Wgu658WqeDX9/UomFy4bh7zjXhmIi1jrp3aTeOxhP1kCnmk/jgCRJR0XlahQoggrsF8 X-Received: by 2002:a17:907:9806:b0:878:8249:bef6 with SMTP id ji6-20020a170907980600b008788249bef6mr3166667ejc.59.1677584170552; Tue, 28 Feb 2023 03:36:10 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1677584170; cv=none; d=google.com; s=arc-20160816; b=veATUL5KknfTinajiWgGqvRqteAwmuWqnxzI9zErILGIhacjFSW2qT2X1Kuqw5Qm2V 7vlvGRD9x/vn9pRozw/+IpPHEOjgwKDmOEp69ZhQzt5MZEvK9OuAiTIFA0ixIX6cb4rY Z1X2KN7A4ZeuxMXdV6ATHg9Dxt9q6a48fZEqrMWOabMQ+pOEPpCAaaEEVxg3iLFTwx1z 7Cof4sLGM2PydPY8TZkdRlyOxEc1Qn426eyOKhCwwbDxZrxlk06BL4/B7SxWZ7bXviPY SrYRp+L7A9/drfDS0wAqrTAmX1S0KIkhkzY2iChjbEGIo9CBKhiJt2hgjM6MhRhmSzV+ fWPA== 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=1Jqavn8I72mf53t7lNrGFTQof0/1hH35WgYIfHhBSonzK/rs8oi9EWfriIJffV8+Us ESkdNgPC8JOoS05t3vXJdNvJP7JkeMw1SABMKhSoYx5El6XghvrdBVMqXRYlTkU2S/B+ yvVpxSG4lUAowGw8oZNfPHR/CPBO0RFvQ+CwxQ6uyhwlDTpv9FTzCp7+qFeyt2y5ga8U A6BfDCD0igBEKc5ovBSfJWpMLwC653tLUWPa0mY41ADYeKv8jZr8G9jaOxJ3LIRqMo4O t9zz2SaIPehj09TyP6SRHIygBb35r1ydotPBhwT1AoPW7wR4e2+ytfM5eNbjkvurpKRq TLHg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=uH2iPKUi; 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 n21-20020a170906689500b008d2262654bdsi9516855ejr.430.2023.02.28.03.35.47; Tue, 28 Feb 2023 03:36: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=uH2iPKUi; 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 S231629AbjB1LZM (ORCPT + 99 others); Tue, 28 Feb 2023 06:25:12 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44892 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231637AbjB1LYU (ORCPT ); Tue, 28 Feb 2023 06:24:20 -0500 Received: from mail-wm1-x32c.google.com (mail-wm1-x32c.google.com [IPv6:2a00:1450:4864:20::32c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 44486241DC for ; Tue, 28 Feb 2023 03:23:46 -0800 (PST) Received: by mail-wm1-x32c.google.com with SMTP id l7-20020a05600c4f0700b003e79fa98ce1so5634436wmq.2 for ; Tue, 28 Feb 2023 03:23:46 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1677583419; 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=uH2iPKUi6WWzxncaaUCnNyUW93Te0pgpw5ZVwQslHbwqJ/8zYBAPRAyVU+rCYo49m+ vwJfjfzWSyZFyui3qDxrhI6YZtsgewelZDRzhfB/mrkRCN33zgfKv49GvwquHmeUuRCJ oywdKx2uiIdUmj6sohlH44EaXz6vKSFcPMgMQWRsWywfb8pKDToojlf05J6f+h16x1G9 6JZmgpLt5MkCIA68wsyWP+Oih9p+S27qOp9iIlRrA60IyxEzrB+RELqvhxCepoQtMy0W NDrdjdjoNPFlb3HS28boS3f6ksSeOu9s71kaooPyFE9PLqd2Vp6C26legnHfZg+ghuaL t6WA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1677583419; 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=2yP12XyBgSDs8M2+kNK0WBSe6V4QZmyWVXy1Ggxk0mY931lZiMmKep8vMAznWE9vQG xC6QybztU7GdURwYnMzQL/7wUhS5LMqwjl6bZQc7K8RhcF7cWYfj39P0A/6MTepp9cdK Q3y1HxO7ZhuSQjN2lGOWaYNP0Pp58M5vEsADpBXC3hHwFzZybFBzmgnWXJKXfazBkFBt AfOU2QQxmLrm9ICOL2HEoCiybK7CnvSbCYf1v4ubKrBR1tsurKNEbw/SxOJXvPSlJWe/ rmI7LdZfM0Z+/FhqeAV0AM1l9w/kcyiJFVFcvDCHnqDcpjpWI16GLZqKm621TdIxYHdZ MdbA== X-Gm-Message-State: AO0yUKWENEvQVjPAkEP4xNgh6ah0T2JVvNcJaOUZzuhUD1CmQvuptDmq YN6oGNBH856cMWJgUWOq3uEJqQ== X-Received: by 2002:a05:600c:4586:b0:3eb:376e:2ba5 with SMTP id r6-20020a05600c458600b003eb376e2ba5mr1823393wmo.3.1677583419590; Tue, 28 Feb 2023 03:23:39 -0800 (PST) Received: from mai.box.freepro.com ([2a05:6e02:1041:c10:6830:6390:2815:b6a5]) by smtp.gmail.com with ESMTPSA id z5-20020a5d6545000000b002c5501a5803sm9598130wrv.65.2023.02.28.03.23.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 28 Feb 2023 03:23:39 -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 , Florian Fainelli , Jernej Skrabec , AngeloGioacchino Del Regno , =?utf-8?q?Niklas_S=C3=B6derlund?= , linux-tegra@vger.kernel.org (open list:TEGRA ARCHITECTURE SUPPORT) Subject: [PATCH v4 16/19] thermal/drivers/tegra: Remove unneeded lock when setting a trip point Date: Tue, 28 Feb 2023 12:22:35 +0100 Message-Id: <20230228112238.2312273-17-daniel.lezcano@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230228112238.2312273-1-daniel.lezcano@linaro.org> References: <20230228112238.2312273-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?1759074499222340891?= X-GMAIL-MSGID: =?utf-8?q?1759074499222340891?= 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 Tue Feb 28 11:22:36 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Lezcano X-Patchwork-Id: 62445 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp2955323wrd; Tue, 28 Feb 2023 03:25:30 -0800 (PST) X-Google-Smtp-Source: AK7set8qU0yfQa8F7GA/qT3GUUBLlpLizZV3wueN/KQTfNWol7xOjKOCWT6z0fzlyZv2+2NACx/l X-Received: by 2002:a17:90a:4b:b0:237:9cc7:28a6 with SMTP id 11-20020a17090a004b00b002379cc728a6mr2827471pjb.26.1677583530370; Tue, 28 Feb 2023 03:25:30 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1677583530; cv=none; d=google.com; s=arc-20160816; b=pH2BV1qRhenfH34lNNiIYKQFkwX2Zt/hkUmsBMfaOI1lcj4gs23HT5vcYsxkvq/jKv LTu+ics7arekOHS3gbmCxE0Np2aA+icwF9jz+nKA7Gqo6ip4MJBMFYWtCzhXSVbU9cKW pcU0FnTtwu0grPmdY+qBsCO6Eo1PSda44Kn3XQD4DOsS0PIEh7bvagNo643z6x3W4z7A fp21JW+k2POcOBxQxmPTGtJT+lssfzbhBJ82PjSQ6/KAlk32gWk22536GAoIB7wYvukG kBj0xmtdwZaFQfN5q6VoDHxJtxsx2G/WsqnRaTGxV3DEls41F4rDxwmBv9vwCe9ITLYy cPCg== 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=yrXBv/0DhyBIAopuvNJkmTQUwb8FKLQ9dCvDu7FidBeoKwXgk4ryewegA7VnEKwn4i AlY8PklxxcO/ejfB03IJ12CuVtNl9Zukujhq+KmF2O+EwjVEH1g+P4fHws6gyi/ucylk 24rRpcsvqG62OgKZzmTyMj71g05c97dPibikgcEuaS6eNBMNld8Kx76yJBg3pYGRXo0W 18eFud+GzsOx10Rn4ImHsaxXcfjhFCsOxcJdFGcK1GFDGI5d3+WoIEIaYJcnadLKQy/f pM6Pr+wR0NJ0dssfKwq7+apxsgZ+TiHT6XQ/f6Rd9THpSLTA04/EWB03dVyuMMX9wTGA /tsQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=N1SdnoGv; 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 w9-20020a17090a5e0900b00233c8df7e8asi9430360pjf.51.2023.02.28.03.25.17; Tue, 28 Feb 2023 03:25: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=N1SdnoGv; 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 S231503AbjB1LYp (ORCPT + 99 others); Tue, 28 Feb 2023 06:24:45 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43956 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231574AbjB1LYK (ORCPT ); Tue, 28 Feb 2023 06:24:10 -0500 Received: from mail-wr1-x433.google.com (mail-wr1-x433.google.com [IPv6:2a00:1450:4864:20::433]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9703B166CA for ; Tue, 28 Feb 2023 03:23:41 -0800 (PST) Received: by mail-wr1-x433.google.com with SMTP id e37so6856357wri.10 for ; Tue, 28 Feb 2023 03:23:41 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1677583421; 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=N1SdnoGvKYGN2Vws5l0m8bcPfavEc4K0A4F9KTKBWfG/Nb0s8I5k9D6IRUSUVBcyDL uwVkHBmtI91xam5l/NcxmrXmcpBr/tjYMrufe3fRHk33fy9VZ3Zi+T0fcimH5aCrWvnr MztRwhT6t9MqIzmQ2+PkEQxZWf205MP6mVhGJoDOsSLZ/B2VxgYAntMAuDkxd82VDN+m TRENFIe8GgQH1oeZHfsH1oNavvj+GohpMAi77UedP0NHqCNCk04BW1JO+OZ0nkzUf0Bv UB2nE7XYdh240oMkq6wxig6p3QDtMQBBX4VoSzUFbsDWCA44IfPSO0g6dt55Wy96Kixe BfEw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1677583421; 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=yh4U4E0/RJdsc680JcN9Nr68Fp2E3rhBaaSTdNiTiG+UawIfyej4LH9zj2R5F7KlNb 0xgVid7hN57ApvymGB71lKZTzC4fKklSeEV7UOY5ijZ4hyBsh0Bb4KOFqg5XzcF30YB5 nXy7PDssraSMKcwiAM5TL1hxUHcAqwC0rVpwH+NkV0yYYURzohJlTw/SDw39rLoHWNZL KoxVO1eu8WizZiXKJzjbDe0g5XbGjuW15sAZfFyr6GO0f+dPqngA5ox09q96MqGG3K9R lz8dV/4eWX1PjlpMSV36LA39jZBNTh3ZGR3kf53oQ8KoK9BNvCSlqS+lxX/eNa/G/bPH xxtQ== X-Gm-Message-State: AO0yUKUdQlIo+wcvDjs6pySVoDPtzSQtSDevN4RncCO09ix7bp8vqJAC e8zCRFPOmkvCbxX9qaMAhRVKNQ== X-Received: by 2002:a5d:4a0d:0:b0:2c3:f026:9085 with SMTP id m13-20020a5d4a0d000000b002c3f0269085mr1795742wrq.13.1677583421190; Tue, 28 Feb 2023 03:23:41 -0800 (PST) Received: from mai.box.freepro.com ([2a05:6e02:1041:c10:6830:6390:2815:b6a5]) by smtp.gmail.com with ESMTPSA id z5-20020a5d6545000000b002c5501a5803sm9598130wrv.65.2023.02.28.03.23.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 28 Feb 2023 03:23:40 -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 v4 17/19] thermal/tegra: Do not enable the thermal zone, it is already enabled Date: Tue, 28 Feb 2023 12:22:36 +0100 Message-Id: <20230228112238.2312273-18-daniel.lezcano@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230228112238.2312273-1-daniel.lezcano@linaro.org> References: <20230228112238.2312273-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?1759073827932807198?= X-GMAIL-MSGID: =?utf-8?q?1759073827932807198?= 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 Tue Feb 28 11:22:37 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Lezcano X-Patchwork-Id: 62449 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp2958718wrd; Tue, 28 Feb 2023 03:33:58 -0800 (PST) X-Google-Smtp-Source: AK7set8UG+Kd1VYFO2CB0seSYxjXbjvxH1Q7xjNcOgg7hCfjeajn0UZbH/2D1oI1XqXmp+nckiRe X-Received: by 2002:a05:6402:54:b0:4ac:c562:bf7d with SMTP id f20-20020a056402005400b004acc562bf7dmr2900966edu.2.1677584038692; Tue, 28 Feb 2023 03:33:58 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1677584038; cv=none; d=google.com; s=arc-20160816; b=jpN8wIbP9tSHJMLGpl0aysfK7BkLf/hmmsp14vv9kcVMFhcJhBfb2MwW8H9IJOZpfV 0nZlinaMNjEAUZ/Ks/l/AFXjkCpm492YwRweuxDxdtXY2CQRPlLN27RnEURFFzY0cDDc 8E9a8A5pv7tzetij1hPfRyPRX5V9EO6GuOKANYde0UOCHALY6fni87L/uSlPJ/t6p0YG imQdp98XsSeWylRzXPbtd0ELuNxVJ/wf6LFVuzZEU9hFB2HgBuoSDjrdc8umy4uxKHqu onGzfxtd6oANjcZ/wKyywJNSPS33IPpCOu0RNpHrRTsMVKC2PAYy6FJzDj2tyLhVyBiw vCHA== 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=RbQDA39duckRU6RZau37yn7+mF4CD67upgt1k1QYANLv5EiMulcGL5+0NtzONCHGaP lG6F8QAlOnAYy6dzZb88E3mHV1hL2zK6xGYKfCibfU3+BUVLohGtNmJl/j1uj9YnPQtN +sisbjgBUWRa2k5AUidaA3fnzN4H82hdvBhVKAZTLG/OOXSG4dvwecoGfdTbCXut5tjp sKyR89FpXuPNaQtLojM1LiuxJ6d2iqXccm+0QDP/7evUR3idpk95oWy6fwbuDEpGorgc mBdyqb8TSjsNutSfYsQRIqQY0soxeefloT/sRQDsg0hiAjohVcXa+J0rG837bu+i9A9n dNlg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=SauDXJNk; 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 a9-20020a50ff09000000b004ad6d76c2e2si10684201edu.190.2023.02.28.03.33.30; Tue, 28 Feb 2023 03:33: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=SauDXJNk; 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 S231646AbjB1LZO (ORCPT + 99 others); Tue, 28 Feb 2023 06:25:14 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43406 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229600AbjB1LYV (ORCPT ); Tue, 28 Feb 2023 06:24:21 -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 8F0222E821 for ; Tue, 28 Feb 2023 03:23:48 -0800 (PST) Received: by mail-wr1-x430.google.com with SMTP id e37so6856384wri.10 for ; Tue, 28 Feb 2023 03:23:48 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1677583422; 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=SauDXJNkgfwQ1ggwYxd3HcJ5q2YHnt2xK5twAXslHbZRS9MM/k74NroFLzymffLQUg /8Qo+sDoEPUr1cSGopMkHV3jf8uF4DS6dqFujIxwlA8wzFqlH4j/oBWz2vvSMQ3I3H+1 HBdWJlW1shUTK/+vTRiVKqlNYiL4iqNmuARgw3QYABI3N26BEUtlFSfTQoZTtckw3F+I HEe0axve0k3LS4JYeh9NfoN7qd9Ml3FjmJBG4gHNagPr33+DlbXBFWUf+9bPM4h46vaQ 6O039a1e6OZLPfxDNhYDltwXd81IWKEHJCatF56nZixI8AIWl8WznaGgK4jZHB5F8UDh n3nA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1677583422; 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=aNR3QuNtxd5Yb+HO8NtiVsrNs2mvwUBNLuotemHBAK1WdnjZtflIXN1r1yjeXzKU6L 3RTnQ9aPnX+Ov5HySjnYIVmmMBDmde0569msErStAwQpfq9Usl7AWI5tJ/eTfxnWnexj 3bmXpKakFtNKiJzPevuNmLLst8zfVlf1BvjWCFF94vQo4OqPMQJyAQFDWjoL6WKjgfmS f8aI5kJjLf5SDH2BzvxWz18QIuntqbcUyLfSWBr/D82AGJC7uWsS+nbvJWL/9tDQK/i7 f5OsIYZ0Iosgv6Kuj1NR51kIUR3CsARrn8+UsbB0+Cnt3lCOI0h8izebx/IxQaBoyHiS PUHg== X-Gm-Message-State: AO0yUKVvZsMRGecVS2gt2q9b3N/EpfclODg5t0u8Tgk+k7LUQ1apQuqz ZfRRsMUXnXt/G8BxRq/FrIgGWw== X-Received: by 2002:a5d:5651:0:b0:2cc:459b:8bc8 with SMTP id j17-20020a5d5651000000b002cc459b8bc8mr1651726wrw.6.1677583422037; Tue, 28 Feb 2023 03:23:42 -0800 (PST) Received: from mai.box.freepro.com ([2a05:6e02:1041:c10:6830:6390:2815:b6a5]) by smtp.gmail.com with ESMTPSA id z5-20020a5d6545000000b002c5501a5803sm9598130wrv.65.2023.02.28.03.23.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 28 Feb 2023 03:23:41 -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 v4 18/19] thermal/drivers/acerhdf: Make interval setting only at module load time Date: Tue, 28 Feb 2023 12:22:37 +0100 Message-Id: <20230228112238.2312273-19-daniel.lezcano@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230228112238.2312273-1-daniel.lezcano@linaro.org> References: <20230228112238.2312273-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?1759074361184213097?= X-GMAIL-MSGID: =?utf-8?q?1759074361184213097?= 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 Tue Feb 28 11:22:38 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Lezcano X-Patchwork-Id: 62448 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp2956207wrd; Tue, 28 Feb 2023 03:27:58 -0800 (PST) X-Google-Smtp-Source: AK7set9yEhkfx7MlQQwcRn9ttvcu5enPE+gIe3AILQLJF0u1qVLGcFsWdR5L14pRYJbMArKMO2kE X-Received: by 2002:a17:90b:4b04:b0:229:649a:9a05 with SMTP id lx4-20020a17090b4b0400b00229649a9a05mr3038971pjb.11.1677583677852; Tue, 28 Feb 2023 03:27:57 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1677583677; cv=none; d=google.com; s=arc-20160816; b=h/VR33bl+WBmxlDiKE6Gc2WX/Pu6i/Oz3gl9/9EjpJ1mbx/TZchmIoXkYzb/0V1Gum Fcdywaf89drLh5ahJc5FxBJdMs8aToOeDpd0ydhNTZW48DrGDcjaBq1yRco6FY1pgRWt OQob/OeSBLv6E7RFxELgpA6dE2ofdBlc6b3z2Sv1z2k1/N+z0NV5vDEqkhzooIVXoIwf FOsHToUEC42QQUUFkqT0cCRk659/j4XP8D9cEm+4cifXOf0nIdEdUjMIXtpX2c737RjY I+u5PFD2m0Qs5ay4h6I7ebYjlmr39nciE8YeKwcnVDyosHSEIYsRelwiA4HRmMAqorPH vYIQ== 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=h/Kx1zD4IZrWH+ZET2u9mMbTF0PJVHMkvTDFFor3pWot+BG++JMxJDtcwz9ZgA+cnE +WeJzlnqC4xEtLi5dBdenWk3zjx6Kj2LRQCQwyuGyulEtU4+tWdi6Tid3Z19nflAncZR Slf6d9JJXKPdeY0ocfeqlmGO342qBzgnTlMdGqEFOMtHx0Tz2qWsFpk344EFS9Sh/DbK sxovFL3c6Fbigbc3CXIv08EgadifFN9nLjpQTqTHqMa1ijnRVjji1nfaLTQnv6iAxBhU XewRrK4t9Kh3sn/ZpxJx8fgoE98z76Zjcs7P+kVhozPWs9sGKQo47JrnoxugvNuPiWmC U8vA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=wmROP6Ay; 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 31-20020a63135f000000b004faeaf65ba0si9364476pgt.800.2023.02.28.03.27.44; Tue, 28 Feb 2023 03:27:57 -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=wmROP6Ay; 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 S231589AbjB1LZE (ORCPT + 99 others); Tue, 28 Feb 2023 06:25:04 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44908 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231586AbjB1LYV (ORCPT ); Tue, 28 Feb 2023 06:24:21 -0500 Received: from mail-wr1-x42d.google.com (mail-wr1-x42d.google.com [IPv6:2a00:1450:4864:20::42d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C0BD022DCD for ; Tue, 28 Feb 2023 03:23:49 -0800 (PST) Received: by mail-wr1-x42d.google.com with SMTP id r18so9357083wrx.1 for ; Tue, 28 Feb 2023 03:23:49 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1677583423; 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=wmROP6AyQSd/5lYDaTnJSUSDXdhXDdPFq6dWXSe77IejOrFttF3d59ytNrebe9bWZD 7G9JvxGcOZeqMgxxKGV78ZWGnj3tWGl5eHJp0AcWtzyoe3qEdHGW6yN3eVOEs00SdMev 1IXw0FeceljNrRpqTqA3WpAol75g+SiSq2TGI265YAs4USbddI0OBs2VZkN0y81+KQJC ag97hXN8hnVLeuV73nCVIlwWV1IJwsGLMorSpUivU/zZYBwtgadH+UPfQvbdnBvBiY/w nya+SL8nqgkYI8Z5tKMI0O3fcuoPiU9Z1AjYwN6Z44iSGmqj9rWQctC5xBwHXC8HoLf1 f5Tw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1677583423; 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=2FUBuTBEz1Nr1VGDS+5j+Jhj+xq4NrQWR0d1MjEYOQWKITzjp56M7ofsluIhJEqCMG qJS5idgsnq28qJ2/LNqs7p/ofQu5mY7vnIUGr1d96zGe4gwslaQtNc7nnGxEVlKCdSnI KOn5O7ewCZgYHRNzJf7cWXZhO6kCCcevCTM8oHRagFJo7O1t22Ny3wOsz8BwyY5ZdxYb dObclxENDALT7Sql8R/PWO/VTxqPszczAS5ulUwtaWfRkz+DA0hAEJIMu0qE3zXHs+uY Spti4H6NyMYLbdYDOTFMEGJf/dYV04phyFDH0fWkmEq2yd4O9NRW3pJfhJlBUlreOF1a gSqg== X-Gm-Message-State: AO0yUKXpMBpzoTuD2a+EkPwDpQ1jWPZLVnOHCF0rNNdVMqsj2Z1YNckS dpyH67tMdz5XiqDhLjC2A7Kjvw== X-Received: by 2002:a5d:63c6:0:b0:2c9:e34e:7d0 with SMTP id c6-20020a5d63c6000000b002c9e34e07d0mr2243434wrw.3.1677583422966; Tue, 28 Feb 2023 03:23:42 -0800 (PST) Received: from mai.box.freepro.com ([2a05:6e02:1041:c10:6830:6390:2815:b6a5]) by smtp.gmail.com with ESMTPSA id z5-20020a5d6545000000b002c5501a5803sm9598130wrv.65.2023.02.28.03.23.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 28 Feb 2023 03:23: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, Peter Kaestle , Hans de Goede , Mark Gross , platform-driver-x86@vger.kernel.org (open list:ACER ASPIRE ONE TEMPERATURE AND FAN DRIVER) Subject: [PATCH v4 19/19] thermal/drivers/acerhdf: Remove pointless governor test Date: Tue, 28 Feb 2023 12:22:38 +0100 Message-Id: <20230228112238.2312273-20-daniel.lezcano@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230228112238.2312273-1-daniel.lezcano@linaro.org> References: <20230228112238.2312273-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?1759073982396909664?= X-GMAIL-MSGID: =?utf-8?q?1759073982396909664?= 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; }