[PATCH linux dev-4.13 3/4] fsi/occ: Nicer error messages when talking to a host that isn't ready

Andrew Jeffery andrew at aj.id.au
Mon May 21 15:30:47 AEST 2018


On Fri, 18 May 2018, at 11:04, Benjamin Herrenschmidt wrote:
> Signed-off-by: Benjamin Herrenschmidt <benh at kernel.crashing.org>

Reviewed-by: Andrew Jeffery <andrew at aj.id.au>

> ---
>  drivers/fsi/fsi-occ.c      | 12 ++++++++++++
>  drivers/hwmon/occ/common.c |  9 +++++++--
>  2 files changed, 19 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/fsi/fsi-occ.c b/drivers/fsi/fsi-occ.c
> index 7a5afa78fb6b..4bda1b435ecb 100644
> --- a/drivers/fsi/fsi-occ.c
> +++ b/drivers/fsi/fsi-occ.c
> @@ -484,6 +484,10 @@ static int occ_getsram(struct device *sbefifo, u32 
> address, u8 *data,
>  		rc = sbefifo_submit(sbefifo, cmd, 5, resp, &resp_len);
>  		if (rc == 0)
>  			rc = sbefifo_parse_status(0xa403, resp, resp_len, &resp_len);
> +		if (rc == -ESHUTDOWN) {
> +			pr_info("occ: Host not ready\n");
> +			return rc;
> +		}
>  		if (rc) {
>  			if (rc < 0)
>  				pr_err("occ: FSI error %d, retrying sram read\n", rc);
> @@ -548,6 +552,10 @@ static int occ_putsram(struct device *sbefifo, u32 
> address, u8 *data,
>  
>  		resp_len = OCC_SBE_STATUS_WORDS;
>  		rc = sbefifo_submit(sbefifo, buf, cmd_len, buf, &resp_len);
> +		if (rc == -ESHUTDOWN) {
> +			pr_info("occ: Host not ready\n");
> +			return rc;
> +		}
>  		if (rc == 0)
>  			rc = sbefifo_parse_status(0xa404, buf, resp_len, &resp_len);
>  		if (rc) {
> @@ -604,6 +612,10 @@ static int occ_trigger_attn(struct device *sbefifo)
>  		buf[6] = 0;
>  
>  		rc = sbefifo_submit(sbefifo, buf, 7, buf, &resp_len);
> +		if (rc == -ESHUTDOWN) {
> +			pr_info("occ: Host not ready\n");
> +			return rc;
> +		}
>  		if (rc == 0)
>  			rc = sbefifo_parse_status(0xa404, buf, resp_len, &resp_len);
>  		if (rc) {
> diff --git a/drivers/hwmon/occ/common.c b/drivers/hwmon/occ/common.c
> index 88c32915b8bf..10f5c0586d47 100644
> --- a/drivers/hwmon/occ/common.c
> +++ b/drivers/hwmon/occ/common.c
> @@ -1350,8 +1350,13 @@ int occ_setup(struct occ *occ, const char *name)
>  	/* no need to lock */
>  	rc = occ_poll(occ);
>  	if (rc < 0) {
> -		dev_err(occ->bus_dev, "failed to get OCC poll response: %d\n",
> -			rc);
> +		/*
> +		 * If the error is -ESHUTDOWN, fail silently, as this happen in
> +		 * normal circumstances when the driver is loaded too early
> +		 */
> +		if (rc != -ESHUTDOWN)
> +			dev_err(occ->bus_dev, "failed to get OCC poll response: %d\n",
> +				rc);
>  		return rc;
>  	}
>  
> -- 
> 2.17.0
> 


More information about the openbmc mailing list