iio: backend: print message in case op is not implemented
authorNuno Sa <nuno.sa@analog.com>
Tue, 9 Jul 2024 11:14:29 +0000 (13:14 +0200)
committerJonathan Cameron <Jonathan.Cameron@huawei.com>
Sat, 3 Aug 2024 09:13:36 +0000 (10:13 +0100)
For APIs that have a return value, -EOPNOTSUPP is returned in case the
backend does not support the functionality. However, for APIs that do
not have a return value we are left in silence. Hence, at least print a
debug message in case the callback is not implemented by the backend.

Signed-off-by: Nuno Sa <nuno.sa@analog.com>
Link: https://patch.msgid.link/20240709-dev-iio-backend-add-debugfs-v1-2-fb4b8f2373c7@analog.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
drivers/iio/industrialio-backend.c

index 65a4294..f9da635 100644 (file)
@@ -40,6 +40,7 @@
 #include <linux/mutex.h>
 #include <linux/property.h>
 #include <linux/slab.h>
+#include <linux/stringify.h>
 #include <linux/types.h>
 
 #include <linux/iio/backend.h>
@@ -111,6 +112,9 @@ static DEFINE_MUTEX(iio_back_lock);
        __ret = iio_backend_check_op(__back, op);               \
        if (!__ret)                                             \
                __back->ops->op(__back, ##args);                \
+       else                                                    \
+               dev_dbg(__back->dev, "Op(%s) not implemented\n",\
+                       __stringify(op));                       \
 }
 
 /**