Skip to content

Commit

Permalink
[media] v4l2: pass std by value to the write-only s_std ioctl
Browse files Browse the repository at this point in the history
This ioctl is defined as IOW, so pass the argument by value instead of by
reference. I could have chosen to add const instead, but this is 1) easier
to handle in drivers and 2) consistent with the s_std subdev operation.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Acked-by: Jonathan Corbet <corbet@lwn.net>
Acked-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
Acked-by: Lad, Prabhakar <prabhakar.csengg@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
  • Loading branch information
Hans Verkuil authored and Mauro Carvalho Chehab committed Mar 24, 2013
1 parent 2f73c7c commit 314527a
Show file tree
Hide file tree
Showing 56 changed files with 165 additions and 165 deletions.
4 changes: 2 additions & 2 deletions drivers/media/common/saa7146/saa7146_video.c
Original file line number Diff line number Diff line change
Expand Up @@ -832,7 +832,7 @@ static int vidioc_g_std(struct file *file, void *fh, v4l2_std_id *norm)
}
*/

static int vidioc_s_std(struct file *file, void *fh, v4l2_std_id *id)
static int vidioc_s_std(struct file *file, void *fh, v4l2_std_id id)
{
struct saa7146_dev *dev = ((struct saa7146_fh *)fh)->dev;
struct saa7146_vv *vv = dev->vv_data;
Expand All @@ -856,7 +856,7 @@ static int vidioc_s_std(struct file *file, void *fh, v4l2_std_id *id)
}

for (i = 0; i < dev->ext_vv_data->num_stds; i++)
if (*id & dev->ext_vv_data->stds[i].id)
if (id & dev->ext_vv_data->stds[i].id)
break;
if (i != dev->ext_vv_data->num_stds) {
vv->standard = &dev->ext_vv_data->stds[i];
Expand Down
4 changes: 2 additions & 2 deletions drivers/media/parport/pms.c
Original file line number Diff line number Diff line change
Expand Up @@ -735,12 +735,12 @@ static int pms_g_std(struct file *file, void *fh, v4l2_std_id *std)
return 0;
}

static int pms_s_std(struct file *file, void *fh, v4l2_std_id *std)
static int pms_s_std(struct file *file, void *fh, v4l2_std_id std)
{
struct pms *dev = video_drvdata(file);
int ret = 0;

dev->std = *std;
dev->std = std;
if (dev->std & V4L2_STD_NTSC) {
pms_framerate(dev, 30);
pms_secamcross(dev, 0);
Expand Down
6 changes: 3 additions & 3 deletions drivers/media/pci/bt8xx/bttv-driver.c
Original file line number Diff line number Diff line change
Expand Up @@ -1713,22 +1713,22 @@ static void radio_enable(struct bttv *btv)
}
}

static int bttv_s_std(struct file *file, void *priv, v4l2_std_id *id)
static int bttv_s_std(struct file *file, void *priv, v4l2_std_id id)
{
struct bttv_fh *fh = priv;
struct bttv *btv = fh->btv;
unsigned int i;
int err = 0;

for (i = 0; i < BTTV_TVNORMS; i++)
if (*id & bttv_tvnorms[i].v4l2_id)
if (id & bttv_tvnorms[i].v4l2_id)
break;
if (i == BTTV_TVNORMS) {
err = -EINVAL;
goto err;
}

btv->std = *id;
btv->std = id;
set_tvnorm(btv, i);

err:
Expand Down
2 changes: 1 addition & 1 deletion drivers/media/pci/cx18/cx18-driver.c
Original file line number Diff line number Diff line change
Expand Up @@ -1243,7 +1243,7 @@ int cx18_init_on_first_open(struct cx18 *cx)
in one place. */
cx->std++; /* Force full standard initialization */
std = (cx->tuner_std == V4L2_STD_ALL) ? V4L2_STD_NTSC_M : cx->tuner_std;
cx18_s_std(NULL, &fh, &std);
cx18_s_std(NULL, &fh, std);
cx18_s_frequency(NULL, &fh, &vf);
return 0;
}
Expand Down
10 changes: 5 additions & 5 deletions drivers/media/pci/cx18/cx18-ioctl.c
Original file line number Diff line number Diff line change
Expand Up @@ -637,15 +637,15 @@ static int cx18_g_std(struct file *file, void *fh, v4l2_std_id *std)
return 0;
}

