V4L/DVB: V4L - vpfe capture - fix for kernel crash
authorMuralidharan Karicheri <m-karicheri2@ti.com>
Thu, 18 Mar 2010 14:44:12 +0000 (11:44 -0300)
committerMauro Carvalho Chehab <mchehab@redhat.com>
Thu, 6 May 2010 22:19:05 +0000 (19:19 -0300)
As part of upstream merge, set_params() function was removed from isif.c.
This requires removal of BUG_ON() and check for set_params ptr in
vpfe_capture.c. Without this kernel crash dump is seen while bootup on DM365

Also made following changes:-

 1) converted error messages to debug messages since it is not right to flood
    the console with error messages for user mistakes.
 2) returns -EINVAL if ioctl is not supported

Signed-off-by: Muralidharan Karicheri <m-karicheri2@ti.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
drivers/media/video/davinci/vpfe_capture.c

index 55128644b5d7370cd2c67c0a345063d78d0f6df5..398dbe71cb82aa60ca07e104b84c89f4274b959e 100644 (file)
@@ -223,7 +223,6 @@ int vpfe_register_ccdc_device(struct ccdc_hw_device *dev)
        BUG_ON(!dev->hw_ops.get_frame_format);
        BUG_ON(!dev->hw_ops.get_pixel_format);
        BUG_ON(!dev->hw_ops.set_pixel_format);
-       BUG_ON(!dev->hw_ops.set_params);
        BUG_ON(!dev->hw_ops.set_image_window);
        BUG_ON(!dev->hw_ops.get_image_window);
        BUG_ON(!dev->hw_ops.get_line_length);
@@ -1689,11 +1688,12 @@ static long vpfe_param_handler(struct file *file, void *priv,
        struct vpfe_device *vpfe_dev = video_drvdata(file);
        int ret = 0;
 
-       v4l2_dbg(1, debug, &vpfe_dev->v4l2_dev, "vpfe_param_handler\n");
+       v4l2_dbg(2, debug, &vpfe_dev->v4l2_dev, "vpfe_param_handler\n");
 
        if (vpfe_dev->started) {
                /* only allowed if streaming is not started */
-               v4l2_err(&vpfe_dev->v4l2_dev, "device already started\n");
+               v4l2_dbg(1, debug, &vpfe_dev->v4l2_dev,
+                       "device already started\n");
                return -EBUSY;
        }
 
@@ -1705,16 +1705,23 @@ static long vpfe_param_handler(struct file *file, void *priv,
        case VPFE_CMD_S_CCDC_RAW_PARAMS:
                v4l2_warn(&vpfe_dev->v4l2_dev,
                          "VPFE_CMD_S_CCDC_RAW_PARAMS: experimental ioctl\n");
-               ret = ccdc_dev->hw_ops.set_params(param);
-               if (ret) {
-                       v4l2_err(&vpfe_dev->v4l2_dev,
-                               "Error in setting parameters in CCDC\n");
-                       goto unlock_out;
-               }
-               if (vpfe_get_ccdc_image_format(vpfe_dev, &vpfe_dev->fmt) < 0) {
-                       v4l2_err(&vpfe_dev->v4l2_dev,
-                               "Invalid image format at CCDC\n");
-                       goto unlock_out;
+               if (ccdc_dev->hw_ops.set_params) {
+                       ret = ccdc_dev->hw_ops.set_params(param);
+                       if (ret) {
+                               v4l2_dbg(1, debug, &vpfe_dev->v4l2_dev,
+                                       "Error setting parameters in CCDC\n");
+                               goto unlock_out;
+                       }
+                       if (vpfe_get_ccdc_image_format(vpfe_dev,
+                                                      &vpfe_dev->fmt) < 0) {
+                               v4l2_dbg(1, debug, &vpfe_dev->v4l2_dev,
+                                       "Invalid image format at CCDC\n");
+                               goto unlock_out;
+                       }
+               } else {
+                       ret = -EINVAL;
+                       v4l2_dbg(1, debug, &vpfe_dev->v4l2_dev,
+                               "VPFE_CMD_S_CCDC_RAW_PARAMS not supported\n");
                }
                break;
        default: