diff mbox series

[2/9] iio: backend: print message in case op is not implemented

Message ID 20240709-dev-iio-backend-add-debugfs-v1-2-fb4b8f2373c7@analog.com (mailing list archive)
State Accepted
Headers show
Series iio: adc: ad9467: add debugFS test mode support | expand

Commit Message

Nuno Sa July 9, 2024, 11:14 a.m. UTC
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>
---
 drivers/iio/industrialio-backend.c | 4 ++++
 1 file changed, 4 insertions(+)

Comments

Jonathan Cameron July 16, 2024, 6:07 p.m. UTC | #1
On Tue, 9 Jul 2024 13:14:29 +0200
Nuno Sa <nuno.sa@analog.com> wrote:

> 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>
Applied.
diff mbox series

Patch

diff --git a/drivers/iio/industrialio-backend.c b/drivers/iio/industrialio-backend.c
index 65a42944d090..f9da635cdfea 100644
--- a/drivers/iio/industrialio-backend.c
+++ b/drivers/iio/industrialio-backend.c
@@ -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));			\
 }
 
 /**