All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jonathan Woithe <jwoithe@physics.adelaide.edu.au>
To: Bjorn Helgaas <bjorn.helgaas@hp.com>
Cc: Len Brown <lenb@kernel.org>, Tony Vroon <tony@linx.net>,
	Alex Chiang <achiang@hp.com>,
	linux-acpi@vger.kernel.org,
	Carlos Corbacho <carlos@strangeworlds.co.uk>,
	Anil S Keshavamurthy <anil.s.keshavamurthy@intel.com>,
	Jonathan Woithe <jwoithe@physics.adelaide.edu.au>,
	Zhao Yakui <yakui.zhao@intel.com>,
	Mattia Dongili <malattia@linux.it>,
	Harald Welte <laforge@gnumonks.org>,
	Venki Pallipadi <venkatesh.pallipadi@intel.com>,
	Alexey Starikovskiy <alexey.y.starikovskiy@linux.intel.com>,
	Zhang Rui <rui.zhang@intel.com>, Matthew Garrett <mjg@redhat.com>
Subject: Re: [PATCH 07/10] fujitsu-laptop: use .notify method instead of installing handler directly
Date: Wed, 1 Apr 2009 08:00:45 +0930 (CST)	[thread overview]
Message-ID: <200903312230.n2VMUjM1014758@turbo.physics.adelaide.edu.au> (raw)
In-Reply-To: <20090330174844.20905.18635.stgit@bob.kio> from "Bjorn Helgaas" at Mar 30, 2009 11:48:44 AM

> This patch adds a .notify() method.  The presence of .notify() causes
> Linux/ACPI to manage event handlers and notify handlers on our behalf,
> so we don't have to install and remove them ourselves.
> 
> Signed-off-by: Bjorn Helgaas <bjorn.helgaas@hp.com>
> CC: Jonathan Woithe <jwoithe@physics.adelaide.edu.au>
> CC: Tony Vroon <tony@linx.net>

This patch also looks to be fine (machine is S7020).  Thanks again Bjorn.

Acked-by: Jonathan Woithe <jwoithe@physics.adelaide.edu.au>

Regards
  jonathan

