Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=198.175.65.15 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796386147; b=MhM5yBjmvVjkQgcHB0evhRr80g9VCmrf37QocwjofrwHGcyooOyhYYA64P99iJnOFvy0 fovveYM7BRObb0PYABcJBufWYTlAUtZWcMKAVpW0ZinnVlE9crmhbEriJ7RwI6XKUjM6u 8biiN29Jl3xtPTcMiq8CJlLu87GuapWs/eSXr6+b62w4ptrSkcS4I0mRvRS5QUmLGhLFU 9U1pH7I9mjdcCw1QSmf9kot46l5vIeF5z6HIiAuHVHLazv2Hr3+QramobrhNFDg7xQnaq /nlupdDqy4noVJp4Q8ANrZLThO3gqLVyx50daYyNDR6/mgOXNdUZ6gJLhM3WxQM/0tg== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796386147; h=DMARC-Filter:DKIM-Signature:X-CSE-ConnectionGUID:X-CSE-MsgGUID: X-IronPort-AV:X-IronPort-AV:Received:X-CSE-ConnectionGUID: X-CSE-MsgGUID:X-ExtLoop1:X-IronPort-AV:Received:Received:Date:From:To: Cc:Subject:Message-ID:References:MIME-Version:Content-Type: Content-Disposition:Content-Transfer-Encoding:In-Reply-To; bh=5OeDhiEDZQSsAxry1UGlbTsbt8f56qL0tsP1aN7Cb1o=; b=jYudI46FnHeh6ram/ZdU+8MJ18tVhHOTE/rL9CNZfGVFX/8okR7mL8ARKxm3Jjhgaxe7 b8mgMajb3Jh0gEkvriY1k/3J/sSiOXZ2s5zqfee9jLbDdHYiNm5/HUTM95ZWrHDu7LkmJ cdwFIkm+PO47gRgsbs+VK/ablMDE7bELs5O+Y/8Yfl5RBKYY2kDkRKqRQlwYRfRgXT9SO OR5PR47bu3eKNgtj8YDTmiAYKWCCqUQ8PuQniGjI2esIs9sc4wJ4833ZEueHwLDzNZLrD PXus7I8HtpjmopgM99fJ3xflTE+Ey2XiieajTwpTKD5FkRpeyOL88at83l9/n2bUHTQ== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=linux.intel.com; spf=pass smtp.mailfrom=linux.intel.com; dkim=pass header.d=intel.com header.i=@intel.com header.a=rsa-sha256 header.s=Intel header.b=LDrsXTYM; arc=none smtp.remote-ip=198.175.65.15 Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.15]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id EE826606A322 for ; Fri, 4 Dec 2026 12:09:06 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org EE826606A322 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.a=rsa-sha256 header.s=Intel header.b=LDrsXTYM DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1796386147; x=1827922147; h=date:from:to:cc:subject:message-id:references: mime-version:content-transfer-encoding:in-reply-to; bh=5OeDhiEDZQSsAxry1UGlbTsbt8f56qL0tsP1aN7Cb1o=; b=LDrsXTYM8k9F/mNNvbkg+dK2xnwagoZXE+oLBNS+45uADMPa7PBxCSgT aEQqac1kbIe1tkgrzuPp3Ma6vMbkQeNWZdf0tXpkvjipZYSD8CdIzA39Y tTtgx34VzFTfwbe+6otiJ+dWULLkfjhztyuBIImlM0DN9nglRGeQIkiyL 88PNbd7TuWGZfH/wWt9rl0J3RNTnuVvMcZRSnXudx0TPZcnbma/uQ+ZqA I+mn3Qy1yPii0ZrZ4A8LN6jT8Pa6wl4P5LDaOMh0IezRJMLnv+KYTBTKc aMqu8MyaVr4tfUPK8LmtYZ9P9t46J/xuLuskbibHp9LlZxC6zY49f95xG g==; X-CSE-ConnectionGUID: L/HsZ8aXQAeunhb6bONZDA== X-CSE-MsgGUID: 5mvS+gI8QMKPCpTjyrulbA== X-IronPort-AV: E=McAfee;i="6800,10657,11985"; a="5366710" X-IronPort-AV: E=Sophos;i="6.29,78,1794902400"; d="scan'208";a="5366710" Received: from fmviesa007.fm.intel.com ([10.60.135.147]) by orvoesa107.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 04 Dec 2026 04:09:07 -0800 X-CSE-ConnectionGUID: tjDvusOfQU6mnsffEjzTlw== X-CSE-MsgGUID: o24XsEI6TH++ZablxIQ9KQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.29,78,1794902400"; d="scan'208";a="14354922" Received: from black.igk.intel.com ([10.91.253.5]) by fmviesa007.fm.intel.com with ESMTP; 04 Dec 2026 04:09:03 -0800 Received: by black.igk.intel.com (Postfix, from userid 1008) id 7AC2A98; Fri, 04 Dec 2026 13:09:02 +0100 (CET) Date: Fri, 4 Dec 2026 13:09:02 +0100 From: Heikki Krogerus To: =?iso-8859-1?Q?Andr=E9?= Draszik Cc: Greg Kroah-Hartman , Badhri Jagan Sridharan , Sebastian Andrzej Siewior , Clark Williams , Steven Rostedt , Peter Griffin , Tudor Ambarus , Juan Yescas , Amit Sunil Dhamne , kernel-team@android.com, linux-usb@vger.kernel.org, linux-rt-devel@lists.linux.dev, stable@vger.kernel.org Subject: Re: [PATCH v3 4/4] usb: typec: tcpm/tcpci_maxim: only complain about vbus when sourcing Message-ID: References: <20261130-max77759-wait-v3-0-1ee9034dd228@linaro.org> <20261130-max77759-wait-v3-4-1ee9034dd228@linaro.org> X-Mailing-List: linux-rt-devel@lists.linux.dev List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20261130-max77759-wait-v3-4-1ee9034dd228@linaro.org> On Mon, Nov 30, 2026 at 04:04:02PM +0000, André Draszik wrote: > get_vbus_regulator_handle() logs a spurious "Failed to get vbus > regulator handle" error during probe and stores the ERR_PTR in > chip->vbus_reg even when sourcing VBUS is not requested. > > During tcpci_register_port(), tcpm_init_vbus() calls set_vbus(false, > false) before the PMIC charger providing the vbus regulator has probed > (the charger's power supply waits for the TCPM power supply), or on > sink-only boards without a vbus regulator. Sink-only operation does not > need the vbus regulator, and max_tcpci_set_vbus() already ignores > regulator lookup failures when source is false. > > Leave chip->vbus_reg untouched when regulator_get_exclusive() fails, > return the error from get_vbus_regulator_handle() silently, and log an > error in max_tcpci_set_vbus() only when sourcing is requested. > > Fixes: 0c8935642cb0 ("usb: typec: tcpm/tcpci_maxim: deprecate WAR for setting charger mode") > Cc: stable@vger.kernel.org > Signed-off-by: André Draszik Reviewed-by: Heikki Krogerus > --- > drivers/usb/typec/tcpm/tcpci_maxim_core.c | 26 ++++++++++++++++---------- > 1 file changed, 16 insertions(+), 10 deletions(-) > > diff --git a/drivers/usb/typec/tcpm/tcpci_maxim_core.c b/drivers/usb/typec/tcpm/tcpci_maxim_core.c > index 2e6a8906fb32..736d01694745 100644 > --- a/drivers/usb/typec/tcpm/tcpci_maxim_core.c > +++ b/drivers/usb/typec/tcpm/tcpci_maxim_core.c > @@ -208,15 +208,16 @@ static void process_rx(struct max_tcpci_chip *chip, u16 status) > > static int get_vbus_regulator_handle(struct max_tcpci_chip *chip) > { > - if (IS_ERR_OR_NULL(chip->vbus_reg)) { > - chip->vbus_reg = regulator_get_exclusive(chip->dev, "vbus"); > - if (IS_ERR_OR_NULL(chip->vbus_reg)) { > - dev_err(chip->dev, > - "Failed to get vbus regulator handle\n"); > - return -ENODEV; > - } > - } > + struct regulator *reg; > + > + if (chip->vbus_reg) > + return 0; > > + reg = regulator_get_exclusive(chip->dev, "vbus"); > + if (IS_ERR(reg)) > + return PTR_ERR(reg); > + > + chip->vbus_reg = reg; > return 0; > } > > @@ -224,7 +225,7 @@ static void max_tcpci_put_vbus_regulator(void *data) > { > struct max_tcpci_chip *chip = data; > > - if (!IS_ERR_OR_NULL(chip->vbus_reg)) > + if (chip->vbus_reg) > regulator_put(chip->vbus_reg); > } > > @@ -244,7 +245,12 @@ static int max_tcpci_set_vbus(struct tcpci *tcpci, struct tcpci_data *tdata, boo > * Regulator is not necessary for sink only applications. Return > * success in cases where sink mode is being modified. > */ > - return source ? ret : 1; > + if (!source) > + return 1; > + > + dev_err(chip->dev, "Failed to get vbus regulator: %pe\n", > + ERR_PTR(ret)); > + return ret; > } > > if (source) { > > -- > 2.56.1.839.g22a8290db9-goog > -- heikki