Received: by 2002:a05:6358:11c7:b0:104:8066:f915 with SMTP id i7csp4603770rwl; Mon, 10 Apr 2023 13:55:04 -0700 (PDT) X-Google-Smtp-Source: AKy350akwPl9ZFPJuaBNaiKGDLMyl1MQ2JqmHXATaL1hFC+a1yEKWLe9dNZMvLHfy1F3Xnl+QJDZ X-Received: by 2002:a17:902:f254:b0:1a1:460e:6a5d with SMTP id j20-20020a170902f25400b001a1460e6a5dmr283040plc.49.1681160104027; Mon, 10 Apr 2023 13:55:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1681160104; cv=none; d=google.com; s=arc-20160816; b=eTQkKuEA7Re0oSEjzYXzP4py9JABCUZeI7bA9WoJ2OaoC1XRBL1hTP0mUi/9OPcgcO 9CBpnmnBOhenK8kNnxU3NLdsBCYAHjWEBdFeOyfwZgGSJPMB2KOhliX0L8gFz4ClogdF 9XQYMeGwmk/SNz4SBoPQfdn3wMv6UlesAmtPczzbHQipGLNsdL2LnQyOgXHK2pHsyWtY fmFccbVtwoP23bJ+zs/Ixh2fynOXJQWThRd4g8HQzTPcr/toj7S/+NxZjJ0bUZ/RcbYL 33xkp8cWH4GOPP174zthjxNmArKXe6cqk5VFr/BbkTJi4SBuOfDSnz3yZ5b5gPEguO9V NtBQ== 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=yXmWvAxmEJZIFwnPEcbm2yR6zWDTyMXIdG0+GkvO0nVNaZk+ibEeg8EuuGCTwi1MKY z5cANdIOA5tctSO2zSnUAS5P/QKPfvFRekCnPgs58fWXLHwE6CEzM34EstqJ9IabRMa3 DBCjtzqw82W6sy+p4B7cwVmSmgBe0aa9wQEEfSSNmA9ojPalHr0ABnLz8HB3sQM2Vgal kPRfCuPZeFBRrk78kXoK2J6UqyqdI00w9oEMPK9CF2XDR+d6go7mfu51Nn9H/fdjv4NW OSRvCZQ4jO1ssAApJcL7ub97Irlddl+1w2epASgKR3ygLYHki9Wv8UFzcIOXbG9Nzjxo XVwA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=FxLeg2sT; 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 m4-20020a1709026bc400b001a24efe1f14si11474717plt.78.2023.04.10.13.54.51; Mon, 10 Apr 2023 13:55:04 -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=FxLeg2sT; 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 S229842AbjDJUxx (ORCPT + 99 others); Mon, 10 Apr 2023 16:53:53 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37518 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229854AbjDJUxo (ORCPT ); Mon, 10 Apr 2023 16:53:44 -0400 Received: from mail-wm1-x329.google.com (mail-wm1-x329.google.com [IPv6:2a00:1450:4864:20::329]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DA5361986 for ; Mon, 10 Apr 2023 13:53:41 -0700 (PDT) Received: by mail-wm1-x329.google.com with SMTP id he11-20020a05600c540b00b003ef6d684102so1272276wmb.3 for ; Mon, 10 Apr 2023 13:53:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1681160020; x=1683752020; 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=FxLeg2sTLVYKL6SFHQGx1FS/5j5eNFIakBq/wmiT/7z73ycZpRJOGN+zVK4lR2cyyC wIBkdAHRc+p5/f9InR3Q7uSswONpKuDg0e55ZkON7Efl7JAQhwTXV5ExsDMUlTHgcatG dox8L7LfD1XszOKEVApR/6iS6vIl3Cs8z15bNYqPgc+vw+YiRfQ7F9jTKm+FyP+sWfcx mdTngflLgrvi+IZw7iCa30iJrdCHbr5luYlbDMiS5P4iOxWhCTu+0v7uzlnXejf3ewPv 8iSNvewqgw+hmJjaW2OnBwLuC97r80s9WDZm5i0QvZt1n4xpcCEzNiaF4ldhzyLPiVa0 BT2A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1681160020; x=1683752020; 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=qUmPu336AzO2s/9oJRUSswuI4+IEQA7gTUu1G1otlx9n7uA92mVON57jOPX97NHGSl GnovMqNwlPaDu+mD/CgqCCzvTKKYRS8xdTSEze3ZvVFfvxancGoPWJm9rAOxIQH+1VcO ddCm7ycVaJXcYOEA1FrvuRlL9V4HQ0vdr19gZdNLKFJX4qa+pFJlkqbez8fD6aU8knNb fvYmQ0GtZie3WVG3YjfTMej/poocO1hPnzUBs4nT6r6eiGDg39gTcapweLQnrFCh2yGt cS4tMmlLcKJiMFe1OrSO9QeWjSuePWIhWIFpbIUIe1/FPfpcabmk1BCelEYiB2eIr9aW 9EPQ== X-Gm-Message-State: AAQBX9ev5kiOzKi9blvw1w0kvWttODrj1X7yrP/4u8icdzdjEfRphdfE jdDs2l81+e3YgEDV/1QHPzorWw== X-Received: by 2002:a05:600c:ce:b0:3f0:39ab:347c with SMTP id u14-20020a05600c00ce00b003f039ab347cmr5368542wmm.23.1681160020330; Mon, 10 Apr 2023 13:53:40 -0700 (PDT) Received: from mai.box.freepro.com ([2a05:6e02:1041:c10:2611:592:3b9e:d2ae]) by smtp.gmail.com with ESMTPSA id e17-20020adffc51000000b002ef2e148d59sm11966789wrs.16.2023.04.10.13.53.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 10 Apr 2023 13:53:40 -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 v2 3/7] thermal/drivers/acpi: Use thermal_zone_device() Date: Mon, 10 Apr 2023 22:53:01 +0200 Message-Id: <20230410205305.1649678-4-daniel.lezcano@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230410205305.1649678-1-daniel.lezcano@linaro.org> References: <20230410205305.1649678-1-daniel.lezcano@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-0.2 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS 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