diff options
-rw-r--r-- | arch/ia64/hp/common/sba_iommu.c | 24 | ||||
-rw-r--r-- | drivers/acpi/scan.c | 84 | ||||
-rw-r--r-- | drivers/acpi/video.c | 3 |
3 files changed, 46 insertions, 65 deletions
diff --git a/arch/ia64/hp/common/sba_iommu.c b/arch/ia64/hp/common/sba_iommu.c index bcda5b2d121a..d43daf192b21 100644 --- a/arch/ia64/hp/common/sba_iommu.c +++ b/arch/ia64/hp/common/sba_iommu.c | |||
@@ -2042,7 +2042,8 @@ sba_map_ioc_to_node(struct ioc *ioc, acpi_handle handle) | |||
2042 | #endif | 2042 | #endif |
2043 | 2043 | ||
2044 | static int __init | 2044 | static int __init |
2045 | acpi_sba_ioc_add(struct acpi_device *device) | 2045 | acpi_sba_ioc_add(struct acpi_device *device, |
2046 | const struct acpi_device_id *not_used) | ||
2046 | { | 2047 | { |
2047 | struct ioc *ioc; | 2048 | struct ioc *ioc; |
2048 | acpi_status status; | 2049 | acpi_status status; |
@@ -2090,14 +2091,18 @@ static const struct acpi_device_id hp_ioc_iommu_device_ids[] = { | |||
2090 | {"HWP0004", 0}, | 2091 | {"HWP0004", 0}, |
2091 | {"", 0}, | 2092 | {"", 0}, |
2092 | }; | 2093 | }; |
2093 | static struct acpi_driver acpi_sba_ioc_driver = { | 2094 | static struct acpi_scan_handler acpi_sba_ioc_handler = { |
2094 | .name = "IOC IOMMU Driver", | 2095 | .ids = hp_ioc_iommu_device_ids, |
2095 | .ids = hp_ioc_iommu_device_ids, | 2096 | .attach = acpi_sba_ioc_add, |
2096 | .ops = { | ||
2097 | .add = acpi_sba_ioc_add, | ||
2098 | }, | ||
2099 | }; | 2097 | }; |
2100 | 2098 | ||
2099 | static int __init acpi_sba_ioc_init_acpi(void) | ||
2100 | { | ||
2101 | return acpi_scan_add_handler(&acpi_sba_ioc_handler); | ||
2102 | } | ||
2103 | /* This has to run before acpi_scan_init(). */ | ||
2104 | arch_initcall(acpi_sba_ioc_init_acpi); | ||
2105 | |||
2101 | extern struct dma_map_ops swiotlb_dma_ops; | 2106 | extern struct dma_map_ops swiotlb_dma_ops; |
2102 | 2107 | ||
2103 | static int __init | 2108 | static int __init |
@@ -2122,7 +2127,10 @@ sba_init(void) | |||
2122 | } | 2127 | } |
2123 | #endif | 2128 | #endif |
2124 | 2129 | ||
2125 | acpi_bus_register_driver(&acpi_sba_ioc_driver); | 2130 | /* |
2131 | * ioc_list should be populated by the acpi_sba_ioc_handler's .attach() | ||
2132 | * routine, but that only happens if acpi_scan_init() has already run. | ||
2133 | */ | ||
2126 | if (!ioc_list) { | 2134 | if (!ioc_list) { |
2127 | #ifdef CONFIG_IA64_GENERIC | 2135 | #ifdef CONFIG_IA64_GENERIC |
2128 | /* | 2136 | /* |
diff --git a/drivers/acpi/scan.c b/drivers/acpi/scan.c index db118b1ad3e8..e0db2dc42370 100644 --- a/drivers/acpi/scan.c +++ b/drivers/acpi/scan.c | |||
@@ -933,32 +933,43 @@ static void acpi_device_remove_notify_handler(struct acpi_device *device) | |||
933 | acpi_device_notify); | 933 | acpi_device_notify); |
934 | } | 934 | } |
935 | 935 | ||
936 | static int acpi_bus_driver_init(struct acpi_device *, struct acpi_driver *); | 936 | static int acpi_device_probe(struct device *dev) |
937 | static int acpi_device_probe(struct device * dev) | ||
938 | { | 937 | { |
939 | struct acpi_device *acpi_dev = to_acpi_device(dev); | 938 | struct acpi_device *acpi_dev = to_acpi_device(dev); |
940 | struct acpi_driver *acpi_drv = to_acpi_driver(dev->driver); | 939 | struct acpi_driver *acpi_drv = to_acpi_driver(dev->driver); |
941 | int ret; | 940 | int ret; |
942 | 941 | ||
943 | ret = acpi_bus_driver_init(acpi_dev, acpi_drv); | 942 | if (acpi_dev->handler) |
944 | if (!ret) { | 943 | return -EINVAL; |
945 | if (acpi_drv->ops.notify) { | ||
946 | ret = acpi_device_install_notify_handler(acpi_dev); | ||
947 | if (ret) { | ||
948 | if (acpi_drv->ops.remove) | ||
949 | acpi_drv->ops.remove(acpi_dev); | ||
950 | acpi_dev->driver = NULL; | ||
951 | acpi_dev->driver_data = NULL; | ||
952 | return ret; | ||
953 | } | ||
954 | } | ||
955 | 944 | ||
956 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, | 945 | if (!acpi_drv->ops.add) |
957 | "Found driver [%s] for device [%s]\n", | 946 | return -ENOSYS; |
958 | acpi_drv->name, acpi_dev->pnp.bus_id)); | 947 | |
959 | get_device(dev); | 948 | ret = acpi_drv->ops.add(acpi_dev); |
949 | if (ret) | ||
950 | return ret; | ||
951 | |||
952 | acpi_dev->driver = acpi_drv; | ||
953 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, | ||
954 | "Driver [%s] successfully bound to device [%s]\n", | ||
955 | acpi_drv->name, acpi_dev->pnp.bus_id)); | ||
956 | |||
957 | if (acpi_drv->ops.notify) { | ||
958 | ret = acpi_device_install_notify_handler(acpi_dev); | ||
959 | if (ret) { | ||
960 | if (acpi_drv->ops.remove) | ||
961 | acpi_drv->ops.remove(acpi_dev); | ||
962 | |||
963 | acpi_dev->driver = NULL; | ||
964 | acpi_dev->driver_data = NULL; | ||
965 | return ret; | ||
966 | } | ||
960 | } | 967 | } |
961 | return ret; | 968 | |
969 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Found driver [%s] for device [%s]\n", | ||
970 | acpi_drv->name, acpi_dev->pnp.bus_id)); | ||
971 | get_device(dev); | ||
972 | return 0; | ||
962 | } | 973 | } |
963 | 974 | ||
964 | static int acpi_device_remove(struct device * dev) | 975 | static int acpi_device_remove(struct device * dev) |
@@ -1114,41 +1125,6 @@ static void acpi_device_unregister(struct acpi_device *device) | |||
1114 | Driver Management | 1125 | Driver Management |
1115 | -------------------------------------------------------------------------- */ | 1126 | -------------------------------------------------------------------------- */ |
1116 | /** | 1127 | /** |
1117 | * acpi_bus_driver_init - add a device to a driver | ||
1118 | * @device: the device to add and initialize | ||
1119 | * @driver: driver for the device | ||
1120 | * | ||
1121 | * Used to initialize a device via its device driver. Called whenever a | ||
1122 | * driver is bound to a device. Invokes the driver's add() ops. | ||
1123 | */ | ||
1124 | static int | ||
1125 | acpi_bus_driver_init(struct acpi_device *device, struct acpi_driver *driver) | ||
1126 | { | ||
1127 | int result = 0; | ||
1128 | |||
1129 | if (!device || !driver) | ||
1130 | return -EINVAL; | ||
1131 | |||
1132 | if (!driver->ops.add) | ||
1133 | return -ENOSYS; | ||
1134 | |||
1135 | result = driver->ops.add(device); | ||
1136 | if (result) | ||
1137 | return result; | ||
1138 | |||
1139 | device->driver = driver; | ||
1140 | |||
1141 | /* | ||
1142 | * TBD - Configuration Management: Assign resources to device based | ||
1143 | * upon possible configuration and currently allocated resources. | ||
1144 | */ | ||
1145 | |||
1146 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, | ||
1147 | "Driver successfully bound to device\n")); | ||
1148 | return 0; | ||
1149 | } | ||
1150 | |||
1151 | /** | ||
1152 | * acpi_bus_register_driver - register a driver with the ACPI bus | 1128 | * acpi_bus_register_driver - register a driver with the ACPI bus |
1153 | * @driver: driver being registered | 1129 | * @driver: driver being registered |
1154 | * | 1130 | * |
diff --git a/drivers/acpi/video.c b/drivers/acpi/video.c index 440eadf2d32c..5d7075d25700 100644 --- a/drivers/acpi/video.c +++ b/drivers/acpi/video.c | |||
@@ -1722,9 +1722,6 @@ static int acpi_video_bus_add(struct acpi_device *device) | |||
1722 | int error; | 1722 | int error; |
1723 | acpi_status status; | 1723 | acpi_status status; |
1724 | 1724 | ||
1725 | if (device->handler) | ||
1726 | return -EINVAL; | ||
1727 | |||
1728 | status = acpi_walk_namespace(ACPI_TYPE_DEVICE, | 1725 | status = acpi_walk_namespace(ACPI_TYPE_DEVICE, |
1729 | device->parent->handle, 1, | 1726 | device->parent->handle, 1, |
1730 | acpi_video_bus_match, NULL, | 1727 | acpi_video_bus_match, NULL, |