Skip to contentSkip to conversation

Introduce msi-wmi driver - Fix hp-wmi memleaks - Cleanup __cpuinit warnings

PATCH Applied Thomas Renninger 3 participants 10 messages Oct 26, 2009 – Dec 16, 2009

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

Hi Len,

The patches are against latest test branch of the linux-acpi tree. If they survive reviews, can they be added please.

Thanks,

Thomas

#1 lore raw

PATCH 1/3 X86 drivers: Introduce msi-wmi driver

This driver serves backlight (including switching) and volume up/down keys for MSI machines providing a specific wmi interface:
551A1F84-FBDD-4125-91DB-3EA8F44F1D45 B6F3EEF2-3D2F-49DC-9DE3-85BCE18C62F2

C: Carlos Corbacho <[email protected]>

---
 drivers/platform/x86/Kconfig   |   10 +
 drivers/platform/x86/Makefile  |    1 +
 drivers/platform/x86/msi-wmi.c |  369 ++++++++++++++++++++++++++++++++++++++++
 3 files changed, 380 insertions(+), 0 deletions(-)
 create mode 100644 drivers/platform/x86/msi-wmi.c
drivers/platform/x86/Kconfig +10 -0
index 55ca39d..98ec6bd 100644
@@ -365,6 +365,16 @@ config ACPI_WMI
 	  It is safe to enable this driver even if your DSDT doesn't define
 	  any ACPI-WMI devices.
 
+config MSI_WMI
+	tristate "MSI WMI extras"
+	depends on ACPI_WMI
+	depends on INPUT
+	help
+	 Say Y here if you want to support WMI-based hotkeys on MSI laptops.
+
+	 To compile this driver as a module, choose M here: the module will
+	 be called msi-wmi.
+
 config ACPI_ASUS
 	tristate "ASUS/Medion Laptop Extras (DEPRECATED)"
 	depends on ACPI
drivers/platform/x86/Makefile +1 -0
index d1c1621..13aa373 100644
@@ -18,6 +18,7 @@ obj-$(CONFIG_FUJITSU_LAPTOP)	+= fujitsu-laptop.o
 obj-$(CONFIG_PANASONIC_LAPTOP)	+= panasonic-laptop.o
 obj-$(CONFIG_INTEL_MENLOW)	+= intel_menlow.o
 obj-$(CONFIG_ACPI_WMI)		+= wmi.o
+obj-$(CONFIG_MSI_WMI)		+= msi-wmi.o
 obj-$(CONFIG_ACPI_ASUS)		+= asus_acpi.o
 obj-$(CONFIG_TOPSTAR_LAPTOP)	+= topstar-laptop.o
 obj-$(CONFIG_ACPI_TOSHIBA)	+= toshiba_acpi.o
drivers/platform/x86/msi-wmi.c new file +369 -0

369 lines not on this page · raw message

Signature · 1 line
1.6.3
#2 lore raw

Re: [PATCH 1/3] X86 drivers: Introduce msi-wmi driver

Only one question - does hitting the brightness keys automatically change the backlight on non-ACPI backlight hardware driven by this?

Signature · 1 line
Matthew Garrett | [email protected]
#3 lore raw

Re: [PATCH 1/3] X86 drivers: Introduce msi-wmi driver

Quoted 2 lines · Matthew Garrett

Only one question - does hitting the brightness keys automatically change the backlight on non-ACPI backlight hardware driven by this?

Hmm, not sure what you mean with non-ACPI driven.
I can only talk about this specific model which only provides WMI (thus also ACPI driven) backlight functionality. No generic ACPI backlight functions as it seems only WindowsXP and not Vista is supported.

The OS has to react on WMI notifications and the brightness change only happens when writing to IO via ACPI WSAA (WMI set block) function. So I expect the answer to your question is no.

Thomas

BTW: Does someone know already whether Windows 7 also requires generic ACPI backlight functions? Does someone have a good pointer to some published Windows 7 ACPI documentation/requirements?

#4 lore raw

Re: [PATCH 1/3] X86 drivers: Introduce msi-wmi driver

Quoted 3 lines · Thomas Renninger

The OS has to react on WMI notifications and the brightness change only happens when writing to IO via ACPI WSAA (WMI set block) function. So I expect the answer to your question is no.

