lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CACvgo52xB0KwumC75u2dxfz_yv2PNE0Gem+0t8dqV9qn+pPRLg@mail.gmail.com>
Date:	Fri, 27 May 2016 10:24:57 +0100
From:	Emil Velikov <emil.l.velikov@...il.com>
To:	YT Shen <yt.shen@...iatek.com>
Cc:	CK Hu <ck.hu@...iatek.com>,
	ML dri-devel <dri-devel@...ts.freedesktop.org>,
	Philipp Zabel <p.zabel@...gutronix.de>,
	Rob Herring <robh+dt@...nel.org>,
	Pawel Moll <pawel.moll@....com>,
	Mark Rutland <mark.rutland@....com>,
	Ian Campbell <ijc+devicetree@...lion.org.uk>,
	Kumar Gala <galak@...eaurora.org>,
	Russell King <linux@....linux.org.uk>,
	David Airlie <airlied@...ux.ie>,
	Matthias Brugger <matthias.bgg@...il.com>,
	Mao Huang <littlecvr@...omium.org>,
	Bibby Hsieh <bibby.hsieh@...iatek.com>,
	devicetree <devicetree@...r.kernel.org>,
	"Linux-Kernel@...r. Kernel. Org" <linux-kernel@...r.kernel.org>,
	LAKML <linux-arm-kernel@...ts.infradead.org>,
	linux-mediatek@...ts.infradead.org, srv_heupstream@...iatek.com,
	Sascha Hauer <kernel@...gutronix.de>,
	Yingjoe Chen <yingjoe.chen@...iatek.com>
Subject: Re: [RFC v2 3/5] drm/mediatek: add *driver_data for different
 hardware settings

On 27 May 2016 at 08:31, YT Shen <yt.shen@...iatek.com> wrote:
> Hi CK,
>
>
> On Mon, 2016-05-23 at 17:43 +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.
> OK, I'll do this in the next version.

Also preserve the const-ness of the data - don't cast it away on the
return line.
Note that the function return type (and some of the users of said
functions) should be updated as well.

-Emil

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