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

soc: ti: smartreflex: Use platform_get_irq_optional() to get the interrupt

platform_get_resource(pdev, IORESOURCE_IRQ, ..) relies on static
allocation of IRQ resources in DT core code, this causes an issue
when using hierarchical interrupt domains using "interrupts" property
in the node as this bypasses the hierarchical setup and messes up the
irq chaining.

In preparation for removal of static setup of IRQ resource from DT core
code use platform_get_irq_optional().

While at it return 0 instead of returning ret in the probe success path.

Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
Signed-off-by: Nishanth Menon <nm@ti.com>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Link: https://lore.kernel.org/r/20220105180323.8563-1-prabhakar.mahadev-lad.rj@bp.renesas.com

authored by

Lad Prabhakar and committed by
Nishanth Menon
001d7c83 a8eba8dd

+7 -6
+7 -6
drivers/soc/ti/smartreflex.c
··· 819 819 { 820 820 struct omap_sr *sr_info; 821 821 struct omap_sr_data *pdata = pdev->dev.platform_data; 822 - struct resource *mem, *irq; 822 + struct resource *mem; 823 823 struct dentry *nvalue_dir; 824 824 int i, ret = 0; 825 825 ··· 844 844 if (IS_ERR(sr_info->base)) 845 845 return PTR_ERR(sr_info->base); 846 846 847 - irq = platform_get_resource(pdev, IORESOURCE_IRQ, 0); 847 + ret = platform_get_irq_optional(pdev, 0); 848 + if (ret < 0 && ret != -ENXIO) 849 + return dev_err_probe(&pdev->dev, ret, "failed to get IRQ resource\n"); 850 + if (ret > 0) 851 + sr_info->irq = ret; 848 852 849 853 sr_info->fck = devm_clk_get(pdev->dev.parent, "fck"); 850 854 if (IS_ERR(sr_info->fck)) ··· 873 869 sr_info->senp_avgweight = pdata->senp_avgweight; 874 870 sr_info->autocomp_active = false; 875 871 sr_info->ip_type = pdata->ip_type; 876 - 877 - if (irq) 878 - sr_info->irq = irq->start; 879 872 880 873 sr_set_clk_length(sr_info); 881 874 ··· 927 926 928 927 } 929 928 930 - return ret; 929 + return 0; 931 930 932 931 err_debugfs: 933 932 debugfs_remove_recursive(sr_info->dbg_dir);