[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <878ruww4tv.fsf@intel.com>
Date: Mon, 31 Jan 2022 12:57:16 +0200
From: Jani Nikula <jani.nikula@...ux.intel.com>
To: Daniel Vetter <daniel@...ll.ch>, Yong Wu <yong.wu@...iatek.com>
Cc: David Airlie <airlied@...ux.ie>, Liviu Dudau <liviu.dudau@....com>,
dri-devel@...ts.freedesktop.org,
Sebastian Reichel <sre@...nel.org>,
Srinivas Kandagatla <srinivas.kandagatla@...aro.org>,
Laurent Pinchart <laurent.pinchart@...asonboard.com>,
Will Deacon <will@...nel.org>,
Krzysztof Kozlowski <krzysztof.kozlowski@...onical.com>,
Joerg Roedel <joro@...tes.org>,
James Wang <james.qian.wang@....com>,
Chun-Kuang Hu <chunkuang.hu@...nel.org>,
Arnd Bergmann <arnd@...db.de>,
linux-mediatek@...ts.infradead.org,
Hsin-Yi Wang <hsinyi@...omium.org>,
Matthias Brugger <matthias.bgg@...il.com>,
linux-arm-kernel@...ts.infradead.org,
AngeloGioacchino Del Regno
<angelogioacchino.delregno@...labora.com>,
srv_heupstream@...iatek.com, Stephen Boyd <sboyd@...nel.org>,
linux-kernel@...r.kernel.org, Tomasz Figa <tfiga@...omium.org>,
iommu@...ts.linux-foundation.org,
Robin Murphy <robin.murphy@....com>
Subject: Re: [RFC PATCH] component: Add common helpers for compare/release
functions
On Fri, 28 Jan 2022, Daniel Vetter <daniel@...ll.ch> 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 <yong.wu@...iatek.com>
>> ---
>> 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 <linux/device.h>
>> +#include <linux/of.h>
>> #include <linux/stddef.h>
>>
>>
>> @@ -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
Powered by blists - more mailing lists