From: arno@natisbad.org (Arnaud Ebalard)
To: Andrew Morton <akpm@linux-foundation.org>
Cc: Mark Rutland <mark.rutland@arm.com>,
Alessandro Zummo <a.zummo@towertech.it>,
Jason Cooper <jason@lakedaemon.net>,
Pawel Moll <pawel.moll@arm.com>,
Stephen Warren <swarren@wwwdotorg.org>,
rtc-linux@googlegroups.com,
Linus Walleij <linus.walleij@linaro.org>,
Ian Campbell <ijc+devicetree@hellion.org.uk>,
linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org,
Rob Herring <rob.herring@calxeda.com>,
Jason Gunthorpe <jgunthorpe@obsidianresearch.com>,
devicetree@vger.kernel.org, Mark Brown <broonie@kernel.org>,
linux-arm-kernel@lists.infradead.org,
Rob Landley <rob@landley.net>, Kumar Gala <galak@codeaurora.org>,
Grant Likely <grant.likely@linaro.org>,
Peter Huewe <peter.huewe@infineon.com>,
Thierry Reding <treding@nvidia.com>,
Guenter Roeck <linux@roeck-us.net>
Subject: Re: [PATCHv7] rtc: Add support for Intersil ISL12057 I2C RTC chip
Date: Thu, 19 Dec 2013 23:22:56 +0100 [thread overview]
Message-ID: <87ob4c1nwf.fsf@natisbad.org> (raw)
In-Reply-To: <20131219140726.e7d7ccf765da9b6be0ac3fa5@linux-foundation.org> (Andrew Morton's message of "Thu, 19 Dec 2013 14:07:26 -0800")
Hi Andrew,
Andrew Morton <akpm@linux-foundation.org> writes:
> On Thu, 19 Dec 2013 22:53:16 +0100 Arnaud Ebalard <arno@natisbad.org> wrote:
>
>> +static int isl12057_i2c_validate_chip(struct regmap *regmap)
>> +{
>> + u8 regs[ISL12057_MEM_MAP_LEN];
>> + u8 mask[ISL12057_MEM_MAP_LEN] = { 0x80, 0x80, 0x80, 0xf8,
>> + 0xc0, 0x60, 0x00, 0x00,
>> + 0x00, 0x00, 0x00, 0x00,
>> + 0x00, 0x00, 0x60, 0x7c };
>> + int ret, i;
>> +
>> + ret = regmap_bulk_read(regmap, 0, regs, ISL12057_MEM_MAP_LEN);
>> + if (ret)
>> + return ret;
>> +
>> + for (i = 0; i < ISL12057_MEM_MAP_LEN; ++i) {
>> + if (regs[i] & mask[i]) /* check if bits are cleared */
>> + return -ENODEV;
>> + }
>> +
>> + return 0;
>> +}
>
> When I build this for x86_64, mask[] is assembled on-stack at runtime:
>
> leaq -48(%rbp), %r14 #, tmp130
> xorl %esi, %esi #
> movl $16, %ecx #,
> movq %rax, %rdi # regmap,
> incq .LPBX1+552(%rip) # *.LPBX1
> movb $-128, -64(%rbp) #, mask
> movq %r14, %rdx # tmp130,
> movb $-128, -63(%rbp) #, mask
> movb $-128, -62(%rbp) #, mask
> movb $-8, -61(%rbp) #, mask
> movb $-64, -60(%rbp) #, mask
> movb $96, -59(%rbp) #, mask
> movb $0, -58(%rbp) #, mask
> movb $0, -57(%rbp) #, mask
> movb $0, -56(%rbp) #, mask
> movb $0, -55(%rbp) #, mask
> movb $0, -54(%rbp) #, mask
> movb $0, -53(%rbp) #, mask
> movb $0, -52(%rbp) #, mask
> movb $0, -51(%rbp) #, mask
> movb $96, -50(%rbp) #, mask
> movb $124, -49(%rbp) #, mask
> call regmap_bulk_read #
>
> If we make `mask' static const, that all gets done at compile time instead:
>
> leaq -48(%rbp), %r14 #, tmp134
> xorl %esi, %esi #
> movl $16, %ecx #,
> movq %rax, %rdi # regmap,
> incq .LPBX1+552(%rip) # *.LPBX1
> movq %r14, %rdx # tmp134,
> call regmap_bulk_read #
>
> much nicer.
Damned. That's a good argument for a v8 ;-) Give me some minutes to
assemble one.
Cheers,
a+
prev parent reply other threads:[~2013-12-19 22:23 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <72207bc152a06638f0e0e21a6e00d4c2054a1a71.1387489507.git.arno@natisbad.org>
2013-12-19 22:07 ` Andrew Morton
2013-12-19 22:22 ` Arnaud Ebalard [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87ob4c1nwf.fsf@natisbad.org \
--to=arno@natisbad.org \
--cc=a.zummo@towertech.it \
--cc=akpm@linux-foundation.org \
--cc=broonie@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=galak@codeaurora.org \
--cc=grant.likely@linaro.org \
--cc=ijc+devicetree@hellion.org.uk \
--cc=jason@lakedaemon.net \
--cc=jgunthorpe@obsidianresearch.com \
--cc=linus.walleij@linaro.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-doc@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@roeck-us.net \
--cc=mark.rutland@arm.com \
--cc=pawel.moll@arm.com \
--cc=peter.huewe@infineon.com \
--cc=rob.herring@calxeda.com \
--cc=rob@landley.net \
--cc=rtc-linux@googlegroups.com \
--cc=swarren@wwwdotorg.org \
--cc=treding@nvidia.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Powered by JetHome