Skip to contentSkip to conversation

toshiba_acpi: Purge driver from bluetooth RFKill code

PATCH Superseded Azael Avalos 2 participants 4 messages Apr 27, 2015 – May 3, 2015

Subsystems (2)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore

Azael Avalos

author maintainer
#0 lore raw

cover toshiba_acpi: Purge driver from bluetooth RFKill code

These two patches remove all bluetooth rfkill code from toshiba_acpi and its build dependencies, as another series of patches will re-add the rfkill code to toshiba_bluetooth instead.

Azael Avalos (2):
toshiba_acpi: Remove bluetooth rfkill code platform/x86: Remove RFKILL dependency from toshiba_acpi

 drivers/platform/x86/Kconfig        |   1 -
 drivers/platform/x86/toshiba_acpi.c | 123 ------------------------------------
 2 files changed, 124 deletions(-)
Signature · 1 line
2.3.5
author maintainer
#1 lore raw

PATCH 1/2 toshiba_acpi: Remove bluetooth rfkill code

This patch removes all bluetooth rfkill related code residing in the toshiba_acpi driver.

Separate patches will add (and adapt) the code to toshiba_bluetooth (where it belongs).

---
 drivers/platform/x86/toshiba_acpi.c | 123 ------------------------------------
 1 file changed, 123 deletions(-)
drivers/platform/x86/toshiba_acpi.c +0 -123
index f624dd5..2599d23 100644
@@ -41,7 +41,6 @@
 #include <linux/proc_fs.h>
 #include <linux/seq_file.h>
 #include <linux/backlight.h>
-#include <linux/rfkill.h>
 #include <linux/input.h>
 #include <linux/input/sparse-keymap.h>
 #include <linux/leds.h>
