ACPI / hotplug: Simplify acpi_set_hp_context()
diff mbox

Message ID 5388095.MjHqc07ajT@vostro.rjw.lan
State Not Applicable
Headers show

Commit Message

Rafael J. Wysocki July 14, 2014, 8:36 p.m. UTC
From: Rafael J. Wysocki <rafael.j.wysocki@intel.com>

Since all of the acpi_set_hp_context() callers pass at least one NULL
function pointer and one caller passes NULL function pointers only
to it, drop function pointer arguments from acpi_set_hp_context()
and make the callers initialize the function pointers in struct
acpi_hotplug_context by themselves before passing it to
acpi_set_hp_context().

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


--
To unsubscribe from this list: send the line "unsubscribe linux-pci" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Comments

Bjorn Helgaas July 15, 2014, 8:56 p.m. UTC | #1
On Mon, Jul 14, 2014 at 2:36 PM, Rafael J. Wysocki <rjw@rjwysocki.net> wrote:
> From: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
>
> Since all of the acpi_set_hp_context() callers pass at least one NULL
> function pointer and one caller passes NULL function pointers only
> to it, drop function pointer arguments from acpi_set_hp_context()
> and make the callers initialize the function pointers in struct
> acpi_hotplug_context by themselves before passing it to
> acpi_set_hp_context().
>
> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>

Acked-by: Bjorn Helgaas <bhelgaas@google.com>

> ---
>  drivers/acpi/scan.c                |    4 +++-
>  drivers/pci/hotplug/acpiphp_glue.c |    7 ++++---
>  include/acpi/acpi_bus.h            |    8 +-------
>  3 files changed, 8 insertions(+), 11 deletions(-)
>
> Index: linux-pm/include/acpi/acpi_bus.h
> ===================================================================
> --- linux-pm.orig/include/acpi/acpi_bus.h
> +++ linux-pm/include/acpi/acpi_bus.h
> @@ -372,15 +372,9 @@ static inline void acpi_set_device_statu
>  }
>
>  static inline void acpi_set_hp_context(struct acpi_device *adev,
> -                                      struct acpi_hotplug_context *hp,
> -                                      int (*notify)(struct acpi_device *, u32),
> -                                      void (*uevent)(struct acpi_device *, u32),
> -                                      void (*fixup)(struct acpi_device *))
> +                                      struct acpi_hotplug_context *hp)
>  {
>         hp->self = adev;
> -       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
> @@ -77,7 +77,9 @@ void acpi_initialize_hp_context(struct a
>                                 void (*uevent)(struct acpi_device *, u32))
>  {
>         acpi_lock_hp_context();
> -       acpi_set_hp_context(adev, hp, notify, uevent, NULL);
> +       hp->notify = notify;
> +       hp->uevent = uevent;
> +       acpi_set_hp_context(adev, hp);
>         acpi_unlock_hp_context();
>  }
>  EXPORT_SYMBOL_GPL(acpi_initialize_hp_context);
> 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
> @@ -80,8 +80,9 @@ static struct acpiphp_context *acpiphp_i
>                 return NULL;
>
>         context->refcount = 1;
> -       acpi_set_hp_context(adev, &context->hp, acpiphp_hotplug_notify, NULL,
> -                           acpiphp_post_dock_fixup);
> +       context->hp.notify = acpiphp_hotplug_notify;
> +       context->hp.fixup = acpiphp_post_dock_fixup;
> +       acpi_set_hp_context(adev, &context->hp);
>         return context;
>  }
>
> @@ -876,7 +877,7 @@ void acpiphp_enumerate_slots(struct pci_
>                         goto err;
>
>                 root_context->root_bridge = bridge;
> -               acpi_set_hp_context(adev, &root_context->hp, NULL, NULL, NULL);
> +               acpi_set_hp_context(adev, &root_context->hp);
>         } else {
>                 struct acpiphp_context *context;
>
>
--
To unsubscribe from this list: send the line "unsubscribe linux-pci" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Rafael J. Wysocki July 16, 2014, 12:26 a.m. UTC | #2
On Tuesday, July 15, 2014 02:56:29 PM Bjorn Helgaas wrote:
> On Mon, Jul 14, 2014 at 2:36 PM, Rafael J. Wysocki <rjw@rjwysocki.net> wrote:
> > From: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
> >
> > Since all of the acpi_set_hp_context() callers pass at least one NULL
> > function pointer and one caller passes NULL function pointers only
> > to it, drop function pointer arguments from acpi_set_hp_context()
> > and make the callers initialize the function pointers in struct
> > acpi_hotplug_context by themselves before passing it to
> > acpi_set_hp_context().
> >
> > Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
> 
> Acked-by: Bjorn Helgaas <bhelgaas@google.com>

Thanks! [And for the other one too.]

> > ---
> >  drivers/acpi/scan.c                |    4 +++-
> >  drivers/pci/hotplug/acpiphp_glue.c |    7 ++++---
> >  include/acpi/acpi_bus.h            |    8 +-------
> >  3 files changed, 8 insertions(+), 11 deletions(-)
> >
> > Index: linux-pm/include/acpi/acpi_bus.h
> > ===================================================================
> > --- linux-pm.orig/include/acpi/acpi_bus.h
> > +++ linux-pm/include/acpi/acpi_bus.h
> > @@ -372,15 +372,9 @@ static inline void acpi_set_device_statu
> >  }
> >
> >  static inline void acpi_set_hp_context(struct acpi_device *adev,
> > -                                      struct acpi_hotplug_context *hp,
> > -                                      int (*notify)(struct acpi_device *, u32),
> > -                                      void (*uevent)(struct acpi_device *, u32),
> > -                                      void (*fixup)(struct acpi_device *))
> > +                                      struct acpi_hotplug_context *hp)
> >  {
> >         hp->self = adev;
> > -       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
> > @@ -77,7 +77,9 @@ void acpi_initialize_hp_context(struct a
> >                                 void (*uevent)(struct acpi_device *, u32))
> >  {
> >         acpi_lock_hp_context();
> > -       acpi_set_hp_context(adev, hp, notify, uevent, NULL);
> > +       hp->notify = notify;
> > +       hp->uevent = uevent;
> > +       acpi_set_hp_context(adev, hp);
> >         acpi_unlock_hp_context();
> >  }
> >  EXPORT_SYMBOL_GPL(acpi_initialize_hp_context);
> > 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
> > @@ -80,8 +80,9 @@ static struct acpiphp_context *acpiphp_i
> >                 return NULL;
> >
> >         context->refcount = 1;
> > -       acpi_set_hp_context(adev, &context->hp, acpiphp_hotplug_notify, NULL,
> > -                           acpiphp_post_dock_fixup);
> > +       context->hp.notify = acpiphp_hotplug_notify;
> > +       context->hp.fixup = acpiphp_post_dock_fixup;
> > +       acpi_set_hp_context(adev, &context->hp);
> >         return context;
> >  }
> >
> > @@ -876,7 +877,7 @@ void acpiphp_enumerate_slots(struct pci_
> >                         goto err;
> >
> >                 root_context->root_bridge = bridge;
> > -               acpi_set_hp_context(adev, &root_context->hp, NULL, NULL, NULL);
> > +               acpi_set_hp_context(adev, &root_context->hp);
> >         } else {
> >                 struct acpiphp_context *context;
> >
> >

Patch
diff mbox

Index: linux-pm/include/acpi/acpi_bus.h
===================================================================
--- linux-pm.orig/include/acpi/acpi_bus.h
+++ linux-pm/include/acpi/acpi_bus.h
@@ -372,15 +372,9 @@  static inline void acpi_set_device_statu
 }
 
 static inline void acpi_set_hp_context(struct acpi_device *adev,
-				       struct acpi_hotplug_context *hp,
-				       int (*notify)(struct acpi_device *, u32),
-				       void (*uevent)(struct acpi_device *, u32),
-				       void (*fixup)(struct acpi_device *))
+				       struct acpi_hotplug_context *hp)
 {
 	hp->self = adev;
-	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
@@ -77,7 +77,9 @@  void acpi_initialize_hp_context(struct a
 				void (*uevent)(struct acpi_device *, u32))
 {
 	acpi_lock_hp_context();
-	acpi_set_hp_context(adev, hp, notify, uevent, NULL);
+	hp->notify = notify;
+	hp->uevent = uevent;
+	acpi_set_hp_context(adev, hp);
 	acpi_unlock_hp_context();
 }
 EXPORT_SYMBOL_GPL(acpi_initialize_hp_context);
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
@@ -80,8 +80,9 @@  static struct acpiphp_context *acpiphp_i
 		return NULL;
 
 	context->refcount = 1;
-	acpi_set_hp_context(adev, &context->hp, acpiphp_hotplug_notify, NULL,
-			    acpiphp_post_dock_fixup);
+	context->hp.notify = acpiphp_hotplug_notify;
+	context->hp.fixup = acpiphp_post_dock_fixup;
+	acpi_set_hp_context(adev, &context->hp);
 	return context;
 }
 
@@ -876,7 +877,7 @@  void acpiphp_enumerate_slots(struct pci_
 			goto err;
 
 		root_context->root_bridge = bridge;
-		acpi_set_hp_context(adev, &root_context->hp, NULL, NULL, NULL);
+		acpi_set_hp_context(adev, &root_context->hp);
 	} else {
 		struct acpiphp_context *context;