Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 223156
b: refs/heads/master
c: 12d3206
h: refs/heads/master
v: v3
  • Loading branch information
Lin Ming authored and Len Brown committed Dec 11, 2010
1 parent 3acc23f commit 81faf88
Show file tree
Hide file tree
Showing 2 changed files with 51 additions and 17 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: d90aa92c0c1625d7f02050e4d2924805840cda3d
refs/heads/master: 12d3206466d2074ef0684aaf7759ae01a0a92560
66 changes: 50 additions & 16 deletions trunk/drivers/acpi/osl.c
Original file line number Diff line number Diff line change
Expand Up @@ -110,9 +110,6 @@ struct acpi_ioremap {
static LIST_HEAD(acpi_ioremaps);
static DEFINE_SPINLOCK(acpi_ioremap_lock);

#define OSI_STRING_LENGTH_MAX 64 /* arbitrary */
static char osi_setup_string[OSI_STRING_LENGTH_MAX];

static void __init acpi_osi_setup_late(void);

/*
Expand Down Expand Up @@ -1054,16 +1051,47 @@ static int __init acpi_os_name_setup(char *str)

__setup("acpi_os_name=", acpi_os_name_setup);

#define OSI_STRING_LENGTH_MAX 64 /* arbitrary */
#define OSI_STRING_ENTRIES_MAX 16 /* arbitrary */

struct osi_setup_entry {
char string[OSI_STRING_LENGTH_MAX];
bool enable;
};

static struct osi_setup_entry __initdata osi_setup_entries[OSI_STRING_ENTRIES_MAX];

void __init acpi_osi_setup(char *str)
{
struct osi_setup_entry *osi;
bool enable = true;
int i;

if (!acpi_gbl_create_osi_method)
return;

if (str == NULL || *str == '\0') {
printk(KERN_INFO PREFIX "_OSI method disabled\n");
acpi_gbl_create_osi_method = FALSE;
} else
strncpy(osi_setup_string, str, OSI_STRING_LENGTH_MAX);
return;
}

if (*str == '!') {
str++;
enable = false;
}

for (i = 0; i < OSI_STRING_ENTRIES_MAX; i++) {
osi = &osi_setup_entries[i];
if (!strcmp(osi->string, str)) {
osi->enable = enable;
break;
} else if (osi->string[0] == '\0') {
osi->enable = enable;
strncpy(osi->string, str, OSI_STRING_LENGTH_MAX);
break;
}
}
}

static void __init set_osi_linux(unsigned int enable)
Expand Down Expand Up @@ -1110,22 +1138,28 @@ void __init acpi_dmi_osi_linux(int enable, const struct dmi_system_id *d)
*/
static void __init acpi_osi_setup_late(void)
{
char *str = osi_setup_string;
struct osi_setup_entry *osi;
char *str;
int i;
acpi_status status;

if (*str == '\0')
return;
for (i = 0; i < OSI_STRING_ENTRIES_MAX; i++) {
osi = &osi_setup_entries[i];
str = osi->string;

if (*str == '!') {
status = acpi_remove_interface(++str);
if (*str == '\0')
break;
if (osi->enable) {
status = acpi_install_interface(str);

if (ACPI_SUCCESS(status))
printk(KERN_INFO PREFIX "Deleted _OSI(%s)\n", str);
} else {
status = acpi_install_interface(str);
if (ACPI_SUCCESS(status))
printk(KERN_INFO PREFIX "Added _OSI(%s)\n", str);
} else {
status = acpi_remove_interface(str);

if (ACPI_SUCCESS(status))
printk(KERN_INFO PREFIX "Added _OSI(%s)\n", str);
if (ACPI_SUCCESS(status))
printk(KERN_INFO PREFIX "Deleted _OSI(%s)\n", str);
}
}
}

Expand Down

0 comments on commit 81faf88

Please sign in to comment.