@@ -163,7 +162,6 @@ MODULE_LICENSE("GPL");
 struct toshiba_acpi_dev {
 	struct acpi_device *acpi_dev;
 	const char *method_hci;
-	struct rfkill *bt_rfk;
 	struct input_dev *hotkey_dev;
 	struct work_struct hotkey_work;
 	struct backlight_device *backlight_dev;
@@ -200,8 +198,6 @@ struct toshiba_acpi_dev {
 	unsigned int panel_power_on_supported:1;
 	unsigned int usb_three_supported:1;
 	unsigned int sysfs_created:1;
-
-	struct mutex mutex;
 };
 
 static struct toshiba_acpi_dev *toshiba_acpi;
@@ -1202,97 +1198,6 @@ static int toshiba_hotkey_event_type_get(struct toshiba_acpi_dev *dev,
 	return 0;
 }
 
-/* Bluetooth rfkill handlers */
-
-static u32 hci_get_bt_present(struct toshiba_acpi_dev *dev, bool *present)
-{
-	u32 hci_result;
-	u32 value, value2;
-
-	value = 0;
-	value2 = 0;
-	hci_result = hci_read2(dev, HCI_WIRELESS, &value, &value2);
-	if (hci_result == TOS_SUCCESS)
-		*present = (value & HCI_WIRELESS_BT_PRESENT) ? true : false;
-
-	return hci_result;
-}
-
-static u32 hci_get_radio_state(struct toshiba_acpi_dev *dev, bool *radio_state)
-{
-	u32 hci_result;
-	u32 value, value2;
-
-	value = 0;
-	value2 = 0x0001;
-	hci_result = hci_read2(dev, HCI_WIRELESS, &value, &value2);
-
-	*radio_state = value & HCI_WIRELESS_KILL_SWITCH;
-	return hci_result;
-}
-
-static int bt_rfkill_set_block(void *data, bool blocked)
-{
-	struct toshiba_acpi_dev *dev = data;
-	u32 result1, result2;
-	u32 value;
-	int err;
-	bool radio_state;
-
-	value = (blocked == false);
-
-	mutex_lock(&dev->mutex);
-	if (hci_get_radio_state(dev, &radio_state) != TOS_SUCCESS) {
-		err = -EIO;
-		goto out;
-	}
-
-	if (!radio_state) {
-		err = 0;
-		goto out;
-	}
-
-	result1 = hci_write2(dev, HCI_WIRELESS, value, HCI_WIRELESS_BT_POWER);
-	result2 = hci_write2(dev, HCI_WIRELESS, value, HCI_WIRELESS_BT_ATTACH);
-
-	if (result1 != TOS_SUCCESS || result2 != TOS_SUCCESS)
-		err = -EIO;
-	else
-		err = 0;
- out:
-	mutex_unlock(&dev->mutex);
-	return err;
-}
-
-static void bt_rfkill_poll(struct rfkill *rfkill, void *data)
-{
-	bool new_rfk_state;
-	bool value;
-	u32 hci_result;
-	struct toshiba_acpi_dev *dev = data;
-
-	mutex_lock(&dev->mutex);
-
-	hci_result = hci_get_radio_state(dev, &value);
-	if (hci_result != TOS_SUCCESS) {
-		/* Can't do anything useful */
-		mutex_unlock(&dev->mutex);
-		return;
-	}
-
-	new_rfk_state = value;
-
-	mutex_unlock(&dev->mutex);
-
-	if (rfkill_set_hw_state(rfkill, !new_rfk_state))
-		bt_rfkill_set_block(data, true);
-}
-
-static const struct rfkill_ops toshiba_rfk_ops = {
-	.set_block = bt_rfkill_set_block,
-	.poll = bt_rfkill_poll,
-};
-
 static int get_tr_backlight_status(struct toshiba_acpi_dev *dev, bool *enabled)
 {
 	u32 hci_result;
@@ -2668,11 +2573,6 @@ static int toshiba_acpi_remove(struct acpi_device *acpi_dev)
 		sparse_keymap_free(dev->hotkey_dev);
 	}
 
-	if (dev->bt_rfk) {
-		rfkill_unregister(dev->bt_rfk);
-		rfkill_destroy(dev->bt_rfk);
-	}
-
 	backlight_device_unregister(dev->backlight_dev);
 
 	if (dev->illumination_supported)
@@ -2745,33 +2645,10 @@ static int toshiba_acpi_add(struct acpi_device *acpi_dev)
 	if (toshiba_acpi_setup_keyboard(dev))
 		pr_info("Unable to activate hotkeys\n");
 
-	mutex_init(&dev->mutex);
-
 	ret = toshiba_acpi_setup_backlight(dev);
 	if (ret)
 		goto error;
 
-	/* Register rfkill switch for Bluetooth */
-	if (hci_get_bt_present(dev, &bt_present) == TOS_SUCCESS && bt_present) {
-		dev->bt_rfk = rfkill_alloc("Toshiba Bluetooth",
-					   &acpi_dev->dev,
-					   RFKILL_TYPE_BLUETOOTH,
-					   &toshiba_rfk_ops,
-					   dev);
-		if (!dev->bt_rfk) {
-			pr_err("unable to allocate rfkill device\n");
-			ret = -ENOMEM;
-			goto error;
-		}
-
-		ret = rfkill_register(dev->bt_rfk);
-		if (ret) {
-			pr_err("unable to register rfkill device\n");
-			rfkill_destroy(dev->bt_rfk);
-			goto error;
-		}
-	}
-
 	if (toshiba_illumination_available(dev)) {
 		dev->led_dev.name = "toshiba::illumination";
 		dev->led_dev.max_brightness = 1;
Signature · 1 line
2.3.5
#2 lore raw

Re: [PATCH 1/2] toshiba_acpi: Remove bluetooth rfkill code

Quoted 7 lines · Azael Avalos

This patch removes all bluetooth rfkill related code residing in the toshiba_acpi driver.

Separate patches will add (and adapt) the code to toshiba_bluetooth (where it belongs).

Hi Azael,

With this applied the driver as build warnings:

...
CC [M] drivers/platform/x86/toshiba_acpi.o
drivers/platform/x86/toshiba_acpi.c: In function ‘toshiba_acpi_add’:
drivers/platform/x86/toshiba_acpi.c:2636:7: warning: unused variable ‘bt_present’ [-Wunused-variable]

  bool bt_present;
       ^

drivers/platform/x86/toshiba_acpi.c: At top level:
drivers/platform/x86/toshiba_acpi.c:358:12: warning: ‘hci_write2’ defined but not used [-Wunused-function]
static u32 hci_write2(struct toshiba_acpi_dev *dev, u32 reg, u32 in1, u32 in2)

I presume these should be removed as well?

Thanks,

Signature · 2 lines
Darren Hart
Intel Open Source Technology Center
author maintainer
#3 lore raw

PATCH 2/2 platform/x86: Remove RFKILL dependency from toshiba_acpi

In reply to Azael Avalos

This patch removes the dependency on rfkill for toshiba_acpi from KConfig, as a previous patch removed all the code related to it.

---
 drivers/platform/x86/Kconfig | 1 -
 1 file changed, 1 deletion(-)
drivers/platform/x86/Kconfig +0 -1
index 9752761..35319f8 100644
@@ -612,7 +612,6 @@ config ACPI_TOSHIBA
 	select NEW_LEDS
 	depends on BACKLIGHT_CLASS_DEVICE
 	depends on INPUT
-	depends on RFKILL || RFKILL = n
 	depends on SERIO_I8042 || SERIO_I8042 = n
 	select INPUT_POLLDEV
 	select INPUT_SPARSEKMAP
Signature · 1 line
2.3.5