public inbox for linux-acpi@vger.kernel.org
 help / color / mirror / Atom feed
From: Henrique de Moraes Holschuh <hmh@hmh.eng.br>
To: Carlos Corbacho <carlos@strangeworlds.co.uk>
Cc: linux-acpi@vger.kernel.org, linux-wireless@vger.kernel.org,
	Ivo van Doorn <ivdoorn@gmail.com>
Subject: Re: [RFC] acer-wmi: Add rfkill support for wireless and bluetooth
Date: Sat, 30 Aug 2008 11:07:30 -0300	[thread overview]
Message-ID: <20080830140730.GB12246@khazad-dum.debian.net> (raw)
In-Reply-To: <200808301206.56279.carlos@strangeworlds.co.uk>

On Sat, 30 Aug 2008, Carlos Corbacho wrote:
> +static void device##_rfkill_update(struct work_struct *ignored) \
> +{ \
> +	u32 state; \
> +	acpi_status status; \
> +	status = get_u32(&state, cap); \
> +	\
> +	if (ACPI_SUCCESS(status)) \
> +		rfkill_force_state(device##_rfkill, state); \
> +	queue_delayed_work(rfkill_workqueue, &device##_rfkill_work, \
> +		round_jiffies_relative(HZ)); \
> +}

Please explicitly map from state (int) to the parameter for
rfkill_force_state (enum rfkill_state).  The compiler will optimize it if it
is numerically equal.

> +static int acer_rfkill_init(struct device *dev)
> +{
> +	u32 state;
> +
> +	wireless_rfkill = rfkill_allocate(dev, RFKILL_TYPE_WLAN);

Where's the error handling?

> +	wireless_rfkill->name = "acer-wireless";
> +	get_u32(&state, ACER_CAP_WIRELESS);
> +	wireless_rfkill->state = state;

Needs proper map between types to be future-proof.

> +	wireless_rfkill->toggle_radio = wireless_rfkill_set;
> +	wireless_rfkill->user_claim_unsupported = 1;
> +
> +	bluetooth_rfkill = rfkill_allocate(dev, RFKILL_TYPE_BLUETOOTH);

Where's the error handling?

> +	bluetooth_rfkill->name = "acer-bluetooth";
> +	get_u32(&state, ACER_CAP_BLUETOOTH);
> +	bluetooth_rfkill->state = state;

Needs proper map between types to be future-proof.

BTW: you also need error handling on rfkill_register calls.

Since rfkill is a safety measure that the user will expect to be there
(after you add support and he starts using it), if you cannot register the
rfkill interfaces, you should fail the driver load.

-- 
  "One disk to rule them all, One disk to find them. One disk to bring
  them all and in the darkness grind them. In the Land of Redmond
  where the shadows lie." -- The Silicon Valley Tarot
  Henrique Holschuh

  reply	other threads:[~2008-08-30 14:07 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-08-30 11:06 [RFC] acer-wmi: Add rfkill support for wireless and bluetooth Carlos Corbacho
2008-08-30 14:07 ` Henrique de Moraes Holschuh [this message]
     [not found]   ` <20080830140730.GB12246-ZGHd14iZgfaRjzvQDGKj+xxZW9W5cXbT@public.gmane.org>
2008-08-30 15:54     ` [RFC] acer-wmi: Add rfkill support for wireless and bluetooth (v2) Carlos Corbacho
2008-08-31 13:36       ` Henrique de Moraes Holschuh
2008-09-07 17:13         ` [RFC] acer-wmi: Add rfkill support for wireless and bluetooth (v3) Carlos Corbacho
2008-09-08  3:29           ` Henrique de Moraes Holschuh
2008-09-12 19:44             ` [RFC] acer-wmi: Add rfkill support for wireless and bluetooth (v4) Carlos Corbacho
2008-09-12 20:20               ` Henrique de Moraes Holschuh
     [not found]               ` <200809122044.27418.carlos-8YloKY0SPvpS8uBCpOlSjPXRex20P6io@public.gmane.org>
2008-09-12 20:43                 ` Dmitry Torokhov
     [not found]                   ` <20080912164039.ZZRA012-NG0XCrj25/nJrYCpivWRnl5pS2h4L8biXqFh9Ls21Oc@public.gmane.org>
2008-09-12 22:04                     ` [RFC] acer-wmi: Add rfkill support for wireless and bluetooth (v5) Carlos Corbacho
     [not found]                       ` <200809122304.21000.carlos-8YloKY0SPvpS8uBCpOlSjPXRex20P6io@public.gmane.org>
2008-09-14 12:18                         ` Dmitry Torokhov

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=20080830140730.GB12246@khazad-dum.debian.net \
    --to=hmh@hmh.eng.br \
    --cc=carlos@strangeworlds.co.uk \
    --cc=ivdoorn@gmail.com \
    --cc=linux-acpi@vger.kernel.org \
    --cc=linux-wireless@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