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: <CABuKBeJgmwtH4KjfxwPXgvO9Nwaz3o3ha7h99-VdtSNmQ80N5A@mail.gmail.com>
Date:	Thu, 21 May 2015 17:20:55 +0200
From:	Matthias Brugger <matthias.bgg@...il.com>
To:	Yong Wu <yong.wu@...iatek.com>
Cc:	Daniel Kurtz <djkurtz@...gle.com>,
	Rob Herring <robh+dt@...nel.org>,
	Joerg Roedel <joro@...tes.org>,
	Robin Murphy <robin.murphy@....com>,
	Will Deacon <will.deacon@....com>,
	Tomasz Figa <tfiga@...gle.com>,
	Lucas Stach <l.stach@...gutronix.de>,
	Mark Rutland <mark.rutland@....com>,
	Catalin Marinas <catalin.marinas@....com>,
	linux-mediatek@...ts.infradead.org,
	Sasha Hauer <kernel@...gutronix.de>,
	srv_heupstream <srv_heupstream@...iatek.com>,
	"devicetree@...r.kernel.org" <devicetree@...r.kernel.org>,
	"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
	"linux-arm-kernel@...ts.infradead.org" 
	<linux-arm-kernel@...ts.infradead.org>,
	"open list:IOMMU DRIVERS" <iommu@...ts.linux-foundation.org>,
	Paul Bolle <pebolle@...cali.nl>, Arnd Bergmann <arnd@...db.de>,
	mitchelh@...eaurora.org, k.zhang@...iatek.com,
	youhua.li@...iatek.com
Subject: Re: [PATCH v2 4/6] soc: mediatek: Add SMI driver

2015-05-21 16:49 GMT+02:00 Yong Wu <yong.wu@...iatek.com>:
> On Thu, 2015-05-21 at 22:33 +0800, Daniel Kurtz wrote:
>> On Thu, May 21, 2015 at 3:30 PM, Matthias Brugger
>> <matthias.bgg@...il.com> wrote:
>> > 2015-05-21 8:16 GMT+02:00 Yong Wu <yong.wu@...iatek.com>:
>> >> Hi Matthias,
>> >>      Thanks very much for your suggestion.
>> >>      Abort the smi clock name, Could you help check below.
>> >>      The others I will improve in next time.
>> >>
>> >> On Tue, 2015-05-19 at 13:14 +0200, Matthias Brugger wrote:
>> >>> 2015-05-15 11:43 GMT+02:00 Yong Wu <yong.wu@...iatek.com>:
>> >>> >     This patch add SMI(Smart Multimedia Interface) driver. This driver is
>> >>> > responsible to enable/disable iommu and control the clocks of each local arbiter.
>> >>> >
>> >> [snip]
>> >>> > +
>> >>> > +#define SMI_LARB_MMU_EN                (0xf00)
>> >>> > +#define F_SMI_MMU_EN(port)     (1 << (port))
>> >>> > +
>> >>> > +enum {
>> >>> > +       MTK_CLK_APB,
>> >>> > +       MTK_CLK_SMI,
>> >>> > +       MTK_CLK_MAX,
>> >>>
>> >>> Maybe add something like:
>> >>> MTK_CLK_FIRST = MTK_CLK_APB,
>> >>> to make the for loops better readable.
>> >>>
>> >> Then, Is it like this? :
>> >>  enum {
>> >>         MTK_CLK_FIRST = MTK_CLK_APB,
>> >>         MTK_CLK_SMI,
>> >>         MTK_CLK_MAX,
>> >>  }
>> >> or the CLK_SMI also need MTK_CLK_SECOND = MTK_CLK_SMI.
>> >
>> >
>> > something like:
>> > enum {
>> >          MTK_CLK_FIRST,
>> >          MTK_CLK_APB = MTK_CLK_FIRST,
>> >          MTK_CLK_SMI,
>> >          MTK_CLK_LAST,
>> > }
>> >
>> > So you can rewrite the for loop:
>> > if (i = MTK_CLK_FIRST; i < MTK_CLK_LAST; i++)
>>
>> Actually, do we ever plan to add more clks per smi node?
> No.
>> If not, perhaps the whole driver would be simpler if you just
>> explicitly handle the apb & smi clocks:
>>
>> struct mtk_smi_larb {
>>        void __iomem            *base;
>>        spinlock_t              portlock; /* lock for config port */
>>        struct device           *smi;
>>        struct clk              *clk_apb;
>>        struct clk              *clk_smi;
>> };
>>
>> And then all of the loops become just a pair of clock operations.
> Thanks. I will try this and compare whether it will add many lines.

If you don't plan to add more clocks in the future, then I think the
suggestion Dan made is the best one.

Regards,
Matthias
-- 
motzblog.wordpress.com
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