Received: by 2002:a05:7412:cfc7:b0:fc:a2b0:25d7 with SMTP id by7csp2561153rdb; Wed, 21 Feb 2024 11:24:39 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCV555rBz/O0MqmZHNwHXOZJgwcWiwqr+8NQc/yIctg/KP00CSQq6CxB9DM95kDrN8wpzZoFVUnfnWUhQCh8TFPyG5yXyXOpB6lsfmVLpw== X-Google-Smtp-Source: AGHT+IFhA1uZyXoOqGxp/mfzy3LKrtxxH6XNbVOY6wJ2SWX6SwvH2QBSidw+lQK9FgmO8K+22VuT X-Received: by 2002:a05:6a00:4b0a:b0:6e4:869e:137a with SMTP id kq10-20020a056a004b0a00b006e4869e137amr511639pfb.16.1708543479667; Wed, 21 Feb 2024 11:24:39 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708543479; cv=pass; d=google.com; s=arc-20160816; b=QZVopQF1ZhtaVmY8FUw0O1KVqy3WkrUg5IO7N41HFM3klrn/+Dcf05nTR+YkzJhM9T CIWVuTaDtyTwNRi5BOeqCTSiYgqa6F2jUod4Pl2jZFecug6efOrppUDF6nxnllv8olTn h/P65xkxHCirpRtT4nlHgZ60pumK+b6/g8O+ekK7X1zE05HZzGzcl6v7Gk33/aqANoxm W8tZiHGvW/IBGBZ/a5i1ZniiK+gw4Lj86nkgQ4D9YDYQzqcvps+q+sfTOnWn+QTA7GcL 5TTXjBry7sHHJdiWGvD4ii3pckpXlGiFXO5OPL+AD3E5Uwitf3QjWaAIalZHg+uCf7/F 1lMQ== 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=0yFTzTjr3GTZORxDHTHVOaXJnjBMrs5r+BDpbCsO/O0=; fh=Jg09hRqTKG2V80ScDE0N0MjHnnqZNeXDdPIjLp9f608=; b=btnf9Hg1EOw7wGsKsQWoBuq/8IjN6gWw2T4wzM4pEYCjJGMKFT6mFpVZ2vwoQJwzAU lK0ElRhjNdQk6JYgZ2yd10r1lZxMWc6nM+R2VE77tPqR24QDgeEQ/KpyWdH8WY+cr+4u iXh9fS9NzpF/dKtsm8gFWdY1PPzGxHOtzPlypUK8xTeUkijAj+aLw6Sq7gktIUC/Gbg8 wPLJquL+aGgf2oy5z2NY8WOCbmTNsM8uWbhzG1l2aSsmxpivZp07kNOsT5aVjRdlxKcu y0d+brUYaHUhkIA/y0+tpgdGCvv73A5fkULf8fCYnDgUD2kW0Yh8Dp/8SbBmSu3UPa74 tsbA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=PZi07Wty; 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-75359-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-75359-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. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id d23-20020a637357000000b005dc927ee322si8708020pgn.683.2024.02.21.11.24.39 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 21 Feb 2024 11:24:39 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-75359-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=PZi07Wty; 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-75359-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-75359-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 5F4F128234B for ; Wed, 21 Feb 2024 19:24:39 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 4FDD686646; Wed, 21 Feb 2024 19:24:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="PZi07Wty" Received: from mail-io1-f45.google.com (mail-io1-f45.google.com [209.85.166.45]) (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 EC2868613A for ; Wed, 21 Feb 2024 19:24:14 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.166.45 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708543456; cv=none; b=iJyl+vdu0bdfA2p8BTiXgwL096hCnuj2P23DoPSJGwGYG6zM/UgSYU1YQpQ2xZHmJIztBKQ+XdzBhkzW4RYENXuR0bY6H+EWsj33mm/rEyU9jSF+EzdQGmraN7XcMfB0oeCtJFFdA2euNQ9ZM+pmTH/2k7sgcxjx5BvFYZ968i8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708543456; c=relaxed/simple; bh=3T+4Sowq+/a2cVZqSXKH4sBJEPnTUsRKB2xiZ30Hff4=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=KGUgoQsEk2n2p9/QqZYrli8OtWG60J7Jph0HtDtXMtDK/DrCFQ4dELydeW7KpQgkuG1Hi5bIGXkNt4aa0tQ3SJ1lAFhihQ86zQZo0e/BTYMSnxFgsKoSSdNuFtDp1LAU371Z6ktCTjM9ZXXrRGw7Ui1veOD0lD11B57GUACiL6g= 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=PZi07Wty; arc=none smtp.client-ip=209.85.166.45 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-f45.google.com with SMTP id ca18e2360f4ac-7c029beb8efso4448339f.0 for ; Wed, 21 Feb 2024 11:24:14 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1708543454; x=1709148254; 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=0yFTzTjr3GTZORxDHTHVOaXJnjBMrs5r+BDpbCsO/O0=; b=PZi07WtySJY7RDcpykVgk8yCt4XeyzKR4b/MLOYnEfo/9gsVh9c06tUTGt7UZ0N25Q pzn2QrHpjg5szoyuYmHF6ymWPS4VT00vRRlFybrI6xhOHm8IJZYCkNDb/yvGiS1tpfoW wgFZpy/LFhQJKLzlVa43vbIRQ/PfhGi6Urqc8= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708543454; x=1709148254; 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=0yFTzTjr3GTZORxDHTHVOaXJnjBMrs5r+BDpbCsO/O0=; b=f2j3e5JVMCbte59CQ8CvdI1csHFVj7X2KKLq20yzVlc3RZWOYZp7BfXZRgNHnA5t5R w6Dpq0VymCG2ZtIjecTzAqMmDPK/3GDxYIgBmtiRKlL5WUEAFRKvpl61OtmzI7sGuaih hYG/m6HwQ9Nh2D4nmQkrW8kQspM8WA4DbjO6xi8yi3b8/zYxsEiz52+m+e9mxw6aG09M paXbzRXiSKSX/0xVzcwULPU4cgprofZ5fduZ8Rcq9qgsl1tNjTi0kdqa+CAHhBnLlj8n xNpmOM+MrHWpW5CUCRbX+oMkwnJ8bJLnO/suSFbro8Km5oSchNwMZ+EI6Qf04fEPnGXm P0Aw== X-Forwarded-Encrypted: i=1; AJvYcCVc0f/UYMqGIoe03OWjJUoGD+vCEcUAwUoQvapDyF6iGEF+n+Le5JSEgCHl7NQf9h8F4bWS5dzLUi4XRBAQNbLaInvOwRS4ihwtUf6L X-Gm-Message-State: AOJu0YxzAQTXLomgPFAnLN23mmnz/TBBOL2NTMyr7UWmt8wntH3XtZZv JE8JNRXawEq3R/8YdF0B952XnwtG6jlgqQTOfVQ4IoXFNbBjblZAz4xRm50GTA== X-Received: by 2002:a6b:e519:0:b0:7c4:89b2:8084 with SMTP id y25-20020a6be519000000b007c489b28084mr423301ioc.1.1708543453597; Wed, 21 Feb 2024 11:24:13 -0800 (PST) Received: from localhost (147.220.222.35.bc.googleusercontent.com. [35.222.220.147]) by smtp.gmail.com with UTF8SMTPSA id x17-20020a02ac91000000b00473f31f96desm2836260jan.90.2024.02.21.11.24.13 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 21 Feb 2024 11:24:13 -0800 (PST) Date: Wed, 21 Feb 2024 19:24:12 +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> 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: <20240220-onboard_xvf3500-v4-2-dc1617cc5dd4@wolfvision.net> 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). > 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.