From patchwork Fri Jun 17 07:08:40 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Francesco Dolcini X-Patchwork-Id: 12885133 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 3AA1CC43334 for ; Fri, 17 Jun 2022 07:10:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:CC:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=B806UdpnNHidMP/CNfqh71xOh8udGlZFPY+e1bF9Mn8=; b=pbIAmOO7SVITIx PVxsjJpkTl5JlyNrqjKjCwAFulCB3Q8Ckwsr/dLd0rLb1VeK5Gg+I3QXW74zRRBd7+nW7ouaEQwOW 5Ab9sh0KdMSIEgmW9mZqvpvcJxc+UEoIiR7DOjd732vmz8m7CKIBAn8Ed2gO6nWwyAOQIG6jbk+TO bdwNmh0kWHB53Yqpj2vqNXPehbxz+057n3vn6d/p3+dPbHuq31BKsWn8PB6XGW2EM5QLxyxDpz0ST Qxfe4H4vWKug9xsndZYj+pD2NRBjggxSQ6fmGInuq9IQRpmpx4hRTXvhPhd81vihyUpEH8dAhBgsj HetD+Er6HUYCP03V3tdg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1o266d-005qi5-Ci; Fri, 17 Jun 2022 07:09:23 +0000 Received: from de-smtp-delivery-113.mimecast.com ([194.104.109.113]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1o266G-005qZ2-LS for linux-arm-kernel@lists.infradead.org; Fri, 17 Jun 2022 07:09:02 +0000 Received: from CHE01-GV0-obe.outbound.protection.outlook.com (mail-gv0che01lp2048.outbound.protection.outlook.com [104.47.22.48]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id de-mta-15-HiX9Ztl5OHGCcyCCHrYQow-4; Fri, 17 Jun 2022 09:08:55 +0200 X-MC-Unique: HiX9Ztl5OHGCcyCCHrYQow-4 Received: from ZRAP278MB0495.CHEP278.PROD.OUTLOOK.COM (2603:10a6:910:2e::8) by GVAP278MB0263.CHEP278.PROD.OUTLOOK.COM (2603:10a6:710:3d::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5353.15; Fri, 17 Jun 2022 07:08:50 +0000 Received: from ZRAP278MB0495.CHEP278.PROD.OUTLOOK.COM ([fe80::2879:acb:62c8:4987]) by ZRAP278MB0495.CHEP278.PROD.OUTLOOK.COM ([fe80::2879:acb:62c8:4987%8]) with mapi id 15.20.5353.016; Fri, 17 Jun 2022 07:08:50 +0000 From: Francesco Dolcini To: Daniel Lezcano , Rob Herring , "Rafael J. Wysocki" , Krzysztof Kozlowski , Shawn Guo , Marco Felsch , Anson Huang CC: Francesco Dolcini , Amit Kucheria , Zhang Rui , linux-pm@vger.kernel.org, devicetree@vger.kernel.org, Pengutronix Kernel Team , Sascha Hauer , Fabio Estevam , NXP Linux Team , linux-arm-kernel@lists.infradead.org Subject: [PATCH v2 2/9] thermal: thermal: Export OF trip helper function Date: Fri, 17 Jun 2022 09:08:40 +0200 Message-ID: <20220617070847.186876-3-francesco.dolcini@toradex.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220617070847.186876-1-francesco.dolcini@toradex.com> References: <20220617070847.186876-1-francesco.dolcini@toradex.com> X-ClientProxiedBy: MR1P264CA0149.FRAP264.PROD.OUTLOOK.COM (2603:10a6:501:54::15) To ZRAP278MB0495.CHEP278.PROD.OUTLOOK.COM (2603:10a6:910:2e::8) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: f29491f6-84b8-454c-e4c7-08da50303abe X-MS-TrafficTypeDiagnostic: GVAP278MB0263:EE_ X-Microsoft-Antispam-PRVS: X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0 X-Microsoft-Antispam-Message-Info: 68Ipod9J7oUIltabKYSX6yy0b+/lzGEdyvKSJSDjXMBuW91NKzr6Ey2xSWIVdKlVP8ih3G1cGyhptVmt91ZWFNY8HF2otvYvooEs/pmfF+fnv3iumtunUE86QIJ6p+QWF2+aM/htCPSzqOUOdrJhTvg1E7I6yFalnHwaufd6V4kGNqAJ9GiwXtFW8Cq9Mwd4sk+yvDbmNChc9AllxrtlS/c8JefIjkPrS0zRp3w3h0g9RISIcxACqJ/8bugSYVQWVNDRrbJnw7Eafmp+RUFR9XxgFjXK1NlJsyyAGoTjatOwZAFAmWrtdeY9UDYXpFjmcEo/8ZaTDpRQFfROcgZGMbAY8TvfbxDRihuidoa2tgM6sml2r6Rdo6rS7bIgzW2XMhiRHcUEhWOqJrLKcf4+8liOqIfeM2KHhiCbEU8WrFs4kvoeVkQgm5gfqVsww9zIJPXIFo8mDesWoaD6sRKRzwsWH0NSn5zxK7h1IKUI6Php6+ggYxdm994iaS8KKfKZBrUbYB8TnR46oBJOl/gLV4/kzMHeNqcTwz0SKtXVVWyKs9iXbN1tSB0jAbjiPaFcQ1orNw9LhOipblbSu7iV5U0NnYFVV2F5+/CshpXvf13nxsuHOmAVL//GiiipgC9TEIPB/MNUEQrtWCjr8UCakjbc3V8mqNQqmes3plfRH+lmT6JoYQ1uT/W/bZNJtiGZnyQwbMYX+BIlDw3Ix1E+3g== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:ZRAP278MB0495.CHEP278.PROD.OUTLOOK.COM;PTR:;CAT:NONE;SFS:(13230016)(4636009)(39840400004)(346002)(136003)(396003)(366004)(38100700002)(6506007)(52116002)(8936002)(6666004)(6512007)(6486002)(26005)(83380400001)(2906002)(110136005)(5660300002)(54906003)(316002)(36756003)(86362001)(1076003)(2616005)(41300700001)(66556008)(4326008)(44832011)(8676002)(186003)(66476007)(38350700002)(508600001)(66946007)(7416002);DIR:OUT;SFP:1102 X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: hmg6VvfWvfNHFg8cNppHGZY76ahWeyqIyO1SZCvSewR+myTnpZ5OSkGqeG1haBULheGnLFXZcqnLIDTvrO+EYR+dzhOPQ4NhOUUT52nal9YMJ2YHonnLzvLLhianh7+1rfueFik4OdDuHZ5TTxReWnQVDbIG5cjDJwYPOY+WUZ99gcBz02N3DfTDKlBVO4I/qVv0gLr9qf3yIDrk2TExjTUZGKNpCxWP9NIGo43mClCJqfVSb25nDHfIjAzqi6sioRirGGjKFleLq4Gq69TDdMaL7w0usgfcm8EIPbc5ls0OsMgTAZOEirzz1UdA/uPkHBM5isPT+ft5j+CxmM9jr8bTRbHBvBzW/BrHAUTdtGrgoRIl3jzuZSV/Ry1dVC3tkrKkslUHvnMjAU9u/UBhadjz6YwnHUbsZczcHf41EmAjkvl/31C/FW8sOFadz5fPqQlR9aU6a3ODePwad9r7nRfJpJjJzaQAuIjW6KC87XjApPTmZ7VGAFnHkvPD+M54MVhyw/br306CAkDeEjvQvegPkd94Un2OUioD7Xd0nEJ9UEiGL8JvjpPABcmYxLptWNOmt43voZvrEkWqxOQg0Ax9bYCIHdwFdGK8MUTFm2bsgugR9qgOmio/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ldh8yMsT2VF6aQMcd7xHw1QasSN8NyCw+6PTL9Zlxix1Fc9Lyc4NAEM= X-OriginatorOrg: toradex.com X-MS-Exchange-CrossTenant-Network-Message-Id: f29491f6-84b8-454c-e4c7-08da50303abe X-MS-Exchange-CrossTenant-AuthSource: ZRAP278MB0495.CHEP278.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Jun 2022 07:08:50.2462 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: d9995866-0d9b-4251-8315-093f062abab4 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: GRUMhGYnWl4xuqfe70O1x7m/JY2x4BCOu3c766dmWom29b5DFF2OYJ3ipc6XG3WBIMGEYnAst+DRK6pNYjVd79DCewcZmvqgTLh2amlKtPA= X-MS-Exchange-Transport-CrossTenantHeadersStamped: GVAP278MB0263 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CDE13A77 smtp.mailfrom=francesco.dolcini@toradex.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: toradex.com X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220617_000901_049783_3A61A63E X-CRM114-Status: UNSURE ( 9.83 ) X-CRM114-Notice: Please train this message. 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 Export function that populate thermal trip struct from a of node to be able to re-use it in thermal drivers different from thermal_of. Signed-off-by: Francesco Dolcini --- v2: fix build error, use EOPNOTSUPP --- drivers/thermal/thermal_core.h | 7 +++++++ drivers/thermal/thermal_of.c | 5 +++-- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/drivers/thermal/thermal_core.h b/drivers/thermal/thermal_core.h index 726e327b4205..7d429d299d82 100644 --- a/drivers/thermal/thermal_core.h +++ b/drivers/thermal/thermal_core.h @@ -155,6 +155,8 @@ 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 *); +int thermal_of_populate_trip(struct device_node *np, + struct thermal_trip *trip); #else static inline int of_parse_thermal_zones(void) { return 0; } static inline int of_thermal_get_ntrips(struct thermal_zone_device *tz) @@ -171,6 +173,11 @@ of_thermal_get_trip_points(struct thermal_zone_device *tz) { return NULL; } +static inline int thermal_of_populate_trip(struct device_node *np, + struct thermal_trip *trip) +{ + return -EOPNOTSUPP; +} #endif int thermal_zone_device_is_enabled(struct thermal_zone_device *tz); diff --git a/drivers/thermal/thermal_of.c b/drivers/thermal/thermal_of.c index b65d435cb92f..dcd6571a3871 100644 --- a/drivers/thermal/thermal_of.c +++ b/drivers/thermal/thermal_of.c @@ -817,8 +817,8 @@ static int thermal_of_get_trip_type(struct device_node *np, * * Return: 0 on success, proper error code otherwise */ -static int thermal_of_populate_trip(struct device_node *np, - struct thermal_trip *trip) +int thermal_of_populate_trip(struct device_node *np, + struct thermal_trip *trip) { int prop; int ret; @@ -849,6 +849,7 @@ static int thermal_of_populate_trip(struct device_node *np, return 0; } +EXPORT_SYMBOL_GPL(thermal_of_populate_trip); /** * thermal_of_build_thermal_zone - parse and fill one thermal zone data