From: Jonathan Cameron <jic23@kernel.org>
To: Brian Masney <masneyb@onstation.org>
Cc: gregkh@linuxfoundation.org, linux-iio@vger.kernel.org,
devel@driverdev.osuosl.org
Subject: Re: [PATCH v2 2/8] staging: iio: isl29018: fix poorly named function
Date: Mon, 10 Oct 2016 21:33:28 +0100 [thread overview]
Message-ID: <82c1efb7-57e6-a3ba-2f68-059e94f02daa@kernel.org> (raw)
In-Reply-To: <1476084002-29683-3-git-send-email-masneyb@onstation.org>
On 10/10/16 08:19, Brian Masney wrote:
> isl29035_detect() did not do chip detection. Move functionality directly
> into isl29018_chip_init() to avoid naming confusion.
It kind of does do detection (or at least verification). Key point is that
it does other things as well.
I added the word 'just' to the description when applying.
Applied to the togreg branch of iio.git and pushed out as testing
for the autobuilders to play with it.
Thanks,
Jonathan
>
> Signed-off-by: Brian Masney <masneyb@onstation.org>
> ---
> drivers/staging/iio/light/isl29018.c | 44 ++++++++++++++++--------------------
> 1 file changed, 19 insertions(+), 25 deletions(-)
>
> diff --git a/drivers/staging/iio/light/isl29018.c b/drivers/staging/iio/light/isl29018.c
> index 26bbbb8..130f222 100644
> --- a/drivers/staging/iio/light/isl29018.c
> +++ b/drivers/staging/iio/light/isl29018.c
> @@ -529,30 +529,6 @@ static const struct attribute_group isl29023_group = {
> .attrs = isl29023_attributes,
> };
>
> -static int isl29035_detect(struct isl29018_chip *chip)
> -{
> - int status;
> - unsigned int id;
> - struct device *dev = regmap_get_device(chip->regmap);
> -
> - status = regmap_read(chip->regmap, ISL29035_REG_DEVICE_ID, &id);
> - if (status < 0) {
> - dev_err(dev,
> - "Error reading ID register with error %d\n",
> - status);
> - return status;
> - }
> -
> - id = (id & ISL29035_DEVICE_ID_MASK) >> ISL29035_DEVICE_ID_SHIFT;
> -
> - if (id != ISL29035_DEVICE_ID)
> - return -ENODEV;
> -
> - /* Clear brownout bit */
> - return regmap_update_bits(chip->regmap, ISL29035_REG_DEVICE_ID,
> - ISL29035_BOUT_MASK, 0);
> -}
> -
> enum {
> isl29018,
> isl29023,
> @@ -565,7 +541,25 @@ static int isl29018_chip_init(struct isl29018_chip *chip)
> struct device *dev = regmap_get_device(chip->regmap);
>
> if (chip->type == isl29035) {
> - status = isl29035_detect(chip);
> + unsigned int id;
> +
> + status = regmap_read(chip->regmap, ISL29035_REG_DEVICE_ID, &id);
> + if (status < 0) {
> + dev_err(dev,
> + "Error reading ID register with error %d\n",
> + status);
> + return status;
> + }
> +
> + id = (id & ISL29035_DEVICE_ID_MASK) >> ISL29035_DEVICE_ID_SHIFT;
> +
> + if (id != ISL29035_DEVICE_ID)
> + return -ENODEV;
> +
> + /* Clear brownout bit */
> + status = regmap_update_bits(chip->regmap,
> + ISL29035_REG_DEVICE_ID,
> + ISL29035_BOUT_MASK, 0);
> if (status < 0)
> return status;
> }
>
next prev parent reply other threads:[~2016-10-10 20:33 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-10-10 7:19 [PATCH v2 0/8] staging: iio: isl29018: move out of staging Brian Masney
2016-10-10 7:19 ` [PATCH v2 1/8] staging: iio: isl29018: add newlines to improve readability Brian Masney
2016-10-10 20:31 ` Jonathan Cameron
2016-10-10 7:19 ` [PATCH v2 2/8] staging: iio: isl29018: fix poorly named function Brian Masney
2016-10-10 20:33 ` Jonathan Cameron [this message]
2016-10-10 7:19 ` [PATCH v2 3/8] staging: iio: isl29018: fix multiline comment syntax Brian Masney
2016-10-10 20:34 ` Jonathan Cameron
2016-10-10 7:19 ` [PATCH v2 4/8] staging: iio: isl29018: combine two return statements into one Brian Masney
2016-10-10 20:53 ` Jonathan Cameron
2016-10-10 7:19 ` [PATCH v2 5/8] staging: iio: isl29018: remove blank line for consistency Brian Masney
2016-10-10 20:53 ` Jonathan Cameron
2016-10-10 7:20 ` [PATCH v2 6/8] staging: iio: isl29018: rename description in Kconfig " Brian Masney
2016-10-10 20:54 ` Jonathan Cameron
2016-10-10 7:20 ` [PATCH v2 7/8] staging: iio: isl29018: add ABI documentation for infrared suppression Brian Masney
2016-10-10 20:57 ` Jonathan Cameron
2016-10-15 15:13 ` Jonathan Cameron
2016-10-10 7:20 ` [PATCH v2 8/8] staging: iio: isl29018: move out of staging Brian Masney
2016-10-15 15:15 ` Jonathan Cameron
2016-10-16 2:25 ` Brian Masney
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=82c1efb7-57e6-a3ba-2f68-059e94f02daa@kernel.org \
--to=jic23@kernel.org \
--cc=devel@driverdev.osuosl.org \
--cc=gregkh@linuxfoundation.org \
--cc=linux-iio@vger.kernel.org \
--cc=masneyb@onstation.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 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.