From 25c4ccbfeff2154c5ad321d2530ee3f9d9dc6e8f Mon Sep 17 00:00:00 2001 From: Ike Panhc Date: Thu, 30 Jun 2011 19:50:47 +0800 Subject: [PATCH] --- yaml --- r: 262594 b: refs/heads/master c: a84511f7fbeb37e26aacb9c72f5a21ffc24e909e h: refs/heads/master v: v3 --- [refs] | 2 +- trunk/drivers/platform/x86/ideapad-laptop.c | 18 ++++++++++++++++++ 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/[refs] b/[refs] index d60281c77ec1..72a36a1a6783 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 3371f48167e04017125dd08cc1f70fa93d2f2e17 +refs/heads/master: a84511f7fbeb37e26aacb9c72f5a21ffc24e909e diff --git a/trunk/drivers/platform/x86/ideapad-laptop.c b/trunk/drivers/platform/x86/ideapad-laptop.c index 42b9ba7e903c..1612abde5188 100644 --- a/trunk/drivers/platform/x86/ideapad-laptop.c +++ b/trunk/drivers/platform/x86/ideapad-laptop.c @@ -38,6 +38,7 @@ #define CFG_BT_BIT (16) #define CFG_3G_BIT (17) #define CFG_WIFI_BIT (18) +#define CFG_CAMERA_BIT (19) struct ideapad_private { struct rfkill *rfk[IDEAPAD_RFKILL_DEV_NUM]; @@ -208,7 +209,24 @@ static struct attribute *ideapad_attributes[] = { NULL }; +static mode_t ideapad_is_visible(struct kobject *kobj, + struct attribute *attr, + int idx) +{ + struct device *dev = container_of(kobj, struct device, kobj); + struct ideapad_private *priv = dev_get_drvdata(dev); + bool supported; + + if (attr == &dev_attr_camera_power.attr) + supported = test_bit(CFG_CAMERA_BIT, &(priv->cfg)); + else + supported = true; + + return supported ? attr->mode : 0; +} + static struct attribute_group ideapad_attribute_group = { + .is_visible = ideapad_is_visible, .attrs = ideapad_attributes };