diff options
author | Ike Panhc <ike.pan@canonical.com> | 2011-06-30 07:50:47 -0400 |
---|---|---|
committer | Matthew Garrett <mjg@redhat.com> | 2011-08-05 14:45:44 -0400 |
commit | a84511f7fbeb37e26aacb9c72f5a21ffc24e909e (patch) | |
tree | fd7ae07ffad60c7201d7d26e28c2dbc35d398040 /drivers | |
parent | 3371f48167e04017125dd08cc1f70fa93d2f2e17 (diff) |
ideapad: let camera_power node invisiable if no camera
Signed-off-by: Ike Panhc <ike.pan@canonical.com>
Signed-off-by: Matthew Garrett <mjg@redhat.com>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/platform/x86/ideapad-laptop.c | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/drivers/platform/x86/ideapad-laptop.c b/drivers/platform/x86/ideapad-laptop.c index 42b9ba7e903c..1612abde5188 100644 --- a/drivers/platform/x86/ideapad-laptop.c +++ b/drivers/platform/x86/ideapad-laptop.c | |||
@@ -38,6 +38,7 @@ | |||
38 | #define CFG_BT_BIT (16) | 38 | #define CFG_BT_BIT (16) |
39 | #define CFG_3G_BIT (17) | 39 | #define CFG_3G_BIT (17) |
40 | #define CFG_WIFI_BIT (18) | 40 | #define CFG_WIFI_BIT (18) |
41 | #define CFG_CAMERA_BIT (19) | ||
41 | 42 | ||
42 | struct ideapad_private { | 43 | struct ideapad_private { |
43 | struct rfkill *rfk[IDEAPAD_RFKILL_DEV_NUM]; | 44 | struct rfkill *rfk[IDEAPAD_RFKILL_DEV_NUM]; |
@@ -208,7 +209,24 @@ static struct attribute *ideapad_attributes[] = { | |||
208 | NULL | 209 | NULL |
209 | }; | 210 | }; |
210 | 211 | ||
212 | static mode_t ideapad_is_visible(struct kobject *kobj, | ||
213 | struct attribute *attr, | ||
214 | int idx) | ||
215 | { | ||
216 | struct device *dev = container_of(kobj, struct device, kobj); | ||
217 | struct ideapad_private *priv = dev_get_drvdata(dev); | ||
218 | bool supported; | ||
219 | |||
220 | if (attr == &dev_attr_camera_power.attr) | ||
221 | supported = test_bit(CFG_CAMERA_BIT, &(priv->cfg)); | ||
222 | else | ||
223 | supported = true; | ||
224 | |||
225 | return supported ? attr->mode : 0; | ||
226 | } | ||
227 | |||
211 | static struct attribute_group ideapad_attribute_group = { | 228 | static struct attribute_group ideapad_attribute_group = { |
229 | .is_visible = ideapad_is_visible, | ||
212 | .attrs = ideapad_attributes | 230 | .attrs = ideapad_attributes |
213 | }; | 231 | }; |
214 | 232 | ||