linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Philip Langdale <philipl@overt.org>
To: Henrique de Moraes Holschuh <hmh@hmh.eng.br>
Cc: LKML <linux-kernel@vger.kernel.org>,
	Matthew Garrett <mjg59@srcf.ucam.org>,
	toshiba_acpi@memebeam.org, Ivo van Doorn <ivdoorn@gmail.com>,
	linux-wireless@vger.kernel.org
Subject: Re: [PATCH 1/1] toshiba_acpi: Add support for bluetooth toggling through rfkill (v2)
Date: Sun, 03 Aug 2008 18:10:46 -0700	[thread overview]
Message-ID: <48965716.6020508@overt.org> (raw)
In-Reply-To: <20080803042613.GC6053@khazad-dum.debian.net>

Henrique de Moraes Holschuh wrote:
>> +	value = state == RFKILL_STATE_UNBLOCKED;
> 
> value = (state == RFKILL_STATE_UNBLOCKED);
> 
> It is a lot easier to read without confusing the == for a =.

Fixed.

> 
> You don't really need the above, rfkill won't ever call your toggle_radio
> callback like that.
> 
> If you want paranoid checking, do this instead:
> 
> default:
> 	/* maybe WARN(), WARN_ON() or printk here */
> 	return -EINVAL;

Fixed.

>> +static void bt_acpi_notify(acpi_handle handle, u32 event, void *data)
>> +{
>> +	struct toshiba_acpi_dev *dev = data;
>> +
>> +	switch (event) {
>> +	case BT_ACPI_SOFT_UNBLOCKED_EVENT:
>> +		if (!dev->ignore_next_bt_event) {
>> +			bt_rfkill_toggle_radio(data, RFKILL_STATE_UNBLOCKED);
>> +			rfkill_force_state(dev->rfk_dev,
>> +					   RFKILL_STATE_UNBLOCKED);
> 
> This one got me confused.  Why do you need that bt_rfkill_toggle_radio call
> here?

When you turn off the hardware kill switch, the hardware will not reactivate
the bluetooth device. it just returns to the SOFT_UNBLOCKED state. I put that
in so that it would turn the device back on - a generally more desirable
behaviour - otherwise the user has to dig around for a software way to turn
it back. All the other hardware I've ever seen (including the wifi device on
this laptop) turns it back on, so it seemed sensible to try and make it work
as people would expect.

> 
> Read the kernel-doc headers of every rfkill function you call at least
> once...  Never rfkill_free() something you rfkill_unregister()'ed.
> 
> rfkill_free() is just for the error unwind of a failure between
> rfkill_allocate() and rfkill_register().

Fair enough, but it doesn't help that rfkill and input-polldev work in
exactly opposite ways; polldev requires you to unregister and then free;
some consistency wouldn't hurt.

>> +		toshiba_acpi.rfk_dev->dev.class->suspend = NULL;
>> +		toshiba_acpi.rfk_dev->dev.class->resume = NULL;
> 
> Why?

Good question. Gone.

> 
> Do the above between rfkill_allocate() and rfkill_register().
> 

Moved.

Diff is updated and resent as v3.

Thanks,

--phil

  reply	other threads:[~2008-08-04  1:11 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-08-02 19:12 [PATCH 1/1] toshiba_acpi: Add support for bluetooth toggling through rfkill (v2) Philip Langdale
2008-08-03  4:26 ` Henrique de Moraes Holschuh
2008-08-04  1:10   ` Philip Langdale [this message]
2008-08-05 21:24     ` Henrique de Moraes Holschuh
2008-08-06  3:33       ` Philip Langdale
2008-08-06 12:26         ` Henrique de Moraes Holschuh
2008-08-07  4:40       ` Philip Langdale
2008-08-07 13:45         ` Henrique de Moraes Holschuh
2008-08-11 16:41           ` Philip Langdale
2008-08-13  9:29             ` Henrique de Moraes Holschuh
2008-08-14  6:58               ` Philip Langdale
2008-08-16 19:22                 ` Philip Langdale

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=48965716.6020508@overt.org \
    --to=philipl@overt.org \
    --cc=hmh@hmh.eng.br \
    --cc=ivdoorn@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-wireless@vger.kernel.org \
    --cc=mjg59@srcf.ucam.org \
    --cc=toshiba_acpi@memebeam.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).