Commit c265cc5c authored by Linus Torvalds's avatar Linus Torvalds

Merge branch 'x86-cleanups-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip

Pull x86 cleanups from Ingo Molnar:
 "Three small cleanups"

* 'x86-cleanups-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
  lguest: Read offset of device_cap later
  lguest: Read length of device_cap later
  x86: Do away with ARCH_[WANT_OPTIONAL|REQUIRE]_GPIOLIB
parents 80f09cf5 cf2cf0f5
...@@ -49,7 +49,6 @@ config X86 ...@@ -49,7 +49,6 @@ config X86
select ARCH_WANTS_DYNAMIC_TASK_STRUCT select ARCH_WANTS_DYNAMIC_TASK_STRUCT
select ARCH_WANT_FRAME_POINTERS select ARCH_WANT_FRAME_POINTERS
select ARCH_WANT_IPC_PARSE_VERSION if X86_32 select ARCH_WANT_IPC_PARSE_VERSION if X86_32
select ARCH_WANT_OPTIONAL_GPIOLIB
select BUILDTIME_EXTABLE_SORT select BUILDTIME_EXTABLE_SORT
select CLKEVT_I8253 select CLKEVT_I8253
select CLKSRC_I8253 if X86_32 select CLKSRC_I8253 if X86_32
...@@ -638,7 +637,7 @@ config STA2X11 ...@@ -638,7 +637,7 @@ config STA2X11
select X86_DMA_REMAP select X86_DMA_REMAP
select SWIOTLB select SWIOTLB
select MFD_STA2X11 select MFD_STA2X11
select ARCH_REQUIRE_GPIOLIB select GPIOLIB
default n default n
---help--- ---help---
This adds support for boards based on the STA2X11 IO-Hub, This adds support for boards based on the STA2X11 IO-Hub,
......
...@@ -1233,8 +1233,6 @@ static void write_bar_via_cfg(u32 cfg_offset, u32 off, u32 val) ...@@ -1233,8 +1233,6 @@ static void write_bar_via_cfg(u32 cfg_offset, u32 off, u32 val)
static void probe_pci_console(void) static void probe_pci_console(void)
{ {
u8 cap, common_cap = 0, device_cap = 0; u8 cap, common_cap = 0, device_cap = 0;
/* Offset within BAR0 */
u32 device_offset;
u32 device_len; u32 device_len;
/* Avoid recursive printk into here. */ /* Avoid recursive printk into here. */
...@@ -1258,24 +1256,16 @@ static void probe_pci_console(void) ...@@ -1258,24 +1256,16 @@ static void probe_pci_console(void)
u8 vndr = read_pci_config_byte(0, 1, 0, cap); u8 vndr = read_pci_config_byte(0, 1, 0, cap);
if (vndr == PCI_CAP_ID_VNDR) { if (vndr == PCI_CAP_ID_VNDR) {
u8 type, bar; u8 type, bar;
u32 offset, length;
type = read_pci_config_byte(0, 1, 0, type = read_pci_config_byte(0, 1, 0,
cap + offsetof(struct virtio_pci_cap, cfg_type)); cap + offsetof(struct virtio_pci_cap, cfg_type));
bar = read_pci_config_byte(0, 1, 0, bar = read_pci_config_byte(0, 1, 0,
cap + offsetof(struct virtio_pci_cap, bar)); cap + offsetof(struct virtio_pci_cap, bar));
offset = read_pci_config(0, 1, 0,
cap + offsetof(struct virtio_pci_cap, offset));
length = read_pci_config(0, 1, 0,
cap + offsetof(struct virtio_pci_cap, length));
switch (type) { switch (type) {
case VIRTIO_PCI_CAP_DEVICE_CFG: case VIRTIO_PCI_CAP_DEVICE_CFG:
if (bar == 0) { if (bar == 0)
device_cap = cap; device_cap = cap;
device_offset = offset;
device_len = length;
}
break; break;
case VIRTIO_PCI_CAP_PCI_CFG: case VIRTIO_PCI_CAP_PCI_CFG:
console_access_cap = cap; console_access_cap = cap;
...@@ -1297,13 +1287,16 @@ static void probe_pci_console(void) ...@@ -1297,13 +1287,16 @@ static void probe_pci_console(void)
* emerg_wr. If it doesn't support VIRTIO_CONSOLE_F_EMERG_WRITE * emerg_wr. If it doesn't support VIRTIO_CONSOLE_F_EMERG_WRITE
* it should ignore the access. * it should ignore the access.
*/ */
device_len = read_pci_config(0, 1, 0,
device_cap + offsetof(struct virtio_pci_cap, length));
if (device_len < (offsetof(struct virtio_console_config, emerg_wr) if (device_len < (offsetof(struct virtio_console_config, emerg_wr)
+ sizeof(u32))) { + sizeof(u32))) {
printk(KERN_ERR "lguest: console missing emerg_wr field\n"); printk(KERN_ERR "lguest: console missing emerg_wr field\n");
return; return;
} }
console_cfg_offset = device_offset; console_cfg_offset = read_pci_config(0, 1, 0,
device_cap + offsetof(struct virtio_pci_cap, offset));
printk(KERN_INFO "lguest: Console via virtio-pci emerg_wr\n"); printk(KERN_INFO "lguest: Console via virtio-pci emerg_wr\n");
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment