Re: sdio: parameterize SDIO FBR register defines

From: David Vrabel
Date: Mon Aug 06 2007 - 07:03:39 EST


Pierre Ossman wrote:
> On Tue, 31 Jul 2007 16:36:31 +0100
> David Vrabel <david.vrabel@xxxxxxx> wrote:
>
>> Signed-off-by: David Vrabel <david.vrabel@xxxxxxx>
>>
>> ---
>> commit 51755c3d59be1ba778bef45888f9f5e341dc4af4
>> tree c7bbb562b2d801197eefb619a17c94467c1299cd
>> parent 1cf0b6019aa3916197eecafe058bd2f3d700d24a
>> author David Vrabel <david.vrabel@xxxxxxx> Mon, 30 Jul 2007 19:20:59
>> +0100 committer David Vrabel <dvrabel@xxxxxxxxxx> Mon, 30 Jul 2007
>> 19:28:30 +0100
>>
>> drivers/mmc/core/sdio.c | 4 ++--
>> drivers/mmc/core/sdio_cis.c | 2 +-
>> include/linux/mmc/sdio.h | 16 +++++++++-------
>> 3 files changed, 12 insertions(+), 10 deletions(-)
>>
>> diff --git a/drivers/mmc/core/sdio.c b/drivers/mmc/core/sdio.c
>> index 6589fd6..08f579c 100644
>> --- a/drivers/mmc/core/sdio.c
>> +++ b/drivers/mmc/core/sdio.c
>> @@ -30,7 +30,7 @@ static int sdio_read_fbr(struct sdio_func *func)
>> unsigned char data;
>>
>> ret = mmc_io_rw_direct(func->card, 0, 0,
>> - func->num * 0x100 + SDIO_FBR_STD_IF, 0, &data);
>> + SDIO_FBR_STD_IF(func->num), 0, &data);
>> if (ret != MMC_ERR_NONE)
>> goto out;
>>
>
> I am a bit sceptical about these macros. Most i/o code in the kernel is
> in the form of "<base address> + <register offset>". For one thing,
> that model keeps the register defines clean and means people don't have
> to go reaching for specs all the time.

I really don't follow you objection to this. If one is maintaining the
SDIO core then I would expect some familiarity with the spec and an
understanding the FBRs are per-function but contained in the same
CCCR/F0 register space.

Also, I would consider the start of the CCCR as the "base address".

> Would you be content with replacing "func->num * 0x100" with a macro so
> that the code becomes something like:
>
> SDIO_FBR_BASE(func->num) + SDIO_FBR_STD_IF

I think this is less readable than SDIO_FBR_STD_IF(func->num).

David
--
David Vrabel, Software Engineer, Drivers group Tel: +44 (0)1223 692562
CSR plc, Churchill House, Cambridge Business Park, Cowley Road, CB4 0WZ


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