Received: by 2002:a05:6358:11c7:b0:104:8066:f915 with SMTP id i7csp1386264rwl; Wed, 12 Apr 2023 12:01:18 -0700 (PDT) X-Google-Smtp-Source: AKy350Zy3C9IvHyubBnbfUQI2iz6prs4+POMbqD8a3gWT8mYebmaq3OmORI53zetGd27NZvHhhRS X-Received: by 2002:a17:906:90d4:b0:94a:7696:4188 with SMTP id v20-20020a17090690d400b0094a76964188mr6343082ejw.74.1681326077960; Wed, 12 Apr 2023 12:01:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1681326077; cv=none; d=google.com; s=arc-20160816; b=ekZO5MropGtZlxWnQQjhj3oOOAZxKy0xRhsDQf4Vlj7S0dCh+dBsiBmFdLjFUa7nkH t2VBD3vdwfeu6k+vy+Dx7RbwBh+X8wrhtpYKMae3w7QVw1+aQY33QOVM+Or6jnsZJ+Ei F9By6r0m8bqCCdpuw7jvUVD4+KEX0OHctrtYtODocMp4H76EOUSL2jk7Ear6ctUuQvpF LkUfkZ/b36BZ7XrQ55A1MJBEiMAhgC5J/G4Fp0hv5FnlpHrgyTTCMIc3GVA0Ut18bGQH ozLsFE/35HGvkZpOUUsFvhUx4RDEb4m4lqfJVvWVWqfEi2on26JCtK9T57mEyw9zsACe FqFA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version; bh=TdiQbQHcxAYdcLurrbkMJ7WUwv+v1n/b9IKTMO9EI1w=; b=TGtu4famrhXGrd/LEYQo9sEh9VsdOUUtL2Bo3vKDtd8XlWsEKgIHEmmo+kKOy8UDTQ K6dwimJF405IBuuDj3EIFm2CeG8CyPiw8g+pS+0yS2s2vfTavbx8unoeBrLIuLlvfOcL i3R6yVvEFmrMYtrFid8p9mNY11phCCJcYtG0ACet0TDANu0aYPHCdlqO58KoowaOf6Wg TxrOzGYqsvPSr6VXVBE+2weX9bfj1zcnt4gP8v1MKxve6c1ZgtnunWWcNH7w8DvHfpG3 j1PxqXG9L6dddcue3a2Fcq1vaZ6pAqNqSQxttLKnFSwnZbqBdNcXYXyjxWK51174NH6g kUOA== ARC-Authentication-Results: i=1; mx.google.com; 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=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id di3-20020a170906730300b0093b6dc73d08si5901270ejc.780.2023.04.12.12.00.49; Wed, 12 Apr 2023 12:01:17 -0700 (PDT) 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; 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=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229784AbjDLS5v convert rfc822-to-8bit (ORCPT + 99 others); Wed, 12 Apr 2023 14:57:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38202 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229620AbjDLS5t (ORCPT ); Wed, 12 Apr 2023 14:57:49 -0400 Received: from mail-ej1-f53.google.com (mail-ej1-f53.google.com [209.85.218.53]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C4B6E7280; Wed, 12 Apr 2023 11:57:20 -0700 (PDT) Received: by mail-ej1-f53.google.com with SMTP id j17so21716519ejs.5; Wed, 12 Apr 2023 11:57:20 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1681325815; x=1683917815; h=content-transfer-encoding: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=62gwaY7vFs4oo/QchLorKjyrNub9mjhwDQpkTj5sUS0=; b=UCzo1bYSPEkym7F4SFRqqLo9F7kBkICU77Fub0xZ4tpFoev9wkV6J+QLzsYjyOkeLt GMZSapiLqKYYqL50JSw7D0LzyXgpvzbkm/rHOH/9k9la+nV9y3CWpv8qD4v8LjYK3sYw T4uwWJqx9jXb12jlGGsvG22ffpw7suNW682juhQI4+nPMTDguZJlx+Vpl2uEzYLAKwxl iR8EaZ6P3W1m4ws958R3WN98ZlXBwqa6vWZfXs7LaZsJ6v2Ot4XSF/tN6A2wvoPGAJTt 9PdLHpdp5pvYkHdrx7035fByAJXybzYrgIW1+Y/S10275LeqTwQ0wFY1rnW5SqL8EsWr DORg== X-Gm-Message-State: AAQBX9fQYjZM3wJ+lY7IFSMvO/wQpGBGMYVPye3MZEjY/KwQHHMO2jm2 4OpY4Wd2sKgVgyI4yYILfHo0VexbdeleVxDFIo4= X-Received: by 2002:a17:907:3f16:b0:8b1:3298:c587 with SMTP id hq22-20020a1709073f1600b008b13298c587mr22529ejc.2.1681325807375; Wed, 12 Apr 2023 11:56:47 -0700 (PDT) MIME-Version: 1.0 References: <20230410205305.1649678-1-daniel.lezcano@linaro.org> <20230410205305.1649678-3-daniel.lezcano@linaro.org> In-Reply-To: From: "Rafael J. Wysocki" Date: Wed, 12 Apr 2023 20:56:36 +0200 Message-ID: Subject: Re: [PATCH v2 2/7] thermal/core: Encapsulate tz->device field To: Daniel Lezcano Cc: "Rafael J. Wysocki" , rui.zhang@intel.com, linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org, Amit Kucheria Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8BIT X-Spam-Status: No, score=-1.4 required=5.0 tests=BAYES_00, FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM,HEADER_FROM_DIFFERENT_DOMAINS, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE, SPF_PASS,URIBL_BLOCKED autolearn=no 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 On Tue, Apr 11, 2023 at 10:20 PM Daniel Lezcano wrote: > > On 11/04/2023 20:19, Rafael J. Wysocki wrote: > > On Mon, Apr 10, 2023 at 10:53 PM Daniel Lezcano > > wrote: > >> > >> There are still some drivers needing to play with the thermal zone > >> device internals. That is not the best but until we can figure out if > >> the information is really needed, let's encapsulate the field used in > >> the thermal zone device structure, so we can move forward relocating > >> the thermal zone device structure definition in the thermal framework > >> private headers. > > > > I'm not really sure why this is needed, so please explain. > > Some drivers are accessing tz->device, that implies they have the > knowledge of the thermal_zone_device structure but we want to > self-encapsulate this structure and reduce the scope of the structure to > the thermal core only. > > The ACPI and the Menlon drivers are the drivers accessing tz->device. > > By adding this wrapper, these drivers do no longer need the thermal zone > device structure definition. So you want to move the definition of struct thermal_zone_device from include/linux/thermal.h into a local header in drivers/thermal/ and make it entirely local to the thermal core IIUC. Which would be forcing the callers of thermal_zone_device_register_with_trips() (and friends) to use pointers to a data type that's not completely defined (from their perspective), but they would still have access to the trips array passed to that function. That doesn't sound particularly consistent and what's the purpose of doing it? > >> Signed-off-by: Daniel Lezcano > >> --- > >> drivers/thermal/thermal_core.c | 6 ++++++ > >> include/linux/thermal.h | 1 + > >> 2 files changed, 7 insertions(+) > >> > >> diff --git a/drivers/thermal/thermal_core.c b/drivers/thermal/thermal_core.c > >> index c5025aca22ee..842f678c1c3e 100644 > >> --- a/drivers/thermal/thermal_core.c > >> +++ b/drivers/thermal/thermal_core.c > >> @@ -1398,6 +1398,12 @@ int thermal_zone_device_id(struct thermal_zone_device *tzd) > >> } > >> EXPORT_SYMBOL_GPL(thermal_zone_device_id); > >> > >> +struct device *thermal_zone_device(struct thermal_zone_device *tzd) > >> +{ > >> + return &tzd->device; > >> +} > >> +EXPORT_SYMBOL_GPL(thermal_zone_device); > >> + > >> /** > >> * 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 82ddb32f9876..87837094d549 100644 > >> --- a/include/linux/thermal.h > >> +++ b/include/linux/thermal.h > >> @@ -313,6 +313,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); > >> +struct device *thermal_zone_device(struct thermal_zone_device *tzd); > >> > >> int thermal_zone_bind_cooling_device(struct thermal_zone_device *, int, > >> struct thermal_cooling_device *, > >> -- > >> 2.34.1 > >> > > -- > Linaro.org │ Open source software for ARM SoCs > > Follow Linaro: Facebook | > Twitter | > Blog >