From: Sebastian Reichel <sebastian.reichel@collabora.co.uk>
To: Liam Breck <liam@networkimprov.net>
Cc: Pali Rohar <pali.rohar@gmail.com>,
linux-pm@vger.kernel.org,
Enric Balletbo <enric.balletbo@collabora.com>,
Paul Kocialkowski <contact@paulk.fr>,
Quentin Schulz <quentin.schulz@free-electrons.com>,
Liam Breck <kernel@networkimprov.net>
Subject: Re: [PATCH v14 09/11] power: supply: bq27xxx: Enable data memory update for certain chips
Date: Thu, 15 Jun 2017 18:02:18 +0200 [thread overview]
Message-ID: <20170615160218.sq5jychjn7x2dhyq@earth> (raw)
In-Reply-To: <20170607183759.20261-10-liam@networkimprov.net>
[-- Attachment #1: Type: text/plain, Size: 2729 bytes --]
Hi,
On Wed, Jun 07, 2017 at 11:37:57AM -0700, Liam Breck wrote:
> static const struct i2c_device_id bq27xxx_i2c_id_table[] = {
> - { "bq27200", BQ27000 },
> - { "bq27210", BQ27010 },
> - { "bq27500", BQ2750X },
> - { "bq27510", BQ2751X },
> - { "bq27520", BQ2751X },
> - { "bq27500-1", BQ27500 },
> - { "bq27510g1", BQ27510G1 },
> - { "bq27510g2", BQ27510G2 },
> - { "bq27510g3", BQ27510G3 },
> - { "bq27520g1", BQ27520G1 },
> - { "bq27520g2", BQ27520G2 },
> - { "bq27520g3", BQ27520G3 },
> - { "bq27520g4", BQ27520G4 },
> - { "bq27530", BQ27530 },
> - { "bq27531", BQ27530 },
> - { "bq27541", BQ27541 },
> - { "bq27542", BQ27541 },
> - { "bq27546", BQ27541 },
> - { "bq27742", BQ27541 },
> - { "bq27545", BQ27545 },
> - { "bq27421", BQ27421 },
> - { "bq27425", BQ27421 },
> - { "bq27441", BQ27421 },
> - { "bq27621", BQ27421 },
> + /* dest. di->real_chip di->chip */
> + { "bq27200", (BQ27000 << 16) | BQ27000 },
> + { "bq27210", (BQ27010 << 16) | BQ27010 },
> + { "bq27500", (BQ2750X << 16) | BQ2750X },
> + { "bq27510", (BQ2751X << 16) | BQ2751X },
> + { "bq27520", (BQ2752X << 16) | BQ2751X },
> + { "bq27500-1", (BQ27500 << 16) | BQ27500 },
> + { "bq27510g1", (BQ27510G1 << 16) | BQ27510G1 },
> + { "bq27510g2", (BQ27510G2 << 16) | BQ27510G2 },
> + { "bq27510g3", (BQ27510G3 << 16) | BQ27510G3 },
> + { "bq27520g1", (BQ27520G1 << 16) | BQ27520G1 },
> + { "bq27520g2", (BQ27520G2 << 16) | BQ27520G2 },
> + { "bq27520g3", (BQ27520G3 << 16) | BQ27520G3 },
> + { "bq27520g4", (BQ27520G4 << 16) | BQ27520G4 },
> + { "bq27530", (BQ27530 << 16) | BQ27530 },
> + { "bq27531", (BQ27531 << 16) | BQ27530 },
> + { "bq27541", (BQ27541 << 16) | BQ27541 },
> + { "bq27542", (BQ27542 << 16) | BQ27541 },
> + { "bq27546", (BQ27546 << 16) | BQ27541 },
> + { "bq27742", (BQ27742 << 16) | BQ27541 },
> + { "bq27545", (BQ27545 << 16) | BQ27545 },
> + { "bq27421", (BQ27421 << 16) | BQ27421 },
> + { "bq27425", (BQ27425 << 16) | BQ27421 },
> + { "bq27441", (BQ27441 << 16) | BQ27421 },
> + { "bq27621", (BQ27621 << 16) | BQ27421 },
This is ugly. The proper way to do this is by providing a pointer
to a structure with all required information. E.g.:
static const struct bq27xxx_pdata chip_info_bq27530 {
.reg_layout = ®_info_bq27530,
.feature = false,
/* more stuff */
};
static const struct bq27xxx_pdata chip_info_bq27531 {
.reg_layout = ®_info_bq27530,
.feature = true,
/* more stuff */
};
/* ... */
static const struct i2c_device_id bq27xxx_i2c_id_table[] = {
/* ... */
{ "bq27530", &chip_info_bq27530 },
{ "bq27531", &chip_info_bq27531 },
/* ... */
}
-- Sebastian
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
next prev parent reply other threads:[~2017-06-15 16:02 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-06-07 18:37 [PATCH v14 00/11] devicetree simple-battery and client in bq27xxx_battery Liam Breck
2017-06-07 18:37 ` [PATCH v14 01/11] devicetree: property-units: Add uWh and uAh units Liam Breck
2017-06-07 18:37 ` [PATCH v14 02/11] dt-bindings: power: supply: Add battery.txt with simple-battery binding Liam Breck
2017-06-07 18:37 ` [PATCH v14 03/11] power: supply: core: Add power_supply_battery_info and API Liam Breck
2017-06-07 18:37 ` [PATCH v14 04/11] power: supply: core: Add power_supply_prop_precharge Liam Breck
2017-06-07 18:37 ` [PATCH v14 05/11] dt-bindings: power: supply: bq27xxx: Add monitored-battery documentation Liam Breck
2017-06-07 18:37 ` [PATCH v14 06/11] power: supply: bq27xxx: Add bulk transfer bus methods Liam Breck
2017-06-07 18:37 ` [PATCH v14 07/11] power: supply: bq27xxx: Add chip data memory read/write support Liam Breck
2017-06-07 18:37 ` [PATCH v14 08/11] power: supply: bq27xxx: Add power_supply_battery_info support Liam Breck
2017-06-07 18:37 ` [PATCH v14 09/11] power: supply: bq27xxx: Enable data memory update for certain chips Liam Breck
2017-06-15 16:02 ` Sebastian Reichel [this message]
2017-06-16 9:21 ` Liam Breck
2017-06-16 10:33 ` Sebastian Reichel
2017-06-16 11:32 ` Liam Breck
2017-06-21 20:55 ` Liam Breck
2017-07-03 16:48 ` Sebastian Reichel
2017-07-04 23:24 ` Liam Breck
2017-07-05 9:47 ` Sebastian Reichel
2017-07-05 17:49 ` Liam Breck
2017-07-06 6:06 ` Liam Breck
2017-06-07 18:37 ` [PATCH v14 10/11] power: supply: bq27xxx: Flag identical register maps when in debug mode Liam Breck
2017-06-15 16:06 ` Sebastian Reichel
2017-06-16 9:44 ` Liam Breck
2017-06-07 18:37 ` [PATCH v14 11/11] power: supply: bq27xxx: Remove duplicate register arrays Liam Breck
2017-06-08 16:42 ` [PATCH v14 00/11] devicetree simple-battery and client in bq27xxx_battery Sebastian Reichel
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=20170615160218.sq5jychjn7x2dhyq@earth \
--to=sebastian.reichel@collabora.co.uk \
--cc=contact@paulk.fr \
--cc=enric.balletbo@collabora.com \
--cc=kernel@networkimprov.net \
--cc=liam@networkimprov.net \
--cc=linux-pm@vger.kernel.org \
--cc=pali.rohar@gmail.com \
--cc=quentin.schulz@free-electrons.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