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 D3E6FC64ED6 for ; Sun, 19 Feb 2023 18:23:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231243AbjBSSXi (ORCPT ); Sun, 19 Feb 2023 13:23:38 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41162 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231233AbjBSSXe (ORCPT ); Sun, 19 Feb 2023 13:23:34 -0500 Received: from mail-lf1-x12a.google.com (mail-lf1-x12a.google.com [IPv6:2a00:1450:4864:20::12a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5AEAAEFA6 for ; Sun, 19 Feb 2023 10:23:25 -0800 (PST) Received: by mail-lf1-x12a.google.com with SMTP id w28so1482853lfu.1 for ; Sun, 19 Feb 2023 10:23:25 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ragnatech-se.20210112.gappssmtp.com; s=20210112; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:message-id:subject:cc:to:from:date:from:to :cc:subject:date:message-id:reply-to; bh=ofJSqx7zRI6EorpfBbQAKk970rJXU8Lshyo67tpjsLQ=; b=xeLeOsLmY3pe81rt3ga3i6n8lIyX45qvBgDtiyY75SxtAK1EKPLEQqXyq1T1gn61Wl SJ+jJyXEslG9XZjq5SVgthjWH+AkiKzov8phzcdx8q8u1wRZD2dSS62mDgcNoDTrJRRD BGXSBGZw4wh0B5bjOFtjGs/lNfSujOK7nRSeBI4eM8qRDyPK0u0ttERgJvfd64NhAQOL +GauQSBtxQusXIDfvDLOsegFBY0WgTEt2z+DzKpl1W3Bv4DRhTSQjKczNAPttxdfVqBM dTEYKt9a7qM1Hh42++i5n3Yf5pFVYUGxLDKZ4ol99hiPHSnPg3ZKrbHR9P3kkfouE6yn kpWQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=ofJSqx7zRI6EorpfBbQAKk970rJXU8Lshyo67tpjsLQ=; b=NY/Wlv8hG4caPKTpKrRRyvn9N7atwHUqVxgcbepHf1YVLOZuP1J3C2jhRr94SJGe49 rJ9Df5K4bD/x6O444CMasDmvVDnVdoRVVdbz67WAQvPaE1RXyO3BT+cjHgUn5PJUPA+A 82geIeSJ6BZ32FOF8VRu40wFvlsqjF4Z7o8eH3CSM31WPIC/vRz1mUxpq24pvif1Y/wM xTV95eVPHr81+pYU8gxIGKI5EvCmXKtaIvcx4kkjA/DR1+oQVbJpoWqHxecHCLwi3RoN jfbFjL+USRFUbhqV9Fn/Do2PrfIVL+gmg4B3lW1V66sElYuHDH3/ScsJBddFqzFSCS4g 6USQ== X-Gm-Message-State: AO0yUKWlANf+LCqOlIGiGC1gS7SqQiz3IKIWMvoYB3aGY5gp/7sQ13gP 5hvbulT3Y1Vsa+Usg00cj8GXzg== X-Google-Smtp-Source: AK7set+YZZSclvxF42ryv90+XULHABPVIVIEdoKcZJbE3Ao4Z3FCGIUuBB+mT3TOxDnV55f/X2PI5w== X-Received: by 2002:ac2:4c21:0:b0:4dc:4c1d:eec1 with SMTP id u1-20020ac24c21000000b004dc4c1deec1mr483829lfq.46.1676831003077; Sun, 19 Feb 2023 10:23:23 -0800 (PST) Received: from localhost (h-46-59-89-207.A463.priv.bahnhof.se. [46.59.89.207]) by smtp.gmail.com with ESMTPSA id b26-20020ac2563a000000b004db51852e6csm56694lff.246.2023.02.19.10.23.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 19 Feb 2023 10:23:22 -0800 (PST) Date: Sun, 19 Feb 2023 19:23:21 +0100 From: Niklas =?utf-8?Q?S=C3=B6derlund?= 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 , 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 , Balsam CHIHI , 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" Subject: Re: [PATCH v1 01/17] thermal/core: Add a thermal zone 'devdata' accessor Message-ID: References: <20230219143657.241542-1-daniel.lezcano@linaro.org> <20230219143657.241542-2-daniel.lezcano@linaro.org> <4d8f1e68-8d2c-b70f-69c7-a1137ac4b05f@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <4d8f1e68-8d2c-b70f-69c7-a1137ac4b05f@linaro.org> Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org On 2023-02-19 18:07:36 +0100, Daniel Lezcano wrote: > On 19/02/2023 16:07, Niklas Söderlund wrote: > > Hi Daniel, > > > > Thanks for your work. > > > > On 2023-02-19 15:36:41 +0100, 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/rcar_gen3_thermal.c | 4 ++-- > > > drivers/thermal/rcar_thermal.c | 3 +-- > > > > For R-Car, > > > > Reviewed-by: Niklas Söderlund > > > > ... > > > > > > > diff --git a/include/linux/thermal.h b/include/linux/thermal.h > > > index 2bb4bf33f4f3..724b95662da9 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_get_data(struct thermal_zone_device *tzd); > > > + > > > > bikeshedding: > > > > Would it make sens to name this thermal_zone_device_get_priv_data(), > > thermal_zone_device_get_priv() or something like that? To make it more > > explicitly when reading the driver code this fetches the drivers private > > data, and not some data belonging to the zone itself. > > In the headers files, there are more occurrences with _name_priv(): > > # _name_priv() > git grep priv include/linux/ | grep "priv(" | grep -v get | wc -l > 52 > > # _name_private() > git grep priv include/linux/ | grep "private(" | grep -v get | wc -l > 33 > > # _name_get_private() > git grep priv include/linux/ | grep "private(" | grep get | wc -l > 12 > > # _name_get_priv() > git grep priv include/linux/ | grep "priv(" | grep get | wc -l > 4 > > > What about thermal_zone_device_priv() ? Looks good to me. > > > > > > > -- > Linaro.org │ Open source software for ARM SoCs > > Follow Linaro: Facebook | > Twitter | > Blog > -- Kind Regards, Niklas Söderlund