[ 106/128] samsung-laptop: Disable on EFI hardware

Ben Hutchings
2013-02-03T14:58:10Z

From: Matt Fleming <matt.fleming@intel.com>

commit e0094244e41c4d0c7ad69920681972fc45d8ce34 upstream.

It has been reported that running this driver on some Samsung laptops
with EFI can cause those machines to become bricked as detailed in the
following report,

https://bugs.launchpad.net/ubuntu-cdimage/+bug/1040557

There have also been reports of this driver causing Machine Check
Exceptions on recent EFI-enabled Samsung laptops,

https://bugzilla.kernel.org/show_bug.cgi?id=47121

So disable it if booting from EFI since this driver relies on
grovelling around in the BIOS memory map which isn't going to work.

Cc: Corentin Chary <corentincj@iksaif.net>
Cc: Matthew Garrett <mjg59@srcf.ucam.org>
Cc: Colin Ian King <colin.king@canonical.com>
Cc: Steve Langasek <steve.langasek@canonical.com>
Signed-off-by: Matt Fleming <matt.fleming@intel.com>
Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
[bwh: Backported to 3.2: adjust context]
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
---
drivers/platform/x86/samsung-laptop.c | 4 ++++
1 file changed, 4 insertions(+)

--- a/drivers/platform/x86/samsung-laptop.c
+++ b/drivers/platform/x86/samsung-laptop.c
@@ -22,6 +22,7 @@
#include <linux/platform_device.h>
#include <linux/rfkill.h>
#include <linux/acpi.h>
+#include <linux/efi.h>

/*
* This driver is needed because a number of Samsung laptops do not hook
@@ -603,6 +604,9 @@ static int __init samsung_init(void)
int loca;
int retval;

+ if (efi_enabled(EFI_BOOT))
+ return -ENODEV;
+
mutex_init(&sabi_mutex);
handle_backlight = true;