linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 0/2] staging: iio: ad7606: move driver out of staging
@ 2016-12-09 13:30 Eva Rachel Retuya
  2016-12-09 13:30 ` [PATCH v2 1/2] staging: iio: ad7606: replace range/range_available with corresponding scale Eva Rachel Retuya
  2016-12-09 13:30 ` [PATCH v2 2/2] staging: iio: ad7606: move out of staging Eva Rachel Retuya
  0 siblings, 2 replies; 5+ messages in thread
From: Eva Rachel Retuya @ 2016-12-09 13:30 UTC (permalink / raw)
  To: linux-iio, devel, linux-kernel
  Cc: lars, Michael.Hennerich, jic23, knaack.h, pmeerw, gregkh,
	Eva Rachel Retuya

Address the last remaining TODO [1] for this driver and move it from staging
into mainline.

[1] https://marc.info/?l=linux-iio&m=147689684332118&w=2 

Change in v2:
* Address the incorrect way of implementing the scale. (Pointed out by Lars)

Eva Rachel Retuya (2):
  staging: iio: ad7606: replace range/range_available with corresponding
    scale
  staging: iio: ad7606: move out of staging

 drivers/iio/adc/Kconfig                    | 34 ++++++++++
 drivers/iio/adc/Makefile                   |  3 +
 drivers/{staging => }/iio/adc/ad7606.c     | 99 ++++++++++++++++++------------
 drivers/{staging => }/iio/adc/ad7606.h     |  1 +
 drivers/{staging => }/iio/adc/ad7606_par.c |  0
 drivers/{staging => }/iio/adc/ad7606_spi.c |  0
 drivers/staging/iio/adc/Kconfig            | 34 ----------
 drivers/staging/iio/adc/Makefile           |  4 --
 8 files changed, 98 insertions(+), 77 deletions(-)
 rename drivers/{staging => }/iio/adc/ad7606.c (86%)
 rename drivers/{staging => }/iio/adc/ad7606.h (98%)
 rename drivers/{staging => }/iio/adc/ad7606_par.c (100%)
 rename drivers/{staging => }/iio/adc/ad7606_spi.c (100%)

-- 
2.7.4

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH v2 1/2] staging: iio: ad7606: replace range/range_available with corresponding scale
  2016-12-09 13:30 [PATCH v2 0/2] staging: iio: ad7606: move driver out of staging Eva Rachel Retuya
@ 2016-12-09 13:30 ` Eva Rachel Retuya
  2016-12-09 13:30 ` [PATCH v2 2/2] staging: iio: ad7606: move out of staging Eva Rachel Retuya
  1 sibling, 0 replies; 5+ messages in thread
From: Eva Rachel Retuya @ 2016-12-09 13:30 UTC (permalink / raw)
  To: linux-iio, devel, linux-kernel
  Cc: lars, Michael.Hennerich, jic23, knaack.h, pmeerw, gregkh,
	Eva Rachel Retuya

Eliminate the non-standard attributes in_voltage_range and
in_voltage_range_available. Implement in_voltage_scale_available in place
of these attributes and update the SCALE accordingly. The array
scale_avail is introduced to hold the available scale values.

Signed-off-by: Eva Rachel Retuya <eraretuya@gmail.com>
---
Changes in v2:
* Update commit message to reflect changes.
* Introduce scale_avail[] array to hold the available scales.
* Rewrite read_raw's SCALE to make use of the scale_avail[].
* Provide write_raw and write_raw_get_fmt for implementing SCALE.
* Populate the scale_avail[] with values in probe().

 drivers/staging/iio/adc/ad7606.c | 99 ++++++++++++++++++++++++----------------
 drivers/staging/iio/adc/ad7606.h |  1 +
 2 files changed, 61 insertions(+), 39 deletions(-)

