lkml.org 
[lkml]   [2012]   [Mar]   [6]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRe: [PATCHv2 1/3] misc: clean up bmp085 driver
Date
On Tuesday 06 March 2012, Eric Andersson wrote:
> This patch includes various cleaning of the bmp085 driver including:
> - Addition of platform_data and header file
> - Implement pm functions
> - Whitespaces and alignment fixes
> - Minor typos
> - Consistency fixes
>
> Reviewed-by: Stefan Nilsson <stefan.nilsson@unixphere.com>
> Signed-off-by: Eric Andersson <eric.andersson@unixphere.com>

Most of the cleanups look good, just a few things that stick out:

> static int __devinit bmp085_probe(struct i2c_client *client,
> - const struct i2c_device_id *id)
> + const struct i2c_device_id *id)
> {
> struct bmp085_data *data;
> + struct bmp085_platform_data *pdata = client->dev.platform_data;
> + u8 chip_id = (pdata && pdata->chip_id) ? pdata->chip_id :
> + BMP085_CHIP_ID;
> int err = 0;
>
> + if (pdata && pdata->init_hw) {
> + err = pdata->init_hw(&client->dev);
> + if (err) {
> + dev_err(&client->dev, "%s: init_hw failed!\n",
> + BMP085_NAME);
> + return err;
> + }
> + }
> +

The addition of platform_data does not look like a cleanup to me,
it's a significant change in the interface to the platform, so I
would put it into a separate patch.

> + if (i2c_smbus_read_byte_data(client, BMP085_CHIP_ID_REG) != chip_id) {
> + dev_err(&client->dev, "%s: chip_id failed!\n", BMP085_NAME);
> + err = -ENODEV;
> + goto exit_free;
> + }
> +

This part looks like it belongs into the second patch where you add support
for more than one chip id.

> diff --git a/include/linux/i2c/bmp085.h b/include/linux/i2c/bmp085.h
> new file mode 100644
> index 0000000..e6fc752
> --- /dev/null
> +++ b/include/linux/i2c/bmp085.h

Since this file only adds platform_data, I think it should go into
include/linux/platform_data/, not include/linux/i2c, and it should
be in the same patch as the change to use the platform data when you
split that out.

Also, which platforms are actually using this driver? I could
not find any platform that defines a bmp085 platform_device. If this
is for new ARM platforms, I would rather not add platform_data at
all because those platforms will have to use device tree properties
rather than platform_data to pass initialization data.

Arnd


\
 
 \ /
  Last update: 2012-03-06 22:23    [W:0.094 / U:0.552 seconds]
©2003-2014 Jasper Spaans. Advertise on this site