All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jeremy Kerr <jk@ozlabs.org>
To: Christopher Bostic <cbostic@linux.vnet.ibm.com>, joel@jms.id.au
Cc: openbmc@lists.ozlabs.org
Subject: Re: [PATCH linux dev-4.7 v2 5/7] drivers/fsi: Add retry on bus error detect
Date: Wed, 22 Feb 2017 09:13:59 +0800	[thread overview]
Message-ID: <a16b4705-f6d8-67cc-9bd1-a3d10df050bd@ozlabs.org> (raw)
In-Reply-To: <20170221215032.79282-6-cbostic@linux.vnet.ibm.com>

Hi Chris,

> --- a/drivers/fsi/fsi-master-gpio.c
> +++ b/drivers/fsi/fsi-master-gpio.c
> @@ -381,7 +381,17 @@ static int fsi_master_gpio_read(struct fsi_master *_master, int link,
>  		return -ENODEV;
>  
>  	build_abs_ar_command(&cmd, FSI_GPIO_CMD_READ, slave, addr, size, NULL);
> -	return send_command(master, &cmd, FSI_GPIO_RESP_ACKD, size, val);
> +	rc = send_command(master, &cmd, FSI_GPIO_RESP_ACKD, size, val);
> +	if (rc) {
> +		fsi_master_handle_error(&master->master, addr);
> +
> +		/* Try again */
> +		rc = send_command(master, &cmd, FSI_GPIO_RESP_ACKD, size, val);
> +		if (rc)
> +			fsi_master_handle_error(&master->master, addr);
> +	}
> +
> +	return rc;

Lets avoid the repeated code:

	const static int master_retries = 2;

	[...]

	for (retries = 0; retries < master_retries; retries++) {
		rc = send_command(master, &cmd, FSI_GPIO_RESP_ACKD, size, val);
		if (!rc)
			break;
		fsi_master_handle_error(&master->master, addr);
	}

	return rc;

[or even better, we may want to put this in a helper, for use by both
call sites]

Also, is there any condition where fsi_master_handle_error() knows that
the FSI bus is totally hosed, and there's no point retrying?

Cheers,


Jeremy

  parent reply	other threads:[~2017-02-22  1:14 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-02-21 21:50 [PATCH linux dev-4.7 v2 0/7] drivers/fsi: Add hub master Christopher Bostic
2017-02-21 21:50 ` [PATCH linux dev-4.7 v2 1/7] drivers/fsi: Add hub master scan detect Christopher Bostic
2017-02-22  1:02   ` Jeremy Kerr
2017-02-22 15:29     ` Christopher Bostic
2017-02-21 21:50 ` [PATCH linux dev-4.7 v2 2/7] drivers/fsi: Initialize hub master Christopher Bostic
2017-02-21 21:50 ` [PATCH linux dev-4.7 v2 3/7] drivers/fsi: Define hub master callbacks Christopher Bostic
2017-02-22  1:06   ` Jeremy Kerr
2017-02-22 16:33     ` Christopher Bostic
2017-02-21 21:50 ` [PATCH linux dev-4.7 v2 4/7] drivers/fsi: Move common read write ops into single function Christopher Bostic
2017-02-22  1:02   ` Joel Stanley
2017-02-21 21:50 ` [PATCH linux dev-4.7 v2 5/7] drivers/fsi: Add retry on bus error detect Christopher Bostic
2017-02-22  1:00   ` Joel Stanley
2017-02-22 16:34     ` Christopher Bostic
2017-02-22 22:36     ` Christopher Bostic
2017-02-22  1:13   ` Jeremy Kerr [this message]
2017-02-22 16:37     ` Christopher Bostic
2017-02-21 21:50 ` [PATCH linux dev-4.7 v2 6/7] drivers/fsi: Cleanup bus errors Christopher Bostic
2017-02-22 21:55   ` Jeremy Kerr
2017-02-22 22:51     ` Christopher Bostic
2017-02-21 21:50 ` [PATCH linux dev-4.7 v2 7/7] tools/testing/selftests: Add fsi command line tool Christopher Bostic
2017-02-22  1:08 ` [PATCH linux dev-4.7 v2 0/7] drivers/fsi: Add hub master Jeremy Kerr
2017-02-22 15:27   ` Christopher Bostic
2017-02-22 16:24 ` Andrew Geissler

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=a16b4705-f6d8-67cc-9bd1-a3d10df050bd@ozlabs.org \
    --to=jk@ozlabs.org \
    --cc=cbostic@linux.vnet.ibm.com \
    --cc=joel@jms.id.au \
    --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.