Received: by 2002:a05:6a10:7420:0:0:0:0 with SMTP id hk32csp4426311pxb; Mon, 21 Feb 2022 21:15:02 -0800 (PST) X-Google-Smtp-Source: ABdhPJw/u5TPdUGp7SUi7yRmaNXpRC48N35egqyjJCatcvB0B4sfgyiwAVODLQuNHzWsa/EcJg6z X-Received: by 2002:a62:cdc3:0:b0:4e0:e439:ed2d with SMTP id o186-20020a62cdc3000000b004e0e439ed2dmr23035187pfg.39.1645506902090; Mon, 21 Feb 2022 21:15:02 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1645506902; cv=none; d=google.com; s=arc-20160816; b=JwCQet88ERSc2dx294e9Mkp/PosGC7B6WbwQq66XGGootE4fjG/WIHpuOCKa93wG8K NZfpTeYW5yfGQ4FErhcW5ekJ6kTOLU2nrUCuEUOlOX4kDsW4wwqu0DksIcIIxufMYk3I PYLNCmefgWoGMBPJDBXaUN/1Ga6NRmLCuim2BscqV/QUbBYwEbXjpBp0SCOJRJlNyygH 0ppHfv8IGbN+Wqiu4nO8LoEEFYDbYXNQo1UPVQ9hGnX2zCLJQY/AZttaW8QFAsUI1L5M M9i3/K7Ge5shAi6e2zKePRNttdJ7qiOgtf9+yUh34E0ZQDa4UMz/Ws9cVgtEhDIoL8nH w8zg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=/e2iZsxFY+H/44yYHExPJa6lTflMw/3gK08JNl6XbE4=; b=wA/Q/dYavbjgPbdswnqAU8ufL5ynglvTcHcAv5eTFyCEOn6r1Wie4aPpbjwNTCXFui jIfXDDoo8scVS1TMb1WFap1cbLMkEnm0Y0Tp4ElG71oFkOGnWI5KYe3aJj537nEbqiXs zNO4HGUZ4kj8YgBN/aJpn93vY13zgPUxl2itA7g0YKQLNRotQ/I8D59c+xFS8T3i2ZiM 8/2pjL219a+b+/WG9L3iT9eikbTsaQZGKZNJU2dkJoxqTF45xhr4EgwEacOfOlo1QWBu 4M1l+5rdCwLnjK9rDw5YDZKHqdOj/2NsN7hLTRfW2AEjVPj75L9fVMz3+XXKi5EN2ZNb y5VA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b="UC/wIbPY"; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=bootlin.com Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id g17si10584136pfv.115.2022.02.21.21.15.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 21 Feb 2022 21:15:02 -0800 (PST) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b="UC/wIbPY"; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=bootlin.com Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id D1D82E4496; Mon, 21 Feb 2022 20:47:07 -0800 (PST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1380878AbiBUQjX (ORCPT + 99 others); Mon, 21 Feb 2022 11:39:23 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:49578 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1380781AbiBUQjJ (ORCPT ); Mon, 21 Feb 2022 11:39:09 -0500 Received: from mslow1.mail.gandi.net (mslow1.mail.gandi.net [217.70.178.240]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2960F22BD5; Mon, 21 Feb 2022 08:38:37 -0800 (PST) Received: from relay9-d.mail.gandi.net (unknown [IPv6:2001:4b98:dc4:8::229]) by mslow1.mail.gandi.net (Postfix) with ESMTP id 1847DD243E; Mon, 21 Feb 2022 16:29:15 +0000 (UTC) Received: (Authenticated sender: clement.leger@bootlin.com) by mail.gandi.net (Postfix) with ESMTPSA id 971DFFF806; Mon, 21 Feb 2022 16:29:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1645460952; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=/e2iZsxFY+H/44yYHExPJa6lTflMw/3gK08JNl6XbE4=; b=UC/wIbPYMT+4T+ynra4OxvY0MmvzqiCwd3KVJH2dNZOt70UaJPYg4rXhW5sS7ZS+igOLqo AAYoS2n2nrvsrKOkgtQ7rNYXNGTFZvGn2vhAmYOTvOJbcLrfAOHlpvF1r9K/dVjpoq7xOo kTg0aAkhBB9HC0WQJ7OzO6UX/1oyLcRm95lkS55mSvtYLm18InaFuJMXYXI5KiE4mJduF+ DyIM3U1dzmYffdx8lIq2O80rPpludWnkuSJwj+bD+OoX/NiaQMlGbBlUmunVhVHPiptUBt TMQw32HqV6hQPwGti7YjKkdHeghrtl+jDYv3bK719dSHBtv2PGVZRHcQiGuF+Q== From: =?UTF-8?q?Cl=C3=A9ment=20L=C3=A9ger?= To: Andy Shevchenko , Daniel Scally , Heikki Krogerus , Sakari Ailus , Greg Kroah-Hartman , "Rafael J . Wysocki" , Wolfram Sang , Peter Rosin , Russell King , Andrew Lunn , Heiner Kallweit , "David S . Miller" , Jakub Kicinski Cc: linux-kernel@vger.kernel.org, linux-acpi@vger.kernel.org, linux-i2c@vger.kernel.org, netdev@vger.kernel.org, Thomas Petazzoni , Alexandre Belloni , =?UTF-8?q?Cl=C3=A9ment=20L=C3=A9ger?= Subject: [RFC 02/10] property: add fwnode_get_match_data() Date: Mon, 21 Feb 2022 17:26:44 +0100 Message-Id: <20220221162652.103834-3-clement.leger@bootlin.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220221162652.103834-1-clement.leger@bootlin.com> References: <20220221162652.103834-1-clement.leger@bootlin.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Add fwnode_get_match_data() which is meant to be used as device_get_match_data for fwnode_operations. Signed-off-by: Clément Léger --- drivers/base/property.c | 12 ++++++++++++ include/linux/property.h | 3 +++ 2 files changed, 15 insertions(+) diff --git a/drivers/base/property.c b/drivers/base/property.c index 434c2713fd99..6ffb3ac4509c 100644 --- a/drivers/base/property.c +++ b/drivers/base/property.c @@ -1181,6 +1181,18 @@ const struct of_device_id *fwnode_match_node(const struct fwnode_handle *fwnode, } EXPORT_SYMBOL(fwnode_match_node); +const void *fwnode_get_match_data(const struct fwnode_handle *fwnode, + const struct device *dev) +{ + const struct of_device_id *match; + + match = fwnode_match_node(fwnode, dev->driver->of_match_table); + if (!match) + return NULL; + + return match->data; +} + const void *device_get_match_data(struct device *dev) { return fwnode_call_ptr_op(dev_fwnode(dev), device_get_match_data, dev); diff --git a/include/linux/property.h b/include/linux/property.h index 978ecf6be34e..7f727c492602 100644 --- a/include/linux/property.h +++ b/include/linux/property.h @@ -449,6 +449,9 @@ static inline void *device_connection_find_match(struct device *dev, const struct of_device_id *fwnode_match_node(const struct fwnode_handle *fwnode, const struct of_device_id *matches); +const void *fwnode_get_match_data(const struct fwnode_handle *fwnode, + const struct device *dev); + /* -------------------------------------------------------------------------- */ /* Software fwnode support - when HW description is incomplete or missing */ -- 2.34.1