Re: PC Engines APU/APU2 led driver

Pavel Machek
2017-09-11T06:15:15Z

[-- Attachment #1: Type: text/plain, Size: 1226 bytes --]

Hi!

> static int __init apu_led_init(void)
> {
> struct platform_device *pdev;
> int err;
>
> if (!dmi_match(DMI_SYS_VENDOR, "PC Engines")) {
> pr_err("No PC Engines board detected\n");
> return -ENODEV;
> }
> if (!(dmi_match(DMI_PRODUCT_NAME, "APU") || dmi_match(DMI_PRODUCT_NAME, "APU2"))) {
> printk(KERN_ERR "Unknown PC Engines board: %s\n", dmi_get_system_info(DMI_PRODUCT_NAME));
> return -ENODEV;
> }
>
> pdev = platform_device_register_simple(KBUILD_MODNAME, -1, NULL, 0);
> if (IS_ERR(pdev)) {
> pr_err("Device allocation failed\n");
> return PTR_ERR(pdev);
> }
>
> err = platform_driver_probe(&apu_led_driver, apu_led_probe);
> if (err) {
> pr_err("Probe platform driver failed\n");
> platform_device_unregister(pdev);
> }
>
> return err;
> }
>
> static void __exit apu_led_exit(void)
> {
> platform_device_unregister(apu_led->pdev);
> platform_driver_unregister(&apu_led_driver);
> }

Normally, I'd expect _exit() to be 'reverse' of _init(). That is I'd
expect reverese order there.
Pavel

--
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 181 bytes --]