[RFC 4/4] iio: input-bridge: make the iio-input-bridge driver called by iio-core

From: H. Nikolaus Schaller
Date: Mon Mar 18 2019 - 16:40:04 EST


This adds the iio-input-bridge to iio device (un)registering so
that accelerometers are located and made present an input event
device.

Signed-off-by: H. Nikolaus Schaller <hns@xxxxxxxxxxxxx>
---
drivers/iio/industrialio-core.c | 12 ++++++++++++
1 file changed, 12 insertions(+)

diff --git a/drivers/iio/industrialio-core.c b/drivers/iio/industrialio-core.c
index 4700fd5d8c90..81f412b41a78 100644
--- a/drivers/iio/industrialio-core.c
+++ b/drivers/iio/industrialio-core.c
@@ -29,6 +29,7 @@
#include <linux/iio/iio.h>
#include "iio_core.h"
#include "iio_core_trigger.h"
+#include "industrialio-inputbridge.h"
#include <linux/iio/sysfs.h>
#include <linux/iio/events.h>
#include <linux/iio/buffer.h>
@@ -1723,6 +1724,15 @@ int __iio_device_register(struct iio_dev *indio_dev, struct module *this_mod)
if (ret < 0)
goto error_unreg_eventset;

+ ret = iio_device_register_inputbridge(indio_dev);
+ if (ret) {
+ dev_err(indio_dev->dev.parent,
+ "Failed to register as input driver\n");
+ device_del(&indio_dev->dev);
+
+ return ret;
+ }
+
return 0;

error_unreg_eventset:
@@ -1745,6 +1755,8 @@ void iio_device_unregister(struct iio_dev *indio_dev)
{
mutex_lock(&indio_dev->info_exist_lock);

+ iio_device_unregister_inputbridge(indio_dev);
+
cdev_device_del(&indio_dev->chrdev, &indio_dev->dev);

iio_device_unregister_debugfs(indio_dev);
--
2.19.1