X86 platform drivers
 help / color / mirror / Atom feed
From: Dmitry Torokhov <dmitry.torokhov@gmail.com>
To: "Lee, Chun-Yi" <joeyli.kernel@gmail.com>
Cc: platform-driver-x86@vger.kernel.org, mjg59@srcf.ucam.org,
	carlos@strangeworlds.co.uk, linux-input@vger.kernel.org,
	tiwai@novell.com, trenn@novell.com, jbenc@suse.cz, "Lee,
	Chun-Yi" <jlee@novell.com>
Subject: Re: [PATCH 1/2] Add acer wmi hotkey events support
Date: Fri, 1 Oct 2010 09:58:34 -0700	[thread overview]
Message-ID: <20101001165833.GA15390@core.coreip.homeip.net> (raw)
In-Reply-To: <1285941088-31196-1-git-send-email-jlee@novell.com>

Hi Lee,

On Fri, Oct 01, 2010 at 09:51:27PM +0800, Lee, Chun-Yi wrote:
> +
> +struct key_entry {
> +	char type;	/* See KE_* below */
> +	u16 code;
> +	u16 keycode;
> +};
> +
> +enum { KE_KEY, KE_END };
> +

Like Corentin said, please use sparse_keymap, it will cut the code in
half.

> +
> +	set_bit(EV_SW, acer_wmi_input_dev->evbit);
> +

I do not see you sending SW_* events...

> +	err = input_register_device(acer_wmi_input_dev);
> +
> +	if (err) {
> +		input_free_device(acer_wmi_input_dev);
> +		return err;
> +	}
> +
> +	return 0;
> +}
> +
>  /*
>   * debugfs functions
>   */
> @@ -1327,6 +1518,18 @@ static int __init acer_wmi_init(void)
>  		       "generic video driver\n");
>  	}
>  
> +	if (wmi_has_guid(ACERWMID_EVENT_GUID)) {
> +		err = wmi_install_notify_handler(ACERWMID_EVENT_GUID,
> +						acer_wmi_notify, NULL);
> +		if (ACPI_FAILURE(err))
> +			return -EINVAL;
> +		err = acer_wmi_input_setup();

You really want to set up the device first and install notify handler
later. What will happen if event will fire up while input device has not
been created yet?

> +		if (err) {
> +			wmi_remove_notify_handler(ACERWMID_EVENT_GUID);
> +			return err;
> +		}
> +	}
> +
>  	err = platform_driver_register(&acer_platform_driver);
>  	if (err) {
>  		printk(ACER_ERR "Unable to register platform driver.\n");
> @@ -1368,11 +1571,21 @@ error_device_add:
>  error_device_alloc:
>  	platform_driver_unregister(&acer_platform_driver);
>  error_platform_register:
> +	if (wmi_has_guid(ACERWMID_EVENT_GUID)) {
> +		input_unregister_device(acer_wmi_input_dev);
> +		wmi_remove_notify_handler(ACERWMID_EVENT_GUID);

Same here, first shut off notified, then remove the device.

> +	}
> +
>  	return err;
>  }
>  
>  static void __exit acer_wmi_exit(void)
>  {
> +	if (wmi_has_guid(ACERWMID_EVENT_GUID)) {
> +		wmi_remove_notify_handler(ACERWMID_EVENT_GUID);
> +		input_unregister_device(acer_wmi_input_dev);

Same here.

Thanks.

-- 
Dmitry

  parent reply	other threads:[~2010-10-01 16:58 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-10-01 13:51 [PATCH 1/2] Add acer wmi hotkey events support Lee, Chun-Yi
2010-10-01 13:51 ` [PATCH 2/2] Support enable Acer Launch Manager mode Lee, Chun-Yi
2010-10-01 14:03 ` [PATCH 1/2] Add acer wmi hotkey events support Corentin Chary
2010-10-01 16:58 ` Dmitry Torokhov [this message]
2010-10-01 18:16 ` Carlos Corbacho
  -- strict thread matches above, loose matches on Subject: below --
2010-10-01 17:37 Joey Lee
2010-10-01 17:44 ` Dmitry Torokhov
2010-10-01 17:46   ` Dmitry Torokhov
2010-10-01 19:20 Joey Lee
2010-10-12  1:56 Joey Lee

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=20101001165833.GA15390@core.coreip.homeip.net \
    --to=dmitry.torokhov@gmail.com \
    --cc=carlos@strangeworlds.co.uk \
    --cc=jbenc@suse.cz \
    --cc=jlee@novell.com \
    --cc=joeyli.kernel@gmail.com \
    --cc=linux-input@vger.kernel.org \
    --cc=mjg59@srcf.ucam.org \
    --cc=platform-driver-x86@vger.kernel.org \
    --cc=tiwai@novell.com \
    --cc=trenn@novell.com \
    /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