On Thu, Aug 24, 2006 at 03:46:21AM +0200, danny@xxxxxxxxxxx wrote: > Ok. I made an updated version. I leave it to you to decide to remove the proc entries or to push > something like this upstream for the time being. On my laptop this patch seems to resolve the problems. > <snip> Please ignore that version. It was severly broken (oops) the moment the name of video bus was not 3 but 4 bytes long (the string would not be nulterminated by strcpy, leading to overflows if we use strcat afterthat). Thanks to Arnaud Patard for pointing this out to me, and also for the fix: just initialize all elements to 0. Updated version follows. Acpi bus ids are not necessarily unique. For example, the VID entry can appear on both the PCI and on the AGP bus. The proc entries for the acpi video devices were not aware of this. Therefore, a double VID entry could occur in /proc/acpi/video/. This also lead to a warning on remove_proc_entry because the wrong directory was removed first. This patch renames the VID entries to include their parent bus (ie VID_PCI0 and VID_AGP). Signed-off-by: Danny Tholen <obiwan@xxxxxxxxxxx> --- linux-2.6.17.1/drivers/acpi/video.c.orig 2006-09-06 08:27:13.000000000 +0200 +++ linux-2.6.17.1/drivers/acpi/video.c 2006-09-06 09:17:14.000000000 +0200 @@ -1183,13 +1183,19 @@ { struct proc_dir_entry *entry = NULL; struct acpi_video_bus *video; + char proc_dir_name[ACPI_NAME_SIZE*2+2]; ACPI_FUNCTION_TRACE("acpi_video_bus_add_fs"); video = (struct acpi_video_bus *)acpi_driver_data(device); if (!acpi_device_dir(device)) { - acpi_device_dir(device) = proc_mkdir(acpi_device_bid(device), + memset(proc_dir_name, 0x00, ACPI_NAME_SIZE*2+2); + strncpy(proc_dir_name, acpi_device_bid(device), ACPI_NAME_SIZE); + strcat(proc_dir_name, "_"); + strncat(proc_dir_name, acpi_device_bid(device->parent), ACPI_NAME_SIZE); + + acpi_device_dir(device) = proc_mkdir(proc_dir_name, acpi_video_dir); if (!acpi_device_dir(device)) return_VALUE(-ENODEV); @@ -1265,6 +1271,7 @@ static int acpi_video_bus_remove_fs(struct acpi_device *device) { struct acpi_video_bus *video; + char proc_dir_name[ACPI_NAME_SIZE*2+2]; ACPI_FUNCTION_TRACE("acpi_video_bus_remove_fs"); @@ -1276,7 +1283,12 @@ remove_proc_entry("POST_info", acpi_device_dir(device)); remove_proc_entry("POST", acpi_device_dir(device)); remove_proc_entry("DOS", acpi_device_dir(device)); - remove_proc_entry(acpi_device_bid(device), acpi_video_dir); + + memset(proc_dir_name, 0x00, ACPI_NAME_SIZE*2+2); + strncpy(proc_dir_name, acpi_device_bid(device), ACPI_NAME_SIZE); + strcat(proc_dir_name, "_"); + strncat(proc_dir_name, acpi_device_bid(device->parent), ACPI_NAME_SIZE); + remove_proc_entry(proc_dir_name, acpi_video_dir); acpi_device_dir(device) = NULL; } @@ -1796,8 +1808,9 @@ goto end; } - printk(KERN_INFO PREFIX "%s [%s] (multi-head: %s rom: %s post: %s)\n", + printk(KERN_INFO PREFIX "%s [%s_%s] (multi-head: %s rom: %s post: %s)\n", ACPI_VIDEO_DEVICE_NAME, acpi_device_bid(device), + acpi_device_bid(device->parent), video->flags.multihead ? "yes" : "no", video->flags.rom ? "yes" : "no", video->flags.post ? "yes" : "no"); - To unsubscribe from this list: send the line "unsubscribe linux-acpi" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html