Re: [PATCH 7/8] firmware: arm_scmi: transport: Add ACPI PCC transport

Dan Carpenter
2025-10-20T08:20:25Z

On Fri, Oct 17, 2025 at 02:23:50PM +0100, Sudeep Holla wrote:
> +static int pcc_chan_setup(struct scmi_chan_info *cinfo, struct device *dev,
> + bool tx)
> +{
> + const char *desc = tx ? "Tx" : "Rx";
> + struct device *cdev = cinfo->dev;
> + struct scmi_pcc *smbox;
> + int ret, ss_id;
> + struct mbox_client *cl;
> +
> + smbox = devm_kzalloc(dev, sizeof(*smbox), GFP_KERNEL);
> + if (!smbox)
> + return -ENOMEM;
> +
> + cl = &smbox->cl;
> + cl->dev = cdev;
> + cl->tx_prepare = tx ? tx_prepare : NULL;
> + cl->rx_callback = rx_callback;
> + cl->tx_block = false;
> +
> + ss_id = pcc_get_ss_id(cinfo->id, tx);
> + if (ss_id < 0)
> + return ss_id;
> +
> + smbox->pchan = pcc_mbox_request_channel(cl, ss_id);
> + if (IS_ERR(smbox->pchan)) {
> + ret = PTR_ERR(smbox->pchan);
> + if (ret != -EPROBE_DEFER)
> + dev_err(cdev,
> + "failed to request SCMI %s mailbox\n", desc);
> + return ret;
> + }

Use the dev_err_probe() function for this:

smbox->pchan = pcc_mbox_request_channel(cl, ss_id);
if (IS_ERR(smbox->pchan)
return dev_err_probe(cdev, PTR_ERR(smbox->pchan),
"failed to request SCMI %s mailbox\n",
desc);

regards,
dan carpenter

> +
> + cinfo->transport_info = smbox;
> + smbox->cinfo = cinfo;
> +
> + return 0;
> +}