lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <2a23817d-b797-4659-a4e6-5c8a75864c90@wolfvision.net>
Date: Tue, 13 Feb 2024 11:00:43 +0100
From: Javier Carrasco <javier.carrasco@...fvision.net>
To: Matthias Kaehlcke <mka@...omium.org>
Cc: Liam Girdwood <lgirdwood@...il.com>, Mark Brown <broonie@...nel.org>,
 Rob Herring <robh+dt@...nel.org>,
 Krzysztof Kozlowski <krzysztof.kozlowski+dt@...aro.org>,
 Conor Dooley <conor+dt@...nel.org>,
 Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
 linux-sound@...r.kernel.org, devicetree@...r.kernel.org,
 linux-kernel@...r.kernel.org, linux-usb@...r.kernel.org
Subject: Re: [PATCH v3 2/7] usb: misc: onboard_dev: add support for non-hub
 devices

On 06.02.24 19:40, Matthias Kaehlcke wrote:
> On Tue, Feb 06, 2024 at 02:59:30PM +0100, Javier Carrasco wrote:
>> Most of the functionality this driver provides can be used by non-hub
>> devices as well.
>>
>> To account for the hub-specific code, add a flag to the device data
>> structure and check its value for hub-specific code.
>>
>> Signed-off-by: Javier Carrasco <javier.carrasco@...fvision.net>
>> ---
>>  drivers/usb/misc/onboard_usb_dev.c |  3 +++
>>  drivers/usb/misc/onboard_usb_dev.h | 10 ++++++++++
>>  2 files changed, 13 insertions(+)
>>
>> diff --git a/drivers/usb/misc/onboard_usb_dev.c b/drivers/usb/misc/onboard_usb_dev.c
>> index e2e1e1e30c1e..3ac21ec38ac0 100644
>> --- a/drivers/usb/misc/onboard_usb_dev.c
>> +++ b/drivers/usb/misc/onboard_usb_dev.c
>> @@ -123,6 +123,9 @@ static int __maybe_unused onboard_dev_suspend(struct device *dev)
>>  	if (onboard_dev->always_powered_in_suspend)
>>  		return 0;
>>  
>> +	if (!onboard_dev->pdata->is_hub)
>> +		return onboard_dev_power_off(onboard_dev);
> 
> Why turn the device always off when it isn't a hub? It could be a device
> with wakeup support.
> 
> I really regret making 'off in suspend' the default :(
> 


The power management seems to be a critical point to consider.

Maybe we keep the current implementation and add support to non-hub
devices by simply adding a check to set power_off to false:

static int __maybe_unused onboard_dev_suspend(struct device *dev)

{

        struct onboard_dev *onboard_dev = dev_get_drvdata(dev);

        struct usbdev_node *node;

        bool power_off = true;



        if (onboard_dev->always_powered_in_suspend)

                return 0;



        mutex_lock(&onboard_dev->lock);



        list_for_each_entry(node, &onboard_dev->udev_list, list) {

                if (!device_may_wakeup(node->udev->bus->controller))

                        continue;



~                if (usb_wakeup_enabled_descendants(node->udev) ||

+                    !onboard_dev->pdata->is_hub) {

                        power_off = false;

                        break;

                }

        }



        mutex_unlock(&onboard_dev->lock);



        if (!power_off)

                return 0;



        return onboard_dev_power_off(onboard_dev);

}


Best regards,
Javier Carrasco


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