On Thu, Jun 2, 2011 at 11:24 AM, Ike Panhc <ike.pan@xxxxxxxxxxxxx> wrote: > Signed-off-by: Ike Panhc <ike.pan@xxxxxxxxxxxxx> > --- > Âdrivers/platform/x86/ideapad-laptop.c | Â Â5 +++++ > Â1 files changed, 5 insertions(+), 0 deletions(-) > > diff --git a/drivers/platform/x86/ideapad-laptop.c b/drivers/platform/x86/ideapad-laptop.c > index 9c09891..4a54ed1 100644 > --- a/drivers/platform/x86/ideapad-laptop.c > +++ b/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]; > @@ -199,6 +200,10 @@ static ssize_t show_ideapad_cam(struct device *dev, > Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Âstruct device_attribute *attr, > Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Âchar *buf) > Â{ > + Â Â Â struct ideapad_private *priv = dev_get_drvdata(dev); > + > + Â Â Â if (!test_bit(CFG_CAMERA_BIT, &(priv->cfg))) > + Â Â Â Â Â Â Â return sprintf(buf, "-1\n"); > Â Â Â Âreturn show_ideapad_helper(dev, attr, buf, 0x1D); > Â} > > -- > 1.7.4.1 > > -- > To unsubscribe from this list: send the line "unsubscribe platform-driver-x86" in > the body of a message to majordomo@xxxxxxxxxxxxxxx > More majordomo info at Âhttp://vger.kernel.org/majordomo-info.html > I think it would be better to not add the file when the camera is not available. Another option is to return -ENODEV. But printing -1 doesn't seems right. -- Corentin Chary http://xf.iksaif.net -- To unsubscribe from this list: send the line "unsubscribe platform-driver-x86" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html