linux-doc.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Kory Maincent <kory.maincent@bootlin.com>
To: Sai Krishna Gajula <saikrishnag@marvell.com>
Cc: "David S. Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@google.com>,
	Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
	Donald Hunter <donald.hunter@gmail.com>,
	Oleksij Rempel <o.rempel@pengutronix.de>,
	Jonathan Corbet <corbet@lwn.net>,
	Thomas Petazzoni <thomas.petazzoni@bootlin.com>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"netdev@vger.kernel.org" <netdev@vger.kernel.org>,
	Dent Project <dentproject@linuxfoundation.org>,
	"kernel@pengutronix.de" <kernel@pengutronix.de>,
	"linux-doc@vger.kernel.org" <linux-doc@vger.kernel.org>
Subject: Re: [PATCH net-next v4 4/7] net: pse-pd: Add new power limit get and set c33 features
Date: Wed, 26 Jun 2024 10:21:40 +0200	[thread overview]
Message-ID: <20240626102140.1aac4593@kmaincent-XPS-13-7390> (raw)
In-Reply-To: <BY3PR18MB4707C5C95955ED5CA2D7CA60A0D52@BY3PR18MB4707.namprd18.prod.outlook.com>

On Tue, 25 Jun 2024 18:49:26 +0000
Sai Krishna Gajula <saikrishnag@marvell.com> wrote:

> > + * Return: 0 on success and failure value on error  */ int
> > +pse_ethtool_set_pw_limit(struct pse_control *psec,
> > +			     struct netlink_ext_ack *extack,
> > +			     const unsigned int pw_limit)
> > +{
> > +	int uV, uA, ret;
> > +	s64 tmp_64;
> > +
> > +	ret = regulator_get_voltage(psec->ps);
> > +	if (!ret) {
> > +		NL_SET_ERR_MSG(extack,
> > +			       "Can't read current voltage");
> > +		return ret;
> > +	}
> > +	if (ret < 0) {
> > +		NL_SET_ERR_MSG(extack,
> > +			       "Error reading current voltage");
> > +		return ret;
> > +	}  
> 
> Is there any significance of checking "ret" value against '0' and '< 0'
> separately?  Just trying to understand, these checks reflect regulator
> failure etc..?

In fact having ret = 0 is not an error for regulator_get_voltage() but with a 0
value I can't calculate the currrent.
I will update the error message and return value:

NL_SET_ERR_MSG(extack, "Can't calculate the current, PSE voltage read is 0");
return -ERANGE;
 
>  [...]  
> Reviewed-by: Sai Krishna <saikrishnag@marvell.com>

Thanks!

Regards,
-- 
Köry Maincent, Bootlin
Embedded Linux and kernel engineering
https://bootlin.com

  reply	other threads:[~2024-06-26  8:21 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-06-25 12:33 [PATCH net-next v4 0/7] net: pse-pd: Add new PSE c33 features Kory Maincent
2024-06-25 12:33 ` [PATCH net-next v4 1/7] net: ethtool: pse-pd: Expand C33 PSE status with class, power and extended state Kory Maincent
2024-06-26  5:08   ` Oleksij Rempel
2024-06-25 12:33 ` [PATCH net-next v4 2/7] netlink: specs: Expand the PSE netlink command with C33 new features Kory Maincent
2024-06-25 12:33 ` [PATCH net-next v4 3/7] net: pse-pd: pd692x0: Expand ethtool status message Kory Maincent
2024-06-25 12:33 ` [PATCH net-next v4 4/7] net: pse-pd: Add new power limit get and set c33 features Kory Maincent
2024-06-25 18:49   ` Sai Krishna Gajula
2024-06-26  8:21     ` Kory Maincent [this message]
2024-06-25 12:33 ` [PATCH net-next v4 5/7] net: ethtool: Add new power limit get and set features Kory Maincent
2024-06-25 12:33 ` [PATCH net-next v4 6/7] netlink: specs: Expand the PSE netlink command with C33 pw-limit attributes Kory Maincent
2024-06-25 12:33 ` [PATCH net-next v4 7/7] net: pse-pd: pd692x0: Enhance with new current limit and voltage read callbacks Kory Maincent
2024-06-26  1:41 ` [PATCH net-next v4 0/7] net: pse-pd: Add new PSE c33 features Jakub Kicinski
2024-06-26  7:52   ` Kory Maincent
2024-06-26 13:27     ` Jakub Kicinski
2024-06-26 15:25       ` Kory Maincent

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=20240626102140.1aac4593@kmaincent-XPS-13-7390 \
    --to=kory.maincent@bootlin.com \
    --cc=corbet@lwn.net \
    --cc=davem@davemloft.net \
    --cc=dentproject@linuxfoundation.org \
    --cc=donald.hunter@gmail.com \
    --cc=edumazet@google.com \
    --cc=kernel@pengutronix.de \
    --cc=kuba@kernel.org \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=o.rempel@pengutronix.de \
    --cc=pabeni@redhat.com \
    --cc=saikrishnag@marvell.com \
    --cc=thomas.petazzoni@bootlin.com \
    /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).