I agree with your approach, below is a new patch which apply clean on
top of v3.1-rc3.

Best regards

René

---
diff --git a/drivers/platform/x86/ideapad-laptop.c
b/drivers/platform/x86/ideapad-laptop.c
index 0c59541..0d94eec 100644
--- a/drivers/platform/x86/ideapad-laptop.c
+++ b/drivers/platform/x86/ideapad-laptop.c
@@ -493,6 +493,8 @@ static void ideapad_backlight_notify_power(struct
ideapad_private *priv)
       unsigned long power;
       struct backlight_device *blightdev = priv->blightdev;

+     if (!blightdev)
+             return;
       if (read_ec_data(ideapad_handle, 0x18, &power))
               return;
       blightdev->props.power = power ? FB_BLANK_UNBLANK : FB_BLANK_POWERDOWN;
--

On Wed, Aug 24, 2011 at 5:12 AM, Ike Panhc <ike....@canonical.com> wrote:
> Nice done. Thanks for finding the bug. I write most part of ideapad-laptop.c
> though the maintainer is still Matthew.
>
> I think the patch attached below is much simple and we can avoid unnecessary
> read_ec_data if blightdev is not set. Since you are the one who find the bug
> and have the first patch, I would like to keep you as author and your sign
> off. Of course I need your agree. (Hoping I do not break the sign-off rule)
>
> Please review the patch below and reply if you agree with this or disagree.
>
>
> Hi Matthew,
>
> When acpi_backlight=video, priv->blightdev will be NULL and use it without
> checking will cause kernel oops. I suggest we shall have the fix in v3.1
> cycle.
>
>
> ====== 8< ======
>
> From 8bd37cd5da31abaca4b906bc84eb45a0834678ea Mon Sep 17 00:00:00 2001
> From: Rene Bolldorf <xsec...@googlemail.com>
> Date: Wed, 24 Aug 2011 09:56:24 +0800
> Subject: [PATCH] ideapad: Check if acpi already handle backlight power in
>  'ideapad_backlight_notify_power' to avoid a page fault
>
> This patch avoid a page fault in the ideapad-laptop extras when
> turning the backlight power on or off.
>
> Signed-off-by: Rene Bolldorf <xsec...@googlemail.com>
> Signed-off-by: Ike Panhc <ike....@canonical.com>
> ---
>  drivers/platform/x86/ideapad-laptop.c |    2 ++
>  1 files changed, 2 insertions(+), 0 deletions(-)
>
> diff --git a/drivers/platform/x86/ideapad-laptop.c 
> b/drivers/platform/x86/ideapad-laptop.c
> index 0c59541..0d94eec 100644
> --- a/drivers/platform/x86/ideapad-laptop.c
> +++ b/drivers/platform/x86/ideapad-laptop.c
> @@ -493,6 +493,8 @@ static void ideapad_backlight_notify_power(struct 
> ideapad_private *priv)
>        unsigned long power;
>        struct backlight_device *blightdev = priv->blightdev;
>
> +       if (!blightdev)
> +               return;
>        if (read_ec_data(ideapad_handle, 0x18, &power))
>                return;
>        blightdev->props.power = power ? FB_BLANK_UNBLANK : FB_BLANK_POWERDOWN;
> --
> 1.7.5.4
>
>
--
To unsubscribe from this list: send the line "unsubscribe platform-driver-x86" 
in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to