Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

[media] media: davinci: vpif_display: return -ENODATA for *std calls

this patch adds supports to return -ENODATA to *std calls
if the selected output does not support it.

Signed-off-by: Lad, Prabhakar <prabhakar.csengg@gmail.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>

authored by

Lad, Prabhakar and committed by
Mauro Carvalho Chehab
f27d0f45 1093c590

+24 -1
+24 -1
drivers/media/platform/davinci/vpif_display.c
··· 715 715 716 716 static int vpif_s_std(struct file *file, void *priv, v4l2_std_id std_id) 717 717 { 718 + struct vpif_display_config *config = vpif_dev->platform_data; 718 719 struct video_device *vdev = video_devdata(file); 719 720 struct channel_obj *ch = video_get_drvdata(vdev); 720 721 struct common_obj *common = &ch->common[VPIF_VIDEO_INDEX]; 721 - int ret = 0; 722 + struct vpif_display_chan_config *chan_cfg; 723 + struct v4l2_output output; 724 + int ret; 725 + 726 + if (config->chan_config[ch->channel_id].outputs == NULL) 727 + return -ENODATA; 728 + 729 + chan_cfg = &config->chan_config[ch->channel_id]; 730 + output = chan_cfg->outputs[ch->output_idx].output; 731 + if (output.capabilities != V4L2_OUT_CAP_STD) 732 + return -ENODATA; 722 733 723 734 if (vb2_is_busy(&common->buffer_queue)) 724 735 return -EBUSY; 736 + 725 737 726 738 if (!(std_id & VPIF_V4L2_STD)) 727 739 return -EINVAL; ··· 766 754 767 755 static int vpif_g_std(struct file *file, void *priv, v4l2_std_id *std) 768 756 { 757 + struct vpif_display_config *config = vpif_dev->platform_data; 769 758 struct video_device *vdev = video_devdata(file); 770 759 struct channel_obj *ch = video_get_drvdata(vdev); 760 + struct vpif_display_chan_config *chan_cfg; 761 + struct v4l2_output output; 762 + 763 + if (config->chan_config[ch->channel_id].outputs == NULL) 764 + return -ENODATA; 765 + 766 + chan_cfg = &config->chan_config[ch->channel_id]; 767 + output = chan_cfg->outputs[ch->output_idx].output; 768 + if (output.capabilities != V4L2_OUT_CAP_STD) 769 + return -ENODATA; 771 770 772 771 *std = ch->video.stdid; 773 772 return 0;