public inbox for linux-next@vger.kernel.org 
 help / color / mirror / Atom feed
From: Stephen Rothwell <sfr@canb•auug.org.au>
To: "John W. Linville" <linville@tuxdriver•com>
Cc: linux-next@vger•kernel.org, linux-kernel@vger•kernel.org,
	Johannes Berg <johannes@sipsolutions•net>,
	Matthew Garrett <mjg59@srcf•ucam.org>,
	Len Brown <lenb@kernel•org>
Subject: linux-next: manual merge of the wireless tree with the acpi tree
Date: Wed, 3 Jun 2009 12:27:24 +1000	[thread overview]
Message-ID: <20090603122724.ddf679ba.sfr@canb.auug.org.au> (raw)

Hi John,

Today's linux-next merge of the wireless tree got a conflict in
drivers/platform/x86/toshiba_acpi.c between commit
76e310021ad9560fd02ce3d1e5723e5f0230ea7a ("toshiba_acpi: add full hotkey
support") from the acpi tree and commit
c6d660ce29295d344fcdc3654274b4a0aad1a9c8 ("rfkill: rewrite") from the
wireless tree.

I fixed it up (see below) and can carry the fix as necessary.
-- 
Cheers,
Stephen Rothwell                    sfr@canb•auug.org.au

diff --cc drivers/platform/x86/toshiba_acpi.c
index ce7de70,81d31ea..0000000
--- a/drivers/platform/x86/toshiba_acpi.c
+++ b/drivers/platform/x86/toshiba_acpi.c
@@@ -45,8 -45,6 +45,7 @@@
  #include <linux/backlight.h>
  #include <linux/platform_device.h>
  #include <linux/rfkill.h>
- #include <linux/input-polldev.h>
 +#include <linux/input.h>
  
  #include <asm/uaccess.h>
  
@@@ -282,15 -249,9 +281,11 @@@ static acpi_status hci_read2(u32 reg, u
  
  struct toshiba_acpi_dev {
  	struct platform_device *p_dev;
- 	struct rfkill *rfk_dev;
- 	struct input_polled_dev *poll_dev;
+ 	struct rfkill *bt_rfk;
 +	struct input_dev *hotkey_dev;
 +	acpi_handle handle;
  
  	const char *bt_name;
- 	const char *rfk_name;
- 
- 	bool last_rfk_state;
  
  	struct mutex mutex;
  };
@@@ -734,167 -675,13 +709,164 @@@ static struct backlight_ops toshiba_bac
          .update_status  = set_lcd_status,
  };
  
 +static struct key_entry *toshiba_acpi_get_entry_by_scancode(int code)
 +{
 +	struct key_entry *key;
 +
 +	for (key = toshiba_acpi_keymap; key->type != KE_END; key++)
 +		if (code == key->code)
 +			return key;
 +
 +	return NULL;
 +}
 +
 +static struct key_entry *toshiba_acpi_get_entry_by_keycode(int code)
 +{
 +	struct key_entry *key;
 +
 +	for (key = toshiba_acpi_keymap; key->type != KE_END; key++)
 +		if (code == key->keycode && key->type == KE_KEY)
 +			return key;
 +
 +	return NULL;
 +}
 +
 +static int toshiba_acpi_getkeycode(struct input_dev *dev, int scancode,
 +				   int *keycode)
 +{
 +	struct key_entry *key = toshiba_acpi_get_entry_by_scancode(scancode);
 +
 +	if (key && key->type == KE_KEY) {
 +		*keycode = key->keycode;
 +		return 0;
 +	}
 +
 +	return -EINVAL;
 +}
 +
 +static int toshiba_acpi_setkeycode(struct input_dev *dev, int scancode,
 +				   int keycode)
 +{
 +	struct key_entry *key;
 +	int old_keycode;
 +
 +	if (keycode < 0 || keycode > KEY_MAX)
 +		return -EINVAL;
 +
 +	key = toshiba_acpi_get_entry_by_scancode(scancode);
 +	if (key && key->type == KE_KEY) {
 +		old_keycode = key->keycode;
 +		key->keycode = keycode;
 +		set_bit(keycode, dev->keybit);
 +		if (!toshiba_acpi_get_entry_by_keycode(old_keycode))
 +			clear_bit(old_keycode, dev->keybit);
 +		return 0;
 +	}
 +
 +	return -EINVAL;
 +}
 +
 +static void toshiba_acpi_notify(acpi_handle handle, u32 event, void *context)
 +{
 +	u32 hci_result, value;
 +	struct key_entry *key;
 +
 +	if (event != 0x80)
 +		return;
 +	do {
 +		hci_read1(HCI_SYSTEM_EVENT, &value, &hci_result);
 +		if (hci_result == HCI_SUCCESS) {
 +			if (value == 0x100)
 +				continue;
 +			else if (value & 0x80) {
 +				key = toshiba_acpi_get_entry_by_scancode
 +					(value & ~0x80);
 +				if (!key) {
 +					printk(MY_INFO "Unknown key %x\n",
 +					       value & ~0x80);
 +					continue;
 +				}
 +				input_report_key(toshiba_acpi.hotkey_dev,
 +						 key->keycode, 1);
 +				input_sync(toshiba_acpi.hotkey_dev);
 +				input_report_key(toshiba_acpi.hotkey_dev,
 +						 key->keycode, 0);
 +				input_sync(toshiba_acpi.hotkey_dev);
 +			}
 +		} else if (hci_result == HCI_NOT_SUPPORTED) {
 +			/* This is a workaround for an unresolved issue on
 +			 * some machines where system events sporadically
 +			 * become disabled. */
 +			hci_write1(HCI_SYSTEM_EVENT, 1, &hci_result);
 +			printk(MY_NOTICE "Re-enabled hotkeys\n");
 +		}
 +	} while (hci_result != HCI_EMPTY);
 +}
 +
 +static int toshiba_acpi_setup_keyboard(char *device)
 +{
 +	acpi_status status;
 +	acpi_handle handle;
 +	int result;
 +	const struct key_entry *key;
 +
 +	status = acpi_get_handle(NULL, device, &handle);
 +	if (ACPI_FAILURE(status)) {
 +		printk(MY_INFO "Unable to get notification device\n");
 +		return -ENODEV;
 +	}
 +
 +	toshiba_acpi.handle = handle;
 +
 +	status = acpi_evaluate_object(handle, "ENAB", NULL, NULL);
 +	if (ACPI_FAILURE(status)) {
 +		printk(MY_INFO "Unable to enable hotkeys\n");
 +		return -ENODEV;
 +	}
 +
 +	status = acpi_install_notify_handler(handle, ACPI_DEVICE_NOTIFY,
 +					      toshiba_acpi_notify, NULL);
 +	if (ACPI_FAILURE(status)) {
 +		printk(MY_INFO "Unable to install hotkey notification\n");
 +		return -ENODEV;
 +	}
 +
 +	toshiba_acpi.hotkey_dev = input_allocate_device();
 +	if (!toshiba_acpi.hotkey_dev) {
 +		printk(MY_INFO "Unable to register input device\n");
 +		return -ENOMEM;
 +	}
 +
 +	toshiba_acpi.hotkey_dev->name = "Toshiba input device";
 +	toshiba_acpi.hotkey_dev->phys = device;
 +	toshiba_acpi.hotkey_dev->id.bustype = BUS_HOST;
 +	toshiba_acpi.hotkey_dev->getkeycode = toshiba_acpi_getkeycode;
 +	toshiba_acpi.hotkey_dev->setkeycode = toshiba_acpi_setkeycode;
 +
 +	for (key = toshiba_acpi_keymap; key->type != KE_END; key++) {
 +		set_bit(EV_KEY, toshiba_acpi.hotkey_dev->evbit);
 +		set_bit(key->keycode, toshiba_acpi.hotkey_dev->keybit);
 +	}
 +
 +	result = input_register_device(toshiba_acpi.hotkey_dev);
 +	if (result) {
 +		printk(MY_INFO "Unable to register input device\n");
 +		return result;
 +	}
 +
 +	return 0;
 +}
 +
  static void toshiba_acpi_exit(void)
  {
- 	if (toshiba_acpi.poll_dev) {
- 		input_unregister_polled_device(toshiba_acpi.poll_dev);
- 		input_free_polled_device(toshiba_acpi.poll_dev);
+ 	if (toshiba_acpi.bt_rfk) {
+ 		rfkill_unregister(toshiba_acpi.bt_rfk);
+ 		rfkill_destroy(toshiba_acpi.bt_rfk);
  	}
  
 +	if (toshiba_acpi.hotkey_dev)
 +		input_unregister_device(toshiba_acpi.hotkey_dev);
 +
- 	if (toshiba_acpi.rfk_dev)
- 		rfkill_unregister(toshiba_acpi.rfk_dev);
- 
  	if (toshiba_backlight_device)
  		backlight_device_unregister(toshiba_backlight_device);
  

             reply	other threads:[~2009-06-03  2:55 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-06-03  2:27 Stephen Rothwell [this message]
2009-06-03  3:05 ` linux-next: manual merge of the wireless tree with the acpi tree Matthew Garrett
2009-06-03  4:42   ` Stephen Rothwell
  -- strict thread matches above, loose matches on Subject: below --
2009-06-18  1:29 Stephen Rothwell
2009-06-03  2:20 Stephen Rothwell
2009-06-03  3:03 ` Matthew Garrett

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=20090603122724.ddf679ba.sfr@canb.auug.org.au \
    --to=sfr@canb$(echo .)auug.org.au \
    --cc=johannes@sipsolutions$(echo .)net \
    --cc=lenb@kernel$(echo .)org \
    --cc=linux-kernel@vger$(echo .)kernel.org \
    --cc=linux-next@vger$(echo .)kernel.org \
    --cc=linville@tuxdriver$(echo .)com \
    --cc=mjg59@srcf$(echo .)ucam.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
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