linux-input.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Dmitry Torokhov" <dmitry.torokhov@gmail.com>
To: Matthew Garrett <mjg59@srcf.ucam.org>
Cc: Carlos Corbacho <carlos@strangeworlds.co.uk>,
	linux-acpi@vger.kernel.org, Len Brown <lenb@kernel.org>,
	Alexey Starikovskiy <aystarik@gmail.com>,
	linux-input@vger.kernel.org
Subject: Re: [PATCH, RFC] HP WMI hotkey driver
Date: Thu, 3 Jan 2008 11:58:02 -0500	[thread overview]
Message-ID: <d120d5000801030858o7a1f5112g1041186636852ab7@mail.gmail.com> (raw)
In-Reply-To: <20071226224812.GA32652@srcf.ucam.org>

Hi Matthew,

On Dec 26, 2007 5:48 PM, Matthew Garrett <mjg59@srcf.ucam.org> wrote:
> +       } else
> +               printk (KERN_INFO "HP WMI: Unknown response received\n");
> +
> +       return;

No need for empty returns.

> +}
> +
> +static int __init hp_wmi_init(void)
> +{
> +       int err;
> +       const struct key_entry *key;
> +
> +       if (!wmi_has_guid(HPWMI_GUID)) {
> +               printk ("Unable to locate guid\n");
> +               return -ENODEV;
> +       }
> +
> +       err = wmi_install_notify_handler (hp_wmi_notify, NULL);
> +       if (err)
> +               return err;
> +
> +       hp_wmi_input_dev = input_allocate_device();
> +
> +       hp_wmi_input_dev->name = "HP WMI hotkeys";
> +       hp_wmi_input_dev->phys = "wmi/input0";
> +       hp_wmi_input_dev->id.bustype = BUS_HOST;
> +       hp_wmi_input_dev->getkeycode = hp_wmi_getkeycode;
> +       hp_wmi_input_dev->setkeycode = hp_wmi_setkeycode;
> +

There is no sysfs device to attach the input device to, by any chance?

> +       for (key = hp_wmi_keymap; key->type != KE_END; key++) {
> +               set_bit(EV_KEY, hp_wmi_input_dev->evbit);
> +               set_bit(key->keycode, hp_wmi_input_dev->keybit);
> +       }
> +
> +       err = input_register_device (hp_wmi_input_dev);
> +
> +       if (err) {
> +               input_free_device (hp_wmi_input_dev);
> +               return err;
> +       }
> +
> +       return 0;
> +}
> +
> +static void __exit hp_wmi_exit(void)
> +{
> +       wmi_remove_notify_handler();
> +       input_unregister_device (hp_wmi_input_dev);
> +       input_free_device (hp_wmi_input_dev);

Do not call input_free_device after input_unregister_device, it may
cause freeing already freed memory.

-- 
Dmitry

  reply	other threads:[~2008-01-03 16:58 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20071218235137.12838.75397.stgit@localhost>
2007-12-26 22:48 ` [PATCH, RFC] HP WMI hotkey driver Matthew Garrett
2008-01-03 16:58   ` Dmitry Torokhov [this message]
2008-01-14 17:41     ` [PATCH, RFC] HP WMI hotkey driver, RFKill query? Matthew Garrett
2008-01-14 18:27       ` Carlos Corbacho
2008-01-14 22:25         ` Carlos Corbacho
2008-01-15 20:54           ` Dmitry Torokhov
2008-01-16  1:38             ` Carlos Corbacho
2008-01-16  1:49               ` Matthew Garrett
2008-02-07  3:54               ` Len Brown
2008-02-08 15:26                 ` Carlos Corbacho

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=d120d5000801030858o7a1f5112g1041186636852ab7@mail.gmail.com \
    --to=dmitry.torokhov@gmail.com \
    --cc=aystarik@gmail.com \
    --cc=carlos@strangeworlds.co.uk \
    --cc=lenb@kernel.org \
    --cc=linux-acpi@vger.kernel.org \
    --cc=linux-input@vger.kernel.org \
    --cc=mjg59@srcf.ucam.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;
as well as URLs for NNTP newsgroup(s).