From 0145071b33142cbccffb51486b1ce921677b1d2d Mon Sep 17 00:00:00 2001 From: Linus Walleij Date: Thu, 2 Jun 2016 14:20:18 +0200 Subject: x86: Do away with ARCH_[WANT_OPTIONAL|REQUIRE]_GPIOLIB MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This replaces: - "select ARCH_REQUIRE_GPIOLIB" with "select GPIOLIB" as this can now be selected directly. - "select ARCH_WANT_OPTIONAL_GPIOLIB" with no dependency: GPIOLIB is now selectable by everyone, so we need not declare our intent to select it. When ordering the symbols the following rationale was used: if the selects were in alphabetical order, I moved select GPIOLIB to be in alphabetical order, but if the selects were not maintained in alphabetical order, I just replaced "select ARCH_REQUIRE_GPIOLIB" with "select GPIOLIB". Signed-off-by: Linus Walleij Cc: Michael Büsch Link: http://lkml.kernel.org/r/1464870018-8281-1-git-send-email-linus.walleij@linaro.org Signed-off-by: Thomas Gleixner --- arch/x86/Kconfig | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'arch/x86') diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig index 0a7b885964ba..607382b95372 100644 --- a/arch/x86/Kconfig +++ b/arch/x86/Kconfig @@ -49,7 +49,6 @@ config X86 select ARCH_WANTS_DYNAMIC_TASK_STRUCT select ARCH_WANT_FRAME_POINTERS select ARCH_WANT_IPC_PARSE_VERSION if X86_32 - select ARCH_WANT_OPTIONAL_GPIOLIB select BUILDTIME_EXTABLE_SORT select CLKEVT_I8253 select CLKSRC_I8253 if X86_32 @@ -643,7 +642,7 @@ config STA2X11 select X86_DMA_REMAP select SWIOTLB select MFD_STA2X11 - select ARCH_REQUIRE_GPIOLIB + select GPIOLIB default n ---help--- This adds support for boards based on the STA2X11 IO-Hub, -- cgit v1.2.3 From 7faf90ef995ea470f32f43810266ece8ac8ba6c7 Mon Sep 17 00:00:00 2001 From: Paul Bolle Date: Thu, 3 Mar 2016 13:01:40 +0100 Subject: lguest: Read length of device_cap later Read the length of the capability with type VIRTIO_PCI_CAP_DEVICE_CFG only when we're sure we're going to need it. Which is just before the check whether the virtio console actually has an emerg_wr field. Signed-off-by: Paul Bolle Cc: Rusty Russell Cc: lguest@lists.ozlabs.org Link: http://lkml.kernel.org/r/1457006501-5377-2-git-send-email-pebolle@tiscali.nl Signed-off-by: Thomas Gleixner --- arch/x86/lguest/boot.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'arch/x86') diff --git a/arch/x86/lguest/boot.c b/arch/x86/lguest/boot.c index 3847e736702e..146d11c8cf78 100644 --- a/arch/x86/lguest/boot.c +++ b/arch/x86/lguest/boot.c @@ -1258,7 +1258,7 @@ static void probe_pci_console(void) u8 vndr = read_pci_config_byte(0, 1, 0, cap); if (vndr == PCI_CAP_ID_VNDR) { u8 type, bar; - u32 offset, length; + u32 offset; type = read_pci_config_byte(0, 1, 0, cap + offsetof(struct virtio_pci_cap, cfg_type)); @@ -1266,15 +1266,12 @@ static void probe_pci_console(void) 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) { case VIRTIO_PCI_CAP_DEVICE_CFG: if (bar == 0) { device_cap = cap; device_offset = offset; - device_len = length; } break; case VIRTIO_PCI_CAP_PCI_CFG: @@ -1297,6 +1294,8 @@ static void probe_pci_console(void) * emerg_wr. If it doesn't support VIRTIO_CONSOLE_F_EMERG_WRITE * 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) + sizeof(u32))) { printk(KERN_ERR "lguest: console missing emerg_wr field\n"); -- cgit v1.2.3 From cf2cf0f50c14e86e04cda2c684357eed77922666 Mon Sep 17 00:00:00 2001 From: Paul Bolle Date: Thu, 3 Mar 2016 13:01:41 +0100 Subject: lguest: Read offset of device_cap later Read the offset of the capability with type VIRTIO_PCI_CAP_DEVICE_CFG only when we're sure we're going to need it. Which is when all checks have passed and we know we have a virtio console with an emerg_wr field. Signed-off-by: Paul Bolle Cc: Rusty Russell Cc: lguest@lists.ozlabs.org Link: http://lkml.kernel.org/r/1457006501-5377-3-git-send-email-pebolle@tiscali.nl Signed-off-by: Thomas Gleixner --- arch/x86/lguest/boot.c | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) (limited to 'arch/x86') diff --git a/arch/x86/lguest/boot.c b/arch/x86/lguest/boot.c index 146d11c8cf78..25da5bc8d83d 100644 --- a/arch/x86/lguest/boot.c +++ b/arch/x86/lguest/boot.c @@ -1233,8 +1233,6 @@ static void write_bar_via_cfg(u32 cfg_offset, u32 off, u32 val) static void probe_pci_console(void) { u8 cap, common_cap = 0, device_cap = 0; - /* Offset within BAR0 */ - u32 device_offset; u32 device_len; /* Avoid recursive printk into here. */ @@ -1258,21 +1256,16 @@ static void probe_pci_console(void) u8 vndr = read_pci_config_byte(0, 1, 0, cap); if (vndr == PCI_CAP_ID_VNDR) { u8 type, bar; - u32 offset; type = read_pci_config_byte(0, 1, 0, cap + offsetof(struct virtio_pci_cap, cfg_type)); bar = read_pci_config_byte(0, 1, 0, cap + offsetof(struct virtio_pci_cap, bar)); - offset = read_pci_config(0, 1, 0, - cap + offsetof(struct virtio_pci_cap, offset)); switch (type) { case VIRTIO_PCI_CAP_DEVICE_CFG: - if (bar == 0) { + if (bar == 0) device_cap = cap; - device_offset = offset; - } break; case VIRTIO_PCI_CAP_PCI_CFG: console_access_cap = cap; @@ -1302,7 +1295,8 @@ static void probe_pci_console(void) 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"); } -- cgit v1.2.3