Hi William,

The 'struct v4l2_subdev *sd' is v4l2 sub device pointer, and these functions 
are used in standard V4L2 CID controls,
The V4L2 main driver (ISP driver) will pass this subdev handle to the sub 
device driver,
if this pointer is NULL (it shouldn't be, otherwise this subdev driver will not 
be created), we should have been detected at the probe stage.

The *value is also passed down by the V4L2 main driver, it point to one of V4L2 
CID control parameters, it won't be NULL here.

-- Yong
Phone (+86) 21-61166334
Lab (+86) 21-61167881

-----Original Message-----
From: William Douglas [mailto:william.r.doug...@gmail.com] 
Sent: Friday, June 24, 2011 6:59 AM
To: He, Yong M
Cc: Arjan van de Ven; MeeGo-kernel@lists.meego.com; Kristen Carlson Accardi
Subject: Re: [Meego-kernel] [PATCH] MRST Tablet camera driver ver-0.953, fix 
9960


   -static int ov5640_q_flash(struct i2c_client *c, int *value)
   +static int ov5640_q_flash(struct v4l2_subdev *sd, int *value)
    {
   -    if(!value)
   -            return -EINVAL;
           *value=ov5640_flash;
           return 0;
    }
   @@ -1327,6 +1322,37 @@
           return ret;
    }


   +static int ov5640_q_exposure_level_detect(struct v4l2_subdev *sd, int 
*value)
   +{
   +    int ret = 0;
   +    struct i2c_client *c = v4l2_get_subdevdata(sd);
   +    int exposure, gain;
   +    u8 v;
   +
   +    ret += ov5640_read(c, 0x3500, &v);
   +    exposure = v;
   +    ret += ov5640_read(c, 0x3501, &v);
   +    exposure = (exposure<<8) | v;
   +    ret += ov5640_read(c, 0x3502, &v);
   +    exposure = (exposure<<8) | v;
   +
   +    ret += ov5640_read(c, 0x350a, &v);
   +    gain = v;
   +    ret += ov5640_read(c, 0x350b, &v);
   +    gain = (gain<<8) | v;
   +
   +    *value = exposure*gain;
   +    return ret;
   +}
   +

I am not sure why it is okay to not check if value is NULL before doing the 
assign in the above two statements.  Could you clarify that for me?
_______________________________________________
MeeGo-kernel mailing list
MeeGo-kernel@lists.meego.com
http://lists.meego.com/listinfo/meego-kernel

Reply via email to