From: nicolas.ferre@atmel.com (Nicolas Ferre)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 1/3] ARM: at91: dt: add header to define at_hdmac configuration
Date: Tue, 4 Jun 2013 15:17:45 +0200 [thread overview]
Message-ID: <51ADE8F9.7090200@atmel.com> (raw)
In-Reply-To: <20130603073226.GG11384@ludovic.desroches@atmel.com>
On 03/06/2013 09:32, Ludovic Desroches :
> On Fri, May 31, 2013 at 11:30:29PM +0200, Arnd Bergmann wrote:
>> On Thursday 30 May 2013, ludovic.desroches at atmel.com wrote:
>>> +/*
>>> + * Source and/or destination peripheral ID
>>> + */
>>> +#define AT91_DMA_CFG_PER_ID_MASK (0xff)
>>> +#define AT91_DMA_CFG_PER_ID(id) (id & AT91_DMA_CFG_PER_ID_MASK)
>>> +
>>
>> I'm a little worried about macros like this one spreading in the name
>> of readability, and I don't see this as actual value-add here:
>>
>> The output of the macro is always the same as the input, and passing
>> an invalid number still results in an invalid output and no error message,
>> it actually prevents us from warning about the mistake at run-time.
>>
>
> You are right, this macro is here only for readability in order to not have
> something like this:
>
> dmas = <&dma0 AT91_DMA_CFG_FIFOCFG_ASAP | 13>
>
> In this case, I prefer having a macro instead of using a numeric value which
> can stand for other things than the peripheral id and which could conflict
> with other parameters such as the FIFO configuration.
>
> If adding this macro is really an issue, it could be removed of course but
> in this case I am in favor of readability.
Arnd,
I think that the case highlighted by Ludovic is indeed a case where
someone can be confused by the presentation of data in the cell... even
if I like the use of macro as implemented by Ludovic, I do not have a
strong opinion about this.
Best regards,
--
Nicolas Ferre
WARNING: multiple messages have this Message-ID (diff)
From: Nicolas Ferre <nicolas.ferre-AIFe0yeh4nAAvxtiuMwx3w@public.gmane.org>
To: Arnd Bergmann <arnd-r2nGTMty4D4@public.gmane.org>,
linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org,
devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.org,
vinod.koul-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org,
plagnioj-sclMFOaUSTBWk0Htik3J/w@public.gmane.org
Subject: Re: [PATCH 1/3] ARM: at91: dt: add header to define at_hdmac configuration
Date: Tue, 4 Jun 2013 15:17:45 +0200 [thread overview]
Message-ID: <51ADE8F9.7090200@atmel.com> (raw)
In-Reply-To: <20130603073226.GG11384-tOglhBvtKaELqBSMlTbpHvU/3Eu2kcEP@public.gmane.org@atmel.com>
On 03/06/2013 09:32, Ludovic Desroches :
> On Fri, May 31, 2013 at 11:30:29PM +0200, Arnd Bergmann wrote:
>> On Thursday 30 May 2013, ludovic.desroches-AIFe0yeh4nAAvxtiuMwx3w@public.gmane.org wrote:
>>> +/*
>>> + * Source and/or destination peripheral ID
>>> + */
>>> +#define AT91_DMA_CFG_PER_ID_MASK (0xff)
>>> +#define AT91_DMA_CFG_PER_ID(id) (id & AT91_DMA_CFG_PER_ID_MASK)
>>> +
>>
>> I'm a little worried about macros like this one spreading in the name
>> of readability, and I don't see this as actual value-add here:
>>
>> The output of the macro is always the same as the input, and passing
>> an invalid number still results in an invalid output and no error message,
>> it actually prevents us from warning about the mistake at run-time.
>>
>
> You are right, this macro is here only for readability in order to not have
> something like this:
>
> dmas = <&dma0 AT91_DMA_CFG_FIFOCFG_ASAP | 13>
>
> In this case, I prefer having a macro instead of using a numeric value which
> can stand for other things than the peripheral id and which could conflict
> with other parameters such as the FIFO configuration.
>
> If adding this macro is really an issue, it could be removed of course but
> in this case I am in favor of readability.
Arnd,
I think that the case highlighted by Ludovic is indeed a case where
someone can be confused by the presentation of data in the cell... even
if I like the use of macro as implemented by Ludovic, I do not have a
strong opinion about this.
Best regards,
--
Nicolas Ferre
next prev parent reply other threads:[~2013-06-04 13:17 UTC|newest]
Thread overview: 39+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-05-30 16:08 [PATCH 0/3] at_hdmac: dt dma bindings update ludovic.desroches at atmel.com
2013-05-30 16:08 ` ludovic.desroches
2013-05-30 16:08 ` [PATCH 1/3] ARM: at91: dt: add header to define at_hdmac configuration ludovic.desroches at atmel.com
2013-05-30 16:08 ` ludovic.desroches
2013-05-31 21:30 ` Arnd Bergmann
2013-05-31 21:30 ` Arnd Bergmann
2013-06-03 7:32 ` Ludovic Desroches
[not found] ` <201305312330.29364.arnd-r2nGTMty4D4@public.gmane.org>
2013-06-03 7:32 ` Ludovic Desroches
2013-06-03 7:32 ` Ludovic Desroches
2013-06-04 13:17 ` Nicolas Ferre [this message]
2013-06-04 13:17 ` Nicolas Ferre
2013-05-30 16:08 ` [PATCH 2/3] ARM: at91: dt: switch DMA DT bindings to pre-processor ludovic.desroches at atmel.com
2013-05-30 16:08 ` ludovic.desroches
2013-05-30 16:08 ` [PATCH 3/3] at_hdmac: add FIFO configuration parameter to DMA DT binding ludovic.desroches at atmel.com
2013-05-30 16:08 ` ludovic.desroches
2013-05-30 16:32 ` Nicolas Ferre
2013-05-30 16:32 ` Nicolas Ferre
2013-05-30 16:39 ` Jean-Christophe PLAGNIOL-VILLARD
2013-05-30 16:39 ` Jean-Christophe PLAGNIOL-VILLARD
[not found] ` <20130530163936.GC23653-RQcB7r2h9QmfDR2tN2SG5Ni2O/JbrIOy@public.gmane.org>
2013-05-31 9:16 ` Ludovic Desroches
2013-05-31 9:16 ` Ludovic Desroches
2013-05-31 9:31 ` Nicolas Ferre
2013-05-31 9:31 ` Nicolas Ferre
2013-05-31 15:11 ` Jean-Christophe PLAGNIOL-VILLARD
2013-05-31 15:11 ` Jean-Christophe PLAGNIOL-VILLARD
2013-05-31 23:11 ` Olof Johansson
2013-05-31 23:11 ` Olof Johansson
2013-06-03 7:39 ` Ludovic Desroches
2013-06-03 7:39 ` Ludovic Desroches
[not found] ` <CAOesGMhQetZfyzMpCax63xoRqtRW2ZRXt04MCbgCT-CcvUq43A-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2013-06-03 7:39 ` Ludovic Desroches
2013-05-31 9:16 ` Ludovic Desroches
2013-05-30 16:37 ` [PATCH 0/3] at_hdmac: dt dma bindings update Jean-Christophe PLAGNIOL-VILLARD
2013-05-30 16:37 ` Jean-Christophe PLAGNIOL-VILLARD
2013-05-30 17:26 ` Vinod Koul
2013-05-30 17:26 ` Vinod Koul
2013-05-30 20:13 ` Jean-Christophe PLAGNIOL-VILLARD
2013-05-30 20:13 ` Jean-Christophe PLAGNIOL-VILLARD
2013-05-31 8:04 ` Nicolas Ferre
2013-05-31 8:04 ` Nicolas Ferre
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=51ADE8F9.7090200@atmel.com \
--to=nicolas.ferre@atmel.com \
--cc=linux-arm-kernel@lists.infradead.org \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.