All of lore.kernel.org
 help / color / mirror / Atom feed
From: Eddie James <eajames@linux.vnet.ibm.com>
To: Andrew Jeffery <andrew@aj.id.au>, joel@jms.id.au
Cc: openbmc@lists.ozlabs.org, Matt Spinler <mspinler@linux.vnet.ibm.com>
Subject: Re: [PATCH linux dev-4.13 3/5] pmbus (core): One-shot retries for failure to set page
Date: Tue, 3 Apr 2018 09:58:43 -0500	[thread overview]
Message-ID: <48da24d8-0594-88d7-967d-4639740127c4@linux.vnet.ibm.com> (raw)
In-Reply-To: <20180403142655.16681-4-andrew@aj.id.au>



On 04/03/2018 09:26 AM, Andrew Jeffery wrote:
> Work around the shonky behaviour seen with the MAX31785 where we fail
> to set the page register in some circumstances.
>
> There's no real elegant way to do this. We can propagate the error up,
> but that forces us to retry the operation way up the call tree in any
> number of places. It also forces callers to split out pmbus_set_page()
> from the pmbus_{read,write}_{byte,word}_data() functions in order to
> differentiate between a failure to set the page and a failure to read a
> register (that might not exist, in which case an error is anticiptated).

Reviewed-by: Eddie James <eajames@linux.vnet.ibm.com>

>
> Cc: Eddie James <eajames@linux.vnet.ibm.com>
> Cc: Matt Spinler <mspinler@linux.vnet.ibm.com>
> Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
> ---
>   drivers/hwmon/pmbus/pmbus_core.c | 12 ++++++++++--
>   1 file changed, 10 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/hwmon/pmbus/pmbus_core.c b/drivers/hwmon/pmbus/pmbus_core.c
> index ee7e0684c29f..ee1bf11c7fc6 100644
> --- a/drivers/hwmon/pmbus/pmbus_core.c
> +++ b/drivers/hwmon/pmbus/pmbus_core.c
> @@ -167,9 +167,17 @@ int pmbus_set_page(struct i2c_client *client, int page)
>   		return 0;
>
>   	if (!(data->info->func[page] & PMBUS_PAGE_VIRTUAL)) {
> +		dev_dbg(&client->dev, "Want page %u, %u cached\n", page,
> +			data->currpage);
> +
>   		rv = i2c_smbus_write_byte_data(client, PMBUS_PAGE, page);
> -		if (rv < 0)
> -			return rv;
> +		if (rv) {
> +			rv = i2c_smbus_write_byte_data(client, PMBUS_PAGE,
> +						       page);
> +			dev_dbg(&client->dev,
> +				"Failed to set page %u, performed one-shot retry %s: %d\n",
> +				page, rv ? "and failed" : "with success", rv);
> +		}
>
>   		rv = i2c_smbus_read_byte_data(client, PMBUS_PAGE);
>   		if (rv < 0)

  reply	other threads:[~2018-04-03 14:58 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-04-03 14:26 [PATCH linux dev-4.13 0/5] max31785: Add devicetree support and work-arounds for transfer failures Andrew Jeffery
2018-04-03 14:26 ` [PATCH linux dev-4.13 1/5] dt-bindings: hwmon: pmbus: Add Maxim MAX31785 documentation Andrew Jeffery
2018-04-03 14:26 ` [PATCH linux dev-4.13 2/5] pmbus (max31785): Add support for devicetree configuration Andrew Jeffery
2018-04-03 14:26 ` [PATCH linux dev-4.13 3/5] pmbus (core): One-shot retries for failure to set page Andrew Jeffery
2018-04-03 14:58   ` Eddie James [this message]
2018-04-03 14:26 ` [PATCH linux dev-4.13 4/5] pmbus (core): Use driver callbacks in pmbus_get_fan_rate() Andrew Jeffery
2018-04-03 20:37   ` Eddie James
2018-04-03 14:26 ` [PATCH linux dev-4.13 5/5] pmbus (max31785): Wrap all I2C accessors in one-shot failure handlers Andrew Jeffery

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=48da24d8-0594-88d7-967d-4639740127c4@linux.vnet.ibm.com \
    --to=eajames@linux.vnet.ibm.com \
    --cc=andrew@aj.id.au \
    --cc=joel@jms.id.au \
    --cc=mspinler@linux.vnet.ibm.com \
    --cc=openbmc@lists.ozlabs.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.