diff --git a/drivers/staging/iio/adc/ad7606.c b/drivers/staging/iio/adc/ad7606.c
index 4531908..7a9471d 100644
--- a/drivers/staging/iio/adc/ad7606.c
+++ b/drivers/staging/iio/adc/ad7606.c
@@ -151,9 +151,9 @@ static int ad7606_read_raw(struct iio_dev *indio_dev,
 		*val = (short)ret;
 		return IIO_VAL_INT;
 	case IIO_CHAN_INFO_SCALE:
-		*val = st->range * 2;
-		*val2 = st->chip_info->channels[0].scan_type.realbits;
-		return IIO_VAL_FRACTIONAL_LOG2;
+		*val = st->scale_avail[st->range][0];
+		*val2 = st->scale_avail[st->range][1];
+		return IIO_VAL_INT_PLUS_NANO;
 	case IIO_CHAN_INFO_OVERSAMPLING_RATIO:
 		*val = st->oversampling;
 		return IIO_VAL_INT;
@@ -161,42 +161,24 @@ static int ad7606_read_raw(struct iio_dev *indio_dev,
 	return -EINVAL;
 }
 
-static ssize_t ad7606_show_range(struct device *dev,
-				 struct device_attribute *attr, char *buf)
+static ssize_t in_voltage_scale_available_show(struct device *dev,
+					       struct device_attribute *attr,
+					       char *buf)
 {
 	struct iio_dev *indio_dev = dev_to_iio_dev(dev);
 	struct ad7606_state *st = iio_priv(indio_dev);
+	int i, len = 0;
 
-	return sprintf(buf, "%u\n", st->range);
-}
-
-static ssize_t ad7606_store_range(struct device *dev,
-				  struct device_attribute *attr,
-				  const char *buf, size_t count)
-{
-	struct iio_dev *indio_dev = dev_to_iio_dev(dev);
-	struct ad7606_state *st = iio_priv(indio_dev);
-	unsigned long lval;
-	int ret;
-
-	ret = kstrtoul(buf, 10, &lval);
-	if (ret)
-		return ret;
-
-	if (!(lval == 5000 || lval == 10000))
-		return -EINVAL;
+	for (i = 0; i < ARRAY_SIZE(st->scale_avail); i++)
+		len += scnprintf(buf + len, PAGE_SIZE - len, "%d.%09u ",
+				 st->scale_avail[i][0], st->scale_avail[i][1]);
 
-	mutex_lock(&indio_dev->mlock);
-	gpiod_set_value(st->gpio_range, lval == 10000);
-	st->range = lval;
-	mutex_unlock(&indio_dev->mlock);
+	buf[len - 1] = '\n';
 
-	return count;
+	return len;
 }
 
-static IIO_DEVICE_ATTR(in_voltage_range, S_IRUGO | S_IWUSR,
-		       ad7606_show_range, ad7606_store_range, 0);
-static IIO_CONST_ATTR(in_voltage_range_available, "5000 10000");
+static IIO_DEVICE_ATTR_RO(in_voltage_scale_available, 0);
 
 static int ad7606_oversampling_get_index(unsigned int val)
 {
@@ -218,9 +200,23 @@ static int ad7606_write_raw(struct iio_dev *indio_dev,
 {
 	struct ad7606_state *st = iio_priv(indio_dev);
 	int values[3];
-	int ret;
+	int ret, i;
 
 	switch (mask) {
+	case IIO_CHAN_INFO_SCALE:
+		ret = -EINVAL;
+		mutex_lock(&indio_dev->mlock);
+		for (i = 0; i < ARRAY_SIZE(st->scale_avail); i++)
+			if (val2 == st->scale_avail[i][1]) {
+				gpiod_set_value(st->gpio_range, i);
+				st->range = i;
+
+				ret = 0;
+				break;
+			}
+		mutex_unlock(&indio_dev->mlock);
+
+		return ret;
 	case IIO_CHAN_INFO_OVERSAMPLING_RATIO:
 		if (val2)
 			return -EINVAL;
@@ -244,11 +240,22 @@ static int ad7606_write_raw(struct iio_dev *indio_dev,
 	}
 }
 
+static int ad7606_write_raw_get_fmt(struct iio_dev *indio_dev,
+				    struct iio_chan_spec const *chan,
+				    long mask)
+{
+	switch (mask) {
+	case IIO_CHAN_INFO_SCALE:
+		return IIO_VAL_INT_PLUS_NANO;
+	default:
+		return -EINVAL;
+	}
+}
+
 static IIO_CONST_ATTR(oversampling_ratio_available, "1 2 4 8 16 32 64");
 
 static struct attribute *ad7606_attributes_os_and_range[] = {
-	&iio_dev_attr_in_voltage_range.dev_attr.attr,
-	&iio_const_attr_in_voltage_range_available.dev_attr.attr,
+	&iio_dev_attr_in_voltage_scale_available.dev_attr.attr,
 	&iio_const_attr_oversampling_ratio_available.dev_attr.attr,
 	NULL,
 };
@@ -267,8 +274,7 @@ static const struct attribute_group ad7606_attribute_group_os = {
 };
 
 static struct attribute *ad7606_attributes_range[] = {
-	&iio_dev_attr_in_voltage_range.dev_attr.attr,
-	&iio_const_attr_in_voltage_range_available.dev_attr.attr,
+	&iio_dev_attr_in_voltage_scale_available.dev_attr.attr,
 	NULL,
 };
 
@@ -384,6 +390,7 @@ static const struct iio_info ad7606_info_os_and_range = {
 	.driver_module = THIS_MODULE,
 	.read_raw = &ad7606_read_raw,
 	.write_raw = &ad7606_write_raw,
+	.write_raw_get_fmt = &ad7606_write_raw_get_fmt,
 	.attrs = &ad7606_attribute_group_os_and_range,
 };
 
@@ -397,6 +404,8 @@ static const struct iio_info ad7606_info_os = {
 static const struct iio_info ad7606_info_range = {
 	.driver_module = THIS_MODULE,
 	.read_raw = &ad7606_read_raw,
+	.write_raw = &ad7606_write_raw,
+	.write_raw_get_fmt = &ad7606_write_raw_get_fmt,
 	.attrs = &ad7606_attribute_group_range,
 };
 
@@ -405,7 +414,8 @@ int ad7606_probe(struct device *dev, int irq, void __iomem *base_address,
 		 const struct ad7606_bus_ops *bops)
 {
 	struct ad7606_state *st;
-	int ret;
+	unsigned int scale, range;
+	int ret, i, j;
 	struct iio_dev *indio_dev;
 
 	indio_dev = devm_iio_device_alloc(dev, sizeof(*st));
@@ -417,8 +427,19 @@ int ad7606_probe(struct device *dev, int irq, void __iomem *base_address,
 	st->dev = dev;
 	st->bops = bops;
 	st->base_address = base_address;
-	st->range = 5000;
+	/* tied to logic low, analog input range is +/- 5V */
+	st->range = 0;
 	st->oversampling = 1;
+	/* Populate the scales, 2.5/2**16 then 5/2**16 */
+	range = 5000;
+	for (i = 0, j = 1; i < ARRAY_SIZE(st->scale_avail); i++, j--) {
+		scale = ((u64)range * 100000000) >>
+			ad7606_channels[1].scan_type.realbits;
+		scale >>= j;
+
+		st->scale_avail[i][1] = do_div(scale, 100000000) * 10;
+		st->scale_avail[i][0] = scale;
+	}
 	INIT_WORK(&st->poll_work, &ad7606_poll_bh_to_ring);
 
 	st->reg = devm_regulator_get(dev, "avcc");
@@ -525,7 +546,7 @@ static int ad7606_resume(struct device *dev)
 	struct ad7606_state *st = iio_priv(indio_dev);
 
 	if (st->gpio_standby) {
-		gpiod_set_value(st->gpio_range, st->range == 10000);
+		gpiod_set_value(st->gpio_range, st->range);
 		gpiod_set_value(st->gpio_standby, 1);
 		ad7606_reset(st);
 	}
diff --git a/drivers/staging/iio/adc/ad7606.h b/drivers/staging/iio/adc/ad7606.h
index 746f955..671c456 100644
--- a/drivers/staging/iio/adc/ad7606.h
+++ b/drivers/staging/iio/adc/ad7606.h
@@ -34,6 +34,7 @@ struct ad7606_state {
 	const struct ad7606_bus_ops	*bops;
 	unsigned int			range;
 	unsigned int			oversampling;
+	unsigned int			scale_avail[2][2];
 	bool				done;
 	void __iomem			*base_address;
 
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH v2 2/2] staging: iio: ad7606: move out of staging
  2016-12-09 13:30 [PATCH v2 0/2] staging: iio: ad7606: move driver out of staging Eva Rachel Retuya
  2016-12-09 13:30 ` [PATCH v2 1/2] staging: iio: ad7606: replace range/range_available with corresponding scale Eva Rachel Retuya
@ 2016-12-09 13:30 ` Eva Rachel Retuya
  2016-12-09 21:52   ` kbuild test robot
  2016-12-10  2:03   ` kbuild test robot
  1 sibling, 2 replies; 5+ messages in thread
From: Eva Rachel Retuya @ 2016-12-09 13:30 UTC (permalink / raw)
  To: linux-iio, devel, linux-kernel
  Cc: lars, Michael.Hennerich, jic23, knaack.h, pmeerw, gregkh,
	Eva Rachel Retuya

Move the ad7606 driver from staging/iio/adc to iio/adc. Also, update the
corresponding Makefile and Kconfig associated with the change.

Signed-off-by: Eva Rachel Retuya <eraretuya@gmail.com>
---
 drivers/iio/adc/Kconfig                    | 34 ++++++++++++++++++++++++++++++
 drivers/iio/adc/Makefile                   |  3 +++
 drivers/{staging => }/iio/adc/ad7606.c     |  0
 drivers/{staging => }/iio/adc/ad7606.h     |  0
 drivers/{staging => }/iio/adc/ad7606_par.c |  0
 drivers/{staging => }/iio/adc/ad7606_spi.c |  0
 drivers/staging/iio/adc/Kconfig            | 34 ------------------------------
 drivers/staging/iio/adc/Makefile           |  4 ----
 8 files changed, 37 insertions(+), 38 deletions(-)
 rename drivers/{staging => }/iio/adc/ad7606.c (100%)
 rename drivers/{staging => }/iio/adc/ad7606.h (100%)
 rename drivers/{staging => }/iio/adc/ad7606_par.c (100%)
 rename drivers/{staging => }/iio/adc/ad7606_spi.c (100%)

diff --git a/drivers/iio/adc/Kconfig b/drivers/iio/adc/Kconfig
index be81ba3..3fa2c60 100644
--- a/drivers/iio/adc/Kconfig
+++ b/drivers/iio/adc/Kconfig
@@ -58,6 +58,40 @@ config AD7476
 	  To compile this driver as a module, choose M here: the
 	  module will be called ad7476.
 
+config AD7606
+	tristate "Analog Devices AD7606 ADC driver"
+	depends on GPIOLIB || COMPILE_TEST
+	depends on HAS_IOMEM
+	select IIO_BUFFER
+	select IIO_TRIGGERED_BUFFER
+	help
+	  Say yes here to build support for Analog Devices:
+	  ad7606, ad7606-6, ad7606-4 analog to digital converters (ADC).
+
+	  To compile this driver as a module, choose M here: the
+	  module will be called ad7606.
+
+config AD7606_IFACE_PARALLEL
+	tristate "parallel interface support"
+	depends on AD7606
+	help
+	  Say yes here to include parallel interface support on the AD7606
+	  ADC driver.
+
+	  To compile this driver as a module, choose M here: the
+	  module will be called ad7606_parallel.
+
+config AD7606_IFACE_SPI
+	tristate "spi interface support"
+	depends on AD7606
+	depends on SPI
+	help
+	  Say yes here to include parallel interface support on the AD7606
+	  ADC driver.
+
+	  To compile this driver as a module, choose M here: the
+	  module will be called ad7606_spi.
+
 config AD7766
 	tristate "Analog Devices AD7766/AD7767 ADC driver"
 	depends on SPI_MASTER
diff --git a/drivers/iio/adc/Makefile b/drivers/iio/adc/Makefile
index f8e1218..dfe7dea 100644
--- a/drivers/iio/adc/Makefile
+++ b/drivers/iio/adc/Makefile
@@ -9,6 +9,9 @@ obj-$(CONFIG_AD7291) += ad7291.o
 obj-$(CONFIG_AD7298) += ad7298.o
 obj-$(CONFIG_AD7923) += ad7923.o
 obj-$(CONFIG_AD7476) += ad7476.o
+obj-$(CONFIG_AD7606_IFACE_PARALLEL) += ad7606_par.o
+obj-$(CONFIG_AD7606_IFACE_SPI) += ad7606_spi.o
+obj-$(CONFIG_AD7606) += ad7606.o
 obj-$(CONFIG_AD7766) += ad7766.o
 obj-$(CONFIG_AD7791) += ad7791.o
 obj-$(CONFIG_AD7793) += ad7793.o
diff --git a/drivers/staging/iio/adc/ad7606.c b/drivers/iio/adc/ad7606.c
similarity index 100%
rename from drivers/staging/iio/adc/ad7606.c
rename to drivers/iio/adc/ad7606.c
diff --git a/drivers/staging/iio/adc/ad7606.h b/drivers/iio/adc/ad7606.h
similarity index 100%
rename from drivers/staging/iio/adc/ad7606.h
rename to drivers/iio/adc/ad7606.h
diff --git a/drivers/staging/iio/adc/ad7606_par.c b/drivers/iio/adc/ad7606_par.c
similarity index 100%
rename from drivers/staging/iio/adc/ad7606_par.c
rename to drivers/iio/adc/ad7606_par.c
diff --git a/drivers/staging/iio/adc/ad7606_spi.c b/drivers/iio/adc/ad7606_spi.c
similarity index 100%
rename from drivers/staging/iio/adc/ad7606_spi.c
rename to drivers/iio/adc/ad7606_spi.c
diff --git a/drivers/staging/iio/adc/Kconfig b/drivers/staging/iio/adc/Kconfig
index deff899..995867b 100644
--- a/drivers/staging/iio/adc/Kconfig
+++ b/drivers/staging/iio/adc/Kconfig
@@ -3,40 +3,6 @@
 #
 menu "Analog to digital converters"
 
-config AD7606
-	tristate "Analog Devices AD7606 ADC driver"
-	depends on GPIOLIB || COMPILE_TEST
-	depends on HAS_IOMEM
-	select IIO_BUFFER
-	select IIO_TRIGGERED_BUFFER
-	help
-	  Say yes here to build support for Analog Devices:
-	  ad7606, ad7606-6, ad7606-4 analog to digital converters (ADC).
-
-	  To compile this driver as a module, choose M here: the
-	  module will be called ad7606.
-
-config AD7606_IFACE_PARALLEL
-	tristate "parallel interface support"
-	depends on AD7606
-	help
-	  Say yes here to include parallel interface support on the AD7606
-	  ADC driver.
-
-	  To compile this driver as a module, choose M here: the
-	  module will be called ad7606_parallel.
-
-config AD7606_IFACE_SPI
-	tristate "spi interface support"
-	depends on AD7606
-	depends on SPI
-	help
-	  Say yes here to include parallel interface support on the AD7606
-	  ADC driver.
-
-	  To compile this driver as a module, choose M here: the
-	  module will be called ad7606_spi.
-
 config AD7780
 	tristate "Analog Devices AD7780 and similar ADCs driver"
 	depends on SPI
diff --git a/drivers/staging/iio/adc/Makefile b/drivers/staging/iio/adc/Makefile
index ac09485..549032b 100644
--- a/drivers/staging/iio/adc/Makefile
+++ b/drivers/staging/iio/adc/Makefile
@@ -2,10 +2,6 @@
 # Makefile for industrial I/O ADC drivers
 #
 
-obj-$(CONFIG_AD7606_IFACE_PARALLEL) += ad7606_par.o
-obj-$(CONFIG_AD7606_IFACE_SPI) += ad7606_spi.o
-obj-$(CONFIG_AD7606) += ad7606.o
-
 obj-$(CONFIG_AD7780) += ad7780.o
 obj-$(CONFIG_AD7816) += ad7816.o
 obj-$(CONFIG_AD7192) += ad7192.o
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH v2 2/2] staging: iio: ad7606: move out of staging
  2016-12-09 13:30 ` [PATCH v2 2/2] staging: iio: ad7606: move out of staging Eva Rachel Retuya
@ 2016-12-09 21:52   ` kbuild test robot
  2016-12-10  2:03   ` kbuild test robot
  1 sibling, 0 replies; 5+ messages in thread
From: kbuild test robot @ 2016-12-09 21:52 UTC (permalink / raw)
  To: Eva Rachel Retuya
  Cc: kbuild-all, linux-iio, devel, linux-kernel, lars,
	Michael.Hennerich, jic23, knaack.h, pmeerw, gregkh,
	Eva Rachel Retuya

[-- Attachment #1: Type: text/plain, Size: 6332 bytes --]

Hi Eva,

[auto build test WARNING on iio/togreg]
[also build test WARNING on next-20161209]
[cannot apply to v4.9-rc8]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url:    https://github.com/0day-ci/linux/commits/Eva-Rachel-Retuya/staging-iio-ad7606-move-driver-out-of-staging/20161210-041408
base:   https://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio.git togreg
config: blackfin-allmodconfig (attached as .config)
compiler: bfin-uclinux-gcc (GCC) 6.2.0
reproduce:
        wget https://git.kernel.org/cgit/linux/kernel/git/wfg/lkp-tests.git/plain/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # save the attached .config to linux build tree
        make.cross ARCH=blackfin 

All warnings (new ones prefixed by >>):

   In file included from ./arch/blackfin/include/generated/asm/div64.h:1:0,
                    from include/linux/kernel.h:142,
                    from include/linux/interrupt.h:5,
                    from drivers/iio/adc/ad7606.c:9:
   drivers/iio/adc/ad7606.c: In function 'ad7606_probe':
   include/asm-generic/div64.h:207:28: warning: comparison of distinct pointer types lacks a cast
     (void)(((typeof((n)) *)0) == ((uint64_t *)0)); \
                               ^
>> drivers/iio/adc/ad7606.c:440:27: note: in expansion of macro 'do_div'
      st->scale_avail[i][1] = do_div(scale, 100000000) * 10;
                              ^~~~~~
   In file included from include/linux/linkage.h:4:0,
                    from include/linux/kernel.h:6,
                    from include/linux/interrupt.h:5,
                    from drivers/iio/adc/ad7606.c:9:
   include/asm-generic/div64.h:220:25: warning: right shift count >= width of type [-Wshift-count-overflow]
     } else if (likely(((n) >> 32) == 0)) {  \
                            ^
   include/linux/compiler.h:167:40: note: in definition of macro 'likely'
    # define likely(x) __builtin_expect(!!(x), 1)
                                           ^
>> drivers/iio/adc/ad7606.c:440:27: note: in expansion of macro 'do_div'
      st->scale_avail[i][1] = do_div(scale, 100000000) * 10;
                              ^~~~~~
   In file included from ./arch/blackfin/include/generated/asm/div64.h:1:0,
                    from include/linux/kernel.h:142,
                    from include/linux/interrupt.h:5,
                    from drivers/iio/adc/ad7606.c:9:
   include/asm-generic/div64.h:224:22: error: passing argument 1 of '__div64_32' from incompatible pointer type [-Werror=incompatible-pointer-types]
      __rem = __div64_32(&(n), __base); \
                         ^
>> drivers/iio/adc/ad7606.c:440:27: note: in expansion of macro 'do_div'
      st->scale_avail[i][1] = do_div(scale, 100000000) * 10;
                              ^~~~~~
   include/asm-generic/div64.h:198:17: note: expected 'uint64_t * {aka long long unsigned int *}' but argument is of type 'unsigned int *'
    extern uint32_t __div64_32(uint64_t *dividend, uint32_t divisor);
                    ^~~~~~~~~~
   cc1: some warnings being treated as errors

vim +/do_div +440 drivers/iio/adc/ad7606.c

b9618c0c drivers/staging/iio/adc/ad7606_core.c Michael Hennerich  2011-02-22  424  
e61181d0 drivers/staging/iio/adc/ad7606_core.c Michael Hennerich  2011-05-18  425  	st = iio_priv(indio_dev);
e61181d0 drivers/staging/iio/adc/ad7606_core.c Michael Hennerich  2011-05-18  426  
b9618c0c drivers/staging/iio/adc/ad7606_core.c Michael Hennerich  2011-02-22  427  	st->dev = dev;
b9618c0c drivers/staging/iio/adc/ad7606_core.c Michael Hennerich  2011-02-22  428  	st->bops = bops;
b9618c0c drivers/staging/iio/adc/ad7606_core.c Michael Hennerich  2011-02-22  429  	st->base_address = base_address;
c22bfdb9 drivers/staging/iio/adc/ad7606.c      Eva Rachel Retuya  2016-12-09  430  	/* tied to logic low, analog input range is +/- 5V */
c22bfdb9 drivers/staging/iio/adc/ad7606.c      Eva Rachel Retuya  2016-12-09  431  	st->range = 0;
e79e8027 drivers/staging/iio/adc/ad7606_core.c Lars-Peter Clausen 2016-10-19  432  	st->oversampling = 1;
c22bfdb9 drivers/staging/iio/adc/ad7606.c      Eva Rachel Retuya  2016-12-09  433  	/* Populate the scales, 2.5/2**16 then 5/2**16 */
c22bfdb9 drivers/staging/iio/adc/ad7606.c      Eva Rachel Retuya  2016-12-09  434  	range = 5000;
c22bfdb9 drivers/staging/iio/adc/ad7606.c      Eva Rachel Retuya  2016-12-09  435  	for (i = 0, j = 1; i < ARRAY_SIZE(st->scale_avail); i++, j--) {
c22bfdb9 drivers/staging/iio/adc/ad7606.c      Eva Rachel Retuya  2016-12-09  436  		scale = ((u64)range * 100000000) >>
c22bfdb9 drivers/staging/iio/adc/ad7606.c      Eva Rachel Retuya  2016-12-09  437  			ad7606_channels[1].scan_type.realbits;
c22bfdb9 drivers/staging/iio/adc/ad7606.c      Eva Rachel Retuya  2016-12-09  438  		scale >>= j;
c22bfdb9 drivers/staging/iio/adc/ad7606.c      Eva Rachel Retuya  2016-12-09  439  
c22bfdb9 drivers/staging/iio/adc/ad7606.c      Eva Rachel Retuya  2016-12-09 @440  		st->scale_avail[i][1] = do_div(scale, 100000000) * 10;
c22bfdb9 drivers/staging/iio/adc/ad7606.c      Eva Rachel Retuya  2016-12-09  441  		st->scale_avail[i][0] = scale;
c22bfdb9 drivers/staging/iio/adc/ad7606.c      Eva Rachel Retuya  2016-12-09  442  	}
fa23105f drivers/staging/iio/adc/ad7606.c      Lars-Peter Clausen 2016-10-19  443  	INIT_WORK(&st->poll_work, &ad7606_poll_bh_to_ring);
b9618c0c drivers/staging/iio/adc/ad7606_core.c Michael Hennerich  2011-02-22  444  
12edb974 drivers/staging/iio/adc/ad7606.c      Eva Rachel Retuya  2016-10-20  445  	st->reg = devm_regulator_get(dev, "avcc");
f0879217 drivers/staging/iio/adc/ad7606.c      Eva Rachel Retuya  2016-10-20  446  	if (IS_ERR(st->reg))
f0879217 drivers/staging/iio/adc/ad7606.c      Eva Rachel Retuya  2016-10-20  447  		return PTR_ERR(st->reg);
f0879217 drivers/staging/iio/adc/ad7606.c      Eva Rachel Retuya  2016-10-20  448  

:::::: The code at line 440 was first introduced by commit
:::::: c22bfdb966a91ee001c3ab37b8fb070dbebb2510 staging: iio: ad7606: replace range/range_available with corresponding scale

:::::: TO: Eva Rachel Retuya <eraretuya@gmail.com>
:::::: CC: 0day robot <fengguang.wu@intel.com>

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 42121 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH v2 2/2] staging: iio: ad7606: move out of staging
  2016-12-09 13:30 ` [PATCH v2 2/2] staging: iio: ad7606: move out of staging Eva Rachel Retuya
  2016-12-09 21:52   ` kbuild test robot
@ 2016-12-10  2:03   ` kbuild test robot
  1 sibling, 0 replies; 5+ messages in thread
From: kbuild test robot @ 2016-12-10  2:03 UTC (permalink / raw)
  To: Eva Rachel Retuya
  Cc: kbuild-all, linux-iio, devel, linux-kernel, lars,
	Michael.Hennerich, jic23, knaack.h, pmeerw, gregkh,
	Eva Rachel Retuya

[-- Attachment #1: Type: text/plain, Size: 5584 bytes --]

Hi Eva,

[auto build test WARNING on iio/togreg]
[also build test WARNING on next-20161209]
[cannot apply to v4.9-rc8]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url:    https://github.com/0day-ci/linux/commits/Eva-Rachel-Retuya/staging-iio-ad7606-move-driver-out-of-staging/20161210-041408
base:   https://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio.git togreg
config: xtensa-allyesconfig (attached as .config)
compiler: xtensa-linux-gcc (GCC) 4.9.0
reproduce:
        wget https://git.kernel.org/cgit/linux/kernel/git/wfg/lkp-tests.git/plain/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # save the attached .config to linux build tree
        make.cross ARCH=xtensa 

All warnings (new ones prefixed by >>):

   In file included from ./arch/xtensa/include/generated/asm/div64.h:1:0,
                    from include/linux/kernel.h:142,
                    from include/linux/interrupt.h:5,
                    from drivers/iio/adc/ad7606.c:9:
   drivers/iio/adc/ad7606.c: In function 'ad7606_probe':
   include/asm-generic/div64.h:207:28: warning: comparison of distinct pointer types lacks a cast
     (void)(((typeof((n)) *)0) == ((uint64_t *)0)); \
                               ^
   drivers/iio/adc/ad7606.c:440:27: note: in expansion of macro 'do_div'
      st->scale_avail[i][1] = do_div(scale, 100000000) * 10;
                              ^
>> drivers/iio/adc/ad7606.c:440:3: warning: right shift count >= width of type
      st->scale_avail[i][1] = do_div(scale, 100000000) * 10;
      ^
   In file included from ./arch/xtensa/include/generated/asm/div64.h:1:0,
                    from include/linux/kernel.h:142,
                    from include/linux/interrupt.h:5,
                    from drivers/iio/adc/ad7606.c:9:
   include/asm-generic/div64.h:224:11: warning: passing argument 1 of '__div64_32' from incompatible pointer type
      __rem = __div64_32(&(n), __base); \
              ^
   drivers/iio/adc/ad7606.c:440:27: note: in expansion of macro 'do_div'
      st->scale_avail[i][1] = do_div(scale, 100000000) * 10;
                              ^
   include/asm-generic/div64.h:198:17: note: expected 'uint64_t *' but argument is of type 'unsigned int *'
    extern uint32_t __div64_32(uint64_t *dividend, uint32_t divisor);
                    ^

vim +440 drivers/iio/adc/ad7606.c

b9618c0c drivers/staging/iio/adc/ad7606_core.c Michael Hennerich  2011-02-22  424  
e61181d0 drivers/staging/iio/adc/ad7606_core.c Michael Hennerich  2011-05-18  425  	st = iio_priv(indio_dev);
e61181d0 drivers/staging/iio/adc/ad7606_core.c Michael Hennerich  2011-05-18  426  
b9618c0c drivers/staging/iio/adc/ad7606_core.c Michael Hennerich  2011-02-22  427  	st->dev = dev;
b9618c0c drivers/staging/iio/adc/ad7606_core.c Michael Hennerich  2011-02-22  428  	st->bops = bops;
b9618c0c drivers/staging/iio/adc/ad7606_core.c Michael Hennerich  2011-02-22  429  	st->base_address = base_address;
c22bfdb9 drivers/staging/iio/adc/ad7606.c      Eva Rachel Retuya  2016-12-09  430  	/* tied to logic low, analog input range is +/- 5V */
c22bfdb9 drivers/staging/iio/adc/ad7606.c      Eva Rachel Retuya  2016-12-09  431  	st->range = 0;
e79e8027 drivers/staging/iio/adc/ad7606_core.c Lars-Peter Clausen 2016-10-19  432  	st->oversampling = 1;
c22bfdb9 drivers/staging/iio/adc/ad7606.c      Eva Rachel Retuya  2016-12-09  433  	/* Populate the scales, 2.5/2**16 then 5/2**16 */
c22bfdb9 drivers/staging/iio/adc/ad7606.c      Eva Rachel Retuya  2016-12-09  434  	range = 5000;
c22bfdb9 drivers/staging/iio/adc/ad7606.c      Eva Rachel Retuya  2016-12-09  435  	for (i = 0, j = 1; i < ARRAY_SIZE(st->scale_avail); i++, j--) {
c22bfdb9 drivers/staging/iio/adc/ad7606.c      Eva Rachel Retuya  2016-12-09  436  		scale = ((u64)range * 100000000) >>
c22bfdb9 drivers/staging/iio/adc/ad7606.c      Eva Rachel Retuya  2016-12-09  437  			ad7606_channels[1].scan_type.realbits;
c22bfdb9 drivers/staging/iio/adc/ad7606.c      Eva Rachel Retuya  2016-12-09  438  		scale >>= j;
c22bfdb9 drivers/staging/iio/adc/ad7606.c      Eva Rachel Retuya  2016-12-09  439  
c22bfdb9 drivers/staging/iio/adc/ad7606.c      Eva Rachel Retuya  2016-12-09 @440  		st->scale_avail[i][1] = do_div(scale, 100000000) * 10;
c22bfdb9 drivers/staging/iio/adc/ad7606.c      Eva Rachel Retuya  2016-12-09  441  		st->scale_avail[i][0] = scale;
c22bfdb9 drivers/staging/iio/adc/ad7606.c      Eva Rachel Retuya  2016-12-09  442  	}
fa23105f drivers/staging/iio/adc/ad7606.c      Lars-Peter Clausen 2016-10-19  443  	INIT_WORK(&st->poll_work, &ad7606_poll_bh_to_ring);
b9618c0c drivers/staging/iio/adc/ad7606_core.c Michael Hennerich  2011-02-22  444  
12edb974 drivers/staging/iio/adc/ad7606.c      Eva Rachel Retuya  2016-10-20  445  	st->reg = devm_regulator_get(dev, "avcc");
f0879217 drivers/staging/iio/adc/ad7606.c      Eva Rachel Retuya  2016-10-20  446  	if (IS_ERR(st->reg))
f0879217 drivers/staging/iio/adc/ad7606.c      Eva Rachel Retuya  2016-10-20  447  		return PTR_ERR(st->reg);
f0879217 drivers/staging/iio/adc/ad7606.c      Eva Rachel Retuya  2016-10-20  448  

:::::: The code at line 440 was first introduced by commit
:::::: c22bfdb966a91ee001c3ab37b8fb070dbebb2510 staging: iio: ad7606: replace range/range_available with corresponding scale

:::::: TO: Eva Rachel Retuya <eraretuya@gmail.com>
:::::: CC: 0day robot <fengguang.wu@intel.com>

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 47277 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2016-12-10  2:04 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-12-09 13:30 [PATCH v2 0/2] staging: iio: ad7606: move driver out of staging Eva Rachel Retuya
2016-12-09 13:30 ` [PATCH v2 1/2] staging: iio: ad7606: replace range/range_available with corresponding scale Eva Rachel Retuya
2016-12-09 13:30 ` [PATCH v2 2/2] staging: iio: ad7606: move out of staging Eva Rachel Retuya
2016-12-09 21:52   ` kbuild test robot
2016-12-10  2:03   ` kbuild test robot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).