From patchwork Tue Feb 21 18:07:02 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Lezcano X-Patchwork-Id: 13148283 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 B5D0EC678DB for ; Tue, 21 Feb 2023 18:09:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231473AbjBUSJE (ORCPT ); Tue, 21 Feb 2023 13:09:04 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59608 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232319AbjBUSIg (ORCPT ); Tue, 21 Feb 2023 13:08:36 -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 C864746A8 for ; Tue, 21 Feb 2023 10:07:59 -0800 (PST) Received: by mail-wr1-x433.google.com with SMTP id r7so5251708wrz.6 for ; Tue, 21 Feb 2023 10:07:59 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; 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=5ezEc6A/YkeOfDdMrb507e1ylDVbi788yh7gKtVJ50s=; b=nAitZ675oyeRfothdhY716BmMpAt/3sxWyhpoECXSKhzfcK2UvMI+8cnRaM09PSRj4 2cUkKVuLGiH0L8ma/SmOPafi0wBzPojeOa98H7dAtvD3budEf5axe0rB+y3+bdsTYs0z YeNWicN8lH4I6d3FW5pd5YjUyqVCnLXP9lpIQMFCt61o1bDRrydXmvufHJcgLNFxMqzA aIxoSFLfzQCX4KfIQR2Jfk/8uoN7RKR2AE0adv1kQeU2cZkjHNl7PBzoQ4SvEGws9FSJ wQuz80m72XXyzlJSh77Vdo6ZMEn3PNILXcCruw53RJRlA41kHy1FYqJU7Ih5NGZRWpoB TJLg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; 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=5ezEc6A/YkeOfDdMrb507e1ylDVbi788yh7gKtVJ50s=; b=vDWWCMzhsQH8sX+N0yYp4VDASlb6gYV4xM55OXx5HTrwE0/i0w6VyTk7+c4SaH8EZl WvSj6p46CAusdWJu1WrfUg9WV042K+Zh3IjGHol09WKhfI5zy+z6mApDYn6u0IytrAY+ r9YQr12RDHbK75llFnE3Yikr7WVF5Ku+VxFqG/zNbunT4TnVz4MdT3gsjeaJFF9OiSCs lVinws5gdrO4M6T9yPt5WYVfnKB6wKHm+6Nj2rEwi8nCJ70H9m4rz0Pd7Z1Hut9jH/jN JvAU44Obab3hNeEmX2/j/LNwO5Jn4klbhCNuXnBW5196tpI97q3WGWjCA8xycRsuKsoa Gjlw== X-Gm-Message-State: AO0yUKXW4/fvNhJJX/eyB5H/OVJs/fX5Z288yXwgqCJKlCQfYMnof6Yh 0WOaV0i98yeKwwcKNLAMNtcXgw== X-Google-Smtp-Source: AK7set/soV5ezaxbxiC0k21pKqAsgpfGS7RZe3hvloq6lIpLm1euGOya3NW90+JTLW4f9jqnRMIn9w== X-Received: by 2002:a5d:5945:0:b0:2c5:5c00:b917 with SMTP id e5-20020a5d5945000000b002c55c00b917mr3293354wri.0.1677002878283; Tue, 21 Feb 2023 10:07:58 -0800 (PST) Received: from mai.box.freepro.com ([2a05:6e02:1041:c10:1e9:315c:bb40:e382]) by smtp.gmail.com with ESMTPSA id c128-20020a1c3586000000b003e21558ee9dsm5107815wma.2.2023.02.21.10.07.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 21 Feb 2023 10:07:57 -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 , Jean Delvare , Amit Kucheria , Zhang Rui , linux-hwmon@vger.kernel.org (open list:HARDWARE MONITORING) Subject: [PATCH v2 08/16] thermal: Add a thermal zone id accessor Date: Tue, 21 Feb 2023 19:07:02 +0100 Message-Id: <20230221180710.2781027-9-daniel.lezcano@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230221180710.2781027-1-daniel.lezcano@linaro.org> References: <20230221180710.2781027-1-daniel.lezcano@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-hwmon@vger.kernel.org In order to get the thermal zone id but without directly accessing the thermal zone device structure, add an accessor. Use the accessor from the hwmon_scmi No functional change intented. Signed-off-by: Daniel Lezcano Acked-by: Guenter Roeck Acked-by: Rafael J. Wysocki --- drivers/hwmon/scmi-hwmon.c | 2 +- drivers/thermal/thermal_core.c | 6 ++++++ include/linux/thermal.h | 2 ++ 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/drivers/hwmon/scmi-hwmon.c b/drivers/hwmon/scmi-hwmon.c index 046ac157749d..6681478ea41c 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_get_id(tzd)); } return 0; diff --git a/drivers/thermal/thermal_core.c b/drivers/thermal/thermal_core.c index 9fa12147fead..73b7a060f768 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); +int thermal_zone_device_get_id(struct thermal_zone_device *tzd) +{ + return tzd->id; +} +EXPORT_SYMBOL_GPL(thermal_zone_device_get_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 7dbb5712434c..321aa3c71f58 100644 --- a/include/linux/thermal.h +++ b/include/linux/thermal.h @@ -367,6 +367,8 @@ thermal_zone_device_register_with_trips(const char *, struct thermal_trip *, int void *thermal_zone_device_priv(struct thermal_zone_device *tzd); +int thermal_zone_device_get_id(struct thermal_zone_device *tzd); + int thermal_zone_bind_cooling_device(struct thermal_zone_device *, int, struct thermal_cooling_device *, unsigned long, unsigned long,