int cx18_s_std(struct file *file, void *fh, v4l2_std_id *std)
int cx18_s_std(struct file *file, void *fh, v4l2_std_id std)
{
struct cx18_open_id *id = fh2id(fh);
struct cx18 *cx = id->cx;

if ((*std & V4L2_STD_ALL) == 0)
if ((std & V4L2_STD_ALL) == 0)
return -EINVAL;

if (*std == cx->std)
if (std == cx->std)
return 0;

if (test_bit(CX18_F_I_RADIO_USER, &cx->i_flags) ||
Expand All @@ -656,8 +656,8 @@ int cx18_s_std(struct file *file, void *fh, v4l2_std_id *std)
return -EBUSY;
}

cx->std = *std;
cx->is_60hz = (*std & V4L2_STD_525_60) ? 1 : 0;
cx->std = std;
cx->is_60hz = (std & V4L2_STD_525_60) ? 1 : 0;
cx->is_50hz = !cx->is_60hz;
cx2341x_handler_set_50hz(&cx->cxhdl, cx->is_50hz);
cx->cxhdl.width = 720;
Expand Down
2 changes: 1 addition & 1 deletion drivers/media/pci/cx18/cx18-ioctl.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,6 @@ u16 cx18_service2vbi(int type);
void cx18_expand_service_set(struct v4l2_sliced_vbi_format *fmt, int is_pal);
u16 cx18_get_service_set(struct v4l2_sliced_vbi_format *fmt);
void cx18_set_funcs(struct video_device *vdev);
int cx18_s_std(struct file *file, void *fh, v4l2_std_id *std);
int cx18_s_std(struct file *file, void *fh, v4l2_std_id std);
int cx18_s_frequency(struct file *file, void *fh, const struct v4l2_frequency *vf);
int cx18_s_input(struct file *file, void *fh, unsigned int inp);
6 changes: 3 additions & 3 deletions drivers/media/pci/cx23885/cx23885-417.c
Original file line number Diff line number Diff line change
Expand Up @@ -1222,22 +1222,22 @@ static int vidioc_g_std(struct file *file, void *priv, v4l2_std_id *id)
return 0;
}

static int vidioc_s_std(struct file *file, void *priv, v4l2_std_id *id)
static int vidioc_s_std(struct file *file, void *priv, v4l2_std_id id)
{
struct cx23885_fh *fh = file->private_data;
struct cx23885_dev *dev = fh->dev;
unsigned int i;

for (i = 0; i < ARRAY_SIZE(cx23885_tvnorms); i++)
if (*id & cx23885_tvnorms[i].id)
if (id & cx23885_tvnorms[i].id)
break;
if (i == ARRAY_SIZE(cx23885_tvnorms))
return -EINVAL;
dev->encodernorm = cx23885_tvnorms[i];

/* Have the drier core notify the subdevices */
mutex_lock(&dev->lock);
cx23885_set_tvnorm(dev, *id);
cx23885_set_tvnorm(dev, id);
mutex_unlock(&dev->lock);

return 0;
Expand Down
4 changes: 2 additions & 2 deletions drivers/media/pci/cx23885/cx23885-video.c
Original file line number Diff line number Diff line change
Expand Up @@ -1259,13 +1259,13 @@ static int vidioc_g_std(struct file *file, void *priv, v4l2_std_id *id)
return 0;
}

