Received: by 2002:a05:7208:9594:b0:7e:5202:c8b4 with SMTP id gs20csp2078915rbb; Tue, 27 Feb 2024 09:57:02 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCVwVCY/Cesg1R7qGuVuVQLfw7XErcTs0rR1+ec2BDEh5khmUTgFEfVboSmgxzB7YSHgzRGMmiiZA2crXBTK6cBQ5O7EaJ3d4RuJdumTXg== X-Google-Smtp-Source: AGHT+IEGergYY99uKDVnSM5G9YLMwaYQ+E6Zxi05vLgzuW7UNdvqUL3ZvpTKiT/yuIfoL2vvHIhs X-Received: by 2002:a17:902:ce91:b0:1db:f910:98a9 with SMTP id f17-20020a170902ce9100b001dbf91098a9mr12758152plg.56.1709056621868; Tue, 27 Feb 2024 09:57:01 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1709056621; cv=pass; d=google.com; s=arc-20160816; b=y0fH8CpjiZh6JW2sPE1RFrbtWDfgbpfQdogSXjw83koYVBoQ2ewdiX3S2IVRxfTNJz 5ZihwgHPBddYOocTOeDKkqBy2/Iuol7FCsg5YDOg8mVHFoL6uUD0OIAQN31OnmLtWg4b /Qo2Rfcu+gbSS/lkXn1psqOksYBoVqdC3AsHjP4uLc14xxAsv+q9C5msTLF3pg4/IQvn DBmL728UtddPzEV+yniAB+KhsfYZrGI8UMchQPBT0faCJ48RrMENCUODL1WjgvJzAXpS 0Wwx7SKeYuQBxdoK0Wb9Pv/mqM22539+yxXc1sJy7Mm0VE1aeuRGkWuieqxutLhD5Zq1 vJWQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date:dkim-signature; bh=0z6oy3tLEwRGgu8/omrsseYREQZqlDjlucfwbridRR4=; fh=3ADwxOGMgI2etAcdeHtBd1JyaiNmbqka5NsDdGUOLqM=; b=WVnS9ZAxnZDLRD16w7ADU+J+sg5hHRJh1KRcd+ioO3ctffJCzTEMGbQG2X/miSw0pb 0fQ3KfVGivkLlVLKD1f6lu1nNqdNnTzvtjjIhnYssHxjPaCq2oT8NFmBYxm0Qp4NVeZg TeT6a9MU6XNej8WXlSsaOgLDeAWoJ0MrgIcsAh69o54odMhy44lpzevacC8QN7SAZEWs TuvEwA/MokST76VqCFqYcHfnge0uDXHrFtacUitBFHtHqogsvWi6tIo4TOlhVObg5a9B V7dxBJ49VGv1t9M+GsgZZTfRCsMwu2sRap+Aq0Wct+fEzdbM3kuv9bXvT0s0QWLoF0jA wxEw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=chESIHFZ; arc=pass (i=1 spf=pass spfdomain=chromium.org dkim=pass dkdomain=chromium.org dmarc=pass fromdomain=chromium.org); spf=pass (google.com: domain of linux-kernel+bounces-83782-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-83782-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id i11-20020a17090332cb00b001d5e9f77cf3si1786439plr.79.2024.02.27.09.57.01 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 27 Feb 2024 09:57:01 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-83782-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=chESIHFZ; arc=pass (i=1 spf=pass spfdomain=chromium.org dkim=pass dkdomain=chromium.org dmarc=pass fromdomain=chromium.org); spf=pass (google.com: domain of linux-kernel+bounces-83782-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-83782-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 0B7DE28D1E0 for ; Tue, 27 Feb 2024 17:56:20 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id D40DA14AD2A; Tue, 27 Feb 2024 17:55:12 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="chESIHFZ" Received: from mail-io1-f51.google.com (mail-io1-f51.google.com [209.85.166.51]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E81B314A4DE for ; Tue, 27 Feb 2024 17:55:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.166.51 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709056512; cv=none; b=Hos3NRltSNM3nV0IRbeOg2jB/7q3IiRaFpPpH6v5m9YMskse0HAS2Vt/y56toz5VCkKj9DfaaTeGGQHbKMV18W+P/I5ZDBbhxj9SFaxY8Z9xavaJmOxIA8ivPQ/dAi5Y5XRUe60HA5SK89yrxfvCjgoPK6+pjKcDJnfGL2A6E7o= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709056512; c=relaxed/simple; bh=4mxpcwtJGmPAx0hGuHiSF19sttpDcfgAzEqkq+js9w0=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=hXP3bb/i53kTpm9zUb8/QzKyhbSGKh+KsWEIjWxUep+MThYxaU4OdwZF4eXleqyT3W4vx2ehFMv5hHf0EVrm6p41Gp2Sp2b5DFT2C2PY2sXoj9CJ3wVS9jvkRU07q5SyLjqpkMuDMyXAsibE+Cn7c9r3OSvn7MSDg6C1tvZpm6A= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=chromium.org; spf=pass smtp.mailfrom=chromium.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b=chESIHFZ; arc=none smtp.client-ip=209.85.166.51 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=chromium.org Received: by mail-io1-f51.google.com with SMTP id ca18e2360f4ac-7c788332976so146280039f.3 for ; Tue, 27 Feb 2024 09:55:09 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1709056509; x=1709661309; darn=vger.kernel.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=0z6oy3tLEwRGgu8/omrsseYREQZqlDjlucfwbridRR4=; b=chESIHFZopoekdXZAIn5yr8L36LqKiRAzMmBw0JBzQdug/CTAodhBYAHHvD7wNUm7O yo4UCYJAOc4GbOcIf/OFhVNYZ5ssaZkAGjeQcVoSFwmTwDttR51c8WWCh5ULH12ghuGq 2UZsNyck+l4Ae2E9kGCporZr2CKI+1eDAI/b8= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709056509; x=1709661309; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=0z6oy3tLEwRGgu8/omrsseYREQZqlDjlucfwbridRR4=; b=s76j7fADnSQ0BlFxrzk1Y9WQ0XW34f/ZGfT3ElYicN1Z5tAExVDXrW+I+jM0dTwJfv +ld96rbWEZXVBFNbPQU0G3MDIa0LSvhoIwUv8+S8KF8ARvC6DEoUdYLMpRKkuRLiklZQ mYMSx1zSZV8Ec6pugxX0ccjwCkGauY6Nfk9nczW4Awy6p0B+6BZiYpBi/lSeSYhzjb2G e7KTFoTGdCZO7O/pWKv8qP+qJFdD2jj+hIMi5f9vE8AKOeC81A7ccB/T1MmH5K9Z+UfY i5PCdr5rEIE5miw7I3dsjXOD8XOq/IAO8Tiv3+ZvpIDL4cT08sg+J/XPltofTopHdgRY EArQ== X-Forwarded-Encrypted: i=1; AJvYcCVzGnqfb+cD7lwdgM1Q1BqR/SuVMlJolats72SH/VyUIQkcbYOg/ZhQ+5L9nGrN4EyiAbD48ezO4StM0fH/IlM8RXu3qOAjmvi2PauA X-Gm-Message-State: AOJu0YzSwZC8YGLwMaYLP9LQRRt1FPtzuq2v+7TGMX7m6FmMzBZ9fn2F PDP2Wgi/EJ29FbzIHSNNG43Uy2awfsRlh2A97lXYumGEqnzQ7YxUoEUo8y95XQ== X-Received: by 2002:a5e:c007:0:b0:7c7:9184:df98 with SMTP id u7-20020a5ec007000000b007c79184df98mr13293582iol.12.1709056509170; Tue, 27 Feb 2024 09:55:09 -0800 (PST) Received: from localhost (147.220.222.35.bc.googleusercontent.com. [35.222.220.147]) by smtp.gmail.com with UTF8SMTPSA id u14-20020a02b1ce000000b0047464deaba5sm1816183jah.114.2024.02.27.09.55.08 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 27 Feb 2024 09:55:08 -0800 (PST) Date: Tue, 27 Feb 2024 17:55:07 +0000 From: Matthias Kaehlcke To: Javier Carrasco Cc: Liam Girdwood , Mark Brown , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Greg Kroah-Hartman , Helen Koike , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Daniel Vetter , Catalin Marinas , Will Deacon , Russell King , 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 Message-ID: References: <20240220-onboard_xvf3500-v4-0-dc1617cc5dd4@wolfvision.net> <20240220-onboard_xvf3500-v4-2-dc1617cc5dd4@wolfvision.net> <174ce57a-3197-4251-831f-205ec5cfeae9@wolfvision.net> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <174ce57a-3197-4251-831f-205ec5cfeae9@wolfvision.net> On Thu, Feb 22, 2024 at 03:42:26PM +0100, Javier Carrasco wrote: > 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 > >> --- > >> 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. Even without the sysfs attribute the field 'always_powered_in_suspend' could be set to true by probe() for non-hub devices.