Re: [Update][PATCH 4/6] ACPI / hotplug: Simplify device ejection routines

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxx>
> > > > 
> > > > 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@xxxxxx>

Awesome, thanks! :-)

-- 
I speak only for myself.
Rafael J. Wysocki, Intel Open Source Technology Center.
--
To unsubscribe from this list: send the line "unsubscribe linux-pci" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [DMA Engine]     [Linux Coverity]     [Linux USB]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Greybus]

  Powered by Linux