mirror of
https://github.com/torvalds/linux.git
synced 2025-12-07 20:06:24 +00:00
Merge tag 'imx-drivers-6.19' of https://git.kernel.org/pub/scm/linux/kernel/git/shawnguo/linux into soc/drivers
i.MX drivers update for 6.19: - A series from Peng Fan to to improve i.MX SCU firmware drivers * tag 'imx-drivers-6.19' of https://git.kernel.org/pub/scm/linux/kernel/git/shawnguo/linux: firmware: imx: scu: Use devm_mutex_init firmware: imx: scu: Suppress bind attrs firmware: imx: scu: Update error code firmware: imx: scu-irq: Remove unused export of imx_scu_enable_general_irq_channel firmware: imx: scu-irq: Set mu_resource_id before get handle firmware: imx: scu-irq: Init workqueue before request mbox channel firmware: imx: scu-irq: Free mailbox client on failure at imx_scu_enable_general_irq_channel() firmware: imx: scu-irq: fix OF node leak in Signed-off-by: Arnd Bergmann <arnd@arndb.de>
This commit is contained in:
@@ -203,6 +203,18 @@ int imx_scu_enable_general_irq_channel(struct device *dev)
|
||||
struct mbox_chan *ch;
|
||||
int ret = 0, i = 0;
|
||||
|
||||
if (!of_parse_phandle_with_args(dev->of_node, "mboxes",
|
||||
"#mbox-cells", 0, &spec)) {
|
||||
i = of_alias_get_id(spec.np, "mu");
|
||||
of_node_put(spec.np);
|
||||
}
|
||||
|
||||
/* use mu1 as general mu irq channel if failed */
|
||||
if (i < 0)
|
||||
i = 1;
|
||||
|
||||
mu_resource_id = IMX_SC_R_MU_0A + i;
|
||||
|
||||
ret = imx_scu_get_handle(&imx_sc_irq_ipc_handle);
|
||||
if (ret)
|
||||
return ret;
|
||||
@@ -214,27 +226,16 @@ int imx_scu_enable_general_irq_channel(struct device *dev)
|
||||
cl->dev = dev;
|
||||
cl->rx_callback = imx_scu_irq_callback;
|
||||
|
||||
INIT_WORK(&imx_sc_irq_work, imx_scu_irq_work_handler);
|
||||
|
||||
/* SCU general IRQ uses general interrupt channel 3 */
|
||||
ch = mbox_request_channel_byname(cl, "gip3");
|
||||
if (IS_ERR(ch)) {
|
||||
ret = PTR_ERR(ch);
|
||||
dev_err(dev, "failed to request mbox chan gip3, ret %d\n", ret);
|
||||
devm_kfree(dev, cl);
|
||||
return ret;
|
||||
goto free_cl;
|
||||
}
|
||||
|
||||
INIT_WORK(&imx_sc_irq_work, imx_scu_irq_work_handler);
|
||||
|
||||
if (!of_parse_phandle_with_args(dev->of_node, "mboxes",
|
||||
"#mbox-cells", 0, &spec))
|
||||
i = of_alias_get_id(spec.np, "mu");
|
||||
|
||||
/* use mu1 as general mu irq channel if failed */
|
||||
if (i < 0)
|
||||
i = 1;
|
||||
|
||||
mu_resource_id = IMX_SC_R_MU_0A + i;
|
||||
|
||||
/* Create directory under /sysfs/firmware */
|
||||
wakeup_obj = kobject_create_and_add("scu_wakeup_source", firmware_kobj);
|
||||
if (!wakeup_obj) {
|
||||
@@ -253,7 +254,8 @@ int imx_scu_enable_general_irq_channel(struct device *dev)
|
||||
|
||||
free_ch:
|
||||
mbox_free_channel(ch);
|
||||
free_cl:
|
||||
devm_kfree(dev, cl);
|
||||
|
||||
return ret;
|
||||
}
|
||||
EXPORT_SYMBOL(imx_scu_enable_general_irq_channel);
|
||||
|
||||
@@ -73,9 +73,9 @@ static int imx_sc_linux_errmap[IMX_SC_ERR_LAST] = {
|
||||
-EACCES, /* IMX_SC_ERR_NOACCESS */
|
||||
-EACCES, /* IMX_SC_ERR_LOCKED */
|
||||
-ERANGE, /* IMX_SC_ERR_UNAVAILABLE */
|
||||
-EEXIST, /* IMX_SC_ERR_NOTFOUND */
|
||||
-EPERM, /* IMX_SC_ERR_NOPOWER */
|
||||
-EPIPE, /* IMX_SC_ERR_IPC */
|
||||
-ENOENT, /* IMX_SC_ERR_NOTFOUND */
|
||||
-ENODEV, /* IMX_SC_ERR_NOPOWER */
|
||||
-ECOMM, /* IMX_SC_ERR_IPC */
|
||||
-EBUSY, /* IMX_SC_ERR_BUSY */
|
||||
-EIO, /* IMX_SC_ERR_FAIL */
|
||||
};
|
||||
@@ -324,7 +324,9 @@ static int imx_scu_probe(struct platform_device *pdev)
|
||||
}
|
||||
|
||||
sc_ipc->dev = dev;
|
||||
mutex_init(&sc_ipc->lock);
|
||||
ret = devm_mutex_init(dev, &sc_ipc->lock);
|
||||
if (ret)
|
||||
return ret;
|
||||
init_completion(&sc_ipc->done);
|
||||
|
||||
imx_sc_ipc_handle = sc_ipc;
|
||||
@@ -352,6 +354,7 @@ static struct platform_driver imx_scu_driver = {
|
||||
.driver = {
|
||||
.name = "imx-scu",
|
||||
.of_match_table = imx_scu_match,
|
||||
.suppress_bind_attrs = true,
|
||||
},
|
||||
.probe = imx_scu_probe,
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user