lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Tue,  3 Feb 2015 00:48:49 +0300
From:	Roman Volkov <v1ron@...os.org>
To:	Dmitry Torokhov <dmitry.torokhov@...il.com>,
	Rob Herring <robh+dt@...nel.org>,
	Pawel Moll <pawel.moll@....com>,
	Mark Rutland <mark.rutland@....com>,
	Ian Campbell <ijc+devicetree@...lion.org.uk>,
	Kumar Gala <galak@...eaurora.org>,
	Grant Likely <grant.likely@...aro.org>
Cc:	Hans de Goede <hdegoede@...hat.com>, Jiri Kosina <jkosina@...e.cz>,
	Wolfram Sang <wsa@...-dreams.de>, linux-input@...r.kernel.org,
	linux-kernel@...r.kernel.org, devicetree@...r.kernel.org,
	Roman Volkov <v1ron@...l.ru>, Roman Volkov <v1ron@...os.org>,
	Tony Prisk <linux@...sktech.co.nz>
Subject: [PATCH 4/5] i8042: Prepare i8042 driver for DT support

Use platform_device_probe() instead of platform_create_bundle() when
compiled with DT support, since the latter function is not suitable for
handling the OF device tree.

The order of initialization is changed, since i8042_platform_init() for DT
requires initialized platform_device structure. To avoid searching of the
compatible node twice, the platform_device structure pointer must be passed
to the i8042_platform_init() function right after initialization by
platform_device_probe().

Signed-off-by: Tony Prisk <linux@...sktech.co.nz>
Signed-off-by: Roman Volkov <v1ron@...os.org>
---

Yes, many of these ifdefs look ugly. Suggestions on how to avoid this are
welcome (except using of_find_compatible_node() for searching the node twice
before calling the probe function).

The problem is that platform_device_add() causes parent drivers to be probed
while the i8042 is not ready yet (register addresses point to the sky).

I would suggest to do something like deferred probing of the parent drivers,
but this would be a part of another investigation and patchset.

Regards,
Roman.

 drivers/input/serio/i8042.c | 33 ++++++++++++++++++++++++++++++---
 1 file changed, 30 insertions(+), 3 deletions(-)

diff --git a/drivers/input/serio/i8042.c b/drivers/input/serio/i8042.c
index c53323e..2978b0e 100644
--- a/drivers/input/serio/i8042.c
+++ b/drivers/input/serio/i8042.c
@@ -1407,16 +1407,32 @@ static int __init i8042_probe(struct platform_device *dev)
 	int error;
 
 	i8042_platform_device = dev;
+#ifdef SERIO_I8042_DT
+	error = i8042_platform_init(dev);
+	if (error)
+		return error;
 
+	error = i8042_controller_check();
+	if (error)
+		goto out_platform_exit;
+#endif
 	if (i8042_reset) {
 		error = i8042_controller_selftest();
 		if (error)
+#ifdef SERIO_I8042_DT
+			goto out_platform_exit;
+#else
 			return error;
+#endif
 	}
 
 	error = i8042_controller_init();
 	if (error)
+#ifdef SERIO_I8042_DT
+		goto out_platform_exit;
+#else
 		return error;
+#endif
 
 #ifdef CONFIG_X86
 	if (i8042_dritek)
@@ -1446,7 +1462,10 @@ static int __init i8042_probe(struct platform_device *dev)
 	i8042_free_irqs();
 	i8042_controller_reset(false);
 	i8042_platform_device = NULL;
-
+#ifdef SERIO_I8042_DT
+ out_platform_exit:
+	i8042_platform_exit();
+#endif
 	return error;
 }
 
@@ -1483,11 +1502,18 @@ static struct platform_driver i8042_driver = {
 
 static int __init i8042_init(void)
 {
+#ifndef SERIO_I8042_DT
 	struct platform_device *pdev;
+#endif
 	int err;
 
 	dbg_init();
 
+#ifdef SERIO_I8042_DT
+	err = platform_driver_probe(&i8042_driver, i8042_probe);
+	if (err)
+		return err;
+#else
 	err = i8042_platform_init();
 	if (err)
 		return err;
@@ -1501,14 +1527,15 @@ static int __init i8042_init(void)
 		err = PTR_ERR(pdev);
 		goto err_platform_exit;
 	}
-
+#endif
 	panic_blink = i8042_panic_blink;
 
 	return 0;
-
+#ifndef SERIO_I8042_DT
  err_platform_exit:
 	i8042_platform_exit();
 	return err;
+#endif
 }
 
 static void __exit i8042_exit(void)
-- 
2.2.2

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