* [PATCH 2/2] acpi: allow to add/remove multiple _OSI strings
@ 2010-12-09 8:51 Lin Ming
[not found] ` <AANLkTi=fw9Hoo6=hgu4_VndoDzd_T4Mq4bV9tVSvPLft@mail.gmail.com>
2010-12-11 6:31 ` Len Brown
0 siblings, 2 replies; 3+ messages in thread
From: Lin Ming @ 2010-12-09 8:51 UTC (permalink / raw)
To: lenb, Lukas Hejtmanek; +Cc: Moore, Robert, linux-acpi
commit b0ed7a91(ACPICA/ACPI: Add new host interfaces for _OSI suppor)
introduced another regression that only one _OSI string can be added or
removed.
Now multiple _OSI strings can be added or removed, for example
acpi_osi=Linux acpi_osi=FreeBSD acpi_osi="!Windows 2006"
Signed-off-by: Lin Ming <ming.m.lin@intel.com>
---
drivers/acpi/osl.c | 66 +++++++++++++++++++++++++++++++++++++++------------
1 files changed, 50 insertions(+), 16 deletions(-)
diff --git a/drivers/acpi/osl.c b/drivers/acpi/osl.c
index 6867443..d6e181a 100644
--- a/drivers/acpi/osl.c
+++ b/drivers/acpi/osl.c
@@ -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);
/*
@@ -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 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)
@@ -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);
+ }
}
}
--
1.5.3
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH 2/2] acpi: allow to add/remove multiple _OSI strings
[not found] ` <AANLkTi=fw9Hoo6=hgu4_VndoDzd_T4Mq4bV9tVSvPLft@mail.gmail.com>
@ 2010-12-09 15:09 ` Lin Ming
0 siblings, 0 replies; 3+ messages in thread
From: Lin Ming @ 2010-12-09 15:09 UTC (permalink / raw)
To: lenb; +Cc: Lukas Hejtmanek, Moore, Robert, linux-acpi
On Thu, 2010-12-09 at 23:04 +0800, Lin Ming wrote:
> ---------- Forwarded message ----------
> From: Lin Ming <ming.m.lin@intel.com>
> Date: Thu, Dec 9, 2010 at 4:51 PM
> Subject: [PATCH 2/2] acpi: allow to add/remove multiple _OSI strings
> To: lenb <lenb@kernel.org>, Lukas Hejtmanek <xhejtman@ics.muni.cz>
> Cc: "Moore, Robert" <robert.moore@intel.com>, linux-acpi
> <linux-acpi@vger.kernel.org>
>
>
> commit b0ed7a91(ACPICA/ACPI: Add new host interfaces for _OSI suppor)
> introduced another regression that only one _OSI string can be added or
> removed.
>
> Now multiple _OSI strings can be added or removed, for example
>
> acpi_osi=Linux acpi_osi=FreeBSD acpi_osi="!Windows 2006"
>
> Signed-off-by: Lin Ming <ming.m.lin@intel.com>
> ---
> drivers/acpi/osl.c | 66 +++++++++++++++++++++++++++++++++++++++------------
> 1 files changed, 50 insertions(+), 16 deletions(-)
>
> diff --git a/drivers/acpi/osl.c b/drivers/acpi/osl.c
> index 6867443..d6e181a 100644
> --- a/drivers/acpi/osl.c
> +++ b/drivers/acpi/osl.c
> @@ -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);
>
> /*
> @@ -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 osi_setup_entries[OSI_STRING_ENTRIES_MAX];
Len,
A small update, mark osi_setup_entries as __initdata.
Would you consider merging this for 2.6.37-rc6?
diff --git a/drivers/acpi/osl.c b/drivers/acpi/osl.c
index d6e181a..d0a1bb5 100644
--- a/drivers/acpi/osl.c
+++ b/drivers/acpi/osl.c
@@ -1059,7 +1059,7 @@ struct osi_setup_entry {
bool enable;
};
-static struct osi_setup_entry osi_setup_entries[OSI_STRING_ENTRIES_MAX];
+static struct osi_setup_entry __initdata osi_setup_entries[OSI_STRING_ENTRIES_MAX];
void __init acpi_osi_setup(char *str)
{
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH 2/2] acpi: allow to add/remove multiple _OSI strings
2010-12-09 8:51 [PATCH 2/2] acpi: allow to add/remove multiple _OSI strings Lin Ming
[not found] ` <AANLkTi=fw9Hoo6=hgu4_VndoDzd_T4Mq4bV9tVSvPLft@mail.gmail.com>
@ 2010-12-11 6:31 ` Len Brown
1 sibling, 0 replies; 3+ messages in thread
From: Len Brown @ 2010-12-11 6:31 UTC (permalink / raw)
To: Lin Ming; +Cc: Lukas Hejtmanek, Moore, Robert, linux-acpi
applied
thanks,
Len Brown, Intel Open Source Technology Center
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2010-12-11 6:31 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-12-09 8:51 [PATCH 2/2] acpi: allow to add/remove multiple _OSI strings Lin Ming
[not found] ` <AANLkTi=fw9Hoo6=hgu4_VndoDzd_T4Mq4bV9tVSvPLft@mail.gmail.com>
2010-12-09 15:09 ` Lin Ming
2010-12-11 6:31 ` Len Brown
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox