linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Lars-Peter Clausen <lars@metafoo.de>
To: Rhyland Klein <rklein@nvidia.com>
Cc: Anton Vorontsov <cbouatmailru@gmail.com>,
	"broonie@opensource.wolfsonmicro.com" 
	<broonie@opensource.wolfsonmicro.com>,
	Andrew Chew <AChew@nvidia.com>, "olof@lixom.net" <olof@lixom.net>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH v2] POWER: Add gpio charger driver
Date: Thu, 11 Nov 2010 02:33:47 +0100	[thread overview]
Message-ID: <4CDB47FB.1050004@metafoo.de> (raw)
In-Reply-To: <E88A1D35AF5437468E5B14C7C4BA61C702D41B4F4F@HQMAIL01.nvidia.com>

Rhyland Klein wrote:
>> From: Anton Vorontsov [mailto:cbouatmailru@gmail.com]
>> Sent: Thursday, November 04, 2010 10:48 AM
>> To: Rhyland Klein
>> Cc: Lars-Peter Clausen; broonie@opensource.wolfsonmicro.com; Andrew Chew;
>> olof@lixom.net; linux-kernel@vger.kernel.org
>> Subject: Re: [PATCH v2] POWER: Add gpio charger driver
>>
>> On Thu, Oct 28, 2010 at 02:17:41PM -0700, Rhyland Klein wrote:
>> [...]
>>>> Hm... I guess it can be, but on the other hand most platform bus
>> chargers
>>>> type
>>>> devices can be, because the pda_power driver is keep pretty generic
>> with
>>>> custom init,
>>>> status and exit callbacks.
>>>>
>>>> - Lars
>>> I didn't see any more discussion on this. Is the plan to integrate
>>> the gpio-charger driver as is or to instead try to integrate support
>>> for this into pda_power?
>> Sorry for the delayed response, and thanks for the pings! ;-)
>>
>> The main thing I'm afraid of is duplication. I.e. someday you
>> will want debouncing (include/linux/pda_power.h's wait_for_status,
>> wait_for_charger parameters) support, regulators support etc.
>>
>> And your gpio driver will look very similar to pda_power.
>>
>> So I'd vote for adding the GPIO functionality to pda_power, and
>> refactoring it if needed.
>>
>> Though, if there are strong objections against this idea, I
>> can merge the GPIO driver, and let's see how things will evolve.
>>
>> Thanks!
>>
>> --
>> Anton Vorontsov
>> email: cbouatmailru@gmail.com
>> irc://irc.freenode.net/bd2
> 
> My guess, is that since no one has responded, no one is working on integrating the functionality into pda-power?
> 
> -rhyland

hi

Well I'm still not convinced that both drivers should be merged, yet I'm not totally
opposed to it. In my opinion we are in some kind of dilemma here.
I can see Antons point regarding to introducing code duplication, but on the other
hand you'll always have code duplication amongst similar drivers. This will
especially stand out if the setup functions take up a relatively large part of the
whole code size.
One way to avoid this is by putting everything into one driver which handles all
different cases. But the next time yet another sort of similar driver comes along
another if-else-branch is added to the pda-power driver. And slowly over time things
will get messy.
Another option to solve the problem is to add another level of indirection. For
example in form of a simple_charger driver which will take callbacks for add, remove
and status. The gpio-charger and pda-power could then instantiate such a driver and
provide their callbacks. But by adding more and more levels of indirection things
will slowly get messy as well.
One solution that might could work is to provide library functions which aim at
providing aid for implementing (simple) charger drivers.

- Lars

  reply	other threads:[~2010-11-11  1:34 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-10-21  0:56 [PATCH v2] power: bq24617: Adding initial charger support rklein
2010-10-21 12:20 ` Lars-Peter Clausen
2010-10-21 12:25   ` [PATCH] POWER: Add gpio chager driver Lars-Peter Clausen
2010-10-21 12:43     ` Piotr Hosowicz
2010-10-21 14:53       ` Lars-Peter Clausen
2010-10-21 14:14     ` Anton Vorontsov
2010-10-21 14:52       ` Lars-Peter Clausen
2010-10-21 15:05         ` Anton Vorontsov
2010-10-21 17:22       ` Rhyland Klein
2010-10-21 15:55     ` [PATCH v2] POWER: Add gpio charger driver Lars-Peter Clausen
2010-10-21 16:00       ` Mark Brown
2010-10-21 16:16         ` Lars-Peter Clausen
2010-10-21 16:19           ` Mark Brown
2010-10-21 16:26       ` Anton Vorontsov
2010-10-21 17:47         ` Lars-Peter Clausen
2010-10-22 21:41           ` Rhyland Klein
2010-10-28 21:17           ` Rhyland Klein
2010-11-04 17:47             ` Anton Vorontsov
2010-11-11  0:53               ` Rhyland Klein
2010-11-11  1:33                 ` Lars-Peter Clausen [this message]
2010-11-11  1:46                   ` Rhyland Klein
2010-11-17  1:37                   ` Rhyland Klein
2010-11-18 14:05       ` Anton Vorontsov
2010-11-18 14:30         ` Lars-Peter Clausen
2010-11-18 14:42           ` Anton Vorontsov

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=4CDB47FB.1050004@metafoo.de \
    --to=lars@metafoo.de \
    --cc=AChew@nvidia.com \
    --cc=broonie@opensource.wolfsonmicro.com \
    --cc=cbouatmailru@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=olof@lixom.net \
    --cc=rklein@nvidia.com \
    /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;
as well as URLs for NNTP newsgroup(s).