Commit fc723957 authored by Rafael J. Wysocki's avatar Rafael J. Wysocki

Merge branches 'acpi-pci', 'acpi-misc' and 'acpi-tools'

* acpi-pci:
  ACPI,PCI,IRQ: remove SCI penalize function
  ACPI,PCI,IRQ: remove redundant code in acpi_irq_penalty_init()
  ACPI,PCI,IRQ: reduce static IRQ array size to 16
  ACPI,PCI,IRQ: reduce resource requirements

* acpi-misc:
  ACPI / sysfs: fix error code in get_status()
  ACPI / device_sysfs: Clean up checkpatch errors
  ACPI / device_sysfs: Change _SUN and _STA show functions error return to EIO
  ACPI / device_sysfs: Add sysfs support for _HRV hardware revision
  arm64: defconfig: Enable ACPI
  ACPI / ARM64: Remove EXPERT dependency for ACPI on ARM64
  ACPI / ARM64: Don't enable ACPI by default on ARM64
  acer-wmi: Use acpi_dev_found()
  eeepc-wmi: Use acpi_dev_found()
  ACPI / utils: Rename acpi_dev_present()

* acpi-tools:
  tools/power/acpi: close file only if it is open
...@@ -264,6 +264,7 @@ CONFIG_PHY_RCAR_GEN3_USB2=y ...@@ -264,6 +264,7 @@ CONFIG_PHY_RCAR_GEN3_USB2=y
CONFIG_PHY_HI6220_USB=y CONFIG_PHY_HI6220_USB=y
CONFIG_PHY_XGENE=y CONFIG_PHY_XGENE=y
CONFIG_ARM_SCPI_PROTOCOL=y CONFIG_ARM_SCPI_PROTOCOL=y
CONFIG_ACPI=y
CONFIG_EXT2_FS=y CONFIG_EXT2_FS=y
CONFIG_EXT3_FS=y CONFIG_EXT3_FS=y
CONFIG_FANOTIFY=y CONFIG_FANOTIFY=y
......
...@@ -445,7 +445,6 @@ static void __init acpi_sci_ioapic_setup(u8 bus_irq, u16 polarity, u16 trigger, ...@@ -445,7 +445,6 @@ static void __init acpi_sci_ioapic_setup(u8 bus_irq, u16 polarity, u16 trigger,
polarity = acpi_sci_flags & ACPI_MADT_POLARITY_MASK; polarity = acpi_sci_flags & ACPI_MADT_POLARITY_MASK;
mp_override_legacy_irq(bus_irq, polarity, trigger, gsi); mp_override_legacy_irq(bus_irq, polarity, trigger, gsi);
acpi_penalize_sci_irq(bus_irq, trigger, polarity);
/* /*
* stash over-ride to indicate we've been here * stash over-ride to indicate we've been here
......
...@@ -396,7 +396,6 @@ int __init pci_acpi_init(void) ...@@ -396,7 +396,6 @@ int __init pci_acpi_init(void)
return -ENODEV; return -ENODEV;
printk(KERN_INFO "PCI: Using ACPI for IRQ routing\n"); printk(KERN_INFO "PCI: Using ACPI for IRQ routing\n");
acpi_irq_penalty_init();
pcibios_enable_irq = acpi_pci_irq_enable; pcibios_enable_irq = acpi_pci_irq_enable;
pcibios_disable_irq = acpi_pci_irq_disable; pcibios_disable_irq = acpi_pci_irq_disable;
x86_init.pci.init_irq = x86_init_noop; x86_init.pci.init_irq = x86_init_noop;
......
...@@ -5,10 +5,10 @@ ...@@ -5,10 +5,10 @@
menuconfig ACPI menuconfig ACPI
bool "ACPI (Advanced Configuration and Power Interface) Support" bool "ACPI (Advanced Configuration and Power Interface) Support"
depends on !IA64_HP_SIM depends on !IA64_HP_SIM
depends on IA64 || X86 || (ARM64 && EXPERT) depends on IA64 || X86 || ARM64
depends on PCI depends on PCI
select PNP select PNP
default y default y if (IA64 || X86)
help help
Advanced Configuration and Power Interface (ACPI) support for Advanced Configuration and Power Interface (ACPI) support for
Linux requires an ACPI-compliant platform (hardware/firmware), Linux requires an ACPI-compliant platform (hardware/firmware),
......
...@@ -35,7 +35,7 @@ static ssize_t acpi_object_path(acpi_handle handle, char *buf) ...@@ -35,7 +35,7 @@ static ssize_t acpi_object_path(acpi_handle handle, char *buf)
if (result) if (result)
return result; return result;
result = sprintf(buf, "%s\n", (char*)path.pointer); result = sprintf(buf, "%s\n", (char *)path.pointer);
kfree(path.pointer); kfree(path.pointer);
return result; return result;
} }
...@@ -333,7 +333,8 @@ int acpi_device_modalias(struct device *dev, char *buf, int size) ...@@ -333,7 +333,8 @@ int acpi_device_modalias(struct device *dev, char *buf, int size)
EXPORT_SYMBOL_GPL(acpi_device_modalias); EXPORT_SYMBOL_GPL(acpi_device_modalias);
static ssize_t static ssize_t
acpi_device_modalias_show(struct device *dev, struct device_attribute *attr, char *buf) { acpi_device_modalias_show(struct device *dev, struct device_attribute *attr, char *buf)
{
return __acpi_device_modalias(to_acpi_device(dev), buf, 1024); return __acpi_device_modalias(to_acpi_device(dev), buf, 1024);
} }
static DEVICE_ATTR(modalias, 0444, acpi_device_modalias_show, NULL); static DEVICE_ATTR(modalias, 0444, acpi_device_modalias_show, NULL);
...@@ -397,7 +398,8 @@ acpi_eject_store(struct device *d, struct device_attribute *attr, ...@@ -397,7 +398,8 @@ acpi_eject_store(struct device *d, struct device_attribute *attr,
static DEVICE_ATTR(eject, 0200, NULL, acpi_eject_store); static DEVICE_ATTR(eject, 0200, NULL, acpi_eject_store);
static ssize_t static ssize_t
acpi_device_hid_show(struct device *dev, struct device_attribute *attr, char *buf) { acpi_device_hid_show(struct device *dev, struct device_attribute *attr, char *buf)
{
struct acpi_device *acpi_dev = to_acpi_device(dev); struct acpi_device *acpi_dev = to_acpi_device(dev);
return sprintf(buf, "%s\n", acpi_device_hid(acpi_dev)); return sprintf(buf, "%s\n", acpi_device_hid(acpi_dev));
...@@ -467,12 +469,27 @@ acpi_device_sun_show(struct device *dev, struct device_attribute *attr, ...@@ -467,12 +469,27 @@ acpi_device_sun_show(struct device *dev, struct device_attribute *attr,
status = acpi_evaluate_integer(acpi_dev->handle, "_SUN", NULL, &sun); status = acpi_evaluate_integer(acpi_dev->handle, "_SUN", NULL, &sun);
if (ACPI_FAILURE(status)) if (ACPI_FAILURE(status))
return -ENODEV; return -EIO;
return sprintf(buf, "%llu\n", sun); return sprintf(buf, "%llu\n", sun);
} }
static DEVICE_ATTR(sun, 0444, acpi_device_sun_show, NULL); static DEVICE_ATTR(sun, 0444, acpi_device_sun_show, NULL);
static ssize_t
acpi_device_hrv_show(struct device *dev, struct device_attribute *attr,
char *buf) {
struct acpi_device *acpi_dev = to_acpi_device(dev);
acpi_status status;
unsigned long long hrv;
status = acpi_evaluate_integer(acpi_dev->handle, "_HRV", NULL, &hrv);
if (ACPI_FAILURE(status))
return -EIO;
return sprintf(buf, "%llu\n", hrv);
}
static DEVICE_ATTR(hrv, 0444, acpi_device_hrv_show, NULL);
static ssize_t status_show(struct device *dev, struct device_attribute *attr, static ssize_t status_show(struct device *dev, struct device_attribute *attr,
char *buf) { char *buf) {
struct acpi_device *acpi_dev = to_acpi_device(dev); struct acpi_device *acpi_dev = to_acpi_device(dev);
...@@ -481,7 +498,7 @@ static ssize_t status_show(struct device *dev, struct device_attribute *attr, ...@@ -481,7 +498,7 @@ static ssize_t status_show(struct device *dev, struct device_attribute *attr,
status = acpi_evaluate_integer(acpi_dev->handle, "_STA", NULL, &sta); status = acpi_evaluate_integer(acpi_dev->handle, "_STA", NULL, &sta);
if (ACPI_FAILURE(status)) if (ACPI_FAILURE(status))
return -ENODEV; return -EIO;
return sprintf(buf, "%llu\n", sta); return sprintf(buf, "%llu\n", sta);
} }
...@@ -541,6 +558,12 @@ int acpi_device_setup_files(struct acpi_device *dev) ...@@ -541,6 +558,12 @@ int acpi_device_setup_files(struct acpi_device *dev)
goto end; goto end;
} }
if (acpi_has_method(dev->handle, "_HRV")) {
result = device_create_file(&dev->dev, &dev_attr_hrv);
if (result)
goto end;
}
if (acpi_has_method(dev->handle, "_STA")) { if (acpi_has_method(dev->handle, "_STA")) {
result = device_create_file(&dev->dev, &dev_attr_status); result = device_create_file(&dev->dev, &dev_attr_status);
if (result) if (result)
...@@ -604,6 +627,9 @@ void acpi_device_remove_files(struct acpi_device *dev) ...@@ -604,6 +627,9 @@ void acpi_device_remove_files(struct acpi_device *dev)
if (acpi_has_method(dev->handle, "_SUN")) if (acpi_has_method(dev->handle, "_SUN"))
device_remove_file(&dev->dev, &dev_attr_sun); device_remove_file(&dev->dev, &dev_attr_sun);
if (acpi_has_method(dev->handle, "_HRV"))
device_remove_file(&dev->dev, &dev_attr_hrv);
if (dev->pnp.unique_id) if (dev->pnp.unique_id)
device_remove_file(&dev->dev, &dev_attr_uid); device_remove_file(&dev->dev, &dev_attr_uid);
if (dev->pnp.type.bus_address) if (dev->pnp.type.bus_address)
......
...@@ -36,6 +36,7 @@ ...@@ -36,6 +36,7 @@
#include <linux/mutex.h> #include <linux/mutex.h>
#include <linux/slab.h> #include <linux/slab.h>
#include <linux/acpi.h> #include <linux/acpi.h>
#include <linux/irq.h>
#include "internal.h" #include "internal.h"
...@@ -437,17 +438,15 @@ static int acpi_pci_link_set(struct acpi_pci_link *link, int irq) ...@@ -437,17 +438,15 @@ static int acpi_pci_link_set(struct acpi_pci_link *link, int irq)
* enabled system. * enabled system.
*/ */
#define ACPI_MAX_IRQS 256 #define ACPI_MAX_ISA_IRQS 16
#define ACPI_MAX_ISA_IRQ 16
#define PIRQ_PENALTY_PCI_AVAILABLE (0)
#define PIRQ_PENALTY_PCI_POSSIBLE (16*16) #define PIRQ_PENALTY_PCI_POSSIBLE (16*16)
#define PIRQ_PENALTY_PCI_USING (16*16*16) #define PIRQ_PENALTY_PCI_USING (16*16*16)
#define PIRQ_PENALTY_ISA_TYPICAL (16*16*16*16) #define PIRQ_PENALTY_ISA_TYPICAL (16*16*16*16)
#define PIRQ_PENALTY_ISA_USED (16*16*16*16*16) #define PIRQ_PENALTY_ISA_USED (16*16*16*16*16)
#define PIRQ_PENALTY_ISA_ALWAYS (16*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_isa_irq_penalty[ACPI_MAX_ISA_IRQS] = {
PIRQ_PENALTY_ISA_ALWAYS, /* IRQ0 timer */ PIRQ_PENALTY_ISA_ALWAYS, /* IRQ0 timer */
PIRQ_PENALTY_ISA_ALWAYS, /* IRQ1 keyboard */ PIRQ_PENALTY_ISA_ALWAYS, /* IRQ1 keyboard */
PIRQ_PENALTY_ISA_ALWAYS, /* IRQ2 cascade */ PIRQ_PENALTY_ISA_ALWAYS, /* IRQ2 cascade */
...@@ -457,9 +456,9 @@ static int acpi_irq_penalty[ACPI_MAX_IRQS] = { ...@@ -457,9 +456,9 @@ static int acpi_irq_penalty[ACPI_MAX_IRQS] = {
PIRQ_PENALTY_ISA_TYPICAL, /* IRQ6 */ PIRQ_PENALTY_ISA_TYPICAL, /* IRQ6 */
PIRQ_PENALTY_ISA_TYPICAL, /* IRQ7 parallel, spurious */ PIRQ_PENALTY_ISA_TYPICAL, /* IRQ7 parallel, spurious */
PIRQ_PENALTY_ISA_TYPICAL, /* IRQ8 rtc, sometimes */ PIRQ_PENALTY_ISA_TYPICAL, /* IRQ8 rtc, sometimes */
PIRQ_PENALTY_PCI_AVAILABLE, /* IRQ9 PCI, often acpi */ 0, /* IRQ9 PCI, often acpi */
PIRQ_PENALTY_PCI_AVAILABLE, /* IRQ10 PCI */ 0, /* IRQ10 PCI */
PIRQ_PENALTY_PCI_AVAILABLE, /* IRQ11 PCI */ 0, /* IRQ11 PCI */
PIRQ_PENALTY_ISA_USED, /* IRQ12 mouse */ PIRQ_PENALTY_ISA_USED, /* IRQ12 mouse */
PIRQ_PENALTY_ISA_USED, /* IRQ13 fpe, sometimes */ PIRQ_PENALTY_ISA_USED, /* IRQ13 fpe, sometimes */
PIRQ_PENALTY_ISA_USED, /* IRQ14 ide0 */ PIRQ_PENALTY_ISA_USED, /* IRQ14 ide0 */
...@@ -467,39 +466,58 @@ static int acpi_irq_penalty[ACPI_MAX_IRQS] = { ...@@ -467,39 +466,58 @@ static int acpi_irq_penalty[ACPI_MAX_IRQS] = {
/* >IRQ15 */ /* >IRQ15 */
}; };
int __init acpi_irq_penalty_init(void) static int acpi_irq_pci_sharing_penalty(int irq)
{ {
struct acpi_pci_link *link; struct acpi_pci_link *link;
int i; int penalty = 0;
list_for_each_entry(link, &acpi_link_list, list) {
/* /*
* Update penalties to facilitate IRQ balancing. * If a link is active, penalize its IRQ heavily
* so we try to choose a different IRQ.
*/ */
list_for_each_entry(link, &acpi_link_list, list) { if (link->irq.active && link->irq.active == irq)
penalty += PIRQ_PENALTY_PCI_USING;
else {
int i;
/* /*
* reflect the possible and active irqs in the penalty table -- * If a link is inactive, penalize the IRQs it
* useful for breaking ties. * might use, but not as severely.
*/ */
if (link->irq.possible_count) { for (i = 0; i < link->irq.possible_count; i++)
int penalty = if (link->irq.possible[i] == irq)
PIRQ_PENALTY_PCI_POSSIBLE / penalty += PIRQ_PENALTY_PCI_POSSIBLE /
link->irq.possible_count; 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;
} }
} else if (link->irq.active) {
acpi_irq_penalty[link->irq.active] +=
PIRQ_PENALTY_PCI_POSSIBLE;
} }
return penalty;
}
static int acpi_irq_get_penalty(int irq)
{
int penalty = 0;
if (irq < ACPI_MAX_ISA_IRQS)
penalty += acpi_isa_irq_penalty[irq];
/*
* Penalize IRQ used by ACPI SCI. If ACPI SCI pin attributes conflict
* with PCI IRQ attributes, mark ACPI SCI as ISA_ALWAYS so it won't be
* use for PCI IRQs.
*/
if (irq == acpi_gbl_FADT.sci_interrupt) {
u32 type = irq_get_trigger_type(irq) & IRQ_TYPE_SENSE_MASK;
if (type != IRQ_TYPE_LEVEL_LOW)
penalty += PIRQ_PENALTY_ISA_ALWAYS;
else
penalty += PIRQ_PENALTY_PCI_USING;
} }
return 0; penalty += acpi_irq_pci_sharing_penalty(irq);
return penalty;
} }
static int acpi_irq_balance = -1; /* 0: static, 1: balance */ static int acpi_irq_balance = -1; /* 0: static, 1: balance */
...@@ -547,12 +565,12 @@ static int acpi_pci_link_allocate(struct acpi_pci_link *link) ...@@ -547,12 +565,12 @@ static int acpi_pci_link_allocate(struct acpi_pci_link *link)
* the use of IRQs 9, 10, 11, and >15. * the use of IRQs 9, 10, 11, and >15.
*/ */
for (i = (link->irq.possible_count - 1); i >= 0; i--) { for (i = (link->irq.possible_count - 1); i >= 0; i--) {
if (acpi_irq_penalty[irq] > if (acpi_irq_get_penalty(irq) >
acpi_irq_penalty[link->irq.possible[i]]) acpi_irq_get_penalty(link->irq.possible[i]))
irq = 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]. " printk(KERN_ERR PREFIX "No IRQ available for %s [%s]. "
"Try pci=noacpi or acpi=off\n", "Try pci=noacpi or acpi=off\n",
acpi_device_name(link->device), acpi_device_name(link->device),
...@@ -568,7 +586,6 @@ static int acpi_pci_link_allocate(struct acpi_pci_link *link) ...@@ -568,7 +586,6 @@ static int acpi_pci_link_allocate(struct acpi_pci_link *link)
acpi_device_bid(link->device)); acpi_device_bid(link->device));
return -ENODEV; return -ENODEV;
} else { } else {
acpi_irq_penalty[link->irq.active] += PIRQ_PENALTY_PCI_USING;
printk(KERN_WARNING PREFIX "%s [%s] enabled at IRQ %d\n", printk(KERN_WARNING PREFIX "%s [%s] enabled at IRQ %d\n",
acpi_device_name(link->device), acpi_device_name(link->device),
acpi_device_bid(link->device), link->irq.active); acpi_device_bid(link->device), link->irq.active);
...@@ -778,7 +795,7 @@ static void acpi_pci_link_remove(struct acpi_device *device) ...@@ -778,7 +795,7 @@ static void acpi_pci_link_remove(struct acpi_device *device)
} }
/* /*
* modify acpi_irq_penalty[] from cmdline * modify acpi_isa_irq_penalty[] from cmdline
*/ */
static int __init acpi_irq_penalty_update(char *str, int used) static int __init acpi_irq_penalty_update(char *str, int used)
{ {
...@@ -787,23 +804,24 @@ static int __init acpi_irq_penalty_update(char *str, int used) ...@@ -787,23 +804,24 @@ static int __init acpi_irq_penalty_update(char *str, int used)
for (i = 0; i < 16; i++) { for (i = 0; i < 16; i++) {
int retval; int retval;
int irq; int irq;
int new_penalty;
retval = get_option(&str, &irq); retval = get_option(&str, &irq);
if (!retval) if (!retval)
break; /* no number found */ break; /* no number found */
if (irq < 0) /* see if this is a ISA IRQ */
continue; if ((irq < 0) || (irq >= ACPI_MAX_ISA_IRQS))
if (irq >= ARRAY_SIZE(acpi_irq_penalty))
continue; continue;
if (used) if (used)
acpi_irq_penalty[irq] += PIRQ_PENALTY_ISA_USED; new_penalty = acpi_irq_get_penalty(irq) +
PIRQ_PENALTY_ISA_USED;
else else
acpi_irq_penalty[irq] = PIRQ_PENALTY_PCI_AVAILABLE; new_penalty = 0;
acpi_isa_irq_penalty[irq] = new_penalty;
if (retval != 2) /* no next number */ if (retval != 2) /* no next number */
break; break;
} }
...@@ -819,34 +837,15 @@ static int __init acpi_irq_penalty_update(char *str, int used) ...@@ -819,34 +837,15 @@ static int __init acpi_irq_penalty_update(char *str, int used)
*/ */
void acpi_penalize_isa_irq(int irq, int active) void acpi_penalize_isa_irq(int irq, int active)
{ {
if (irq >= 0 && irq < ARRAY_SIZE(acpi_irq_penalty)) { if ((irq >= 0) && (irq < ARRAY_SIZE(acpi_isa_irq_penalty)))
if (active) acpi_isa_irq_penalty[irq] = acpi_irq_get_penalty(irq) +
acpi_irq_penalty[irq] += PIRQ_PENALTY_ISA_USED; active ? PIRQ_PENALTY_ISA_USED : PIRQ_PENALTY_PCI_USING;
else
acpi_irq_penalty[irq] += PIRQ_PENALTY_PCI_USING;
}
} }
bool acpi_isa_irq_available(int irq) bool acpi_isa_irq_available(int irq)
{ {
return irq >= 0 && (irq >= ARRAY_SIZE(acpi_irq_penalty) || return irq >= 0 && (irq >= ARRAY_SIZE(acpi_isa_irq_penalty) ||
acpi_irq_penalty[irq] < PIRQ_PENALTY_ISA_ALWAYS); acpi_irq_get_penalty(irq) < PIRQ_PENALTY_ISA_ALWAYS);
}
/*
* Penalize IRQ used by ACPI SCI. If ACPI SCI pin attributes conflict with
* PCI IRQ attributes, mark ACPI SCI as ISA_ALWAYS so it won't be use for
* PCI IRQs.
*/
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;
}
} }
/* /*
......
...@@ -555,23 +555,22 @@ static void acpi_global_event_handler(u32 event_type, acpi_handle device, ...@@ -555,23 +555,22 @@ static void acpi_global_event_handler(u32 event_type, acpi_handle device,
static int get_status(u32 index, acpi_event_status *status, static int get_status(u32 index, acpi_event_status *status,
acpi_handle *handle) acpi_handle *handle)
{ {
int result = 0; int result;
if (index >= num_gpes + ACPI_NUM_FIXED_EVENTS) if (index >= num_gpes + ACPI_NUM_FIXED_EVENTS)
goto end; return -EINVAL;
if (index < num_gpes) { if (index < num_gpes) {
result = acpi_get_gpe_device(index, handle); result = acpi_get_gpe_device(index, handle);
if (result) { if (result) {
ACPI_EXCEPTION((AE_INFO, AE_NOT_FOUND, ACPI_EXCEPTION((AE_INFO, AE_NOT_FOUND,
"Invalid GPE 0x%x", index)); "Invalid GPE 0x%x", index));
goto end; return result;
} }
result = acpi_get_gpe_status(*handle, index, status); result = acpi_get_gpe_status(*handle, index, status);
} else if (index < (num_gpes + ACPI_NUM_FIXED_EVENTS)) } else if (index < (num_gpes + ACPI_NUM_FIXED_EVENTS))
result = acpi_get_event_status(index - num_gpes, status); result = acpi_get_event_status(index - num_gpes, status);
end:
return result; return result;
} }
......
...@@ -707,7 +707,7 @@ bool acpi_check_dsm(acpi_handle handle, const u8 *uuid, int rev, u64 funcs) ...@@ -707,7 +707,7 @@ bool acpi_check_dsm(acpi_handle handle, const u8 *uuid, int rev, u64 funcs)
EXPORT_SYMBOL(acpi_check_dsm); EXPORT_SYMBOL(acpi_check_dsm);
/** /**
* acpi_dev_present - Detect presence of a given ACPI device in the system. * acpi_dev_found - Detect presence of a given ACPI device in the namespace.
* @hid: Hardware ID of the device. * @hid: Hardware ID of the device.
* *
* Return %true if the device was present at the moment of invocation. * Return %true if the device was present at the moment of invocation.
...@@ -719,7 +719,7 @@ EXPORT_SYMBOL(acpi_check_dsm); ...@@ -719,7 +719,7 @@ EXPORT_SYMBOL(acpi_check_dsm);
* instead). Calling from module_init() is fine (which is synonymous * instead). Calling from module_init() is fine (which is synonymous
* with device_initcall()). * with device_initcall()).
*/ */
bool acpi_dev_present(const char *hid) bool acpi_dev_found(const char *hid)
{ {
struct acpi_device_bus_id *acpi_device_bus_id; struct acpi_device_bus_id *acpi_device_bus_id;
bool found = false; bool found = false;
...@@ -734,7 +734,7 @@ bool acpi_dev_present(const char *hid) ...@@ -734,7 +734,7 @@ bool acpi_dev_present(const char *hid)
return found; return found;
} }
EXPORT_SYMBOL(acpi_dev_present); EXPORT_SYMBOL(acpi_dev_found);
/* /*
* acpi_backlight= handling, this is done here rather then in video_detect.c * acpi_backlight= handling, this is done here rather then in video_detect.c
......
...@@ -793,15 +793,6 @@ static acpi_status __init AMW0_find_mailled(void) ...@@ -793,15 +793,6 @@ static acpi_status __init AMW0_find_mailled(void)
return AE_OK; return AE_OK;
} }
static int AMW0_set_cap_acpi_check_device_found __initdata;
static acpi_status __init AMW0_set_cap_acpi_check_device_cb(acpi_handle handle,
u32 level, void *context, void **retval)
{
AMW0_set_cap_acpi_check_device_found = 1;
return AE_OK;
}
static const struct acpi_device_id norfkill_ids[] __initconst = { static const struct acpi_device_id norfkill_ids[] __initconst = {
{ "VPC2004", 0}, { "VPC2004", 0},
{ "IBM0068", 0}, { "IBM0068", 0},
...@@ -816,9 +807,10 @@ static int __init AMW0_set_cap_acpi_check_device(void) ...@@ -816,9 +807,10 @@ static int __init AMW0_set_cap_acpi_check_device(void)
const struct acpi_device_id *id; const struct acpi_device_id *id;
for (id = norfkill_ids; id->id[0]; id++) for (id = norfkill_ids; id->id[0]; id++)
acpi_get_devices(id->id, AMW0_set_cap_acpi_check_device_cb, if (acpi_dev_found(id->id))
NULL, NULL); return true;
return AMW0_set_cap_acpi_check_device_found;
return false;
} }
static acpi_status __init AMW0_set_capabilities(void) static acpi_status __init AMW0_set_capabilities(void)
......
...@@ -204,30 +204,10 @@ static void eeepc_wmi_key_filter(struct asus_wmi_driver *asus_wmi, int *code, ...@@ -204,30 +204,10 @@ static void eeepc_wmi_key_filter(struct asus_wmi_driver *asus_wmi, int *code,
} }
} }
static acpi_status eeepc_wmi_parse_device(acpi_handle handle, u32 level,
void *context, void **retval)
{
pr_warn("Found legacy ATKD device (%s)\n", EEEPC_ACPI_HID);
*(bool *)context = true;
return AE_CTRL_TERMINATE;
}
static int eeepc_wmi_check_atkd(void)
{
acpi_status status;
bool found = false;
status = acpi_get_devices(EEEPC_ACPI_HID, eeepc_wmi_parse_device,
&found, NULL);
if (ACPI_FAILURE(status) || !found)
return 0;
return -1;
}
static int eeepc_wmi_probe(struct platform_device *pdev) static int eeepc_wmi_probe(struct platform_device *pdev)
{ {
if (eeepc_wmi_check_atkd()) { if (acpi_dev_found(EEEPC_ACPI_HID)) {
pr_warn("Found legacy ATKD device (%s)\n", EEEPC_ACPI_HID);
pr_warn("WMI device present, but legacy ATKD device is also " pr_warn("WMI device present, but legacy ATKD device is also "
"present and enabled\n"); "present and enabled\n");
pr_warn("You probably booted with acpi_osi=\"Linux\" or " pr_warn("You probably booted with acpi_osi=\"Linux\" or "
......
...@@ -87,7 +87,7 @@ acpi_evaluate_dsm_typed(acpi_handle handle, const u8 *uuid, int rev, int func, ...@@ -87,7 +87,7 @@ acpi_evaluate_dsm_typed(acpi_handle handle, const u8 *uuid, int rev, int func,
.package.elements = (eles) \ .package.elements = (eles) \
} }
bool acpi_dev_present(const char *hid); bool acpi_dev_found(const char *hid);
#ifdef CONFIG_ACPI #ifdef CONFIG_ACPI
......
...@@ -78,7 +78,6 @@ ...@@ -78,7 +78,6 @@
/* ACPI PCI Interrupt Link (pci_link.c) */ /* ACPI PCI Interrupt Link (pci_link.c) */
int acpi_irq_penalty_init(void);
int acpi_pci_link_allocate_irq(acpi_handle handle, int index, int *triggering, int acpi_pci_link_allocate_irq(acpi_handle handle, int index, int *triggering,
int *polarity, char **name); int *polarity, char **name);
int acpi_pci_link_free_irq(acpi_handle handle); int acpi_pci_link_free_irq(acpi_handle handle);
......
...@@ -305,7 +305,6 @@ struct pci_dev; ...@@ -305,7 +305,6 @@ struct pci_dev;
int acpi_pci_irq_enable (struct pci_dev *dev); int acpi_pci_irq_enable (struct pci_dev *dev);
void acpi_penalize_isa_irq(int irq, int active); void acpi_penalize_isa_irq(int irq, int active);
bool acpi_isa_irq_available(int irq); bool acpi_isa_irq_available(int irq);
void acpi_penalize_sci_irq(int irq, int trigger, int polarity);
void acpi_pci_irq_disable (struct pci_dev *dev); void acpi_pci_irq_disable (struct pci_dev *dev);
extern int ec_read(u8 addr, u8 *val); extern int ec_read(u8 addr, u8 *val);
......
...@@ -35,7 +35,7 @@ ...@@ -35,7 +35,7 @@
*/ */
static inline bool apple_gmux_present(void) static inline bool apple_gmux_present(void)
{ {
return acpi_dev_present(GMUX_ACPI_HID); return acpi_dev_found(GMUX_ACPI_HID);
} }
#else /* !CONFIG_APPLE_GMUX */ #else /* !CONFIG_APPLE_GMUX */
......
...@@ -13,7 +13,7 @@ static void (*old_vmaster_hook)(void *, int); ...@@ -13,7 +13,7 @@ static void (*old_vmaster_hook)(void *, int);
static bool is_thinkpad(struct hda_codec *codec) static bool is_thinkpad(struct hda_codec *codec)
{ {
return (codec->core.subsystem_id >> 16 == 0x17aa) && return (codec->core.subsystem_id >> 16 == 0x17aa) &&
(acpi_dev_present("LEN0068") || acpi_dev_present("IBM0068")); (acpi_dev_found("LEN0068") || acpi_dev_found("IBM0068"));
} }
static void update_tpacpi_mute_led(void *private_data, int enabled) static void update_tpacpi_mute_led(void *private_data, int enabled)
......
...@@ -296,7 +296,7 @@ static int snd_cht_mc_probe(struct platform_device *pdev) ...@@ -296,7 +296,7 @@ static int snd_cht_mc_probe(struct platform_device *pdev)
if (!drv) if (!drv)
return -ENOMEM; return -ENOMEM;
drv->ts3a227e_present = acpi_dev_present("104C227E"); drv->ts3a227e_present = acpi_dev_found("104C227E");
if (!drv->ts3a227e_present) { if (!drv->ts3a227e_present) {
/* no need probe TI jack detection chip */ /* no need probe TI jack detection chip */
snd_soc_card_cht.aux_dev = NULL; snd_soc_card_cht.aux_dev = NULL;
......
...@@ -357,7 +357,7 @@ static int snd_cht_mc_probe(struct platform_device *pdev) ...@@ -357,7 +357,7 @@ static int snd_cht_mc_probe(struct platform_device *pdev)
return -ENOMEM; return -ENOMEM;
for (i = 0; i < ARRAY_SIZE(snd_soc_cards); i++) { for (i = 0; i < ARRAY_SIZE(snd_soc_cards); i++) {
if (acpi_dev_present(snd_soc_cards[i].codec_id)) { if (acpi_dev_found(snd_soc_cards[i].codec_id)) {
dev_dbg(&pdev->dev, dev_dbg(&pdev->dev,
"found codec %s\n", snd_soc_cards[i].codec_id); "found codec %s\n", snd_soc_cards[i].codec_id);
card = snd_soc_cards[i].soc_card; card = snd_soc_cards[i].soc_card;
......
...@@ -375,7 +375,7 @@ void usage(FILE *file, char *progname) ...@@ -375,7 +375,7 @@ void usage(FILE *file, char *progname)
int main(int argc, char **argv) int main(int argc, char **argv)
{ {
int fd = 0; int fd = -1;
int ch; int ch;
int len; int len;
int ret = EXIT_SUCCESS; int ret = EXIT_SUCCESS;
...@@ -430,7 +430,7 @@ int main(int argc, char **argv) ...@@ -430,7 +430,7 @@ int main(int argc, char **argv)
acpi_aml_loop(fd); acpi_aml_loop(fd);
exit: exit:
if (fd < 0) if (fd >= 0)
close(fd); close(fd);
if (acpi_aml_batch_cmd) if (acpi_aml_batch_cmd)
free(acpi_aml_batch_cmd); free(acpi_aml_batch_cmd);
......
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