diff options
Diffstat (limited to 'drivers/acpi/video.c')
-rw-r--r-- | drivers/acpi/video.c | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/drivers/acpi/video.c b/drivers/acpi/video.c index 72e76b4b6538..b765790b32be 100644 --- a/drivers/acpi/video.c +++ b/drivers/acpi/video.c | |||
@@ -78,6 +78,13 @@ MODULE_LICENSE("GPL"); | |||
78 | static int brightness_switch_enabled = 1; | 78 | static int brightness_switch_enabled = 1; |
79 | module_param(brightness_switch_enabled, bool, 0644); | 79 | module_param(brightness_switch_enabled, bool, 0644); |
80 | 80 | ||
81 | /* | ||
82 | * By default, we don't allow duplicate ACPI video bus devices | ||
83 | * under the same VGA controller | ||
84 | */ | ||
85 | static int allow_duplicates; | ||
86 | module_param(allow_duplicates, bool, 0644); | ||
87 | |||
81 | static int register_count = 0; | 88 | static int register_count = 0; |
82 | static int acpi_video_bus_add(struct acpi_device *device); | 89 | static int acpi_video_bus_add(struct acpi_device *device); |
83 | static int acpi_video_bus_remove(struct acpi_device *device, int type); | 90 | static int acpi_video_bus_remove(struct acpi_device *device, int type); |
@@ -2239,11 +2246,47 @@ static int acpi_video_resume(struct acpi_device *device) | |||
2239 | return AE_OK; | 2246 | return AE_OK; |
2240 | } | 2247 | } |
2241 | 2248 | ||
2249 | static acpi_status | ||
2250 | acpi_video_bus_match(acpi_handle handle, u32 level, void *context, | ||
2251 | void **return_value) | ||
2252 | { | ||
2253 | struct acpi_device *device = context; | ||
2254 | struct acpi_device *sibling; | ||
2255 | int result; | ||
2256 | |||
2257 | if (handle == device->handle) | ||
2258 | return AE_CTRL_TERMINATE; | ||
2259 | |||
2260 | result = acpi_bus_get_device(handle, &sibling); | ||
2261 | if (result) | ||
2262 | return AE_OK; | ||
2263 | |||
2264 | if (!strcmp(acpi_device_name(sibling), ACPI_VIDEO_BUS_NAME)) | ||
2265 | return AE_ALREADY_EXISTS; | ||
2266 | |||
2267 | return AE_OK; | ||
2268 | } | ||
2269 | |||
2242 | static int acpi_video_bus_add(struct acpi_device *device) | 2270 | static int acpi_video_bus_add(struct acpi_device *device) |
2243 | { | 2271 | { |
2244 | struct acpi_video_bus *video; | 2272 | struct acpi_video_bus *video; |
2245 | struct input_dev *input; | 2273 | struct input_dev *input; |
2246 | int error; | 2274 | int error; |
2275 | acpi_status status; | ||
2276 | |||
2277 | status = acpi_walk_namespace(ACPI_TYPE_DEVICE, | ||
2278 | device->parent->handle, 1, | ||
2279 | acpi_video_bus_match, NULL, | ||
2280 | device, NULL); | ||
2281 | if (status == AE_ALREADY_EXISTS) { | ||
2282 | printk(KERN_WARNING FW_BUG | ||
2283 | "Duplicate ACPI video bus devices for the" | ||
2284 | " same VGA controller, please try module " | ||
2285 | "parameter \"video.allow_duplicates=1\"" | ||
2286 | "if the current driver doesn't work.\n"); | ||
2287 | if (!allow_duplicates) | ||
2288 | return -ENODEV; | ||
2289 | } | ||
2247 | 2290 | ||
2248 | video = kzalloc(sizeof(struct acpi_video_bus), GFP_KERNEL); | 2291 | video = kzalloc(sizeof(struct acpi_video_bus), GFP_KERNEL); |
2249 | if (!video) | 2292 | if (!video) |