All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] firmware: arm_scmi: Use dev_err_probe() to simplify code
@ 2022-09-24  2:51 Yuan Can
  2022-09-26 10:50 ` Cristian Marussi
  0 siblings, 1 reply; 2+ messages in thread
From: Yuan Can @ 2022-09-24  2:51 UTC (permalink / raw)
  To: sudeep.holla, cristian.marussi, linux-arm-kernel; +Cc: yuancan

In the probe path, dev_err() can be replaced with dev_err_probe()
which will check if error code is -EPROBE_DEFER and prints the
error name. It also sets the defer probe reason which can be
checked later through debugfs.

Signed-off-by: Yuan Can <yuancan@huawei.com>
---
 drivers/firmware/arm_scmi/mailbox.c | 11 ++++-------
 1 file changed, 4 insertions(+), 7 deletions(-)

diff --git a/drivers/firmware/arm_scmi/mailbox.c b/drivers/firmware/arm_scmi/mailbox.c
index 08ff4d110beb..85b84be85458 100644
--- a/drivers/firmware/arm_scmi/mailbox.c
+++ b/drivers/firmware/arm_scmi/mailbox.c
@@ -94,13 +94,10 @@ static int mailbox_chan_setup(struct scmi_chan_info *cinfo, struct device *dev,
 	cl->knows_txdone = tx;
 
 	smbox->chan = mbox_request_channel(cl, tx ? 0 : 1);
-	if (IS_ERR(smbox->chan)) {
-		ret = PTR_ERR(smbox->chan);
-		if (ret != -EPROBE_DEFER)
-			dev_err(cdev, "failed to request SCMI %s mailbox\n",
-				tx ? "Tx" : "Rx");
-		return ret;
-	}
+	if (IS_ERR(smbox->chan))
+		return dev_err_probe(cdev, PTR_ERR(smbox->chan),
+				     "failed to request SCMI %s mailbox\n",
+				     tx ? "Tx" : "Rx");
 
 	cinfo->transport_info = smbox;
 	smbox->cinfo = cinfo;
-- 
2.17.1


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] firmware: arm_scmi: Use dev_err_probe() to simplify code
  2022-09-24  2:51 [PATCH] firmware: arm_scmi: Use dev_err_probe() to simplify code Yuan Can
@ 2022-09-26 10:50 ` Cristian Marussi
  0 siblings, 0 replies; 2+ messages in thread
From: Cristian Marussi @ 2022-09-26 10:50 UTC (permalink / raw)
  To: Yuan Can; +Cc: sudeep.holla, linux-arm-kernel

On Sat, Sep 24, 2022 at 02:51:46AM +0000, Yuan Can wrote:
> In the probe path, dev_err() can be replaced with dev_err_probe()
> which will check if error code is -EPROBE_DEFER and prints the
> error name. It also sets the defer probe reason which can be
> checked later through debugfs.
> 
> Signed-off-by: Yuan Can <yuancan@huawei.com>

Hi Yuan,

LGTM, thanks for this.

Reviewed-by: Cristian Marussi <cristian.marussi@arm.com>

Thanks,
Cristian

> ---
>  drivers/firmware/arm_scmi/mailbox.c | 11 ++++-------
>  1 file changed, 4 insertions(+), 7 deletions(-)
> 
> diff --git a/drivers/firmware/arm_scmi/mailbox.c b/drivers/firmware/arm_scmi/mailbox.c
> index 08ff4d110beb..85b84be85458 100644
> --- a/drivers/firmware/arm_scmi/mailbox.c
> +++ b/drivers/firmware/arm_scmi/mailbox.c
> @@ -94,13 +94,10 @@ static int mailbox_chan_setup(struct scmi_chan_info *cinfo, struct device *dev,
>  	cl->knows_txdone = tx;
>  
>  	smbox->chan = mbox_request_channel(cl, tx ? 0 : 1);
> -	if (IS_ERR(smbox->chan)) {
> -		ret = PTR_ERR(smbox->chan);
> -		if (ret != -EPROBE_DEFER)
> -			dev_err(cdev, "failed to request SCMI %s mailbox\n",
> -				tx ? "Tx" : "Rx");
> -		return ret;
> -	}
> +	if (IS_ERR(smbox->chan))
> +		return dev_err_probe(cdev, PTR_ERR(smbox->chan),
> +				     "failed to request SCMI %s mailbox\n",
> +				     tx ? "Tx" : "Rx");
>  
>  	cinfo->transport_info = smbox;
>  	smbox->cinfo = cinfo;
> -- 
> 2.17.1
> 

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-09-26 10:51 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-09-24  2:51 [PATCH] firmware: arm_scmi: Use dev_err_probe() to simplify code Yuan Can
2022-09-26 10:50 ` Cristian Marussi

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.