Re: [PATCH] usb: core: hub: modify hub reset logic in hub driver

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

 



On 21 January 2015 at 15:58, Alan Stern <stern@xxxxxxxxxxxxxxxxxxx> wrote:
> On Wed, 21 Jan 2015 deepakdas.linux@xxxxxxxxx wrote:
>
>> From: Deepak Das <deepakdas.linux@xxxxxxxxx>
>>
>> Currently if port power is turned off by user on hub port
>> using USBDEVFS then port power is turned back ON
>> by hub driver.
>> This commit modifies hub reset logic in hub_port_connect() to prevent
>> hub driver from turning back the port power ON if port is not owned
>> by kernel.
>>
>> Signed-off-by: Deepak Das <deepakdas.linux@xxxxxxxxx>
>> ---
>>  drivers/usb/core/hub.c |    8 ++++++--
>>  1 file changed, 6 insertions(+), 2 deletions(-)
>>
>> diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c
>> index b649fef..6f12de7 100644
>> --- a/drivers/usb/core/hub.c
>> +++ b/drivers/usb/core/hub.c
>> @@ -4657,9 +4657,13 @@ static void hub_port_connect(struct usb_hub *hub, int port1, u16 portstatus,
>>       if (!(portstatus & USB_PORT_STAT_CONNECTION) ||
>>                       test_bit(port1, hub->removed_bits)) {
>>
>> -             /* maybe switch power back on (e.g. root hub was reset) */
>> +             /*
>> +             *  maybe switch power back on (e.g. root hub was reset)
>> +             * but only if the port isn't owned by someone else.
>> +             */
>
> Minor issue: Multi-line comments should be formatted like this:
>
>                 /*
>                  * blah blah blah
>                  * blah blah blah
>                  */
>
> with all the '*' characters aligned vertically.  See how it is done
> elsewhere in the source file.
>
>>               if (hub_is_port_power_switchable(hub)
>> -                             && !port_is_power_on(hub, portstatus))
>> +                             && !port_is_power_on(hub, portstatus)
>> +                             && !port_dev->port_owner)
>>                       set_port_feature(hdev, port1, USB_PORT_FEAT_POWER);
>>
>>               if (portstatus & USB_PORT_STAT_ENABLE)
>
> Fix that and then repost the patch with:
>
> Acked-by: Alan Stern <stern@xxxxxxxxxxxxxxxxxxx>
>
> Be sure to CC: Greg KH so he will see it and apply it.
>
> Alan Stern
>
Thanks Alen, I will repost the patch after modification.

With warm regards,
Deepak Das
--
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