Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 262594
b: refs/heads/master
c: a84511f
h: refs/heads/master
v: v3
  • Loading branch information
Ike Panhc authored and Matthew Garrett committed Aug 5, 2011
1 parent 2cb48ae commit 25c4ccb
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 1 deletion.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 3371f48167e04017125dd08cc1f70fa93d2f2e17
refs/heads/master: a84511f7fbeb37e26aacb9c72f5a21ffc24e909e
18 changes: 18 additions & 0 deletions trunk/drivers/platform/x86/ideapad-laptop.c
Original file line number Diff line number Diff line change
Expand Up @@ -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];
Expand Down Expand Up @@ -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
};

Expand Down

0 comments on commit 25c4ccb

Please sign in to comment.