From mboxrd@z Thu Jan 1 00:00:00 1970 From: Stephen Warren Date: Sun, 04 Nov 2012 10:15:28 -0700 Subject: [U-Boot] [PATCH 1/2] mmc: add bcm2835 driver In-Reply-To: <20121104163232.2bb93c5d@lilith> References: <1351054248-5604-1-git-send-email-swarren@wwwdotorg.org> <508A7510.4040106@gmail.com> <508CA64C.8090601@wwwdotorg.org> <508D6611.1040409@gmail.com> <20121104163232.2bb93c5d@lilith> Message-ID: <5096A2B0.4030705@wwwdotorg.org> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de On 11/04/2012 08:32 AM, Albert ARIBAUD wrote: > Hi Stephen, > > On Sun, 28 Oct 2012 22:36:25 +0530, Vikram Narayanan > wrote: > >> On 10/28/2012 8:58 AM, Stephen Warren wrote: >>> On 10/26/2012 05:33 AM, Vikram Narayanan wrote: >>>> Some nitpicks. >>>> >>>> On 10/24/2012 10:20 AM, Stephen Warren wrote: >> >>>>> +static u8 bcm2835_sdhci_readb(struct sdhci_host *host, int reg) >>>>> +{ >>>>> + u32 val = bcm2835_sdhci_raw_readl(host, (reg& ~3)); >>>>> + val = val>> (reg<< 3& 0x18)& 0xff; >>>>> + >>>>> + return (u8)val; >>>>> +} >>>> >>>> Can the above used magics be made as macros? >>> >>> This code was taken directly from the downstream Linux kernel, so I >>> changed it as little as possible, to make comparisons easier. Still, if >>> people want I can certainly make it easier to understand the expression >>> a bit. >> >> Seems reasonable. >> >>> I don't think the issue is the magic numbers so much as understanding >>> what the expression does; the magic are obvious then. It's simply >>> extracting byte n from from a u32. Would the following be more obvious: >>> >>> byte_num = reg& 3; >>> byte_shift = bytenum * 8; >>> byte = (val>> byte_shift)& 0xff; >>> >>> ... and similar for the other functions? >> >> This looks better to me than the former. Thanks. > > Stephen, > > Does this mean there'll be a new version of this patch? > > Amicalement, Hopefully. I'm waiting on Signed-off-by lines from Oleksandr Tymoshenko and Dom Cobley (assuming they can provide them...) before I make this change and repost.