Skip to content

Commit 85f5fe3

Browse files
Hans VerkuilMauro Carvalho Chehab
authored andcommitted
[media] v4l2: make vidioc_(un)subscribe_event const
Write-only ioctls should have a const argument in the ioctl op. Do this conversion for vidioc_(un)subscribe_event. Adding const for write-only ioctls was decided during the 2012 Media Workshop. Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
1 parent ec6f432 commit 85f5fe3

9 files changed

Lines changed: 15 additions & 15 deletions

File tree

‎drivers/media/pci/ivtv/ivtv-ioctl.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1460,7 +1460,7 @@ static int ivtv_overlay(struct file *file, void *fh, unsigned int on)
14601460
return 0;
14611461
}
14621462

1463-
static int ivtv_subscribe_event(struct v4l2_fh *fh, struct v4l2_event_subscription *sub)
1463+
static int ivtv_subscribe_event(struct v4l2_fh *fh, const struct v4l2_event_subscription *sub)
14641464
{
14651465
switch (sub->type) {
14661466
case V4L2_EVENT_VSYNC:

‎drivers/media/platform/omap3isp/ispccdc.c‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1706,7 +1706,7 @@ static long ccdc_ioctl(struct v4l2_subdev *sd, unsigned int cmd, void *arg)
17061706
}
17071707

17081708
static int ccdc_subscribe_event(struct v4l2_subdev *sd, struct v4l2_fh *fh,
1709-
struct v4l2_event_subscription *sub)
1709+
const struct v4l2_event_subscription *sub)
17101710
{
17111711
if (sub->type != V4L2_EVENT_FRAME_SYNC)
17121712
return -EINVAL;
@@ -1719,7 +1719,7 @@ static int ccdc_subscribe_event(struct v4l2_subdev *sd, struct v4l2_fh *fh,
17191719
}
17201720

17211721
static int ccdc_unsubscribe_event(struct v4l2_subdev *sd, struct v4l2_fh *fh,
1722-
struct v4l2_event_subscription *sub)
1722+
const struct v4l2_event_subscription *sub)
17231723
{
17241724
return v4l2_event_unsubscribe(fh, sub);
17251725
}

‎drivers/media/platform/omap3isp/ispstat.c‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1025,7 +1025,7 @@ void omap3isp_stat_dma_isr(struct ispstat *stat)
10251025

10261026
int omap3isp_stat_subscribe_event(struct v4l2_subdev *subdev,
10271027
struct v4l2_fh *fh,
1028-
struct v4l2_event_subscription *sub)
1028+
const struct v4l2_event_subscription *sub)
10291029
{
10301030
struct ispstat *stat = v4l2_get_subdevdata(subdev);
10311031

@@ -1037,7 +1037,7 @@ int omap3isp_stat_subscribe_event(struct v4l2_subdev *subdev,
10371037

10381038
int omap3isp_stat_unsubscribe_event(struct v4l2_subdev *subdev,
10391039
struct v4l2_fh *fh,
1040-
struct v4l2_event_subscription *sub)
1040+
const struct v4l2_event_subscription *sub)
10411041
{
10421042
return v4l2_event_unsubscribe(fh, sub);
10431043
}

‎drivers/media/platform/omap3isp/ispstat.h‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -147,10 +147,10 @@ int omap3isp_stat_init(struct ispstat *stat, const char *name,
147147
void omap3isp_stat_cleanup(struct ispstat *stat);
148148
int omap3isp_stat_subscribe_event(struct v4l2_subdev *subdev,
149149
struct v4l2_fh *fh,
150-
struct v4l2_event_subscription *sub);
150+
const struct v4l2_event_subscription *sub);
151151
int omap3isp_stat_unsubscribe_event(struct v4l2_subdev *subdev,
152152
struct v4l2_fh *fh,
153-
struct v4l2_event_subscription *sub);
153+
const struct v4l2_event_subscription *sub);
154154
int omap3isp_stat_s_stream(struct v4l2_subdev *subdev, int enable);
155155

156156
int omap3isp_stat_busy(struct ispstat *stat);

