Message ID | 20231221124825.149141-3-angelogioacchino.delregno@collabora.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel+bounces-8369-ouuuleilei=gmail.com@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:2483:b0:fb:cd0c:d3e with SMTP id q3csp383967dyi; Thu, 21 Dec 2023 04:49:52 -0800 (PST) X-Google-Smtp-Source: AGHT+IFnn7a53dW0LjJaenZsAUkFG9vjrysy2WKO6HuhzGPqLcXOHcgLo3lgDNmjcXjWGl7LG8Qg X-Received: by 2002:a17:902:988e:b0:1d0:6ffd:836a with SMTP id s14-20020a170902988e00b001d06ffd836amr8700466plp.117.1703162992053; Thu, 21 Dec 2023 04:49:52 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1703162992; cv=none; d=google.com; s=arc-20160816; b=UlzSeyrHaqTTLjjnT4DaL41v1qWr0GtrDw3jr3fpzIEJ22aY3PCA4qnMb5qVesnAFB fIHwclnf5ENcfbvPGsgmJI3M/852ZiSfQXs1dlrj1y2mrxsmgEt7vqDd7TnOvn4E0P+g TGYugXnEqCc55OPNIGpPCRnJhRzP1AXQj9zhTgLr3x65HuovcrihET/gESLn6LKbgyJL 3M5iMMZYmRmqUR8FVz93u6vnFYr5A1lNofK1Gi6Et9aa7eIHkLk2Nb5bEksfEawQyJhi qPWfF+utGVN8/H2ZPdW7b/MOEUh4U/4BT0HI9gYy1DMfnLNEP/cP+KKLOOGpg33O4ROZ QpgQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=rWfeW/+yHwTm997tobcEwy6oM33o+llz4q4oJVnR3lw=; fh=tj3vwvS1joPqVAqhm025RI9FzN3aC+9rlGGIIVsXGr8=; b=Y1gSaG3PdB7PConVi5xD6QKqizYKs/6l3KMF7MsQPr+2dnWTxJJAuT+Ct9qGLxQsK6 IhAWNgK6OReqzv+17aGe8NfIq+0jRlkQaI9vplKiYqj22kWmhzrkLsBRfB9HDoD6hTmC 1RljqdTs0X/4pA/jTyUC0GhxquVZvdfXN76EwqRanBQBLIj6n+fE8rHTUl0FWe4ghBUT 7nFu2UX3ganPwfj2u4v2xx9O6bjq5wnh2YvwiXKisLVrt43b++VHg0w5ITqLkLG/WGZA WBYDpnbl8hGbnj51/9D2g6ERE6QcCPCimCk0bx5MVrdu4ybPNeu58k7ThPt5lnMFpAZJ sskA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=Yfc+M27n; spf=pass (google.com: domain of linux-kernel+bounces-8369-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-8369-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=collabora.com Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id bh4-20020a170902a98400b001d0a084b012si1391355plb.558.2023.12.21.04.49.51 for <ouuuleilei@gmail.com> (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 Dec 2023 04:49:52 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-8369-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=Yfc+M27n; spf=pass (google.com: domain of linux-kernel+bounces-8369-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-8369-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=collabora.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 3FBA6288DC1 for <ouuuleilei@gmail.com>; Thu, 21 Dec 2023 12:49:37 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 968F4768E1; Thu, 21 Dec 2023 12:48:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=collabora.com header.i=@collabora.com header.b="Yfc+M27n" X-Original-To: linux-kernel@vger.kernel.org Received: from madrid.collaboradmins.com (madrid.collaboradmins.com [46.235.227.194]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 931E86F602; Thu, 21 Dec 2023 12:48:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=collabora.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=collabora.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1703162913; bh=CUiivx2KB9ULlkM3oFhD369DYLNqb+gWzcXQBgX77n0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Yfc+M27nJq5whbliK87wubRT+rAMmn7gW902W5ZtohEp5acJJgtMJnJ7cjOMEgmJn ZwMXPmkDWHGQz0jl2hKe/E4ViKO8BuF+qqD+26WhFqsFOdXS1gRWEiRVBQVSWhlgwA 0IUiocI1rtAntsh7+IxwtO9gfh3eGl14DX3oer6uyemcrwzbkwo6CvRlnxLXGqSZAT 1kvLm4RbtdxeC1EH3drNQjTZklQsTXnF7b1MuCKrvXSGjyPUjCszbtAHx8cA+Q42J7 DNioY3SS4ZbiW2e4QnY5xewqI04i2nWPBkOWG6U1fJpMAMkenFPISzPcsPH5wmr1jv 5hC6wBSfcyywg== Received: from IcarusMOD.eternityproject.eu (cola.collaboradmins.com [195.201.22.229]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: kholk11) by madrid.collaboradmins.com (Postfix) with ESMTPSA id 514BF3781FFF; Thu, 21 Dec 2023 12:48:33 +0000 (UTC) From: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com> To: daniel.lezcano@linaro.org Cc: rafael@kernel.org, rui.zhang@intel.com, lukasz.luba@arm.com, linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>, kernel@collabora.com Subject: [RFC PATCH 02/26] thermal/of: Migrate to thermal_zone_device_register() Date: Thu, 21 Dec 2023 13:48:01 +0100 Message-ID: <20231221124825.149141-3-angelogioacchino.delregno@collabora.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20231221124825.149141-1-angelogioacchino.delregno@collabora.com> References: <20231221124825.149141-1-angelogioacchino.delregno@collabora.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: <linux-kernel.vger.kernel.org> List-Subscribe: <mailto:linux-kernel+subscribe@vger.kernel.org> List-Unsubscribe: <mailto:linux-kernel+unsubscribe@vger.kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1785895837147889162 X-GMAIL-MSGID: 1785895837147889162 |
Series |
Add thermal zones names and new registration func
|
|
Commit Message
AngeloGioacchino Del Regno
Dec. 21, 2023, 12:48 p.m. UTC
The thermal API has a new thermal_zone_device_register() function which
is deprecating the older thermal_zone_device_register_with_trips() and
thermal_tripless_zone_device_register().
Migrate to the new thermal zone device registration function.
Signed-off-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
---
drivers/thermal/thermal_of.c | 37 ++++++++++++++++--------------------
1 file changed, 16 insertions(+), 21 deletions(-)
Comments
On 21/12/2023 13:48, AngeloGioacchino Del Regno wrote: > The thermal API has a new thermal_zone_device_register() function which > is deprecating the older thermal_zone_device_register_with_trips() and > thermal_tripless_zone_device_register(). > > Migrate to the new thermal zone device registration function. Sounds good to me. May be add "No functional change intended" ? > Signed-off-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com > --- > drivers/thermal/thermal_of.c | 37 ++++++++++++++++-------------------- > 1 file changed, 16 insertions(+), 21 deletions(-) > > diff --git a/drivers/thermal/thermal_of.c b/drivers/thermal/thermal_of.c > index 1e0655b63259..62a903ad649f 100644 > --- a/drivers/thermal/thermal_of.c > +++ b/drivers/thermal/thermal_of.c > @@ -471,16 +471,12 @@ static struct thermal_zone_device *thermal_of_zone_register(struct device_node * > const struct thermal_zone_device_ops *ops) > { > struct thermal_zone_device *tz; > - struct thermal_trip *trips; > - struct thermal_zone_params tzp = {}; > - struct thermal_zone_device_ops *of_ops; > + struct thermal_zone_device_params tzdp; > struct device_node *np; > - int delay, pdelay; > - int ntrips, mask; > int ret; > > - of_ops = kmemdup(ops, sizeof(*ops), GFP_KERNEL); > - if (!of_ops) > + tzdp.ops = kmemdup(ops, sizeof(*ops), GFP_KERNEL); > + if (!tzdp.ops) > return ERR_PTR(-ENOMEM); > > np = of_thermal_zone_find(sensor, id); > @@ -490,30 +486,29 @@ static struct thermal_zone_device *thermal_of_zone_register(struct device_node * > ret = PTR_ERR(np); > goto out_kfree_of_ops; > } > + tzdp.type = np->name; > > - trips = thermal_of_trips_init(np, &ntrips); > - if (IS_ERR(trips)) { > + tzdp.trips = thermal_of_trips_init(np, &tzdp.num_trips); > + if (IS_ERR(tzdp.trips)) { > pr_err("Failed to find trip points for %pOFn id=%d\n", sensor, id); > - ret = PTR_ERR(trips); > + ret = PTR_ERR(tzdp.trips); > goto out_kfree_of_ops; > } > > - ret = thermal_of_monitor_init(np, &delay, &pdelay); > + ret = thermal_of_monitor_init(np, &tzdp.polling_delay, &tzdp.passive_delay); > if (ret) { > pr_err("Failed to initialize monitoring delays from %pOFn\n", np); > goto out_kfree_trips; > } > > - thermal_of_parameters_init(np, &tzp); > + thermal_of_parameters_init(np, &tzdp.tzp); > > - of_ops->bind = thermal_of_bind; > - of_ops->unbind = thermal_of_unbind; > + tzdp.ops->bind = thermal_of_bind; > + tzdp.ops->unbind = thermal_of_unbind; > + tzdp.mask = GENMASK_ULL((tzdp.num_trips) - 1, 0); > + tzdp.devdata = data; > > - mask = GENMASK_ULL((ntrips) - 1, 0); > - > - tz = thermal_zone_device_register_with_trips(np->name, trips, ntrips, > - mask, data, of_ops, &tzp, > - pdelay, delay); > + tz = thermal_zone_device_register(&tzdp); > if (IS_ERR(tz)) { > ret = PTR_ERR(tz); > pr_err("Failed to register thermal zone %pOFn: %d\n", np, ret); > @@ -531,9 +526,9 @@ static struct thermal_zone_device *thermal_of_zone_register(struct device_node * > return tz; > > out_kfree_trips: > - kfree(trips); > + kfree(tzdp.trips); > out_kfree_of_ops: > - kfree(of_ops); > + kfree(tzdp.ops); > > return ERR_PTR(ret); > }
Il 15/01/24 18:17, Daniel Lezcano ha scritto: > On 21/12/2023 13:48, AngeloGioacchino Del Regno wrote: >> The thermal API has a new thermal_zone_device_register() function which >> is deprecating the older thermal_zone_device_register_with_trips() and >> thermal_tripless_zone_device_register(). >> >> Migrate to the new thermal zone device registration function. > > Sounds good to me. > > May be add "No functional change intended" ? > Yeah, makes sense - will add "This patch brings no functional changes". Cheers! >> Signed-off-by: AngeloGioacchino Del Regno >> <angelogioacchino.delregno@collabora.com > --- >> drivers/thermal/thermal_of.c | 37 ++++++++++++++++-------------------- >> 1 file changed, 16 insertions(+), 21 deletions(-) >> >> diff --git a/drivers/thermal/thermal_of.c b/drivers/thermal/thermal_of.c >> index 1e0655b63259..62a903ad649f 100644 >> --- a/drivers/thermal/thermal_of.c >> +++ b/drivers/thermal/thermal_of.c >> @@ -471,16 +471,12 @@ static struct thermal_zone_device >> *thermal_of_zone_register(struct device_node * >> const struct thermal_zone_device_ops *ops) >> { >> struct thermal_zone_device *tz; >> - struct thermal_trip *trips; >> - struct thermal_zone_params tzp = {}; >> - struct thermal_zone_device_ops *of_ops; >> + struct thermal_zone_device_params tzdp; >> struct device_node *np; >> - int delay, pdelay; >> - int ntrips, mask; >> int ret; >> - of_ops = kmemdup(ops, sizeof(*ops), GFP_KERNEL); >> - if (!of_ops) >> + tzdp.ops = kmemdup(ops, sizeof(*ops), GFP_KERNEL); >> + if (!tzdp.ops) >> return ERR_PTR(-ENOMEM); >> np = of_thermal_zone_find(sensor, id); >> @@ -490,30 +486,29 @@ static struct thermal_zone_device >> *thermal_of_zone_register(struct device_node * >> ret = PTR_ERR(np); >> goto out_kfree_of_ops; >> } >> + tzdp.type = np->name; >> - trips = thermal_of_trips_init(np, &ntrips); >> - if (IS_ERR(trips)) { >> + tzdp.trips = thermal_of_trips_init(np, &tzdp.num_trips); >> + if (IS_ERR(tzdp.trips)) { >> pr_err("Failed to find trip points for %pOFn id=%d\n", sensor, id); >> - ret = PTR_ERR(trips); >> + ret = PTR_ERR(tzdp.trips); >> goto out_kfree_of_ops; >> } >> - ret = thermal_of_monitor_init(np, &delay, &pdelay); >> + ret = thermal_of_monitor_init(np, &tzdp.polling_delay, &tzdp.passive_delay); >> if (ret) { >> pr_err("Failed to initialize monitoring delays from %pOFn\n", np); >> goto out_kfree_trips; >> } >> - thermal_of_parameters_init(np, &tzp); >> + thermal_of_parameters_init(np, &tzdp.tzp); >> - of_ops->bind = thermal_of_bind; >> - of_ops->unbind = thermal_of_unbind; >> + tzdp.ops->bind = thermal_of_bind; >> + tzdp.ops->unbind = thermal_of_unbind; >> + tzdp.mask = GENMASK_ULL((tzdp.num_trips) - 1, 0); >> + tzdp.devdata = data; >> - mask = GENMASK_ULL((ntrips) - 1, 0); >> - >> - tz = thermal_zone_device_register_with_trips(np->name, trips, ntrips, >> - mask, data, of_ops, &tzp, >> - pdelay, delay); >> + tz = thermal_zone_device_register(&tzdp); >> if (IS_ERR(tz)) { >> ret = PTR_ERR(tz); >> pr_err("Failed to register thermal zone %pOFn: %d\n", np, ret); >> @@ -531,9 +526,9 @@ static struct thermal_zone_device >> *thermal_of_zone_register(struct device_node * >> return tz; >> out_kfree_trips: >> - kfree(trips); >> + kfree(tzdp.trips); >> out_kfree_of_ops: >> - kfree(of_ops); >> + kfree(tzdp.ops); >> return ERR_PTR(ret); >> } >
diff --git a/drivers/thermal/thermal_of.c b/drivers/thermal/thermal_of.c index 1e0655b63259..62a903ad649f 100644 --- a/drivers/thermal/thermal_of.c +++ b/drivers/thermal/thermal_of.c @@ -471,16 +471,12 @@ static struct thermal_zone_device *thermal_of_zone_register(struct device_node * const struct thermal_zone_device_ops *ops) { struct thermal_zone_device *tz; - struct thermal_trip *trips; - struct thermal_zone_params tzp = {}; - struct thermal_zone_device_ops *of_ops; + struct thermal_zone_device_params tzdp; struct device_node *np; - int delay, pdelay; - int ntrips, mask; int ret; - of_ops = kmemdup(ops, sizeof(*ops), GFP_KERNEL); - if (!of_ops) + tzdp.ops = kmemdup(ops, sizeof(*ops), GFP_KERNEL); + if (!tzdp.ops) return ERR_PTR(-ENOMEM); np = of_thermal_zone_find(sensor, id); @@ -490,30 +486,29 @@ static struct thermal_zone_device *thermal_of_zone_register(struct device_node * ret = PTR_ERR(np); goto out_kfree_of_ops; } + tzdp.type = np->name; - trips = thermal_of_trips_init(np, &ntrips); - if (IS_ERR(trips)) { + tzdp.trips = thermal_of_trips_init(np, &tzdp.num_trips); + if (IS_ERR(tzdp.trips)) { pr_err("Failed to find trip points for %pOFn id=%d\n", sensor, id); - ret = PTR_ERR(trips); + ret = PTR_ERR(tzdp.trips); goto out_kfree_of_ops; } - ret = thermal_of_monitor_init(np, &delay, &pdelay); + ret = thermal_of_monitor_init(np, &tzdp.polling_delay, &tzdp.passive_delay); if (ret) { pr_err("Failed to initialize monitoring delays from %pOFn\n", np); goto out_kfree_trips; } - thermal_of_parameters_init(np, &tzp); + thermal_of_parameters_init(np, &tzdp.tzp); - of_ops->bind = thermal_of_bind; - of_ops->unbind = thermal_of_unbind; + tzdp.ops->bind = thermal_of_bind; + tzdp.ops->unbind = thermal_of_unbind; + tzdp.mask = GENMASK_ULL((tzdp.num_trips) - 1, 0); + tzdp.devdata = data; - mask = GENMASK_ULL((ntrips) - 1, 0); - - tz = thermal_zone_device_register_with_trips(np->name, trips, ntrips, - mask, data, of_ops, &tzp, - pdelay, delay); + tz = thermal_zone_device_register(&tzdp); if (IS_ERR(tz)) { ret = PTR_ERR(tz); pr_err("Failed to register thermal zone %pOFn: %d\n", np, ret); @@ -531,9 +526,9 @@ static struct thermal_zone_device *thermal_of_zone_register(struct device_node * return tz; out_kfree_trips: - kfree(trips); + kfree(tzdp.trips); out_kfree_of_ops: - kfree(of_ops); + kfree(tzdp.ops); return ERR_PTR(ret); }