From: Darren Hart <dvhart@infradead.org>
To: Alex Hung <alex.hung@canonical.com>
Cc: corentin.chary@gmail.com, 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: Wed, 24 Jun 2015 21:04:56 -0700 [thread overview]
Message-ID: <20150625040456.GC18285@vmdeb7> (raw)
In-Reply-To: <1435114671-24380-1-git-send-email-alex.hung@canonical.com>
On Wed, Jun 24, 2015 at 10:57:51AM +0800, Alex Hung wrote:
> ASUS introduced a new approach to handle wireless hotkey
> since Windows 8. When the hotkey is pressed, BIOS generates
> a notification 0x88 to a new ACPI device, ATK4001. This
> new driver not only translates the notification to KEY_RFKILL
> but also toggles its LED accordingly.
>
> Signed-off-by: Alex Hung <alex.hung@canonical.com>
> ---
> MAINTAINERS | 6 +
> drivers/platform/x86/Kconfig | 11 ++
> drivers/platform/x86/Makefile | 1 +
> drivers/platform/x86/asus-rbtn.c | 240 +++++++++++++++++++++++++++++++++++++++
> 4 files changed, 258 insertions(+)
> create mode 100644 drivers/platform/x86/asus-rbtn.c
>
> diff --git a/MAINTAINERS b/MAINTAINERS
> index d8afd29..03711ce 100644
> --- a/MAINTAINERS
> +++ b/MAINTAINERS
> @@ -1673,6 +1673,12 @@ S: Maintained
> F: drivers/platform/x86/asus*.c
> F: drivers/platform/x86/eeepc*.c
>
> +ASUS RADIO BUTTON DRIVER
> +M: Alex Hung <alex.hung@canonical.com>
> +L: platform-driver-x86@vger.kernel.org
> +S: Maintained
> +F: drivers/platform/x86/asus-rbtn.c
> +
> ASYNCHRONOUS TRANSFERS/TRANSFORMS (IOAT) API
> R: Dan Williams <dan.j.williams@intel.com>
> W: http://sourceforge.net/projects/xscaleiop
> diff --git a/drivers/platform/x86/Kconfig b/drivers/platform/x86/Kconfig
> index f9f205c..a8ac885 100644
> --- a/drivers/platform/x86/Kconfig
> +++ b/drivers/platform/x86/Kconfig
> @@ -516,6 +516,17 @@ config EEEPC_LAPTOP
> If you have an Eee PC laptop, say Y or M here. If this driver
> doesn't work on your Eee PC, try eeepc-wmi instead.
>
> +config ASUS_RBTN
> + tristate "ASUS radio button"
> + depends on ACPI
> + depends on INPUT
> + help
> + This driver provides supports for new ASUS radio button for Windows 8.
s/supports/support/
Also, avoid using "new" in the Kconfig as this lives forever, in 10 years, it
won't be so new :-)
Consider:
"This driver supports the ASUS radio button for Windows 8."
(And maybe fix the entry for HP_WIRELESS while you're at it in a separate patch)
...
> +static int asus_rbtn_input_setup(void)
> +{
> + int err;
> +
> + asusrb_input_dev = input_allocate_device();
> + if (!asusrb_input_dev)
> + return -ENOMEM;
> +
> + asusrb_input_dev->name = "ASUS radio hotkeys";
> + asusrb_input_dev->phys = "atk4001/input0";
> + asusrb_input_dev->id.bustype = BUS_HOST;
> + asusrb_input_dev->evbit[0] = BIT(EV_KEY);
> + set_bit(KEY_RFKILL, asusrb_input_dev->keybit);
> +
> + err = input_register_device(asusrb_input_dev);
> + if (err)
> + goto err_free_dev;
> +
> + return 0;
> +
> +err_free_dev:
> + input_free_device(asusrb_input_dev);
> + return err;
I missed this on the first round. There is no need for a goto here at all:
int ret;
...
ret = input_register_Device(asusrb_input_dev);
if (ret)
input_free_device(asusrb_input_dev);
return ret;
Much nicer IMHO.
Do you have a strong preference for err over ret? In most cases in this driver,
ret would be the more typical choice in my experience.
I suppose this is modeled after hp-wireless which has the same error path in
hp_wireless_input_setup I mentioned above and uses err throughout - consistency
is a good thing. I won't argue over the ret/err thing as there is precedent in
this subsystem for similar drivers.
--
Darren Hart
Intel Open Source Technology Center
next prev parent reply other threads:[~2015-06-25 4:04 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 [this message]
2015-06-25 6:58 ` Paul Bolle
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=20150625040456.GC18285@vmdeb7 \
--to=dvhart@infradead.org \
--cc=acpi4asus-user@lists.sourceforge.net \
--cc=alex.hung@canonical.com \
--cc=corentin.chary@gmail.com \
--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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.