linux-usb.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Javier Carrasco <javier.carrasco@wolfvision.net>
To: Matthias Kaehlcke <mka@chromium.org>
Cc: Liam Girdwood <lgirdwood@gmail.com>,
	Mark Brown <broonie@kernel.org>, Rob Herring <robh+dt@kernel.org>,
	Krzysztof Kozlowski <krzysztof.kozlowski+dt@linaro.org>,
	Conor Dooley <conor+dt@kernel.org>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Helen Koike <helen.koike@collabora.com>,
	Maarten Lankhorst <maarten.lankhorst@linux.intel.com>,
	Maxime Ripard <mripard@kernel.org>,
	Thomas Zimmermann <tzimmermann@suse.de>,
	David Airlie <airlied@gmail.com>, Daniel Vetter <daniel@ffwll.ch>,
	Catalin Marinas <catalin.marinas@arm.com>,
	Will Deacon <will@kernel.org>,
	Russell King <linux@armlinux.org.uk>,
	linux-sound@vger.kernel.org, devicetree@vger.kernel.org,
	linux-kernel@vger.kernel.org, linux-usb@vger.kernel.org,
	dri-devel@lists.freedesktop.org,
	linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH v4 2/8] usb: misc: onboard_dev: add support for non-hub devices
Date: Thu, 22 Feb 2024 15:42:26 +0100	[thread overview]
Message-ID: <174ce57a-3197-4251-831f-205ec5cfeae9@wolfvision.net> (raw)
In-Reply-To: <ZdZN3FIS4zcKe4Kw@google.com>

On 21.02.24 20:24, Matthias Kaehlcke wrote:
> On Tue, Feb 20, 2024 at 03:05:46PM +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.
> 
> Please mention that the driver doesn't power off non-hub devices
> during system suspend.
> 
>> Signed-off-by: Javier Carrasco <javier.carrasco@wolfvision.net>
>> ---
>>  drivers/usb/misc/onboard_usb_dev.c |  3 ++-
>>  drivers/usb/misc/onboard_usb_dev.h | 10 ++++++++++
>>  2 files changed, 12 insertions(+), 1 deletion(-)
>>
>> diff --git a/drivers/usb/misc/onboard_usb_dev.c b/drivers/usb/misc/onboard_usb_dev.c
>> index 2103af2cb2a6..f43130a6786f 100644
>> --- a/drivers/usb/misc/onboard_usb_dev.c
>> +++ b/drivers/usb/misc/onboard_usb_dev.c
>> @@ -129,7 +129,8 @@ static int __maybe_unused onboard_dev_suspend(struct device *dev)
>>  		if (!device_may_wakeup(node->udev->bus->controller))
>>  			continue;
>>  
>> -		if (usb_wakeup_enabled_descendants(node->udev)) {
>> +		if (usb_wakeup_enabled_descendants(node->udev) ||
>> +		    !onboard_dev->pdata->is_hub) {
> 
> 
> This check isn't dependent on characteristics of the USB devices processed
> in this loop, therefore it can be performed at function entry. Please combine
> it with the check of 'always_powered_in_suspend'. It's also an option to
> omit the check completely, 'always_powered_in_suspend' will never be set for
> non-hub devices (assuming the sysfs attribute isn't added).
> 

The attribute will not be available for non-hub devices in v5. However,
if the check is completely removed, will power_off not stay true at the
end of the function, always leading to a device power off? As you said,
'always_powered_in_suspend' will not be set for non-hub devices.

>>  			power_off = false;
>>  			break;
>>  		}
> 
> Without code context: please omit the creation of the 'always_powered_in_suspend'
> attribute for non-hub devices. As per above we don't plan to hone it, so it
> shouldn't exist.

Best regards,
Javier Carrasco


  reply	other threads:[~2024-02-22 14:42 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-20 14:05 [PATCH v4 0/8] usb: misc: onboard_hub: add support for XMOS XVF3500 Javier Carrasco
2024-02-20 14:05 ` [PATCH v4 1/8] usb: misc: onboard_hub: rename to onboard_dev Javier Carrasco
2024-02-21 19:14   ` Matthias Kaehlcke
2024-02-20 14:05 ` [PATCH v4 2/8] usb: misc: onboard_dev: add support for non-hub devices Javier Carrasco
2024-02-21 19:24   ` Matthias Kaehlcke
2024-02-22 14:42     ` Javier Carrasco [this message]
2024-02-27 17:55       ` Matthias Kaehlcke
2024-02-20 14:05 ` [PATCH v4 3/8] drm: ci: arm64.config: update ONBOARD_USB_HUB to ONBOARD_USB_DEV Javier Carrasco
2024-02-20 14:33   ` Helen Koike
2024-02-20 14:05 ` [PATCH v4 4/8] arm64: defconfig: " Javier Carrasco
2024-02-20 14:05 ` [PATCH v4 5/8] ARM: multi_v7_defconfig: update ONBOARD_USB_HUB name Javier Carrasco
2024-02-20 14:05 ` [PATCH v4 6/8] usb: misc: onboard_dev: use device supply names Javier Carrasco
2024-02-21 20:25   ` Matthias Kaehlcke
2024-02-21 20:40     ` Javier Carrasco
2024-02-21 21:18       ` Matthias Kaehlcke
2024-02-21 21:33         ` Javier Carrasco
2024-02-21 21:46           ` Matthias Kaehlcke
2024-02-27 18:12   ` Matthias Kaehlcke
2024-02-20 14:05 ` [PATCH v4 7/8] ASoC: dt-bindings: xmos,xvf3500: add XMOS XVF3500 voice processor Javier Carrasco
2024-02-22 15:02   ` Krzysztof Kozlowski
2024-02-20 14:05 ` [PATCH v4 8/8] usb: misc: onboard_hub: add support for XMOS XVF3500 Javier Carrasco
2024-02-20 14:34 ` [PATCH v4 0/8] " Alexander Stein

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=174ce57a-3197-4251-831f-205ec5cfeae9@wolfvision.net \
    --to=javier.carrasco@wolfvision.net \
    --cc=airlied@gmail.com \
    --cc=broonie@kernel.org \
    --cc=catalin.marinas@arm.com \
    --cc=conor+dt@kernel.org \
    --cc=daniel@ffwll.ch \
    --cc=devicetree@vger.kernel.org \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=helen.koike@collabora.com \
    --cc=krzysztof.kozlowski+dt@linaro.org \
    --cc=lgirdwood@gmail.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-sound@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=linux@armlinux.org.uk \
    --cc=maarten.lankhorst@linux.intel.com \
    --cc=mka@chromium.org \
    --cc=mripard@kernel.org \
    --cc=robh+dt@kernel.org \
    --cc=tzimmermann@suse.de \
    --cc=will@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).