+ value = state == RFKILL_STATE_UNBLOCKED;
value = (state == RFKILL_STATE_UNBLOCKED);
It is a lot easier to read without confusing the == for a =.
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;
+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?
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().
+ toshiba_acpi.rfk_dev->dev.class->suspend = NULL;
+ toshiba_acpi.rfk_dev->dev.class->resume = NULL;
Why?
Do the above between rfkill_allocate() and rfkill_register().