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
| ||
|
Date: Mon, 27 Jun 2011 18:21:51 -0700 From: Sergiu Iordache <sergiu@...omium.org> To: Marco Stornelli <marco.stornelli@...il.com> Cc: Andrew Morton <akpm@...ux-foundation.org>, Sergiu Iordache <sergiu@...omium.org>, "Ahmed S. Darwish" <darwish.07@...il.com>, Artem Bityutskiy <Artem.Bityutskiy@...ia.com>, Kyungmin Park <kyungmin.park@...sung.com>, linux-kernel@...r.kernel.org Subject: [PATCH 1/3] char drivers: ramoops default platform device for module parameter use The introduction of platform data in ramoops resulted in the need to define a platform device in order to use the ramoops module with module parameters (without setting any platform data). Sadly this is not clear or properly documented. This patch checks if the module parameters are set and declares a platform device if they are so that the module can be used with module parameters without any aditional declarations out of the module. Change-Id: I3cdb0f8e27852ac79e327e526645c9859f19efa8 Signed-off-by: Sergiu Iordache <sergiu@...omium.org> --- drivers/char/ramoops.c | 20 ++++++++++++++++++++ 1 files changed, 20 insertions(+), 0 deletions(-) diff --git a/drivers/char/ramoops.c b/drivers/char/ramoops.c index 1a9f5f6..0c3cb42 100644 --- a/drivers/char/ramoops.c +++ b/drivers/char/ramoops.c @@ -177,13 +177,33 @@ static struct platform_driver ramoops_driver = { }, }; +struct platform_device *ramoops_device; + static int __init ramoops_init(void) { + /* + * If mem_address and mem_size are set (i.e. the module parameters + * are used) then a default platform driver is created + * as there is no need to configure the platform data elsewhere. + */ + if (mem_address && mem_size) { + ramoops_device = platform_device_register_simple("ramoops", + -1, NULL, 0); + + if (IS_ERR(ramoops_device)) { + printk(KERN_ERR "Unable to register platform device\n"); + return PTR_ERR(ramoops_device); + } + } + return platform_driver_probe(&ramoops_driver, ramoops_probe); } static void __exit ramoops_exit(void) { + /* Unregister the device if it was set */ + if (ramoops_device) + platform_device_unregister(ramoops_device); platform_driver_unregister(&ramoops_driver); } -- 1.7.3.1 -- 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