public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Jeff Garzik <jeff@garzik.org>
To: cbou@mail.ru
Cc: Andrew Morton <akpm@linux-foundation.org>,
	LKML <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] pda_power: clean up irq, timer, return usage
Date: Sat, 14 Jul 2007 20:29:07 -0400	[thread overview]
Message-ID: <46996A53.6000807@garzik.org> (raw)
In-Reply-To: <20070715001515.GA3641@zarina>

Anton Vorontsov wrote:
> On Sat, Jul 14, 2007 at 07:12:04PM -0400, Jeff Garzik wrote:
>> Clean up pda_power interrupt handling:
> 
> Nice, thanks! Just few cosmetic comments.
> 
>> Prior to this patch, the driver would pass information it needed
>> to the interrupt handler dev_id pointer, and then prompt forget it
>> ever did so, recreating that same information after a couple passes
>> through the timer-based state machine.
>>
>> This patch removes the redundant checks by passing the
>> pda_power_supply[] pointer through the state machine.  The current
>> code passed 'irq' through the state machine, as an index to recreate
>> the pointer, when we could more simply pass around the pointer itself.
>>
>> Additionally, bogus "return;" statements were removed.
> 
> My preference is to use "return;" statements in functions returning
> void, even if functions is very small. It's just sugar for my eyes,
> to really see exit points. . Without returns I've feeling that
> something is missing there. Yes, my oddity.
> 
> Plus, so far CodingStyle does not say anything about non obligatory
> return statements.
> 
> These should be "fixed" too, though:
> ~/linux-2.6$ grep -h "return;" -A1 -r drivers/ arch/ | grep "^}$" | \
> wc -l
> 1354
> 
> Obviously, drivers/ata is almost pure (3). ;-)
> 
> Either way, I prefer to leave alone these "return;"s, until CodingStyle
> permits them.

CodingStyle is not the end-all of rulebooks.  See repeated messages by 
Linus, me, and others on the subject.  CodingStyle intentionally does 
not list a rule for every possible C code incarnation.

It's the general style to avoid these return statements in new code.  It 
makes the page longer, meaning less code to review.  It tends to trip up 
people making bombing runs through drivers, and searching for return 
statements in their favorite editor.

If you consider how many void functions there are in the kernel, 1354 is 
the obvious minority, being far smaller than "millions."  Please follow 
what -millions- of void functions already do in the kernel.


>> This patch makes it easier to remove the 'irq' argument in the future,
>> in addition to cleaning up the driver today.
>>
>> P.S.  Where are the MAINTAINERS entries for this driver, and
>> drivers/power in general?
> 
> I'll send patch shortly.
> 
>> +	void *power_supply = (void *) power_supply_ptr;
>                                      ^
> I guess common practice is not to put space here.

incorrect.  a space goes there, as I put it.


>> +	charger_timer.data = (unsigned long) power_supply;
> 
> And here.

ditto.


  reply	other threads:[~2007-07-15  0:29 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-07-14 23:12 [PATCH] pda_power: clean up irq, timer, return usage Jeff Garzik
2007-07-15  0:15 ` Anton Vorontsov
2007-07-15  0:29   ` Jeff Garzik [this message]
2007-07-15  1:43     ` [PATCH] pda_power: clean up irq, timer Anton Vorontsov
2007-07-15  1:45     ` [PATCH] Power supply class and drivers: remove non obligatory return statements Anton Vorontsov
2007-07-15  2:09       ` Jeff Garzik
2007-07-15  4:50     ` [PATCH] pda_power: clean up irq, timer, return usage Andrew Morton
2007-07-15  1:02 ` [PATCH] MAINTAINERS: Add maintainers for power supply subsystem and drivers (was [PATCH] pda_power: clean up irq, timer, return usage) Anton Vorontsov
2007-07-15  7:54   ` David Woodhouse

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=46996A53.6000807@garzik.org \
    --to=jeff@garzik.org \
    --cc=akpm@linux-foundation.org \
    --cc=cbou@mail.ru \
    --cc=linux-kernel@vger.kernel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox