Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751222AbbFYG6Y (ORCPT ); Thu, 25 Jun 2015 02:58:24 -0400 Received: from lb1-smtp-cloud6.xs4all.net ([194.109.24.24]:34768 "EHLO lb1-smtp-cloud6.xs4all.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751017AbbFYG6Q (ORCPT ); Thu, 25 Jun 2015 02:58:16 -0400 Message-ID: <1435215484.4528.96.camel@tiscali.nl> Subject: Re: [PATCH][v2] asus-rbtn: new driver for asus radio button for Windows 8 From: Paul Bolle To: Alex Hung , dvhart@infradead.org, corentin.chary@gmail.com Cc: platform-driver-x86@vger.kernel.org, acpi4asus-user@lists.sourceforge.net, linux-kernel@vger.kernel.org Date: Thu, 25 Jun 2015 08:58:04 +0200 In-Reply-To: <1435114671-24380-1-git-send-email-alex.hung@canonical.com> References: <1435114671-24380-1-git-send-email-alex.hung@canonical.com> Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.16.3 (3.16.3-2.fc22) Mime-Version: 1.0 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1896 Lines: 76 On Wed, 2015-06-24 at 10:57 +0800, Alex Hung wrote: > --- /dev/null > +++ b/drivers/platform/x86/asus-rbtn.c > +MODULE_ALIAS("acpi*:ATK4001:*"); This looked odd. It turned out this is the pattern that scripts/mod/file2alias.c::do_acpi_entry() creates. > +static const struct acpi_device_id asusrb_ids[] = { > + {"ATK4001", 0}, > + {"", 0}, > +}; I think you should just put MODULE_DEVICE_TABLE(acpi, asusrb_ids); here, like all other drivers do, and drop the odd looking alias. All others drivers except drivers/platform/x86/hp-wireless.c, that is. (I noticed that you also wrote that driver.) It should just use MODULE_DEVICE_TABLE() too > +static int __init asusrb_init(void) > +{ > + int err; > + > + [...] > + > + asuspl_dev = platform_device_alloc("asus-rbtn", -1); > + if (!asuspl_dev) { > + err = -ENOMEM; > + goto err_device_alloc; > + } > + err = platform_device_add(asuspl_dev); > + if (err) > + goto err_device_add; > + > + return 0; > + > +err_device_add: > + platform_device_put(asuspl_dev); > +err_device_alloc: > + platform_driver_unregister(&asuspl_driver); > +err_driver_reg: > + return err; > +} > + > +static void __exit asusrb_exit(void) > +{ > + pr_info("Exiting ATK4001 module\n"); > + acpi_bus_unregister_driver(&asusrb_driver); > + > + if (asuspl_dev) { If asusrb_exit() will be run asusrb_init() must have completed successfully before, right? And is there a way for asuspl_dev to be NULL after asusrb_init() succeeded? > + platform_device_unregister(asuspl_dev); > + platform_driver_unregister(&asuspl_driver); > + } > +} > + > +module_init(asusrb_init); > +module_exit(asusrb_exit); Thanks, Paul Bolle -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/