diff options
Diffstat (limited to 'drivers/net/sunhme.c')
-rw-r--r-- | drivers/net/sunhme.c | 44 |
1 files changed, 34 insertions, 10 deletions
diff --git a/drivers/net/sunhme.c b/drivers/net/sunhme.c index 7a72a3112f0a..4e9bd380a5c2 100644 --- a/drivers/net/sunhme.c +++ b/drivers/net/sunhme.c | |||
@@ -2543,25 +2543,36 @@ static struct quattro * __devinit quattro_sbus_find(struct of_device *child) | |||
2543 | } | 2543 | } |
2544 | 2544 | ||
2545 | /* After all quattro cards have been probed, we call these functions | 2545 | /* After all quattro cards have been probed, we call these functions |
2546 | * to register the IRQ handlers. | 2546 | * to register the IRQ handlers for the cards that have been |
2547 | * successfully probed and skip the cards that failed to initialize | ||
2547 | */ | 2548 | */ |
2548 | static void __init quattro_sbus_register_irqs(void) | 2549 | static int __init quattro_sbus_register_irqs(void) |
2549 | { | 2550 | { |
2550 | struct quattro *qp; | 2551 | struct quattro *qp; |
2551 | 2552 | ||
2552 | for (qp = qfe_sbus_list; qp != NULL; qp = qp->next) { | 2553 | for (qp = qfe_sbus_list; qp != NULL; qp = qp->next) { |
2553 | struct of_device *op = qp->quattro_dev; | 2554 | struct of_device *op = qp->quattro_dev; |
2554 | int err; | 2555 | int err, qfe_slot, skip = 0; |
2556 | |||
2557 | for (qfe_slot = 0; qfe_slot < 4; qfe_slot++) { | ||
2558 | if (!qp->happy_meals[qfe_slot]) | ||
2559 | skip = 1; | ||
2560 | } | ||
2561 | if (skip) | ||
2562 | continue; | ||
2555 | 2563 | ||
2556 | err = request_irq(op->irqs[0], | 2564 | err = request_irq(op->irqs[0], |
2557 | quattro_sbus_interrupt, | 2565 | quattro_sbus_interrupt, |
2558 | IRQF_SHARED, "Quattro", | 2566 | IRQF_SHARED, "Quattro", |
2559 | qp); | 2567 | qp); |
2560 | if (err != 0) { | 2568 | if (err != 0) { |
2561 | printk(KERN_ERR "Quattro: Fatal IRQ registery error %d.\n", err); | 2569 | printk(KERN_ERR "Quattro HME: IRQ registration " |
2562 | panic("QFE request irq"); | 2570 | "error %d.\n", err); |
2571 | return err; | ||
2563 | } | 2572 | } |
2564 | } | 2573 | } |
2574 | |||
2575 | return 0; | ||
2565 | } | 2576 | } |
2566 | 2577 | ||
2567 | static void quattro_sbus_free_irqs(void) | 2578 | static void quattro_sbus_free_irqs(void) |
@@ -2570,6 +2581,14 @@ static void quattro_sbus_free_irqs(void) | |||
2570 | 2581 | ||
2571 | for (qp = qfe_sbus_list; qp != NULL; qp = qp->next) { | 2582 | for (qp = qfe_sbus_list; qp != NULL; qp = qp->next) { |
2572 | struct of_device *op = qp->quattro_dev; | 2583 | struct of_device *op = qp->quattro_dev; |
2584 | int qfe_slot, skip = 0; | ||
2585 | |||
2586 | for (qfe_slot = 0; qfe_slot < 4; qfe_slot++) { | ||
2587 | if (!qp->happy_meals[qfe_slot]) | ||
2588 | skip = 1; | ||
2589 | } | ||
2590 | if (skip) | ||
2591 | continue; | ||
2573 | 2592 | ||
2574 | free_irq(op->irqs[0], qp); | 2593 | free_irq(op->irqs[0], qp); |
2575 | } | 2594 | } |
@@ -2629,6 +2648,12 @@ static int __devinit happy_meal_sbus_probe_one(struct of_device *op, int is_qfe) | |||
2629 | int i, qfe_slot = -1; | 2648 | int i, qfe_slot = -1; |
2630 | int err = -ENODEV; | 2649 | int err = -ENODEV; |
2631 | 2650 | ||
2651 | sbus_dp = to_of_device(op->dev.parent)->node; | ||
2652 | |||
2653 | /* We can match PCI devices too, do not accept those here. */ | ||
2654 | if (strcmp(sbus_dp->name, "sbus")) | ||
2655 | return err; | ||
2656 | |||
2632 | if (is_qfe) { | 2657 | if (is_qfe) { |
2633 | qp = quattro_sbus_find(op); | 2658 | qp = quattro_sbus_find(op); |
2634 | if (qp == NULL) | 2659 | if (qp == NULL) |
@@ -2734,10 +2759,6 @@ static int __devinit happy_meal_sbus_probe_one(struct of_device *op, int is_qfe) | |||
2734 | if (qp != NULL) | 2759 | if (qp != NULL) |
2735 | hp->happy_flags |= HFLAG_QUATTRO; | 2760 | hp->happy_flags |= HFLAG_QUATTRO; |
2736 | 2761 | ||
2737 | sbus_dp = to_of_device(op->dev.parent)->node; | ||
2738 | if (is_qfe) | ||
2739 | sbus_dp = to_of_device(op->dev.parent->parent)->node; | ||
2740 | |||
2741 | /* Get the supported DVMA burst sizes from our Happy SBUS. */ | 2762 | /* Get the supported DVMA burst sizes from our Happy SBUS. */ |
2742 | hp->happy_bursts = of_getintprop_default(sbus_dp, | 2763 | hp->happy_bursts = of_getintprop_default(sbus_dp, |
2743 | "burst-sizes", 0x00); | 2764 | "burst-sizes", 0x00); |
@@ -2824,6 +2845,9 @@ err_out_iounmap: | |||
2824 | if (hp->tcvregs) | 2845 | if (hp->tcvregs) |
2825 | of_iounmap(&op->resource[4], hp->tcvregs, TCVR_REG_SIZE); | 2846 | of_iounmap(&op->resource[4], hp->tcvregs, TCVR_REG_SIZE); |
2826 | 2847 | ||
2848 | if (qp) | ||
2849 | qp->happy_meals[qfe_slot] = NULL; | ||
2850 | |||
2827 | err_out_free_netdev: | 2851 | err_out_free_netdev: |
2828 | free_netdev(dev); | 2852 | free_netdev(dev); |
2829 | 2853 | ||
@@ -3281,7 +3305,7 @@ static int __init happy_meal_sbus_init(void) | |||
3281 | 3305 | ||
3282 | err = of_register_driver(&hme_sbus_driver, &of_bus_type); | 3306 | err = of_register_driver(&hme_sbus_driver, &of_bus_type); |
3283 | if (!err) | 3307 | if (!err) |
3284 | quattro_sbus_register_irqs(); | 3308 | err = quattro_sbus_register_irqs(); |
3285 | 3309 | ||
3286 | return err; | 3310 | return err; |
3287 | } | 3311 | } |