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

mfd: mt6397: IRQ domain should initialize before mfd_add_devices()

Some sub driver like RTC module need irq domain from parent to create
irq mapping when driver initialize. so move mt6397_irq_init() before
mfd_add_devices().

Acked-by: John Crispin <blogic@openwrt.org>
Signed-off-by: Henry Chen <henryc.chen@mediatek.com>
Signed-off-by: Lee Jones <lee.jones@linaro.org>

authored by

Henry Chen and committed by
Lee Jones
1387ff53 ba5776ab

+13 -9
+13 -9
drivers/mfd/mt6397-core.c
··· 267 267 ret = regmap_read(pmic->regmap, MT6397_CID, &id); 268 268 if (ret) { 269 269 dev_err(pmic->dev, "Failed to read chip id: %d\n", ret); 270 - goto fail_irq; 270 + return ret; 271 271 } 272 + 273 + pmic->irq = platform_get_irq(pdev, 0); 274 + if (pmic->irq <= 0) 275 + return pmic->irq; 272 276 273 277 switch (id & 0xff) { 274 278 case MT6323_CID_CODE: ··· 280 276 pmic->int_con[1] = MT6323_INT_CON1; 281 277 pmic->int_status[0] = MT6323_INT_STATUS0; 282 278 pmic->int_status[1] = MT6323_INT_STATUS1; 279 + ret = mt6397_irq_init(pmic); 280 + if (ret) 281 + return ret; 282 + 283 283 ret = devm_mfd_add_devices(&pdev->dev, -1, mt6323_devs, 284 284 ARRAY_SIZE(mt6323_devs), NULL, 285 285 0, NULL); ··· 295 287 pmic->int_con[1] = MT6397_INT_CON1; 296 288 pmic->int_status[0] = MT6397_INT_STATUS0; 297 289 pmic->int_status[1] = MT6397_INT_STATUS1; 290 + ret = mt6397_irq_init(pmic); 291 + if (ret) 292 + return ret; 293 + 298 294 ret = devm_mfd_add_devices(&pdev->dev, -1, mt6397_devs, 299 295 ARRAY_SIZE(mt6397_devs), NULL, 300 296 0, NULL); ··· 310 298 break; 311 299 } 312 300 313 - pmic->irq = platform_get_irq(pdev, 0); 314 - if (pmic->irq > 0) { 315 - ret = mt6397_irq_init(pmic); 316 - if (ret) 317 - return ret; 318 - } 319 - 320 - fail_irq: 321 301 if (ret) { 322 302 irq_domain_remove(pmic->irq_domain); 323 303 dev_err(&pdev->dev, "failed to add child devices: %d\n", ret);