[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <1464772226.10410.28.camel@mtksdaap41>
Date: Wed, 1 Jun 2016 17:10:26 +0800
From: YT Shen <yt.shen@...iatek.com>
To: Thierry Reding <thierry.reding@...il.com>
CC: CK Hu <ck.hu@...iatek.com>, Mark Rutland <mark.rutland@....com>,
<devicetree@...r.kernel.org>,
Russell King <linux@....linux.org.uk>,
"Pawel Moll" <pawel.moll@....com>,
Ian Campbell <ijc+devicetree@...lion.org.uk>,
<emil.l.velikov@...il.com>, <linux-kernel@...r.kernel.org>,
<dri-devel@...ts.freedesktop.org>,
Mao Huang <littlecvr@...omium.org>,
<srv_heupstream@...iatek.com>, Rob Herring <robh+dt@...nel.org>,
<linux-mediatek@...ts.infradead.org>,
Kumar Gala <galak@...eaurora.org>,
Matthias Brugger <matthias.bgg@...il.com>,
<yingjoe.chen@...iatek.com>, Sascha Hauer <kernel@...gutronix.de>,
<linux-arm-kernel@...ts.infradead.org>
Subject: Re: [RFC v2 3/5] drm/mediatek: add *driver_data for different
hardware settings
Hi Thierry,
On Mon, 2016-05-30 at 12:45 +0200, Thierry Reding wrote:
> On Mon, May 23, 2016 at 05:43:02PM +0800, CK Hu wrote:
> > Hi, YT:
> >
> > One comment below.
> >
> > On Fri, 2016-05-20 at 23:05 +0800, yt.shen@...iatek.com wrote:
> > > From: YT Shen <yt.shen@...iatek.com>
> > >
> > > There are some hardware settings changed, between MT8173 & MT2701:
> > > DISP_OVL address offset changed, color format definition changed.
> > > DISP_RDMA fifo size changed.
> > > DISP_COLOR offset changed.
> > >
> > > Signed-off-by: YT Shen <yt.shen@...iatek.com>
> > > ---
> > > +
> > > +static inline struct mtk_ddp_comp_driver_data *mtk_ovl_get_driver_data(
> > > + struct platform_device *pdev)
> > > +{
> > > + const struct of_device_id *of_id =
> > > + of_match_device(mtk_disp_ovl_driver_dt_match, &pdev->dev);
> > > +
> > > + return (struct mtk_ddp_comp_driver_data *)of_id->data;
> > > +}
> > > +
> > > +static inline struct mtk_ddp_comp_driver_data *mtk_rdma_get_driver_data(
> > > + struct platform_device *pdev)
> > > +{
> > > + const struct of_device_id *of_id =
> > > + of_match_device(mtk_disp_rdma_driver_dt_match, &pdev->dev);
> > > +
> > > + return (struct mtk_ddp_comp_driver_data *)of_id->data;
> > > +}
> > > +
> > > +static inline struct mtk_ddp_comp_driver_data *mtk_color_get_driver_data(
> > > + struct device_node *node)
> > > +{
> > > + const struct of_device_id *of_id =
> > > + of_match_node(mtk_disp_color_driver_dt_match, node);
> > > +
> > > + return (struct mtk_ddp_comp_driver_data *)of_id->data;
> > > +}
> > > +
> >
> > These three functions looks the same with different parameter:
> > mtk_disp_ovl_driver_dt_match, mtk_disp_rdma_driver_dt_match, and
> > mtk_disp_color_driver_dt_match. So merge them to prevent duplicated
> > code.
>
> I think what you really want is of_device_get_match_data().
>
> Thierry
Great, that function is really what we need, thanks.
yt.shen
Powered by blists - more mailing lists