Ok, that's fine.

Signature · 1 line
Matthew Garrett | [email protected]
#5 lore raw

PATCH 2/3 hp-wmi: Fix memleaks by freeing acpi buffers delcared as ACPI_ALLOCATE_BUFFER

In reply to Thomas Renninger

C: Carlos Corbacho <[email protected]>
CC: Matthew Garrett <[email protected]>
CC: [email protected]
CC: Len Brown <[email protected]>
CC: [email protected]

---
 drivers/platform/x86/hp-wmi.c |   10 +++++++++-
 1 files changed, 9 insertions(+), 1 deletions(-)
drivers/platform/x86/hp-wmi.c +9 -1
index c284217..8cea7ff 100644
@@ -128,10 +128,15 @@ static int hp_wmi_perform_query(int query, int write, int value)
 
 	obj = output.pointer;
 
-	if (!obj || obj->type != ACPI_TYPE_BUFFER)
+	if (!obj)
 		return -EINVAL;
+	else if (obj->type != ACPI_TYPE_BUFFER) {
+		kfree(output.pointer);
+		return -EINVAL;
+	}
 
 	bios_return = *((struct bios_return *)obj->buffer.pointer);
+	kfree(output.pointer);
 	if (bios_return.return_code > 0)
 		return bios_return.return_code * -1;
 	else
@@ -377,6 +382,9 @@ static void hp_wmi_notify(u32 value, void *context)
 			       eventcode);
 	} else
 		printk(KERN_INFO "HP WMI: Unknown response received\n");
+
+	if(obj)
+		kfree(obj.pointer);
 }
 
 static int __init hp_wmi_input_setup(void)
Signature · 1 line
1.6.3
reviewer Applied
#6 lore raw

Re: [PATCH 2/3] hp-wmi: Fix memleaks by freeing acpi buffers delcared as ACPI_ALLOCATE_BUFFER

applied

thanks,
Len Brown, Intel Open Source Technology Center

reviewer
#7 lore raw

Re: [PATCH 2/3] hp-wmi: Fix memleaks by freeing acpi buffers delcared as ACPI_ALLOCATE_BUFFER

dropped.

maybe this patch is stale or i screwed up merging it...

drivers/platform/x86/hp-wmi.c: In function ‘hp_wmi_notify’:
drivers/platform/x86/hp-wmi.c:390: error: request for member ‘pointer’ in something not a structure or union

thanks,
Len Brown, Intel Open Source Technology Center

#8 lore raw

PATCH 3/3 ACPI processor: Fix section mismatch for processor_add()

In reply to Thomas Renninger

Due to the merge of processor_start() (declared with __cpuinit) into processor_add(), a section mismatch warning appears:

WARNING: drivers/built-in.o(.text+0x4d59d): Section mismatch in reference from the function acpi_processor_add() to the function .cpuinit.text:acpi_processor_power_init()
...

This patch fixes the warning by declaring processor_add() as __cpuinit and also declares acpi_processor_add_fs() as __cpuinit as it is only used in acpi_processor_add().

---
 drivers/acpi/processor_core.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
drivers/acpi/processor_core.c +2 -2
index c567b46..32b7d92 100644
@@ -353,7 +353,7 @@ static int acpi_processor_info_open_fs(struct inode *inode, struct file *file)
 			   PDE(inode)->data);
 }
 
-static int acpi_processor_add_fs(struct acpi_device *device)
+static int __cpuinit acpi_processor_add_fs(struct acpi_device *device)
 {
 	struct proc_dir_entry *entry = NULL;
 
@@ -770,7 +770,7 @@ static struct notifier_block acpi_cpu_notifier =
 	    .notifier_call = acpi_cpu_soft_notify,
 };
 
-static int acpi_processor_add(struct acpi_device *device)
+static int __cpuinit acpi_processor_add(struct acpi_device *device)
 {
 	struct acpi_processor *pr = NULL;
 	int result = 0;
Signature · 1 line
1.6.3
reviewer
#9 lore raw

Re: [PATCH 3/3] ACPI processor: Fix section mismatch for processor_add()

applied the acpi_processor_add_fs() hunk,
as we already had the acpi_processor_add hunk

thanks,
Len Brown, Intel Open Source Technology Center