[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <face7ccf80520ecad1b75f01f74314ddb483b88b.camel@mediatek.com>
Date: Thu, 10 Feb 2022 15:49:53 +0800
From: Yong Wu <yong.wu@...iatek.com>
To: Robin Murphy <robin.murphy@....com>,
<dri-devel@...ts.freedesktop.org>
CC: David Airlie <airlied@...ux.ie>, Daniel Vetter <daniel@...ll.ch>,
"James Wang" <james.qian.wang@....com>,
Liviu Dudau <liviu.dudau@....com>,
<iommu@...ts.linux-foundation.org>,
Matthias Brugger <matthias.bgg@...il.com>,
Krzysztof Kozlowski <krzysztof.kozlowski@...onical.com>,
<linux-kernel@...r.kernel.org>, "Joerg Roedel" <joro@...tes.org>,
Will Deacon <will@...nel.org>, Arnd Bergmann <arnd@...db.de>,
Laurent Pinchart <laurent.pinchart@...asonboard.com>,
<linux-mediatek@...ts.infradead.org>,
Chun-Kuang Hu <chunkuang.hu@...nel.org>,
<linux-arm-kernel@...ts.infradead.org>,
"Stephen Boyd" <sboyd@...nel.org>,
AngeloGioacchino Del Regno
<angelogioacchino.delregno@...labora.com>,
Hsin-Yi Wang <hsinyi@...omium.org>,
Tomasz Figa <tfiga@...omium.org>,
<srv_heupstream@...iatek.com>, Rob Clark <robdclark@...il.com>,
"Srinivas Kandagatla" <srinivas.kandagatla@...aro.org>,
Sebastian Reichel <sre@...nel.org>
Subject: Re: [RFC PATCH] component: Add common helpers for compare/release
functions
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 <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;
> > +}
>
> 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.
Powered by blists - more mailing lists