From mboxrd@z Thu Jan 1 00:00:00 1970 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 4183FC64ED6 for ; Sun, 19 Feb 2023 17:07:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231138AbjBSRHr (ORCPT ); Sun, 19 Feb 2023 12:07:47 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43868 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230209AbjBSRHp (ORCPT ); Sun, 19 Feb 2023 12:07:45 -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 3D97F126EA for ; Sun, 19 Feb 2023 09:07:43 -0800 (PST) Received: by mail-wm1-x32c.google.com with SMTP id j41-20020a05600c1c2900b003e1e754657aso713805wms.2 for ; Sun, 19 Feb 2023 09:07:43 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=6KxNFzRgs/0vUNP2uZncHosd2KHSBPqfvZ7J555gKlI=; b=TqDmxeCqgjX/SCT0zS+PF6AfR/9dCo1FpS5mnG9j01BFC1+VD4Q7ubhlQfXhrmE083 0WYN1f0bIbo21XRTWifbJwcYTr2X1HSPBzZM87/35szohbgwJWtwst3ZB/Uyku+BZ1GT fdjOk5jg86fdGhZQivHhMX1dUtyEtd0zEYACMvag1QVVQXdQ7R5c7aIxveMhWwkz75hR 8chbsS6v67DndN4W12l84nsUdBhyOjwMW1hwOqBmE6eyqzuIM8WMLxP7V5DN4UAzCAZX vqLCw8gjWfj/gz3br1kNLOjZCJGA+sAEn8LyDTAn692JW1B2MJS3YSi60TU4KXtLsjqR Lx/g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=6KxNFzRgs/0vUNP2uZncHosd2KHSBPqfvZ7J555gKlI=; b=s1rbk/s4VDvc4i5vjrOSX+NGMfpmQvAUmYluLoGHK9fV41i5FNwWnMMHl5mIb+rWjM P2G+Yywm3hmCuFJA5T5ki52HwUb+SYYprwBCcLms5uFKlxMr5YzU1OGA4f3ZnUW8/dfw Xm+J3yS9xtglLfkfwkh3bIcSmKTEmwBU0CTJMiyXMe4jdxa0PjI+GXugDoU1RtBB5GHx cXHA5MnrXLx30anEarSR8TB+zeGC08LwBefW7/rh2Khsp1Qz1mHEMmL1ZuXG0CWlPZl5 kMyyIUAUxvjmT4UJKLklr0Fcuu/jqC/9WnBEKoDrESSvv/vc4gwUnwqXRorPj+QrNAwG rq4w== X-Gm-Message-State: AO0yUKWwB8ZNwRMUmQkPhG97jrmbIJJw7Lefe7PNwhwTJH2K1m4+lpqf TBiRPmzIpSaYKZIqcSI3bSt5hQ== X-Google-Smtp-Source: AK7set83h6bWbda4YvPCa+ZBjfPRZ/9UdfQCE1sEN23gN10rONUKibwH121WMa44Jr/M6QZ46vWaSg== X-Received: by 2002:a05:600c:198e:b0:3e2:1f00:bff7 with SMTP id t14-20020a05600c198e00b003e21f00bff7mr7646707wmq.12.1676826461464; Sun, 19 Feb 2023 09:07:41 -0800 (PST) Received: from ?IPV6:2a05:6e02:1041:c10:6f43:b92:7670:463? ([2a05:6e02:1041:c10:6f43:b92:7670:463]) by smtp.googlemail.com with ESMTPSA id n27-20020a05600c3b9b00b003e206cc7237sm15155832wms.24.2023.02.19.09.07.36 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sun, 19 Feb 2023 09:07:40 -0800 (PST) Message-ID: <4d8f1e68-8d2c-b70f-69c7-a1137ac4b05f@linaro.org> Date: Sun, 19 Feb 2023 18:07:36 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.7.1 Subject: Re: [PATCH v1 01/17] thermal/core: Add a thermal zone 'devdata' accessor Content-Language: en-US To: =?UTF-8?Q?Niklas_S=c3=b6derlund?= 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" References: <20230219143657.241542-1-daniel.lezcano@linaro.org> <20230219143657.241542-2-daniel.lezcano@linaro.org> From: Daniel Lezcano In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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() ? -- Linaro.org │ Open source software for ARM SoCs Follow Linaro: Facebook | Twitter | Blog