static int vidioc_s_std(struct file *file, void *priv, v4l2_std_id *tvnorms)
static int vidioc_s_std(struct file *file, void *priv, v4l2_std_id tvnorms)
{
struct cx23885_dev *dev = ((struct cx23885_fh *)priv)->dev;
dprintk(1, "%s()\n", __func__);

mutex_lock(&dev->lock);
cx23885_set_tvnorm(dev, *tvnorms);
cx23885_set_tvnorm(dev, tvnorms);
mutex_unlock(&dev->lock);

return 0;
Expand Down
6 changes: 3 additions & 3 deletions drivers/media/pci/cx25821/cx25821-video.c
Original file line number Diff line number Diff line change
Expand Up @@ -1203,7 +1203,7 @@ int cx25821_vidioc_s_priority(struct file *file, void *f,
}

#ifdef TUNER_FLAG
int cx25821_vidioc_s_std(struct file *file, void *priv, v4l2_std_id * tvnorms)
int cx25821_vidioc_s_std(struct file *file, void *priv, v4l2_std_id tvnorms)
{
struct cx25821_fh *fh = priv;
struct cx25821_dev *dev = ((struct cx25821_fh *)priv)->dev;
Expand All @@ -1218,11 +1218,11 @@ int cx25821_vidioc_s_std(struct file *file, void *priv, v4l2_std_id * tvnorms)
return err;
}

if (dev->tvnorm == *tvnorms)
if (dev->tvnorm == tvnorms)
return 0;

mutex_lock(&dev->lock);
cx25821_set_tvnorm(dev, *tvnorms);
cx25821_set_tvnorm(dev, tvnorms);
mutex_unlock(&dev->lock);

medusa_set_videostandard(dev);
Expand Down
2 changes: 1 addition & 1 deletion drivers/media/pci/cx25821/cx25821-video.h
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ extern int cx25821_vidioc_querybuf(struct file *file, void *priv,
extern int cx25821_vidioc_qbuf(struct file *file, void *priv,
struct v4l2_buffer *p);
extern int cx25821_vidioc_s_std(struct file *file, void *priv,
v4l2_std_id *tvnorms);
v4l2_std_id tvnorms);
extern int cx25821_enum_input(struct cx25821_dev *dev, struct v4l2_input *i);
extern int cx25821_vidioc_enum_input(struct file *file, void *priv,
struct v4l2_input *i);
Expand Down
4 changes: 2 additions & 2 deletions drivers/media/pci/cx88/cx88-blackbird.c
Original file line number Diff line number Diff line change
Expand Up @@ -939,12 +939,12 @@ static int vidioc_g_std(struct file *file, void *priv, v4l2_std_id *tvnorm)
return 0;
}

static int vidioc_s_std (struct file *file, void *priv, v4l2_std_id *id)
static int vidioc_s_std(struct file *file, void *priv, v4l2_std_id id)
{
struct cx88_core *core = ((struct cx8802_fh *)priv)->dev->core;

mutex_lock(&core->lock);
cx88_set_tvnorm(core,*id);
cx88_set_tvnorm(core, id);
mutex_unlock(&core->lock);
return 0;
}
Expand Down
4 changes: 2 additions & 2 deletions drivers/media/pci/cx88/cx88-video.c
Original file line number Diff line number Diff line change
Expand Up @@ -1193,12 +1193,12 @@ static int vidioc_g_std(struct file *file, void *priv, v4l2_std_id *tvnorm)
return 0;
}

