X86 platform drivers
 help / color / mirror / Atom feed
From: Paul Bolle <pebolle@tiscali.nl>
To: Alex Hung <alex.hung@canonical.com>,
	dvhart@infradead.org, corentin.chary@gmail.com
Cc: platform-driver-x86@vger.kernel.org,
	acpi4asus-user@lists.sourceforge.net,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH][v2] asus-rbtn: new driver for asus radio button for Windows 8
Date: Thu, 25 Jun 2015 08:58:04 +0200	[thread overview]
Message-ID: <1435215484.4528.96.camel@tiscali.nl> (raw)
In-Reply-To: <1435114671-24380-1-git-send-email-alex.hung@canonical.com>

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

  parent reply	other threads:[~2015-06-25  6:58 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-06-24  2:57 [PATCH][v2] asus-rbtn: new driver for asus radio button for Windows 8 Alex Hung
2015-06-25  4:04 ` Darren Hart
2015-06-25  6:58 ` Paul Bolle [this message]
2015-06-25 20:00   ` Darren Hart
2015-06-26 14:56 ` Pali Rohár
2015-06-26 15:24   ` Alex Hung
2015-06-29 12:29     ` Pali Rohár
2015-06-30  8:38       ` Alex Hung
2015-06-30  8:58         ` Pali Rohár
2015-06-30 16:09           ` Alex Hung
2015-06-30 17:04             ` Pali Rohár
2015-07-01 11:48             ` Pali Rohár
2015-07-02  7:10               ` Alex Hung
2015-07-03  7:25                 ` Pali Rohár
2015-07-06  1:35                   ` Alex Hung
2015-07-06 22:43                     ` Darren Hart
2015-07-07 14:25                       ` Pali Rohár
2015-07-09 20:52                         ` Darren Hart
2015-07-10  1:52                           ` Alex Hung
2015-07-12 13:02                             ` Corentin Chary
2015-06-30 16:17       ` Darren Hart

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1435215484.4528.96.camel@tiscali.nl \
    --to=pebolle@tiscali.nl \
    --cc=acpi4asus-user@lists.sourceforge.net \
    --cc=alex.hung@canonical.com \
    --cc=corentin.chary@gmail.com \
    --cc=dvhart@infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=platform-driver-x86@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox