lkml.org 
[lkml]   [2013]   [Nov]   [6]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRe: [Update][PATCH 4/6] ACPI / hotplug: Simplify device ejection routines
Date
On Wednesday, November 06, 2013 05:17:05 PM Toshi Kani wrote:
> On Thu, 2013-11-07 at 01:14 +0100, Rafael J. Wysocki wrote:
> > On Wednesday, November 06, 2013 04:27:01 PM Toshi Kani wrote:
> > > On Mon, 2013-11-04 at 14:36 +0100, Rafael J. Wysocki wrote:
> > > > From: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
> > > >
> > > > Simplify handle_root_bridge_removal() and acpi_eject_store() by
> > > > getting rid of struct acpi_eject_event and passing device objects
> > > > directly to async routines executed via acpi_os_hotplug_execute().
> > > :
> > > > static ssize_t
> > > > acpi_eject_store(struct device *d, struct device_attribute *attr,
> > > > const char *buf, size_t count)
> > > > {
> > > > struct acpi_device *acpi_device = to_acpi_device(d);
> > > > - struct acpi_eject_event *ej_event;
> > > > acpi_object_type not_used;
> > > > acpi_status status;
> > > > - int ret;
> > > >
> > > > if (!count || buf[0] != '1')
> > > > return -EINVAL;
> > > > @@ -518,28 +519,17 @@ acpi_eject_store(struct device *d, struc
> > > > if (ACPI_FAILURE(status) || !acpi_device->flags.ejectable)
> > > > return -ENODEV;
> > > >
> > > > - ej_event = kmalloc(sizeof(*ej_event), GFP_KERNEL);
> > > > - if (!ej_event) {
> > > > - ret = -ENOMEM;
> > > > - goto err_out;
> > > > - }
> > > > acpi_evaluate_hotplug_ost(acpi_device->handle, ACPI_OST_EC_OSPM_EJECT,
> > > > ACPI_OST_SC_EJECT_IN_PROGRESS, NULL);
> > > > - ej_event->device = acpi_device;
> > > > - ej_event->event = ACPI_OST_EC_OSPM_EJECT;
> > > > get_device(&acpi_device->dev);
> > > > - status = acpi_os_hotplug_execute(acpi_bus_hot_remove_device, ej_event);
> > > > + status = acpi_os_hotplug_execute(acpi_eject_store_work, acpi_device);
> > > > if (ACPI_SUCCESS(status))
> > > > return count;
> > > >
> > > > put_device(&acpi_device->dev);
> > > > - kfree(ej_event);
> > > > - ret = status == AE_NO_MEMORY ? -ENOMEM : -EAGAIN;
> > >
> > > Why are you deleting the above line as part of this change?
> >
> > Ah, because I forgot that acpi_os_hotplug_execute() can also return AE_NO_MEMORY. :-)
> >
> > Good catch, updated pach follows.
>
> Looks good. The rest of the patches also look good. For patch 4-6:
>
> Acked-by: Toshi Kani <toshi.kani@hp.com>

Awesome, thanks! :-)

--
I speak only for myself.
Rafael J. Wysocki, Intel Open Source Technology Center.


\
 
 \ /
  Last update: 2013-11-07 02:01    [W:2.122 / U:0.412 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site