From patchwork Sun Feb 26 22:53:49 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Lezcano X-Patchwork-Id: 61670 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp2130969wrd; Sun, 26 Feb 2023 14:55:45 -0800 (PST) X-Google-Smtp-Source: AK7set/xqNapg1ZgWGwqF9sKPWrN7fsNenmArhYdQTpNRhYqvuDWNQFYjCevuqV7irwRuzzEPSc5 X-Received: by 2002:a17:90b:148a:b0:233:6d76:27b7 with SMTP id js10-20020a17090b148a00b002336d7627b7mr19625972pjb.3.1677452145062; Sun, 26 Feb 2023 14:55:45 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1677452145; cv=none; d=google.com; s=arc-20160816; b=r+QCNm5hcXtzERrsG2CNLxe4KTd03viurUIuZfxmMraOGnvs/Lc9ZTC2sq9lSO9wJ+ V8GBIacy6F3quMN8TRyoCzUGRtcDZab+awqxitkadyi1ui9NQuBWew9QM9LWqhf9fIRc OtWjbhMdRgDuVaO76PIVAzw1DKp+QGyRJtJH+1OVrQgdbppjvS8m7Sj2QYmNT0odDfSq Db1SDw2g+1GI8/DwbbM1/oTSO6CGM3mv6uqPJkhlZCuC9T7jQeHGO2W29CQ3kA4OmVVL v1Vpc6Fgvh8uYdJoW6hUagzhocxoNQA4qGtp83t5T6JThwgT18cIrYYTvNjrw7poJxZ1 k8qg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=664mQufj36GAinUsmDVRemqvXpqdvf+x4ah+LNp4umE=; b=moiGbpB6fvRmmB1Tjf6YQyJ+Olq5zBO/VlL6sQ9LdioYBPATvNfBATxrh4jvTpGtM7 yrB4zzu2FQobEIrqem3g5C+K5UbOECVn/aMZfJsRS1IPnUphBr4tgf0LtiLr610GGh+e T5P3uwvTx6+GawORVwMR1NhDHnKCXNqGcEvGcm0+XTvE467XbZJgInm5MVi2yXsH4o++ 1Lsi+tvSCfjY5ZM94opZLSbatULCoenICXSO5o6lRC2dlrJXrl6gR5OLI3Aw27nDHSfF A3GqoJ/+0cneLtk30pPqAFe6ARQFLS5Muo514rsJXzF+Kd6yRtvwxz5OS37Ryjm/yFnl eWAQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="Xi1i/CqW"; 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=linaro.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id x4-20020a63fe44000000b004facc8ab172si5667523pgj.846.2023.02.26.14.55.32; Sun, 26 Feb 2023 14:55:45 -0800 (PST) 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; dkim=pass header.i=@linaro.org header.s=google header.b="Xi1i/CqW"; 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=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229679AbjBZWy7 (ORCPT + 99 others); Sun, 26 Feb 2023 17:54:59 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33484 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229690AbjBZWy4 (ORCPT ); Sun, 26 Feb 2023 17:54:56 -0500 Received: from mail-wr1-x436.google.com (mail-wr1-x436.google.com [IPv6:2a00:1450:4864:20::436]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 07B3F126CF for ; Sun, 26 Feb 2023 14:54:45 -0800 (PST) Received: by mail-wr1-x436.google.com with SMTP id v16so1610929wrn.0 for ; Sun, 26 Feb 2023 14:54:44 -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=664mQufj36GAinUsmDVRemqvXpqdvf+x4ah+LNp4umE=; b=Xi1i/CqWZ9XDyFCiLm1jEzGg1dxTPicCiAjJxOkq5GDsATuyvyV8Y7sK4AyK/MKLrt L3/ZuVg5LlKPrXAtcFdgW4DIhU0lqMEugxT76bLJTM1aQ011rQG3mVxbLvjSumaichLn W6RO2XT48xK58xTU+imWZ5EXauLjSjQ0IAQPtJWaGJa6g95u72fF6mMNYRYB8Wp/PQfR iJ00ypajR6u+JlX6p8Phostq3dMYooDvxeqZQ8s7vwMeC7DcAS+j2xBXxV9oC/OHCUSD /Evp9b7ZJDXeG96mUGeeeDJ8A4OfnaQ6B3akTIPxP7y460jcsNAXlM1UuVyYiBR3OX6w /MpA== 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=664mQufj36GAinUsmDVRemqvXpqdvf+x4ah+LNp4umE=; b=5l3c8uW8F3CkWXCWTs5VObnbrU8+o+XrDGqLjf8Z6osYt/er8Uqo7wEE6M9WnHrv9Q aHA8Yx6iAuWB6Rlj54IR+fDn/YSNdM5AWPWf46GX3l2Xy84lePgExpDXC+PfTlt3jLCJ 3Z6XTp1deSOLr2T8AGdpGoZiqjx6NZZGJI+nR6vOZSnAfi27n4jjmcCmTa+g7hYH0GlM SYTJ3O/k/zds1xDf4OY5z+rxMl3dBiTx/cg6k78iHRr+oRyn4XhrVU3njCy+xzfX1iNG iB08kVTy8ucK9t5LIImA9OioKtwOSJuW1gsZ5Q0Rf82EWvTw7oBVbpgWXG2GzujIMaWb 26Uw== X-Gm-Message-State: AO0yUKUdUSJI0+KUus5QOxLybgrFTaXNPzPyfjxjMUhpYY/HO0X3kWLx MFwm5235FNIEJ8yElbC2vcA/Dw== X-Received: by 2002:a5d:4e47:0:b0:2c8:840:26ea with SMTP id r7-20020a5d4e47000000b002c8084026eamr6703396wrt.12.1677452084449; Sun, 26 Feb 2023 14:54:44 -0800 (PST) Received: from mai.box.freepro.com ([2a05:6e02:1041:c10:8baa:6b32:391b:62de]) by smtp.gmail.com with ESMTPSA id d10-20020a05600c3aca00b003eb369abd92sm6138074wms.2.2023.02.26.14.54.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 26 Feb 2023 14:54:44 -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 , Mark Brown , "Rafael J . Wysocki" , Jean Delvare , linux-hwmon@vger.kernel.org (open list:HARDWARE MONITORING) Subject: [PATCH v3 03/20] thermal/core: Use the thermal zone 'devdata' accessor in hwmon located drivers Date: Sun, 26 Feb 2023 23:53:49 +0100 Message-Id: <20230226225406.979703-4-daniel.lezcano@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230226225406.979703-1-daniel.lezcano@linaro.org> References: <20230226225406.979703-1-daniel.lezcano@linaro.org> MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS autolearn=ham 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1758936060240098561?= X-GMAIL-MSGID: =?utf-8?q?1758936060240098561?= 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. Use the devdata accessor introduced in the previous patch. No functional changes intended. Signed-off-by: Daniel Lezcano Acked-by: Guenter Roeck #hwmon Acked-by: Mark Brown Acked-by: Rafael J. Wysocki --- drivers/hwmon/hwmon.c | 4 ++-- drivers/hwmon/pmbus/pmbus_core.c | 2 +- drivers/hwmon/scmi-hwmon.c | 2 +- drivers/hwmon/scpi-hwmon.c | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/hwmon/hwmon.c b/drivers/hwmon/hwmon.c index 33edb5c02f7d..3adf5c3c75ed 100644 --- a/drivers/hwmon/hwmon.c +++ b/drivers/hwmon/hwmon.c @@ -154,7 +154,7 @@ static DEFINE_IDA(hwmon_ida); #ifdef CONFIG_THERMAL_OF static int hwmon_thermal_get_temp(struct thermal_zone_device *tz, int *temp) { - struct hwmon_thermal_data *tdata = tz->devdata; + struct hwmon_thermal_data *tdata = thermal_zone_device_priv(tz); struct hwmon_device *hwdev = to_hwmon_device(tdata->dev); int ret; long t; @@ -171,7 +171,7 @@ static int hwmon_thermal_get_temp(struct thermal_zone_device *tz, int *temp) static int hwmon_thermal_set_trips(struct thermal_zone_device *tz, int low, int high) { - struct hwmon_thermal_data *tdata = tz->devdata; + struct hwmon_thermal_data *tdata = thermal_zone_device_priv(tz); struct hwmon_device *hwdev = to_hwmon_device(tdata->dev); const struct hwmon_chip_info *chip = hwdev->chip; const struct hwmon_channel_info **info = chip->info; diff --git a/drivers/hwmon/pmbus/pmbus_core.c b/drivers/hwmon/pmbus/pmbus_core.c index 95e95783972a..e39a327ac2a1 100644 --- a/drivers/hwmon/pmbus/pmbus_core.c +++ b/drivers/hwmon/pmbus/pmbus_core.c @@ -1272,7 +1272,7 @@ struct pmbus_thermal_data { static int pmbus_thermal_get_temp(struct thermal_zone_device *tz, int *temp) { - struct pmbus_thermal_data *tdata = tz->devdata; + struct pmbus_thermal_data *tdata = thermal_zone_device_priv(tz); struct pmbus_sensor *sensor = tdata->sensor; struct pmbus_data *pmbus_data = tdata->pmbus_data; struct i2c_client *client = to_i2c_client(pmbus_data->dev); diff --git a/drivers/hwmon/scmi-hwmon.c b/drivers/hwmon/scmi-hwmon.c index e192f0c67146..046ac157749d 100644 --- a/drivers/hwmon/scmi-hwmon.c +++ b/drivers/hwmon/scmi-hwmon.c @@ -141,7 +141,7 @@ static int scmi_hwmon_thermal_get_temp(struct thermal_zone_device *tz, { int ret; long value; - struct scmi_thermal_sensor *th_sensor = tz->devdata; + struct scmi_thermal_sensor *th_sensor = thermal_zone_device_priv(tz); ret = scmi_hwmon_read_scaled_value(th_sensor->ph, th_sensor->info, &value); diff --git a/drivers/hwmon/scpi-hwmon.c b/drivers/hwmon/scpi-hwmon.c index 4d75385f7d5e..121e5e9f487f 100644 --- a/drivers/hwmon/scpi-hwmon.c +++ b/drivers/hwmon/scpi-hwmon.c @@ -64,7 +64,7 @@ static void scpi_scale_reading(u64 *value, struct sensor_data *sensor) static int scpi_read_temp(struct thermal_zone_device *tz, int *temp) { - struct scpi_thermal_zone *zone = tz->devdata; + struct scpi_thermal_zone *zone = thermal_zone_device_priv(tz); struct scpi_sensors *scpi_sensors = zone->scpi_sensors; struct scpi_ops *scpi_ops = scpi_sensors->scpi_ops; struct sensor_data *sensor = &scpi_sensors->data[zone->sensor_id];