Merge 4.4-rc5 into staging-next
[deliverable/linux.git] / drivers / iio / industrialio-core.c
index 208358f9e7e36582152cad8c4f4924d9667a58cc..8966f85ca4cd48e335dc17754038d259e0e72576 100644 (file)
@@ -512,6 +512,12 @@ int iio_str_to_fixpoint(const char *str, int fract_mult,
        int i = 0, f = 0;
        bool integer_part = true, negative = false;
 
+       if (fract_mult == 0) {
+               *fract = 0;
+
+               return kstrtoint(str, 0, integer);
+       }
+
        if (str[0] == '-') {
                negative = true;
                str++;
@@ -571,6 +577,9 @@ static ssize_t iio_write_channel_info(struct device *dev,
        if (indio_dev->info->write_raw_get_fmt)
                switch (indio_dev->info->write_raw_get_fmt(indio_dev,
                        this_attr->c, this_attr->address)) {
+               case IIO_VAL_INT:
+                       fract_mult = 0;
+                       break;
                case IIO_VAL_INT_PLUS_MICRO:
                        fract_mult = 100000;
                        break;
@@ -655,7 +664,7 @@ int __iio_device_attr_init(struct device_attribute *dev_attr,
                        break;
                case IIO_SEPARATE:
                        if (!chan->indexed) {
-                               WARN_ON("Differential channels must be indexed\n");
+                               WARN(1, "Differential channels must be indexed\n");
                                ret = -EINVAL;
                                goto error_free_full_postfix;
                        }
This page took 0.025007 seconds and 5 git commands to generate.