static int vidioc_s_std (struct file *file, void *priv, v4l2_std_id *tvnorms)
static int vidioc_s_std(struct file *file, void *priv, v4l2_std_id tvnorms)
{
struct cx88_core *core = ((struct cx8800_fh *)priv)->dev->core;

mutex_lock(&core->lock);
cx88_set_tvnorm(core,*tvnorms);
cx88_set_tvnorm(core, tvnorms);
mutex_unlock(&core->lock);

return 0;
Expand Down
4 changes: 2 additions & 2 deletions drivers/media/pci/ivtv/ivtv-driver.c
Original file line number Diff line number Diff line change
Expand Up @@ -1387,7 +1387,7 @@ int ivtv_init_on_first_open(struct ivtv *itv)
if (!itv->has_cx23415)
write_reg_sync(0x03, IVTV_REG_DMACONTROL);

ivtv_s_std_enc(itv, &itv->tuner_std);
ivtv_s_std_enc(itv, itv->tuner_std);

/* Default interrupts enabled. For the PVR350 this includes the
decoder VSYNC interrupt, which is always on. It is not only used
Expand All @@ -1397,7 +1397,7 @@ int ivtv_init_on_first_open(struct ivtv *itv)
if (itv->v4l2_cap & V4L2_CAP_VIDEO_OUTPUT) {
ivtv_clear_irq_mask(itv, IVTV_IRQ_MASK_INIT | IVTV_IRQ_DEC_VSYNC);
ivtv_set_osd_alpha(itv);
ivtv_s_std_dec(itv, &itv->tuner_std);
ivtv_s_std_dec(itv, itv->tuner_std);
} else {
ivtv_clear_irq_mask(itv, IVTV_IRQ_MASK_INIT);
}
Expand Down
4 changes: 2 additions & 2 deletions drivers/media/pci/ivtv/ivtv-firmware.c
Original file line number Diff line number Diff line change
Expand Up @@ -302,15 +302,15 @@ static int ivtv_firmware_restart(struct ivtv *itv)
/* Restore encoder video standard */
std = itv->std;
itv->std = 0;
ivtv_s_std_enc(itv, &std);
ivtv_s_std_enc(itv, std);

if (itv->v4l2_cap & V4L2_CAP_VIDEO_OUTPUT) {
ivtv_init_mpeg_decoder(itv);

/* Restore decoder video standard */
std = itv->std_out;
itv->std_out = 0;
ivtv_s_std_dec(itv, &std);
ivtv_s_std_dec(itv, std);

/* Restore framebuffer if active */
if (itv->ivtvfb_restore)
Expand Down
18 changes: 9 additions & 9 deletions drivers/media/pci/ivtv/ivtv-ioctl.c
Original file line number Diff line number Diff line change
Expand Up @@ -1103,10 +1103,10 @@ static int ivtv_g_std(struct file *file, void *fh, v4l2_std_id *std)
return 0;
}

void ivtv_s_std_enc(struct ivtv *itv, v4l2_std_id *std)
void ivtv_s_std_enc(struct ivtv *itv, v4l2_std_id std)
{
itv->std = *std;
itv->is_60hz = (*std & V4L2_STD_525_60) ? 1 : 0;
itv->std = std;
itv->is_60hz = (std & V4L2_STD_525_60) ? 1 : 0;
itv->is_50hz = !itv->is_60hz;
cx2341x_handler_set_50hz(&itv->cxhdl, itv->is_50hz);
itv->cxhdl.width = 720;
Expand All @@ -1122,15 +1122,15 @@ void ivtv_s_std_enc(struct ivtv *itv, v4l2_std_id *std)
ivtv_call_all(itv, core, s_std, itv->std);
}

void ivtv_s_std_dec(struct ivtv *itv, v4l2_std_id *std)
void ivtv_s_std_dec(struct ivtv *itv, v4l2_std_id std)
{
struct yuv_playback_info *yi = &itv->yuv_info;
DEFINE_WAIT(wait);
int f;

/* set display standard */
itv->std_out = *std;
itv->is_out_60hz = (*std & V4L2_STD_525_60) ? 1 : 0;
itv->std_out = std;
itv->is_out_60hz = (std & V4L2_STD_525_60) ? 1 : 0;
itv->is_out_50hz = !itv->is_out_60hz;
ivtv_call_all(itv, video, s_std_output, itv->std_out);

Expand Down Expand Up @@ -1168,14 +1168,14 @@ void ivtv_s_std_dec(struct ivtv *itv, v4l2_std_id *std)
}
}

