Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1535568

[PATCH 03/19] staging: iio: isl29028: remove chip test and defaults from isl29028_chip_init()

From Brian Masney <masneyb@onstation.org>
Newsgroups linux.kernel
Subject [PATCH 03/19] staging: iio: isl29028: remove chip test and defaults from isl29028_chip_init()
Date 2016-12-04 03:30 +0100
Message-ID <sKuIW-194-29@gated-at.bofh.it> (permalink)
References <sKuIV-194-3@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


isl29028_chip_init() contains the device driver defaults and
two I2C calls that detect the presence of the chip. This patch
moves these into isl29028_probe() so that this function can
be used by the power management runtinme in a followup patch. This
patch also renames isl29028_chip_init() to
isl29028_chip_init_and_power_on().

Signed-off-by: Brian Masney <masneyb@onstation.org>
---
 drivers/staging/iio/light/isl29028.c | 42 +++++++++++++++++++-----------------
 1 file changed, 22 insertions(+), 20 deletions(-)

diff --git a/drivers/staging/iio/light/isl29028.c b/drivers/staging/iio/light/isl29028.c
index c8e234d..4f819a8 100644
--- a/drivers/staging/iio/light/isl29028.c
+++ b/drivers/staging/iio/light/isl29028.c
@@ -416,29 +416,11 @@ static const struct iio_info isl29028_info = {
 	.write_raw = isl29028_write_raw,
 };
 
-static int isl29028_chip_init(struct isl29028_chip *chip)
+static int isl29028_chip_init_and_power_on(struct isl29028_chip *chip)
 {
 	struct device *dev = regmap_get_device(chip->regmap);
 	int ret;
 
-	chip->enable_prox  = false;
-	chip->prox_sampling = 20;
-	chip->lux_scale = 2000;
-	chip->als_ir_mode = ISL29028_MODE_NONE;
-
-	ret = regmap_write(chip->regmap, ISL29028_REG_TEST1_MODE, 0x0);
-	if (ret < 0) {
-		dev_err(dev, "%s(): write to reg %d failed, err = %d\n",
-			__func__, ISL29028_REG_TEST1_MODE, ret);
-		return ret;
-	}
-	ret = regmap_write(chip->regmap, ISL29028_REG_TEST2_MODE, 0x0);
-	if (ret < 0) {
-		dev_err(dev, "%s(): write to reg %d failed, err = %d\n",
-			__func__, ISL29028_REG_TEST2_MODE, ret);
-		return ret;
-	}
-
 	ret = regmap_write(chip->regmap, ISL29028_REG_CONFIGURE, 0x0);
 	if (ret < 0) {
 		dev_err(dev, "%s(): write to reg %d failed, err = %d\n",
@@ -506,7 +488,27 @@ static int isl29028_probe(struct i2c_client *client,
 		return ret;
 	}
 
-	ret = isl29028_chip_init(chip);
+	chip->enable_prox  = false;
+	chip->prox_sampling = 20;
+	chip->lux_scale = 2000;
+	chip->als_ir_mode = ISL29028_MODE_NONE;
+
+	ret = regmap_write(chip->regmap, ISL29028_REG_TEST1_MODE, 0x0);
+	if (ret < 0) {
+		dev_err(&client->dev,
+			"%s(): write to reg %d failed, err = %d\n", __func__,
+			ISL29028_REG_TEST1_MODE, ret);
+		return ret;
+	}
+	ret = regmap_write(chip->regmap, ISL29028_REG_TEST2_MODE, 0x0);
+	if (ret < 0) {
+		dev_err(&client->dev,
+			"%s(): write to reg %d failed, err = %d\n", __func__,
+			ISL29028_REG_TEST2_MODE, ret);
+		return ret;
+	}
+
+	ret = isl29028_chip_init_and_power_on(chip);
 	if (ret < 0) {
 		dev_err(&client->dev, "chip initialization failed: %d\n", ret);
 		return ret;
-- 
2.7.4

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH 00/19] staging: iio: isl29028: staging cleanups Brian Masney <masneyb@onstation.org> - 2016-12-04 03:30 +0100
  [PATCH 03/19] staging: iio: isl29028: remove chip test and defaults from isl29028_chip_init() Brian Masney <masneyb@onstation.org> - 2016-12-04 03:30 +0100
  [PATCH 15/19] staging: iio: isl29028: made error messages consistent Brian Masney <masneyb@onstation.org> - 2016-12-04 03:30 +0100
  [PATCH 19/19] staging: iio: isl29028: remove legacy device tree binding Brian Masney <masneyb@onstation.org> - 2016-12-04 03:30 +0100
  [PATCH 09/19] staging: iio: isl29028: change newlines to improve readability Brian Masney <masneyb@onstation.org> - 2016-12-04 03:30 +0100
  [PATCH 12/19] staging: iio: isl29028: fix comparison between signed and unsigned integers Brian Masney <masneyb@onstation.org> - 2016-12-04 03:30 +0100
    Re: [PATCH 12/19] staging: iio: isl29028: fix comparison between  signed and unsigned integers Dan Carpenter <dan.carpenter@oracle.com> - 2016-12-05 22:00 +0100
      Re: [PATCH 12/19] staging: iio: isl29028: fix comparison between  signed and unsigned integers Brian Masney <masneyb@onstation.org> - 2016-12-06 01:20 +0100
        Re: [PATCH 12/19] staging: iio: isl29028: fix comparison between  signed and unsigned integers Dan Carpenter <dan.carpenter@oracle.com> - 2016-12-06 11:30 +0100
  [PATCH 10/19] staging: iio: isl29028: remove unused define ISL29028_DEV_ATTR Brian Masney <masneyb@onstation.org> - 2016-12-04 03:30 +0100
  [PATCH 04/19] staging: iio: isl29028: add power management support Brian Masney <masneyb@onstation.org> - 2016-12-04 03:30 +0100
  [PATCH 16/19] staging: iio: isl29028: remove unnecessary error logging in isl29028_chip_init_and_power_on() Brian Masney <masneyb@onstation.org> - 2016-12-04 03:30 +0100

csiph-web