Re: [RFC PATCH v2 1/6] usb: Register usb port's acpi power resources

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

 



On 2012年11月14日 07:56, Rafael J. Wysocki wrote:
> On Tuesday, November 13, 2012 08:36:15 PM Lan Tianyu wrote:
>> 于 2012/11/13 19:07, Sergei Shtylyov 写道:
>>> Hello.
>>>
>>> On 13-11-2012 12:00, Lan Tianyu wrote:
>>>
>>>> This patch is to register usb port's acpi power resources. Create
>>>> link between usb port device and its acpi power resource.
>>>
>>>> Signed-off-by: Lan Tianyu <tianyu.lan@xxxxxxxxx>
>>> [...]
>>>
>>>> diff --git a/drivers/usb/core/usb-acpi.c b/drivers/usb/core/usb-acpi.c
>>>> index cef4252..c58ebc0 100644
>>>> --- a/drivers/usb/core/usb-acpi.c
>>>> +++ b/drivers/usb/core/usb-acpi.c
>>>> @@ -216,6 +216,28 @@ static struct acpi_bus_type usb_acpi_bus = {
>>>>       .find_device = usb_acpi_find_device,
>>>>   };
>>>>
>>>> +int usb_acpi_register_power_resources(struct device *dev)
>>>> +{
>>>> +    acpi_handle port_handle = DEVICE_ACPI_HANDLE(dev);
>>>> +
>>>> +    if (!port_handle)
>>>> +        return -ENODEV;
>>>> +
>>>> +    if (acpi_power_resource_register_device(dev, port_handle) < 0)
>>>> +        return -ENODEV;
>>>> +    return 0;
>>>> +}
>>>> +
>>>> +void usb_acpi_unregister_power_resources(struct device *dev)
>>>> +{
>>>> +    acpi_handle port_handle = DEVICE_ACPI_HANDLE(dev);
>>>> +
>>>> +    if (!port_handle)
>>>> +        return;
>>>> +
>>>> +    acpi_power_resource_register_device(dev, port_handle);
>>>
>>>     I thinbk you have been askied already, but shouldn't it be
>>> acpi_power_resource_unregister_device()?
>>>
>> Oh. Sorry. Too focus on the other modification. Thanks for your reminder.
> 
> Besides, it would be a bit more natural to do
> 
> if (port_handle)
> 	acpi_power_resource_unregister_device(dev, port_handle);
> 
> instead of doing that return when port_handle is NULL.
> 
Hi Rafael:
	Great thanks for your review. :)
	I get it and will update it at next version.
> Thanks,
> Rafael
> 
> 


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


[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux