Hi Arjan/Kristen,
I made the same cleanups on mrstov9740.c, Please review. From: Yong He <[email protected]<mailto:[email protected]>> Subject: [patch] mrstov9740: use linux debug print mechanism #9826 Bug 9826 - camera driver is very noisy. Signed-off-by: He, Yong <[email protected]<mailto:[email protected]>> ---- Index: linux-2.6.37/drivers/staging/mrstci/mrstov9740/mrstov9740.c =================================================================== --- linux-2.6.37/drivers/staging/mrstci/mrstov9740/mrstov9740.c (revision 106) +++ linux-2.6.37/drivers/staging/mrstci/mrstov9740/mrstov9740.c (working copy) @@ -49,19 +49,12 @@ #include "ov9740.h" #define DRIVER_VERSION "0.941" -//#define pr_fmt(fmt) "ov9740: " fmt +#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt -static int mrstov9740_debug = 3; -#define dprintk(level, fmt, arg...) do { \ - if (mrstov9740_debug >= level) \ - printk(KERN_DEBUG "ov9740@%s: " fmt "\n", \ - __func__, ## arg); } \ - while (0) +#define DBG_entering pr_debug("%s entering", __func__); +#define DBG_leaving pr_debug("%s leaving", __func__); +#define DBG_line pr_debug(" line: %d", __LINE__); -#define DBG_entering dprintk(2, "%s entering", __func__); -#define DBG_leaving dprintk(2,"%s leaving", __func__); -#define DBG_line dprintk(2," line: %d", __LINE__); - static inline struct ci_sensor_config *to_sensor_config(struct v4l2_subdev *sd) { return container_of(sd, struct ci_sensor_config, sd); @@ -162,7 +155,6 @@ *value = ret_val; ret = (ret == 2) ? 0 : -1; - dprintk( 4, " && ov9740_read \t\t\t(0x%04x) ------> 0x%02x",reg,*value); return ret; } @@ -191,7 +183,6 @@ msleep(3); ret = (ret == 1) ? 0 : -1; - dprintk( 4, "&& ov9740_write \t\t\t(0x%04x) <------ 0x%02x",reg,value); return ret; } @@ -236,14 +227,14 @@ static int ov9740_standby(void) { gpio_set_value(GPIO_STDBY_PIN, 1); - dprintk(1, "PM: ov9740 standby called\n"); + printk(KERN_INFO "PM: ov9740 standby called\n"); return 0; } static int ov9740_wakeup(void) { gpio_set_value(GPIO_STDBY_PIN, 0); - dprintk(1, "PM: ov9740 wakeup called\n"); + printk(KERN_INFO "PM: ov9740 wakeup called\n"); return 0; } @@ -482,13 +473,17 @@ target_res_index = find_OV9740_TIMING_index(res_index->res); if (previous_res != target_res_index) { - dprintk( 3, "[ov9740-wr-reg] <----------- changing res from index-%d to index-%d (%dx%d)", previous_res, target_res_index,width, height); - dprintk( 3, "[ov9740-wr-reg] <----------- Set resolutiojn Configs"); + dev_dbg(sd->v4l2_dev->dev, + "changing res from index-%d to index-%d (%dx%d)", + previous_res, target_res_index, width, height); + dev_dbg(sd->v4l2_dev->dev, "Set Resolution Configs"); ret += ov9740_write_array(client, res_index->regs); previous_res = target_res_index; } else { - dprintk(3, "[ov9740-wr-reg] <----------- same res index-%d (%dx%d)", target_res_index,width, height); + dev_dbg(sd->v4l2_dev->dev, + "same res index-%d (%dx%d)", + target_res_index, width, height); } /* Marked current sensor res as being "used" */ @@ -809,13 +804,14 @@ struct i2c_client *client = v4l2_get_subdevdata(sd); DBG_entering; - dprintk( 1, "[ov9740-wr-reg] <----------- ov9740: s_stream %d \n",enable); + dev_dbg(sd->v4l2_dev->dev, "ov9740: s_stream %d\n", enable); if (enable) { unsigned char v; ov9740_read(client, 0x0100, &v); if ((v & 0xff) != 0x01) { - dprintk( 1, "[ov9740-wr-reg] <----------- set stream on, sleep 300 ms for sensor adjusting...\n"); + dev_dbg(sd->v4l2_dev->dev, + "set stream on, sleep 300 ms for sensor adjusting...\n"); ov9740_write(client, 0x0100, 0x01); msleep(300); } @@ -856,7 +852,9 @@ DBG_entering; res_index = find_OV9740_res_index(fival->width, fival->height); - dprintk( 1, "find res index %d (%dx%d)\n",res_index,fival->width, fival->height); + dev_dbg(sd->v4l2_dev->dev, + "find res index %d (%dx%d)\n", + res_index, fival->width, fival->height); if (res_index >= N_RES) return -EINVAL; @@ -879,7 +877,8 @@ fival->type = V4L2_FRMIVAL_TYPE_DISCRETE; fival->discrete.numerator = 1; fival->discrete.denominator = ov9740_res[res_index].fps[index]; - dprintk( 1, "find FPS index-%d (%d)\n",index,fival->discrete.denominator); + dev_dbg(sd->v4l2_dev->dev, "find FPS index-%d (%d)\n", + index, fival->discrete.denominator); DBG_leaving; @@ -900,7 +899,7 @@ if (target_fps == ov9740_res[previous_res].fps[fps_i]) { // found the target fps u8 val; - dprintk( 1, "set sensor FPS to %d\n", target_fps); + dev_dbg(sd->v4l2_dev->dev, "set sensor FPS to %d\n", target_fps); ov9740_read(client, 0x0100, &val); if (val == 0x01) ov9740_s_stream(sd, 0); @@ -913,12 +912,15 @@ } } if (fps_i >= OV9740_N_FPS) { - dprintk( 1, "Warning!! target FPS %d/%d is not found in sensor supported table.\n", - param->parm.capture.timeperframe.denominator, param->parm.capture.timeperframe.numerator); + dev_dbg(sd->v4l2_dev->dev, + "Warning!! target FPS %d/%d is not found in sensor supported table.\n", + param->parm.capture.timeperframe.denominator, + param->parm.capture.timeperframe.numerator); return -EINVAL; } } else { - dprintk( 1, "Warning!! current_res (%d) is not used??\n", + dev_dbg(sd->v4l2_dev->dev, + "Warning!! current_res (%d) is not used??\n", previous_res); } Signed-off-by: Yong He <[email protected]> Best Regards, Yong He Software Engineer, PCSD SW Solutions, Intel Asia-Pacific R&D Ltd. Phone (+86) 21-61166334 Lab (+86) 21-61167881
linux-2.6.37-camera-debug-printk-ov9740.patch
Description: linux-2.6.37-camera-debug-printk-ov9740.patch
_______________________________________________ MeeGo-kernel mailing list [email protected] http://lists.meego.com/listinfo/meego-kernel
