From patchwork Thu Dec 19 22:21:52 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Lezcano X-Patchwork-Id: 182193 Delivered-To: patch@linaro.org Received: by 2002:a92:d0a:0:0:0:0:0 with SMTP id 10csp1085612iln; Thu, 19 Dec 2019 14:22:10 -0800 (PST) X-Google-Smtp-Source: APXvYqySNbmQCWuFrXi7RuKcCFv8TXCBNQfiNA9smVLpfDGekJIDnj2D4qipeiNdh2i65IinOk2W X-Received: by 2002:a9d:664a:: with SMTP id q10mr4172421otm.99.1576794130147; Thu, 19 Dec 2019 14:22:10 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1576794130; cv=none; d=google.com; s=arc-20160816; b=Th5ikW7METibBFTE5Dz90eH2N/X45KlrXomYIr6TqtH6hB2eLSFSLMJg6fNk9MeGt4 nZMFWHOgQkZTxBZuqkcuYXbTBeXOwBiaNQlgqgbNel5+gTZEGVVfspjAGfW6M8YBSkt1 UOv4uhTBuZ5pBFb3jthnPLH8gg5azjKjCmTel5t0h4VfGukoyD5nFR+iyjMVWZ0P4UoP 6YbE3S9fb42ldgzQzGgsv3u2fMJd2AaLeaF3Wj4tMrid+/v59WSB4UChO+G2NCozUWR4 cXeuii8ZOFc874KazoUJ3Mpm5aq5an8RdcYUbJWQ05Tb5huMwxm9A0f1YQgNbcy1Xjan zRyw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :dkim-signature; bh=+EdJlshrU/x9lwXaiDsMcX871Y/B3IPP2mzwerHvxc0=; b=vP/Qyd4/GOCXfBBqbUkGJWwt3wktd9xDPhPErR8oXnerq6Q4qrM6NXacp9j57WMvWu JBphMgFStmjvpkMZ9d40BDOXf1LL9LG53yx/aW7S4XRPrwGFC5hYGHXiUib0yVvOa0Jo sdKqpmZyuttYy7O4V0g/EtX7MKVgAAAGQ1NUS9Hs84Gu7MgiohUI97JkjaNvB78QAkgI a3WJfDenYvac9VAUW7MqIP1qbpe0erGSKrxthNbyvn+o1pyzyUDFhgsKRXbwl7+LCE3S 2gqcUFWrvkhqxsQO95L6lyr/VsQKgH/tA/n2VI4OHlyjSEfKXrzQ5WDf7AjNKbn2fLee npaQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=OBYavYa3; spf=pass (google.com: best guess record for domain of linux-pm-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-pm-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 19si3952128oiq.128.2019.12.19.14.22.09; Thu, 19 Dec 2019 14:22:10 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-pm-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=OBYavYa3; spf=pass (google.com: best guess record for domain of linux-pm-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-pm-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 S1727333AbfLSWWJ (ORCPT + 10 others); Thu, 19 Dec 2019 17:22:09 -0500 Received: from mail-wm1-f67.google.com ([209.85.128.67]:51086 "EHLO mail-wm1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727129AbfLSWWJ (ORCPT ); Thu, 19 Dec 2019 17:22:09 -0500 Received: by mail-wm1-f67.google.com with SMTP id a5so7019768wmb.0 for ; Thu, 19 Dec 2019 14:22:07 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id; bh=+EdJlshrU/x9lwXaiDsMcX871Y/B3IPP2mzwerHvxc0=; b=OBYavYa3Os4P3wLJqYc7ViOZC9UtFFSArzXrXdPXO3u/P6Fp+c/tZWkJ+54mrV5+Ql PPVp8YdxWqA59qeUMnStPysx3l+AICJR1TLM3NIVcUzMV+FaC6ciUwqpvmNt6AfUCwxW aqGQKQiwTUKWxaSGkfsLgiFxZfgmx5LMAd+Lz9dha6Z8sHPIQ5P8wg6ByWQid7SW+lWd romJPspM/EhgfAVanxijAsqNdPmyOlb15lVhMRxRIVi84XVf52/y7lS7RHyxN+Il3xsh 9c3EqCphIVONRXpK69tJ316L7xSYrE2gXEMpR3WCKHlHVu6sWl0oQzvjwRH7mq1atxw0 rJ5w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=+EdJlshrU/x9lwXaiDsMcX871Y/B3IPP2mzwerHvxc0=; b=GcqKlql08OnsYRGBdbPi5MEu/GjpvcZ1F4VB1KKfi4EkwhtDicru/0IAxqympmm14S HTyzg7rh12UzbhgGvORO7gwGRcxOGlzRKUs1gQGouW6m7+YWidLCuNAWy4MxOIPKtRbD JAW7DFBpVM/XfrxwFTiei8nn4q7xvX6rULjUuqX/0S/XVCCP4+151hGY0HCo7kfSmyU/ Bg/3TVsuKInCGDUUVNMagT0APerSxd1m6NrWVLP2D9FqGqTGkCCuGpgiu3pIUKVM4l2g NGJsX4pcsw13F+0G7gXFX80PK0sazM6HGYdrmXNr5HWcCbPW+mySiohHM5X2PO/92ZXz QSXQ== X-Gm-Message-State: APjAAAWDa86Rz4vMjQmXyIpLgufqkLXtDkfplUtNfaEu8jbFgotalLa0 SD8Paw9ruzFVoaJsPoUVcpksSg== X-Received: by 2002:a7b:c19a:: with SMTP id y26mr12429961wmi.152.1576794126696; Thu, 19 Dec 2019 14:22:06 -0800 (PST) Received: from localhost.localdomain ([2a01:e34:ed2f:f020:58d:4e9b:2833:86c3]) by smtp.gmail.com with ESMTPSA id q68sm8942295wme.14.2019.12.19.14.22.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 19 Dec 2019 14:22:06 -0800 (PST) From: Daniel Lezcano To: daniel.lezcano@linaro.org Cc: Zhang Rui , Eduardo Valentin , Amit Kucheria , linux-pm@vger.kernel.org (open list:THERMAL), linux-kernel@vger.kernel.org (open list) Subject: [PATCH 1/2] thermal/drivers/of-thermal: Make of_thermal_destroy_zones static Date: Thu, 19 Dec 2019 23:21:52 +0100 Message-Id: <20191219222154.16100-1-daniel.lezcano@linaro.org> X-Mailer: git-send-email 2.17.1 Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org The function of_thermal_destroy_zones() is only used internally by the of_parse_thermal_zones() for rollbacking in case of error. Make it static and tag it as an __init function. Signed-off-by: Daniel Lezcano --- drivers/thermal/of-thermal.c | 64 +++++++++++++++++----------------- drivers/thermal/thermal_core.h | 2 -- 2 files changed, 32 insertions(+), 34 deletions(-) -- 2.17.1 diff --git a/drivers/thermal/of-thermal.c b/drivers/thermal/of-thermal.c index dc5093be553e..4333cd5f1073 100644 --- a/drivers/thermal/of-thermal.c +++ b/drivers/thermal/of-thermal.c @@ -998,6 +998,38 @@ static inline void of_thermal_free_zone(struct __thermal_zone *tz) kfree(tz); } +/** + * of_thermal_destroy_zones - remove all zones parsed and allocated resources + * + * Finds all zones parsed and added to the thermal framework and remove them + * from the system, together with their resources. + * + */ +static __init void of_thermal_destroy_zones(void) +{ + struct device_node *np, *child; + + np = of_find_node_by_name(NULL, "thermal-zones"); + if (!np) { + pr_debug("unable to find thermal zones\n"); + return; + } + + for_each_available_child_of_node(np, child) { + struct thermal_zone_device *zone; + + zone = thermal_zone_get_zone_by_name(child->name); + if (IS_ERR(zone)) + continue; + + thermal_zone_device_unregister(zone); + kfree(zone->tzp); + kfree(zone->ops); + of_thermal_free_zone(zone->devdata); + } + of_node_put(np); +} + /** * of_parse_thermal_zones - parse device tree thermal data * @@ -1087,35 +1119,3 @@ int __init of_parse_thermal_zones(void) return -ENOMEM; } - -/** - * of_thermal_destroy_zones - remove all zones parsed and allocated resources - * - * Finds all zones parsed and added to the thermal framework and remove them - * from the system, together with their resources. - * - */ -void of_thermal_destroy_zones(void) -{ - struct device_node *np, *child; - - np = of_find_node_by_name(NULL, "thermal-zones"); - if (!np) { - pr_debug("unable to find thermal zones\n"); - return; - } - - for_each_available_child_of_node(np, child) { - struct thermal_zone_device *zone; - - zone = thermal_zone_get_zone_by_name(child->name); - if (IS_ERR(zone)) - continue; - - thermal_zone_device_unregister(zone); - kfree(zone->tzp); - kfree(zone->ops); - of_thermal_free_zone(zone->devdata); - } - of_node_put(np); -} diff --git a/drivers/thermal/thermal_core.h b/drivers/thermal/thermal_core.h index 207b0cda70da..a9bf00e91d64 100644 --- a/drivers/thermal/thermal_core.h +++ b/drivers/thermal/thermal_core.h @@ -92,14 +92,12 @@ thermal_cooling_device_stats_update(struct thermal_cooling_device *cdev, /* device tree support */ #ifdef CONFIG_THERMAL_OF int of_parse_thermal_zones(void); -void of_thermal_destroy_zones(void); int of_thermal_get_ntrips(struct thermal_zone_device *); bool of_thermal_is_trip_valid(struct thermal_zone_device *, int); const struct thermal_trip * of_thermal_get_trip_points(struct thermal_zone_device *); #else static inline int of_parse_thermal_zones(void) { return 0; } -static inline void of_thermal_destroy_zones(void) { } static inline int of_thermal_get_ntrips(struct thermal_zone_device *tz) { return 0; From patchwork Thu Dec 19 22:21:53 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Lezcano X-Patchwork-Id: 182194 Delivered-To: patch@linaro.org Received: by 2002:a92:d0a:0:0:0:0:0 with SMTP id 10csp1085663iln; Thu, 19 Dec 2019 14:22:12 -0800 (PST) X-Google-Smtp-Source: APXvYqzL3h/9sRBUKJuCnab6JIWFqPmEUG491YbI4Aq4ijNq3cg07e3vQKL5zHktlss0Mgq6pgbX X-Received: by 2002:a9d:69ce:: with SMTP id v14mr11611291oto.248.1576794132464; Thu, 19 Dec 2019 14:22:12 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1576794132; cv=none; d=google.com; s=arc-20160816; b=i6Iu3sUQLZYXwnkGNAQqbg5w8YHsDZsunch//aB0n7DEBQdadproUT+H2k+LlTkFxh ffcL+/T+V4QULfUgy2PbCp2+16KhFeKZwtqXQFhDPe93RojI+mX59ZHCzYi1tr9rPmdj U8japu1v6b+cigECrHwVCxt0VrmS9nsF2RtKQOI+i7afoDGTFYgY8Vi8wuyGsPJkkn5+ fKVEB8MDZ7113anoadd15xpHAube6wAsATEke4RI5XAiidD8780fKEO2fEYABXQ7keNb JZDZQl5H3vWbzxpSW/EDOXhcSNwDrvDq/baeJnf3BSbOB1KuOgc7jmSxjqZHvnRtuLX0 McCg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature; bh=I3Bk5DzXh21LjzbbFrLuxqc/f6SASou8FRBI3bqnTBA=; b=iXt5tGTamjrrM6kyTU7/YsgOrIWNzg+BhN167+A5F7P2JSqomvr8z6Mo9t3iGqBQkR fR8jScQmA4dTnYliTGHB58TG39P7mEM/88uMicyy9eh6Gr07o7Ybl/eibIFIOvInoYBw AfWyE5fVot5aG6c2IqTxD9xJQJULuGJyv4A3/H6rYduqm/8OHNRCgHC1ieIxxYG26bBE J4VjGqwX+EW0m68Qp/LFpkTXvzDVX6MZXFvHMOUckiXERmvC4I8zoDQ24sOhSMRYzzat j4LAAoJCjyAhwFJ4QJvBWXJCj6od6pd0C9SPWuL1RZJQNguld+ShuoZtLoKQF0rWRV3F /PYw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=FLDJjxsE; spf=pass (google.com: best guess record for domain of linux-pm-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-pm-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id h8si4171463otk.183.2019.12.19.14.22.12; Thu, 19 Dec 2019 14:22:12 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-pm-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=FLDJjxsE; spf=pass (google.com: best guess record for domain of linux-pm-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-pm-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 S1727145AbfLSWWL (ORCPT + 10 others); Thu, 19 Dec 2019 17:22:11 -0500 Received: from mail-wm1-f68.google.com ([209.85.128.68]:39645 "EHLO mail-wm1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727328AbfLSWWK (ORCPT ); Thu, 19 Dec 2019 17:22:10 -0500 Received: by mail-wm1-f68.google.com with SMTP id 20so7158207wmj.4 for ; Thu, 19 Dec 2019 14:22:08 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=I3Bk5DzXh21LjzbbFrLuxqc/f6SASou8FRBI3bqnTBA=; b=FLDJjxsEJG/wiTxMggZDT57y8zuOsasoO92JVnZnwWfr/G6LW7JICsrf9WSJtkfaTa OW0dfm6aPcCiFoCMDiRypVa+urEjemUEv4DoeeWLt/c6FdGb6FPZCVr/MtAYABVMI8p5 B3kT/1uFHr5fhtMbjAzq/f7DO8bFMw6R0DrgrG1h0LaG5C77lQh8Ov9UZUVJUF/yLPIQ Tgkl21Nw8hNdAADDCX0GaH9cgc+wBucdPnMkcRNyPdQOXvg/pd65vIVtmOjN/e++ZN0q GXChjAXFKsf6y87HxmQgVASAZqEfGA7XWIe9RvYFXF4iZ1wqe2CdEKGElxen2uM9B51/ 0Z1w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=I3Bk5DzXh21LjzbbFrLuxqc/f6SASou8FRBI3bqnTBA=; b=eya6b4dq8xA0toowhQTQ91Jta/nkTZFomtl/yJ6/ByWvxmWCP45P1psNRNIUfoUfU5 TfLN2Bs6uUep/zCfMuPGh+vvqNJs7Ddr+es+NOu6ZjrAnXMwUx5sG2EQ38MyDHpNfSos 5lpjkDidops+XB63hJMDIMfqHk6RJDxu1u1TW50dIgg5gscvt6fNvw/2uyloiH1J/svJ xNQx3JKkDS4vlDVOesNqJC/UNlMCDlmTbvvF5sl62vAKPvFuzYXTiGlwGQZAyz0odblK re1u6hwCLe6SkYPXtIA0rCgstmG0REwkQAlPAyV6C8TuUsijH8IuU+idXbRLrxjwNPWr ujAg== X-Gm-Message-State: APjAAAV+q3XqaPpmTa/iQW3IIKwdfDmC/+OXTUqQi6f6QYRiQ68o2Fte ocD3uldRRcnq5CF0FPf6OmYs4g== X-Received: by 2002:a7b:c183:: with SMTP id y3mr12245737wmi.45.1576794127988; Thu, 19 Dec 2019 14:22:07 -0800 (PST) Received: from localhost.localdomain ([2a01:e34:ed2f:f020:58d:4e9b:2833:86c3]) by smtp.gmail.com with ESMTPSA id q68sm8942295wme.14.2019.12.19.14.22.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 19 Dec 2019 14:22:07 -0800 (PST) From: Daniel Lezcano To: daniel.lezcano@linaro.org Cc: Zhang Rui , Eduardo Valentin , Amit Kucheria , linux-pm@vger.kernel.org (open list:THERMAL), linux-kernel@vger.kernel.org (open list) Subject: [PATCH 2/2] thermal/drivers/of-thermal: Move the of_thermal_free_zone() to the init section Date: Thu, 19 Dec 2019 23:21:53 +0100 Message-Id: <20191219222154.16100-2-daniel.lezcano@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20191219222154.16100-1-daniel.lezcano@linaro.org> References: <20191219222154.16100-1-daniel.lezcano@linaro.org> Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org The function of_thermal_free_zone() is only used the initialization function which all belonging to the init section. Move it also to the __init section. Signed-off-by: Daniel Lezcano --- drivers/thermal/of-thermal.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- 2.17.1 diff --git a/drivers/thermal/of-thermal.c b/drivers/thermal/of-thermal.c index 4333cd5f1073..27d5b85eb2ca 100644 --- a/drivers/thermal/of-thermal.c +++ b/drivers/thermal/of-thermal.c @@ -977,7 +977,7 @@ __init *thermal_of_build_thermal_zone(struct device_node *np) return ERR_PTR(ret); } -static inline void of_thermal_free_zone(struct __thermal_zone *tz) +static __init void of_thermal_free_zone(struct __thermal_zone *tz) { struct __thermal_bind_params *tbp; int i, j;