Received: by 2002:a05:6358:11c7:b0:104:8066:f915 with SMTP id i7csp2302819rwl; Thu, 13 Apr 2023 04:48:51 -0700 (PDT) X-Google-Smtp-Source: AKy350bt5GCTuKrZ+5QMhNuCmuTNmGZ12B8Z7Vh+wv3/K88NCyjDl7XiTMMzbKOi8EYVwBi+drgo X-Received: by 2002:a17:90b:1d12:b0:246:d15d:4937 with SMTP id on18-20020a17090b1d1200b00246d15d4937mr1674247pjb.36.1681386531621; Thu, 13 Apr 2023 04:48:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1681386531; cv=none; d=google.com; s=arc-20160816; b=N+4W13f70ijSn3Wn1EL5ucG3a2c5xYJwU9XOZW9f8IyCuwGE3+hZvrt4+EvYFLKcdt uVuy5sqkA8qTe/UlR2aggpOvUO7KFa2zUuE6jpwXZy2vR6TciC3+syloATp3gUd5+DpR GghRTButXbG42TMVV3f/CY40FHyr6Bwa8ZLiI1mFq3mnYgizv3tFBfEKChst85hlF8zi RWaSDc5mOmEboQ+GE3ZQ47CiLTog+lO0oJSd4xe88n7QCHjHmukf5fxHIwmZVenNu1i1 /yBDr+YnshZzf8Z+T+dnxZwYv/JF2EP2Gs1WtDzG7XS0eWUDffJbDuwFapKAEdz7MUXE Lf1w== 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=+VZk/Xuf/BecNwwdsFB/838vQVCvaje2TQnFopmd7IM=; b=xaTl+noCk3HmIiJQvJrq25rihKKQJPMQbIha9gMRlj5who8xSe4RoucofJ1fltyiuo d6p5z+MxtXbEuEoEBSzahKc/bJ9IWS+vM4afWoLQ6M8DeG1cDjKI3JGaoZUQrJ8jaQiR gxoIToOcOo1nRt1Tkvxp1yfeeGSexw4rQN/+9yahg6Phx7yUhvea7/wDjm5eN3kAHfb4 G3PMR45ol6+XGrKRTourA7K8TqvOSvN/XCARY/+tO5eNCkdQU9MvCnWfbuFD2EzIwHgH sDZ3bi9gOH14FTd3A44i9LEq6t9MYLoRZc/UiZHnuS9AzvdroTJLeEJvH/eOzKbLHAjE s6yA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=gESRsna9; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id f6-20020a17090a700600b00246a6cecff8si1801685pjk.44.2023.04.13.04.48.38; Thu, 13 Apr 2023 04:48:51 -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; dkim=pass header.i=@linaro.org header.s=google header.b=gESRsna9; 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 S230382AbjDMLrG (ORCPT + 99 others); Thu, 13 Apr 2023 07:47:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46424 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229699AbjDMLrA (ORCPT ); Thu, 13 Apr 2023 07:47:00 -0400 Received: from mail-wm1-x32d.google.com (mail-wm1-x32d.google.com [IPv6:2a00:1450:4864:20::32d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2A2079EC6 for ; Thu, 13 Apr 2023 04:46:57 -0700 (PDT) Received: by mail-wm1-x32d.google.com with SMTP id he11-20020a05600c540b00b003ef6d684102so6158408wmb.3 for ; Thu, 13 Apr 2023 04:46:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1681386415; x=1683978415; 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=+VZk/Xuf/BecNwwdsFB/838vQVCvaje2TQnFopmd7IM=; b=gESRsna9XWyk/KwQX0XbxJviRAtaQKcmohShrQT1B9JAbemafdpAFiajo6uaJgXmVQ kxxRmTB5tyvFwBhkyuwwnM80F1Y38VkgRr+JbOVFoEvedQtsdX6INun5wSS3kQREpXG8 CDuc/Zb6XtHVaGQumBYbJU7BeRv13BB3l8IbswZmSLih6IuGtu4oogjkww4bO+CLOpas TevDdIeetR3MSi20N0cErhAwGW+xYJm/orRNAkT40mj14IPZ7XqRGqQ3WPA+n97OgG9g 3iCuE/n8cT0j95rF/bu4Ma49lJtzpcOqae/Yi9oVnlk22k3/sh3Fb4K3dy6hmc6awB3L 07Pw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1681386415; x=1683978415; 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=+VZk/Xuf/BecNwwdsFB/838vQVCvaje2TQnFopmd7IM=; b=MwrZPqm0HOddcGD34u5EyHOBAMJpu1I+6ayHAMkr7fd5n7l0P/sOxV6agr6NovS0dQ jM6TM81cumUu0lRJbrDGKBvuh/yZT7YFIg8G4/+CqRfe9DIEGsvH13yfVz/CJjNn945Z 3Of9jAEoPjepwESCgA1KZe4ASwO3jRjM06obv9z6Wau2mtz2Fj2o2UL9I62jxUJ0X+oW SejS16Mi1F8ouvBPNL4sAD42ajCX0zonc8E2P1TJhnGw3+bcW/k02/stXH0ZkCzP9T0g zNoN+ghELGZreczYOYks8jmVByKudL8P9c5bcnas2iAH/NFvJBzVejsSOcS+SrbTY/Ly tYkQ== X-Gm-Message-State: AAQBX9dGkHVk+lJdfaaLTHPVyOoiw3696sfIGLNKXJ8hgpzyoLQjb3Sk 3RcGfPEKabp0+Pdyn2l+V7JebQ== X-Received: by 2002:a1c:f302:0:b0:3ed:b048:73f4 with SMTP id q2-20020a1cf302000000b003edb04873f4mr1626368wmq.5.1681386415664; Thu, 13 Apr 2023 04:46:55 -0700 (PDT) Received: from mai.box.freepro.com ([2a05:6e02:1041:c10:6418:c878:b0e:d11b]) by smtp.gmail.com with ESMTPSA id iz11-20020a05600c554b00b003f09aaf547asm6730590wmb.1.2023.04.13.04.46.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 13 Apr 2023 04:46:55 -0700 (PDT) From: Daniel Lezcano To: daniel.lezcano@linaro.org, rafael@kernel.org Cc: rui.zhang@intel.com, linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org, Len Brown , linux-acpi@vger.kernel.org (open list:ACPI THERMAL DRIVER) Subject: [PATCH v3 3/6] thermal/drivers/acpi: Use thermal_zone_device() Date: Thu, 13 Apr 2023 13:46:44 +0200 Message-Id: <20230413114647.3878792-4-daniel.lezcano@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230413114647.3878792-1-daniel.lezcano@linaro.org> References: <20230413114647.3878792-1-daniel.lezcano@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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,URIBL_BLOCKED autolearn=unavailable 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 In order to get the device associated with the thermal zone, let's use the wrapper thermal_zone_device() instead of accessing directly the content of the thermal zone device structure. Signed-off-by: Daniel Lezcano --- drivers/acpi/thermal.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/drivers/acpi/thermal.c b/drivers/acpi/thermal.c index 255efa73ed70..5763db4528b8 100644 --- a/drivers/acpi/thermal.c +++ b/drivers/acpi/thermal.c @@ -789,6 +789,7 @@ static struct thermal_zone_device_ops acpi_thermal_zone_ops = { static int acpi_thermal_register_thermal_zone(struct acpi_thermal *tz) { + struct device *tzdev; int trips = 0; int result; acpi_status status; @@ -820,12 +821,14 @@ static int acpi_thermal_register_thermal_zone(struct acpi_thermal *tz) if (IS_ERR(tz->thermal_zone)) return -ENODEV; + tzdev = thermal_zone_device(tz->thermal_zone); + result = sysfs_create_link(&tz->device->dev.kobj, - &tz->thermal_zone->device.kobj, "thermal_zone"); + &tzdev->kobj, "thermal_zone"); if (result) goto unregister_tzd; - result = sysfs_create_link(&tz->thermal_zone->device.kobj, + result = sysfs_create_link(&tzdev->kobj, &tz->device->dev.kobj, "device"); if (result) goto remove_tz_link; @@ -849,7 +852,7 @@ static int acpi_thermal_register_thermal_zone(struct acpi_thermal *tz) acpi_bus_detach: acpi_bus_detach_private_data(tz->device->handle); remove_dev_link: - sysfs_remove_link(&tz->thermal_zone->device.kobj, "device"); + sysfs_remove_link(&tzdev->kobj, "device"); remove_tz_link: sysfs_remove_link(&tz->device->dev.kobj, "thermal_zone"); unregister_tzd: @@ -860,8 +863,10 @@ static int acpi_thermal_register_thermal_zone(struct acpi_thermal *tz) static void acpi_thermal_unregister_thermal_zone(struct acpi_thermal *tz) { + struct device *tzdev = thermal_zone_device(tz->thermal_zone); + sysfs_remove_link(&tz->device->dev.kobj, "thermal_zone"); - sysfs_remove_link(&tz->thermal_zone->device.kobj, "device"); + sysfs_remove_link(&tzdev->kobj, "device"); thermal_zone_device_unregister(tz->thermal_zone); tz->thermal_zone = NULL; acpi_bus_detach_private_data(tz->device->handle); -- 2.34.1