public inbox for linux-omap@vger.kernel.org
 help / color / mirror / Atom feed
From: Felipe Balbi <me@felipebalbi.com>
To: Anton Vorontsov <avorontsov@ru.mvista.com>
Cc: Felipe Balbi <felipe.balbi@nokia.com>,
	linux-omap@vger.kernel.org, Anton Vorontsov <cbou@mail.ru>,
	David Woodhouse <dwmw2@infradead.org>
Subject: Re: [PATCH 0/4] bq27x00 updates
Date: Sun, 19 Oct 2008 01:23:43 +0300	[thread overview]
Message-ID: <20081018222338.GT31842@frodo> (raw)
In-Reply-To: <20081018211643.GA1272@oksana.dev.rtsoft.ru>

On Sun, Oct 19, 2008 at 01:16:43AM +0400, Anton Vorontsov wrote:
> On Sat, Oct 18, 2008 at 12:00:44AM +0300, Felipe Balbi wrote:
> > The previous driver for bq27x00 batteries was a real
> > ifdef mess. The following patches separate common code
> > and create separate drivers for bq27200 and bq27000.
> 
> FYI (if you don't know already): Rodolfo Giometti already
> cleaned up bq27200 part of that driver and submitted it few
> months ago.

Didn't know that. Good to know by the way. In any case I think Copyright
Texas Instruments should be kept as is and not like Rodolfo wrote:

"Based on a previous work by Copyright (C) 2008 Texas Instruments, Inc."

since he's not really writing new driver from scratch but only cleaning
up an existing one that still sits in linux-omap tree.

In any case, that's what you get when you don't push your drivers upstream,
right ?? :-p

Hopefully TI will start pushing their code upstream and this kind of
issue will vanish.

> http://lkml.org/lkml/2008/6/18/154
> 
> It will appear in the 2.6.28 kernel. For now it lives here:
> 
> http://git.infradead.org/battery-2.6.git?a=commitdiff;h=b996ad0e9fb15ca4acc60bcd0380912117a45d13
> 
> So I'd be happy if you could just rework it to support
> bq27000 (w1) interface as well.

Sure, but I'll only take a look at that after it falls into mainline.
And btw, I don't have access to bq27000, only bq27200, so don't know if
I'm gonna be the best person to put down that code since I can only
build test.

> > The code looks much cleaner, but we had to keep a global
> > static pointer to hold the i2c_client (bq27200) or the
> > w1 device (bq27000).
> 
> Yeah, this is not great...

What I was trying to do, actually, is to provide a generic structure for
bq27200 and bq27000 and another device specific which would hold the
bus-related hooks (basically a pointer to i2c_client or a pointer to
the w1 dev).

Turned out that would be way too complicated for such a simple driver.

> Can you consider this idea
> http://kerneltrap.org/mailarchive/linux-kernel/2008/6/23/2198444
> ?
> 
> It shows only i2c part, but the idea should be clear:
> there should be w1 and i2c drivers, both would create bq27x00
> platform devices, then the platform driver would not depend on
> any hw interface.

That looks good, but please don't add new stuff to drivers/i2c/chips.
That directory is schedule to vanish asap. Also, I think bq27x00.h
should not site in include/linux since it's not really related to the
kernel as a whole.

Sure you need the access method, but that structure is initialized by
bq27200.c or bq27000.c; better would be to move bq27200.c into
drivers/power and make bq27x00.h sit inside drivers/power as well.

Also, this line is wrong:

+	di->bus = platform_get_drvdata(pdev);

di->bus will get initialized by di again. The correct would be:

di->bus = pdev->dev.platform_data;

another point is that I suppose that goto idr_try_again should have a
max_tries hook to prevent that code from looping unconditionally if we
can't get new IDR (for some reason).

-- 
balbi

  reply	other threads:[~2008-10-18 22:24 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-10-17 21:00 [PATCH 0/4] bq27x00 updates Felipe Balbi
2008-10-17 21:00 ` [PATCH 1/4] power_supply: bq27x00: separate common code Felipe Balbi
2008-10-17 21:00   ` [PATCH 2/4] power_supply: bq27200: separate bq27200-specific driver Felipe Balbi
2008-10-17 21:00     ` [PATCH 3/4] power_supply: bq27200: separate bq27000-specific driver Felipe Balbi
2008-10-17 21:00       ` [PATCH 4/4] power_supply: bq27x00: get rid of old code Felipe Balbi
2008-10-18 21:46     ` [PATCH 2/4] power_supply: bq27200: separate bq27200-specific driver Anton Vorontsov
2008-10-18 22:34       ` Felipe Balbi
2008-10-18 21:36   ` [PATCH 1/4] power_supply: bq27x00: separate common code Anton Vorontsov
2008-10-18 22:29     ` Felipe Balbi
2008-10-18 23:53       ` Anton Vorontsov
2008-10-17 21:40 ` [PATCH 0/4] bq27x00 updates Anton Vorontsov
2008-10-17 21:45   ` Felipe Balbi
2008-10-18 21:16 ` Anton Vorontsov
2008-10-18 22:23   ` Felipe Balbi [this message]
2008-10-18 23:47     ` 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=20081018222338.GT31842@frodo \
    --to=me@felipebalbi.com \
    --cc=avorontsov@ru.mvista.com \
    --cc=cbou@mail.ru \
    --cc=dwmw2@infradead.org \
    --cc=felipe.balbi@nokia.com \
    --cc=linux-omap@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