public inbox for linux-acpi@vger.kernel.org
 help / color / mirror / Atom feed
From: "Rafael J. Wysocki" <rjw@rjwysocki.net>
To: ACPI Devel Maling List <linux-acpi@vger.kernel.org>
Cc: Linux PCI <linux-pci@vger.kernel.org>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	Bjorn Helgaas <bhelgaas@google.com>, Tejun Heo <tj@kernel.org>,
	Aaron Lu <aaron.lu@intel.com>
Subject: [PATCH 5/9] ACPI / dock: Add .uevent() callback to struct acpi_hotplug_context
Date: Wed, 19 Feb 2014 02:30:02 +0100	[thread overview]
Message-ID: <1634069.8i1LGae7Tj@vostro.rjw.lan> (raw)
In-Reply-To: <3011875.q18rCmXyYX@vostro.rjw.lan>

From: Rafael J. Wysocki <rafael.j.wysocki@intel.com>

In order to avoid the need to register special ACPI dock
operations for SATA devices add a .uevent() callback pointer to
struct acpi_hotplug_context and make dock_hotplug_event() use that
callback if available.  Also rename the existing .event() callback
in struct acpi_hotplug_context to .notify() to avoid possible
confusion in the future.

Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
---
 drivers/acpi/dock.c                |   11 ++++++++++-
 drivers/acpi/scan.c                |    8 ++++----
 drivers/pci/hotplug/acpiphp_glue.c |    8 ++++----
 include/acpi/acpi_bus.h            |    9 ++++++---
 4 files changed, 24 insertions(+), 12 deletions(-)

Index: linux-pm/include/acpi/acpi_bus.h
===================================================================
--- linux-pm.orig/include/acpi/acpi_bus.h
+++ linux-pm/include/acpi/acpi_bus.h
@@ -145,7 +145,8 @@ struct acpi_scan_handler {
 
 struct acpi_hotplug_context {
 	struct acpi_device *self;
-	int (*event)(struct acpi_device *, u32);
+	int (*notify)(struct acpi_device *, u32);
+	void (*uevent)(struct acpi_device *, u32);
 	void (*fixup)(struct acpi_device *);
 };
 
@@ -369,11 +370,13 @@ static inline void acpi_set_device_statu
 
 static inline void acpi_set_hp_context(struct acpi_device *adev,
 				       struct acpi_hotplug_context *hp,
-				       int (*event)(struct acpi_device *, u32),
+				       int (*notify)(struct acpi_device *, u32),
+				       void (*uevent)(struct acpi_device *, u32),
 				       void (*fixup)(struct acpi_device *))
 {
 	hp->self = adev;
-	hp->event = event;
+	hp->notify = notify;
+	hp->uevent = uevent;
 	hp->fixup = fixup;
 	adev->hp = hp;
 }
Index: linux-pm/drivers/acpi/scan.c
===================================================================
--- linux-pm.orig/drivers/acpi/scan.c
+++ linux-pm/drivers/acpi/scan.c
@@ -496,17 +496,17 @@ void acpi_device_hotplug(void *data, u32
 			goto err_out;
 		}
 	} else {
-		int (*event)(struct acpi_device *, u32);
+		int (*notify)(struct acpi_device *, u32);
 
 		acpi_lock_hp_context();
-		event = adev->hp ? adev->hp->event : NULL;
+		notify = adev->hp ? adev->hp->notify : NULL;
 		acpi_unlock_hp_context();
 		/*
 		 * There may be additional notify handlers for device objects
 		 * without the .event() callback, so ignore them here.
 		 */
-		if (event)
-			error = event(adev, src);
+		if (notify)
+			error = notify(adev, src);
 		else
 			goto out;
 	}
Index: linux-pm/drivers/acpi/dock.c
===================================================================
--- linux-pm.orig/drivers/acpi/dock.c
+++ linux-pm/drivers/acpi/dock.c
@@ -203,10 +203,19 @@ static void dock_hotplug_event(struct do
 			fixup(adev);
 			return;
 		}