static int ivtv_s_std(struct file *file, void *fh, v4l2_std_id *std)
static int ivtv_s_std(struct file *file, void *fh, v4l2_std_id std)
{
struct ivtv *itv = fh2id(fh)->itv;

if ((*std & V4L2_STD_ALL) == 0)
if ((std & V4L2_STD_ALL) == 0)
return -EINVAL;

if (*std == itv->std)
if (std == itv->std)
return 0;

if (test_bit(IVTV_F_I_RADIO_USER, &itv->i_flags) ||
Expand Down
4 changes: 2 additions & 2 deletions drivers/media/pci/ivtv/ivtv-ioctl.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ u16 ivtv_get_service_set(struct v4l2_sliced_vbi_format *fmt);
void ivtv_set_osd_alpha(struct ivtv *itv);
int ivtv_set_speed(struct ivtv *itv, int speed);
void ivtv_set_funcs(struct video_device *vdev);
void ivtv_s_std_enc(struct ivtv *itv, v4l2_std_id *std);
void ivtv_s_std_dec(struct ivtv *itv, v4l2_std_id *std);
void ivtv_s_std_enc(struct ivtv *itv, v4l2_std_id std);
void ivtv_s_std_dec(struct ivtv *itv, v4l2_std_id std);
int ivtv_s_frequency(struct file *file, void *fh, const struct v4l2_frequency *vf);
int ivtv_s_input(struct file *file, void *fh, unsigned int inp);

Expand Down
2 changes: 1 addition & 1 deletion drivers/media/pci/saa7134/saa7134-empress.c
Original file line number Diff line number Diff line change
Expand Up @@ -428,7 +428,7 @@ static int empress_g_chip_ident(struct file *file, void *fh,
return -EINVAL;
}

static int empress_s_std(struct file *file, void *priv, v4l2_std_id *id)
static int empress_s_std(struct file *file, void *priv, v4l2_std_id id)
{
struct saa7134_dev *dev = file->private_data;

Expand Down
14 changes: 7 additions & 7 deletions drivers/media/pci/saa7134/saa7134-video.c
Original file line number Diff line number Diff line change
Expand Up @@ -1828,7 +1828,7 @@ static int saa7134_querycap(struct file *file, void *priv,
return 0;
}

int saa7134_s_std_internal(struct saa7134_dev *dev, struct saa7134_fh *fh, v4l2_std_id *id)
int saa7134_s_std_internal(struct saa7134_dev *dev, struct saa7134_fh *fh, v4l2_std_id id)
{
unsigned long flags;
unsigned int i;
Expand All @@ -1849,17 +1849,17 @@ int saa7134_s_std_internal(struct saa7134_dev *dev, struct saa7134_fh *fh, v4l2_
}

for (i = 0; i < TVNORMS; i++)
if (*id == tvnorms[i].id)
if (id == tvnorms[i].id)
break;

if (i == TVNORMS)
for (i = 0; i < TVNORMS; i++)
if (*id & tvnorms[i].id)
if (id & tvnorms[i].id)
break;
if (i == TVNORMS)
return -EINVAL;

if ((*id & V4L2_STD_SECAM) && (secam[0] != '-')) {
if ((id & V4L2_STD_SECAM) && (secam[0] != '-')) {
if (secam[0] == 'L' || secam[0] == 'l') {
if (secam[1] == 'C' || secam[1] == 'c')
fixup = V4L2_STD_SECAM_LC;
Expand All @@ -1879,7 +1879,7 @@ int saa7134_s_std_internal(struct saa7134_dev *dev, struct saa7134_fh *fh, v4l2_
return -EINVAL;
}

*id = tvnorms[i].id;
id = tvnorms[i].id;

mutex_lock(&dev->lock);
if (fh && res_check(fh, RESOURCE_OVERLAY)) {
Expand All @@ -1901,7 +1901,7 @@ int saa7134_s_std_internal(struct saa7134_dev *dev, struct saa7134_fh *fh, v4l2_
}
EXPORT_SYMBOL_GPL(saa7134_s_std_internal);

static int saa7134_s_std(struct file *file, void *priv, v4l2_std_id *id)
static int saa7134_s_std(struct file *file, void *priv, v4l2_std_id id)
{
struct saa7134_fh *fh = priv;

Expand Down Expand Up @@ -2396,7 +2396,7 @@ static int radio_s_input(struct file *filp, void *priv, unsigned int i)
return 0;
}

static int radio_s_std(struct file *file, void *fh, v4l2_std_id *norm)
static int radio_s_std(struct file *file, void *fh, v4l2_std_id norm)
{
return 0;
}
Expand Down
2 changes: 1 addition & 1 deletion drivers/media/pci/saa7134/saa7134.h
Original file line number Diff line number Diff line change
Expand Up @@ -766,7 +766,7 @@ extern struct video_device saa7134_radio_template;
int saa7134_s_ctrl_internal(struct saa7134_dev *dev, struct saa7134_fh *fh, struct v4l2_control *c);
int saa7134_g_ctrl_internal(struct saa7134_dev *dev, struct saa7134_fh *fh, struct v4l2_control *c);
int saa7134_queryctrl(struct file *file, void *priv, struct v4l2_queryctrl *c);
int saa7134_s_std_internal(struct saa7134_dev *dev, struct saa7134_fh *fh, v4l2_std_id *id);
int saa7134_s_std_internal(struct saa7134_dev *dev, struct saa7134_fh *fh, v4l2_std_id id);

int saa7134_videoport_init(struct saa7134_dev *dev);
void saa7134_set_tvnorm_hw(struct saa7134_dev *dev);
Expand Down
Loading

0 comments on commit 314527a

Please sign in to comment.