mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-09-22 22:11:38 +08:00
ARM: 9163/1: amba: Move of_amba_device_decode_irq() into amba_probe()
Similar to other resources the AMBA bus "gets" for the device, move irq obtain from amba_device_add() to amba_probe(). Signed-off-by: Kefeng Wang <wangkefeng.wang@huawei.com> Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
This commit is contained in:
parent
33c6a54964
commit
dcc0a8f6b6
@ -171,6 +171,28 @@ static int amba_uevent(struct device *dev, struct kobj_uevent_env *env)
|
|||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int of_amba_device_decode_irq(struct amba_device *dev)
|
||||||
|
{
|
||||||
|
struct device_node *node = dev->dev.of_node;
|
||||||
|
int i, irq = 0;
|
||||||
|
|
||||||
|
if (IS_ENABLED(CONFIG_OF_IRQ) && node) {
|
||||||
|
/* Decode the IRQs and address ranges */
|
||||||
|
for (i = 0; i < AMBA_NR_IRQS; i++) {
|
||||||
|
irq = of_irq_get(node, i);
|
||||||
|
if (irq < 0) {
|
||||||
|
if (irq == -EPROBE_DEFER)
|
||||||
|
return irq;
|
||||||
|
irq = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
dev->irq[i] = irq;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* These are the device model conversion veneers; they convert the
|
* These are the device model conversion veneers; they convert the
|
||||||
* device model structures to our more specific structures.
|
* device model structures to our more specific structures.
|
||||||
@ -183,6 +205,10 @@ static int amba_probe(struct device *dev)
|
|||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
do {
|
do {
|
||||||
|
ret = of_amba_device_decode_irq(pcdev);
|
||||||
|
if (ret)
|
||||||
|
break;
|
||||||
|
|
||||||
ret = of_clk_set_defaults(dev->of_node, false);
|
ret = of_clk_set_defaults(dev->of_node, false);
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
break;
|
break;
|
||||||
@ -368,38 +394,12 @@ static void amba_device_release(struct device *dev)
|
|||||||
kfree(d);
|
kfree(d);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int of_amba_device_decode_irq(struct amba_device *dev)
|
|
||||||
{
|
|
||||||
struct device_node *node = dev->dev.of_node;
|
|
||||||
int i, irq = 0;
|
|
||||||
|
|
||||||
if (IS_ENABLED(CONFIG_OF_IRQ) && node) {
|
|
||||||
/* Decode the IRQs and address ranges */
|
|
||||||
for (i = 0; i < AMBA_NR_IRQS; i++) {
|
|
||||||
irq = of_irq_get(node, i);
|
|
||||||
if (irq < 0) {
|
|
||||||
if (irq == -EPROBE_DEFER)
|
|
||||||
return irq;
|
|
||||||
irq = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
dev->irq[i] = irq;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
static int amba_device_try_add(struct amba_device *dev, struct resource *parent)
|
static int amba_device_try_add(struct amba_device *dev, struct resource *parent)
|
||||||
{
|
{
|
||||||
u32 size;
|
u32 size;
|
||||||
void __iomem *tmp;
|
void __iomem *tmp;
|
||||||
int i, ret;
|
int i, ret;
|
||||||
|
|
||||||
ret = of_amba_device_decode_irq(dev);
|
|
||||||
if (ret)
|
|
||||||
goto err_out;
|
|
||||||
|
|
||||||
ret = request_resource(parent, &dev->res);
|
ret = request_resource(parent, &dev->res);
|
||||||
if (ret)
|
if (ret)
|
||||||
goto err_out;
|
goto err_out;
|
||||||
|
Loading…
Reference in New Issue
Block a user