> ---
>  drivers/platform/x86/fujitsu-laptop.c |   32 +++++---------------------------
>  1 files changed, 5 insertions(+), 27 deletions(-)
> 
> diff --git a/drivers/platform/x86/fujitsu-laptop.c b/drivers/platform/x86/fujitsu-laptop.c
> index 10f8796..218b9a1 100644
> --- a/drivers/platform/x86/fujitsu-laptop.c
> +++ b/drivers/platform/x86/fujitsu-laptop.c
> @@ -174,8 +174,7 @@ struct fujitsu_hotkey_t {
>  
>  static struct fujitsu_hotkey_t *fujitsu_hotkey;
>  
> -static void acpi_fujitsu_hotkey_notify(acpi_handle handle, u32 event,
> -				       void *data);
> +static void acpi_fujitsu_hotkey_notify(struct acpi_device *device, u32 event);
>  
>  #ifdef CONFIG_LEDS_CLASS
>  static enum led_brightness logolamp_get(struct led_classdev *cdev);
> @@ -816,7 +815,6 @@ static void acpi_fujitsu_notify(struct acpi_device *device, u32 event)
>  
>  static int acpi_fujitsu_hotkey_add(struct acpi_device *device)
>  {
> -	acpi_status status;
>  	acpi_handle handle;
>  	int result = 0;
>  	int state = 0;
> @@ -833,17 +831,6 @@ static int acpi_fujitsu_hotkey_add(struct acpi_device *device)
>  	sprintf(acpi_device_class(device), "%s", ACPI_FUJITSU_CLASS);
>  	device->driver_data = fujitsu_hotkey;
>  
> -	status = acpi_install_notify_handler(device->handle,
> -					     ACPI_DEVICE_NOTIFY,
> -					     acpi_fujitsu_hotkey_notify,
> -					     fujitsu_hotkey);
> -
> -	if (ACPI_FAILURE(status)) {
> -		printk(KERN_ERR "Error installing notify handler\n");
> -		error = -ENODEV;
> -		goto err_stop;
> -	}
> -
>  	/* kfifo */
>  	spin_lock_init(&fujitsu_hotkey->fifo_lock);
>  	fujitsu_hotkey->fifo =
> @@ -858,7 +845,7 @@ static int acpi_fujitsu_hotkey_add(struct acpi_device *device)
>  	fujitsu_hotkey->input = input = input_allocate_device();
>  	if (!input) {
>  		error = -ENOMEM;
> -		goto err_uninstall_notify;
> +		goto err_free_fifo;
>  	}
>  
>  	snprintf(fujitsu_hotkey->phys, sizeof(fujitsu_hotkey->phys),
> @@ -954,9 +941,7 @@ static int acpi_fujitsu_hotkey_add(struct acpi_device *device)
>  end:
>  err_free_input_dev:
>  	input_free_device(input);
> -err_uninstall_notify:
> -	acpi_remove_notify_handler(device->handle, ACPI_DEVICE_NOTIFY,
> -				   acpi_fujitsu_hotkey_notify);
> +err_free_fifo:
>  	kfifo_free(fujitsu_hotkey->fifo);
>  err_stop:
>  
> @@ -965,7 +950,6 @@ err_stop:
>  
>  static int acpi_fujitsu_hotkey_remove(struct acpi_device *device, int type)
>  {
> -	acpi_status status;
>  	struct fujitsu_hotkey_t *fujitsu_hotkey = NULL;
>  
>  	if (!device || !acpi_driver_data(device))
> @@ -973,10 +957,6 @@ static int acpi_fujitsu_hotkey_remove(struct acpi_device *device, int type)
>  
>  	fujitsu_hotkey = acpi_driver_data(device);
>  
> -	status = acpi_remove_notify_handler(fujitsu_hotkey->acpi_handle,
> -					    ACPI_DEVICE_NOTIFY,
> -					    acpi_fujitsu_hotkey_notify);
> -
>  	fujitsu_hotkey->acpi_handle = NULL;
>  
>  	kfifo_free(fujitsu_hotkey->fifo);
> @@ -984,8 +964,7 @@ static int acpi_fujitsu_hotkey_remove(struct acpi_device *device, int type)
>  	return 0;
>  }
>  
> -static void acpi_fujitsu_hotkey_notify(acpi_handle handle, u32 event,
> -				       void *data)
> +static void acpi_fujitsu_hotkey_notify(struct acpi_device *device, u32 event)
>  {
>  	struct input_dev *input;
>  	int keycode, keycode_r;
> @@ -1068,8 +1047,6 @@ static void acpi_fujitsu_hotkey_notify(acpi_handle handle, u32 event,
>  		input_sync(input);
>  		break;
>  	}
> -
> -	return;
>  }
>  
>  /* Initialization */
> @@ -1102,6 +1079,7 @@ static struct acpi_driver acpi_fujitsu_hotkey_driver = {
>  	.ops = {
>  		.add = acpi_fujitsu_hotkey_add,
>  		.remove = acpi_fujitsu_hotkey_remove,
> +		.notify = acpi_fujitsu_hotkey_notify,
>  		},
>  };
>  
> 

  parent reply	other threads:[~2009-03-31 22:33 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-03-30 17:48 [PATCH 00/10] ACPI: add device .notify methods Bjorn Helgaas
2009-03-30 17:48 ` [PATCH 01/10] ACPI: support acpi_device_ops " Bjorn Helgaas
2009-04-02 13:56   ` Thomas Renninger
2009-04-02 15:03     ` Bjorn Helgaas
2009-04-03  0:23       ` Yasunori Goto
2009-04-03  9:08         ` Thomas Renninger
2009-04-03 15:09         ` Bjorn Helgaas
2009-04-03 22:43           ` Yasunori Goto
2009-04-03 13:14       ` Thomas Renninger
2009-03-30 17:48 ` [PATCH 02/10] ACPI: button: use .notify method instead of installing handler directly Bjorn Helgaas
2009-03-30 17:48 ` [PATCH 03/10] ACPI: processor: " Bjorn Helgaas
2009-03-30 17:48 ` [PATCH 04/10] ACPI: thermal: " Bjorn Helgaas
2009-03-30 17:48 ` [PATCH 05/10] ACPI: video: " Bjorn Helgaas
2009-03-30 17:48 ` [PATCH 06/10] fujitsu-laptop: " Bjorn Helgaas
2009-03-31  6:45   ` [PATCH 06/10] fujitsu-laptop: use .notify method instead of Jonathan Woithe
2009-03-31 21:38   ` [PATCH 06/10] fujitsu-laptop: use .notify method instead of installing handler directly Tony Vroon
2009-03-31 22:09     ` Bjorn Helgaas
2009-03-31 22:09       ` Tony Vroon
2009-03-31 22:29   ` Jonathan Woithe
2009-03-30 17:48 ` [PATCH 07/10] fujitsu-laptop: use .notify method instead of installing hotkey " Bjorn Helgaas
2009-03-31 21:39   ` Tony Vroon
2009-03-31 22:30   ` Jonathan Woithe [this message]
2009-03-30 17:48 ` [PATCH 08/10] panasonic-laptop: use .notify method instead of installing " Bjorn Helgaas
2009-03-30 17:48 ` [PATCH 09/10] sony-laptop: " Bjorn Helgaas
2009-03-31 13:46   ` Mattia Dongili
2009-03-31 22:58     ` Mattia Dongili
2009-03-30 17:48 ` [PATCH 10/10] ACPI: WMI: " Bjorn Helgaas

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=200903312230.n2VMUjM1014758@turbo.physics.adelaide.edu.au \
    --to=jwoithe@physics.adelaide.edu.au \
    --cc=achiang@hp.com \
    --cc=alexey.y.starikovskiy@linux.intel.com \
    --cc=anil.s.keshavamurthy@intel.com \
    --cc=bjorn.helgaas@hp.com \
    --cc=carlos@strangeworlds.co.uk \
    --cc=laforge@gnumonks.org \
    --cc=lenb@kernel.org \
    --cc=linux-acpi@vger.kernel.org \
    --cc=malattia@linux.it \
    --cc=mjg@redhat.com \
    --cc=rui.zhang@intel.com \
    --cc=tony@linx.net \
    --cc=venkatesh.pallipadi@intel.com \
    --cc=yakui.zhao@intel.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.