提交 4be44fcd 编写于 作者: L Len Brown

[ACPI] Lindent all ACPI files

Signed-off-by: NLen Brown <len.brown@intel.com>
上级 c65ade4d
......@@ -40,9 +40,15 @@
#ifdef CONFIG_X86_64
static inline void acpi_madt_oem_check(char *oem_id, char *oem_table_id) { }
static inline void acpi_madt_oem_check(char *oem_id, char *oem_table_id)
{
}
extern void __init clustered_apic_check(void);
static inline int ioapic_setup_disabled(void) { return 0; }
static inline int ioapic_setup_disabled(void)
{
return 0;
}
#include <asm/proto.h>
#else /* X86 */
......@@ -88,7 +94,7 @@ static u64 acpi_lapic_addr __initdata = APIC_DEFAULT_PHYS_BASE;
#define MAX_MADT_ENTRIES 256
u8 x86_acpiid_to_apicid[MAX_MADT_ENTRIES] =
{ [0 ... MAX_MADT_ENTRIES-1] = 0xff };
{[0...MAX_MADT_ENTRIES - 1] = 0xff };
EXPORT_SYMBOL(x86_acpiid_to_apicid);
/* --------------------------------------------------------------------------
......@@ -134,7 +140,7 @@ char *__acpi_map_table(unsigned long phys, unsigned long size)
unsigned long base, offset, mapped_size;
int idx;
if (phys + size < 8*1024*1024)
if (phys + size < 8 * 1024 * 1024)
return __va(phys);
offset = phys & (PAGE_SIZE - 1);
......@@ -154,7 +160,7 @@ char *__acpi_map_table(unsigned long phys, unsigned long size)
mapped_size += PAGE_SIZE;
}
return ((unsigned char *) base + offset);
return ((unsigned char *)base + offset);
}
#endif
......@@ -172,7 +178,7 @@ int __init acpi_parse_mcfg(unsigned long phys_addr, unsigned long size)
if (!phys_addr || !size)
return -EINVAL;
mcfg = (struct acpi_table_mcfg *) __acpi_map_table(phys_addr, size);
mcfg = (struct acpi_table_mcfg *)__acpi_map_table(phys_addr, size);
if (!mcfg) {
printk(KERN_WARNING PREFIX "Unable to map MCFG\n");
return -ENODEV;
......@@ -212,17 +218,14 @@ int __init acpi_parse_mcfg(unsigned long phys_addr, unsigned long size)
#endif /* CONFIG_PCI_MMCONFIG */
#ifdef CONFIG_X86_LOCAL_APIC
static int __init
acpi_parse_madt (
unsigned long phys_addr,
unsigned long size)
static int __init acpi_parse_madt(unsigned long phys_addr, unsigned long size)
{
struct acpi_table_madt *madt = NULL;
if (!phys_addr || !size)
return -EINVAL;
madt = (struct acpi_table_madt *) __acpi_map_table(phys_addr, size);
madt = (struct acpi_table_madt *)__acpi_map_table(phys_addr, size);
if (!madt) {
printk(KERN_WARNING PREFIX "Unable to map MADT\n");
return -ENODEV;
......@@ -240,14 +243,12 @@ acpi_parse_madt (
return 0;
}
static int __init
acpi_parse_lapic (
acpi_table_entry_header *header, const unsigned long end)
acpi_parse_lapic(acpi_table_entry_header * header, const unsigned long end)
{
struct acpi_table_lapic *processor = NULL;
processor = (struct acpi_table_lapic*) header;
processor = (struct acpi_table_lapic *)header;
if (BAD_MADT_ENTRY(processor, end))
return -EINVAL;
......@@ -260,20 +261,19 @@ acpi_parse_lapic (
x86_acpiid_to_apicid[processor->acpi_id] = processor->id;
mp_register_lapic (
processor->id, /* APIC ID */
mp_register_lapic(processor->id, /* APIC ID */
processor->flags.enabled); /* Enabled? */
return 0;
}
static int __init
acpi_parse_lapic_addr_ovr (
acpi_table_entry_header *header, const unsigned long end)
acpi_parse_lapic_addr_ovr(acpi_table_entry_header * header,
const unsigned long end)
{
struct acpi_table_lapic_addr_ovr *lapic_addr_ovr = NULL;
lapic_addr_ovr = (struct acpi_table_lapic_addr_ovr*) header;
lapic_addr_ovr = (struct acpi_table_lapic_addr_ovr *)header;
if (BAD_MADT_ENTRY(lapic_addr_ovr, end))
return -EINVAL;
......@@ -284,12 +284,11 @@ acpi_parse_lapic_addr_ovr (
}
static int __init
acpi_parse_lapic_nmi (
acpi_table_entry_header *header, const unsigned long end)
acpi_parse_lapic_nmi(acpi_table_entry_header * header, const unsigned long end)
{
struct acpi_table_lapic_nmi *lapic_nmi = NULL;
lapic_nmi = (struct acpi_table_lapic_nmi*) header;
lapic_nmi = (struct acpi_table_lapic_nmi *)header;
if (BAD_MADT_ENTRY(lapic_nmi, end))
return -EINVAL;
......@@ -302,28 +301,24 @@ acpi_parse_lapic_nmi (
return 0;
}
#endif /*CONFIG_X86_LOCAL_APIC*/
#endif /*CONFIG_X86_LOCAL_APIC */
#if defined(CONFIG_X86_IO_APIC) && defined(CONFIG_ACPI_INTERPRETER)
static int __init
acpi_parse_ioapic (
acpi_table_entry_header *header, const unsigned long end)
acpi_parse_ioapic(acpi_table_entry_header * header, const unsigned long end)
{
struct acpi_table_ioapic *ioapic = NULL;
ioapic = (struct acpi_table_ioapic*) header;
ioapic = (struct acpi_table_ioapic *)header;
if (BAD_MADT_ENTRY(ioapic, end))
return -EINVAL;
acpi_table_print_madt_entry(header);
mp_register_ioapic (
ioapic->id,
ioapic->address,
ioapic->global_irq_base);
mp_register_ioapic(ioapic->id,
ioapic->address, ioapic->global_irq_base);
return 0;
}
......@@ -331,8 +326,7 @@ acpi_parse_ioapic (
/*
* Parse Interrupt Source Override for the ACPI SCI
*/
static void
acpi_sci_ioapic_setup(u32 gsi, u16 polarity, u16 trigger)
static void acpi_sci_ioapic_setup(u32 gsi, u16 polarity, u16 trigger)
{
if (trigger == 0) /* compatible SCI trigger is level */
trigger = 3;
......@@ -363,12 +357,12 @@ acpi_sci_ioapic_setup(u32 gsi, u16 polarity, u16 trigger)
}
static int __init
acpi_parse_int_src_ovr (
acpi_table_entry_header *header, const unsigned long end)
acpi_parse_int_src_ovr(acpi_table_entry_header * header,
const unsigned long end)
{
struct acpi_table_int_src_ovr *intsrc = NULL;
intsrc = (struct acpi_table_int_src_ovr*) header;
intsrc = (struct acpi_table_int_src_ovr *)header;
if (BAD_MADT_ENTRY(intsrc, end))
return -EINVAL;
......@@ -377,7 +371,8 @@ acpi_parse_int_src_ovr (
if (intsrc->bus_irq == acpi_fadt.sci_int) {
acpi_sci_ioapic_setup(intsrc->global_irq,
intsrc->flags.polarity, intsrc->flags.trigger);
intsrc->flags.polarity,
intsrc->flags.trigger);
return 0;
}
......@@ -387,23 +382,19 @@ acpi_parse_int_src_ovr (
return 0;
}
mp_override_legacy_irq (
intsrc->bus_irq,
mp_override_legacy_irq(intsrc->bus_irq,
intsrc->flags.polarity,
intsrc->flags.trigger,
intsrc->global_irq);
intsrc->flags.trigger, intsrc->global_irq);
return 0;
}
static int __init
acpi_parse_nmi_src (
acpi_table_entry_header *header, const unsigned long end)
acpi_parse_nmi_src(acpi_table_entry_header * header, const unsigned long end)
{
struct acpi_table_nmi_src *nmi_src = NULL;
nmi_src = (struct acpi_table_nmi_src*) header;
nmi_src = (struct acpi_table_nmi_src *)header;
if (BAD_MADT_ENTRY(nmi_src, end))
return -EINVAL;
......@@ -433,8 +424,7 @@ acpi_parse_nmi_src (
* ECLR2 is IRQ's 8-15 (IRQ 8, 13 must be 0)
*/
void __init
acpi_pic_sci_set_trigger(unsigned int irq, u16 trigger)
void __init acpi_pic_sci_set_trigger(unsigned int irq, u16 trigger)
{
unsigned int mask = 1 << irq;
unsigned int old, new;
......@@ -470,7 +460,6 @@ acpi_pic_sci_set_trigger(unsigned int irq, u16 trigger)
outb(new >> 8, 0x4d1);
}
#endif /* CONFIG_ACPI_BUS */
int acpi_gsi_to_irq(u32 gsi, unsigned int *irq)
......@@ -513,50 +502,48 @@ int acpi_register_gsi(u32 gsi, int edge_level, int active_high_low)
acpi_gsi_to_irq(plat_gsi, &irq);
return irq;
}
EXPORT_SYMBOL(acpi_register_gsi);
/*
* ACPI based hotplug support for CPU
*/
#ifdef CONFIG_ACPI_HOTPLUG_CPU
int
acpi_map_lsapic(acpi_handle handle, int *pcpu)
int acpi_map_lsapic(acpi_handle handle, int *pcpu)
{
/* TBD */
return -EINVAL;
}
EXPORT_SYMBOL(acpi_map_lsapic);
EXPORT_SYMBOL(acpi_map_lsapic);
int
acpi_unmap_lsapic(int cpu)
int acpi_unmap_lsapic(int cpu)
{
/* TBD */
return -EINVAL;
}
EXPORT_SYMBOL(acpi_unmap_lsapic);
#endif /* CONFIG_ACPI_HOTPLUG_CPU */
int
acpi_register_ioapic(acpi_handle handle, u64 phys_addr, u32 gsi_base)
int acpi_register_ioapic(acpi_handle handle, u64 phys_addr, u32 gsi_base)
{
/* TBD */
return -EINVAL;
}
EXPORT_SYMBOL(acpi_register_ioapic);
int
acpi_unregister_ioapic(acpi_handle handle, u32 gsi_base)
int acpi_unregister_ioapic(acpi_handle handle, u32 gsi_base)
{
/* TBD */
return -EINVAL;
}
EXPORT_SYMBOL(acpi_unregister_ioapic);
static unsigned long __init
acpi_scan_rsdp (
unsigned long start,
unsigned long length)
acpi_scan_rsdp(unsigned long start, unsigned long length)
{
unsigned long offset = 0;
unsigned long sig_len = sizeof("RSD PTR ") - 1;
......@@ -566,7 +553,7 @@ acpi_scan_rsdp (
* RSDP signature.
*/
for (offset = 0; offset < length; offset += 16) {
if (strncmp((char *) (start + offset), "RSD PTR ", sig_len))
if (strncmp((char *)(start + offset), "RSD PTR ", sig_len))
continue;
return (start + offset);
}
......@@ -581,7 +568,7 @@ static int __init acpi_parse_sbf(unsigned long phys_addr, unsigned long size)
if (!phys_addr || !size)
return -EINVAL;
sb = (struct acpi_table_sbf *) __acpi_map_table(phys_addr, size);
sb = (struct acpi_table_sbf *)__acpi_map_table(phys_addr, size);
if (!sb) {
printk(KERN_WARNING PREFIX "Unable to map SBF\n");
return -ENODEV;
......@@ -592,7 +579,6 @@ static int __init acpi_parse_sbf(unsigned long phys_addr, unsigned long size)
return 0;
}
#ifdef CONFIG_HPET_TIMER
static int __init acpi_parse_hpet(unsigned long phys, unsigned long size)
......@@ -602,7 +588,7 @@ static int __init acpi_parse_hpet(unsigned long phys, unsigned long size)
if (!phys || !size)
return -EINVAL;
hpet_tbl = (struct acpi_table_hpet *) __acpi_map_table(phys, size);
hpet_tbl = (struct acpi_table_hpet *)__acpi_map_table(phys, size);
if (!hpet_tbl) {
printk(KERN_WARNING PREFIX "Unable to map HPET\n");
return -ENODEV;
......@@ -613,10 +599,9 @@ static int __init acpi_parse_hpet(unsigned long phys, unsigned long size)
"memory.\n");
return -1;
}
#ifdef CONFIG_X86_64
vxtime.hpet_address = hpet_tbl->addr.addrl |
((long) hpet_tbl->addr.addrh << 32);
((long)hpet_tbl->addr.addrh << 32);
printk(KERN_INFO PREFIX "HPET id: %#x base: %#lx\n",
hpet_tbl->id, vxtime.hpet_address);
......@@ -644,12 +629,11 @@ static int __init acpi_parse_fadt(unsigned long phys, unsigned long size)
{
struct fadt_descriptor_rev2 *fadt = NULL;
fadt = (struct fadt_descriptor_rev2*) __acpi_map_table(phys,size);
if(!fadt) {
fadt = (struct fadt_descriptor_rev2 *)__acpi_map_table(phys, size);
if (!fadt) {
printk(KERN_WARNING PREFIX "Unable to map FADT\n");
return 0;
}
#ifdef CONFIG_ACPI_INTERPRETER
/* initialize sci_int early for INT_SRC_OVR MADT parsing */
acpi_fadt.sci_int = fadt->sci_int;
......@@ -658,14 +642,16 @@ static int __init acpi_parse_fadt(unsigned long phys, unsigned long size)
#ifdef CONFIG_ACPI_BUS
/* initialize rev and apic_phys_dest_mode for x86_64 genapic */
acpi_fadt.revision = fadt->revision;
acpi_fadt.force_apic_physical_destination_mode = fadt->force_apic_physical_destination_mode;
acpi_fadt.force_apic_physical_destination_mode =
fadt->force_apic_physical_destination_mode;
#endif
#ifdef CONFIG_X86_PM_TIMER
/* detect the location of the ACPI PM Timer */
if (fadt->revision >= FADT2_REVISION_ID) {
/* FADT rev. 2 */
if (fadt->xpm_tmr_blk.address_space_id != ACPI_ADR_SPACE_SYSTEM_IO)
if (fadt->xpm_tmr_blk.address_space_id !=
ACPI_ADR_SPACE_SYSTEM_IO)
return 0;
pmtmr_ioport = fadt->xpm_tmr_blk.address;
......@@ -674,14 +660,13 @@ static int __init acpi_parse_fadt(unsigned long phys, unsigned long size)
pmtmr_ioport = fadt->V1_pm_tmr_blk;
}
if (pmtmr_ioport)
printk(KERN_INFO PREFIX "PM-Timer IO Port: %#x\n", pmtmr_ioport);
printk(KERN_INFO PREFIX "PM-Timer IO Port: %#x\n",
pmtmr_ioport);
#endif
return 0;
}
unsigned long __init
acpi_find_rsdp (void)
unsigned long __init acpi_find_rsdp(void)
{
unsigned long rsdp_phys = 0;
......@@ -695,9 +680,9 @@ acpi_find_rsdp (void)
* Scan memory looking for the RSDP signature. First search EBDA (low
* memory) paragraphs and then search upper memory (E0000-FFFFF).
*/
rsdp_phys = acpi_scan_rsdp (0, 0x400);
rsdp_phys = acpi_scan_rsdp(0, 0x400);
if (!rsdp_phys)
rsdp_phys = acpi_scan_rsdp (0xE0000, 0x20000);
rsdp_phys = acpi_scan_rsdp(0xE0000, 0x20000);
return rsdp_phys;
}
......@@ -707,8 +692,7 @@ acpi_find_rsdp (void)
* Parse LAPIC entries in MADT
* returns 0 on success, < 0 on error
*/
static int __init
acpi_parse_madt_lapic_entries(void)
static int __init acpi_parse_madt_lapic_entries(void)
{
int count;
......@@ -717,9 +701,12 @@ acpi_parse_madt_lapic_entries(void)
* and (optionally) overriden by a LAPIC_ADDR_OVR entry (64-bit value).
*/
count = acpi_table_parse_madt(ACPI_MADT_LAPIC_ADDR_OVR, acpi_parse_lapic_addr_ovr, 0);
count =
acpi_table_parse_madt(ACPI_MADT_LAPIC_ADDR_OVR,
acpi_parse_lapic_addr_ovr, 0);
if (count < 0) {
printk(KERN_ERR PREFIX "Error parsing LAPIC address override entry\n");
printk(KERN_ERR PREFIX
"Error parsing LAPIC address override entry\n");
return count;
}
......@@ -731,14 +718,14 @@ acpi_parse_madt_lapic_entries(void)
printk(KERN_ERR PREFIX "No LAPIC entries present\n");
/* TBD: Cleanup to allow fallback to MPS */
return -ENODEV;
}
else if (count < 0) {
} else if (count < 0) {
printk(KERN_ERR PREFIX "Error parsing LAPIC entry\n");
/* TBD: Cleanup to allow fallback to MPS */
return count;
}
count = acpi_table_parse_madt(ACPI_MADT_LAPIC_NMI, acpi_parse_lapic_nmi, 0);
count =
acpi_table_parse_madt(ACPI_MADT_LAPIC_NMI, acpi_parse_lapic_nmi, 0);
if (count < 0) {
printk(KERN_ERR PREFIX "Error parsing LAPIC NMI entry\n");
/* TBD: Cleanup to allow fallback to MPS */
......@@ -753,8 +740,7 @@ acpi_parse_madt_lapic_entries(void)
* Parse IOAPIC related entries in MADT
* returns 0 on success, < 0 on error
*/
static int __init
acpi_parse_madt_ioapic_entries(void)
static int __init acpi_parse_madt_ioapic_entries(void)
{
int count;
......@@ -777,19 +763,23 @@ acpi_parse_madt_ioapic_entries(void)
return -ENODEV;
}
count = acpi_table_parse_madt(ACPI_MADT_IOAPIC, acpi_parse_ioapic, MAX_IO_APICS);
count =
acpi_table_parse_madt(ACPI_MADT_IOAPIC, acpi_parse_ioapic,
MAX_IO_APICS);
if (!count) {
printk(KERN_ERR PREFIX "No IOAPIC entries present\n");
return -ENODEV;
}
else if (count < 0) {
} else if (count < 0) {
printk(KERN_ERR PREFIX "Error parsing IOAPIC entry\n");
return count;
}
count = acpi_table_parse_madt(ACPI_MADT_INT_SRC_OVR, acpi_parse_int_src_ovr, NR_IRQ_VECTORS);
count =
acpi_table_parse_madt(ACPI_MADT_INT_SRC_OVR, acpi_parse_int_src_ovr,
NR_IRQ_VECTORS);
if (count < 0) {
printk(KERN_ERR PREFIX "Error parsing interrupt source overrides entry\n");
printk(KERN_ERR PREFIX
"Error parsing interrupt source overrides entry\n");
/* TBD: Cleanup to allow fallback to MPS */
return count;
}
......@@ -804,7 +794,9 @@ acpi_parse_madt_ioapic_entries(void)
/* Fill in identity legacy mapings where no override */
mp_config_acpi_legacy_irqs();
count = acpi_table_parse_madt(ACPI_MADT_NMI_SRC, acpi_parse_nmi_src, NR_IRQ_VECTORS);
count =
acpi_table_parse_madt(ACPI_MADT_NMI_SRC, acpi_parse_nmi_src,
NR_IRQ_VECTORS);
if (count < 0) {
printk(KERN_ERR PREFIX "Error parsing NMI SRC entry\n");
/* TBD: Cleanup to allow fallback to MPS */
......@@ -820,9 +812,7 @@ static inline int acpi_parse_madt_ioapic_entries(void)
}
#endif /* !(CONFIG_X86_IO_APIC && CONFIG_ACPI_INTERPRETER) */
static void __init
acpi_process_madt(void)
static void __init acpi_process_madt(void)
{
#ifdef CONFIG_X86_LOCAL_APIC
int count, error;
......@@ -854,7 +844,8 @@ acpi_process_madt(void)
/*
* Dell Precision Workstation 410, 610 come here.
*/
printk(KERN_ERR PREFIX "Invalid BIOS MADT, disabling ACPI\n");
printk(KERN_ERR PREFIX
"Invalid BIOS MADT, disabling ACPI\n");
disable_acpi();
}
}
......@@ -891,7 +882,7 @@ static int __init disable_acpi_pci(struct dmi_system_id *d)
static int __init dmi_disable_acpi(struct dmi_system_id *d)
{
if (!acpi_force) {
printk(KERN_NOTICE "%s detected: acpi off\n",d->ident);
printk(KERN_NOTICE "%s detected: acpi off\n", d->ident);
disable_acpi();
} else {
printk(KERN_NOTICE
......@@ -906,7 +897,8 @@ static int __init dmi_disable_acpi(struct dmi_system_id *d)
static int __init force_acpi_ht(struct dmi_system_id *d)
{
if (!acpi_force) {
printk(KERN_NOTICE "%s detected: force use of acpi=ht\n", d->ident);
printk(KERN_NOTICE "%s detected: force use of acpi=ht\n",
d->ident);
disable_acpi();
acpi_ht = 1;
} else {
......@@ -1044,7 +1036,8 @@ static struct dmi_system_id __initdata acpi_dmi_table[] = {
DMI_MATCH(DMI_BOARD_VENDOR, "ASUSTeK Computer INC"),
DMI_MATCH(DMI_BOARD_NAME, "<A7V>"),
/* newer BIOS, Revision 1011, does work */
DMI_MATCH(DMI_BIOS_VERSION, "ASUS A7V ACPI BIOS Revision 1007"),
DMI_MATCH(DMI_BIOS_VERSION,
"ASUS A7V ACPI BIOS Revision 1007"),
},
},
......@@ -1057,7 +1050,8 @@ static struct dmi_system_id __initdata acpi_dmi_table[] = {
.matches = {
DMI_MATCH(DMI_BOARD_VENDOR, "ASUSTeK Computer INC."),
DMI_MATCH(DMI_BOARD_NAME, "PR-DLS"),
DMI_MATCH(DMI_BIOS_VERSION, "ASUS PR-DLS ACPI BIOS Revision 1010"),
DMI_MATCH(DMI_BIOS_VERSION,
"ASUS PR-DLS ACPI BIOS Revision 1010"),
DMI_MATCH(DMI_BIOS_DATE, "03/21/2003")
},
},
......@@ -1070,7 +1064,7 @@ static struct dmi_system_id __initdata acpi_dmi_table[] = {
},
},
#endif
{ }
{}
};
#endif /* __i386__ */
......@@ -1098,8 +1092,7 @@ static struct dmi_system_id __initdata acpi_dmi_table[] = {
* !0: failure
*/
int __init
acpi_boot_table_init(void)
int __init acpi_boot_table_init(void)
{
int error;
......@@ -1122,7 +1115,6 @@ acpi_boot_table_init(void)
disable_acpi();
return error;
}
#ifdef __i386__
check_acpi_pci();
#endif
......@@ -1146,7 +1138,6 @@ acpi_boot_table_init(void)
return 0;
}
int __init acpi_boot_init(void)
{
/*
......@@ -1172,4 +1163,3 @@ int __init acpi_boot_init(void)
return 0;
}
......@@ -20,7 +20,7 @@ static int __init check_bridge(int vendor, int device)
void __init check_acpi_pci(void)
{
int num,slot,func;
int num, slot, func;
/* Assume the machine supports type 1. If not it will
always read ffffffff and should not have any side effect. */
......@@ -31,7 +31,7 @@ void __init check_acpi_pci(void)
for (func = 0; func < 8; func++) {
u32 class;
u32 vendor;
class = read_pci_config(num,slot,func,
class = read_pci_config(num, slot, func,
PCI_CLASS_REVISION);
if (class == 0xffffffff)
break;
......@@ -42,7 +42,7 @@ void __init check_acpi_pci(void)
vendor = read_pci_config(num, slot, func,
PCI_VENDOR_ID);
if (check_bridge(vendor&0xffff, vendor >> 16))
if (check_bridge(vendor & 0xffff, vendor >> 16))
return;
}
......
......@@ -20,12 +20,13 @@ extern void zap_low_mappings(void);
extern unsigned long FASTCALL(acpi_copy_wakeup_routine(unsigned long));
static void init_low_mapping(pgd_t *pgd, int pgd_limit)
static void init_low_mapping(pgd_t * pgd, int pgd_limit)
{
int pgd_ofs = 0;
while ((pgd_ofs < pgd_limit) && (pgd_ofs + USER_PTRS_PER_PGD < PTRS_PER_PGD)) {
set_pgd(pgd, *(pgd+USER_PTRS_PER_PGD));
while ((pgd_ofs < pgd_limit)
&& (pgd_ofs + USER_PTRS_PER_PGD < PTRS_PER_PGD)) {
set_pgd(pgd, *(pgd + USER_PTRS_PER_PGD));
pgd_ofs++, pgd++;
}
flush_tlb_all();
......@@ -37,12 +38,13 @@ static void init_low_mapping(pgd_t *pgd, int pgd_limit)
* Create an identity mapped page table and copy the wakeup routine to
* low memory.
*/
int acpi_save_state_mem (void)
int acpi_save_state_mem(void)
{
if (!acpi_wakeup_address)
return 1;
init_low_mapping(swapper_pg_dir, USER_PTRS_PER_PGD);
memcpy((void *) acpi_wakeup_address, &wakeup_start, &wakeup_end - &wakeup_start);
memcpy((void *)acpi_wakeup_address, &wakeup_start,
&wakeup_end - &wakeup_start);
acpi_copy_wakeup_routine(acpi_wakeup_address);
return 0;
......@@ -51,7 +53,7 @@ int acpi_save_state_mem (void)
/*
* acpi_restore_state - undo effects of acpi_save_state_mem
*/
void acpi_restore_state_mem (void)
void acpi_restore_state_mem(void)
{
zap_low_mappings();
}
......@@ -67,7 +69,8 @@ void acpi_restore_state_mem (void)
void __init acpi_reserve_bootmem(void)
{
if ((&wakeup_end - &wakeup_start) > PAGE_SIZE) {
printk(KERN_ERR "ACPI: Wakeup code way too big, S3 disabled.\n");
printk(KERN_ERR
"ACPI: Wakeup code way too big, S3 disabled.\n");
return;
}
......@@ -90,10 +93,8 @@ static int __init acpi_sleep_setup(char *str)
return 1;
}
__setup("acpi_sleep=", acpi_sleep_setup);
static __init int reset_videomode_after_s3(struct dmi_system_id *d)
{
acpi_video_flags |= 2;
......@@ -108,7 +109,7 @@ static __initdata struct dmi_system_id acpisleep_dmi_table[] = {
DMI_MATCH(DMI_PRODUCT_NAME, "S4030CDT/4.3"),
},
},
{ }
{}
};
static int __init acpisleep_dmi_init(void)
......
......@@ -30,7 +30,7 @@ struct acpi_vendor_info {
acpi_status
acpi_vendor_resource_match(struct acpi_resource *resource, void *context)
{
struct acpi_vendor_info *info = (struct acpi_vendor_info *) context;
struct acpi_vendor_info *info = (struct acpi_vendor_info *)context;
struct acpi_resource_vendor *vendor;
struct acpi_vendor_descriptor *descriptor;
u32 length;
......@@ -38,8 +38,8 @@ acpi_vendor_resource_match(struct acpi_resource *resource, void *context)
if (resource->id != ACPI_RSTYPE_VENDOR)
return AE_OK;
vendor = (struct acpi_resource_vendor *) &resource->data;
descriptor = (struct acpi_vendor_descriptor *) vendor->reserved;
vendor = (struct acpi_resource_vendor *)&resource->data;
descriptor = (struct acpi_vendor_descriptor *)vendor->reserved;
if (vendor->length <= sizeof(*info->descriptor) ||
descriptor->guid_id != info->descriptor->guid_id ||
efi_guidcmp(descriptor->guid, info->descriptor->guid))
......@@ -50,21 +50,24 @@ acpi_vendor_resource_match(struct acpi_resource *resource, void *context)
if (!info->data)
return AE_NO_MEMORY;
memcpy(info->data, vendor->reserved + sizeof(struct acpi_vendor_descriptor), length);
memcpy(info->data,
vendor->reserved + sizeof(struct acpi_vendor_descriptor),
length);
info->length = length;
return AE_CTRL_TERMINATE;
}
acpi_status
acpi_find_vendor_resource(acpi_handle obj, struct acpi_vendor_descriptor *id,
u8 **data, u32 *length)
acpi_find_vendor_resource(acpi_handle obj, struct acpi_vendor_descriptor * id,
u8 ** data, u32 * length)
{
struct acpi_vendor_info info;
info.descriptor = id;
info.data = NULL;
acpi_walk_resources(obj, METHOD_NAME__CRS, acpi_vendor_resource_match, &info);
acpi_walk_resources(obj, METHOD_NAME__CRS, acpi_vendor_resource_match,
&info);
if (!info.data)
return AE_NOT_FOUND;
......@@ -75,17 +78,19 @@ acpi_find_vendor_resource(acpi_handle obj, struct acpi_vendor_descriptor *id,
struct acpi_vendor_descriptor hp_ccsr_descriptor = {
.guid_id = 2,
.guid = EFI_GUID(0x69e9adf9, 0x924f, 0xab5f, 0xf6, 0x4a, 0x24, 0xd2, 0x01, 0x37, 0x0e, 0xad)
.guid =
EFI_GUID(0x69e9adf9, 0x924f, 0xab5f, 0xf6, 0x4a, 0x24, 0xd2, 0x01,
0x37, 0x0e, 0xad)
};
acpi_status
hp_acpi_csr_space(acpi_handle obj, u64 *csr_base, u64 *csr_length)
acpi_status hp_acpi_csr_space(acpi_handle obj, u64 * csr_base, u64 * csr_length)
{
acpi_status status;
u8 *data;
u32 length;
status = acpi_find_vendor_resource(obj, &hp_ccsr_descriptor, &data, &length);
status =
acpi_find_vendor_resource(obj, &hp_ccsr_descriptor, &data, &length);
if (ACPI_FAILURE(status) || length != 16)
return AE_NOT_FOUND;
......
此差异已折叠。
......@@ -47,7 +47,6 @@
#include <asm/proto.h>
#include <asm/tlbflush.h>
/* --------------------------------------------------------------------------
Low-Level Sleep Support
-------------------------------------------------------------------------- */
......@@ -77,11 +76,12 @@ static void init_low_mapping(void)
* Create an identity mapped page table and copy the wakeup routine to
* low memory.
*/
int acpi_save_state_mem (void)
int acpi_save_state_mem(void)
{
init_low_mapping();
memcpy((void *) acpi_wakeup_address, &wakeup_start, &wakeup_end - &wakeup_start);
memcpy((void *)acpi_wakeup_address, &wakeup_start,
&wakeup_end - &wakeup_start);
acpi_copy_wakeup_routine(acpi_wakeup_address);
return 0;
......@@ -90,7 +90,7 @@ int acpi_save_state_mem (void)
/*
* acpi_restore_state
*/
void acpi_restore_state_mem (void)
void acpi_restore_state_mem(void)
{
set_pgd(pgd_offset(current->mm, 0UL), low_ptr);
flush_tlb_all();
......@@ -108,7 +108,8 @@ void __init acpi_reserve_bootmem(void)
{
acpi_wakeup_address = (unsigned long)alloc_bootmem_low(PAGE_SIZE);
if ((&wakeup_end - &wakeup_start) > PAGE_SIZE)
printk(KERN_CRIT "ACPI: Wakeup code way too big, will crash on attempt to suspend\n");
printk(KERN_CRIT
"ACPI: Wakeup code way too big, will crash on attempt to suspend\n");
}
static int __init acpi_sleep_setup(char *str)
......@@ -127,6 +128,8 @@ static int __init acpi_sleep_setup(char *str)
__setup("acpi_sleep=", acpi_sleep_setup);
#endif /*CONFIG_ACPI_SLEEP*/
#endif /*CONFIG_ACPI_SLEEP */
void acpi_pci_link_exit(void) {}
void acpi_pci_link_exit(void)
{
}
......@@ -32,7 +32,6 @@
#include <acpi/acpi_bus.h>
#include <acpi/acpi_drivers.h>
#define ACPI_AC_COMPONENT 0x00020000
#define ACPI_AC_CLASS "ac_adapter"
#define ACPI_AC_HID "ACPI0003"
......@@ -45,14 +44,14 @@
#define ACPI_AC_STATUS_UNKNOWN 0xFF
#define _COMPONENT ACPI_AC_COMPONENT
ACPI_MODULE_NAME ("acpi_ac")
ACPI_MODULE_NAME("acpi_ac")
MODULE_AUTHOR("Paul Diefenbaugh");
MODULE_AUTHOR("Paul Diefenbaugh");
MODULE_DESCRIPTION(ACPI_AC_DRIVER_NAME);
MODULE_LICENSE("GPL");
static int acpi_ac_add (struct acpi_device *device);
static int acpi_ac_remove (struct acpi_device *device, int type);
static int acpi_ac_add(struct acpi_device *device);
static int acpi_ac_remove(struct acpi_device *device, int type);
static int acpi_ac_open_fs(struct inode *inode, struct file *file);
static struct acpi_driver acpi_ac_driver = {
......@@ -81,9 +80,7 @@ static struct file_operations acpi_ac_fops = {
AC Adapter Management
-------------------------------------------------------------------------- */
static int
acpi_ac_get_state (
struct acpi_ac *ac)
static int acpi_ac_get_state(struct acpi_ac *ac)
{
acpi_status status = AE_OK;
......@@ -103,7 +100,6 @@ acpi_ac_get_state (
return_VALUE(0);
}
/* --------------------------------------------------------------------------
FS Interface (/proc)
-------------------------------------------------------------------------- */
......@@ -112,7 +108,7 @@ static struct proc_dir_entry *acpi_ac_dir;
static int acpi_ac_seq_show(struct seq_file *seq, void *offset)
{
struct acpi_ac *ac = (struct acpi_ac *) seq->private;
struct acpi_ac *ac = (struct acpi_ac *)seq->private;
ACPI_FUNCTION_TRACE("acpi_ac_seq_show");
......@@ -145,9 +141,7 @@ static int acpi_ac_open_fs(struct inode *inode, struct file *file)
return single_open(file, acpi_ac_seq_show, PDE(inode)->data);
}
static int
acpi_ac_add_fs (
struct acpi_device *device)
static int acpi_ac_add_fs(struct acpi_device *device)
{
struct proc_dir_entry *entry = NULL;
......@@ -177,16 +171,12 @@ acpi_ac_add_fs (
return_VALUE(0);
}
static int
acpi_ac_remove_fs (
struct acpi_device *device)
static int acpi_ac_remove_fs(struct acpi_device *device)
{
ACPI_FUNCTION_TRACE("acpi_ac_remove_fs");
if (acpi_device_dir(device)) {
remove_proc_entry(ACPI_AC_FILE_STATE,
acpi_device_dir(device));
remove_proc_entry(ACPI_AC_FILE_STATE, acpi_device_dir(device));
remove_proc_entry(acpi_device_bid(device), acpi_ac_dir);
acpi_device_dir(device) = NULL;
......@@ -195,18 +185,13 @@ acpi_ac_remove_fs (
return_VALUE(0);
}
/* --------------------------------------------------------------------------
Driver Model
-------------------------------------------------------------------------- */
static void
acpi_ac_notify (
acpi_handle handle,
u32 event,
void *data)
static void acpi_ac_notify(acpi_handle handle, u32 event, void *data)
{
struct acpi_ac *ac = (struct acpi_ac *) data;
struct acpi_ac *ac = (struct acpi_ac *)data;
struct acpi_device *device = NULL;
ACPI_FUNCTION_TRACE("acpi_ac_notify");
......@@ -231,10 +216,7 @@ acpi_ac_notify (
return_VOID;
}
static int
acpi_ac_add (
struct acpi_device *device)
static int acpi_ac_add(struct acpi_device *device)
{
int result = 0;
acpi_status status = AE_OK;
......@@ -264,7 +246,8 @@ acpi_ac_add (
goto end;
status = acpi_install_notify_handler(ac->handle,
ACPI_DEVICE_NOTIFY, acpi_ac_notify, ac);
ACPI_DEVICE_NOTIFY, acpi_ac_notify,
ac);
if (ACPI_FAILURE(status)) {
ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
"Error installing notify handler\n"));
......@@ -274,9 +257,9 @@ acpi_ac_add (
printk(KERN_INFO PREFIX "%s [%s] (%s)\n",
acpi_device_name(device), acpi_device_bid(device),
ac->state?"on-line":"off-line");
ac->state ? "on-line" : "off-line");
end:
end:
if (result) {
acpi_ac_remove_fs(device);
kfree(ac);
......@@ -285,11 +268,7 @@ acpi_ac_add (
return_VALUE(result);
}
static int
acpi_ac_remove (
struct acpi_device *device,
int type)
static int acpi_ac_remove(struct acpi_device *device, int type)
{
acpi_status status = AE_OK;
struct acpi_ac *ac = NULL;
......@@ -299,7 +278,7 @@ acpi_ac_remove (
if (!device || !acpi_driver_data(device))
return_VALUE(-EINVAL);
ac = (struct acpi_ac *) acpi_driver_data(device);
ac = (struct acpi_ac *)acpi_driver_data(device);
status = acpi_remove_notify_handler(ac->handle,
ACPI_DEVICE_NOTIFY, acpi_ac_notify);
......@@ -314,9 +293,7 @@ acpi_ac_remove (
return_VALUE(0);
}
static int __init
acpi_ac_init (void)
static int __init acpi_ac_init(void)
{
int result = 0;
......@@ -336,9 +313,7 @@ acpi_ac_init (void)
return_VALUE(0);
}
static void __exit
acpi_ac_exit (void)
static void __exit acpi_ac_exit(void)
{
ACPI_FUNCTION_TRACE("acpi_ac_exit");
......@@ -349,6 +324,5 @@ acpi_ac_exit (void)
return_VOID;
}
module_init(acpi_ac_init);
module_exit(acpi_ac_exit);
......@@ -32,7 +32,6 @@
#include <linux/memory_hotplug.h>
#include <acpi/acpi_drivers.h>
#define ACPI_MEMORY_DEVICE_COMPONENT 0x08000000UL
#define ACPI_MEMORY_DEVICE_CLASS "memory"
#define ACPI_MEMORY_DEVICE_HID "PNP0C80"
......@@ -41,8 +40,8 @@
#define _COMPONENT ACPI_MEMORY_DEVICE_COMPONENT
ACPI_MODULE_NAME ("acpi_memory")
MODULE_AUTHOR("Naveen B S <naveen.b.s@intel.com>");
ACPI_MODULE_NAME("acpi_memory")
MODULE_AUTHOR("Naveen B S <naveen.b.s@intel.com>");
MODULE_DESCRIPTION(ACPI_MEMORY_DEVICE_DRIVER_NAME);
MODULE_LICENSE("GPL");
......@@ -56,8 +55,8 @@ MODULE_LICENSE("GPL");
#define MEMORY_POWER_ON_STATE 1
#define MEMORY_POWER_OFF_STATE 2
static int acpi_memory_device_add (struct acpi_device *device);
static int acpi_memory_device_remove (struct acpi_device *device, int type);
static int acpi_memory_device_add(struct acpi_device *device);
static int acpi_memory_device_remove(struct acpi_device *device, int type);
static struct acpi_driver acpi_memory_device_driver = {
.name = ACPI_MEMORY_DEVICE_DRIVER_NAME,
......@@ -73,17 +72,16 @@ struct acpi_memory_device {
acpi_handle handle;
unsigned int state; /* State of the memory device */
unsigned short cache_attribute; /* memory cache attribute */
unsigned short read_write_attribute;/* memory read/write attribute */
unsigned short read_write_attribute; /* memory read/write attribute */
u64 start_addr; /* Memory Range start physical addr */
u64 end_addr; /* Memory Range end physical addr */
};
static int
acpi_memory_get_device_resources(struct acpi_memory_device *mem_device)
{
acpi_status status;
struct acpi_buffer buffer = {ACPI_ALLOCATE_BUFFER, NULL};
struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL };
struct acpi_resource *resource = NULL;
struct acpi_resource_address64 address64;
......@@ -94,7 +92,7 @@ acpi_memory_get_device_resources(struct acpi_memory_device *mem_device)
if (ACPI_FAILURE(status))
return_VALUE(-EINVAL);
resource = (struct acpi_resource *) buffer.pointer;
resource = (struct acpi_resource *)buffer.pointer;
status = acpi_resource_to_address64(resource, &address64);
if (ACPI_SUCCESS(status)) {
if (address64.resource_type == ACPI_MEMORY_RANGE) {
......@@ -128,8 +126,7 @@ acpi_memory_get_device(acpi_handle handle,
status = acpi_get_parent(handle, &phandle);
if (ACPI_FAILURE(status)) {
ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
"Error in acpi_get_parent\n"));
ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Error in acpi_get_parent\n"));
return_VALUE(-EINVAL);
}
......@@ -147,23 +144,21 @@ acpi_memory_get_device(acpi_handle handle,
*/
status = acpi_bus_add(&device, pdevice, handle, ACPI_BUS_TYPE_DEVICE);
if (ACPI_FAILURE(status)) {
ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
"Error in acpi_bus_add\n"));
ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Error in acpi_bus_add\n"));
return_VALUE(-EINVAL);
}
end:
end:
*mem_device = acpi_driver_data(device);
if (!(*mem_device)) {
printk(KERN_ERR "\n driver data not found" );
printk(KERN_ERR "\n driver data not found");
return_VALUE(-ENODEV);
}
return_VALUE(0);
}
static int
acpi_memory_check_device(struct acpi_memory_device *mem_device)
static int acpi_memory_check_device(struct acpi_memory_device *mem_device)
{
unsigned long current_status;
......@@ -185,8 +180,7 @@ acpi_memory_check_device(struct acpi_memory_device *mem_device)
return_VALUE(0);
}
static int
acpi_memory_enable_device(struct acpi_memory_device *mem_device)
static int acpi_memory_enable_device(struct acpi_memory_device *mem_device)
{
int result;
......@@ -209,8 +203,7 @@ acpi_memory_enable_device(struct acpi_memory_device *mem_device)
(mem_device->end_addr - mem_device->start_addr) + 1,
mem_device->read_write_attribute);
if (result) {
ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
"\nadd_memory failed\n"));
ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "\nadd_memory failed\n"));
mem_device->state = MEMORY_INVALID_STATE;
return result;
}
......@@ -218,8 +211,7 @@ acpi_memory_enable_device(struct acpi_memory_device *mem_device)
return result;
}
static int
acpi_memory_powerdown_device(struct acpi_memory_device *mem_device)
static int acpi_memory_powerdown_device(struct acpi_memory_device *mem_device)
{
acpi_status status;
struct acpi_object_list arg_list;
......@@ -237,7 +229,7 @@ acpi_memory_powerdown_device(struct acpi_memory_device *mem_device)
"_EJ0", &arg_list, NULL);
/* Return on _EJ0 failure */
if (ACPI_FAILURE(status)) {
ACPI_DEBUG_PRINT((ACPI_DB_ERROR,"_EJ0 failed.\n"));
ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "_EJ0 failed.\n"));
return_VALUE(-ENODEV);
}
......@@ -254,8 +246,7 @@ acpi_memory_powerdown_device(struct acpi_memory_device *mem_device)
return_VALUE(0);
}
static int
acpi_memory_disable_device(struct acpi_memory_device *mem_device)
static int acpi_memory_disable_device(struct acpi_memory_device *mem_device)
{
int result;
u64 start = mem_device->start_addr;
......@@ -288,8 +279,7 @@ acpi_memory_disable_device(struct acpi_memory_device *mem_device)
return result;
}
static void
acpi_memory_device_notify(acpi_handle handle, u32 event, void *data)
static void acpi_memory_device_notify(acpi_handle handle, u32 event, void *data)
{
struct acpi_memory_device *mem_device;
struct acpi_device *device;
......@@ -355,8 +345,7 @@ acpi_memory_device_notify(acpi_handle handle, u32 event, void *data)
return_VOID;
}
static int
acpi_memory_device_add(struct acpi_device *device)
static int acpi_memory_device_add(struct acpi_device *device)
{
int result;
struct acpi_memory_device *mem_device = NULL;
......@@ -391,8 +380,7 @@ acpi_memory_device_add(struct acpi_device *device)
return_VALUE(result);
}
static int
acpi_memory_device_remove (struct acpi_device *device, int type)
static int acpi_memory_device_remove(struct acpi_device *device, int type)
{
struct acpi_memory_device *mem_device = NULL;
......@@ -401,7 +389,7 @@ acpi_memory_device_remove (struct acpi_device *device, int type)
if (!device || !acpi_driver_data(device))
return_VALUE(-EINVAL);
mem_device = (struct acpi_memory_device *) acpi_driver_data(device);
mem_device = (struct acpi_memory_device *)acpi_driver_data(device);
kfree(mem_device);
return_VALUE(0);
......@@ -410,12 +398,11 @@ acpi_memory_device_remove (struct acpi_device *device, int type)
/*
* Helper function to check for memory device
*/
static acpi_status
is_memory_device(acpi_handle handle)
static acpi_status is_memory_device(acpi_handle handle)
{
char *hardware_id;
acpi_status status;
struct acpi_buffer buffer = {ACPI_ALLOCATE_BUFFER, NULL};
struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL };
struct acpi_device_info *info;
ACPI_FUNCTION_TRACE("is_memory_device");
......@@ -440,7 +427,7 @@ is_memory_device(acpi_handle handle)
}
static acpi_status
acpi_memory_register_notify_handler (acpi_handle handle,
acpi_memory_register_notify_handler(acpi_handle handle,
u32 level, void *ctxt, void **retv)
{
acpi_status status;
......@@ -463,7 +450,7 @@ acpi_memory_register_notify_handler (acpi_handle handle,
}
static acpi_status
acpi_memory_deregister_notify_handler (acpi_handle handle,
acpi_memory_deregister_notify_handler(acpi_handle handle,
u32 level, void *ctxt, void **retv)
{
acpi_status status;
......@@ -475,7 +462,8 @@ acpi_memory_deregister_notify_handler (acpi_handle handle,
return_ACPI_STATUS(AE_OK); /* continue */
status = acpi_remove_notify_handler(handle,
ACPI_SYSTEM_NOTIFY, acpi_memory_device_notify);
ACPI_SYSTEM_NOTIFY,
acpi_memory_device_notify);
if (ACPI_FAILURE(status)) {
ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
"Error removing notify handler\n"));
......@@ -485,8 +473,7 @@ acpi_memory_deregister_notify_handler (acpi_handle handle,
return_ACPI_STATUS(status);
}
static int __init
acpi_memory_device_init (void)
static int __init acpi_memory_device_init(void)
{
int result;
acpi_status status;
......@@ -503,8 +490,8 @@ acpi_memory_device_init (void)
acpi_memory_register_notify_handler,
NULL, NULL);
if (ACPI_FAILURE (status)) {
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "walk_namespace failed\n"));
if (ACPI_FAILURE(status)) {
ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "walk_namespace failed\n"));
acpi_bus_unregister_driver(&acpi_memory_device_driver);
return_VALUE(-ENODEV);
}
......@@ -512,8 +499,7 @@ acpi_memory_device_init (void)
return_VALUE(0);
}
static void __exit
acpi_memory_device_exit (void)
static void __exit acpi_memory_device_exit(void)
{
acpi_status status;
......@@ -528,8 +514,8 @@ acpi_memory_device_exit (void)
acpi_memory_deregister_notify_handler,
NULL, NULL);
if (ACPI_FAILURE (status))
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "walk_namespace failed\n"));
if (ACPI_FAILURE(status))
ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "walk_namespace failed\n"));
acpi_bus_unregister_driver(&acpi_memory_device_driver);
......@@ -538,5 +524,3 @@ acpi_memory_device_exit (void)
module_init(acpi_memory_device_init);
module_exit(acpi_memory_device_exit);
此差异已折叠。
......@@ -34,7 +34,6 @@
#include <acpi/acpi_bus.h>
#include <acpi/acpi_drivers.h>
#define ACPI_BATTERY_VALUE_UNKNOWN 0xFFFFFFFF
#define ACPI_BATTERY_FORMAT_BIF "NNNNNNNNNSSSS"
......@@ -53,16 +52,15 @@
#define ACPI_BATTERY_UNITS_WATTS "mW"
#define ACPI_BATTERY_UNITS_AMPS "mA"
#define _COMPONENT ACPI_BATTERY_COMPONENT
ACPI_MODULE_NAME ("acpi_battery")
ACPI_MODULE_NAME("acpi_battery")
MODULE_AUTHOR("Paul Diefenbaugh");
MODULE_AUTHOR("Paul Diefenbaugh");
MODULE_DESCRIPTION(ACPI_BATTERY_DRIVER_NAME);
MODULE_LICENSE("GPL");
static int acpi_battery_add (struct acpi_device *device);
static int acpi_battery_remove (struct acpi_device *device, int type);
static int acpi_battery_add(struct acpi_device *device);
static int acpi_battery_remove(struct acpi_device *device, int type);
static struct acpi_driver acpi_battery_driver = {
.name = ACPI_BATTERY_DRIVER_NAME,
......@@ -117,22 +115,21 @@ struct acpi_battery {
struct acpi_battery_info *info;
};
/* --------------------------------------------------------------------------
Battery Management
-------------------------------------------------------------------------- */
static int
acpi_battery_get_info (
struct acpi_battery *battery,
acpi_battery_get_info(struct acpi_battery *battery,
struct acpi_battery_info **bif)
{
int result = 0;
acpi_status status = 0;
struct acpi_buffer buffer = {ACPI_ALLOCATE_BUFFER, NULL};
struct acpi_buffer format = {sizeof(ACPI_BATTERY_FORMAT_BIF),
ACPI_BATTERY_FORMAT_BIF};
struct acpi_buffer data = {0, NULL};
struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL };
struct acpi_buffer format = { sizeof(ACPI_BATTERY_FORMAT_BIF),
ACPI_BATTERY_FORMAT_BIF
};
struct acpi_buffer data = { 0, NULL };
union acpi_object *package = NULL;
ACPI_FUNCTION_TRACE("acpi_battery_get_info");
......@@ -148,7 +145,7 @@ acpi_battery_get_info (
return_VALUE(-ENODEV);
}
package = (union acpi_object *) buffer.pointer;
package = (union acpi_object *)buffer.pointer;
/* Extract Package Data */
......@@ -174,26 +171,26 @@ acpi_battery_get_info (
goto end;
}
end:
end:
acpi_os_free(buffer.pointer);
if (!result)
(*bif) = (struct acpi_battery_info *) data.pointer;
(*bif) = (struct acpi_battery_info *)data.pointer;
return_VALUE(result);
}
static int
acpi_battery_get_status (
struct acpi_battery *battery,
acpi_battery_get_status(struct acpi_battery *battery,
struct acpi_battery_status **bst)
{
int result = 0;
acpi_status status = 0;
struct acpi_buffer buffer = {ACPI_ALLOCATE_BUFFER, NULL};
struct acpi_buffer format = {sizeof(ACPI_BATTERY_FORMAT_BST),
ACPI_BATTERY_FORMAT_BST};
struct acpi_buffer data = {0, NULL};
struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL };
struct acpi_buffer format = { sizeof(ACPI_BATTERY_FORMAT_BST),
ACPI_BATTERY_FORMAT_BST
};
struct acpi_buffer data = { 0, NULL };
union acpi_object *package = NULL;
ACPI_FUNCTION_TRACE("acpi_battery_get_status");
......@@ -209,7 +206,7 @@ acpi_battery_get_status (
return_VALUE(-ENODEV);
}
package = (union acpi_object *) buffer.pointer;
package = (union acpi_object *)buffer.pointer;
/* Extract Package Data */
......@@ -235,24 +232,21 @@ acpi_battery_get_status (
goto end;
}
end:
end:
acpi_os_free(buffer.pointer);
if (!result)
(*bst) = (struct acpi_battery_status *) data.pointer;
(*bst) = (struct acpi_battery_status *)data.pointer;
return_VALUE(result);
}
static int
acpi_battery_set_alarm (
struct acpi_battery *battery,
unsigned long alarm)
acpi_battery_set_alarm(struct acpi_battery *battery, unsigned long alarm)
{
acpi_status status = 0;
union acpi_object arg0 = {ACPI_TYPE_INTEGER};
struct acpi_object_list arg_list = {1, &arg0};
union acpi_object arg0 = { ACPI_TYPE_INTEGER };
struct acpi_object_list arg_list = { 1, &arg0 };
ACPI_FUNCTION_TRACE("acpi_battery_set_alarm");
......@@ -275,10 +269,7 @@ acpi_battery_set_alarm (
return_VALUE(0);
}
static int
acpi_battery_check (
struct acpi_battery *battery)
static int acpi_battery_check(struct acpi_battery *battery)
{
int result = 0;
acpi_status status = AE_OK;
......@@ -336,7 +327,6 @@ acpi_battery_check (
return_VALUE(result);
}
/* --------------------------------------------------------------------------
FS Interface (/proc)
-------------------------------------------------------------------------- */
......@@ -345,7 +335,7 @@ static struct proc_dir_entry *acpi_battery_dir;
static int acpi_battery_read_info(struct seq_file *seq, void *offset)
{
int result = 0;
struct acpi_battery *battery = (struct acpi_battery *) seq->private;
struct acpi_battery *battery = (struct acpi_battery *)seq->private;
struct acpi_battery_info *bif = NULL;
char *units = "?";
......@@ -369,7 +359,9 @@ static int acpi_battery_read_info(struct seq_file *seq, void *offset)
goto end;
}
units = bif->power_unit ? ACPI_BATTERY_UNITS_AMPS : ACPI_BATTERY_UNITS_WATTS;
units =
bif->
power_unit ? ACPI_BATTERY_UNITS_AMPS : ACPI_BATTERY_UNITS_WATTS;
if (bif->design_capacity == ACPI_BATTERY_VALUE_UNKNOWN)
seq_printf(seq, "design capacity: unknown\n");
......@@ -409,16 +401,12 @@ static int acpi_battery_read_info(struct seq_file *seq, void *offset)
(u32) bif->battery_capacity_granularity_1, units);
seq_printf(seq, "capacity granularity 2: %d %sh\n",
(u32) bif->battery_capacity_granularity_2, units);
seq_printf(seq, "model number: %s\n",
bif->model_number);
seq_printf(seq, "serial number: %s\n",
bif->serial_number);
seq_printf(seq, "battery type: %s\n",
bif->battery_type);
seq_printf(seq, "OEM info: %s\n",
bif->oem_info);
end:
seq_printf(seq, "model number: %s\n", bif->model_number);
seq_printf(seq, "serial number: %s\n", bif->serial_number);
seq_printf(seq, "battery type: %s\n", bif->battery_type);
seq_printf(seq, "OEM info: %s\n", bif->oem_info);
end:
kfree(bif);
return_VALUE(0);
......@@ -429,12 +417,10 @@ static int acpi_battery_info_open_fs(struct inode *inode, struct file *file)
return single_open(file, acpi_battery_read_info, PDE(inode)->data);
}
static int
acpi_battery_read_state (struct seq_file *seq, void *offset)
static int acpi_battery_read_state(struct seq_file *seq, void *offset)
{
int result = 0;
struct acpi_battery *battery = (struct acpi_battery *) seq->private;
struct acpi_battery *battery = (struct acpi_battery *)seq->private;
struct acpi_battery_status *bst = NULL;
char *units = "?";
......@@ -452,7 +438,9 @@ acpi_battery_read_state (struct seq_file *seq, void *offset)
/* Battery Units */
units = battery->flags.power_unit ? ACPI_BATTERY_UNITS_AMPS : ACPI_BATTERY_UNITS_WATTS;
units =
battery->flags.
power_unit ? ACPI_BATTERY_UNITS_AMPS : ACPI_BATTERY_UNITS_WATTS;
/* Battery Status (_BST) */
......@@ -467,12 +455,12 @@ acpi_battery_read_state (struct seq_file *seq, void *offset)
else
seq_printf(seq, "capacity state: critical\n");
if ((bst->state & 0x01) && (bst->state & 0x02)){
seq_printf(seq, "charging state: charging/discharging\n");
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
if ((bst->state & 0x01) && (bst->state & 0x02)) {
seq_printf(seq,
"charging state: charging/discharging\n");
ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
"Battery Charging and Discharging?\n"));
}
else if (bst->state & 0x01)
} else if (bst->state & 0x01)
seq_printf(seq, "charging state: discharging\n");
else if (bst->state & 0x02)
seq_printf(seq, "charging state: charging\n");
......@@ -498,7 +486,7 @@ acpi_battery_read_state (struct seq_file *seq, void *offset)
seq_printf(seq, "present voltage: %d mV\n",
(u32) bst->present_voltage);
end:
end:
kfree(bst);
return_VALUE(0);
......@@ -509,11 +497,9 @@ static int acpi_battery_state_open_fs(struct inode *inode, struct file *file)
return single_open(file, acpi_battery_read_state, PDE(inode)->data);
}
static int
acpi_battery_read_alarm (struct seq_file *seq, void *offset)
static int acpi_battery_read_alarm(struct seq_file *seq, void *offset)
{
struct acpi_battery *battery = (struct acpi_battery *) seq->private;
struct acpi_battery *battery = (struct acpi_battery *)seq->private;
char *units = "?";
ACPI_FUNCTION_TRACE("acpi_battery_read_alarm");
......@@ -528,7 +514,9 @@ acpi_battery_read_alarm (struct seq_file *seq, void *offset)
/* Battery Units */
units = battery->flags.power_unit ? ACPI_BATTERY_UNITS_AMPS : ACPI_BATTERY_UNITS_WATTS;
units =
battery->flags.
power_unit ? ACPI_BATTERY_UNITS_AMPS : ACPI_BATTERY_UNITS_WATTS;
/* Battery Alarm */
......@@ -538,20 +526,17 @@ acpi_battery_read_alarm (struct seq_file *seq, void *offset)
else
seq_printf(seq, "%d %sh\n", (u32) battery->alarm, units);
end:
end:
return_VALUE(0);
}
static ssize_t
acpi_battery_write_alarm (
struct file *file,
const char __user *buffer,
size_t count,
loff_t *ppos)
acpi_battery_write_alarm(struct file *file,
const char __user * buffer,
size_t count, loff_t * ppos)
{
int result = 0;
char alarm_string[12] = {'\0'};
char alarm_string[12] = { '\0' };
struct seq_file *m = (struct seq_file *)file->private_data;
struct acpi_battery *battery = (struct acpi_battery *)m->private;
......@@ -606,9 +591,7 @@ static struct file_operations acpi_battery_alarm_ops = {
.owner = THIS_MODULE,
};
static int
acpi_battery_add_fs (
struct acpi_device *device)
static int acpi_battery_add_fs(struct acpi_device *device)
{
struct proc_dir_entry *entry = NULL;
......@@ -650,7 +633,8 @@ acpi_battery_add_fs (
/* 'alarm' [R/W] */
entry = create_proc_entry(ACPI_BATTERY_FILE_ALARM,
S_IFREG|S_IRUGO|S_IWUSR, acpi_device_dir(device));
S_IFREG | S_IRUGO | S_IWUSR,
acpi_device_dir(device));
if (!entry)
ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
"Unable to create '%s' fs entry\n",
......@@ -664,10 +648,7 @@ acpi_battery_add_fs (
return_VALUE(0);
}
static int
acpi_battery_remove_fs (
struct acpi_device *device)
static int acpi_battery_remove_fs(struct acpi_device *device)
{
ACPI_FUNCTION_TRACE("acpi_battery_remove_fs");
......@@ -686,18 +667,13 @@ acpi_battery_remove_fs (
return_VALUE(0);
}
/* --------------------------------------------------------------------------
Driver Interface
-------------------------------------------------------------------------- */
static void
acpi_battery_notify (
acpi_handle handle,
u32 event,
void *data)
static void acpi_battery_notify(acpi_handle handle, u32 event, void *data)
{
struct acpi_battery *battery = (struct acpi_battery *) data;
struct acpi_battery *battery = (struct acpi_battery *)data;
struct acpi_device *device = NULL;
ACPI_FUNCTION_TRACE("acpi_battery_notify");
......@@ -723,10 +699,7 @@ acpi_battery_notify (
return_VOID;
}
static int
acpi_battery_add (
struct acpi_device *device)
static int acpi_battery_add(struct acpi_device *device)
{
int result = 0;
acpi_status status = 0;
......@@ -756,7 +729,8 @@ acpi_battery_add (
goto end;
status = acpi_install_notify_handler(battery->handle,
ACPI_DEVICE_NOTIFY, acpi_battery_notify, battery);
ACPI_DEVICE_NOTIFY,
acpi_battery_notify, battery);
if (ACPI_FAILURE(status)) {
ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
"Error installing notify handler\n"));
......@@ -766,9 +740,9 @@ acpi_battery_add (
printk(KERN_INFO PREFIX "%s Slot [%s] (battery %s)\n",
ACPI_BATTERY_DEVICE_NAME, acpi_device_bid(device),
device->status.battery_present?"present":"absent");
device->status.battery_present ? "present" : "absent");
end:
end:
if (result) {
acpi_battery_remove_fs(device);
kfree(battery);
......@@ -777,11 +751,7 @@ acpi_battery_add (
return_VALUE(result);
}
static int
acpi_battery_remove (
struct acpi_device *device,
int type)
static int acpi_battery_remove(struct acpi_device *device, int type)
{
acpi_status status = 0;
struct acpi_battery *battery = NULL;
......@@ -791,10 +761,11 @@ acpi_battery_remove (
if (!device || !acpi_driver_data(device))
return_VALUE(-EINVAL);
battery = (struct acpi_battery *) acpi_driver_data(device);
battery = (struct acpi_battery *)acpi_driver_data(device);
status = acpi_remove_notify_handler(battery->handle,
ACPI_DEVICE_NOTIFY, acpi_battery_notify);
ACPI_DEVICE_NOTIFY,
acpi_battery_notify);
if (ACPI_FAILURE(status))
ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
"Error removing notify handler\n"));
......@@ -806,9 +777,7 @@ acpi_battery_remove (
return_VALUE(0);
}
static int __init
acpi_battery_init (void)
static int __init acpi_battery_init(void)
{
int result = 0;
......@@ -828,9 +797,7 @@ acpi_battery_init (void)
return_VALUE(0);
}
static void __exit
acpi_battery_exit (void)
static void __exit acpi_battery_exit(void)
{
ACPI_FUNCTION_TRACE("acpi_battery_exit");
......@@ -841,6 +808,5 @@ acpi_battery_exit (void)
return_VOID;
}
module_init(acpi_battery_init);
module_exit(acpi_battery_exit);
......@@ -26,7 +26,6 @@
* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
*/
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/init.h>
......@@ -34,16 +33,14 @@
#include <acpi/acpi_bus.h>
#include <linux/dmi.h>
enum acpi_blacklist_predicates
{
enum acpi_blacklist_predicates {
all_versions,
less_than_or_equal,
equal,
greater_than_or_equal,
};
struct acpi_blacklist_item
{
struct acpi_blacklist_item {
char oem_id[7];
char oem_table_id[9];
u32 oem_revision;
......@@ -57,26 +54,28 @@ struct acpi_blacklist_item
* POLICY: If *anything* doesn't work, put it on the blacklist.
* If they are critical errors, mark it critical, and abort driver load.
*/
static struct acpi_blacklist_item acpi_blacklist[] __initdata =
{
static struct acpi_blacklist_item acpi_blacklist[] __initdata = {
/* Compaq Presario 1700 */
{"PTLTD ", " DSDT ", 0x06040000, ACPI_DSDT, less_than_or_equal, "Multiple problems", 1},
{"PTLTD ", " DSDT ", 0x06040000, ACPI_DSDT, less_than_or_equal,
"Multiple problems", 1},
/* Sony FX120, FX140, FX150? */
{"SONY ", "U0 ", 0x20010313, ACPI_DSDT, less_than_or_equal, "ACPI driver problem", 1},
{"SONY ", "U0 ", 0x20010313, ACPI_DSDT, less_than_or_equal,
"ACPI driver problem", 1},
/* Compaq Presario 800, Insyde BIOS */
{"INT440", "SYSFexxx", 0x00001001, ACPI_DSDT, less_than_or_equal, "Does not use _REG to protect EC OpRegions", 1},
{"INT440", "SYSFexxx", 0x00001001, ACPI_DSDT, less_than_or_equal,
"Does not use _REG to protect EC OpRegions", 1},
/* IBM 600E - _ADR should return 7, but it returns 1 */
{"IBM ", "TP600E ", 0x00000105, ACPI_DSDT, less_than_or_equal, "Incorrect _ADR", 1},
{"ASUS\0\0", "P2B-S ", 0, ACPI_DSDT, all_versions, "Bogus PCI routing", 1},
{"IBM ", "TP600E ", 0x00000105, ACPI_DSDT, less_than_or_equal,
"Incorrect _ADR", 1},
{"ASUS\0\0", "P2B-S ", 0, ACPI_DSDT, all_versions,
"Bogus PCI routing", 1},
{""}
};
#if CONFIG_ACPI_BLACKLIST_YEAR
static int __init
blacklist_by_year(void)
static int __init blacklist_by_year(void)
{
int year;
char *s = dmi_get_system_info(DMI_BIOS_DATE);
......@@ -92,7 +91,7 @@ blacklist_by_year(void)
s += 1;
year = simple_strtoul(s,NULL,0);
year = simple_strtoul(s, NULL, 0);
if (year < 100) { /* 2-digit year */
year += 1900;
......@@ -109,19 +108,21 @@ blacklist_by_year(void)
return 0;
}
#else
static inline int blacklist_by_year(void) { return 0; }
static inline int blacklist_by_year(void)
{
return 0;
}
#endif
int __init
acpi_blacklisted(void)
int __init acpi_blacklisted(void)
{
int i = 0;
int blacklisted = 0;
struct acpi_table_header *table_header;
while (acpi_blacklist[i].oem_id[0] != '\0')
{
if (acpi_get_table_header_early(acpi_blacklist[i].table, &table_header)) {
while (acpi_blacklist[i].oem_id[0] != '\0') {
if (acpi_get_table_header_early
(acpi_blacklist[i].table, &table_header)) {
i++;
continue;
}
......@@ -131,33 +132,43 @@ acpi_blacklisted(void)
continue;
}
if (strncmp(acpi_blacklist[i].oem_table_id, table_header->oem_table_id, 8)) {
if (strncmp
(acpi_blacklist[i].oem_table_id, table_header->oem_table_id,
8)) {
i++;
continue;
}
if ((acpi_blacklist[i].oem_revision_predicate == all_versions)
|| (acpi_blacklist[i].oem_revision_predicate == less_than_or_equal
&& table_header->oem_revision <= acpi_blacklist[i].oem_revision)
|| (acpi_blacklist[i].oem_revision_predicate == greater_than_or_equal
&& table_header->oem_revision >= acpi_blacklist[i].oem_revision)
|| (acpi_blacklist[i].oem_revision_predicate ==
less_than_or_equal
&& table_header->oem_revision <=
acpi_blacklist[i].oem_revision)
|| (acpi_blacklist[i].oem_revision_predicate ==
greater_than_or_equal
&& table_header->oem_revision >=
acpi_blacklist[i].oem_revision)
|| (acpi_blacklist[i].oem_revision_predicate == equal
&& table_header->oem_revision == acpi_blacklist[i].oem_revision)) {
&& table_header->oem_revision ==
acpi_blacklist[i].oem_revision)) {
printk(KERN_ERR PREFIX "Vendor \"%6.6s\" System \"%8.8s\" "
printk(KERN_ERR PREFIX
"Vendor \"%6.6s\" System \"%8.8s\" "
"Revision 0x%x has a known ACPI BIOS problem.\n",
acpi_blacklist[i].oem_id,
acpi_blacklist[i].oem_table_id,
acpi_blacklist[i].oem_revision);
printk(KERN_ERR PREFIX "Reason: %s. This is a %s error\n",
printk(KERN_ERR PREFIX
"Reason: %s. This is a %s error\n",
acpi_blacklist[i].reason,
(acpi_blacklist[i].is_critical_error ? "non-recoverable" : "recoverable"));
(acpi_blacklist[i].
is_critical_error ? "non-recoverable" :
"recoverable"));
blacklisted = acpi_blacklist[i].is_critical_error;
break;
}
else {
} else {
i++;
}
}
......@@ -166,4 +177,3 @@ acpi_blacklisted(void)
return blacklisted;
}
......@@ -36,10 +36,8 @@
#include <acpi/acpi_bus.h>
#include <acpi/acpi_drivers.h>
#define _COMPONENT ACPI_BUS_COMPONENT
ACPI_MODULE_NAME ("acpi_bus")
ACPI_MODULE_NAME("acpi_bus")
#ifdef CONFIG_X86
extern void __init acpi_pic_sci_set_trigger(unsigned int irq, u16 trigger);
#endif
......@@ -57,10 +55,7 @@ EXPORT_SYMBOL(acpi_root_dir);
Device Management
-------------------------------------------------------------------------- */
int
acpi_bus_get_device (
acpi_handle handle,
struct acpi_device **device)
int acpi_bus_get_device(acpi_handle handle, struct acpi_device **device)
{
acpi_status status = AE_OK;
......@@ -71,7 +66,7 @@ acpi_bus_get_device (
/* TBD: Support fixed-feature devices */
status = acpi_get_data(handle, acpi_bus_data_handler, (void**) device);
status = acpi_get_data(handle, acpi_bus_data_handler, (void **)device);
if (ACPI_FAILURE(status) || !*device) {
ACPI_DEBUG_PRINT((ACPI_DB_WARN, "No context for object [%p]\n",
handle));
......@@ -80,11 +75,10 @@ acpi_bus_get_device (
return_VALUE(0);
}
EXPORT_SYMBOL(acpi_bus_get_device);
int
acpi_bus_get_status (
struct acpi_device *device)
int acpi_bus_get_status(struct acpi_device *device)
{
acpi_status status = AE_OK;
unsigned long sta = 0;
......@@ -98,10 +92,11 @@ acpi_bus_get_status (
* Evaluate _STA if present.
*/
if (device->flags.dynamic_status) {
status = acpi_evaluate_integer(device->handle, "_STA", NULL, &sta);
status =
acpi_evaluate_integer(device->handle, "_STA", NULL, &sta);
if (ACPI_FAILURE(status))
return_VALUE(-ENODEV);
STRUCT_TO_INT(device->status) = (int) sta;
STRUCT_TO_INT(device->status) = (int)sta;
}
/*
......@@ -116,27 +111,24 @@ acpi_bus_get_status (
if (device->status.functional && !device->status.present) {
printk(KERN_WARNING PREFIX "Device [%s] status [%08x]: "
"functional but not present; setting present\n",
device->pnp.bus_id,
(u32) STRUCT_TO_INT(device->status));
device->pnp.bus_id, (u32) STRUCT_TO_INT(device->status));
device->status.present = 1;
}
ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Device [%s] status [%08x]\n",
device->pnp.bus_id, (u32) STRUCT_TO_INT(device->status)));
device->pnp.bus_id,
(u32) STRUCT_TO_INT(device->status)));
return_VALUE(0);
}
EXPORT_SYMBOL(acpi_bus_get_status);
EXPORT_SYMBOL(acpi_bus_get_status);
/* --------------------------------------------------------------------------
Power Management
-------------------------------------------------------------------------- */
int
acpi_bus_get_power (
acpi_handle handle,
int *state)
int acpi_bus_get_power(acpi_handle handle, int *state)
{
int result = 0;
acpi_status status = 0;
......@@ -157,8 +149,7 @@ acpi_bus_get_power (
*state = device->parent->power.state;
else
*state = ACPI_STATE_D0;
}
else {
} else {
/*
* Get the device's power state either directly (via _PSC) or
* indirectly (via power resources).
......@@ -168,9 +159,8 @@ acpi_bus_get_power (
NULL, &psc);
if (ACPI_FAILURE(status))
return_VALUE(-ENODEV);
device->power.state = (int) psc;
}
else if (device->power.flags.power_resources) {
device->power.state = (int)psc;
} else if (device->power.flags.power_resources) {
result = acpi_power_get_inferred_state(device);
if (result)
return_VALUE(result);
......@@ -184,18 +174,15 @@ acpi_bus_get_power (
return_VALUE(0);
}
EXPORT_SYMBOL(acpi_bus_get_power);
EXPORT_SYMBOL(acpi_bus_get_power);
int
acpi_bus_set_power (
acpi_handle handle,
int state)
int acpi_bus_set_power(acpi_handle handle, int state)
{
int result = 0;
acpi_status status = AE_OK;
struct acpi_device *device = NULL;
char object_name[5] = {'_','P','S','0'+state,'\0'};
char object_name[5] = { '_', 'P', 'S', '0' + state, '\0' };
ACPI_FUNCTION_TRACE("acpi_bus_set_power");
......@@ -209,7 +196,8 @@ acpi_bus_set_power (
/* Make sure this is a valid target state */
if (!device->flags.power_manageable) {
ACPI_DEBUG_PRINT((ACPI_DB_WARN, "Device is not power manageable\n"));
ACPI_DEBUG_PRINT((ACPI_DB_WARN,
"Device is not power manageable\n"));
return_VALUE(-ENODEV);
}
/*
......@@ -219,15 +207,18 @@ acpi_bus_set_power (
if (device->power.state == ACPI_STATE_UNKNOWN)
acpi_bus_get_power(device->handle, &device->power.state);
if (state == device->power.state) {
ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Device is already at D%d\n", state));
ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Device is already at D%d\n",
state));
return_VALUE(0);
}
if (!device->power.states[state].flags.valid) {
ACPI_DEBUG_PRINT((ACPI_DB_WARN, "Device does not support D%d\n", state));
ACPI_DEBUG_PRINT((ACPI_DB_WARN, "Device does not support D%d\n",
state));
return_VALUE(-ENODEV);
}
if (device->parent && (state < device->parent->power.state)) {
ACPI_DEBUG_PRINT((ACPI_DB_WARN, "Cannot set device to a higher-powered state than parent\n"));
ACPI_DEBUG_PRINT((ACPI_DB_WARN,
"Cannot set device to a higher-powered state than parent\n"));
return_VALUE(-ENODEV);
}
......@@ -252,8 +243,7 @@ acpi_bus_set_power (
goto end;
}
}
}
else {
} else {
if (device->power.states[state].flags.explicit_set) {
status = acpi_evaluate_object(device->handle,
object_name, NULL, NULL);
......@@ -269,19 +259,20 @@ acpi_bus_set_power (
}
}
end:
end:
if (result)
ACPI_DEBUG_PRINT((ACPI_DB_WARN, "Error transitioning device [%s] to D%d\n",
ACPI_DEBUG_PRINT((ACPI_DB_WARN,
"Error transitioning device [%s] to D%d\n",
device->pnp.bus_id, state));
else
ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Device [%s] transitioned to D%d\n",
ACPI_DEBUG_PRINT((ACPI_DB_INFO,
"Device [%s] transitioned to D%d\n",
device->pnp.bus_id, state));
return_VALUE(result);
}
EXPORT_SYMBOL(acpi_bus_set_power);
EXPORT_SYMBOL(acpi_bus_set_power);
/* --------------------------------------------------------------------------
Event Management
......@@ -294,11 +285,7 @@ DECLARE_WAIT_QUEUE_HEAD(acpi_bus_event_queue);
extern int event_is_open;
int
acpi_bus_generate_event (
struct acpi_device *device,
u8 type,
int data)
int acpi_bus_generate_event(struct acpi_device *device, u8 type, int data)
{
struct acpi_bus_event *event = NULL;
unsigned long flags = 0;
......@@ -329,11 +316,10 @@ acpi_bus_generate_event (
return_VALUE(0);
}
EXPORT_SYMBOL(acpi_bus_generate_event);
int
acpi_bus_receive_event (
struct acpi_bus_event *event)
int acpi_bus_receive_event(struct acpi_bus_event *event)
{
unsigned long flags = 0;
struct acpi_bus_event *entry = NULL;
......@@ -361,7 +347,8 @@ acpi_bus_receive_event (
}
spin_lock_irqsave(&acpi_bus_event_lock, flags);
entry = list_entry(acpi_bus_event_list.next, struct acpi_bus_event, node);
entry =
list_entry(acpi_bus_event_list.next, struct acpi_bus_event, node);
if (entry)
list_del(&entry->node);
spin_unlock_irqrestore(&acpi_bus_event_lock, flags);
......@@ -375,17 +362,15 @@ acpi_bus_receive_event (
return_VALUE(0);
}
EXPORT_SYMBOL(acpi_bus_receive_event);
EXPORT_SYMBOL(acpi_bus_receive_event);
/* --------------------------------------------------------------------------
Notification Handling
-------------------------------------------------------------------------- */
static int
acpi_bus_check_device (
struct acpi_device *device,
int *status_changed)
acpi_bus_check_device(struct acpi_device *device, int *status_changed)
{
acpi_status status = 0;
struct acpi_device_status old_status;
......@@ -429,8 +414,7 @@ acpi_bus_check_device (
if ((device->status.present) && !(old_status.present)) {
ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Device insertion detected\n"));
/* TBD: Handle device insertion */
}
else if (!(device->status.present) && (old_status.present)) {
} else if (!(device->status.present) && (old_status.present)) {
ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Device removal detected\n"));
/* TBD: Handle device removal */
}
......@@ -438,10 +422,7 @@ acpi_bus_check_device (
return_VALUE(0);
}
static int
acpi_bus_check_scope (
struct acpi_device *device)
static int acpi_bus_check_scope(struct acpi_device *device)
{
int result = 0;
int status_changed = 0;
......@@ -467,17 +448,12 @@ acpi_bus_check_scope (
return_VALUE(0);
}
/**
* acpi_bus_notify
* ---------------
* Callback for all 'system-level' device notifications (values 0x00-0x7F).
*/
static void
acpi_bus_notify (
acpi_handle handle,
u32 type,
void *data)
static void acpi_bus_notify(acpi_handle handle, u32 type, void *data)
{
int result = 0;
struct acpi_device *device = NULL;
......@@ -490,7 +466,8 @@ acpi_bus_notify (
switch (type) {
case ACPI_NOTIFY_BUS_CHECK:
ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Received BUS CHECK notification for device [%s]\n",
ACPI_DEBUG_PRINT((ACPI_DB_INFO,
"Received BUS CHECK notification for device [%s]\n",
device->pnp.bus_id));
result = acpi_bus_check_scope(device);
/*
......@@ -500,7 +477,8 @@ acpi_bus_notify (
break;
case ACPI_NOTIFY_DEVICE_CHECK:
ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Received DEVICE CHECK notification for device [%s]\n",
ACPI_DEBUG_PRINT((ACPI_DB_INFO,
"Received DEVICE CHECK notification for device [%s]\n",
device->pnp.bus_id));
result = acpi_bus_check_device(device, NULL);
/*
......@@ -510,43 +488,50 @@ acpi_bus_notify (
break;
case ACPI_NOTIFY_DEVICE_WAKE:
ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Received DEVICE WAKE notification for device [%s]\n",
ACPI_DEBUG_PRINT((ACPI_DB_INFO,
"Received DEVICE WAKE notification for device [%s]\n",
device->pnp.bus_id));
/* TBD */
break;
case ACPI_NOTIFY_EJECT_REQUEST:
ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Received EJECT REQUEST notification for device [%s]\n",
ACPI_DEBUG_PRINT((ACPI_DB_INFO,
"Received EJECT REQUEST notification for device [%s]\n",
device->pnp.bus_id));
/* TBD */
break;
case ACPI_NOTIFY_DEVICE_CHECK_LIGHT:
ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Received DEVICE CHECK LIGHT notification for device [%s]\n",
ACPI_DEBUG_PRINT((ACPI_DB_INFO,
"Received DEVICE CHECK LIGHT notification for device [%s]\n",
device->pnp.bus_id));
/* TBD: Exactly what does 'light' mean? */
break;
case ACPI_NOTIFY_FREQUENCY_MISMATCH:
ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Received FREQUENCY MISMATCH notification for device [%s]\n",
ACPI_DEBUG_PRINT((ACPI_DB_INFO,
"Received FREQUENCY MISMATCH notification for device [%s]\n",
device->pnp.bus_id));
/* TBD */
break;
case ACPI_NOTIFY_BUS_MODE_MISMATCH:
ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Received BUS MODE MISMATCH notification for device [%s]\n",
ACPI_DEBUG_PRINT((ACPI_DB_INFO,
"Received BUS MODE MISMATCH notification for device [%s]\n",
device->pnp.bus_id));
/* TBD */
break;
case ACPI_NOTIFY_POWER_FAULT:
ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Received POWER FAULT notification for device [%s]\n",
ACPI_DEBUG_PRINT((ACPI_DB_INFO,
"Received POWER FAULT notification for device [%s]\n",
device->pnp.bus_id));
/* TBD */
break;
default:
ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Received unknown/unsupported notification [%08x]\n",
ACPI_DEBUG_PRINT((ACPI_DB_INFO,
"Received unknown/unsupported notification [%08x]\n",
type));
break;
}
......@@ -558,12 +543,11 @@ acpi_bus_notify (
Initialization/Cleanup
-------------------------------------------------------------------------- */
static int __init
acpi_bus_init_irq (void)
static int __init acpi_bus_init_irq(void)
{
acpi_status status = AE_OK;
union acpi_object arg = {ACPI_TYPE_INTEGER};
struct acpi_object_list arg_list = {1, &arg};
union acpi_object arg = { ACPI_TYPE_INTEGER };
struct acpi_object_list arg_list = { 1, &arg };
char *message = NULL;
ACPI_FUNCTION_TRACE("acpi_bus_init_irq");
......@@ -601,12 +585,10 @@ acpi_bus_init_irq (void)
return_VALUE(0);
}
void __init
acpi_early_init (void)
void __init acpi_early_init(void)
{
acpi_status status = AE_OK;
struct acpi_buffer buffer = {sizeof(acpi_fadt), &acpi_fadt};
struct acpi_buffer buffer = { sizeof(acpi_fadt), &acpi_fadt };
ACPI_FUNCTION_TRACE("acpi_early_init");
......@@ -619,13 +601,15 @@ acpi_early_init (void)
status = acpi_initialize_subsystem();
if (ACPI_FAILURE(status)) {
printk(KERN_ERR PREFIX "Unable to initialize the ACPI Interpreter\n");
printk(KERN_ERR PREFIX
"Unable to initialize the ACPI Interpreter\n");
goto error0;
}
status = acpi_load_tables();
if (ACPI_FAILURE(status)) {
printk(KERN_ERR PREFIX "Unable to load the System Description Tables\n");
printk(KERN_ERR PREFIX
"Unable to load the System Description Tables\n");
goto error0;
}
......@@ -637,7 +621,6 @@ acpi_early_init (void)
printk(KERN_ERR PREFIX "Unable to get the FADT\n");
goto error0;
}
#ifdef CONFIG_X86
if (!acpi_ioapic) {
extern acpi_interrupt_flags acpi_sci_flags;
......@@ -647,7 +630,8 @@ acpi_early_init (void)
acpi_sci_flags.trigger = 3;
/* Set PIC-mode SCI trigger type */
acpi_pic_sci_set_trigger(acpi_fadt.sci_int, acpi_sci_flags.trigger);
acpi_pic_sci_set_trigger(acpi_fadt.sci_int,
acpi_sci_flags.trigger);
} else {
extern int acpi_sci_override_gsi;
/*
......@@ -658,7 +642,10 @@ acpi_early_init (void)
}
#endif
status = acpi_enable_subsystem(~(ACPI_NO_HARDWARE_INIT | ACPI_NO_ACPI_ENABLE));
status =
acpi_enable_subsystem(~
(ACPI_NO_HARDWARE_INIT |
ACPI_NO_ACPI_ENABLE));
if (ACPI_FAILURE(status)) {
printk(KERN_ERR PREFIX "Unable to enable ACPI\n");
goto error0;
......@@ -666,13 +653,12 @@ acpi_early_init (void)
return_VOID;
error0:
error0:
disable_acpi();
return_VOID;
}
static int __init
acpi_bus_init (void)
static int __init acpi_bus_init(void)
{
int result = 0;
acpi_status status = AE_OK;
......@@ -682,14 +668,17 @@ acpi_bus_init (void)
status = acpi_os_initialize1();
status = acpi_enable_subsystem(ACPI_NO_HARDWARE_INIT | ACPI_NO_ACPI_ENABLE);
status =
acpi_enable_subsystem(ACPI_NO_HARDWARE_INIT | ACPI_NO_ACPI_ENABLE);
if (ACPI_FAILURE(status)) {
printk(KERN_ERR PREFIX "Unable to start the ACPI Interpreter\n");
printk(KERN_ERR PREFIX
"Unable to start the ACPI Interpreter\n");
goto error1;
}
if (ACPI_FAILURE(status)) {
printk(KERN_ERR PREFIX "Unable to initialize ACPI OS objects\n");
printk(KERN_ERR PREFIX
"Unable to initialize ACPI OS objects\n");
goto error1;
}
#ifdef CONFIG_ACPI_EC
......@@ -723,9 +712,12 @@ acpi_bus_init (void)
/*
* Register the for all standard device notifications.
*/
status = acpi_install_notify_handler(ACPI_ROOT_OBJECT, ACPI_SYSTEM_NOTIFY, &acpi_bus_notify, NULL);
status =
acpi_install_notify_handler(ACPI_ROOT_OBJECT, ACPI_SYSTEM_NOTIFY,
&acpi_bus_notify, NULL);
if (ACPI_FAILURE(status)) {
printk(KERN_ERR PREFIX "Unable to register for device notifications\n");
printk(KERN_ERR PREFIX
"Unable to register for device notifications\n");
goto error1;
}
......@@ -737,21 +729,20 @@ acpi_bus_init (void)
return_VALUE(0);
/* Mimic structured exception handling */
error1:
error1:
acpi_terminate();
return_VALUE(-ENODEV);
}
decl_subsys(acpi,NULL,NULL);
decl_subsys(acpi, NULL, NULL);
static int __init acpi_init (void)
static int __init acpi_init(void)
{
int result = 0;
ACPI_FUNCTION_TRACE("acpi_init");
printk(KERN_INFO PREFIX "Subsystem revision %08x\n",
ACPI_CA_VERSION);
printk(KERN_INFO PREFIX "Subsystem revision %08x\n", ACPI_CA_VERSION);
if (acpi_disabled) {
printk(KERN_INFO PREFIX "Interpreter disabled.\n");
......@@ -767,7 +758,8 @@ static int __init acpi_init (void)
if (!PM_IS_ACTIVE())
pm_active = 1;
else {
printk(KERN_INFO PREFIX "APM is already active, exiting\n");
printk(KERN_INFO PREFIX
"APM is already active, exiting\n");
disable_acpi();
result = -ENODEV;
}
......
......@@ -32,7 +32,6 @@
#include <acpi/acpi_bus.h>
#include <acpi/acpi_drivers.h>
#define ACPI_BUTTON_COMPONENT 0x00080000
#define ACPI_BUTTON_DRIVER_NAME "ACPI Button Driver"
#define ACPI_BUTTON_CLASS "button"
......@@ -61,15 +60,14 @@
#define ACPI_BUTTON_TYPE_LID 0x05
#define _COMPONENT ACPI_BUTTON_COMPONENT
ACPI_MODULE_NAME ("acpi_button")
ACPI_MODULE_NAME("acpi_button")
MODULE_AUTHOR("Paul Diefenbaugh");
MODULE_AUTHOR("Paul Diefenbaugh");
MODULE_DESCRIPTION(ACPI_BUTTON_DRIVER_NAME);
MODULE_LICENSE("GPL");
static int acpi_button_add (struct acpi_device *device);
static int acpi_button_remove (struct acpi_device *device, int type);
static int acpi_button_add(struct acpi_device *device);
static int acpi_button_remove(struct acpi_device *device, int type);
static int acpi_button_info_open_fs(struct inode *inode, struct file *file);
static int acpi_button_state_open_fs(struct inode *inode, struct file *file);
......@@ -103,6 +101,7 @@ static struct file_operations acpi_button_state_fops = {
.llseek = seq_lseek,
.release = single_release,
};
/* --------------------------------------------------------------------------
FS Interface (/proc)
-------------------------------------------------------------------------- */
......@@ -111,7 +110,7 @@ static struct proc_dir_entry *acpi_button_dir;
static int acpi_button_info_seq_show(struct seq_file *seq, void *offset)
{
struct acpi_button *button = (struct acpi_button *) seq->private;
struct acpi_button *button = (struct acpi_button *)seq->private;
ACPI_FUNCTION_TRACE("acpi_button_info_seq_show");
......@@ -131,7 +130,7 @@ static int acpi_button_info_open_fs(struct inode *inode, struct file *file)
static int acpi_button_state_seq_show(struct seq_file *seq, void *offset)
{
struct acpi_button *button = (struct acpi_button *) seq->private;
struct acpi_button *button = (struct acpi_button *)seq->private;
acpi_status status;
unsigned long state;
......@@ -140,12 +139,12 @@ static int acpi_button_state_seq_show(struct seq_file *seq, void *offset)
if (!button || !button->device)
return_VALUE(0);
status = acpi_evaluate_integer(button->handle,"_LID",NULL,&state);
status = acpi_evaluate_integer(button->handle, "_LID", NULL, &state);
if (ACPI_FAILURE(status)) {
seq_printf(seq, "state: unsupported\n");
}
else{
seq_printf(seq, "state: %s\n", (state ? "open" : "closed"));
} else {
seq_printf(seq, "state: %s\n",
(state ? "open" : "closed"));
}
return_VALUE(0);
......@@ -160,9 +159,7 @@ static struct proc_dir_entry *acpi_power_dir;
static struct proc_dir_entry *acpi_sleep_dir;
static struct proc_dir_entry *acpi_lid_dir;
static int
acpi_button_add_fs (
struct acpi_device *device)
static int acpi_button_add_fs(struct acpi_device *device)
{
struct proc_dir_entry *entry = NULL;
struct acpi_button *button = NULL;
......@@ -237,10 +234,7 @@ acpi_button_add_fs (
return_VALUE(0);
}
static int
acpi_button_remove_fs (
struct acpi_device *device)
static int acpi_button_remove_fs(struct acpi_device *device)
{
struct acpi_button *button = NULL;
......@@ -262,18 +256,13 @@ acpi_button_remove_fs (
return_VALUE(0);
}
/* --------------------------------------------------------------------------
Driver Interface
-------------------------------------------------------------------------- */
static void
acpi_button_notify (
acpi_handle handle,
u32 event,
void *data)
static void acpi_button_notify(acpi_handle handle, u32 event, void *data)
{
struct acpi_button *button = (struct acpi_button *) data;
struct acpi_button *button = (struct acpi_button *)data;
ACPI_FUNCTION_TRACE("acpi_button_notify");
......@@ -282,7 +271,8 @@ acpi_button_notify (
switch (event) {
case ACPI_BUTTON_NOTIFY_STATUS:
acpi_bus_generate_event(button->device, event, ++button->pushed);
acpi_bus_generate_event(button->device, event,
++button->pushed);
break;
default:
ACPI_DEBUG_PRINT((ACPI_DB_INFO,
......@@ -293,12 +283,9 @@ acpi_button_notify (
return_VOID;
}
static acpi_status
acpi_button_notify_fixed (
void *data)
static acpi_status acpi_button_notify_fixed(void *data)
{
struct acpi_button *button = (struct acpi_button *) data;
struct acpi_button *button = (struct acpi_button *)data;
ACPI_FUNCTION_TRACE("acpi_button_notify_fixed");
......@@ -310,10 +297,7 @@ acpi_button_notify_fixed (
return_ACPI_STATUS(AE_OK);
}
static int
acpi_button_add (
struct acpi_device *device)
static int acpi_button_add(struct acpi_device *device)
{
int result = 0;
acpi_status status = AE_OK;
......@@ -339,40 +323,32 @@ acpi_button_add (
*/
if (!strcmp(acpi_device_hid(device), ACPI_BUTTON_HID_POWER)) {
button->type = ACPI_BUTTON_TYPE_POWER;
strcpy(acpi_device_name(device),
ACPI_BUTTON_DEVICE_NAME_POWER);
strcpy(acpi_device_name(device), ACPI_BUTTON_DEVICE_NAME_POWER);
sprintf(acpi_device_class(device), "%s/%s",
ACPI_BUTTON_CLASS, ACPI_BUTTON_SUBCLASS_POWER);
}
else if (!strcmp(acpi_device_hid(device), ACPI_BUTTON_HID_POWERF)) {
} else if (!strcmp(acpi_device_hid(device), ACPI_BUTTON_HID_POWERF)) {
button->type = ACPI_BUTTON_TYPE_POWERF;
strcpy(acpi_device_name(device),
ACPI_BUTTON_DEVICE_NAME_POWERF);
sprintf(acpi_device_class(device), "%s/%s",
ACPI_BUTTON_CLASS, ACPI_BUTTON_SUBCLASS_POWER);
}
else if (!strcmp(acpi_device_hid(device), ACPI_BUTTON_HID_SLEEP)) {
} else if (!strcmp(acpi_device_hid(device), ACPI_BUTTON_HID_SLEEP)) {
button->type = ACPI_BUTTON_TYPE_SLEEP;
strcpy(acpi_device_name(device),
ACPI_BUTTON_DEVICE_NAME_SLEEP);
strcpy(acpi_device_name(device), ACPI_BUTTON_DEVICE_NAME_SLEEP);
sprintf(acpi_device_class(device), "%s/%s",
ACPI_BUTTON_CLASS, ACPI_BUTTON_SUBCLASS_SLEEP);
}
else if (!strcmp(acpi_device_hid(device), ACPI_BUTTON_HID_SLEEPF)) {
} else if (!strcmp(acpi_device_hid(device), ACPI_BUTTON_HID_SLEEPF)) {
button->type = ACPI_BUTTON_TYPE_SLEEPF;
strcpy(acpi_device_name(device),
ACPI_BUTTON_DEVICE_NAME_SLEEPF);
sprintf(acpi_device_class(device), "%s/%s",
ACPI_BUTTON_CLASS, ACPI_BUTTON_SUBCLASS_SLEEP);
}
else if (!strcmp(acpi_device_hid(device), ACPI_BUTTON_HID_LID)) {
} else if (!strcmp(acpi_device_hid(device), ACPI_BUTTON_HID_LID)) {
button->type = ACPI_BUTTON_TYPE_LID;
strcpy(acpi_device_name(device),
ACPI_BUTTON_DEVICE_NAME_LID);
strcpy(acpi_device_name(device), ACPI_BUTTON_DEVICE_NAME_LID);
sprintf(acpi_device_class(device), "%s/%s",
ACPI_BUTTON_CLASS, ACPI_BUTTON_SUBCLASS_LID);
}
else {
} else {
ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Unsupported hid [%s]\n",
acpi_device_hid(device)));
result = -ENODEV;
......@@ -385,20 +361,19 @@ acpi_button_add (
switch (button->type) {
case ACPI_BUTTON_TYPE_POWERF:
status = acpi_install_fixed_event_handler (
ACPI_EVENT_POWER_BUTTON,
status =
acpi_install_fixed_event_handler(ACPI_EVENT_POWER_BUTTON,
acpi_button_notify_fixed,
button);
break;
case ACPI_BUTTON_TYPE_SLEEPF:
status = acpi_install_fixed_event_handler (
ACPI_EVENT_SLEEP_BUTTON,
status =
acpi_install_fixed_event_handler(ACPI_EVENT_SLEEP_BUTTON,
acpi_button_notify_fixed,
button);
break;
default:
status = acpi_install_notify_handler (
button->handle,
status = acpi_install_notify_handler(button->handle,
ACPI_DEVICE_NOTIFY,
acpi_button_notify,
button);
......@@ -415,7 +390,8 @@ acpi_button_add (
if (device->wakeup.flags.valid) {
/* Button's GPE is run-wake GPE */
acpi_set_gpe_type(device->wakeup.gpe_device,
device->wakeup.gpe_number, ACPI_GPE_TYPE_WAKE_RUN);
device->wakeup.gpe_number,
ACPI_GPE_TYPE_WAKE_RUN);
acpi_enable_gpe(device->wakeup.gpe_device,
device->wakeup.gpe_number, ACPI_NOT_ISR);
device->wakeup.state.enabled = 1;
......@@ -424,7 +400,7 @@ acpi_button_add (
printk(KERN_INFO PREFIX "%s [%s]\n",
acpi_device_name(device), acpi_device_bid(device));
end:
end:
if (result) {
acpi_button_remove_fs(device);
kfree(button);
......@@ -433,9 +409,7 @@ acpi_button_add (
return_VALUE(result);
}
static int
acpi_button_remove (struct acpi_device *device, int type)
static int acpi_button_remove(struct acpi_device *device, int type)
{
acpi_status status = 0;
struct acpi_button *button = NULL;
......@@ -450,16 +424,19 @@ acpi_button_remove (struct acpi_device *device, int type)
/* Unregister for device notifications. */
switch (button->type) {
case ACPI_BUTTON_TYPE_POWERF:
status = acpi_remove_fixed_event_handler(
ACPI_EVENT_POWER_BUTTON, acpi_button_notify_fixed);
status =
acpi_remove_fixed_event_handler(ACPI_EVENT_POWER_BUTTON,
acpi_button_notify_fixed);
break;
case ACPI_BUTTON_TYPE_SLEEPF:
status = acpi_remove_fixed_event_handler(
ACPI_EVENT_SLEEP_BUTTON, acpi_button_notify_fixed);
status =
acpi_remove_fixed_event_handler(ACPI_EVENT_SLEEP_BUTTON,
acpi_button_notify_fixed);
break;
default:
status = acpi_remove_notify_handler(button->handle,
ACPI_DEVICE_NOTIFY, acpi_button_notify);
ACPI_DEVICE_NOTIFY,
acpi_button_notify);
break;
}
......@@ -474,9 +451,7 @@ acpi_button_remove (struct acpi_device *device, int type)
return_VALUE(0);
}
static int __init
acpi_button_init (void)
static int __init acpi_button_init(void)
{
int result = 0;
......@@ -495,9 +470,7 @@ acpi_button_init (void)
return_VALUE(0);
}
static void __exit
acpi_button_exit (void)
static void __exit acpi_button_exit(void)
{
ACPI_FUNCTION_TRACE("acpi_button_exit");
......@@ -514,6 +487,5 @@ acpi_button_exit (void)
return_VOID;
}
module_init(acpi_button_init);
module_exit(acpi_button_exit);
......@@ -44,9 +44,9 @@
#define ACPI_CONTAINER_COMPONENT 0x01000000
#define _COMPONENT ACPI_CONTAINER_COMPONENT
ACPI_MODULE_NAME ("acpi_container")
ACPI_MODULE_NAME("acpi_container")
MODULE_AUTHOR("Anil S Keshavamurthy");
MODULE_AUTHOR("Anil S Keshavamurthy");
MODULE_DESCRIPTION(ACPI_CONTAINER_DRIVER_NAME);
MODULE_LICENSE("GPL");
......@@ -65,11 +65,9 @@ static struct acpi_driver acpi_container_driver = {
},
};
/*******************************************************************/
static int
is_device_present(acpi_handle handle)
static int is_device_present(acpi_handle handle)
{
acpi_handle temp;
acpi_status status;
......@@ -89,8 +87,7 @@ is_device_present(acpi_handle handle)
}
/*******************************************************************/
static int
acpi_container_add(struct acpi_device *device)
static int acpi_container_add(struct acpi_device *device)
{
struct acpi_container *container;
......@@ -102,7 +99,7 @@ acpi_container_add(struct acpi_device *device)
}
container = kmalloc(sizeof(struct acpi_container), GFP_KERNEL);
if(!container)
if (!container)
return_VALUE(-ENOMEM);
memset(container, 0, sizeof(struct acpi_container));
......@@ -111,19 +108,17 @@ acpi_container_add(struct acpi_device *device)
strcpy(acpi_device_class(device), ACPI_CONTAINER_CLASS);
acpi_driver_data(device) = container;
ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Device <%s> bid <%s>\n", \
ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Device <%s> bid <%s>\n",
acpi_device_name(device), acpi_device_bid(device)));
return_VALUE(0);
}
static int
acpi_container_remove(struct acpi_device *device, int type)
static int acpi_container_remove(struct acpi_device *device, int type)
{
acpi_status status = AE_OK;
struct acpi_container *pc = NULL;
pc = (struct acpi_container*) acpi_driver_data(device);
pc = (struct acpi_container *)acpi_driver_data(device);
if (pc)
kfree(pc);
......@@ -131,9 +126,7 @@ acpi_container_remove(struct acpi_device *device, int type)
return status;
}
static int
container_device_add(struct acpi_device **device, acpi_handle handle)
static int container_device_add(struct acpi_device **device, acpi_handle handle)
{
acpi_handle phandle;
struct acpi_device *pdev;
......@@ -158,8 +151,7 @@ container_device_add(struct acpi_device **device, acpi_handle handle)
return_VALUE(result);
}
static void
container_notify_cb(acpi_handle handle, u32 type, void *context)
static void container_notify_cb(acpi_handle handle, u32 type, void *context)
{
struct acpi_device *device = NULL;
int result;
......@@ -175,8 +167,8 @@ container_notify_cb(acpi_handle handle, u32 type, void *context)
/* Fall through */
case ACPI_NOTIFY_DEVICE_CHECK:
printk("Container driver received %s event\n",
(type == ACPI_NOTIFY_BUS_CHECK)?
"ACPI_NOTIFY_BUS_CHECK":"ACPI_NOTIFY_DEVICE_CHECK");
(type == ACPI_NOTIFY_BUS_CHECK) ?
"ACPI_NOTIFY_BUS_CHECK" : "ACPI_NOTIFY_DEVICE_CHECK");
status = acpi_bus_get_device(handle, &device);
if (present) {
if (ACPI_FAILURE(status) || !device) {
......@@ -207,12 +199,10 @@ container_notify_cb(acpi_handle handle, u32 type, void *context)
static acpi_status
container_walk_namespace_cb(acpi_handle handle,
u32 lvl,
void *context,
void **rv)
u32 lvl, void *context, void **rv)
{
char *hid = NULL;
struct acpi_buffer buffer = {ACPI_ALLOCATE_BUFFER, NULL};
struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL };
struct acpi_device_info *info;
acpi_status status;
int *action = context;
......@@ -237,12 +227,11 @@ container_walk_namespace_cb(acpi_handle handle,
goto end;
}
switch(*action) {
switch (*action) {
case INSTALL_NOTIFY_HANDLER:
acpi_install_notify_handler(handle,
ACPI_SYSTEM_NOTIFY,
container_notify_cb,
NULL);
container_notify_cb, NULL);
break;
case UNINSTALL_NOTIFY_HANDLER:
acpi_remove_notify_handler(handle,
......@@ -253,36 +242,32 @@ container_walk_namespace_cb(acpi_handle handle,
break;
}
end:
end:
acpi_os_free(buffer.pointer);
return_ACPI_STATUS(AE_OK);
}
static int __init
acpi_container_init(void)
static int __init acpi_container_init(void)
{
int result = 0;
int action = INSTALL_NOTIFY_HANDLER;
result = acpi_bus_register_driver(&acpi_container_driver);
if (result < 0) {
return(result);
return (result);
}
/* register notify handler to every container device */
acpi_walk_namespace(ACPI_TYPE_DEVICE,
ACPI_ROOT_OBJECT,
ACPI_UINT32_MAX,
container_walk_namespace_cb,
&action, NULL);
container_walk_namespace_cb, &action, NULL);
return(0);
return (0);
}
static void __exit
acpi_container_exit(void)
static void __exit acpi_container_exit(void)
{
int action = UNINSTALL_NOTIFY_HANDLER;
......@@ -291,8 +276,7 @@ acpi_container_exit(void)
acpi_walk_namespace(ACPI_TYPE_DEVICE,
ACPI_ROOT_OBJECT,
ACPI_UINT32_MAX,
container_walk_namespace_cb,
&action, NULL);
container_walk_namespace_cb, &action, NULL);
acpi_bus_unregister_driver(&acpi_container_driver);
......
......@@ -12,17 +12,14 @@
#include <acpi/acglobal.h>
#define _COMPONENT ACPI_SYSTEM_COMPONENT
ACPI_MODULE_NAME ("debug")
ACPI_MODULE_NAME("debug")
#define ACPI_SYSTEM_FILE_DEBUG_LAYER "debug_layer"
#define ACPI_SYSTEM_FILE_DEBUG_LEVEL "debug_level"
#ifdef MODULE_PARAM_PREFIX
#undef MODULE_PARAM_PREFIX
#endif
#define MODULE_PARAM_PREFIX
module_param(acpi_dbg_layer, uint, 0400);
module_param(acpi_dbg_layer, uint, 0400);
module_param(acpi_dbg_level, uint, 0400);
struct acpi_dlayer {
......@@ -35,8 +32,7 @@ struct acpi_dlevel {
};
#define ACPI_DEBUG_INIT(v) { .name = #v, .value = v }
static const struct acpi_dlayer acpi_debug_layers[] =
{
static const struct acpi_dlayer acpi_debug_layers[] = {
ACPI_DEBUG_INIT(ACPI_UTILITIES),
ACPI_DEBUG_INIT(ACPI_HARDWARE),
ACPI_DEBUG_INIT(ACPI_EVENTS),
......@@ -53,8 +49,7 @@ static const struct acpi_dlayer acpi_debug_layers[] =
ACPI_DEBUG_INIT(ACPI_TOOLS),
};
static const struct acpi_dlevel acpi_debug_levels[] =
{
static const struct acpi_dlevel acpi_debug_levels[] = {
ACPI_DEBUG_INIT(ACPI_LV_ERROR),
ACPI_DEBUG_INIT(ACPI_LV_WARN),
ACPI_DEBUG_INIT(ACPI_LV_INIT),
......@@ -92,13 +87,8 @@ static const struct acpi_dlevel acpi_debug_levels[] =
};
static int
acpi_system_read_debug (
char *page,
char **start,
off_t off,
int count,
int *eof,
void *data)
acpi_system_read_debug(char *page,
char **start, off_t off, int count, int *eof, void *data)
{
char *p = page;
int size = 0;
......@@ -109,20 +99,21 @@ acpi_system_read_debug (
p += sprintf(p, "%-25s\tHex SET\n", "Description");
switch ((unsigned long) data) {
switch ((unsigned long)data) {
case 0:
for (i = 0; i < ARRAY_SIZE(acpi_debug_layers); i++) {
p += sprintf(p, "%-25s\t0x%08lX [%c]\n",
acpi_debug_layers[i].name,
acpi_debug_layers[i].value,
(acpi_dbg_layer & acpi_debug_layers[i].value) ?
'*' : ' ');
(acpi_dbg_layer & acpi_debug_layers[i].
value) ? '*' : ' ');
}
p += sprintf(p, "%-25s\t0x%08X [%c]\n", "ACPI_ALL_DRIVERS",
ACPI_ALL_DRIVERS,
(acpi_dbg_layer & ACPI_ALL_DRIVERS) == ACPI_ALL_DRIVERS?
'*' : (acpi_dbg_layer & ACPI_ALL_DRIVERS) == 0 ?
' ' : '-');
(acpi_dbg_layer & ACPI_ALL_DRIVERS) ==
ACPI_ALL_DRIVERS ? '*' : (acpi_dbg_layer &
ACPI_ALL_DRIVERS) ==
0 ? ' ' : '-');
p += sprintf(p,
"--\ndebug_layer = 0x%08X (* = enabled, - = partial)\n",
acpi_dbg_layer);
......@@ -132,8 +123,8 @@ acpi_system_read_debug (
p += sprintf(p, "%-25s\t0x%08lX [%c]\n",
acpi_debug_levels[i].name,
acpi_debug_levels[i].value,
(acpi_dbg_level & acpi_debug_levels[i].value) ?
'*' : ' ');
(acpi_dbg_level & acpi_debug_levels[i].
value) ? '*' : ' ');
}
p += sprintf(p, "--\ndebug_level = 0x%08X (* = enabled)\n",
acpi_dbg_level);
......@@ -143,26 +134,26 @@ acpi_system_read_debug (
break;
}
end:
end:
size = (p - page);
if (size <= off+count) *eof = 1;
if (size <= off + count)
*eof = 1;
*start = page + off;
size -= off;
if (size>count) size = count;
if (size<0) size = 0;
if (size > count)
size = count;
if (size < 0)
size = 0;
return size;
}
static int
acpi_system_write_debug (
struct file *file,
const char __user *buffer,
unsigned long count,
void *data)
acpi_system_write_debug(struct file *file,
const char __user * buffer,
unsigned long count, void *data)
{
char debug_string[12] = {'\0'};
char debug_string[12] = { '\0' };
ACPI_FUNCTION_TRACE("acpi_system_write_debug");
......@@ -174,7 +165,7 @@ acpi_system_write_debug (
debug_string[count] = '\0';
switch ((unsigned long) data) {
switch ((unsigned long)data) {
case 0:
acpi_dbg_layer = simple_strtoul(debug_string, NULL, 0);
break;
......@@ -192,7 +183,7 @@ static int __init acpi_debug_init(void)
{
struct proc_dir_entry *entry;
int error = 0;
char * name;
char *name;
ACPI_FUNCTION_TRACE("acpi_debug_init");
......@@ -201,8 +192,10 @@ static int __init acpi_debug_init(void)
/* 'debug_layer' [R/W] */
name = ACPI_SYSTEM_FILE_DEBUG_LAYER;
entry = create_proc_read_entry(name, S_IFREG|S_IRUGO|S_IWUSR, acpi_root_dir,
acpi_system_read_debug,(void *)0);
entry =
create_proc_read_entry(name, S_IFREG | S_IRUGO | S_IWUSR,
acpi_root_dir, acpi_system_read_debug,
(void *)0);
if (entry)
entry->write_proc = acpi_system_write_debug;
else
......@@ -210,8 +203,10 @@ static int __init acpi_debug_init(void)
/* 'debug_level' [R/W] */
name = ACPI_SYSTEM_FILE_DEBUG_LEVEL;
entry = create_proc_read_entry(name, S_IFREG|S_IRUGO|S_IWUSR, acpi_root_dir,
acpi_system_read_debug, (void *)1);
entry =
create_proc_read_entry(name, S_IFREG | S_IRUGO | S_IWUSR,
acpi_root_dir, acpi_system_read_debug,
(void *)1);
if (entry)
entry->write_proc = acpi_system_write_debug;
else
......
......@@ -41,7 +41,6 @@
* POSSIBILITY OF SUCH DAMAGES.
*/
#include <acpi/acpi.h>
#include <acpi/amlcode.h>
#include <acpi/acdispat.h>
......@@ -49,19 +48,15 @@
#include <acpi/acnamesp.h>
#include <acpi/acparser.h>
#define _COMPONENT ACPI_DISPATCHER
ACPI_MODULE_NAME ("dsfield")
ACPI_MODULE_NAME("dsfield")
/* Local prototypes */
static acpi_status
acpi_ds_get_field_names (
struct acpi_create_field_info *info,
acpi_ds_get_field_names(struct acpi_create_field_info *info,
struct acpi_walk_state *walk_state,
union acpi_parse_object *arg);
/*******************************************************************************
*
* FUNCTION: acpi_ds_create_buffer_field
......@@ -82,8 +77,7 @@ acpi_ds_get_field_names (
******************************************************************************/
acpi_status
acpi_ds_create_buffer_field (
union acpi_parse_object *op,
acpi_ds_create_buffer_field(union acpi_parse_object *op,
struct acpi_walk_state *walk_state)
{
union acpi_parse_object *arg;
......@@ -93,30 +87,26 @@ acpi_ds_create_buffer_field (
union acpi_operand_object *second_desc = NULL;
u32 flags;
ACPI_FUNCTION_TRACE ("ds_create_buffer_field");
ACPI_FUNCTION_TRACE("ds_create_buffer_field");
/* Get the name_string argument */
if (op->common.aml_opcode == AML_CREATE_FIELD_OP) {
arg = acpi_ps_get_arg (op, 3);
}
else {
arg = acpi_ps_get_arg(op, 3);
} else {
/* Create Bit/Byte/Word/Dword field */
arg = acpi_ps_get_arg (op, 2);
arg = acpi_ps_get_arg(op, 2);
}
if (!arg) {
return_ACPI_STATUS (AE_AML_NO_OPERAND);
return_ACPI_STATUS(AE_AML_NO_OPERAND);
}
if (walk_state->deferred_node) {
node = walk_state->deferred_node;
status = AE_OK;
}
else {
} else {
/*
* During the load phase, we want to enter the name of the field into
* the namespace. During the execute phase (when we evaluate the size
......@@ -124,8 +114,7 @@ acpi_ds_create_buffer_field (
*/
if (walk_state->parse_flags & ACPI_PARSE_EXECUTE) {
flags = ACPI_NS_NO_UPSEARCH | ACPI_NS_DONT_OPEN_SCOPE;
}
else {
} else {
flags = ACPI_NS_NO_UPSEARCH | ACPI_NS_DONT_OPEN_SCOPE |
ACPI_NS_ERROR_IF_FOUND;
}
......@@ -133,12 +122,14 @@ acpi_ds_create_buffer_field (
/*
* Enter the name_string into the namespace
*/
status = acpi_ns_lookup (walk_state->scope_info, arg->common.value.string,
ACPI_TYPE_ANY, ACPI_IMODE_LOAD_PASS1,
flags, walk_state, &(node));
if (ACPI_FAILURE (status)) {
ACPI_REPORT_NSERROR (arg->common.value.string, status);
return_ACPI_STATUS (status);
status =
acpi_ns_lookup(walk_state->scope_info,
arg->common.value.string, ACPI_TYPE_ANY,
ACPI_IMODE_LOAD_PASS1, flags, walk_state,
&(node));
if (ACPI_FAILURE(status)) {
ACPI_REPORT_NSERROR(arg->common.value.string, status);
return_ACPI_STATUS(status);
}
}
......@@ -153,9 +144,9 @@ acpi_ds_create_buffer_field (
* and we need to create the field object. Otherwise, this was a lookup
* of an existing node and we don't want to create the field object again.
*/
obj_desc = acpi_ns_get_attached_object (node);
obj_desc = acpi_ns_get_attached_object(node);
if (obj_desc) {
return_ACPI_STATUS (AE_OK);
return_ACPI_STATUS(AE_OK);
}
/*
......@@ -165,7 +156,7 @@ acpi_ds_create_buffer_field (
/* Create the buffer field object */
obj_desc = acpi_ut_create_internal_object (ACPI_TYPE_BUFFER_FIELD);
obj_desc = acpi_ut_create_internal_object(ACPI_TYPE_BUFFER_FIELD);
if (!obj_desc) {
status = AE_NO_MEMORY;
goto cleanup;
......@@ -183,21 +174,19 @@ acpi_ds_create_buffer_field (
/* Attach constructed field descriptors to parent node */
status = acpi_ns_attach_object (node, obj_desc, ACPI_TYPE_BUFFER_FIELD);
if (ACPI_FAILURE (status)) {
status = acpi_ns_attach_object(node, obj_desc, ACPI_TYPE_BUFFER_FIELD);
if (ACPI_FAILURE(status)) {
goto cleanup;
}
cleanup:
cleanup:
/* Remove local reference to the object */
acpi_ut_remove_reference (obj_desc);
return_ACPI_STATUS (status);
acpi_ut_remove_reference(obj_desc);
return_ACPI_STATUS(status);
}
/*******************************************************************************
*
* FUNCTION: acpi_ds_get_field_names
......@@ -214,17 +203,14 @@ acpi_ds_create_buffer_field (
******************************************************************************/
static acpi_status
acpi_ds_get_field_names (
struct acpi_create_field_info *info,
acpi_ds_get_field_names(struct acpi_create_field_info *info,
struct acpi_walk_state *walk_state,
union acpi_parse_object *arg)
{
acpi_status status;
acpi_integer position;
ACPI_FUNCTION_TRACE_PTR ("ds_get_field_names", info);
ACPI_FUNCTION_TRACE_PTR("ds_get_field_names", info);
/* First field starts at bit zero */
......@@ -246,15 +232,13 @@ acpi_ds_get_field_names (
+ (acpi_integer) arg->common.value.size;
if (position > ACPI_UINT32_MAX) {
ACPI_REPORT_ERROR ((
"Bit offset within field too large (> 0xFFFFFFFF)\n"));
return_ACPI_STATUS (AE_SUPPORT);
ACPI_REPORT_ERROR(("Bit offset within field too large (> 0xFFFFFFFF)\n"));
return_ACPI_STATUS(AE_SUPPORT);
}
info->field_bit_position = (u32) position;
break;
case AML_INT_ACCESSFIELD_OP:
/*
......@@ -266,39 +250,40 @@ acpi_ds_get_field_names (
* ACCESS_TYPE bits
*/
info->field_flags = (u8)
((info->field_flags & ~(AML_FIELD_ACCESS_TYPE_MASK)) |
((info->
field_flags & ~(AML_FIELD_ACCESS_TYPE_MASK)) |
((u8) ((u32) arg->common.value.integer >> 8)));
info->attribute = (u8) (arg->common.value.integer);
break;
case AML_INT_NAMEDFIELD_OP:
/* Lookup the name */
status = acpi_ns_lookup (walk_state->scope_info,
(char *) &arg->named.name,
info->field_type, ACPI_IMODE_EXECUTE,
status = acpi_ns_lookup(walk_state->scope_info,
(char *)&arg->named.name,
info->field_type,
ACPI_IMODE_EXECUTE,
ACPI_NS_DONT_OPEN_SCOPE,
walk_state, &info->field_node);
if (ACPI_FAILURE (status)) {
ACPI_REPORT_NSERROR ((char *) &arg->named.name, status);
if (ACPI_FAILURE(status)) {
ACPI_REPORT_NSERROR((char *)&arg->named.name,
status);
if (status != AE_ALREADY_EXISTS) {
return_ACPI_STATUS (status);
return_ACPI_STATUS(status);
}
/* Already exists, ignore error */
}
else {
} else {
arg->common.node = info->field_node;
info->field_bit_length = arg->common.value.size;
/* Create and initialize an object for the new Field Node */
status = acpi_ex_prep_field_value (info);
if (ACPI_FAILURE (status)) {
return_ACPI_STATUS (status);
status = acpi_ex_prep_field_value(info);
if (ACPI_FAILURE(status)) {
return_ACPI_STATUS(status);
}
}
......@@ -308,31 +293,27 @@ acpi_ds_get_field_names (
+ (acpi_integer) arg->common.value.size;
if (position > ACPI_UINT32_MAX) {
ACPI_REPORT_ERROR ((
"Field [%4.4s] bit offset too large (> 0xFFFFFFFF)\n",
(char *) &info->field_node->name));
return_ACPI_STATUS (AE_SUPPORT);
ACPI_REPORT_ERROR(("Field [%4.4s] bit offset too large (> 0xFFFFFFFF)\n", (char *)&info->field_node->name));
return_ACPI_STATUS(AE_SUPPORT);
}
info->field_bit_position += info->field_bit_length;
break;
default:
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
"Invalid opcode in field list: %X\n",
arg->common.aml_opcode));
return_ACPI_STATUS (AE_AML_BAD_OPCODE);
return_ACPI_STATUS(AE_AML_BAD_OPCODE);
}
arg = arg->common.next;
}
return_ACPI_STATUS (AE_OK);
return_ACPI_STATUS(AE_OK);
}
/*******************************************************************************
*
* FUNCTION: acpi_ds_create_field
......@@ -348,8 +329,7 @@ acpi_ds_get_field_names (
******************************************************************************/
acpi_status
acpi_ds_create_field (
union acpi_parse_object *op,
acpi_ds_create_field(union acpi_parse_object *op,
struct acpi_namespace_node *region_node,
struct acpi_walk_state *walk_state)
{
......@@ -357,20 +337,20 @@ acpi_ds_create_field (
union acpi_parse_object *arg;
struct acpi_create_field_info info;
ACPI_FUNCTION_TRACE_PTR ("ds_create_field", op);
ACPI_FUNCTION_TRACE_PTR("ds_create_field", op);
/* First arg is the name of the parent op_region (must already exist) */
arg = op->common.value.arg;
if (!region_node) {
status = acpi_ns_lookup (walk_state->scope_info, arg->common.value.name,
ACPI_TYPE_REGION, ACPI_IMODE_EXECUTE,
ACPI_NS_SEARCH_PARENT, walk_state, &region_node);
if (ACPI_FAILURE (status)) {
ACPI_REPORT_NSERROR (arg->common.value.name, status);
return_ACPI_STATUS (status);
status =
acpi_ns_lookup(walk_state->scope_info,
arg->common.value.name, ACPI_TYPE_REGION,
ACPI_IMODE_EXECUTE, ACPI_NS_SEARCH_PARENT,
walk_state, &region_node);
if (ACPI_FAILURE(status)) {
ACPI_REPORT_NSERROR(arg->common.value.name, status);
return_ACPI_STATUS(status);
}
}
......@@ -385,12 +365,11 @@ acpi_ds_create_field (
info.field_type = ACPI_TYPE_LOCAL_REGION_FIELD;
info.region_node = region_node;
status = acpi_ds_get_field_names (&info, walk_state, arg->common.next);
status = acpi_ds_get_field_names(&info, walk_state, arg->common.next);
return_ACPI_STATUS (status);
return_ACPI_STATUS(status);
}
/*******************************************************************************
*
* FUNCTION: acpi_ds_init_field_objects
......@@ -407,8 +386,7 @@ acpi_ds_create_field (
******************************************************************************/
acpi_status
acpi_ds_init_field_objects (
union acpi_parse_object *op,
acpi_ds_init_field_objects(union acpi_parse_object *op,
struct acpi_walk_state *walk_state)
{
acpi_status status;
......@@ -416,28 +394,26 @@ acpi_ds_init_field_objects (
struct acpi_namespace_node *node;
u8 type = 0;
ACPI_FUNCTION_TRACE_PTR ("ds_init_field_objects", op);
ACPI_FUNCTION_TRACE_PTR("ds_init_field_objects", op);
switch (walk_state->opcode) {
case AML_FIELD_OP:
arg = acpi_ps_get_arg (op, 2);
arg = acpi_ps_get_arg(op, 2);
type = ACPI_TYPE_LOCAL_REGION_FIELD;
break;
case AML_BANK_FIELD_OP:
arg = acpi_ps_get_arg (op, 4);
arg = acpi_ps_get_arg(op, 4);
type = ACPI_TYPE_LOCAL_BANK_FIELD;
break;
case AML_INDEX_FIELD_OP:
arg = acpi_ps_get_arg (op, 3);
arg = acpi_ps_get_arg(op, 3);
type = ACPI_TYPE_LOCAL_INDEX_FIELD;
break;
default:
return_ACPI_STATUS (AE_BAD_PARAMETER);
return_ACPI_STATUS(AE_BAD_PARAMETER);
}
/*
......@@ -447,16 +423,18 @@ acpi_ds_init_field_objects (
/* Ignore OFFSET and ACCESSAS terms here */
if (arg->common.aml_opcode == AML_INT_NAMEDFIELD_OP) {
status = acpi_ns_lookup (walk_state->scope_info,
(char *) &arg->named.name,
status = acpi_ns_lookup(walk_state->scope_info,
(char *)&arg->named.name,
type, ACPI_IMODE_LOAD_PASS1,
ACPI_NS_NO_UPSEARCH | ACPI_NS_DONT_OPEN_SCOPE |
ACPI_NS_NO_UPSEARCH |
ACPI_NS_DONT_OPEN_SCOPE |
ACPI_NS_ERROR_IF_FOUND,
walk_state, &node);
if (ACPI_FAILURE (status)) {
ACPI_REPORT_NSERROR ((char *) &arg->named.name, status);
if (ACPI_FAILURE(status)) {
ACPI_REPORT_NSERROR((char *)&arg->named.name,
status);
if (status != AE_ALREADY_EXISTS) {
return_ACPI_STATUS (status);
return_ACPI_STATUS(status);
}
/* Name already exists, just ignore this error */
......@@ -472,10 +450,9 @@ acpi_ds_init_field_objects (
arg = arg->common.next;
}
return_ACPI_STATUS (AE_OK);
return_ACPI_STATUS(AE_OK);
}
/*******************************************************************************
*
* FUNCTION: acpi_ds_create_bank_field
......@@ -491,8 +468,7 @@ acpi_ds_init_field_objects (
******************************************************************************/
acpi_status
acpi_ds_create_bank_field (
union acpi_parse_object *op,
acpi_ds_create_bank_field(union acpi_parse_object *op,
struct acpi_namespace_node *region_node,
struct acpi_walk_state *walk_state)
{
......@@ -500,32 +476,34 @@ acpi_ds_create_bank_field (
union acpi_parse_object *arg;
struct acpi_create_field_info info;
ACPI_FUNCTION_TRACE_PTR ("ds_create_bank_field", op);
ACPI_FUNCTION_TRACE_PTR("ds_create_bank_field", op);
/* First arg is the name of the parent op_region (must already exist) */
arg = op->common.value.arg;
if (!region_node) {
status = acpi_ns_lookup (walk_state->scope_info, arg->common.value.name,
ACPI_TYPE_REGION, ACPI_IMODE_EXECUTE,
ACPI_NS_SEARCH_PARENT, walk_state, &region_node);
if (ACPI_FAILURE (status)) {
ACPI_REPORT_NSERROR (arg->common.value.name, status);
return_ACPI_STATUS (status);
status =
acpi_ns_lookup(walk_state->scope_info,
arg->common.value.name, ACPI_TYPE_REGION,
ACPI_IMODE_EXECUTE, ACPI_NS_SEARCH_PARENT,
walk_state, &region_node);
if (ACPI_FAILURE(status)) {
ACPI_REPORT_NSERROR(arg->common.value.name, status);
return_ACPI_STATUS(status);
}
}
/* Second arg is the Bank Register (Field) (must already exist) */
arg = arg->common.next;
status = acpi_ns_lookup (walk_state->scope_info, arg->common.value.string,
status =
acpi_ns_lookup(walk_state->scope_info, arg->common.value.string,
ACPI_TYPE_ANY, ACPI_IMODE_EXECUTE,
ACPI_NS_SEARCH_PARENT, walk_state, &info.register_node);
if (ACPI_FAILURE (status)) {
ACPI_REPORT_NSERROR (arg->common.value.string, status);
return_ACPI_STATUS (status);
ACPI_NS_SEARCH_PARENT, walk_state,
&info.register_node);
if (ACPI_FAILURE(status)) {
ACPI_REPORT_NSERROR(arg->common.value.string, status);
return_ACPI_STATUS(status);
}
/* Third arg is the bank_value */
......@@ -543,12 +521,11 @@ acpi_ds_create_bank_field (
info.field_type = ACPI_TYPE_LOCAL_BANK_FIELD;
info.region_node = region_node;
status = acpi_ds_get_field_names (&info, walk_state, arg->common.next);
status = acpi_ds_get_field_names(&info, walk_state, arg->common.next);
return_ACPI_STATUS (status);
return_ACPI_STATUS(status);
}
/*******************************************************************************
*
* FUNCTION: acpi_ds_create_index_field
......@@ -564,8 +541,7 @@ acpi_ds_create_bank_field (
******************************************************************************/
acpi_status
acpi_ds_create_index_field (
union acpi_parse_object *op,
acpi_ds_create_index_field(union acpi_parse_object *op,
struct acpi_namespace_node *region_node,
struct acpi_walk_state *walk_state)
{
......@@ -573,30 +549,32 @@ acpi_ds_create_index_field (
union acpi_parse_object *arg;
struct acpi_create_field_info info;
ACPI_FUNCTION_TRACE_PTR ("ds_create_index_field", op);
ACPI_FUNCTION_TRACE_PTR("ds_create_index_field", op);
/* First arg is the name of the Index register (must already exist) */
arg = op->common.value.arg;
status = acpi_ns_lookup (walk_state->scope_info, arg->common.value.string,
status =
acpi_ns_lookup(walk_state->scope_info, arg->common.value.string,
ACPI_TYPE_ANY, ACPI_IMODE_EXECUTE,
ACPI_NS_SEARCH_PARENT, walk_state, &info.register_node);
if (ACPI_FAILURE (status)) {
ACPI_REPORT_NSERROR (arg->common.value.string, status);
return_ACPI_STATUS (status);
ACPI_NS_SEARCH_PARENT, walk_state,
&info.register_node);
if (ACPI_FAILURE(status)) {
ACPI_REPORT_NSERROR(arg->common.value.string, status);
return_ACPI_STATUS(status);
}
/* Second arg is the data register (must already exist) */
arg = arg->common.next;
status = acpi_ns_lookup (walk_state->scope_info, arg->common.value.string,
status =
acpi_ns_lookup(walk_state->scope_info, arg->common.value.string,
ACPI_TYPE_ANY, ACPI_IMODE_EXECUTE,
ACPI_NS_SEARCH_PARENT, walk_state, &info.data_register_node);
if (ACPI_FAILURE (status)) {
ACPI_REPORT_NSERROR (arg->common.value.string, status);
return_ACPI_STATUS (status);
ACPI_NS_SEARCH_PARENT, walk_state,
&info.data_register_node);
if (ACPI_FAILURE(status)) {
ACPI_REPORT_NSERROR(arg->common.value.string, status);
return_ACPI_STATUS(status);
}
/* Next arg is the field flags */
......@@ -609,9 +587,7 @@ acpi_ds_create_index_field (
info.field_type = ACPI_TYPE_LOCAL_INDEX_FIELD;
info.region_node = region_node;
status = acpi_ds_get_field_names (&info, walk_state, arg->common.next);
status = acpi_ds_get_field_names(&info, walk_state, arg->common.next);
return_ACPI_STATUS (status);
return_ACPI_STATUS(status);
}
......@@ -41,23 +41,17 @@
* POSSIBILITY OF SUCH DAMAGES.
*/
#include <acpi/acpi.h>
#include <acpi/acdispat.h>
#include <acpi/acnamesp.h>
#define _COMPONENT ACPI_DISPATCHER
ACPI_MODULE_NAME ("dsinit")
ACPI_MODULE_NAME("dsinit")
/* Local prototypes */
static acpi_status
acpi_ds_init_one_object (
acpi_handle obj_handle,
u32 level,
void *context,
void **return_value);
acpi_ds_init_one_object(acpi_handle obj_handle,
u32 level, void *context, void **return_value);
/*******************************************************************************
*
......@@ -80,20 +74,17 @@ acpi_ds_init_one_object (
******************************************************************************/
static acpi_status
acpi_ds_init_one_object (
acpi_handle obj_handle,
u32 level,
void *context,
void **return_value)
acpi_ds_init_one_object(acpi_handle obj_handle,
u32 level, void *context, void **return_value)
{
struct acpi_init_walk_info *info = (struct acpi_init_walk_info *) context;
struct acpi_namespace_node *node = (struct acpi_namespace_node *) obj_handle;
struct acpi_init_walk_info *info =
(struct acpi_init_walk_info *)context;
struct acpi_namespace_node *node =
(struct acpi_namespace_node *)obj_handle;
acpi_object_type type;
acpi_status status;
ACPI_FUNCTION_NAME ("ds_init_one_object");
ACPI_FUNCTION_NAME("ds_init_one_object");
/*
* We are only interested in NS nodes owned by the table that
......@@ -107,23 +98,23 @@ acpi_ds_init_one_object (
/* And even then, we are only interested in a few object types */
type = acpi_ns_get_type (obj_handle);
type = acpi_ns_get_type(obj_handle);
switch (type) {
case ACPI_TYPE_REGION:
status = acpi_ds_initialize_region (obj_handle);
if (ACPI_FAILURE (status)) {
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
status = acpi_ds_initialize_region(obj_handle);
if (ACPI_FAILURE(status)) {
ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
"Region %p [%4.4s] - Init failure, %s\n",
obj_handle, acpi_ut_get_node_name (obj_handle),
acpi_format_exception (status)));
obj_handle,
acpi_ut_get_node_name(obj_handle),
acpi_format_exception(status)));
}
info->op_region_count++;
break;
case ACPI_TYPE_METHOD:
/*
......@@ -131,7 +122,7 @@ acpi_ds_init_one_object (
* the entire pathname
*/
if (!(acpi_dbg_level & ACPI_LV_INIT_NAMES)) {
ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INIT, "."));
ACPI_DEBUG_PRINT_RAW((ACPI_DB_INIT, "."));
}
/*
......@@ -148,12 +139,13 @@ acpi_ds_init_one_object (
* Always parse methods to detect errors, we will delete
* the parse tree below
*/
status = acpi_ds_parse_method (obj_handle);
if (ACPI_FAILURE (status)) {
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
status = acpi_ds_parse_method(obj_handle);
if (ACPI_FAILURE(status)) {
ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
"\n+Method %p [%4.4s] - parse failure, %s\n",
obj_handle, acpi_ut_get_node_name (obj_handle),
acpi_format_exception (status)));
obj_handle,
acpi_ut_get_node_name(obj_handle),
acpi_format_exception(status)));
/* This parse failed, but we will continue parsing more methods */
}
......@@ -161,13 +153,11 @@ acpi_ds_init_one_object (
info->method_count++;
break;
case ACPI_TYPE_DEVICE:
info->device_count++;
break;
default:
break;
}
......@@ -179,7 +169,6 @@ acpi_ds_init_one_object (
return (AE_OK);
}
/*******************************************************************************
*
* FUNCTION: acpi_ds_initialize_objects
......@@ -195,20 +184,17 @@ acpi_ds_init_one_object (
******************************************************************************/
acpi_status
acpi_ds_initialize_objects (
struct acpi_table_desc *table_desc,
struct acpi_namespace_node *start_node)
acpi_ds_initialize_objects(struct acpi_table_desc * table_desc,
struct acpi_namespace_node * start_node)
{
acpi_status status;
struct acpi_init_walk_info info;
ACPI_FUNCTION_TRACE("ds_initialize_objects");
ACPI_FUNCTION_TRACE ("ds_initialize_objects");
ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH,
"**** Starting initialization of namespace objects ****\n"));
ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INIT, "Parsing all Control Methods:"));
ACPI_DEBUG_PRINT_RAW((ACPI_DB_INIT, "Parsing all Control Methods:"));
info.method_count = 0;
info.op_region_count = 0;
......@@ -218,22 +204,23 @@ acpi_ds_initialize_objects (
/* Walk entire namespace from the supplied root */
status = acpi_walk_namespace (ACPI_TYPE_ANY, start_node, ACPI_UINT32_MAX,
status = acpi_walk_namespace(ACPI_TYPE_ANY, start_node, ACPI_UINT32_MAX,
acpi_ds_init_one_object, &info, NULL);
if (ACPI_FAILURE (status)) {
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "walk_namespace failed, %s\n",
acpi_format_exception (status)));
if (ACPI_FAILURE(status)) {
ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "walk_namespace failed, %s\n",
acpi_format_exception(status)));
}
ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INIT,
ACPI_DEBUG_PRINT_RAW((ACPI_DB_INIT,
"\nTable [%4.4s](id %4.4X) - %hd Objects with %hd Devices %hd Methods %hd Regions\n",
table_desc->pointer->signature, table_desc->owner_id, info.object_count,
info.device_count, info.method_count, info.op_region_count));
table_desc->pointer->signature,
table_desc->owner_id, info.object_count,
info.device_count, info.method_count,
info.op_region_count));
ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
"%hd Methods, %hd Regions\n", info.method_count, info.op_region_count));
ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH,
"%hd Methods, %hd Regions\n", info.method_count,
info.op_region_count));
return_ACPI_STATUS (AE_OK);
return_ACPI_STATUS(AE_OK);
}
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
......@@ -29,7 +29,8 @@ int register_acpi_bus_type(struct acpi_bus_type *type)
down_write(&bus_type_sem);
list_add_tail(&type->list, &bus_type_list);
up_write(&bus_type_sem);
printk(KERN_INFO PREFIX "bus type %s registered\n", type->bus->name);
printk(KERN_INFO PREFIX "bus type %s registered\n",
type->bus->name);
return 0;
}
return -ENODEV;
......@@ -45,7 +46,8 @@ int unregister_acpi_bus_type(struct acpi_bus_type *type)
down_write(&bus_type_sem);
list_del_init(&type->list);
up_write(&bus_type_sem);
printk(KERN_INFO PREFIX "ACPI bus type %s unregistered\n", type->bus->name);
printk(KERN_INFO PREFIX "ACPI bus type %s unregistered\n",
type->bus->name);
return 0;
}
return -ENODEV;
......
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册