Signed-off-by: Joe Perches <joe@xxxxxxxxxxx> --- drivers/staging/dream/camera/msm_camera.c | 119 ++++++++++++++--------------- drivers/staging/dream/camera/msm_v4l2.c | 2 +- 2 files changed, 57 insertions(+), 64 deletions(-) diff --git a/drivers/staging/dream/camera/msm_camera.c b/drivers/staging/dream/camera/msm_camera.c index 8816599..e5aaffc 100644 --- a/drivers/staging/dream/camera/msm_camera.c +++ b/drivers/staging/dream/camera/msm_camera.c @@ -10,6 +10,8 @@ /* FIXME: check limits on command lenghts passed from userspace */ /* FIXME: __msm_release: which queues should we flush when opencnt != 0 */ +#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt + #include <linux/kernel.h> #include <linux/module.h> #include <linux/init.h> @@ -25,8 +27,9 @@ #define MSM_MAX_CAMERA_SENSORS 5 -#define ERR_USER_COPY(to) pr_err("%s(%d): copy %s user\n", \ - __func__, __LINE__, ((to) ? "to" : "from")) +#define ERR_USER_COPY(to) \ + pr_err("%s(%d): copy %s user\n", \ + __func__, __LINE__, ((to) ? "to" : "from")) #define ERR_COPY_FROM_USER() ERR_USER_COPY(0) #define ERR_COPY_TO_USER() ERR_USER_COPY(1) @@ -96,12 +99,9 @@ static int check_overlap(struct hlist_head *ptype, if (CONTAINS(region, &t, paddr) || CONTAINS(&t, region, paddr) || OVERLAPS(region, &t, paddr)) { - printk(KERN_ERR - " region (PHYS %p len %ld)" - " clashes with registered region" - " (paddr %p len %ld)\n", - (void *)t.paddr, t.len, - (void *)region->paddr, region->len); + pr_err(" region (PHYS %p len %ld) clashes with registered region (paddr %p len %ld)\n", + (void *)t.paddr, t.len, + (void *)region->paddr, region->len); return -1; } } @@ -121,8 +121,8 @@ static int msm_pmem_table_add(struct hlist_head *ptype, rc = get_pmem_file(info->fd, &paddr, &vstart, &len, &file); if (rc < 0) { - pr_err("msm_pmem_table_add: get_pmem_file fd %d error %d\n", - info->fd, rc); + pr_err("%s: get_pmem_file fd %d error %d\n", + __func__, info->fd, rc); return rc; } @@ -358,12 +358,11 @@ static int __msm_get_frame(struct msm_sync *sync, pphy->cbcr_phy, &(frame->y_off), &(frame->cbcr_off), &(frame->fd)); if (!frame->buffer) { - pr_err("%s: cannot get frame, invalid lookup address " - "y=%x cbcr=%x offset=%d\n", - __FUNCTION__, - pphy->y_phy, - pphy->cbcr_phy, - frame->y_off); + pr_err("%s: cannot get frame, invalid lookup address y=%x cbcr=%x offset=%d\n", + __func__, + pphy->y_phy, + pphy->cbcr_phy, + frame->y_off); rc = -EINVAL; } @@ -392,8 +391,8 @@ static int msm_get_frame(struct msm_sync *sync, void __user *arg) if (sync->croplen) { if (frame.croplen > sync->croplen) { - pr_err("msm_get_frame: invalid frame croplen %d\n", - frame.croplen); + pr_err("invalid frame croplen %d\n", + __func__, frame.croplen); return -EINVAL; } @@ -480,7 +479,7 @@ static struct msm_queue_cmd* __msm_control(struct msm_sync *sync, if (!rc) rc = -ETIMEDOUT; if (rc < 0) { - pr_err("msm_control: wait_event error %d\n", rc); + pr_err("%s: wait_event error %d\n", __func__, rc); #if 0 /* This is a bit scary. If we time out too early, we * will free qcmd at the end of this function, and the @@ -488,7 +487,7 @@ static struct msm_queue_cmd* __msm_control(struct msm_sync *sync, * remove the message from the source queue. */ pr_err("%s: error waiting for ctrl_status_q: %d\n", - __func__, rc); + __func__, rc); spin_lock_irqsave(&sync->msg_event_q_lock, flags); list_del_init(&qcmd->list); spin_unlock_irqrestore(&sync->msg_event_q_lock, flags); @@ -528,7 +527,7 @@ static int msm_control(struct msm_control_device *ctrl_pmsm, sizeof(struct msm_ctrl_cmd) + udata.length, GFP_KERNEL); if (!qcmd) { - pr_err("msm_control: cannot allocate buffer\n"); + pr_err("%s: cannot allocate buffer\n", __func__); rc = -ENOMEM; goto end; } @@ -628,7 +627,7 @@ static int msm_get_stats(struct msm_sync *sync, void __user *arg) if (rc == 0) rc = -ETIMEDOUT; if (rc < 0) { - pr_err("msm_get_stats error %d\n", rc); + pr_err("%s: error %d\n", __func__, rc); return rc; } } @@ -669,7 +668,7 @@ static int msm_get_stats(struct msm_sync *sync, void __user *arg) &(stats.fd)); if (!stats.buffer) { pr_err("%s: msm_pmem_stats_ptov_lookup error\n", - __FUNCTION__); + __func__); rc = -EINVAL; goto failure; } @@ -720,7 +719,7 @@ static int msm_get_stats(struct msm_sync *sync, void __user *arg) } else { pr_err("%s: pmem lookup failed\n", - __func__); + __func__); rc = -EINVAL; } } @@ -875,7 +874,7 @@ static int msm_config_vfe(struct msm_sync *sync, void __user *arg) MSM_PMEM_AEC_AWB, ®ion[0], NUM_WB_EXP_STAT_OUTPUT_BUFFERS); if (!axi_data.bufnum1) { - pr_err("%s: pmem region lookup error\n", __FUNCTION__); + pr_err("%s: pmem region lookup error\n", __func__); return -EINVAL; } axi_data.region = ®ion[0]; @@ -887,7 +886,7 @@ static int msm_config_vfe(struct msm_sync *sync, void __user *arg) MSM_PMEM_AF, ®ion[0], NUM_AF_STAT_OUTPUT_BUFFERS); if (!axi_data.bufnum1) { - pr_err("%s: pmem region lookup error\n", __FUNCTION__); + pr_err("%s: pmem region lookup error\n", __func__); return -EINVAL; } axi_data.region = ®ion[0]; @@ -898,7 +897,7 @@ static int msm_config_vfe(struct msm_sync *sync, void __user *arg) break; default: pr_err("%s: unknown command type %d\n", - __FUNCTION__, cfgcmd.cmd_type); + __func__, cfgcmd.cmd_type); return -EINVAL; } @@ -927,7 +926,7 @@ static int msm_frame_axi_cfg(struct msm_sync *sync, msm_pmem_region_lookup(&sync->frame, pmem_type, ®ion[0], 8); if (!axi_data.bufnum1) { - pr_err("%s: pmem region lookup error\n", __FUNCTION__); + pr_err("%s: pmem region lookup error\n", __func__); return -EINVAL; } break; @@ -938,7 +937,7 @@ static int msm_frame_axi_cfg(struct msm_sync *sync, msm_pmem_region_lookup(&sync->frame, pmem_type, ®ion[0], 8); if (!axi_data.bufnum2) { - pr_err("%s: pmem region lookup error\n", __FUNCTION__); + pr_err("%s: pmem region lookup error\n", __func__); return -EINVAL; } break; @@ -949,7 +948,7 @@ static int msm_frame_axi_cfg(struct msm_sync *sync, msm_pmem_region_lookup(&sync->frame, pmem_type, ®ion[0], 8); if (!axi_data.bufnum1) { - pr_err("%s: pmem region lookup error\n", __FUNCTION__); + pr_err("%s: pmem region lookup error\n", __func__); return -EINVAL; } @@ -958,7 +957,7 @@ static int msm_frame_axi_cfg(struct msm_sync *sync, msm_pmem_region_lookup(&sync->frame, pmem_type, ®ion[axi_data.bufnum1], 8); if (!axi_data.bufnum2) { - pr_err("%s: pmem region lookup error\n", __FUNCTION__); + pr_err("%s: pmem region lookup error\n", __func__); return -EINVAL; } break; @@ -969,7 +968,7 @@ static int msm_frame_axi_cfg(struct msm_sync *sync, msm_pmem_region_lookup(&sync->frame, pmem_type, ®ion[0], 8); if (!axi_data.bufnum2) { - pr_err("%s: pmem region lookup error\n", __FUNCTION__); + pr_err("%s: pmem region lookup error\n", __func__); return -EINVAL; } break; @@ -980,7 +979,7 @@ static int msm_frame_axi_cfg(struct msm_sync *sync, default: pr_err("%s: unknown command type %d\n", - __FUNCTION__, cfgcmd->cmd_type); + __func__, cfgcmd->cmd_type); return -EINVAL; } @@ -1046,7 +1045,7 @@ static int __msm_put_frame_buf(struct msm_sync *sync, rc = sync->vfefn.vfe_config(&cfgcmd, &pphy); } else { pr_err("%s: msm_pmem_frame_vtop_lookup failed\n", - __FUNCTION__); + __func__); rc = -EINVAL; } @@ -1130,7 +1129,7 @@ static int msm_stats_axi_cfg(struct msm_sync *sync, break; default: pr_err("%s: unknown command type %d\n", - __FUNCTION__, cfgcmd->cmd_type); + __func__, cfgcmd->cmd_type); return -EINVAL; } @@ -1139,7 +1138,7 @@ static int msm_stats_axi_cfg(struct msm_sync *sync, msm_pmem_region_lookup(&sync->stats, pmem_type, ®ion[0], NUM_WB_EXP_STAT_OUTPUT_BUFFERS); if (!axi_data.bufnum1) { - pr_err("%s: pmem region lookup error\n", __FUNCTION__); + pr_err("%s: pmem region lookup error\n", __func__); return -EINVAL; } axi_data.region = ®ion[0]; @@ -1176,8 +1175,7 @@ static int msm_put_stats_buffer(struct msm_sync *sync, void __user *arg) cfgcmd.cmd_type = CMD_STATS_AF_BUF_RELEASE; else { pr_err("%s: invalid buf type %d\n", - __FUNCTION__, - buf.type); + __func__, buf.type); rc = -EINVAL; goto put_done; } @@ -1187,12 +1185,11 @@ static int msm_put_stats_buffer(struct msm_sync *sync, void __user *arg) if (sync->vfefn.vfe_config) { rc = sync->vfefn.vfe_config(&cfgcmd, &pphy); if (rc < 0) - pr_err("msm_put_stats_buffer: "\ - "vfe_config err %d\n", rc); + pr_err("%s: vfe_config err %d\n", __func__, rc); } else - pr_err("msm_put_stats_buffer: vfe_config is NULL\n"); + pr_err("%s: vfe_config is NULL\n", __func__); } else { - pr_err("msm_put_stats_buffer: NULL physical address\n"); + pr_err("%s: NULL physical address\n", __func__); rc = -EINVAL; } @@ -1222,8 +1219,7 @@ static int msm_axi_config(struct msm_sync *sync, void __user *arg) default: pr_err("%s: unknown command type %d\n", - __FUNCTION__, - cfgcmd.cmd_type); + __func__, cfgcmd.cmd_type); return -EINVAL; } @@ -1248,7 +1244,7 @@ static int __msm_get_pic(struct msm_sync *sync, struct msm_ctrl_cmd *ctrl) if (rc == 0) return -ETIMEDOUT; if (rc < 0) { - pr_err("msm_camera_get_picture, rc = %d\n", rc); + pr_err("%s: rc = %d\n", __func__, rc); return rc; } } @@ -1292,8 +1288,8 @@ static int msm_get_pic(struct msm_sync *sync, void __user *arg) if (sync->croplen) { if (ctrlcmd_t.length < sync->croplen) { - pr_err("msm_get_pic: invalid len %d\n", - ctrlcmd_t.length); + pr_err("%s: invalid len %d\n", + __func__, ctrlcmd_t.length); return -EINVAL; } if (copy_to_user(ctrlcmd_t.value, @@ -1712,7 +1708,7 @@ static void msm_vfe_sync(struct msm_vfe_resp *vdata, unsigned long flags; struct msm_sync *sync = (struct msm_sync *)syncdata; if (!sync) { - pr_err("msm_camera: no context in dsp callback.\n"); + pr_err("no context in dsp callback.\n"); return; } @@ -1795,10 +1791,10 @@ static int __msm_open(struct msm_sync *sync, const char *const apps_id) mutex_lock(&sync->lock); if (sync->apps_id && strcmp(sync->apps_id, apps_id)) { - pr_err("msm_camera(%s): sensor %s is already opened for %s\n", - apps_id, - sync->sdata->sensor_name, - sync->apps_id); + pr_err("(%s): sensor %s is already opened for %s\n", + apps_id, + sync->sdata->sensor_name, + sync->apps_id); rc = -EBUSY; goto msm_open_done; } @@ -1850,8 +1846,8 @@ static int msm_open_common(struct inode *inode, struct file *filep, CDBG("msm_camera: open %s\n", filep->f_path.dentry->d_name.name); if (atomic_cmpxchg(&pmsm->opened, 0, 1) && once) { - pr_err("msm_camera: %s is already opened.\n", - filep->f_path.dentry->d_name.name); + pr_err("%s is already opened.\n", + filep->f_path.dentry->d_name.name); return -EBUSY; } @@ -1972,7 +1968,7 @@ static int msm_setup_cdev(struct msm_device *msm, if (IS_ERR(device)) { rc = PTR_ERR(device); - pr_err("msm_camera: error creating device: %d\n", rc); + pr_err("error creating device: %d\n", rc); return rc; } @@ -1981,7 +1977,7 @@ static int msm_setup_cdev(struct msm_device *msm, rc = cdev_add(&msm->cdev, devno, 1); if (rc < 0) { - pr_err("msm_camera: error adding cdev: %d\n", rc); + pr_err("error adding cdev: %d\n", rc); device_destroy(msm_class, devno); return rc; } @@ -2056,8 +2052,7 @@ static int msm_sync_init(struct msm_sync *sync, } msm_camio_probe_off(pdev); if (rc < 0) { - pr_err("msm_camera: failed to initialize %s\n", - sync->sdata->sensor_name); + pr_err("failed to initialize %s\n", sync->sdata->sensor_name); wake_lock_destroy(&sync->wake_lock); return rc; } @@ -2130,7 +2125,7 @@ int msm_camera_drv_start(struct platform_device *dev, static int camera_node; if (camera_node >= MSM_MAX_CAMERA_SENSORS) { - pr_err("msm_camera: too many camera sensors\n"); + pr_err("too many camera sensors\n"); return rc; } @@ -2140,16 +2135,14 @@ int msm_camera_drv_start(struct platform_device *dev, 3 * MSM_MAX_CAMERA_SENSORS, "msm_camera"); if (rc < 0) { - pr_err("msm_camera: failed to allocate chrdev: %d\n", - rc); + pr_err("failed to allocate chrdev: %d\n", rc); return rc; } msm_class = class_create(THIS_MODULE, "msm_camera"); if (IS_ERR(msm_class)) { rc = PTR_ERR(msm_class); - pr_err("msm_camera: create device class failed: %d\n", - rc); + pr_err("create device class failed: %d\n", rc); return rc; } } diff --git a/drivers/staging/dream/camera/msm_v4l2.c b/drivers/staging/dream/camera/msm_v4l2.c index 6a7d46c..bb129d9 100644 --- a/drivers/staging/dream/camera/msm_v4l2.c +++ b/drivers/staging/dream/camera/msm_v4l2.c @@ -36,7 +36,7 @@ #define MSM_V4L2_HEIGHT 320 #if 1 -#define D(fmt, args...) printk(KERN_INFO "msm_v4l2: " fmt, ##args) +#define D(fmt, args...) pr_info("msm_v4l2: " fmt, ##args) #else #define D(fmt, args...) do {} while (0) #endif -- 1.6.5.rc3.dirty _______________________________________________ devel mailing list devel@xxxxxxxxxxxxxxxxxxxxxx http://driverdev.linuxdriverproject.org/mailman/listinfo/devel