From mboxrd@z Thu Jan 1 00:00:00 1970 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 04433C3DA59 for ; Tue, 16 Jul 2024 13:08:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Transfer-Encoding: Content-Type:In-Reply-To:From:References:Cc:To:Subject:MIME-Version:Date: Message-ID:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=HJ8+1Dls9gHXZmTlH8ttAZgOqS31ryuk4YadVHCctP4=; b=vdNu+os7y3s3p7lPGpQmsAOceQ P+61snUktMefKBcxdMPAevGRNjf+HNwvdv3kY2QxRWeqKsg2T37xTQglCyRzII316lDyudJ12JjGM H2NqZP2px/Myp6fO4XARwQDzzJiQlWSUUuX2iQ9eKy9d865A8V6Zl9K7XECsY7R80vir7T2Ar5p+N PNoTYRU8fl8Es8x/39b02CCXAwr4O7oF9HnSb5ln+cVncSz0VACnUChvNaIQRuPnQrzK9ToqgvYt9 YYh7U6RU0PgbnYmFyr7c6beY5gl6C4iqG7GvWpbFmXlAYNGYmG6XlfMZSanVEMGXJVwW+5+jRglV3 vPMAxIcg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sThuW-0000000AVFu-3MXY; Tue, 16 Jul 2024 13:08:05 +0000 Received: from mail-wm1-x330.google.com ([2a00:1450:4864:20::330]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sThuB-0000000AVBE-3ypW for linux-arm-kernel@lists.infradead.org; Tue, 16 Jul 2024 13:07:46 +0000 Received: by mail-wm1-x330.google.com with SMTP id 5b1f17b1804b1-4266f535e82so37178045e9.1 for ; Tue, 16 Jul 2024 06:07:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1721135261; x=1721740061; darn=lists.infradead.org; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=HJ8+1Dls9gHXZmTlH8ttAZgOqS31ryuk4YadVHCctP4=; b=uTeCslSxoU1aahBZSWjFWk6l5rGIRfx/UufYgPFhikUayhLjX92Ls0O+rYF1y/nKk/ kDiK48pky9Mn/U7OYhs5mEf89emdLxZpZD6mMGy2X+00W/kOJQ4xQNKuYf/uR7h7YreZ mONU+RW3+qilGYw0K9IDo5mgvrlimrUhgmQcumeR6+xUJGs6TpMnSf51oNTxA1o1z+q/ 9LR82VOwQuGJ4tKnsO8vfc1ns1heZBvC43otX+beLTaox81Cx4WXxn92owBq09koByo5 8WNlTpYVKX9RtNmZ5vXLhPR+fAIiwWRP+FChhY8vakhgM/zqGFD7uTtYkHnljl3V36At U55g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1721135261; x=1721740061; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=HJ8+1Dls9gHXZmTlH8ttAZgOqS31ryuk4YadVHCctP4=; b=hPonpcwVrDApVqwiO3C9Z99BMK8WODCOmNCw0bzW4FY/91UovvOJu8hAKEFS7o5ETK zGcdiDzFXkSJLWgCusAFuobGnFTAvGFsrBii/NO4lt3YHQMWYr57di8JlaRjSDWvoWWo 8XJtpEZrGPt8J6m4m2dPeikKWNascMiVeVRwbxk5S+7dCkETH7VGIxWdfj2LPTHrsHLm u4rCTM84lTyyzxnU+/OhzIpqtAt6bF4jN7TX+3wdYOkz9gSldoK1kJiOnsFLAoAA9OMs AmxxRQejfsl0Gm3UNRgw2j0ShyIYAA1IS0qeJdLS8cNu51nA2o1ZykrHimpEGxS+jfJZ ORSA== X-Forwarded-Encrypted: i=1; AJvYcCXnIBxoe440JgJywAY4G/mE11O759wCY81gRQmoHetVQXQ0OOFn6DhdUhY3CgNUpQ/R+woHwAal55hPOhPh4BniFygJJjKx6sfUNd5atRepF2BqWiU= X-Gm-Message-State: AOJu0YxP3ORDdfX82ypndIT2u1iTgE9MgfpYrD59+bJbnp21YdHqtB/P lCcWikN5QVRxG125JF9m4oO2hSc6k12hEtNqXbveIGwt19iZxvGTWL6Dv6GlHE8= X-Google-Smtp-Source: AGHT+IF/mJWDmCM/RTFS4KnpUoj8ACXVsq97TxQdcyfYwcgw8wActI/cmP5PqGmH/ftOaErkRt/3KA== X-Received: by 2002:a5d:64ab:0:b0:367:9625:bd06 with SMTP id ffacd0b85a97d-3682633a6aamr1634036f8f.42.1721135261033; Tue, 16 Jul 2024 06:07:41 -0700 (PDT) Received: from ?IPV6:2a05:6e02:1041:c10:5abd:5899:c977:d551? ([2a05:6e02:1041:c10:5abd:5899:c977:d551]) by smtp.googlemail.com with ESMTPSA id 5b1f17b1804b1-427a5e8144dsm127215135e9.11.2024.07.16.06.07.40 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 16 Jul 2024 06:07:40 -0700 (PDT) Message-ID: <046303cd-54d0-42f0-990d-2d18a9de1f3e@linaro.org> Date: Tue, 16 Jul 2024 15:07:39 +0200 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v3 2/2] thermal: sti: depend on THERMAL_OF subsystem To: Raphael Gallais-Pou , "Rafael J. Wysocki" , Zhang Rui , Lukasz Luba , Maxime Coquelin , Alexandre Torgue , Patrice Chotard , Rob Herring , Krzysztof Kozlowski , Conor Dooley Cc: linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org, devicetree@vger.kernel.org References: <20240714-thermal-v3-0-88f2489ef7d5@gmail.com> <20240714-thermal-v3-2-88f2489ef7d5@gmail.com> Content-Language: en-US From: Daniel Lezcano In-Reply-To: <20240714-thermal-v3-2-88f2489ef7d5@gmail.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240716_060744_192115_10543DE0 X-CRM114-Status: GOOD ( 26.40 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On 14/07/2024 13:42, Raphael Gallais-Pou wrote: > Switch to thermal_of_zone to handle thermal-zones. Replace > thermal_zone_device_register() by devm_thermal_of_zone_register() and > remove ops st_thermal_get_trip_type, st_thermal_get_trip_temp. > > Signed-off-by: Raphael Gallais-Pou > --- > Changes in v3: > - Fix unmet dependency when building with ARM64 compiler > https://lore.kernel.org/lkml/202406270605.qodaWd4n-lkp@intel.com/ > - Remove no more used polling_delay variable detected by kernel robot > https://lore.kernel.org/lkml/202406270530.kN5wIswi-lkp@intel.com/ > Changes in v2: > - Remove unused struct thermal_trip trip > --- > drivers/thermal/st/Kconfig | 2 ++ > drivers/thermal/st/st_thermal.c | 28 ++++++++++------------------ > 2 files changed, 12 insertions(+), 18 deletions(-) > > diff --git a/drivers/thermal/st/Kconfig b/drivers/thermal/st/Kconfig > index ecbdf4ef00f4..95a634709a99 100644 > --- a/drivers/thermal/st/Kconfig > +++ b/drivers/thermal/st/Kconfig > @@ -5,12 +5,14 @@ > > config ST_THERMAL > tristate "Thermal sensors on STMicroelectronics STi series of SoCs" > + depends on THERMAL_OF > help > Support for thermal sensors on STMicroelectronics STi series of SoCs. > > config ST_THERMAL_MEMMAP > select ST_THERMAL > tristate "STi series memory mapped access based thermal sensors" > + depends on THERMAL_OF Given the changes below it is possible to move this dependency in the upper Kconfig AFAICS: diff --git a/drivers/thermal/Kconfig b/drivers/thermal/Kconfig index ed16897584b4..b6b916e7e294 100644 --- a/drivers/thermal/Kconfig +++ b/drivers/thermal/Kconfig @@ -429,7 +429,7 @@ source "drivers/thermal/samsung/Kconfig" endmenu menu "STMicroelectronics thermal drivers" -depends on (ARCH_STI || ARCH_STM32) && OF +depends on (ARCH_STI || ARCH_STM32) && THERMAL_OF source "drivers/thermal/st/Kconfig" endmenu THERMAL_OF depends on OF > config STM32_THERMAL > tristate "Thermal framework support on STMicroelectronics STM32 series of SoCs" > diff --git a/drivers/thermal/st/st_thermal.c b/drivers/thermal/st/st_thermal.c > index 5f33543a3a54..23597819ce84 100644 > --- a/drivers/thermal/st/st_thermal.c > +++ b/drivers/thermal/st/st_thermal.c > @@ -12,6 +12,7 @@ > #include > > #include "st_thermal.h" > +#include "../thermal_hwmon.h" > > /* The Thermal Framework expects millidegrees */ > #define mcelsius(temp) ((temp) * 1000) > @@ -135,8 +136,6 @@ static struct thermal_zone_device_ops st_tz_ops = { > .get_temp = st_thermal_get_temp, > }; > > -static struct thermal_trip trip; > - > int st_thermal_register(struct platform_device *pdev, > const struct of_device_id *st_thermal_of_match) > { > @@ -145,7 +144,6 @@ int st_thermal_register(struct platform_device *pdev, > struct device_node *np = dev->of_node; > const struct of_device_id *match; > > - int polling_delay; > int ret; > > if (!np) { > @@ -197,29 +195,22 @@ int st_thermal_register(struct platform_device *pdev, > if (ret) > goto sensor_off; > > - polling_delay = sensor->ops->register_enable_irq ? 0 : 1000; > - > - trip.temperature = sensor->cdata->crit_temp; > - trip.type = THERMAL_TRIP_CRITICAL; > - > sensor->thermal_dev = > - thermal_zone_device_register_with_trips(dev_name(dev), &trip, 1, sensor, > - &st_tz_ops, NULL, 0, polling_delay); > + devm_thermal_of_zone_register(dev, 0, sensor, &st_tz_ops); > if (IS_ERR(sensor->thermal_dev)) { > - dev_err(dev, "failed to register thermal zone device\n"); > + dev_err(dev, "failed to register thermal of zone\n"); > ret = PTR_ERR(sensor->thermal_dev); > goto sensor_off; > } > - ret = thermal_zone_device_enable(sensor->thermal_dev); > - if (ret) > - goto tzd_unregister; > > platform_set_drvdata(pdev, sensor); > > - return 0; > + /* > + * devm_thermal_of_zone_register() doesn't enable hwmon by default > + * Enable it here > + */ > + return devm_thermal_add_hwmon_sysfs(dev, sensor->thermal_dev); Other drivers ignore the return code or just print a message in case it is not zero. Otherwise, that makes the thermal driver to fail because of hwmon. > -tzd_unregister: > - thermal_zone_device_unregister(sensor->thermal_dev); > sensor_off: > st_thermal_sensor_off(sensor); > > @@ -232,7 +223,8 @@ void st_thermal_unregister(struct platform_device *pdev) > struct st_thermal_sensor *sensor = platform_get_drvdata(pdev); > > st_thermal_sensor_off(sensor); > - thermal_zone_device_unregister(sensor->thermal_dev); > + thermal_remove_hwmon_sysfs(sensor->thermal_dev); > + devm_thermal_of_zone_unregister(sensor->dev, sensor->thermal_dev); > } > EXPORT_SYMBOL_GPL(st_thermal_unregister); > > -- Linaro.org │ Open source software for ARM SoCs Follow Linaro: Facebook | Twitter | Blog "