Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5C822C6FD18 for ; Mon, 20 Feb 2023 10:34:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230150AbjBTKez (ORCPT ); Mon, 20 Feb 2023 05:34:55 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54862 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230076AbjBTKep (ORCPT ); Mon, 20 Feb 2023 05:34:45 -0500 Received: from mail-ed1-x530.google.com (mail-ed1-x530.google.com [IPv6:2a00:1450:4864:20::530]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 951AD18ABD for ; Mon, 20 Feb 2023 02:34:43 -0800 (PST) Received: by mail-ed1-x530.google.com with SMTP id eq27so7414645edb.5 for ; Mon, 20 Feb 2023 02:34:43 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20210112.gappssmtp.com; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=hgK+pzbgsRct7v66y7EeW9btlFAMDnGp7qA3LyQeueA=; b=ShobCGbFij7tUT+5/n7fnEr53C2/0jxVBdNu1dHkJSG6s4KAO6LFFnRrmCnoBOmXJy 0eCMJfuG7fVPmFNODgUHbM40obtDqhrtM9XX2Juj5n1FM0jJup7zwFDOwvN80x/f+G+5 Yl68/2isRSQpRcyoGePuKEaWY3YuN6aJC01OUipDJhlG1zqPwve0pSSkBASZ7sIT08TB TCAIkz7ilnchLiNBIRyP4IMso6UIuFCLo1fgD8Z/3NAwzdjQwuahaJfkwOMpIpIT3Fv8 n2kqIPCEHS3nHF8puaQ1L/g8SEMkTntwpiPPdL/eZ9au/HMGX8ITkAyqrnnvOcCi5ePm d8iw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=hgK+pzbgsRct7v66y7EeW9btlFAMDnGp7qA3LyQeueA=; b=yAKVgleJVZlInJFRnlxGZLQjK9S4SBlRsWn66Mu970EUwNNzdrFaCx5oPOFxorr5Al G/cajhzhmdihfIOIy8WmpH7lukQlgRum7xaEEx8WURMiUNCMbDdBcpGHkumY6SWUzGDt JuyWxZmHWlsKc6x4N9EVkyCCwmufcyzFq3OU/tfIe1DqvI2+pYwtznofb+PYutYVj1hy yKzPaj0fvy9vcTTMuEyUzFPSgkcF12V/adJZ5Z08GqVkd6Gol0JrISBXAyJhOxauxOCe TU4i4N4BEgz8fzdl/UlqInpcqdJbnfSlxT4AQ7RaPkRZuhY35tfKOm6uSpt+NmMciKVs 0HrA== X-Gm-Message-State: AO0yUKU2cbMv1ivtjkkYpyAAQSFsGXmzPVNs0bb9Zg5qRwBrAzWoTFbV KKxPkjN/iuVJOJEQ8XhXvqxt3YmZGslx5Xu8//X/uQ== X-Google-Smtp-Source: AK7set9kOckIby41ckXXZd5uq/qQcyFAoci84eoqUFhxhM0EZ569btim73i+tZ6vLNTWM1FX3dsvXtMctilu1VP6iHI= X-Received: by 2002:a17:906:fcad:b0:8b1:3d0d:5333 with SMTP id qw13-20020a170906fcad00b008b13d0d5333mr3882123ejb.13.1676889282013; Mon, 20 Feb 2023 02:34:42 -0800 (PST) MIME-Version: 1.0 References: <20230219143657.241542-1-daniel.lezcano@linaro.org> <20230219143657.241542-2-daniel.lezcano@linaro.org> In-Reply-To: <20230219143657.241542-2-daniel.lezcano@linaro.org> From: Balsam CHIHI Date: Mon, 20 Feb 2023 11:34:05 +0100 Message-ID: Subject: Re: [PATCH v1 01/17] thermal/core: Add a thermal zone 'devdata' accessor To: Daniel Lezcano Cc: rafael@kernel.org, linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, Zhang Rui , Len Brown , Damien Le Moal , Shawn Guo , Sascha Hauer , Pengutronix Kernel Team , Fabio Estevam , NXP Linux Team , Jean Delvare , Guenter Roeck , 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 , Ido Schimmel , Petr Machata , Gregory Greenman , Kalle Valo , Sebastian Reichel , Liam Girdwood , Mark Brown , Miquel Raynal , Amit Kucheria , Florian Fainelli , Broadcom internal kernel review list , Ray Jui , Scott Branden , Markus Mayer , Support Opensource , Andy Gross , Bjorn Andersson , Konrad Dybcio , Thara Gopinath , =?UTF-8?Q?Niklas_S=C3=B6derlund?= , Heiko Stuebner , Bartlomiej Zolnierkiewicz , Krzysztof Kozlowski , Alim Akhtar , Orson Zhai , Baolin Wang , Chunyan Zhang , Vasily Khoruzhick , Yangtao Li , Thierry Reding , Jonathan Hunter , Talel Shenhar , Eduardo Valentin , Keerthy , Kunihiko Hayashi , Masami Hiramatsu , Matthias Brugger , AngeloGioacchino Del Regno , Stefan Wahren , Neil Armstrong , ye xingchen , Zheng Yongjun , Tim Zimmermann , Yang Li , Srinivas Pandruvada , Ricardo Neri , Jiang Jian , Daniel Golle , Randy Dunlap , Mikko Perttunen , "open list:ACPI THERMAL DRIVER" , "open list:LIBATA SUBSYSTEM (Serial and Parallel ATA drivers)" , "moderated list:ARM/FREESCALE IMX / MXC ARM ARCHITECTURE" , "open list:HARDWARE MONITORING" , "open list:IIO SUBSYSTEM AND DRIVERS" , "open list:ARM/Allwinner sunXi SoC support" , "open list:INPUT (KEYBOARD, MOUSE, JOYSTICK, TOUCHSCREEN)..." , "open list:CXGB4 ETHERNET DRIVER (CXGB4)" , "open list:INTEL WIRELESS WIFI LINK (iwlwifi)" , "moderated list:BROADCOM BCM2711/BCM2835 ARM ARCHITECTURE" , "open list:ARM/QUALCOMM SUPPORT" , "open list:RENESAS R-CAR THERMAL DRIVERS" , "open list:ARM/Rockchip SoC support" , "open list:SAMSUNG THERMAL DRIVER" , "open list:TEGRA ARCHITECTURE SUPPORT" , "open list:TI BANDGAP AND THERMAL DRIVER" , "moderated list:ARM/Mediatek SoC support" Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org On Sun, Feb 19, 2023 at 3:37 PM Daniel Lezcano wrote: > > 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 > --- [...] > drivers/thermal/mediatek/lvts_thermal.c | 4 ++-- [...] > diff --git a/drivers/thermal/mediatek/lvts_thermal.c b/drivers/thermal/mediatek/lvts_thermal.c > index 84ba65a27acf..86d280187c83 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_get_data(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_get_data(tz); > void __iomem *base = lvts_sensor->base; > u32 raw_low = lvts_temp_to_raw(low); > u32 raw_high = lvts_temp_to_raw(high); for MediaTek LVTS : Reviewed-by: Balsam CHIHI