В Tue, 3 Feb 2015 11:38:35 -0800 Dmitry Torokhov <dmitry.torokhov@xxxxxxxxx> пишет: > On Tue, Feb 03, 2015 at 12:48:49AM +0300, Roman Volkov wrote: > > 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@xxxxxxxxxxxxxxx> > > Signed-off-by: Roman Volkov <v1ron@xxxxxxxxx> > > --- > > > > 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). > > I guess we need to split the dirver into part that create platform > device and the standard driver part. Then your OF code can supply most > of the needed data via resources/platform data. Yes, it is a larger > change, but the current splat of ifdefs makes my eyes water. > > Thanks. > Dmitry, could you describe this in details? Currently there is platform_create_bundle() function in the driver that is not acceptable to be used with OF (it creates additional device). This function must be replaced with platform_driver_probe() and it is all that common between various architectures and can be the "standard" part of the driver. The difference is in device creation between OF case and, for example, x86 case. Here is a chicken-and-egg problem that needs to be solved, if we try to make the code consistent between various platforms. The problem is that i8042_platform_init() expected to be called first, but at this point DT version requires platform_device structure pointer. Regards, Roman. -- To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html