diff options
Diffstat (limited to 'drivers/ide/ide.c')
-rw-r--r-- | drivers/ide/ide.c | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/drivers/ide/ide.c b/drivers/ide/ide.c index cb18ba8de22d..d791b1ffb586 100644 --- a/drivers/ide/ide.c +++ b/drivers/ide/ide.c | |||
@@ -78,6 +78,8 @@ | |||
78 | /* default maximum number of failures */ | 78 | /* default maximum number of failures */ |
79 | #define IDE_DEFAULT_MAX_FAILURES 1 | 79 | #define IDE_DEFAULT_MAX_FAILURES 1 |
80 | 80 | ||
81 | struct class *ide_port_class; | ||
82 | |||
81 | static const u8 ide_hwif_to_major[] = { IDE0_MAJOR, IDE1_MAJOR, | 83 | static const u8 ide_hwif_to_major[] = { IDE0_MAJOR, IDE1_MAJOR, |
82 | IDE2_MAJOR, IDE3_MAJOR, | 84 | IDE2_MAJOR, IDE3_MAJOR, |
83 | IDE4_MAJOR, IDE5_MAJOR, | 85 | IDE4_MAJOR, IDE5_MAJOR, |
@@ -591,6 +593,7 @@ void ide_unregister(unsigned int index, int init_default, int restore) | |||
591 | 593 | ||
592 | ide_remove_port_from_hwgroup(hwif); | 594 | ide_remove_port_from_hwgroup(hwif); |
593 | 595 | ||
596 | device_unregister(hwif->portdev); | ||
594 | device_unregister(&hwif->gendev); | 597 | device_unregister(&hwif->gendev); |
595 | wait_for_completion(&hwif->gendev_rel_comp); | 598 | wait_for_completion(&hwif->gendev_rel_comp); |
596 | 599 | ||
@@ -1590,6 +1593,13 @@ struct bus_type ide_bus_type = { | |||
1590 | 1593 | ||
1591 | EXPORT_SYMBOL_GPL(ide_bus_type); | 1594 | EXPORT_SYMBOL_GPL(ide_bus_type); |
1592 | 1595 | ||
1596 | static void ide_port_class_release(struct device *portdev) | ||
1597 | { | ||
1598 | ide_hwif_t *hwif = dev_get_drvdata(portdev); | ||
1599 | |||
1600 | put_device(&hwif->gendev); | ||
1601 | } | ||
1602 | |||
1593 | /* | 1603 | /* |
1594 | * This is gets invoked once during initialization, to set *everything* up | 1604 | * This is gets invoked once during initialization, to set *everything* up |
1595 | */ | 1605 | */ |
@@ -1610,11 +1620,23 @@ static int __init ide_init(void) | |||
1610 | return ret; | 1620 | return ret; |
1611 | } | 1621 | } |
1612 | 1622 | ||
1623 | ide_port_class = class_create(THIS_MODULE, "ide_port"); | ||
1624 | if (IS_ERR(ide_port_class)) { | ||
1625 | ret = PTR_ERR(ide_port_class); | ||
1626 | goto out_port_class; | ||
1627 | } | ||
1628 | ide_port_class->dev_release = ide_port_class_release; | ||
1629 | |||
1613 | init_ide_data(); | 1630 | init_ide_data(); |
1614 | 1631 | ||
1615 | proc_ide_create(); | 1632 | proc_ide_create(); |
1616 | 1633 | ||
1617 | return 0; | 1634 | return 0; |
1635 | |||
1636 | out_port_class: | ||
1637 | bus_unregister(&ide_bus_type); | ||
1638 | |||
1639 | return ret; | ||
1618 | } | 1640 | } |
1619 | 1641 | ||
1620 | #ifdef MODULE | 1642 | #ifdef MODULE |
@@ -1651,6 +1673,8 @@ void __exit cleanup_module (void) | |||
1651 | 1673 | ||
1652 | proc_ide_destroy(); | 1674 | proc_ide_destroy(); |
1653 | 1675 | ||
1676 | class_destroy(ide_port_class); | ||
1677 | |||
1654 | bus_unregister(&ide_bus_type); | 1678 | bus_unregister(&ide_bus_type); |
1655 | } | 1679 | } |
1656 | 1680 | ||