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 A42E7C433F5 for ; Mon, 31 Jan 2022 10:57:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239848AbiAaK5o (ORCPT ); Mon, 31 Jan 2022 05:57:44 -0500 Received: from mga09.intel.com ([134.134.136.24]:43981 "EHLO mga09.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239808AbiAaK5d (ORCPT ); Mon, 31 Jan 2022 05:57:33 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1643626653; x=1675162653; h=from:to:cc:subject:in-reply-to:references:date: message-id:mime-version; bh=ZdENkAwNTJtD0Npkluazkuj5//kfgKoLfVNh1OSJ8Us=; b=i4EwR1CEGWZqAO4CWu+i4YxDrBD4bpwP6hI5UwAJoBaBFU8MSiQ00pSh ctjHSKScIG7dv/PJEPgP9PSymyf6ewdmmT1Jsen5VhvdkrzXlDPdgyss7 6yFnO5zQzaO22yrZwz5ewnKCTqtutxwKfyAsDbX7as/zAV6DuTeb8EaYB WtuXG38W/e+5S9OgtE/ugnBQ53IA3MuaMm84sdyfB/K3AnsaNHeQAzstA JQlnQY8E6s5Yq7DnsY0Me8ZS4UCnQXt+mG9U7+Jsv9X/HusSz6L/afr/i N9VcEnByo4j32bQIh2rsVUzoDnOkBfWS1bN4avSiTLfiZOvqqPL3Clwbr w==; X-IronPort-AV: E=McAfee;i="6200,9189,10243"; a="247208532" X-IronPort-AV: E=Sophos;i="5.88,330,1635231600"; d="scan'208";a="247208532" Received: from orsmga006.jf.intel.com ([10.7.209.51]) by orsmga102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 31 Jan 2022 02:57:26 -0800 X-IronPort-AV: E=Sophos;i="5.88,330,1635231600"; d="scan'208";a="481712993" Received: from ylian16-mobl1.ccr.corp.intel.com (HELO localhost) ([10.252.16.100]) by orsmga006-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 31 Jan 2022 02:57:19 -0800 From: Jani Nikula To: Daniel Vetter , Yong Wu Cc: David Airlie , Liviu Dudau , dri-devel@lists.freedesktop.org, Sebastian Reichel , Srinivas Kandagatla , Laurent Pinchart , Will Deacon , Krzysztof Kozlowski , Joerg Roedel , 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 , iommu@lists.linux-foundation.org, Robin Murphy Subject: Re: [RFC PATCH] component: Add common helpers for compare/release functions In-Reply-To: Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo References: <20220128081101.27837-1-yong.wu@mediatek.com> Date: Mon, 31 Jan 2022 12:57:16 +0200 Message-ID: <878ruww4tv.fsf@intel.com> MIME-Version: 1.0 Content-Type: text/plain Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, 28 Jan 2022, Daniel Vetter wrote: > On Fri, Jan 28, 2022 at 04:11:01PM +0800, Yong Wu wrote: >> The component requires the compare/release functions, there are so many >> copy in current kernel. Just define three common helpers for them. >> No functional change. >> >> Signed-off-by: Yong Wu >> --- >> Base on v5.17-rc1 >> --- >> .../gpu/drm/arm/display/komeda/komeda_drv.c | 5 ----- >> drivers/gpu/drm/arm/hdlcd_drv.c | 7 +------ >> drivers/gpu/drm/armada/armada_drv.c | 5 ----- >> drivers/gpu/drm/drm_of.c | 8 +------- >> drivers/gpu/drm/etnaviv/etnaviv_drv.c | 7 ------- >> drivers/gpu/drm/exynos/exynos_drm_drv.c | 5 ----- >> .../gpu/drm/hisilicon/kirin/kirin_drm_drv.c | 5 ----- >> drivers/gpu/drm/imx/imx-drm-core.c | 4 ++-- >> drivers/gpu/drm/ingenic/ingenic-drm-drv.c | 5 ----- >> drivers/gpu/drm/mcde/mcde_drv.c | 7 +------ >> drivers/gpu/drm/mediatek/mtk_drm_drv.c | 5 ----- >> drivers/gpu/drm/meson/meson_drv.c | 8 -------- >> drivers/gpu/drm/msm/msm_drv.c | 9 --------- >> drivers/gpu/drm/omapdrm/dss/dss.c | 8 +------- >> drivers/gpu/drm/rockchip/rockchip_drm_drv.c | 5 ----- >> drivers/gpu/drm/sti/sti_drv.c | 5 ----- >> drivers/gpu/drm/sun4i/sun4i_drv.c | 9 --------- >> drivers/gpu/drm/vc4/vc4_drv.c | 5 ----- >> drivers/iommu/mtk_iommu.h | 10 ---------- >> drivers/power/supply/ab8500_charger.c | 8 +------- >> drivers/video/fbdev/omap2/omapfb/dss/dss.c | 8 +------- >> include/linux/component.h | 18 ++++++++++++++++++ >> sound/soc/codecs/wcd938x.c | 16 ++-------------- > > Seems like a neat idea. Please add kerneldoc for the new functions you're > adding (bonus point for an example in there) and make sure it all renders > correctly in > > $ make htmldoc > > Also please split up the patch series per-driver and add the maintainers > to each patches' Cc: list. With that I think this should be ready for > merging. Aren't the function names perhaps a bit short and generic for the global namespace though? If you encounter compare_of, release_of, or compare_dev in code, component.h is not where you'd expect to find them. BR, Jani. >> 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; >> +} >> + >> +static inline void release_of(struct device *dev, void *data) >> +{ >> + of_node_put(data); >> +} >> + >> +static inline int compare_dev(struct device *dev, void *data) >> +{ >> + return dev == data; >> +} >> + >> void component_master_del(struct device *, >> const struct component_master_ops *); >> -- Jani Nikula, Intel Open Source Graphics Center 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 smtp3.osuosl.org (smtp3.osuosl.org [140.211.166.136]) (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 4BFCEC433F5 for ; Mon, 31 Jan 2022 10:57:32 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp3.osuosl.org (Postfix) with ESMTP id DCC6660C2D; Mon, 31 Jan 2022 10:57:31 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp3.osuosl.org ([127.0.0.1]) by localhost (smtp3.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id zaWb6BfntIO2; Mon, 31 Jan 2022 10:57:31 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [IPv6:2605:bc80:3010:104::8cd3:938]) by smtp3.osuosl.org (Postfix) with ESMTPS id 9CD5B60BD6; Mon, 31 Jan 2022 10:57:30 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id 6B0B5C0011; Mon, 31 Jan 2022 10:57:30 +0000 (UTC) Received: from smtp2.osuosl.org (smtp2.osuosl.org [IPv6:2605:bc80:3010::133]) by lists.linuxfoundation.org (Postfix) with ESMTP id 92B00C000B for ; Mon, 31 Jan 2022 10:57:28 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp2.osuosl.org (Postfix) with ESMTP id 71B8440566 for ; Mon, 31 Jan 2022 10:57:28 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Authentication-Results: smtp2.osuosl.org (amavisd-new); dkim=pass (2048-bit key) header.d=intel.com Received: from smtp2.osuosl.org ([127.0.0.1]) by localhost (smtp2.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id S9YGC9NGdfDR for ; Mon, 31 Jan 2022 10:57:27 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.8.0 Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by smtp2.osuosl.org (Postfix) with ESMTPS id 86B62404EB for ; Mon, 31 Jan 2022 10:57:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1643626647; x=1675162647; h=from:to:cc:subject:in-reply-to:references:date: message-id:mime-version; bh=ZdENkAwNTJtD0Npkluazkuj5//kfgKoLfVNh1OSJ8Us=; b=G2/f5EW9iabG8hkLAMWkBLrSworB1oiqC0mWyrlHLic7ucEfKFE8GZDf jn+UgvFk3KtjFvKBsFi6fvld9O7qbi92U7Ix7X9wGm9b9v7NLax5TX/ZI /u0ugDbx6sEv9uCqIBMRpXrTZWqz81N0kCgjWmg+SA/+HPnKuEAxybO+J xesfwdCYp2uikVee7I4rIbiqXNauwB0CS0hCdXL0OyIxgwg4CYxavRXG7 UpSxvxqaQgbFUHflifk4zPsxGFqrDEnzRICMr6bHUdd/8sGzsvbFGYECL 3/k0DsElVt0mqbIWv9/DmiEOdIRgB05BnSjS/6cLTfQlbc99dv/Yymtpa Q==; X-IronPort-AV: E=McAfee;i="6200,9189,10243"; a="333795281" X-IronPort-AV: E=Sophos;i="5.88,330,1635231600"; d="scan'208";a="333795281" Received: from orsmga006.jf.intel.com ([10.7.209.51]) by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 31 Jan 2022 02:57:26 -0800 X-IronPort-AV: E=Sophos;i="5.88,330,1635231600"; d="scan'208";a="481712993" Received: from ylian16-mobl1.ccr.corp.intel.com (HELO localhost) ([10.252.16.100]) by orsmga006-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 31 Jan 2022 02:57:19 -0800 From: Jani Nikula To: Daniel Vetter , Yong Wu Subject: Re: [RFC PATCH] component: Add common helpers for compare/release functions In-Reply-To: Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo References: <20220128081101.27837-1-yong.wu@mediatek.com> Date: Mon, 31 Jan 2022 12:57:16 +0200 Message-ID: <878ruww4tv.fsf@intel.com> MIME-Version: 1.0 Cc: David Airlie , Liviu Dudau , dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, 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 , Sebastian Reichel , iommu@lists.linux-foundation.org, Robin Murphy 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: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: iommu-bounces@lists.linux-foundation.org Sender: "iommu" On Fri, 28 Jan 2022, Daniel Vetter wrote: > On Fri, Jan 28, 2022 at 04:11:01PM +0800, Yong Wu wrote: >> The component requires the compare/release functions, there are so many >> copy in current kernel. Just define three common helpers for them. >> No functional change. >> >> Signed-off-by: Yong Wu >> --- >> Base on v5.17-rc1 >> --- >> .../gpu/drm/arm/display/komeda/komeda_drv.c | 5 ----- >> drivers/gpu/drm/arm/hdlcd_drv.c | 7 +------ >> drivers/gpu/drm/armada/armada_drv.c | 5 ----- >> drivers/gpu/drm/drm_of.c | 8 +------- >> drivers/gpu/drm/etnaviv/etnaviv_drv.c | 7 ------- >> drivers/gpu/drm/exynos/exynos_drm_drv.c | 5 ----- >> .../gpu/drm/hisilicon/kirin/kirin_drm_drv.c | 5 ----- >> drivers/gpu/drm/imx/imx-drm-core.c | 4 ++-- >> drivers/gpu/drm/ingenic/ingenic-drm-drv.c | 5 ----- >> drivers/gpu/drm/mcde/mcde_drv.c | 7 +------ >> drivers/gpu/drm/mediatek/mtk_drm_drv.c | 5 ----- >> drivers/gpu/drm/meson/meson_drv.c | 8 -------- >> drivers/gpu/drm/msm/msm_drv.c | 9 --------- >> drivers/gpu/drm/omapdrm/dss/dss.c | 8 +------- >> drivers/gpu/drm/rockchip/rockchip_drm_drv.c | 5 ----- >> drivers/gpu/drm/sti/sti_drv.c | 5 ----- >> drivers/gpu/drm/sun4i/sun4i_drv.c | 9 --------- >> drivers/gpu/drm/vc4/vc4_drv.c | 5 ----- >> drivers/iommu/mtk_iommu.h | 10 ---------- >> drivers/power/supply/ab8500_charger.c | 8 +------- >> drivers/video/fbdev/omap2/omapfb/dss/dss.c | 8 +------- >> include/linux/component.h | 18 ++++++++++++++++++ >> sound/soc/codecs/wcd938x.c | 16 ++-------------- > > Seems like a neat idea. Please add kerneldoc for the new functions you're > adding (bonus point for an example in there) and make sure it all renders > correctly in > > $ make htmldoc > > Also please split up the patch series per-driver and add the maintainers > to each patches' Cc: list. With that I think this should be ready for > merging. Aren't the function names perhaps a bit short and generic for the global namespace though? If you encounter compare_of, release_of, or compare_dev in code, component.h is not where you'd expect to find them. BR, Jani. >> 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; >> +} >> + >> +static inline void release_of(struct device *dev, void *data) >> +{ >> + of_node_put(data); >> +} >> + >> +static inline int compare_dev(struct device *dev, void *data) >> +{ >> + return dev == data; >> +} >> + >> void component_master_del(struct device *, >> const struct component_master_ops *); >> -- Jani Nikula, Intel Open Source Graphics Center _______________________________________________ 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 30087C433F5 for ; Mon, 31 Jan 2022 10:57:39 +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:Message-ID:Date:References :In-Reply-To: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=io5PJbQ1CSuaECxo3XzAWd0Hsme1+DosLaSj3N6E2CI=; b=HjQIK/Lvh7qopl TtYB3ytllL2GUsxVDaT1h7S+8oDzLbigodb8x+so38E0vSi25Y/F6dsTeNMQQHEmRsTpdD48vmF+i gUi4WbLvxr2dRPdhp08gWZXOJ35YwiXmoGuLxqRfQpRGHznyZbnw+zU3IQG8agCOvlE4P7NWQ5lZW 9t04cnmhd8vk2Y4/gFr5Omkovu1oLY6mGVcw7dfDecnrWjEyE9r1qfPgf1Nx8J69O4JaPyDzbAbkD saEnv6TSyEPFfPjwVkqvC/a6M4e6PGaAdXkpjBTw/cWo+Qu5PU9AyfNCHuT36apE84KOZnQ8Kj60b n8QXQHTjCPiH+3jJNkfg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nEUNH-008xvI-M4; Mon, 31 Jan 2022 10:57:31 +0000 Received: from mga12.intel.com ([192.55.52.136]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1nEUNF-008xtf-2h; Mon, 31 Jan 2022 10:57:30 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1643626649; x=1675162649; h=from:to:cc:subject:in-reply-to:references:date: message-id:mime-version; bh=ZdENkAwNTJtD0Npkluazkuj5//kfgKoLfVNh1OSJ8Us=; b=juQuVowaK2BDCSttta/HQfP7FdGVfA4z0Lh6ZyV/13wlffPhUvson1b6 p0h4h8WMO1OYXnU6hvAhSbB1lezfJKrDoknAO9fd/obs/PYpIonBzS3dV HAFpwjsyVex9aqKLCGKpKekmKFL5pxw+joBafwFRrMIt7rJOjYzdU4PJC Zxy3QND1GEUxdDTb8ZYdxBXRx/mmrZceIKVTDYRCm+LFqtJ06/gH2U7dP BPu3VDlrTCBwBcegk6kqITlRcTWeqls0e13mYppF5Lnz/4g//oxEWHD8M jXPvcckwSg9RsIE2vh/atkxwCwYj9/5Fvq6JFXhQF/qZl9lbBa71wDKT0 Q==; X-IronPort-AV: E=McAfee;i="6200,9189,10243"; a="227408507" X-IronPort-AV: E=Sophos;i="5.88,330,1635231600"; d="scan'208";a="227408507" Received: from orsmga006.jf.intel.com ([10.7.209.51]) by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 31 Jan 2022 02:57:27 -0800 X-IronPort-AV: E=Sophos;i="5.88,330,1635231600"; d="scan'208";a="481712993" Received: from ylian16-mobl1.ccr.corp.intel.com (HELO localhost) ([10.252.16.100]) by orsmga006-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 31 Jan 2022 02:57:19 -0800 From: Jani Nikula To: Daniel Vetter , Yong Wu Cc: David Airlie , Liviu Dudau , dri-devel@lists.freedesktop.org, Sebastian Reichel , Srinivas Kandagatla , Laurent Pinchart , Will Deacon , Krzysztof Kozlowski , Joerg Roedel , 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 , iommu@lists.linux-foundation.org, Robin Murphy Subject: Re: [RFC PATCH] component: Add common helpers for compare/release functions In-Reply-To: Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo References: <20220128081101.27837-1-yong.wu@mediatek.com> Date: Mon, 31 Jan 2022 12:57:16 +0200 Message-ID: <878ruww4tv.fsf@intel.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220131_025729_167489_9F5A9A3B X-CRM114-Status: GOOD ( 19.36 ) 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, 28 Jan 2022, Daniel Vetter wrote: > On Fri, Jan 28, 2022 at 04:11:01PM +0800, Yong Wu wrote: >> The component requires the compare/release functions, there are so many >> copy in current kernel. Just define three common helpers for them. >> No functional change. >> >> Signed-off-by: Yong Wu >> --- >> Base on v5.17-rc1 >> --- >> .../gpu/drm/arm/display/komeda/komeda_drv.c | 5 ----- >> drivers/gpu/drm/arm/hdlcd_drv.c | 7 +------ >> drivers/gpu/drm/armada/armada_drv.c | 5 ----- >> drivers/gpu/drm/drm_of.c | 8 +------- >> drivers/gpu/drm/etnaviv/etnaviv_drv.c | 7 ------- >> drivers/gpu/drm/exynos/exynos_drm_drv.c | 5 ----- >> .../gpu/drm/hisilicon/kirin/kirin_drm_drv.c | 5 ----- >> drivers/gpu/drm/imx/imx-drm-core.c | 4 ++-- >> drivers/gpu/drm/ingenic/ingenic-drm-drv.c | 5 ----- >> drivers/gpu/drm/mcde/mcde_drv.c | 7 +------ >> drivers/gpu/drm/mediatek/mtk_drm_drv.c | 5 ----- >> drivers/gpu/drm/meson/meson_drv.c | 8 -------- >> drivers/gpu/drm/msm/msm_drv.c | 9 --------- >> drivers/gpu/drm/omapdrm/dss/dss.c | 8 +------- >> drivers/gpu/drm/rockchip/rockchip_drm_drv.c | 5 ----- >> drivers/gpu/drm/sti/sti_drv.c | 5 ----- >> drivers/gpu/drm/sun4i/sun4i_drv.c | 9 --------- >> drivers/gpu/drm/vc4/vc4_drv.c | 5 ----- >> drivers/iommu/mtk_iommu.h | 10 ---------- >> drivers/power/supply/ab8500_charger.c | 8 +------- >> drivers/video/fbdev/omap2/omapfb/dss/dss.c | 8 +------- >> include/linux/component.h | 18 ++++++++++++++++++ >> sound/soc/codecs/wcd938x.c | 16 ++-------------- > > Seems like a neat idea. Please add kerneldoc for the new functions you're > adding (bonus point for an example in there) and make sure it all renders > correctly in > > $ make htmldoc > > Also please split up the patch series per-driver and add the maintainers > to each patches' Cc: list. With that I think this should be ready for > merging. Aren't the function names perhaps a bit short and generic for the global namespace though? If you encounter compare_of, release_of, or compare_dev in code, component.h is not where you'd expect to find them. BR, Jani. >> 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; >> +} >> + >> +static inline void release_of(struct device *dev, void *data) >> +{ >> + of_node_put(data); >> +} >> + >> +static inline int compare_dev(struct device *dev, void *data) >> +{ >> + return dev == data; >> +} >> + >> void component_master_del(struct device *, >> const struct component_master_ops *); >> -- Jani Nikula, Intel Open Source Graphics Center _______________________________________________ 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 1B272C433F5 for ; Mon, 31 Jan 2022 10:57:29 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 3ED7710E38F; Mon, 31 Jan 2022 10:57:28 +0000 (UTC) Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by gabe.freedesktop.org (Postfix) with ESMTPS id 6690810E38F for ; Mon, 31 Jan 2022 10:57:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1643626647; x=1675162647; h=from:to:cc:subject:in-reply-to:references:date: message-id:mime-version; bh=ZdENkAwNTJtD0Npkluazkuj5//kfgKoLfVNh1OSJ8Us=; b=G2/f5EW9iabG8hkLAMWkBLrSworB1oiqC0mWyrlHLic7ucEfKFE8GZDf jn+UgvFk3KtjFvKBsFi6fvld9O7qbi92U7Ix7X9wGm9b9v7NLax5TX/ZI /u0ugDbx6sEv9uCqIBMRpXrTZWqz81N0kCgjWmg+SA/+HPnKuEAxybO+J xesfwdCYp2uikVee7I4rIbiqXNauwB0CS0hCdXL0OyIxgwg4CYxavRXG7 UpSxvxqaQgbFUHflifk4zPsxGFqrDEnzRICMr6bHUdd/8sGzsvbFGYECL 3/k0DsElVt0mqbIWv9/DmiEOdIRgB05BnSjS/6cLTfQlbc99dv/Yymtpa Q==; X-IronPort-AV: E=McAfee;i="6200,9189,10243"; a="246272067" X-IronPort-AV: E=Sophos;i="5.88,330,1635231600"; d="scan'208";a="246272067" Received: from orsmga006.jf.intel.com ([10.7.209.51]) by fmsmga104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 31 Jan 2022 02:57:26 -0800 X-IronPort-AV: E=Sophos;i="5.88,330,1635231600"; d="scan'208";a="481712993" Received: from ylian16-mobl1.ccr.corp.intel.com (HELO localhost) ([10.252.16.100]) by orsmga006-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 31 Jan 2022 02:57:19 -0800 From: Jani Nikula To: Daniel Vetter , Yong Wu Subject: Re: [RFC PATCH] component: Add common helpers for compare/release functions In-Reply-To: Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo References: <20220128081101.27837-1-yong.wu@mediatek.com> Date: Mon, 31 Jan 2022 12:57:16 +0200 Message-ID: <878ruww4tv.fsf@intel.com> MIME-Version: 1.0 Content-Type: text/plain 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 , dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, Srinivas Kandagatla , Laurent Pinchart , Will Deacon , Krzysztof Kozlowski , Joerg Roedel , 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 , Sebastian Reichel , Tomasz Figa , iommu@lists.linux-foundation.org, Robin Murphy Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" On Fri, 28 Jan 2022, Daniel Vetter wrote: > On Fri, Jan 28, 2022 at 04:11:01PM +0800, Yong Wu wrote: >> The component requires the compare/release functions, there are so many >> copy in current kernel. Just define three common helpers for them. >> No functional change. >> >> Signed-off-by: Yong Wu >> --- >> Base on v5.17-rc1 >> --- >> .../gpu/drm/arm/display/komeda/komeda_drv.c | 5 ----- >> drivers/gpu/drm/arm/hdlcd_drv.c | 7 +------ >> drivers/gpu/drm/armada/armada_drv.c | 5 ----- >> drivers/gpu/drm/drm_of.c | 8 +------- >> drivers/gpu/drm/etnaviv/etnaviv_drv.c | 7 ------- >> drivers/gpu/drm/exynos/exynos_drm_drv.c | 5 ----- >> .../gpu/drm/hisilicon/kirin/kirin_drm_drv.c | 5 ----- >> drivers/gpu/drm/imx/imx-drm-core.c | 4 ++-- >> drivers/gpu/drm/ingenic/ingenic-drm-drv.c | 5 ----- >> drivers/gpu/drm/mcde/mcde_drv.c | 7 +------ >> drivers/gpu/drm/mediatek/mtk_drm_drv.c | 5 ----- >> drivers/gpu/drm/meson/meson_drv.c | 8 -------- >> drivers/gpu/drm/msm/msm_drv.c | 9 --------- >> drivers/gpu/drm/omapdrm/dss/dss.c | 8 +------- >> drivers/gpu/drm/rockchip/rockchip_drm_drv.c | 5 ----- >> drivers/gpu/drm/sti/sti_drv.c | 5 ----- >> drivers/gpu/drm/sun4i/sun4i_drv.c | 9 --------- >> drivers/gpu/drm/vc4/vc4_drv.c | 5 ----- >> drivers/iommu/mtk_iommu.h | 10 ---------- >> drivers/power/supply/ab8500_charger.c | 8 +------- >> drivers/video/fbdev/omap2/omapfb/dss/dss.c | 8 +------- >> include/linux/component.h | 18 ++++++++++++++++++ >> sound/soc/codecs/wcd938x.c | 16 ++-------------- > > Seems like a neat idea. Please add kerneldoc for the new functions you're > adding (bonus point for an example in there) and make sure it all renders > correctly in > > $ make htmldoc > > Also please split up the patch series per-driver and add the maintainers > to each patches' Cc: list. With that I think this should be ready for > merging. Aren't the function names perhaps a bit short and generic for the global namespace though? If you encounter compare_of, release_of, or compare_dev in code, component.h is not where you'd expect to find them. BR, Jani. >> 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; >> +} >> + >> +static inline void release_of(struct device *dev, void *data) >> +{ >> + of_node_put(data); >> +} >> + >> +static inline int compare_dev(struct device *dev, void *data) >> +{ >> + return dev == data; >> +} >> + >> void component_master_del(struct device *, >> const struct component_master_ops *); >> -- Jani Nikula, Intel Open Source Graphics Center 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 DEFF6C433EF for ; Mon, 31 Jan 2022 10:58:47 +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:Message-ID:Date:References :In-Reply-To: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=YYT29z9/l+7inygI6OjhSfcBWPLRjLsiWdZKxOZSgjQ=; b=O+3jH4L5bG9EcQ VgALVfXPAXau29vUhuB7wpztFHS7m9tmKJBRc/BGAYVCJaVybhmU/587t/MofG8453QKKenT2JuaK 0ZDWAwNqmw9sCsOxtuaUvyno5UE0NSKeB9iQ2eZA0IgszyFr/ihpTLRvgXodWNEn+yPXxW2YRs05E MhXyhNv2+QJkfkKIKPQRJwtsPNQuBqtS5KJaHHCgdawQBIzQpFNlPO6szx/2GjmVK5nBWPhHd0eyQ tjLaYNoV68jjimCFxQwgqJC4d4MlhO/klaRZKciTHmNuUgNyGx+9STj/cl+oUPUO1jtAk21pAb9Wl F5qWtOIrm6X8aerQBpwA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nEUNJ-008xvV-Mj; Mon, 31 Jan 2022 10:57:33 +0000 Received: from mga12.intel.com ([192.55.52.136]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1nEUNF-008xtf-2h; Mon, 31 Jan 2022 10:57:30 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1643626649; x=1675162649; h=from:to:cc:subject:in-reply-to:references:date: message-id:mime-version; bh=ZdENkAwNTJtD0Npkluazkuj5//kfgKoLfVNh1OSJ8Us=; b=juQuVowaK2BDCSttta/HQfP7FdGVfA4z0Lh6ZyV/13wlffPhUvson1b6 p0h4h8WMO1OYXnU6hvAhSbB1lezfJKrDoknAO9fd/obs/PYpIonBzS3dV HAFpwjsyVex9aqKLCGKpKekmKFL5pxw+joBafwFRrMIt7rJOjYzdU4PJC Zxy3QND1GEUxdDTb8ZYdxBXRx/mmrZceIKVTDYRCm+LFqtJ06/gH2U7dP BPu3VDlrTCBwBcegk6kqITlRcTWeqls0e13mYppF5Lnz/4g//oxEWHD8M jXPvcckwSg9RsIE2vh/atkxwCwYj9/5Fvq6JFXhQF/qZl9lbBa71wDKT0 Q==; X-IronPort-AV: E=McAfee;i="6200,9189,10243"; a="227408507" X-IronPort-AV: E=Sophos;i="5.88,330,1635231600"; d="scan'208";a="227408507" Received: from orsmga006.jf.intel.com ([10.7.209.51]) by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 31 Jan 2022 02:57:27 -0800 X-IronPort-AV: E=Sophos;i="5.88,330,1635231600"; d="scan'208";a="481712993" Received: from ylian16-mobl1.ccr.corp.intel.com (HELO localhost) ([10.252.16.100]) by orsmga006-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 31 Jan 2022 02:57:19 -0800 From: Jani Nikula To: Daniel Vetter , Yong Wu Cc: David Airlie , Liviu Dudau , dri-devel@lists.freedesktop.org, Sebastian Reichel , Srinivas Kandagatla , Laurent Pinchart , Will Deacon , Krzysztof Kozlowski , Joerg Roedel , 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 , iommu@lists.linux-foundation.org, Robin Murphy Subject: Re: [RFC PATCH] component: Add common helpers for compare/release functions In-Reply-To: Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo References: <20220128081101.27837-1-yong.wu@mediatek.com> Date: Mon, 31 Jan 2022 12:57:16 +0200 Message-ID: <878ruww4tv.fsf@intel.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220131_025729_167489_9F5A9A3B X-CRM114-Status: GOOD ( 19.36 ) 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, 28 Jan 2022, Daniel Vetter wrote: > On Fri, Jan 28, 2022 at 04:11:01PM +0800, Yong Wu wrote: >> The component requires the compare/release functions, there are so many >> copy in current kernel. Just define three common helpers for them. >> No functional change. >> >> Signed-off-by: Yong Wu >> --- >> Base on v5.17-rc1 >> --- >> .../gpu/drm/arm/display/komeda/komeda_drv.c | 5 ----- >> drivers/gpu/drm/arm/hdlcd_drv.c | 7 +------ >> drivers/gpu/drm/armada/armada_drv.c | 5 ----- >> drivers/gpu/drm/drm_of.c | 8 +------- >> drivers/gpu/drm/etnaviv/etnaviv_drv.c | 7 ------- >> drivers/gpu/drm/exynos/exynos_drm_drv.c | 5 ----- >> .../gpu/drm/hisilicon/kirin/kirin_drm_drv.c | 5 ----- >> drivers/gpu/drm/imx/imx-drm-core.c | 4 ++-- >> drivers/gpu/drm/ingenic/ingenic-drm-drv.c | 5 ----- >> drivers/gpu/drm/mcde/mcde_drv.c | 7 +------ >> drivers/gpu/drm/mediatek/mtk_drm_drv.c | 5 ----- >> drivers/gpu/drm/meson/meson_drv.c | 8 -------- >> drivers/gpu/drm/msm/msm_drv.c | 9 --------- >> drivers/gpu/drm/omapdrm/dss/dss.c | 8 +------- >> drivers/gpu/drm/rockchip/rockchip_drm_drv.c | 5 ----- >> drivers/gpu/drm/sti/sti_drv.c | 5 ----- >> drivers/gpu/drm/sun4i/sun4i_drv.c | 9 --------- >> drivers/gpu/drm/vc4/vc4_drv.c | 5 ----- >> drivers/iommu/mtk_iommu.h | 10 ---------- >> drivers/power/supply/ab8500_charger.c | 8 +------- >> drivers/video/fbdev/omap2/omapfb/dss/dss.c | 8 +------- >> include/linux/component.h | 18 ++++++++++++++++++ >> sound/soc/codecs/wcd938x.c | 16 ++-------------- > > Seems like a neat idea. Please add kerneldoc for the new functions you're > adding (bonus point for an example in there) and make sure it all renders > correctly in > > $ make htmldoc > > Also please split up the patch series per-driver and add the maintainers > to each patches' Cc: list. With that I think this should be ready for > merging. Aren't the function names perhaps a bit short and generic for the global namespace though? If you encounter compare_of, release_of, or compare_dev in code, component.h is not where you'd expect to find them. BR, Jani. >> 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; >> +} >> + >> +static inline void release_of(struct device *dev, void *data) >> +{ >> + of_node_put(data); >> +} >> + >> +static inline int compare_dev(struct device *dev, void *data) >> +{ >> + return dev == data; >> +} >> + >> void component_master_del(struct device *, >> const struct component_master_ops *); >> -- Jani Nikula, Intel Open Source Graphics Center _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel