Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

firmware: imx: scu-irq: Set mu_resource_id before get handle

mu_resource_id is referenced in imx_scu_irq_get_status() and
imx_scu_irq_group_enable() which could be used by other modules, so
need to set correct value before using imx_sc_irq_ipc_handle in
SCU API call.

Reviewed-by: Frank Li <Frank.Li@nxp.com>
Signed-off-by: Peng Fan <peng.fan@nxp.com>
Signed-off-by: Shawn Guo <shawnguo@kernel.org>

authored by

Peng Fan and committed by
Shawn Guo
ff3f9913 81fb53fe

+12 -12
+12 -12
drivers/firmware/imx/imx-scu-irq.c
··· 203 203 struct mbox_chan *ch; 204 204 int ret = 0, i = 0; 205 205 206 + if (!of_parse_phandle_with_args(dev->of_node, "mboxes", 207 + "#mbox-cells", 0, &spec)) { 208 + i = of_alias_get_id(spec.np, "mu"); 209 + of_node_put(spec.np); 210 + } 211 + 212 + /* use mu1 as general mu irq channel if failed */ 213 + if (i < 0) 214 + i = 1; 215 + 216 + mu_resource_id = IMX_SC_R_MU_0A + i; 217 + 206 218 ret = imx_scu_get_handle(&imx_sc_irq_ipc_handle); 207 219 if (ret) 208 220 return ret; ··· 235 223 dev_err(dev, "failed to request mbox chan gip3, ret %d\n", ret); 236 224 goto free_cl; 237 225 } 238 - 239 - if (!of_parse_phandle_with_args(dev->of_node, "mboxes", 240 - "#mbox-cells", 0, &spec)) { 241 - i = of_alias_get_id(spec.np, "mu"); 242 - of_node_put(spec.np); 243 - } 244 - 245 - /* use mu1 as general mu irq channel if failed */ 246 - if (i < 0) 247 - i = 1; 248 - 249 - mu_resource_id = IMX_SC_R_MU_0A + i; 250 226 251 227 /* Create directory under /sysfs/firmware */ 252 228 wakeup_obj = kobject_create_and_add("scu_wakeup_source", firmware_kobj);