"Nori, Sekhar" <[email protected]> writes:

> On Fri, May 07, 2010 at 03:55:36, Kevin Hilman wrote:
>> Sekhar Nori <[email protected]> writes:
>>
>> > In the edma driver some if statememnts are broken up such that
>> > the condition code is at the same indentation level as the
>> > statement block. This makes reading it particularly difficult.
>> >
>> > This patch fixes that issue.
>> >
>> > Signed-off-by: Sekhar Nori <[email protected]>
>>
>> Hmm, I'm with Sergei on this one...
>>
>> > ---
>> >  arch/arm/mach-davinci/dma.c |   26 +++++++++++++-------------
>> >  1 files changed, 13 insertions(+), 13 deletions(-)
>> >
>> > diff --git a/arch/arm/mach-davinci/dma.c b/arch/arm/mach-davinci/dma.c
>> > index cc5fcda..2734de9 100644
>> > --- a/arch/arm/mach-davinci/dma.c
>> > +++ b/arch/arm/mach-davinci/dma.c
>> > @@ -330,7 +330,7 @@ static int irq2ctlr(int irq)
>> >     if (irq >= edma_cc[0]->irq_res_start && irq <= edma_cc[0]->irq_res_end)
>> >             return 0;
>> >     else if (irq >= edma_cc[1]->irq_res_start &&
>> > -           irq <= edma_cc[1]->irq_res_end)
>> > +                           irq <= edma_cc[1]->irq_res_end)
>>
>> I much prefer the former style.  IMO, all that's needed here is adding
>> one space on the 2nd line so both 'irq's align.
>>
>> In Emacs with (c-set-style "linux"), just hitting TAB to get
>> indentation will get you this style, without having to worry about
>> tabs/spaces etc.
>
> Hmm, I thought using spaces for indentation was expressly disallowed
> in Documentation/CodingStyle. From Chapter 1:
>
> "
> Outside of comments, documentation and except in Kconfig, spaces are never
> used for indentation, and the above example is deliberately broken.
> "
>
> Am I misinterpreting something?

I've never seen any hard rule on this, but what seems to be the
standard is that TABs are always used for the main indent levels, but
it is common practice to use TABS and optionally some spaces to fine
tune the kinds of vertical alignment we've been discussing in this patch.

I'm a blind user of Emacs' (c-set-style "linux") and so I haven't
thought about this for awhile.  I imagine there is a vim equivalent as
well.

Below is an excerpt from my .emacs that turns on this mode everytime I
open a C file.

Kevin


;; Editing C code
(defun linux-c-mode ()
  "C mode with adjusted defaults for use with the Linux kernel."
  (c-set-style "linux")
  )

(add-hook 'c-mode-hook 'linux-c-mode)
_______________________________________________
Davinci-linux-open-source mailing list
[email protected]
http://linux.davincidsp.com/mailman/listinfo/davinci-linux-open-source

Reply via email to