From patchwork Fri Jun 17 07:14:04 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Francesco Dolcini X-Patchwork-Id: 12885179 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 79DACC43334 for ; Fri, 17 Jun 2022 07:21: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: 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=gRUvBOXVUgLmZw axgaWPyuTZJkN3zUVC5qOqr+YkUV6UfLOJcXa0lzc6R794ncvkvQmim+Fiiery213zFWpVzIlz04O q3goOjlpCk7zBYNmNaV1MYt1YSN/CeRMcWVzX833RxqNJv9Pffa2gkTDABuNB28+K8IsoSV3NVihM jFoFSaT6xMG3u5tgoOBGOmQLGz4eljg9tvIGqyPd+Q2HJYR8KDUS42B+byVgLH2orenrltApJVn9R +GxmgHHDqLv8iZWBZynFWt4mSEVGBX5SEweRjSHxjGPnFvv4gjS/Mo30HTc3Qkt6eXkKm4sfIbAA4 A1pwkou4dc0LyVifao6w==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1o26Gs-005ulf-W0; Fri, 17 Jun 2022 07:19:59 +0000 Received: from de-smtp-delivery-113.mimecast.com ([194.104.111.113]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1o26BP-005saH-8W for linux-arm-kernel@lists.infradead.org; Fri, 17 Jun 2022 07:14:22 +0000 Received: from CHE01-ZR0-obe.outbound.protection.outlook.com (mail-zr0che01lp2112.outbound.protection.outlook.com [104.47.22.112]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id de-mta-34-GHOpG-1qOf6KL5FIBHnXfg-1; Fri, 17 Jun 2022 09:14:15 +0200 X-MC-Unique: GHOpG-1qOf6KL5FIBHnXfg-1 Received: from ZRAP278MB0495.CHEP278.PROD.OUTLOOK.COM (2603:10a6:910:2e::8) by GVAP278MB0438.CHEP278.PROD.OUTLOOK.COM (2603:10a6:710:3e::6) 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:14:13 +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:14:13 +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: [RESEND PATCH v2 2/9] thermal: thermal: Export OF trip helper function Date: Fri, 17 Jun 2022 09:14:04 +0200 Message-ID: <20220617071411.187542-3-francesco.dolcini@toradex.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220617071411.187542-1-francesco.dolcini@toradex.com> References: <20220617071411.187542-1-francesco.dolcini@toradex.com> X-ClientProxiedBy: MR2P264CA0142.FRAP264.PROD.OUTLOOK.COM (2603:10a6:500:30::34) 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: c3518745-29dd-4b3c-19dc-08da5030fb44 X-MS-TrafficTypeDiagnostic: GVAP278MB0438: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: txDlX4ieZlW0vXDXCkgTRWhOCxsivL+rTIycqZusuXiDgnb14AcCJ+q2MSRFMTnRE5cyEGbEiAoBLY/kSx0eLF3OA3Z9DVXh5FVrOQ0bu57vRXtexW4xG12gBCMgGuk9i4UsXh4+G2cDtQT+7MMWI98HdeMa36f2m1Gixrvr/90ocW7S8fx/9D9RUOHjxj4e1bRsMERWb2Gfof4xTxQPIUPsfAAAd+xVZ0PX/NhCic/m80YCsUcZEsvndtT2Onz5F3q2cl8i3G//Cycdlqbwg8cLUGEtEfjLI9rEnJakIlU2Yz3GSowmkIsULogn8bCNcLKbRGwDyrULZ991q85Y6QK446Onbj5aoo+DP5YBdrggjczZ6mjI+lg8XLhZgjcerdbrl9SjgNVNwh7Gb15+j4efSZ6Iwqm7GFqlbEoe1uF9MZSeh+5OJmHR2ggTj4O0pTtCA1tYK0DeMbZtXVyyjtLenfg4Jln215sBmzb2oZBLt8hJxhDHgcOPqaPu23qibbGhDzpO2JRuU0KTUPqw9RyrEbS2IBQGDFwuGEfJBS7nyoXY2QBhCqqC/3HpZY8q498JPsK15s7PwarqSYd1HQnD9upFGTrJj81SN4/TyqHeecpEaZhgT41ICQraiAhZqrvo8ivHLj2hE6uR696H8qg7GX4o0muykrrZvS7WY8kf5XPnM7642+O+50OdfQM7qSWiYbrv3IzBet1RYT+XPA== 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)(396003)(366004)(136003)(39850400004)(346002)(52116002)(38100700002)(38350700002)(6506007)(2906002)(8676002)(8936002)(6666004)(6486002)(316002)(66946007)(86362001)(7416002)(508600001)(5660300002)(44832011)(83380400001)(110136005)(41300700001)(2616005)(26005)(6512007)(36756003)(66556008)(54906003)(4326008)(66476007)(186003)(1076003);DIR:OUT;SFP:1102 X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: cqpGMR6/vrwmQMFlFoaOVX2ukogGuOsGFFNYIsUkwQWwS0t5UckZqbMn7K26L3BjAbtRsuSU+7r5JkmJCNGeAjM6oEOTpq2VHzAxDrSOXUzI9yoru6uBrXbsCEv+y/AtTGrrcrf8qYpJgzwrauD6BnJ8RkYcEAz4WXQqheZkRiuxfTFUKQRnjslWroPzIvl6IWvLbiaJvMCo70zTwFGDQyQQGLk/BQlaOSb/q2k90Lk36boHeQ9w38WEQDHNatdEFplYrn7y6EOupixFoIiCo/H9zfwUQ9jy3An4afqCx9rEgMun5sC3b1vil33a2BEEXrzNTCyrCvO78+xU8RyB3AbYSRopfNhmKxEDmbcieqoVLzxU8N6ZABtiZjxfx+J5/lgNQRE3xPegSHce3org+yKrJgsP0EQNF/+DiWGGlEn1wiO+8U9TjCSHm5BCRLx85rabiD5qF2dwai8bbcLcPeGZg8aBpFCkV69Ce3f0mGwIRW+aAXGHxUZee+caOetlTDfZplXFNA1yuDJZwn3va6VjxgGnEnKo2A7Rd4zUBGXZnL5WfCbVl9/iP26pbOXVo9lsulb6MJB7nJjme8v1TL2Ep+sP92atTxT6pZxIqR4OTZHFgnL+SRJQIct7TNtE/Z+3+STiAE8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CyLWpFlfPAvvhqYlzqO8I1JwB3RRhx7rUg/qzzw= X-OriginatorOrg: toradex.com X-MS-Exchange-CrossTenant-Network-Message-Id: c3518745-29dd-4b3c-19dc-08da5030fb44 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:14:13.1949 (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: xymG69DaySbuhFDtTrU3o/NdvRaWizLH+H0t5/OyasY1Q2kNjbYk/YSOsZbZfUvTnchnSrqDuOkla/hSIYvYnIHqfeqrUVvOS5lIMoZNi10= X-MS-Exchange-Transport-CrossTenantHeadersStamped: GVAP278MB0438 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_001419_653447_5E5D8658 X-CRM114-Status: UNSURE ( 9.81 ) 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