From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pj1-f46.google.com (mail-pj1-f46.google.com [209.85.216.46]) (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 B5ED7318B8D for ; Mon, 9 Feb 2026 06:53:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.216.46 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770620022; cv=none; b=NuDr4PoHVAgRjdpOZg8Vn+4GAyzJwG9BV2Z75dOp5rYo/o9wWS1gaMd2tDwYCcrrKigSQ/5w+4+6Yipe+qw8L9EimiQU+UIso+M1ST8fJQSxVSEK1Vm+TQf48aJOX0Z9lU38adjgFjC+DVRI9AIIdYeiKM2fhUPLAGoeCJH8Mh4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770620022; c=relaxed/simple; bh=34oE8k9pbYUI5EGosABwPmeVX24fpZFq86+F+iptjnk=; h=From:Date:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=XPS/uc2xEntALOK1+iY/wMbkqJbnquuEph9m0A6nTOGvRJYLWXNewErfbDzvZcaNIG4kUfaPPAi9q141Q9Pj87KVE49hucN4f1LQjm4eP8yeOlkka6lzrV/yaFGfdpUCqPIZk9XTZQe6TNYKyv4k/JB6wEW5HoOec7PgaGc+a/M= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=TR8pGz/t; arc=none smtp.client-ip=209.85.216.46 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="TR8pGz/t" Received: by mail-pj1-f46.google.com with SMTP id 98e67ed59e1d1-354bc4bb75dso1196053a91.2 for ; Sun, 08 Feb 2026 22:53:42 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1770620022; x=1771224822; darn=vger.kernel.org; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:message-id:subject:cc:to:date:from:from:to :cc:subject:date:message-id:reply-to; bh=J0yBZlUfIwO8R+8/v699G5QRXerYU4/HGTHJycEONF0=; b=TR8pGz/tufmAFgA6xgWviADId42jKk5sYv0ITja6rUsXUI5Lg1iYtJ5wxZWKSTK2qe ilhc5MsAa97OEUtdoWR61MEPXMh1j829hrPSqfR6oKHkEcnnZFx3bNL5Dmz+jXqVAR4p C8eyFmaOjvWI9ccLfkl56uzEJjQr7ivUix4WE6Qy9nOySJhvL3BAdRl90LoVAuezzzB8 LzBbVM0u5eXZifpZdg+/00WihuTbUxL37GBtKWNFHIQCs4z0D5Z4l7uroMQ8UwU8/Tz1 9GqP6locmbG5uYTACkJEmDcp2eObVk31d3zvd9dHQYhsAuZgyRIG/4k33962wyuXud4x wMwA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1770620022; x=1771224822; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:message-id:subject:cc:to:date:from:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=J0yBZlUfIwO8R+8/v699G5QRXerYU4/HGTHJycEONF0=; b=qTnjFqP3FKx1sr4jAcjWRME5Ck/U0079Ra1pGhv5bC5Bp2d0MSTOeaeUmpJP6hDbtF M+fjF4GqSL+yJKWYlfGZtIulvWez6N+l9HXfk4mhNNB2fqxwZx4Q0L2gRo0i54591ZCZ SBURhV7p2vWYmLBxmx4UQOmJOcEQDaX8ffaqvOL5U/ERqHB9hEoa1y3cSvuVa/bpb2bg MfXqyNRFa4/1v8EBhXr2z0uGNLrU8wed6LbMa4k6akT/hVO0Vq64LuKFRqEmUdfwP75K 663StLarfDlv5vnwtpbANyZrj+lyzXLU/ReHrOrZm7c0ae7JYeYIFzVEV9335nqDimen g0Ew== X-Forwarded-Encrypted: i=1; AJvYcCU/IOMEZ/X+vqRscQyZuqEvaWWkRmq6jWJttuYkl5qbwZM28X0inI2qMaz7FyMsQmnQN8tHjpd0kPsfffw=@vger.kernel.org X-Gm-Message-State: AOJu0YyUrhudbmhb2HtFTYFAqCwhBLZTW1JqpgdcMgqQMKWf2/iKDrTD vo2B4H8o5CdfqmgE1HVtAV+tDQC2dQgmJsZ2dXgvuovngT5Wuj6iPwqt X-Gm-Gg: AZuq6aIyoXxldRUghxhyXo5001A72XToavnlwq3zyQ7H5SGOZrk8uxc0FpaJknvHPnx QPrdoLuX0LTgxZvJly4gjQEV7Cy8dxt8YXsE4boDkbBhdozqLMLn1IfLRKlryV8/eSZ7CvmM0OW QEs+TNdHIziWobHLgck9/FfEAOS1XKwYytNtSlH5U8m+1KEi4r/1F8KOWa1C7xLLksYKdgFnSsm w+PPW25hZGF3T39+9IkWZlahqKe/KzQhvXJAMsI/PDs6Sb7eyYpIFGq+veIEW4d6h6dHFfaWIEO MvTOqNfbZ/fjLTwEHr3t1BquvmVISJNY/VvdKZKaUSPG0pd2z9iusOFeRmw853YobsSX05F5dVK DScwbD+RuFxSXWMnOTafqxVVevWgvUJYv5Nzvun+6JqWg1GNx6FkiGY9hkWSdhKUqkB9JxvpOs9 Nchw== X-Received: by 2002:a17:90b:1c87:b0:34c:3501:d118 with SMTP id 98e67ed59e1d1-354b3ba32cemr7736151a91.1.1770620021939; Sun, 08 Feb 2026 22:53:41 -0800 (PST) Received: from localhost ([218.32.81.133]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-354c7fad6c6sm4166851a91.1.2026.02.08.22.53.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 08 Feb 2026 22:53:41 -0800 (PST) From: Carl Lee X-Google-Original-From: Carl Lee Date: Mon, 9 Feb 2026 14:53:38 +0800 To: Guenter Roeck Cc: Rob Herring , Krzysztof Kozlowski , Conor Dooley , Charles Hsu , linux-hwmon@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, peter.shen@amd.com, colin.huang2@amd.com Subject: Re: [PATCH v2 3/3] hwmon: pmbus: mpq8785: force direct mode for VID VOUT on MPQ8785/MPQ8786 Message-ID: References: <20260205-dt-bindings-hwmon-pmbus-mpq8785-add-mpq8786-support-v2-0-3744cd9b2850@amd.com> <20260205-dt-bindings-hwmon-pmbus-mpq8785-add-mpq8786-support-v2-3-3744cd9b2850@amd.com> 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 Content-Transfer-Encoding: 8bit In-Reply-To: On Thu, Feb 05, 2026 at 09:46:05AM -0800, Guenter Roeck wrote: > On Thu, Feb 05, 2026 at 06:01:39PM +0800, Carl Lee via B4 Relay wrote: > > From: Carl Lee > > > > According to MPQ8785/MPQ8786 datasheet, VID mode configuration is > > the same as direct mode configuration. Therefore, when VOUT is > > reported in VID mode, it must be forced to use direct format. > > > > Signed-off-by: Carl Lee > > --- > > drivers/hwmon/pmbus/mpq8785.c | 20 ++++++++++++++++++++ > > 1 file changed, 20 insertions(+) > > > > diff --git a/drivers/hwmon/pmbus/mpq8785.c b/drivers/hwmon/pmbus/mpq8785.c > > index f35534836cb8..d6624af076c3 100644 > > --- a/drivers/hwmon/pmbus/mpq8785.c > > +++ b/drivers/hwmon/pmbus/mpq8785.c > > @@ -48,6 +48,25 @@ static int mpq8785_identify(struct i2c_client *client, > > return 0; > > }; > > > > +static int mpq8785_read_byte_data(struct i2c_client *client, int page, int reg) > > +{ > > + int ret; > > + > > + switch (reg) { > > + case PMBUS_VOUT_MODE: > > + ret = pmbus_read_byte_data(client, page, reg); > > + if (ret < 0) > > + return ret; > > + > > + if ((ret >> 5) == 1) > > + return PB_VOUT_MODE_DIRECT; > > + default: > > + return -ENODATA; > > + } > > + > > + return ret; > > +} > > In addition to my earlier reply, here is AI code review feedback: > > This switch statement appears to fall through to the default case when the > mode is not VID (when (ret >> 5) != 1). If it falls through, it returns > -ENODATA. The core function _pmbus_read_byte_data() will then see -ENODATA > and call pmbus_read_byte_data() again, resulting in a second I2C transaction > for the same register. > > Also, the `return ret;` at the end of the function is unreachable because > the default case returns. > > Should the PMBUS_VOUT_MODE case return `ret` instead of falling through? > > Guenter Got it, I’ll correct this.