Re: [PATCH] iio: ad7793: implement IIO_CHAN_INFO_SAMP_FREQ

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 2018-03-07 19:02, Michael Nosthoff wrote:
On 2018-03-07 17:43, Lars-Peter Clausen wrote:
On 03/07/2018 05:17 PM, Michael Nosthoff wrote:
[...]
+    case IIO_CHAN_INFO_SAMP_FREQ:
+        if (!val) {
+            ret = -EINVAL;
+            break;
+        }
+
+        for (i = 0; i < 16; i++)
+            if (val == st->chip_info->sample_freq_avail[i])
+                break;
+
+        if (i == 16) {
+            ret = -EINVAL;
+            break;
+        }
+
+        st->mode &= ~AD7793_MODE_RATE(-1);
+        st->mode |= AD7793_MODE_RATE(i);
+        ad_sd_write_reg(&st->sd, AD7793_REG_MODE, sizeof(st->mode), st->mode);
+        ret = 0;

I don't think the ret = 0 is needed here, it should already be 0. But of
course it does not hurt either.

My fault. I tested against 4.14 which doesn't have the
"use iio helper function to guarantee direct mode" commit which initializes
ret. Which produces a compiler warning.
So if I remove it a backport would require that commit to be pulled first.

I just noticed I mixed something up, the mentioned patch is already applied in 4.14.
I'll remove the line and resubmit the patch.


--
To unsubscribe from this list: send the line "unsubscribe linux-iio" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Input]     [Linux Kernel]     [Linux SCSI]     [X.org]

  Powered by Linux