From 08dc7c7e407fed00a89bd6f4fc13c7ea20320de1 Mon Sep 17 00:00:00 2001 From: Javier Martinez Canillas Date: Fri, 20 Nov 2015 14:35:02 -0300 Subject: ACPI: Fix build errors due objects compiled unconditionally If the CONFIG_ACPI Kconfig symbol is not enabled and a partial build is attempted, compile errors will happen due missing types and identifiers. This can be easily reproduced with the following commands: $ export CROSS_COMPILE="arm-linux-gnueabihf-" ARCH=arm $ make allmodconfig $ make M=drivers/acpi/ CC drivers/acpi//tables.o drivers/acpi//tables.c:235:3: warning: 'struct acpi_subtable_proc' declared inside parameter list unsigned int max_entries) ^ drivers/acpi//tables.c:235:3: warning: its scope is only this definition or declaration, which is probably not what you want drivers/acpi//tables.c: In function 'acpi_parse_entries_array': drivers/acpi//tables.c:269:4: error: invalid use of undefined type 'struct acpi_subtable_proc' ... scripts/Makefile.build:258: recipe for target 'drivers/acpi//tables.o' failed make[1]: *** [drivers/acpi//tables.o] Error 1 Makefile:1401: recipe for target '_module_drivers/acpi/' failed make: *** [_module_drivers/acpi/] Error 2 This is because objects are tried to be built unconditionally even when CONFIG_ACPI is not enabled. This is usually not a problem since arches' Kconfig sources drivers/acpi/Kconfig directly and also selects ACPI but the Makefile should conditionally build the objects as well to prevent these build errors. Signed-off-by: Javier Martinez Canillas Signed-off-by: Rafael J. Wysocki --- drivers/acpi/Makefile | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'drivers') diff --git a/drivers/acpi/Makefile b/drivers/acpi/Makefile index 675eaf337178..73ec23ca7db1 100644 --- a/drivers/acpi/Makefile +++ b/drivers/acpi/Makefile @@ -8,13 +8,13 @@ ccflags-$(CONFIG_ACPI_DEBUG) += -DACPI_DEBUG_OUTPUT # # ACPI Boot-Time Table Parsing # -obj-y += tables.o +obj-$(CONFIG_ACPI) += tables.o obj-$(CONFIG_X86) += blacklist.o # # ACPI Core Subsystem (Interpreter) # -obj-y += acpi.o \ +obj-$(CONFIG_ACPI) += acpi.o \ acpica/ # All the builtin files are in the "acpi." module_param namespace. @@ -66,10 +66,10 @@ obj-$(CONFIG_ACPI_FAN) += fan.o obj-$(CONFIG_ACPI_VIDEO) += video.o obj-$(CONFIG_ACPI_PCI_SLOT) += pci_slot.o obj-$(CONFIG_ACPI_PROCESSOR) += processor.o -obj-y += container.o +obj-$(CONFIG_ACPI) += container.o obj-$(CONFIG_ACPI_THERMAL) += thermal.o obj-$(CONFIG_ACPI_NFIT) += nfit.o -obj-y += acpi_memhotplug.o +obj-$(CONFIG_ACPI) += acpi_memhotplug.o obj-$(CONFIG_ACPI_HOTPLUG_IOAPIC) += ioapic.o obj-$(CONFIG_ACPI_BATTERY) += battery.o obj-$(CONFIG_ACPI_SBS) += sbshc.o -- cgit v1.2.3-59-g8ed1b From b5bd0269547105046f2236d9895bd5e3038cc8bc Mon Sep 17 00:00:00 2001 From: Sinan Kaya Date: Wed, 9 Dec 2015 11:18:27 -0500 Subject: ACPI, PCI, irq: remove interrupt count restriction Code currently supports 256 maximum interrupts at this moment. The patch is reconfiguring the penalty array as a dynamic list to remove this limitation. A new penalty linklist has been added for all other interrupts greater than 16. If an IRQ is not found in the link list, an IRQ info structure will be dynamically allocated on the first access and will be placed on the list for further reuse. The list will grow by the number of supported interrupts in the ACPI table rather than having a 256 hard limitation. Acked-by: Bjorn Helgaas Signed-off-by: Sinan Kaya Signed-off-by: Rafael J. Wysocki --- drivers/acpi/pci_link.c | 136 ++++++++++++++++++++++++++++++++++++------------ 1 file changed, 102 insertions(+), 34 deletions(-) (limited to 'drivers') diff --git a/drivers/acpi/pci_link.c b/drivers/acpi/pci_link.c index 7c8408b946ca..0286f17f0fa5 100644 --- a/drivers/acpi/pci_link.c +++ b/drivers/acpi/pci_link.c @@ -4,6 +4,7 @@ * Copyright (C) 2001, 2002 Andy Grover * Copyright (C) 2001, 2002 Paul Diefenbaugh * Copyright (C) 2002 Dominik Brodowski + * Copyright (c) 2015, The Linux Foundation. All rights reserved. * * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ * @@ -437,7 +438,6 @@ static int acpi_pci_link_set(struct acpi_pci_link *link, int irq) * enabled system. */ -#define ACPI_MAX_IRQS 256 #define ACPI_MAX_ISA_IRQ 16 #define PIRQ_PENALTY_PCI_AVAILABLE (0) @@ -447,7 +447,7 @@ static int acpi_pci_link_set(struct acpi_pci_link *link, int irq) #define PIRQ_PENALTY_ISA_USED (16*16*16*16*16) #define PIRQ_PENALTY_ISA_ALWAYS (16*16*16*16*16*16) -static int acpi_irq_penalty[ACPI_MAX_IRQS] = { +static int acpi_irq_isa_penalty[ACPI_MAX_ISA_IRQ] = { PIRQ_PENALTY_ISA_ALWAYS, /* IRQ0 timer */ PIRQ_PENALTY_ISA_ALWAYS, /* IRQ1 keyboard */ PIRQ_PENALTY_ISA_ALWAYS, /* IRQ2 cascade */ @@ -464,9 +464,68 @@ static int acpi_irq_penalty[ACPI_MAX_IRQS] = { PIRQ_PENALTY_ISA_USED, /* IRQ13 fpe, sometimes */ PIRQ_PENALTY_ISA_USED, /* IRQ14 ide0 */ PIRQ_PENALTY_ISA_USED, /* IRQ15 ide1 */ - /* >IRQ15 */ }; +struct irq_penalty_info { + int irq; + int penalty; + struct list_head node; +}; + +static LIST_HEAD(acpi_irq_penalty_list); + +static int acpi_irq_get_penalty(int irq) +{ + struct irq_penalty_info *irq_info; + + if (irq < ACPI_MAX_ISA_IRQ) + return acpi_irq_isa_penalty[irq]; + + list_for_each_entry(irq_info, &acpi_irq_penalty_list, node) { + if (irq_info->irq == irq) + return irq_info->penalty; + } + + return 0; +} + +static int acpi_irq_set_penalty(int irq, int new_penalty) +{ + struct irq_penalty_info *irq_info; + + /* see if this is a ISA IRQ */ + if (irq < ACPI_MAX_ISA_IRQ) { + acpi_irq_isa_penalty[irq] = new_penalty; + return 0; + } + + /* next, try to locate from the dynamic list */ + list_for_each_entry(irq_info, &acpi_irq_penalty_list, node) { + if (irq_info->irq == irq) { + irq_info->penalty = new_penalty; + return 0; + } + } + + /* nope, let's allocate a slot for this IRQ */ + irq_info = kzalloc(sizeof(*irq_info), GFP_KERNEL); + if (!irq_info) + return -ENOMEM; + + irq_info->irq = irq; + irq_info->penalty = new_penalty; + list_add_tail(&irq_info->node, &acpi_irq_penalty_list); + + return 0; +} + +static void acpi_irq_add_penalty(int irq, int penalty) +{ + int curpen = acpi_irq_get_penalty(irq); + + acpi_irq_set_penalty(irq, curpen + penalty); +} + int __init acpi_irq_penalty_init(void) { struct acpi_pci_link *link; @@ -487,15 +546,16 @@ int __init acpi_irq_penalty_init(void) link->irq.possible_count; for (i = 0; i < link->irq.possible_count; i++) { - if (link->irq.possible[i] < ACPI_MAX_ISA_IRQ) - acpi_irq_penalty[link->irq. - possible[i]] += - penalty; + if (link->irq.possible[i] < ACPI_MAX_ISA_IRQ) { + int irqpos = link->irq.possible[i]; + + acpi_irq_add_penalty(irqpos, penalty); + } } } else if (link->irq.active) { - acpi_irq_penalty[link->irq.active] += - PIRQ_PENALTY_PCI_POSSIBLE; + acpi_irq_add_penalty(link->irq.active, + PIRQ_PENALTY_PCI_POSSIBLE); } } @@ -547,12 +607,12 @@ static int acpi_pci_link_allocate(struct acpi_pci_link *link) * the use of IRQs 9, 10, 11, and >15. */ for (i = (link->irq.possible_count - 1); i >= 0; i--) { - if (acpi_irq_penalty[irq] > - acpi_irq_penalty[link->irq.possible[i]]) + if (acpi_irq_get_penalty(irq) > + acpi_irq_get_penalty(link->irq.possible[i])) irq = link->irq.possible[i]; } } - if (acpi_irq_penalty[irq] >= PIRQ_PENALTY_ISA_ALWAYS) { + if (acpi_irq_get_penalty(irq) >= PIRQ_PENALTY_ISA_ALWAYS) { printk(KERN_ERR PREFIX "No IRQ available for %s [%s]. " "Try pci=noacpi or acpi=off\n", acpi_device_name(link->device), @@ -568,7 +628,8 @@ static int acpi_pci_link_allocate(struct acpi_pci_link *link) acpi_device_bid(link->device)); return -ENODEV; } else { - acpi_irq_penalty[link->irq.active] += PIRQ_PENALTY_PCI_USING; + acpi_irq_add_penalty(link->irq.active, PIRQ_PENALTY_PCI_USING); + printk(KERN_WARNING PREFIX "%s [%s] enabled at IRQ %d\n", acpi_device_name(link->device), acpi_device_bid(link->device), link->irq.active); @@ -778,7 +839,7 @@ static void acpi_pci_link_remove(struct acpi_device *device) } /* - * modify acpi_irq_penalty[] from cmdline + * modify penalty from cmdline */ static int __init acpi_irq_penalty_update(char *str, int used) { @@ -796,13 +857,10 @@ static int __init acpi_irq_penalty_update(char *str, int used) if (irq < 0) continue; - if (irq >= ARRAY_SIZE(acpi_irq_penalty)) - continue; - if (used) - acpi_irq_penalty[irq] += PIRQ_PENALTY_ISA_USED; + acpi_irq_add_penalty(irq, PIRQ_PENALTY_ISA_USED); else - acpi_irq_penalty[irq] = PIRQ_PENALTY_PCI_AVAILABLE; + acpi_irq_set_penalty(irq, PIRQ_PENALTY_PCI_AVAILABLE); if (retval != 2) /* no next number */ break; @@ -819,18 +877,23 @@ static int __init acpi_irq_penalty_update(char *str, int used) */ void acpi_penalize_isa_irq(int irq, int active) { - if (irq >= 0 && irq < ARRAY_SIZE(acpi_irq_penalty)) { - if (active) - acpi_irq_penalty[irq] += PIRQ_PENALTY_ISA_USED; - else - acpi_irq_penalty[irq] += PIRQ_PENALTY_PCI_USING; - } + int penalty; + + if (irq < 0) + return; + + if (active) + penalty = PIRQ_PENALTY_ISA_USED; + else + penalty = PIRQ_PENALTY_PCI_USING; + + acpi_irq_add_penalty(irq, penalty); } bool acpi_isa_irq_available(int irq) { - return irq >= 0 && (irq >= ARRAY_SIZE(acpi_irq_penalty) || - acpi_irq_penalty[irq] < PIRQ_PENALTY_ISA_ALWAYS); + return irq >= 0 && + (acpi_irq_get_penalty(irq) < PIRQ_PENALTY_ISA_ALWAYS); } /* @@ -840,13 +903,18 @@ bool acpi_isa_irq_available(int irq) */ void acpi_penalize_sci_irq(int irq, int trigger, int polarity) { - if (irq >= 0 && irq < ARRAY_SIZE(acpi_irq_penalty)) { - if (trigger != ACPI_MADT_TRIGGER_LEVEL || - polarity != ACPI_MADT_POLARITY_ACTIVE_LOW) - acpi_irq_penalty[irq] += PIRQ_PENALTY_ISA_ALWAYS; - else - acpi_irq_penalty[irq] += PIRQ_PENALTY_PCI_USING; - } + int penalty; + + if (irq < 0) + return; + + if (trigger != ACPI_MADT_TRIGGER_LEVEL || + polarity != ACPI_MADT_POLARITY_ACTIVE_LOW) + penalty = PIRQ_PENALTY_ISA_ALWAYS; + else + penalty = PIRQ_PENALTY_PCI_USING; + + acpi_irq_add_penalty(irq, penalty); } /* -- cgit v1.2.3-59-g8ed1b From 37c5939136d7ce42b36c5d5b46f5272903a68433 Mon Sep 17 00:00:00 2001 From: Sinan Kaya Date: Wed, 9 Dec 2015 11:18:28 -0500 Subject: ACPI, PCI, irq: remove interrupt number restriction The ACPI compiler uses the extended format when used interrupt numbers are greater than 15. The extended IRQ syntax is 32 bits according to the ACPI spec. The code supports parsing the extended interrupt numbers. However, due to used data structure type; the code silently truncates interrupt numbers greater than 256. Acked-by: Bjorn Helgaas Signed-off-by: Sinan Kaya Signed-off-by: Rafael J. Wysocki --- drivers/acpi/pci_link.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'drivers') diff --git a/drivers/acpi/pci_link.c b/drivers/acpi/pci_link.c index 0286f17f0fa5..5114d8007aa0 100644 --- a/drivers/acpi/pci_link.c +++ b/drivers/acpi/pci_link.c @@ -68,12 +68,12 @@ static struct acpi_scan_handler pci_link_handler = { * later even the link is disable. Instead, we just repick the active irq */ struct acpi_pci_link_irq { - u8 active; /* Current IRQ */ + u32 active; /* Current IRQ */ u8 triggering; /* All IRQs */ u8 polarity; /* All IRQs */ u8 resource_type; u8 possible_count; - u8 possible[ACPI_PCI_LINK_MAX_POSSIBLE]; + u32 possible[ACPI_PCI_LINK_MAX_POSSIBLE]; u8 initialized:1; u8 reserved:7; }; -- cgit v1.2.3-59-g8ed1b From 55a93417c27c6ad1022d5f1121004c494735e8fa Mon Sep 17 00:00:00 2001 From: Christophe RICARD Date: Wed, 23 Dec 2015 23:25:33 +0100 Subject: ACPI: Rename acpi_gsi_get_irq_type to acpi_dev_get_irq_type and export symbol acpi_gsi_get_irq_type could be use out of GSI purpose. Rename and make it available as a resource function. Acked-by: Mika Westerberg Signed-off-by: Christophe Ricard Signed-off-by: Rafael J. Wysocki --- drivers/acpi/gsi.c | 21 +-------------------- drivers/acpi/resource.c | 26 ++++++++++++++++++++++++++ include/linux/acpi.h | 1 + 3 files changed, 28 insertions(+), 20 deletions(-) (limited to 'drivers') diff --git a/drivers/acpi/gsi.c b/drivers/acpi/gsi.c index fa4585a6914e..ee9e0f27b2bf 100644 --- a/drivers/acpi/gsi.c +++ b/drivers/acpi/gsi.c @@ -17,25 +17,6 @@ enum acpi_irq_model_id acpi_irq_model; static struct fwnode_handle *acpi_gsi_domain_id; -static unsigned int acpi_gsi_get_irq_type(int trigger, int polarity) -{ - switch (polarity) { - case ACPI_ACTIVE_LOW: - return trigger == ACPI_EDGE_SENSITIVE ? - IRQ_TYPE_EDGE_FALLING : - IRQ_TYPE_LEVEL_LOW; - case ACPI_ACTIVE_HIGH: - return trigger == ACPI_EDGE_SENSITIVE ? - IRQ_TYPE_EDGE_RISING : - IRQ_TYPE_LEVEL_HIGH; - case ACPI_ACTIVE_BOTH: - if (trigger == ACPI_EDGE_SENSITIVE) - return IRQ_TYPE_EDGE_BOTH; - default: - return IRQ_TYPE_NONE; - } -} - /** * acpi_gsi_to_irq() - Retrieve the linux irq number for a given GSI * @gsi: GSI IRQ number to map @@ -82,7 +63,7 @@ int acpi_register_gsi(struct device *dev, u32 gsi, int trigger, fwspec.fwnode = acpi_gsi_domain_id; fwspec.param[0] = gsi; - fwspec.param[1] = acpi_gsi_get_irq_type(trigger, polarity); + fwspec.param[1] = acpi_dev_get_irq_type(trigger, polarity); fwspec.param_count = 2; return irq_create_fwspec_mapping(&fwspec); diff --git a/drivers/acpi/resource.c b/drivers/acpi/resource.c index cdc5c2599beb..d02fd53042a5 100644 --- a/drivers/acpi/resource.c +++ b/drivers/acpi/resource.c @@ -23,6 +23,7 @@ #include #include #include +#include #ifdef CONFIG_X86 #define valid_IRQ(i) (((i) != 0) && ((i) != 2)) @@ -336,6 +337,31 @@ unsigned long acpi_dev_irq_flags(u8 triggering, u8 polarity, u8 shareable) } EXPORT_SYMBOL_GPL(acpi_dev_irq_flags); +/** + * acpi_dev_get_irq_type - Determine irq type. + * @triggering: Triggering type as provided by ACPI. + * @polarity: Interrupt polarity as provided by ACPI. + */ +unsigned int acpi_dev_get_irq_type(int triggering, int polarity) +{ + switch (polarity) { + case ACPI_ACTIVE_LOW: + return triggering == ACPI_EDGE_SENSITIVE ? + IRQ_TYPE_EDGE_FALLING : + IRQ_TYPE_LEVEL_LOW; + case ACPI_ACTIVE_HIGH: + return triggering == ACPI_EDGE_SENSITIVE ? + IRQ_TYPE_EDGE_RISING : + IRQ_TYPE_LEVEL_HIGH; + case ACPI_ACTIVE_BOTH: + if (triggering == ACPI_EDGE_SENSITIVE) + return IRQ_TYPE_EDGE_BOTH; + default: + return IRQ_TYPE_NONE; + } +} +EXPORT_SYMBOL_GPL(acpi_dev_get_irq_type); + static void acpi_dev_irqresource_disabled(struct resource *res, u32 gsi) { res->start = gsi; diff --git a/include/linux/acpi.h b/include/linux/acpi.h index 1991aea2ec4c..42adb80f11ca 100644 --- a/include/linux/acpi.h +++ b/include/linux/acpi.h @@ -318,6 +318,7 @@ bool acpi_dev_resource_address_space(struct acpi_resource *ares, bool acpi_dev_resource_ext_address_space(struct acpi_resource *ares, struct resource_win *win); unsigned long acpi_dev_irq_flags(u8 triggering, u8 polarity, u8 shareable); +unsigned int acpi_dev_get_irq_type(int triggering, int polarity); bool acpi_dev_resource_interrupt(struct acpi_resource *ares, int index, struct resource *res); -- cgit v1.2.3-59-g8ed1b From 52044723cd27aed6dad655a3bdf6142a8239ce74 Mon Sep 17 00:00:00 2001 From: Christophe RICARD Date: Wed, 23 Dec 2015 23:25:34 +0100 Subject: ACPI / gpio: Add irq_type when a GPIO is used as an interrupt When a GPIO is used as an interrupt in ACPI, the irq_type was not available for device driver. Make available polarity and triggering information in acpi_find_gpio by renaming acpi_gpio_info field active_low to polarity and adding triggering field (edge/level). For sanity, in gpiolib.c replace info.active_low by "info.polarity == GPIO_ACTIVE_LOW". Set the irq_type if necessary in acpi_dev_gpio_irq_get. Signed-off-by: Christophe Ricard Acked-by: Mika Westerberg Signed-off-by: Rafael J. Wysocki --- drivers/gpio/gpiolib-acpi.c | 33 +++++++++++++++++++++++++++------ drivers/gpio/gpiolib.c | 4 ++-- drivers/gpio/gpiolib.h | 3 ++- 3 files changed, 31 insertions(+), 9 deletions(-) (limited to 'drivers') diff --git a/drivers/gpio/gpiolib-acpi.c b/drivers/gpio/gpiolib-acpi.c index 16a7b6816744..cbbb67a6f1d6 100644 --- a/drivers/gpio/gpiolib-acpi.c +++ b/drivers/gpio/gpiolib-acpi.c @@ -417,10 +417,15 @@ static int acpi_find_gpio(struct acpi_resource *ares, void *data) * ActiveLow is only specified for GpioInt resource. If * GpioIo is used then the only way to set the flag is * to use _DSD "gpios" property. + * Note: we expect here: + * - ACPI_ACTIVE_LOW == GPIO_ACTIVE_LOW + * - ACPI_ACTIVE_HIGH == GPIO_ACTIVE_HIGH */ - if (lookup->info.gpioint) - lookup->info.active_low = - agpio->polarity == ACPI_ACTIVE_LOW; + if (lookup->info.gpioint) { + lookup->info.polarity = agpio->polarity; + lookup->info.triggering = agpio->triggering; + } + } return 1; @@ -447,7 +452,7 @@ static int acpi_gpio_resource_lookup(struct acpi_gpio_lookup *lookup, if (info) { *info = lookup->info; if (lookup->active_low) - info->active_low = lookup->active_low; + info->polarity = lookup->active_low; } return 0; } @@ -595,6 +600,7 @@ struct gpio_desc *acpi_node_get_gpiod(struct fwnode_handle *fwnode, int acpi_dev_gpio_irq_get(struct acpi_device *adev, int index) { int idx, i; + unsigned int irq_flags; for (i = 0, idx = 0; idx <= index; i++) { struct acpi_gpio_info info; @@ -603,8 +609,23 @@ int acpi_dev_gpio_irq_get(struct acpi_device *adev, int index) desc = acpi_get_gpiod_by_index(adev, NULL, i, &info); if (IS_ERR(desc)) break; - if (info.gpioint && idx++ == index) - return gpiod_to_irq(desc); + if (info.gpioint && idx++ == index) { + int irq = gpiod_to_irq(desc); + + if (irq < 0) + return irq; + + irq_flags = acpi_dev_get_irq_type(info.triggering, + info.polarity); + + /* Set type if specified and different than the current one */ + if (irq_flags != IRQ_TYPE_NONE && + irq_flags != irq_get_trigger_type(irq)) + irq_set_irq_type(irq, irq_flags); + + return irq; + } + } return -ENOENT; } diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c index 4e4c3083ae56..5d8d7ab96916 100644 --- a/drivers/gpio/gpiolib.c +++ b/drivers/gpio/gpiolib.c @@ -1879,7 +1879,7 @@ static struct gpio_desc *acpi_find_gpio(struct device *dev, const char *con_id, return desc; } - if (info.active_low) + if (info.polarity == GPIO_ACTIVE_LOW) *flags |= GPIO_ACTIVE_LOW; return desc; @@ -2217,7 +2217,7 @@ struct gpio_desc *fwnode_get_named_gpiod(struct fwnode_handle *fwnode, desc = acpi_node_get_gpiod(fwnode, propname, 0, &info); if (!IS_ERR(desc)) - active_low = info.active_low; + active_low = info.polarity == GPIO_ACTIVE_LOW; } if (IS_ERR(desc)) diff --git a/drivers/gpio/gpiolib.h b/drivers/gpio/gpiolib.h index 98ab08c0aa2d..5ac3b88a2e0a 100644 --- a/drivers/gpio/gpiolib.h +++ b/drivers/gpio/gpiolib.h @@ -26,7 +26,8 @@ struct acpi_device; */ struct acpi_gpio_info { bool gpioint; - bool active_low; + int polarity; + int triggering; }; /* gpio suffixes used for ACPI and device tree lookup */ -- cgit v1.2.3-59-g8ed1b From 33ada67da352e138b6dbb372dccad6c3f13b15b2 Mon Sep 17 00:00:00 2001 From: Christophe RICARD Date: Wed, 23 Dec 2015 23:25:35 +0100 Subject: ACPI / spi: attach GPIO IRQ from ACPI description to SPI device spi->irq was ignoring GpioInt property setting it to -1. acpi_dev_gpio_irq_get returns and configure the slave IRQ according to the ACPI slave node description. It is now inline with devicetree behavior. Acked-by: Mark Brown Signed-off-by: Christophe Ricard Acked-by: Mika Westerberg Signed-off-by: Rafael J. Wysocki --- drivers/spi/spi.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'drivers') diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c index dee1cb87d24f..151b01c25b40 100644 --- a/drivers/spi/spi.c +++ b/drivers/spi/spi.c @@ -1623,6 +1623,9 @@ static acpi_status acpi_spi_add_device(acpi_handle handle, u32 level, return AE_OK; } + if (spi->irq < 0) + spi->irq = acpi_dev_gpio_irq_get(adev, 0); + adev->power.flags.ignore_parent = true; strlcpy(spi->modalias, acpi_device_hid(adev), sizeof(spi->modalias)); if (spi_add_device(spi)) { -- cgit v1.2.3-59-g8ed1b From 0971686954f9cdde502c7bce4794c5ad53ea2e66 Mon Sep 17 00:00:00 2001 From: "Rafael J. Wysocki" Date: Mon, 4 Jan 2016 22:07:39 +0100 Subject: ACPI / PCI: Simplify acpi_penalize_isa_irq() acpi_penalize_isa_irq() can be written in fewer lines of code, so do that. No functional change. Signed-off-by: Rafael J. Wysocki Works-for: Andy Shevchenko --- drivers/acpi/pci_link.c | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) (limited to 'drivers') diff --git a/drivers/acpi/pci_link.c b/drivers/acpi/pci_link.c index 5114d8007aa0..fa2863567eed 100644 --- a/drivers/acpi/pci_link.c +++ b/drivers/acpi/pci_link.c @@ -877,17 +877,9 @@ static int __init acpi_irq_penalty_update(char *str, int used) */ void acpi_penalize_isa_irq(int irq, int active) { - int penalty; - - if (irq < 0) - return; - - if (active) - penalty = PIRQ_PENALTY_ISA_USED; - else - penalty = PIRQ_PENALTY_PCI_USING; - - acpi_irq_add_penalty(irq, penalty); + if (irq >= 0) + acpi_irq_add_penalty(irq, active ? + PIRQ_PENALTY_ISA_USED : PIRQ_PENALTY_PCI_USING); } bool acpi_isa_irq_available(int irq) -- cgit v1.2.3-59-g8ed1b From a84bc8cfb2f2e2bb59f2ebdf531464c547f5026f Mon Sep 17 00:00:00 2001 From: Colin Ian King Date: Fri, 1 Jan 2016 23:53:45 +0000 Subject: ACPI / SBS: fix inconsistent indenting inside if statement The indenting in acpi_battery_set_alarm is inconsistent and has been so since 2007; commit 94f6c0860139da9219255b8ff45ad42117dda859 ("ACPI: SBS: Add support for power_supply class (and sysfs)"). Minor fix for this, no code functionality change. Signed-off-by: Colin Ian King Signed-off-by: Rafael J. Wysocki --- drivers/acpi/sbs.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'drivers') diff --git a/drivers/acpi/sbs.c b/drivers/acpi/sbs.c index cb3dedb1beae..ad0b13ad4bbb 100644 --- a/drivers/acpi/sbs.c +++ b/drivers/acpi/sbs.c @@ -417,11 +417,11 @@ static int acpi_battery_set_alarm(struct acpi_battery *battery) if ((value & 0xf000) != sel) { value &= 0x0fff; value |= sel; - ret = acpi_smbus_write(sbs->hc, SMBUS_WRITE_WORD, + ret = acpi_smbus_write(sbs->hc, SMBUS_WRITE_WORD, ACPI_SBS_MANAGER, 0x01, (u8 *)&value, 2); - if (ret) - goto end; + if (ret) + goto end; } } ret = acpi_smbus_write(sbs->hc, SMBUS_WRITE_WORD, ACPI_SBS_BATTERY, -- cgit v1.2.3-59-g8ed1b From 45288978859119c019eff93f0cb838a0de100bcc Mon Sep 17 00:00:00 2001 From: Colin Ian King Date: Tue, 5 Jan 2016 10:57:11 +0000 Subject: ACPI, PCI, irq: remove redundant check for null string pointer source is decleared as a 4 byte char array in struct acpi_pci_routing_table so !prt->source is a redundant null string pointer check. Detected with smatch: drivers/acpi/pci_irq.c:134 do_prt_fixups() warn: this array is probably non-NULL. 'prt->source' Signed-off-by: Colin Ian King Signed-off-by: Rafael J. Wysocki --- drivers/acpi/pci_irq.c | 3 --- 1 file changed, 3 deletions(-) (limited to 'drivers') diff --git a/drivers/acpi/pci_irq.c b/drivers/acpi/pci_irq.c index c9336751e5e3..d30184c7f3bc 100644 --- a/drivers/acpi/pci_irq.c +++ b/drivers/acpi/pci_irq.c @@ -131,9 +131,6 @@ static void do_prt_fixups(struct acpi_prt_entry *entry, quirk = &prt_quirks[i]; /* All current quirks involve link devices, not GSIs */ - if (!prt->source) - continue; - if (dmi_check_system(quirk->system) && entry->id.segment == quirk->segment && entry->id.bus == quirk->bus && -- cgit v1.2.3-59-g8ed1b