From: Jonathan Cameron <jic23@kernel.org>
To: Laurentiu Palcu <laurentiu.palcu@intel.com>,
Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>,
Joe Perches <joe@perches.com>
Cc: Hartmut Knaack <knaack.h@gmx.de>,
Lars-Peter Clausen <lars@metafoo.de>,
Peter Meerwald <pmeerw@pmeerw.net>,
linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v3 3/3] iio: accel: BMC150: add support for other Bosch chips
Date: Wed, 10 Sep 2014 20:32:54 +0100 [thread overview]
Message-ID: <5410A766.8020005@kernel.org> (raw)
In-Reply-To: <20140902103010.GF12606@lpalcu-linux>
On 02/09/14 11:30, Laurentiu Palcu wrote:
> On Mon, Sep 01, 2014 at 08:51:36AM -0700, Srinivas Pandruvada wrote:
>> On Mon, 2014-09-01 at 08:36 -0700, Joe Perches wrote:
>>> On Mon, 2014-09-01 at 12:11 +0300, Laurentiu Palcu wrote:
>>>> The following chips are either similar or have only the resolution
>>>> different. Hence, change this driver to support these chips too:
>>>>
>>>> BMI055 - combo chip (accelerometer part is identical to BMC150's)
>>>> BMA255 - identical to BMC150's accelerometer
>>>> BMA222E - 8 bit resolution
>>>> BMA250E - 10 bit resolution
>>>> BMA280 - 14 bit resolution
>>>>
>>>> Additionally:
>>>> * add bmc150_accel_match_acpi_device() function to check that the device
>>>> has been enumerated through ACPI;
>>>> * rename bmc150_accel_acpi_gpio_probe() to bmc150_accel_gpio_probe()
>>>> since the ACPI matching has been moved to the new function. Also, this
>>>> will allow for the GPIO matching to be done against a device tree too, not only
>>>> ACPI tree;
>>> []
>>>> diff --git a/drivers/iio/accel/bmc150-accel.c b/drivers/iio/accel/bmc150-accel.c
>>> []
>>>> @@ -647,12 +659,13 @@ static int bmc150_accel_read_raw(struct iio_dev *indio_dev,
>>>> {
>>>> int i;
>>>>
>>>> - for (i = 0; i < ARRAY_SIZE(bmc150_accel_scale_table);
>>>> - ++i) {
>>>> - if (bmc150_accel_scale_table[i].range ==
>>>> + for (i = 0;
>>>> + i < ARRAY_SIZE(data->chip_info->scale_table);
>>>> + ++i) {
>>>> + if (data->chip_info->scale_table[i].range ==
>>>> data->range) {
>>>> *val2 =
>>>> - bmc150_accel_scale_table[i].scale;
>>>> + data->chip_info->scale_table[i].scale;
>>>> return IIO_VAL_INT_PLUS_MICRO;
>>>> }
>>>> }
>>>
>>> This looks like it would read a lot better with
>>> a temporary for data->chip_info->scale_table[i]
>>>
>>> so these could become:
>>>
>>> for (i = 0; i < etc; i++) {
>>> type *temp = &data->chip_info->scale_table[i];
>>> if (temp->range == data->range) {
>>> *val2 = temp->scale;
>>> return IIO_VAL_INT_PLUS_MICRO;
>>> }
> Rewrote this part in v5. Thanks for the suggestion.
>
>>>
>>> Maybe all the bmc150_ variable names could be removed.
>>> The prefixes don't seem to serve a purpose other than
>>> to make the code longer.
>>>
>>> The filename could be changed to be more generic.
>> Then this will also require change in the CONFIG name to match. This
>> will require all current users to change the config file once they
>> update to new version of the driver, which they don't like to change
>> once product config is finalized. Since the most of the chips will just
>> differ by a number at the end and they may not be compatible to each
>> other, finding a common name will be challenge.
>> Instead the CONFIG description for this module should explicitly state
>> the names of chips it is compatible to.
> v5 contains the changed CONFIG description that includes the new added chips.
Agreed. Don't rename the driver. Now, if companies went with naming based on
the interface it might be a good idea. In reality it is a nightmare so much
better to keep to a name that covers one part and as you say, make it clear
in the Kconfig help what other parts are supported...
Jonathan
>
> thanks,
> laurentiu
>
prev parent reply other threads:[~2014-09-10 19:32 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-08-29 8:38 [PATCH v2 0/3] iio: accel: BMC150: add support for more Bosch chips Laurentiu Palcu
2014-08-29 8:38 ` [PATCH v2 1/3] iio: accel: BMC150: fix scale value for 16G Laurentiu Palcu
2014-08-30 10:36 ` Jonathan Cameron
2014-08-29 8:38 ` [PATCH v2 2/3] iio: accel: BMC150: fix issues when CONFIG_PM_RUNTIME is not set Laurentiu Palcu
2014-08-30 10:45 ` Jonathan Cameron
2014-09-01 9:24 ` Laurentiu Palcu
2014-08-29 8:38 ` [PATCH v2 3/3] iio: accel: BMC150: add support for other Bosch chips Laurentiu Palcu
2014-08-30 10:54 ` Jonathan Cameron
2014-09-01 9:11 ` [PATCH v3 " Laurentiu Palcu
2014-09-01 11:02 ` Peter Meerwald
2014-09-01 12:55 ` Laurentiu Palcu
2014-09-01 13:03 ` Laurentiu Palcu
2014-09-01 14:29 ` [PATCH v4 " Laurentiu Palcu
2014-09-02 9:30 ` [PATCH v5 " Laurentiu Palcu
2014-09-10 19:35 ` Jonathan Cameron
2014-09-10 19:43 ` Srinivas Pandruvada
2014-09-13 20:37 ` Jonathan Cameron
2014-09-01 15:36 ` [PATCH v3 " Joe Perches
2014-09-01 15:51 ` Srinivas Pandruvada
2014-09-02 10:30 ` Laurentiu Palcu
2014-09-10 19:32 ` Jonathan Cameron [this message]
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=5410A766.8020005@kernel.org \
--to=jic23@kernel.org \
--cc=joe@perches.com \
--cc=knaack.h@gmx.de \
--cc=lars@metafoo.de \
--cc=laurentiu.palcu@intel.com \
--cc=linux-iio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=pmeerw@pmeerw.net \
--cc=srinivas.pandruvada@linux.intel.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.