lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20080620061345.GA9339@gundam.enneenne.com>
Date:	Fri, 20 Jun 2008 08:13:45 +0200
From:	Rodolfo Giometti <giometti@...eenne.com>
To:	Anton Vorontsov <cbouatmailru@...il.com>
Cc:	linux-kernel@...r.kernel.org, Anton Vorontsov <cbou@...l.ru>,
	David Woodhouse <dwmw2@...radead.org>
Subject: Re: [PATCH] power: support for Texas Instruments BQ27x00 battery
	managers.

Hello,

before answering to other questions I'd like solve the following
issue.

On Fri, Jun 20, 2008 at 03:34:11AM +0400, Anton Vorontsov wrote:

> To avoid these ifdefs, I would suggest you to reconsider the model
> of this driver. How about:
> 
> - drivers/power/bq27x00_battery.c:
> 
>   Registers two platform_drivers, first is "bq27200-bat" (I2C) and
>   second is "bq27000-bat" (W1). Both are using the same probe and
>   remove methods. This driver will simply register power_supply
>   and will do all battery logic, separated from the underlaying
>   bus.
> 
>   (Two platform drivers are used simply because underlaying
>   I2C/W1 drivers will not know each other, thus will not able to
>   pass uniqe platform_device.id in case of single driver).
> 
> - include/linux/bq27x00-battery.h:
> 
>   Declares
>   struct bq27x00_access_methods {
>   	/*
> 	 * dev argument is I2C or W1 device, battery driver will use
> 	 * platform_device->dev.parent to pass the dev argument.
> 	 */
> 	int (*read)(struct device *dev, u8 reg, int *rt_value, int b_single);
>   };

Where this function should be defined? Can you explain better what you
mean?

> 
> - drivers/i2c/chips/bq27200.c:
> 
>   This driver will do all I2C stuff, and then will register
>   "bq27200-bat" platform device, with .platform_data pointed
>   to the allocated and filled "struct bq27x00_access_methods".
> 
> - drivers/w1/slaves/bq27000.c:
> 
>   This driver will do all W1 stuff, and then will register
>   "bq27000-bat" platform device, with .platform_data pointed
>   to the allocated and filled "struct bq27x00_access_methods".
> 
> Will this (not) work?

As you can see at the top of the file I based this work an previour
work by Texas Instruments people which never goes into linux vanilla
but lives into linux-omap tree. I just fixed some basic issue which
prevent the driver to compile and work properly and repropose the
driver here.

My hardware just uses the I2C chip version so I cannot test the W1 one
at all. If you agree I can remove the W1 code and provide the
bq27200.c driver only.

Maybe, as you suggested above, we can try to write the code in order
that a future W1 driver writer can write few lines. :)

Ciao,

Rodolfo

-- 

GNU/Linux Solutions                  e-mail: giometti@...eenne.com
Linux Device Driver                          giometti@...ux.it
Embedded Systems                     phone:  +39 349 2432127
UNIX programming                     skype:  rodolfo.giometti
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