Received: by 2002:a05:6a10:1a4d:0:0:0:0 with SMTP id nk13csp696575pxb; Tue, 1 Feb 2022 08:32:55 -0800 (PST) X-Google-Smtp-Source: ABdhPJxS+/c0byaD1i1ZEB/+5xrmtujO6F4FGNzqAiT6AFSerERNFC1c/dvg4A/99skFN14YSOnD X-Received: by 2002:a62:f207:: with SMTP id m7mr25552836pfh.44.1643733174878; Tue, 01 Feb 2022 08:32:54 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643733174; cv=none; d=google.com; s=arc-20160816; b=KfRa1lK/LKlzFq041aiuz8Ec4BiyWoZFjTkvketbgIXVSiKb1Qfy51O9Wt5OyN4rR5 Qd8tNBTz4zt9ZAaN0gTGzk7xd7IS2GUeIQgYMElZzKq3ga00Iw8YZo8ii7j9ea8XcBF4 niUc1KZ6YEtmZ8kiDyXg38pBbwkZCXqzZYfI2J0OzAZMRi0BUWKJlF4MgTKcFSlse+xs KzGwzbXSJxY/ioa3aMI7h011akandW3vSmdYZ0h4m8xOL1X4+ydcYEN/pBE9W2Mzz40H 8t8rY5dadBeUY5Q6kbiiSfPWy8iqLEcMj1Wu5neFAP1QI68wPtCadEFzhR6j9dWcj285 sMmA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:message-id:date:references :organization:in-reply-to:subject:cc:to:from:dkim-signature; bh=/EbAB10ULzR0S0ndYYeYWq0OqIDXZl/O6OkgISNRC2I=; b=qfriUrjrwa18O9Zlr78n6MWhubY3Xs9UcSh7wzP1IAuBkKxnjWMtUWLjFHHXaBdMRL 4H/0wFExaQZzVv8N2vzOCkyDClRHf7AFy8dh0hzsiL44Yt2nAdzPUeDvyPyZg7IS5dCO 8wB+op9LpySWpUT165Z6/3aJokMH360AlrqA5q+u1ZW9W8qlNcxwNEY44SFFyrBUx1LB 8Tg/5TrWvRqrvXP6JytgLw2aCRS5NtdwCt+1ET0PWOjCsO4ozig/OY0xAB5mZDn98FgX qDFbjOTFvdrVmcaQvnW5GyIaRNetlmATSsduUwOcY/tMOcXt6rNun0YBkIhic//yV44H Haew== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=i4EwR1CE; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id t69si7227031pgd.189.2022.02.01.08.32.41; Tue, 01 Feb 2022 08:32:54 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=i4EwR1CE; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239802AbiAaK5m (ORCPT + 99 others); Mon, 31 Jan 2022 05:57:42 -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