‎drivers/media/v4l2-core/v4l2-ctrls.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2699,7 +2699,7 @@ int v4l2_ctrl_log_status(struct file *file, void *fh)
26992699
EXPORT_SYMBOL(v4l2_ctrl_log_status);
27002700

27012701
int v4l2_ctrl_subscribe_event(struct v4l2_fh *fh,
2702-
struct v4l2_event_subscription *sub)
2702+
const struct v4l2_event_subscription *sub)
27032703
{
27042704
if (sub->type == V4L2_EVENT_CTRL)
27052705
return v4l2_event_subscribe(fh, sub, 0, &v4l2_ctrl_sub_ev_ops);

‎drivers/media/v4l2-core/v4l2-event.c‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,7 @@ int v4l2_event_pending(struct v4l2_fh *fh)
203203
EXPORT_SYMBOL_GPL(v4l2_event_pending);
204204

205205
int v4l2_event_subscribe(struct v4l2_fh *fh,
206-
struct v4l2_event_subscription *sub, unsigned elems,
206+
const struct v4l2_event_subscription *sub, unsigned elems,
207207
const struct v4l2_subscribed_event_ops *ops)
208208
{
209209
struct v4l2_subscribed_event *sev, *found_ev;
@@ -278,7 +278,7 @@ void v4l2_event_unsubscribe_all(struct v4l2_fh *fh)
278278
EXPORT_SYMBOL_GPL(v4l2_event_unsubscribe_all);
279279

280280
int v4l2_event_unsubscribe(struct v4l2_fh *fh,
281-
struct v4l2_event_subscription *sub)
281+
const struct v4l2_event_subscription *sub)
282282
{
283283
struct v4l2_subscribed_event *sev;
284284
unsigned long flags;

‎include/media/v4l2-ctrls.h‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -546,7 +546,7 @@ int v4l2_ctrl_log_status(struct file *file, void *fh);
546546
/* Can be used as a vidioc_subscribe_event function that just subscribes
547547
control events. */
548548
int v4l2_ctrl_subscribe_event(struct v4l2_fh *fh,
549-
struct v4l2_event_subscription *sub);
549+
const struct v4l2_event_subscription *sub);
550550

551551
/* Can be used as a poll function that just polls for control events. */
552552
unsigned int v4l2_ctrl_poll(struct file *file, struct poll_table_struct *wait);

‎include/media/v4l2-event.h‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -124,10 +124,10 @@ void v4l2_event_queue(struct video_device *vdev, const struct v4l2_event *ev);
124124
void v4l2_event_queue_fh(struct v4l2_fh *fh, const struct v4l2_event *ev);
125125
int v4l2_event_pending(struct v4l2_fh *fh);
126126
int v4l2_event_subscribe(struct v4l2_fh *fh,
127-
struct v4l2_event_subscription *sub, unsigned elems,
127+
const struct v4l2_event_subscription *sub, unsigned elems,
128128
const struct v4l2_subscribed_event_ops *ops);
129129
int v4l2_event_unsubscribe(struct v4l2_fh *fh,
130-
struct v4l2_event_subscription *sub);
130+
const struct v4l2_event_subscription *sub);
131131
void v4l2_event_unsubscribe_all(struct v4l2_fh *fh);
132132

133133
#endif /* V4L2_EVENT_H */

‎include/media/v4l2-ioctl.h‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -273,9 +273,9 @@ struct v4l2_ioctl_ops {
273273
struct v4l2_dv_timings_cap *cap);
274274

275275
int (*vidioc_subscribe_event) (struct v4l2_fh *fh,
276-
struct v4l2_event_subscription *sub);
276+
const struct v4l2_event_subscription *sub);
277277
int (*vidioc_unsubscribe_event)(struct v4l2_fh *fh,
278-
struct v4l2_event_subscription *sub);
278+
const struct v4l2_event_subscription *sub);
279279

280280
/* For other private ioctls */
281281
long (*vidioc_default) (struct file *file, void *fh,

0 commit comments

Comments
 (0)