From mboxrd@z Thu Jan 1 00:00:00 1970 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8024DC433EF for ; Thu, 10 Feb 2022 07:50:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236659AbiBJHuJ (ORCPT ); Thu, 10 Feb 2022 02:50:09 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:38750 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236626AbiBJHuF (ORCPT ); Thu, 10 Feb 2022 02:50:05 -0500 Received: from mailgw02.mediatek.com (unknown [210.61.82.184]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5089F1086 for ; Wed, 9 Feb 2022 23:50:03 -0800 (PST) X-UUID: 6cdd44ab8bbd4f69b30eb8ff0670bc6a-20220210 X-UUID: 6cdd44ab8bbd4f69b30eb8ff0670bc6a-20220210 Received: from mtkcas11.mediatek.inc [(172.21.101.40)] by mailgw02.mediatek.com (envelope-from ) (Generic MTA with TLSv1.2 ECDHE-RSA-AES256-SHA384 256/256) with ESMTP id 459675619; Thu, 10 Feb 2022 15:49:56 +0800 Received: from mtkcas10.mediatek.inc (172.21.101.39) by mtkmbs07n1.mediatek.inc (172.21.101.16) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Thu, 10 Feb 2022 15:49:54 +0800 Received: from mhfsdcap04 (10.17.3.154) by mtkcas10.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.0.1497.2 via Frontend Transport; Thu, 10 Feb 2022 15:49:53 +0800 Message-ID: Subject: Re: [RFC PATCH] component: Add common helpers for compare/release functions From: Yong Wu To: Robin Murphy , CC: David Airlie , Daniel Vetter , "James Wang" , Liviu Dudau , , Matthias Brugger , Krzysztof Kozlowski , , "Joerg Roedel" , Will Deacon , Arnd Bergmann , Laurent Pinchart , , Chun-Kuang Hu , , "Stephen Boyd" , AngeloGioacchino Del Regno , Hsin-Yi Wang , Tomasz Figa , , Rob Clark , "Srinivas Kandagatla" , Sebastian Reichel Date: Thu, 10 Feb 2022 15:49:53 +0800 In-Reply-To: <29deffd6-aac4-f085-bcd5-f5a2d02784a8@arm.com> References: <20220128081101.27837-1-yong.wu@mediatek.com> <29deffd6-aac4-f085-bcd5-f5a2d02784a8@arm.com> Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.28.5-0ubuntu0.18.04.2 MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-MTK: N Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, 2022-01-28 at 13:04 +0000, Robin Murphy wrote: > On 2022-01-28 08:11, Yong Wu wrote: > [...] > > diff --git a/include/linux/component.h b/include/linux/component.h > > index 16de18f473d7..5a7468ea827c 100644 > > --- a/include/linux/component.h > > +++ b/include/linux/component.h > > @@ -2,6 +2,8 @@ > > #ifndef COMPONENT_H > > #define COMPONENT_H > > > > +#include > > +#include > > #include > > > > > > @@ -82,6 +84,22 @@ struct component_master_ops { > > void (*unbind)(struct device *master); > > }; > > > > +/* A set common helpers for compare/release functions */ > > +static inline int compare_of(struct device *dev, void *data) > > +{ > > + return dev->of_node == data; > > +} > > Note that this is effectively just device_match_of_node(), although > I > guess there is an argument that having a nice consistent set of > component_match API helpers might be worth more than a tiny code > saving > by borrowing one from a different API. Thanks for this tip. I could try use this, Let the maintainer decide. > > Either way, however, I don't think there's any good argument for > instantiating separate copies of these functions in every driver > that > uses them. If they're used as callbacks then they can't actually be > inlined anyway, so they may as well be exported from component.c as oh. The MTK iommu keeps this inline for long time... OK, I will try to move into the component.c and export them. (Sorry for the late reply due to New Year holidays.) > normal so that the code really is shared (plus then there's nice > symmetry with the aforementioned device_match API helpers too). > > Thanks, > Robin. From mboxrd@z Thu Jan 1 00:00:00 1970 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 smtp1.osuosl.org (smtp1.osuosl.org [140.211.166.138]) (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 62C67C433F5 for ; Thu, 10 Feb 2022 07:50:12 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp1.osuosl.org (Postfix) with ESMTP id EEC3982457; Thu, 10 Feb 2022 07:50:11 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp1.osuosl.org ([127.0.0.1]) by localhost (smtp1.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id Kk4BNJbDfEBG; Thu, 10 Feb 2022 07:50:09 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [140.211.9.56]) by smtp1.osuosl.org (Postfix) with ESMTPS id 4792C82443; Thu, 10 Feb 2022 07:50:09 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id 2ED85C0011; Thu, 10 Feb 2022 07:50:09 +0000 (UTC) Received: from smtp4.osuosl.org (smtp4.osuosl.org [IPv6:2605:bc80:3010::137]) by lists.linuxfoundation.org (Postfix) with ESMTP id DEEA0C000B for ; Thu, 10 Feb 2022 07:50:07 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp4.osuosl.org (Postfix) with ESMTP id DAF8D40998 for ; Thu, 10 Feb 2022 07:50:07 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp4.osuosl.org ([127.0.0.1]) by localhost (smtp4.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id DXrmXshwJtf8 for ; Thu, 10 Feb 2022 07:50:04 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.8.0 Received: from mailgw02.mediatek.com (unknown [210.61.82.184]) by smtp4.osuosl.org (Postfix) with ESMTPS id 5A027408D8 for ; Thu, 10 Feb 2022 07:50:04 +0000 (UTC) X-UUID: 6cdd44ab8bbd4f69b30eb8ff0670bc6a-20220210 X-UUID: 6cdd44ab8bbd4f69b30eb8ff0670bc6a-20220210 Received: from mtkcas11.mediatek.inc [(172.21.101.40)] by mailgw02.mediatek.com (envelope-from ) (Generic MTA with TLSv1.2 ECDHE-RSA-AES256-SHA384 256/256) with ESMTP id 459675619; Thu, 10 Feb 2022 15:49:56 +0800 Received: from mtkcas10.mediatek.inc (172.21.101.39) by mtkmbs07n1.mediatek.inc (172.21.101.16) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Thu, 10 Feb 2022 15:49:54 +0800 Received: from mhfsdcap04 (10.17.3.154) by mtkcas10.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.0.1497.2 via Frontend Transport; Thu, 10 Feb 2022 15:49:53 +0800 Message-ID: Subject: Re: [RFC PATCH] component: Add common helpers for compare/release functions To: Robin Murphy , Date: Thu, 10 Feb 2022 15:49:53 +0800 In-Reply-To: <29deffd6-aac4-f085-bcd5-f5a2d02784a8@arm.com> References: <20220128081101.27837-1-yong.wu@mediatek.com> <29deffd6-aac4-f085-bcd5-f5a2d02784a8@arm.com> X-Mailer: Evolution 3.28.5-0ubuntu0.18.04.2 MIME-Version: 1.0 X-MTK: N Cc: David Airlie , Liviu Dudau , Sebastian Reichel , Srinivas Kandagatla , Laurent Pinchart , Will Deacon , Krzysztof Kozlowski , James Wang , Chun-Kuang Hu , Arnd Bergmann , linux-mediatek@lists.infradead.org, Hsin-Yi Wang , Matthias Brugger , linux-arm-kernel@lists.infradead.org, AngeloGioacchino Del Regno , srv_heupstream@mediatek.com, Stephen Boyd , linux-kernel@vger.kernel.org, iommu@lists.linux-foundation.org, Daniel Vetter X-BeenThere: iommu@lists.linux-foundation.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: Development issues for Linux IOMMU support List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , From: Yong Wu via iommu Reply-To: Yong Wu Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: iommu-bounces@lists.linux-foundation.org Sender: "iommu" On Fri, 2022-01-28 at 13:04 +0000, Robin Murphy wrote: > On 2022-01-28 08:11, Yong Wu wrote: > [...] > > diff --git a/include/linux/component.h b/include/linux/component.h > > index 16de18f473d7..5a7468ea827c 100644 > > --- a/include/linux/component.h > > +++ b/include/linux/component.h > > @@ -2,6 +2,8 @@ > > #ifndef COMPONENT_H > > #define COMPONENT_H > > > > +#include > > +#include > > #include > > > > > > @@ -82,6 +84,22 @@ struct component_master_ops { > > void (*unbind)(struct device *master); > > }; > > > > +/* A set common helpers for compare/release functions */ > > +static inline int compare_of(struct device *dev, void *data) > > +{ > > + return dev->of_node == data; > > +} > > Note that this is effectively just device_match_of_node(), although > I > guess there is an argument that having a nice consistent set of > component_match API helpers might be worth more than a tiny code > saving > by borrowing one from a different API. Thanks for this tip. I could try use this, Let the maintainer decide. > > Either way, however, I don't think there's any good argument for > instantiating separate copies of these functions in every driver > that > uses them. If they're used as callbacks then they can't actually be > inlined anyway, so they may as well be exported from component.c as oh. The MTK iommu keeps this inline for long time... OK, I will try to move into the component.c and export them. (Sorry for the late reply due to New Year holidays.) > normal so that the code really is shared (plus then there's nice > symmetry with the aforementioned device_match API helpers too). > > Thanks, > Robin. _______________________________________________ iommu mailing list iommu@lists.linux-foundation.org https://lists.linuxfoundation.org/mailman/listinfo/iommu From mboxrd@z Thu Jan 1 00:00:00 1970 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 DB45FC433EF for ; Thu, 10 Feb 2022 07:50:36 +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: Date:CC:To:From:Subject:Message-ID:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=qBxvWb4Pd/GaHG71W/Ij8p8Hh89Q/yK9eDH/QFNMF6k=; b=Uf8S0gTtsGQ891 5lKsuwf5W0YM/RF/qhz8E2Y9Bb9DcbMttrwCg6d46KA4mcc66bKvCp9nVWDE3inciwc57N2EuJzLd 273i5e0yUrITS9NHx3qdCBZvA8uFgHNbZFHqy9FE2JDRckEw35eBzv5QmzklQ68MOLOlucc/mNrYT JvchOfNBiCG6x9tpRPpVpIRJBF4FfnrZzpluOxRghm3wj8jk/1s/aiWvbTIwlMD0qo2RvpflPmk1g 0W2+vXU9vyd9HKZgzD45Mvmx0jKaBeTmVksSRipK+13ftS2+gF1H4C3KLXwvFUq8zSLv7GhSQpAw4 eKBNVg0H6uqT1WCjfuoA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nI4Di-002vuC-7M; Thu, 10 Feb 2022 07:50:26 +0000 Received: from mailgw02.mediatek.com ([216.200.240.185]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1nI4DR-002vlN-SZ; Thu, 10 Feb 2022 07:50:11 +0000 X-UUID: a98e9dd5d47d4922ae8a8f547fe0f664-20220210 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=mediatek.com; s=dk; h=Content-Transfer-Encoding:MIME-Version:Content-Type:References:In-Reply-To:Date:CC:To:From:Subject:Message-ID; bh=faCuWFRjaTfv9Zgib3R+c+bUwB/LfIm9iz/RWb4LUGs=; b=oIdA8g9WPCIfCSvqYD1Hb0qpDqcUdlE3Z5w/G+LRO5DiQJPBqGL99duRRbI1t80qgMEHT01jNp/jKpvrTSuTjpZo0o5u83rS3cOUzHspL8P2PF/+yubWAm26+sNPki7OmfGLR6aHBWDxLhAqQ62JCtEBtyKcPgUZN37GtHnznTU=; X-UUID: a98e9dd5d47d4922ae8a8f547fe0f664-20220210 Received: from mtkcas68.mediatek.inc [(172.29.94.19)] by mailgw02.mediatek.com (envelope-from ) (musrelay.mediatek.com ESMTP with TLSv1.2 ECDHE-RSA-AES256-SHA384 256/256) with ESMTP id 171337631; Thu, 10 Feb 2022 00:49:57 -0700 Received: from mtkmbs07n1.mediatek.inc (172.21.101.16) by MTKMBS62N1.mediatek.inc (172.29.193.41) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Wed, 9 Feb 2022 23:49:56 -0800 Received: from mtkcas10.mediatek.inc (172.21.101.39) by mtkmbs07n1.mediatek.inc (172.21.101.16) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Thu, 10 Feb 2022 15:49:54 +0800 Received: from mhfsdcap04 (10.17.3.154) by mtkcas10.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.0.1497.2 via Frontend Transport; Thu, 10 Feb 2022 15:49:53 +0800 Message-ID: Subject: Re: [RFC PATCH] component: Add common helpers for compare/release functions From: Yong Wu To: Robin Murphy , CC: David Airlie , Daniel Vetter , "James Wang" , Liviu Dudau , , Matthias Brugger , Krzysztof Kozlowski , , "Joerg Roedel" , Will Deacon , Arnd Bergmann , Laurent Pinchart , , Chun-Kuang Hu , , "Stephen Boyd" , AngeloGioacchino Del Regno , Hsin-Yi Wang , Tomasz Figa , , Rob Clark , "Srinivas Kandagatla" , Sebastian Reichel Date: Thu, 10 Feb 2022 15:49:53 +0800 In-Reply-To: <29deffd6-aac4-f085-bcd5-f5a2d02784a8@arm.com> References: <20220128081101.27837-1-yong.wu@mediatek.com> <29deffd6-aac4-f085-bcd5-f5a2d02784a8@arm.com> X-Mailer: Evolution 3.28.5-0ubuntu0.18.04.2 MIME-Version: 1.0 X-MTK: N X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220209_235009_951447_A8B7B5F9 X-CRM114-Status: GOOD ( 21.67 ) X-BeenThere: linux-mediatek@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "Linux-mediatek" Errors-To: linux-mediatek-bounces+linux-mediatek=archiver.kernel.org@lists.infradead.org On Fri, 2022-01-28 at 13:04 +0000, Robin Murphy wrote: > On 2022-01-28 08:11, Yong Wu wrote: > [...] > > diff --git a/include/linux/component.h b/include/linux/component.h > > index 16de18f473d7..5a7468ea827c 100644 > > --- a/include/linux/component.h > > +++ b/include/linux/component.h > > @@ -2,6 +2,8 @@ > > #ifndef COMPONENT_H > > #define COMPONENT_H > > > > +#include > > +#include > > #include > > > > > > @@ -82,6 +84,22 @@ struct component_master_ops { > > void (*unbind)(struct device *master); > > }; > > > > +/* A set common helpers for compare/release functions */ > > +static inline int compare_of(struct device *dev, void *data) > > +{ > > + return dev->of_node == data; > > +} > > Note that this is effectively just device_match_of_node(), although > I > guess there is an argument that having a nice consistent set of > component_match API helpers might be worth more than a tiny code > saving > by borrowing one from a different API. Thanks for this tip. I could try use this, Let the maintainer decide. > > Either way, however, I don't think there's any good argument for > instantiating separate copies of these functions in every driver > that > uses them. If they're used as callbacks then they can't actually be > inlined anyway, so they may as well be exported from component.c as oh. The MTK iommu keeps this inline for long time... OK, I will try to move into the component.c and export them. (Sorry for the late reply due to New Year holidays.) > normal so that the code really is shared (plus then there's nice > symmetry with the aforementioned device_match API helpers too). > > Thanks, > Robin. _______________________________________________ Linux-mediatek mailing list Linux-mediatek@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-mediatek From mboxrd@z Thu Jan 1 00:00:00 1970 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 gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (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 BD719C433F5 for ; Thu, 10 Feb 2022 07:50:06 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id E4EED10E72C; Thu, 10 Feb 2022 07:50:03 +0000 (UTC) Received: from mailgw02.mediatek.com (unknown [210.61.82.184]) by gabe.freedesktop.org (Postfix) with ESMTPS id 7396C10E72C for ; Thu, 10 Feb 2022 07:50:01 +0000 (UTC) X-UUID: 6cdd44ab8bbd4f69b30eb8ff0670bc6a-20220210 X-UUID: 6cdd44ab8bbd4f69b30eb8ff0670bc6a-20220210 Received: from mtkcas11.mediatek.inc [(172.21.101.40)] by mailgw02.mediatek.com (envelope-from ) (Generic MTA with TLSv1.2 ECDHE-RSA-AES256-SHA384 256/256) with ESMTP id 459675619; Thu, 10 Feb 2022 15:49:56 +0800 Received: from mtkcas10.mediatek.inc (172.21.101.39) by mtkmbs07n1.mediatek.inc (172.21.101.16) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Thu, 10 Feb 2022 15:49:54 +0800 Received: from mhfsdcap04 (10.17.3.154) by mtkcas10.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.0.1497.2 via Frontend Transport; Thu, 10 Feb 2022 15:49:53 +0800 Message-ID: Subject: Re: [RFC PATCH] component: Add common helpers for compare/release functions From: Yong Wu To: Robin Murphy , Date: Thu, 10 Feb 2022 15:49:53 +0800 In-Reply-To: <29deffd6-aac4-f085-bcd5-f5a2d02784a8@arm.com> References: <20220128081101.27837-1-yong.wu@mediatek.com> <29deffd6-aac4-f085-bcd5-f5a2d02784a8@arm.com> Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.28.5-0ubuntu0.18.04.2 MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-MTK: N X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: David Airlie , Liviu Dudau , Sebastian Reichel , Srinivas Kandagatla , Laurent Pinchart , Will Deacon , Krzysztof Kozlowski , Joerg Roedel , iommu@lists.linux-foundation.org, James Wang , Chun-Kuang Hu , Arnd Bergmann , linux-mediatek@lists.infradead.org, Hsin-Yi Wang , Matthias Brugger , linux-arm-kernel@lists.infradead.org, AngeloGioacchino Del Regno , srv_heupstream@mediatek.com, Stephen Boyd , linux-kernel@vger.kernel.org, Tomasz Figa Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" On Fri, 2022-01-28 at 13:04 +0000, Robin Murphy wrote: > On 2022-01-28 08:11, Yong Wu wrote: > [...] > > diff --git a/include/linux/component.h b/include/linux/component.h > > index 16de18f473d7..5a7468ea827c 100644 > > --- a/include/linux/component.h > > +++ b/include/linux/component.h > > @@ -2,6 +2,8 @@ > > #ifndef COMPONENT_H > > #define COMPONENT_H > > > > +#include > > +#include > > #include > > > > > > @@ -82,6 +84,22 @@ struct component_master_ops { > > void (*unbind)(struct device *master); > > }; > > > > +/* A set common helpers for compare/release functions */ > > +static inline int compare_of(struct device *dev, void *data) > > +{ > > + return dev->of_node == data; > > +} > > Note that this is effectively just device_match_of_node(), although > I > guess there is an argument that having a nice consistent set of > component_match API helpers might be worth more than a tiny code > saving > by borrowing one from a different API. Thanks for this tip. I could try use this, Let the maintainer decide. > > Either way, however, I don't think there's any good argument for > instantiating separate copies of these functions in every driver > that > uses them. If they're used as callbacks then they can't actually be > inlined anyway, so they may as well be exported from component.c as oh. The MTK iommu keeps this inline for long time... OK, I will try to move into the component.c and export them. (Sorry for the late reply due to New Year holidays.) > normal so that the code really is shared (plus then there's nice > symmetry with the aforementioned device_match API helpers too). > > Thanks, > Robin. From mboxrd@z Thu Jan 1 00:00:00 1970 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 BA275C433F5 for ; Thu, 10 Feb 2022 07:51:42 +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: Date:CC:To:From:Subject:Message-ID:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=vZSPgbatzOA3MUfJmZipq6RBNFjGGrnGaQFqdaF5L5w=; b=k0hWshWbxNar1I oxa0u06ZL6igYeN/QdLSRUAr177fWrLIarvjnTQ0liTRkCk/ht8S0gsdfMd0cL49/nyTv5qAWslhf VCxCuMuxyFj9ITH0Ioy/WMDfDdlY0MDFs6RFlR7Cqjw653rK3F8F+dF0UEkxzyafAodUKCS/FCCTY uxSdNc+XXA6PWd6FWlyrqyvkMdLS16Fk9igoruhWeqLd3RuELLMYSfseDs3mX0NaQGUCgumZnyh17 zOlVuP9vz5txJsrLxvpXqta+vzdu0xOAUfRYz8jgzWIkVm/8YrgacHdZti0sNptzLNYCGv7BgatBa whg1jnsVaoGSfluTJWSQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nI4DY-002vq1-RJ; Thu, 10 Feb 2022 07:50:16 +0000 Received: from mailgw02.mediatek.com ([216.200.240.185]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1nI4DR-002vlN-SZ; Thu, 10 Feb 2022 07:50:11 +0000 X-UUID: a98e9dd5d47d4922ae8a8f547fe0f664-20220210 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=mediatek.com; s=dk; h=Content-Transfer-Encoding:MIME-Version:Content-Type:References:In-Reply-To:Date:CC:To:From:Subject:Message-ID; bh=faCuWFRjaTfv9Zgib3R+c+bUwB/LfIm9iz/RWb4LUGs=; b=oIdA8g9WPCIfCSvqYD1Hb0qpDqcUdlE3Z5w/G+LRO5DiQJPBqGL99duRRbI1t80qgMEHT01jNp/jKpvrTSuTjpZo0o5u83rS3cOUzHspL8P2PF/+yubWAm26+sNPki7OmfGLR6aHBWDxLhAqQ62JCtEBtyKcPgUZN37GtHnznTU=; X-UUID: a98e9dd5d47d4922ae8a8f547fe0f664-20220210 Received: from mtkcas68.mediatek.inc [(172.29.94.19)] by mailgw02.mediatek.com (envelope-from ) (musrelay.mediatek.com ESMTP with TLSv1.2 ECDHE-RSA-AES256-SHA384 256/256) with ESMTP id 171337631; Thu, 10 Feb 2022 00:49:57 -0700 Received: from mtkmbs07n1.mediatek.inc (172.21.101.16) by MTKMBS62N1.mediatek.inc (172.29.193.41) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Wed, 9 Feb 2022 23:49:56 -0800 Received: from mtkcas10.mediatek.inc (172.21.101.39) by mtkmbs07n1.mediatek.inc (172.21.101.16) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Thu, 10 Feb 2022 15:49:54 +0800 Received: from mhfsdcap04 (10.17.3.154) by mtkcas10.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.0.1497.2 via Frontend Transport; Thu, 10 Feb 2022 15:49:53 +0800 Message-ID: Subject: Re: [RFC PATCH] component: Add common helpers for compare/release functions From: Yong Wu To: Robin Murphy , CC: David Airlie , Daniel Vetter , "James Wang" , Liviu Dudau , , Matthias Brugger , Krzysztof Kozlowski , , "Joerg Roedel" , Will Deacon , Arnd Bergmann , Laurent Pinchart , , Chun-Kuang Hu , , "Stephen Boyd" , AngeloGioacchino Del Regno , Hsin-Yi Wang , Tomasz Figa , , Rob Clark , "Srinivas Kandagatla" , Sebastian Reichel Date: Thu, 10 Feb 2022 15:49:53 +0800 In-Reply-To: <29deffd6-aac4-f085-bcd5-f5a2d02784a8@arm.com> References: <20220128081101.27837-1-yong.wu@mediatek.com> <29deffd6-aac4-f085-bcd5-f5a2d02784a8@arm.com> X-Mailer: Evolution 3.28.5-0ubuntu0.18.04.2 MIME-Version: 1.0 X-MTK: N X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220209_235009_951447_A8B7B5F9 X-CRM114-Status: GOOD ( 21.67 ) 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: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Fri, 2022-01-28 at 13:04 +0000, Robin Murphy wrote: > On 2022-01-28 08:11, Yong Wu wrote: > [...] > > diff --git a/include/linux/component.h b/include/linux/component.h > > index 16de18f473d7..5a7468ea827c 100644 > > --- a/include/linux/component.h > > +++ b/include/linux/component.h > > @@ -2,6 +2,8 @@ > > #ifndef COMPONENT_H > > #define COMPONENT_H > > > > +#include > > +#include > > #include > > > > > > @@ -82,6 +84,22 @@ struct component_master_ops { > > void (*unbind)(struct device *master); > > }; > > > > +/* A set common helpers for compare/release functions */ > > +static inline int compare_of(struct device *dev, void *data) > > +{ > > + return dev->of_node == data; > > +} > > Note that this is effectively just device_match_of_node(), although > I > guess there is an argument that having a nice consistent set of > component_match API helpers might be worth more than a tiny code > saving > by borrowing one from a different API. Thanks for this tip. I could try use this, Let the maintainer decide. > > Either way, however, I don't think there's any good argument for > instantiating separate copies of these functions in every driver > that > uses them. If they're used as callbacks then they can't actually be > inlined anyway, so they may as well be exported from component.c as oh. The MTK iommu keeps this inline for long time... OK, I will try to move into the component.c and export them. (Sorry for the late reply due to New Year holidays.) > normal so that the code really is shared (plus then there's nice > symmetry with the aforementioned device_match API helpers too). > > Thanks, > Robin. _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel