iio: adc: adi-axi-adc: only error out in major version mismatch
authorNuno Sa <nuno.sa@analog.com>
Fri, 19 Apr 2024 15:36:45 +0000 (17:36 +0200)
committerJonathan Cameron <Jonathan.Cameron@huawei.com>
Sat, 20 Apr 2024 15:01:04 +0000 (16:01 +0100)
The IP core only has breaking changes when there major version changes.
Hence, only match the major number. This is also in line with the other
core ADI has upstream. The current check for erroring out
'expected_version > current_version"' is then wrong as we could just
increase the core major with breaking changes and that would go
unnoticed.

Fixes: ef04070692a2 ("iio: adc: adi-axi-adc: add support for AXI ADC IP core")
Signed-off-by: Nuno Sa <nuno.sa@analog.com>
Link: https://lore.kernel.org/r/20240419-ad9467-new-features-v1-2-3e7628ff6d5e@analog.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
drivers/iio/adc/adi-axi-adc.c

index 184b36dca6d035e2de1bf6d8ae347bdca6945bc5..9444b0c5a93c6a32fcf91e1660e51b73740ad40c 100644 (file)
@@ -193,9 +193,9 @@ static int adi_axi_adc_probe(struct platform_device *pdev)
        if (ret)
                return ret;
 
-       if (*expected_ver > ver) {
+       if (ADI_AXI_PCORE_VER_MAJOR(ver) != ADI_AXI_PCORE_VER_MAJOR(*expected_ver)) {
                dev_err(&pdev->dev,
-                       "IP core version is too old. Expected %d.%.2d.%c, Reported %d.%.2d.%c\n",
+                       "Major version mismatch. Expected %d.%.2d.%c, Reported %d.%.2d.%c\n",
                        ADI_AXI_PCORE_VER_MAJOR(*expected_ver),
                        ADI_AXI_PCORE_VER_MINOR(*expected_ver),
                        ADI_AXI_PCORE_VER_PATCH(*expected_ver),