+	} else if (cb_type == DOCK_CALL_UEVENT) {
+		void (*uevent)(struct acpi_device *, u32);
+
+		uevent = adev->hp->uevent;
+		if (uevent) {
+			acpi_unlock_hp_context();
+			uevent(adev, event);
+			return;
+		}
 	} else {
 		int (*notify)(struct acpi_device *, u32);
 
-		notify = adev->hp->event;
+		notify = adev->hp->notify;
 		if (notify) {
 			acpi_unlock_hp_context();
 			notify(adev, event);
Index: linux-pm/drivers/pci/hotplug/acpiphp_glue.c
===================================================================
--- linux-pm.orig/drivers/pci/hotplug/acpiphp_glue.c
+++ linux-pm/drivers/pci/hotplug/acpiphp_glue.c
@@ -59,7 +59,7 @@
 static LIST_HEAD(bridge_list);
 static DEFINE_MUTEX(bridge_mutex);
 
-static int acpiphp_hotplug_event(struct acpi_device *adev, u32 type);
+static int acpiphp_hotplug_notify(struct acpi_device *adev, u32 type);
 static void acpiphp_post_dock_fixup(struct acpi_device *adev);
 static void acpiphp_sanitize_bus(struct pci_bus *bus);
 static void acpiphp_set_hpp_values(struct pci_bus *bus);
@@ -81,7 +81,7 @@ static struct acpiphp_context *acpiphp_i
 		return NULL;
 
 	context->refcount = 1;
-	acpi_set_hp_context(adev, &context->hp, acpiphp_hotplug_event,
+	acpi_set_hp_context(adev, &context->hp, acpiphp_hotplug_notify, NULL,
 			    acpiphp_post_dock_fixup);
 	return context;
 }
@@ -400,7 +400,7 @@ static void cleanup_bridge(struct acpiph
 			struct acpi_device *adev = func_to_acpi_device(func);
 
 			acpi_lock_hp_context();
-			adev->hp->event = NULL;
+			adev->hp->notify = NULL;
 			adev->hp->fixup = NULL;
 			acpi_unlock_hp_context();
 		}
@@ -833,7 +833,7 @@ static void hotplug_event(u32 type, stru
 		put_bridge(bridge);
 }
 
-static int acpiphp_hotplug_event(struct acpi_device *adev, u32 type)
+static int acpiphp_hotplug_notify(struct acpi_device *adev, u32 type)
 {
 	struct acpiphp_context *context;
 

  parent reply	other threads:[~2014-02-19  1:30 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-02-19  1:26 [PATCH 0/9] ACPI / dock / PCI / SATA: Simplify ACPI dock handling Rafael J. Wysocki
2014-02-19  1:27 ` [PATCH 1/9] ACPI / hotplug / PCI: Do not clear event callback pointer for docks Rafael J. Wysocki
2014-02-19  1:27 ` [PATCH 2/9] ACPI / hotplug: Add .fixup() callback to struct acpi_hotplug_context Rafael J. Wysocki
2014-02-19  1:28 ` [PATCH 3/9] ACPI / dock: Use ACPI device object pointers instead of ACPI handles Rafael J. Wysocki
2014-02-19  1:29 ` [PATCH 4/9] ACPI / dock: Use callback pointers from devices' ACPI hotplug contexts Rafael J. Wysocki
2014-02-19  1:30 ` Rafael J. Wysocki [this message]
2014-02-19  1:30 ` [PATCH 6/9] ACPI / ATA: Add hotplug contexts to ACPI companions of SATA devices Rafael J. Wysocki
2014-02-19  2:42   ` Aaron Lu
2014-02-19 16:40     ` Rafael J. Wysocki
2014-02-20  1:47   ` [Update][PATCH " Rafael J. Wysocki
2014-02-20  8:23     ` Aaron Lu
2014-02-20 14:26     ` Tejun Heo
2014-02-20 23:59       ` Rafael J. Wysocki
2014-02-22  0:15     ` [Update 2x][PATCH " Rafael J. Wysocki
2014-02-19  1:31 ` [PATCH 7/9] ACPI / dock: Drop struct acpi_dock_ops and all code related to it Rafael J. Wysocki
2014-02-19  1:32 ` [PATCH 8/9] ACPI / dock: Drop remove_dock_dependent_devices() Rafael J. Wysocki
2014-02-19  1:32 ` [PATCH 9/9] ACPI / dock: Update copyright notice Rafael J. Wysocki

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=1634069.8i1LGae7Tj@vostro.rjw.lan \
    --to=rjw@rjwysocki.net \
    --cc=aaron.lu@intel.com \
    --cc=bhelgaas@google.com \
    --cc=linux-acpi@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=tj@kernel.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