forked from mirrors/linux
		
	ACPI: use more understandable bus_id for ACPI devices
Some of the ACPI devices use the internal fake hids which are exposed to userspace as devces' bus_id after sysfs conversion. To make it more friendly, we convert them to more understandable strings. For those devices w/o PNPids, we use "device:instance_no" as the bus_id instead of "PNPIDNON:instance_no". Signed-off-by: Zhang Rui <rui.zhang@intel.com> Signed-off-by: Len Brown <len.brown@intel.com>
This commit is contained in:
		
							parent
							
								
									2786f6e388
								
							
						
					
					
						commit
						bb0958544f
					
				
					 3 changed files with 12 additions and 12 deletions
				
			
		| 
						 | 
					@ -26,7 +26,7 @@ DEFINE_SPINLOCK(acpi_device_lock);
 | 
				
			||||||
LIST_HEAD(acpi_wakeup_device_list);
 | 
					LIST_HEAD(acpi_wakeup_device_list);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
struct acpi_device_bus_id{
 | 
					struct acpi_device_bus_id{
 | 
				
			||||||
	char bus_id[9];
 | 
						char bus_id[15];
 | 
				
			||||||
	unsigned int instance_no;
 | 
						unsigned int instance_no;
 | 
				
			||||||
	struct list_head node;
 | 
						struct list_head node;
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
| 
						 | 
					@ -342,7 +342,7 @@ static int acpi_device_register(struct acpi_device *device,
 | 
				
			||||||
	 * If failed, create one and link it into acpi_bus_id_list
 | 
						 * If failed, create one and link it into acpi_bus_id_list
 | 
				
			||||||
	 */
 | 
						 */
 | 
				
			||||||
	list_for_each_entry(acpi_device_bus_id, &acpi_bus_id_list, node) {
 | 
						list_for_each_entry(acpi_device_bus_id, &acpi_bus_id_list, node) {
 | 
				
			||||||
		if(!strcmp(acpi_device_bus_id->bus_id, device->flags.hardware_id? device->pnp.hardware_id : "PNPIDNON")) {
 | 
							if(!strcmp(acpi_device_bus_id->bus_id, device->flags.hardware_id? device->pnp.hardware_id : "device")) {
 | 
				
			||||||
			acpi_device_bus_id->instance_no ++;
 | 
								acpi_device_bus_id->instance_no ++;
 | 
				
			||||||
			found = 1;
 | 
								found = 1;
 | 
				
			||||||
			kfree(new_bus_id);
 | 
								kfree(new_bus_id);
 | 
				
			||||||
| 
						 | 
					@ -351,7 +351,7 @@ static int acpi_device_register(struct acpi_device *device,
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	if(!found) {
 | 
						if(!found) {
 | 
				
			||||||
		acpi_device_bus_id = new_bus_id;
 | 
							acpi_device_bus_id = new_bus_id;
 | 
				
			||||||
		strcpy(acpi_device_bus_id->bus_id, device->flags.hardware_id ? device->pnp.hardware_id : "PNPIDNON");
 | 
							strcpy(acpi_device_bus_id->bus_id, device->flags.hardware_id ? device->pnp.hardware_id : "device");
 | 
				
			||||||
		acpi_device_bus_id->instance_no = 0;
 | 
							acpi_device_bus_id->instance_no = 0;
 | 
				
			||||||
		list_add_tail(&acpi_device_bus_id->node, &acpi_bus_id_list);
 | 
							list_add_tail(&acpi_device_bus_id->node, &acpi_bus_id_list);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -184,7 +184,7 @@ struct acpi_device_dir {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
typedef char acpi_bus_id[5];
 | 
					typedef char acpi_bus_id[5];
 | 
				
			||||||
typedef unsigned long acpi_bus_address;
 | 
					typedef unsigned long acpi_bus_address;
 | 
				
			||||||
typedef char acpi_hardware_id[9];
 | 
					typedef char acpi_hardware_id[15];
 | 
				
			||||||
typedef char acpi_unique_id[9];
 | 
					typedef char acpi_unique_id[9];
 | 
				
			||||||
typedef char acpi_device_name[40];
 | 
					typedef char acpi_device_name[40];
 | 
				
			||||||
typedef char acpi_device_class[20];
 | 
					typedef char acpi_device_class[20];
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -36,14 +36,14 @@
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/* _HID definitions */
 | 
					/* _HID definitions */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#define ACPI_POWER_HID			"ACPI_PWR"
 | 
					#define ACPI_POWER_HID			"power_resource"
 | 
				
			||||||
#define ACPI_PROCESSOR_HID		"ACPI_CPU"
 | 
					#define ACPI_PROCESSOR_HID		"processor"
 | 
				
			||||||
#define ACPI_SYSTEM_HID			"ACPI_SYS"
 | 
					#define ACPI_SYSTEM_HID			"acpi_system"
 | 
				
			||||||
#define ACPI_THERMAL_HID		"ACPI_THM"
 | 
					#define ACPI_THERMAL_HID		"thermal"
 | 
				
			||||||
#define ACPI_BUTTON_HID_POWERF		"ACPI_FPB"
 | 
					#define ACPI_BUTTON_HID_POWERF		"button_power"
 | 
				
			||||||
#define ACPI_BUTTON_HID_SLEEPF		"ACPI_FSB"
 | 
					#define ACPI_BUTTON_HID_SLEEPF		"button_sleep"
 | 
				
			||||||
 | 
					#define ACPI_VIDEO_HID			"video"
 | 
				
			||||||
#define ACPI_VIDEO_HID			"ACPI_VID"
 | 
					#define ACPI_BAY_HID			"bay"
 | 
				
			||||||
/* --------------------------------------------------------------------------
 | 
					/* --------------------------------------------------------------------------
 | 
				
			||||||
                                       PCI
 | 
					                                       PCI
 | 
				
			||||||
   -------------------------------------------------------------------------- */
 | 
					   -------------------------------------------------------------------------- */
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in a new issue