Subject: [PATCH] [acpi video] Unify handling of ACPI video device IDs - The ACPI spec seems to indicate that the device address values returned by _ADR must be identical to the values stored in the array of attached devices in the ACPI video bus (_DOD). So, move union video_id out of struct acpi_video_enum so that the ACPI device code can use it, too. - Fix up the references to device IDs and type IDs to use the new locations. Signed-off-by: Patrick Mochel --- drivers/acpi/drivers/video/bus-device.c | 2 + drivers/acpi/drivers/video/bus-lib.c | 2 + drivers/acpi/drivers/video/dev-device.c | 16 +++++---- drivers/acpi/drivers/video/video.h | 54 ++++++++++++++++--------------- 4 files changed, 37 insertions(+), 37 deletions(-) applies-to: 8c8a1ef335e6712a71c04faa1670fbc320a94e18 eb375fe0bce82e3b2e98b7b82b2ba63437f9dd7d diff --git a/drivers/acpi/drivers/video/bus-device.c b/drivers/acpi/drivers/video/bus-device.c index c9dbd7b..10936b9 100644 --- a/drivers/acpi/drivers/video/bus-device.c +++ b/drivers/acpi/drivers/video/bus-device.c @@ -345,7 +345,7 @@ static int enumerate_bus(struct acpi_vid dbg("Found %d video heads in _DOD", vb->v_dev_num); for (i = 0; i < vb->v_dev_num; i++) - vb->v_dev[i].v_attrib = dod_values[i]; + vb->v_dev[i].v_id.v_attrib = dod_values[i]; return 0; } diff --git a/drivers/acpi/drivers/video/bus-lib.c b/drivers/acpi/drivers/video/bus-lib.c index 3e413e5..4793e06 100644 --- a/drivers/acpi/drivers/video/bus-lib.c +++ b/drivers/acpi/drivers/video/bus-lib.c @@ -32,7 +32,7 @@ int video_bus_attach(struct acpi_video_d for (i = 0; i < vb->v_dev_num; i++) { if (!vb->v_dev[i].v_device) { - if (vb->v_dev[i].v_device_id == vd->v_id) { + if (vb->v_dev[i].v_id.v_attrib == vd->v_id.v_attrib) { vd->v_bus_id = i; vb->v_dev[i].v_device = vd; return 0; diff --git a/drivers/acpi/drivers/video/dev-device.c b/drivers/acpi/drivers/video/dev-device.c index eaf9999..66b0591 100644 --- a/drivers/acpi/drivers/video/dev-device.c +++ b/drivers/acpi/drivers/video/dev-device.c @@ -110,7 +110,7 @@ int video_dev_test(struct acpi_dev * ad) static int is_lcd(struct acpi_video_dev * vd) { - return ((vd->v_id & VIDEO_DEV_TYPE_MASK) == VIDEO_DEV_LCD); + return (vd->v_id.v_type == VIDEO_DEV_LCD); } static int lcd_init(struct acpi_video_dev * vd) @@ -150,7 +150,7 @@ int video_dev_init(struct acpi_video_dev ret = get_int(vd->v_ad, "_ADR", &id); if (ret) return ret; - vd->v_id = id & 0xffff; + vd->v_id.v_attrib = id; ret = lcd_init(vd); if (ret) @@ -163,20 +163,20 @@ const char * video_dev_string(struct acp { const char * str; - switch (vd->v_id & VIDEO_DEV_TYPE_MASK) { - case 0x0000: + switch (vd->v_id.v_type) { + case VIDEO_DEV_OTHER: str = "Other"; break; - case 0x0100: + case VIDEO_DEV_VGA: str = "VGA"; break; - case 0x0200: + case VIDEO_DEV_TV: str = "TV/Analog"; break; - case 0x0300: + case VIDEO_DEV_DIGITAL: str = "External Digital"; break; - case 0x0400: + case VIDEO_DEV_LCD: str = "Integrated LCD"; break; default: diff --git a/drivers/acpi/drivers/video/video.h b/drivers/acpi/drivers/video/video.h index 395ac73..aedd495 100644 --- a/drivers/acpi/drivers/video/video.h +++ b/drivers/acpi/drivers/video/video.h @@ -25,18 +25,37 @@ ACPI_MODULE_NAME("acpi_video"); #define VIDEO_DOS_LCD_NO_AUTO 0x01 -#define VIDEO_DEV_TYPE_MASK 0x0f00 -#define VIDEO_DEV_OTHER 0x0000 -#define VIDEO_DEV_CRT 0x0100 -#define VIDEO_DEV_TV 0x0200 -#define VIDEO_DEV_EXT_LCD 0x0300 -#define VIDEO_DEV_LCD 0x0400 +#define VIDEO_DEV_OTHER 0x00 +#define VIDEO_DEV_VGA 0x01 +#define VIDEO_DEV_TV 0x02 +#define VIDEO_DEV_DIGITAL 0x03 +#define VIDEO_DEV_LCD 0x04 #define VIDEO_LCD_MAX 8 +union video_id { + struct { + union { + u32 v_device_id:16; + struct { + u32 v_index:4; + u32 v_port:4; + u32 v_type:4; + u32 v_specific:4; + } __attribute__((packed)); + } __attribute__((packed)); + + u32 v_bios_detect:1; + u32 v_non_vga:1; + u32 v_head_id:3; + u32 v_reserved:10; + u32 v_standard:1; + } __attribute__((packed)); + u32 v_attrib; +} __attribute__((packed)); struct acpi_video_dev { - u32 v_id; + union video_id v_id; u32 v_bus_id; u32 v_br_current; @@ -57,26 +76,7 @@ extern void video_bus_detach(struct acpi struct acpi_video_enum { - union { - struct { - union { - u32 v_device_id:16; - struct { - u32 v_index:4; - u32 v_port:4; - u32 v_type:4; - u32 v_specific:4; - } __attribute__((packed)); - } __attribute__((packed)); - - u32 v_bios_detect:1; - u32 v_non_vga:1; - u32 v_head_id:3; - u32 v_reserved:10; - u32 v_standard:1; - } __attribute__((packed)); - u32 v_attrib; - } __attribute__((packed)); + union video_id v_id; struct acpi_video_dev * v_device; }; --- 0.99.9.GIT