Skip to content

Commit cc4e33d

Browse files
Alan Coxgregkh
authored andcommitted
atomisp2: unify some ifdef cases caused by format changes
The two drivers were originally merged by tools, and the tools didn't always spot white space only changes. Fix a few of them found by zero-day and clean up some more by hand. Signed-off-by: Alan Cox <alan@linux.intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent c9d9602 commit cc4e33d

4 files changed

Lines changed: 6 additions & 133 deletions

File tree

‎drivers/staging/media/atomisp/pci/atomisp2/atomisp_cmd.c‎

Lines changed: 2 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1099,15 +1099,9 @@ void atomisp_buf_done(struct atomisp_sub_device *asd, int error,
10991099
WARN_ON(!vb);
11001100
if (vb)
11011101
pipe->frame_config_id[vb->i] = frame->isp_config_id;
1102-
#ifndef ISP2401
11031102
if (css_pipe_id == IA_CSS_PIPE_ID_CAPTURE &&
11041103
asd->pending_capture_request > 0) {
11051104
err = atomisp_css_offline_capture_configure(asd,
1106-
#else
1107-
if (css_pipe_id == IA_CSS_PIPE_ID_CAPTURE) {
1108-
if (asd->pending_capture_request > 0) {
1109-
err = atomisp_css_offline_capture_configure(asd,
1110-
#endif
11111105
asd->params.offline_parm.num_captures,
11121106
asd->params.offline_parm.skip_frames,
11131107
asd->params.offline_parm.offset);
@@ -1298,9 +1292,7 @@ void atomisp_buf_done(struct atomisp_sub_device *asd, int error,
12981292
*/
12991293
wake_up(&vb->done);
13001294
}
1301-
#ifndef ISP2401
1302-
1303-
#else
1295+
#ifdef ISP2401
13041296
atomic_set(&pipe->wdt_count, 0);
13051297
#endif
13061298
/*
@@ -4995,26 +4987,15 @@ int atomisp_try_fmt(struct video_device *vdev, struct v4l2_format *f,
49954987
{
49964988
struct atomisp_device *isp = video_get_drvdata(vdev);
49974989
struct atomisp_sub_device *asd = atomisp_to_video_pipe(vdev)->asd;
4998-
#ifndef ISP2401
49994990
struct v4l2_subdev_pad_config pad_cfg;
5000-
#else
5001-
struct v4l2_subdev_pad_config pad_cfg;
5002-
#endif
50034991
struct v4l2_subdev_format format = {
50044992
.which = V4L2_SUBDEV_FORMAT_TRY,
5005-
#ifndef ISP2401
50064993
};
5007-
#else
5008-
};
5009-
#endif
4994+
50104995
struct v4l2_mbus_framefmt *snr_mbus_fmt = &format.format;
50114996
const struct atomisp_format_bridge *fmt;
50124997
struct atomisp_input_stream_info *stream_info =
5013-
#ifndef ISP2401
50144998
(struct atomisp_input_stream_info *)snr_mbus_fmt->reserved;
5015-
#else
5016-
(struct atomisp_input_stream_info *)snr_mbus_fmt->reserved;
5017-
#endif
50184999
uint16_t stream_index;
50195000
int source_pad = atomisp_subdev_source_pad(vdev);
50205001
int ret;
@@ -5044,11 +5025,7 @@ int atomisp_try_fmt(struct video_device *vdev, struct v4l2_format *f,
50445025
snr_mbus_fmt->width, snr_mbus_fmt->height);
50455026

50465027
ret = v4l2_subdev_call(isp->inputs[asd->input_curr].camera,
5047-
#ifndef ISP2401
50485028
pad, set_fmt, &pad_cfg, &format);
5049-
#else
5050-
pad, set_fmt, &pad_cfg, &format);
5051-
#endif
50525029
if (ret)
50535030
return ret;
50545031

@@ -6454,9 +6431,7 @@ int atomisp_s_ae_window(struct atomisp_sub_device *asd,
64546431
struct atomisp_ae_window *arg)
64556432
{
64566433
struct atomisp_device *isp = asd->isp;
6457-
#ifndef ISP2401
64586434
/* Coverity CID 298071 - initialzize struct */
6459-
#endif
64606435
struct v4l2_subdev_selection sel = { 0 };
64616436

64626437
sel.r.left = arg->x_left;

‎drivers/staging/media/atomisp/pci/atomisp2/atomisp_ioctl.c‎

Lines changed: 1 addition & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -530,13 +530,8 @@ const struct atomisp_format_bridge *atomisp_get_format_bridge(
530530
return NULL;
531531
}
532532

533-
#ifndef ISP2401
534533
const struct atomisp_format_bridge *atomisp_get_format_bridge_from_mbus(
535534
u32 mbus_code)
536-
#else
537-
const struct atomisp_format_bridge *atomisp_get_format_bridge_from_mbus(u32
538-
mbus_code)
539-
#endif
540535
{
541536
unsigned int i;
542537

@@ -1303,14 +1298,8 @@ static int atomisp_qbuf(struct file *file, void *fh, struct v4l2_buffer *buf)
13031298
/* this buffer will have a per-frame parameter */
13041299
pipe->frame_request_config_id[buf->index] = buf->reserved2 &
13051300
~ATOMISP_BUFFER_HAS_PER_FRAME_SETTING;
1306-
#ifndef ISP2401
13071301
dev_dbg(isp->dev, "This buffer requires per_frame setting which has isp_config_id %d\n",
13081302
pipe->frame_request_config_id[buf->index]);
1309-
#else
1310-
dev_dbg(isp->dev, "This buffer requires per_frame setting \
1311-
which has isp_config_id %d\n",
1312-
pipe->frame_request_config_id[buf->index]);
1313-
#endif
13141303
} else {
13151304
pipe->frame_request_config_id[buf->index] = 0;
13161305
}
@@ -1494,12 +1483,7 @@ static int atomisp_dqbuf(struct file *file, void *fh, struct v4l2_buffer *buf)
14941483
buf->reserved2 = pipe->frame_config_id[buf->index];
14951484
rt_mutex_unlock(&isp->mutex);
14961485

1497-
#ifndef ISP2401
14981486
dev_dbg(isp->dev, "dqbuf buffer %d (%s) for asd%d with exp_id %d, isp_config_id %d\n",
1499-
#else
1500-
dev_dbg(isp->dev, "dqbuf buffer %d (%s) for asd%d with exp_id %d, \
1501-
isp_config_id %d\n",
1502-
#endif
15031487
buf->index, vdev->name, asd->index, buf->reserved >> 16,
15041488
buf->reserved2);
15051489
return 0;
@@ -1570,12 +1554,9 @@ static unsigned int atomisp_sensor_start_stream(struct atomisp_sub_device *asd)
15701554
else
15711555
return 1;
15721556
}
1573-
#ifndef ISP2401
1574-
int atomisp_stream_on_master_slave_sensor(struct atomisp_device *isp, bool isp_timeout)
1575-
#else
1557+
15761558
int atomisp_stream_on_master_slave_sensor(struct atomisp_device *isp,
15771559
bool isp_timeout)
1578-
#endif
15791560
{
15801561
unsigned int master = -1, slave = -1, delay_slave = 0;
15811562
int i, ret;

‎drivers/staging/media/atomisp/pci/atomisp2/atomisp_subdev.c‎

Lines changed: 2 additions & 79 deletions
Original file line numberDiff line numberDiff line change
@@ -322,17 +322,10 @@ static void isp_subdev_propagate(struct v4l2_subdev *sd,
322322
r.width = ffmt[pad]->width;
323323
r.height = ffmt[pad]->height;
324324

325-
#ifndef ISP2401
326-
atomisp_subdev_set_selection(sd, cfg, which, pad, target, flags,
327-
&r);
325+
atomisp_subdev_set_selection(sd, cfg, which, pad,
326+
target, flags, &r);
328327
break;
329328
}
330-
#else
331-
atomisp_subdev_set_selection(sd, cfg, which, pad,
332-
target, flags, &r);
333-
break;
334-
}
335-
#endif
336329
}
337330
}
338331

@@ -444,19 +437,10 @@ int atomisp_subdev_set_selection(struct v4l2_subdev *sd,
444437
i < ATOMISP_SUBDEV_PADS_NUM; i++) {
445438
struct v4l2_rect tmp = *crop[pad];
446439

447-
#ifndef ISP2401
448440
atomisp_subdev_set_selection(
449441
sd, cfg, which, i, V4L2_SEL_TGT_COMPOSE,
450442
flags, &tmp);
451443
}
452-
#else
453-
atomisp_subdev_set_selection(sd, cfg,
454-
which, i,
455-
V4L2_SEL_TGT_COMPOSE,
456-
flags,
457-
&tmp);
458-
}
459-
#endif
460444
}
461445

462446
if (which == V4L2_SUBDEV_FORMAT_TRY)
@@ -611,24 +595,14 @@ static int atomisp_get_sensor_bin_factor(struct atomisp_sub_device *asd)
611595
return hbin;
612596
}
613597

614-
#ifndef ISP2401
615-
void atomisp_subdev_set_ffmt(struct v4l2_subdev *sd, struct v4l2_subdev_pad_config *cfg,
616-
uint32_t which, uint32_t pad,
617-
struct v4l2_mbus_framefmt *ffmt)
618-
#else
619598
void atomisp_subdev_set_ffmt(struct v4l2_subdev *sd,
620599
struct v4l2_subdev_pad_config *cfg, uint32_t which,
621600
uint32_t pad, struct v4l2_mbus_framefmt *ffmt)
622-
#endif
623601
{
624602
struct atomisp_sub_device *isp_sd = v4l2_get_subdevdata(sd);
625603
struct atomisp_device *isp = isp_sd->isp;
626604
struct v4l2_mbus_framefmt *__ffmt =
627-
#ifndef ISP2401
628605
atomisp_subdev_get_ffmt(sd, cfg, which, pad);
629-
#else
630-
atomisp_subdev_get_ffmt(sd, cfg, which, pad);
631-
#endif
632606
uint16_t vdev_pad = atomisp_subdev_source_pad(sd->devnode);
633607
enum atomisp_input_stream_id stream_id;
634608

@@ -692,12 +666,8 @@ void atomisp_subdev_set_ffmt(struct v4l2_subdev *sd,
692666
* to the format type.
693667
*/
694668
static int isp_subdev_get_format(struct v4l2_subdev *sd,
695-
#ifndef ISP2401
696-
struct v4l2_subdev_pad_config *cfg, struct v4l2_subdev_format *fmt)
697-
#else
698669
struct v4l2_subdev_pad_config *cfg,
699670
struct v4l2_subdev_format *fmt)
700-
#endif
701671
{
702672
fmt->format = *atomisp_subdev_get_ffmt(sd, cfg, fmt->which, fmt->pad);
703673

@@ -715,12 +685,8 @@ static int isp_subdev_get_format(struct v4l2_subdev *sd,
715685
* to the format type.
716686
*/
717687
static int isp_subdev_set_format(struct v4l2_subdev *sd,
718-
#ifndef ISP2401
719-
struct v4l2_subdev_pad_config *cfg, struct v4l2_subdev_format *fmt)
720-
#else
721688
struct v4l2_subdev_pad_config *cfg,
722689
struct v4l2_subdev_format *fmt)
723-
#endif
724690
{
725691
atomisp_subdev_set_ffmt(sd, cfg, fmt->which, fmt->pad, &fmt->format);
726692

@@ -736,30 +702,18 @@ static const struct v4l2_subdev_core_ops isp_subdev_v4l2_core_ops = {
736702

737703
/* V4L2 subdev pad operations */
738704
static const struct v4l2_subdev_pad_ops isp_subdev_v4l2_pad_ops = {
739-
#ifndef ISP2401
740-
.enum_mbus_code = isp_subdev_enum_mbus_code,
741-
.get_fmt = isp_subdev_get_format, .set_fmt = isp_subdev_set_format,
742-
.get_selection = isp_subdev_get_selection,
743-
.set_selection = isp_subdev_set_selection,
744-
.link_validate = v4l2_subdev_link_validate_default,
745-
#else
746705
.enum_mbus_code = isp_subdev_enum_mbus_code,
747706
.get_fmt = isp_subdev_get_format,
748707
.set_fmt = isp_subdev_set_format,
749708
.get_selection = isp_subdev_get_selection,
750709
.set_selection = isp_subdev_set_selection,
751710
.link_validate = v4l2_subdev_link_validate_default,
752-
#endif
753711
};
754712

755713
/* V4L2 subdev operations */
756714
static const struct v4l2_subdev_ops isp_subdev_v4l2_ops = {
757-
#ifndef ISP2401
758-
.core = &isp_subdev_v4l2_core_ops, .pad = &isp_subdev_v4l2_pad_ops,
759-
#else
760715
.core = &isp_subdev_v4l2_core_ops,
761716
.pad = &isp_subdev_v4l2_pad_ops,
762-
#endif
763717
};
764718

765719
static void isp_subdev_init_params(struct atomisp_sub_device *asd)
@@ -1187,12 +1141,8 @@ static int isp_subdev_init_entities(struct atomisp_sub_device *asd)
11871141
pads[ATOMISP_SUBDEV_PAD_SOURCE_CAPTURE].flags = MEDIA_PAD_FL_SOURCE;
11881142
pads[ATOMISP_SUBDEV_PAD_SOURCE_VIDEO].flags = MEDIA_PAD_FL_SOURCE;
11891143

1190-
#ifndef ISP2401
11911144
asd->fmt[ATOMISP_SUBDEV_PAD_SINK].fmt.code =
11921145
MEDIA_BUS_FMT_SBGGR10_1X10;
1193-
#else
1194-
asd->fmt[ATOMISP_SUBDEV_PAD_SINK].fmt.code = MEDIA_BUS_FMT_SBGGR10_1X10;
1195-
#endif
11961146
asd->fmt[ATOMISP_SUBDEV_PAD_SOURCE_PREVIEW].fmt.code =
11971147
MEDIA_BUS_FMT_SBGGR10_1X10;
11981148
asd->fmt[ATOMISP_SUBDEV_PAD_SOURCE_VF].fmt.code =
@@ -1209,39 +1159,19 @@ static int isp_subdev_init_entities(struct atomisp_sub_device *asd)
12091159
return ret;
12101160

12111161
atomisp_init_subdev_pipe(asd, &asd->video_in,
1212-
#ifndef ISP2401
1213-
V4L2_BUF_TYPE_VIDEO_OUTPUT);
1214-
#else
12151162
V4L2_BUF_TYPE_VIDEO_OUTPUT);
1216-
#endif
12171163

12181164
atomisp_init_subdev_pipe(asd, &asd->video_out_preview,
1219-
#ifndef ISP2401
1220-
V4L2_BUF_TYPE_VIDEO_CAPTURE);
1221-
#else
12221165
V4L2_BUF_TYPE_VIDEO_CAPTURE);
1223-
#endif
12241166

12251167
atomisp_init_subdev_pipe(asd, &asd->video_out_vf,
1226-
#ifndef ISP2401
1227-
V4L2_BUF_TYPE_VIDEO_CAPTURE);
1228-
#else
12291168
V4L2_BUF_TYPE_VIDEO_CAPTURE);
1230-
#endif
12311169

12321170
atomisp_init_subdev_pipe(asd, &asd->video_out_capture,
1233-
#ifndef ISP2401
1234-
V4L2_BUF_TYPE_VIDEO_CAPTURE);
1235-
#else
12361171
V4L2_BUF_TYPE_VIDEO_CAPTURE);
1237-
#endif
12381172

12391173
atomisp_init_subdev_pipe(asd, &asd->video_out_video_capture,
1240-
#ifndef ISP2401
1241-
V4L2_BUF_TYPE_VIDEO_CAPTURE);
1242-
#else
12431174
V4L2_BUF_TYPE_VIDEO_CAPTURE);
1244-
#endif
12451175

12461176
atomisp_init_acc_pipe(asd, &asd->video_acc);
12471177

@@ -1401,11 +1331,7 @@ void atomisp_subdev_cleanup_pending_events(struct atomisp_sub_device *asd)
14011331
unsigned int i, pending_event;
14021332

14031333
list_for_each_entry_safe(fh, fh_tmp,
1404-
#ifndef ISP2401
14051334
&asd->subdev.devnode->fh_list, list) {
1406-
#else
1407-
&asd->subdev.devnode->fh_list, list) {
1408-
#endif
14091335
pending_event = v4l2_event_pending(fh);
14101336
for (i = 0; i < pending_event; i++)
14111337
v4l2_event_dequeue(fh, &event, 1);
@@ -1471,9 +1397,6 @@ int atomisp_subdev_register_entities(struct atomisp_sub_device *asd,
14711397
return ret;
14721398
}
14731399

1474-
#ifndef ISP2401
1475-
1476-
#endif
14771400
/*
14781401
* atomisp_subdev_init - ISP Subdevice initialization.
14791402
* @dev: Device pointer specific to the ATOM ISP.

‎drivers/staging/media/atomisp/pci/atomisp2/atomisp_v4l2.c‎

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -906,9 +906,7 @@ static int atomisp_register_entities(struct atomisp_device *isp)
906906

907907
strlcpy(isp->media_dev.model, "Intel Atom ISP",
908908
sizeof(isp->media_dev.model));
909-
#ifndef ISP2401
910909

911-
#endif
912910
media_device_init(&isp->media_dev);
913911
isp->v4l2_dev.mdev = &isp->media_dev;
914912
ret = v4l2_device_register(isp->dev, &isp->v4l2_dev);
@@ -1545,16 +1543,12 @@ static int atomisp_pci_probe(struct pci_dev *dev,
15451543
atomisp_msi_irq_uninit(isp, dev);
15461544

15471545
atomisp_ospm_dphy_down(isp);
1548-
#ifndef ISP2401
1546+
15491547
/* Address later when we worry about the ...field chips */
1550-
#endif
15511548
if (ATOMISP_INTERNAL_PM) {
15521549
if (atomisp_mrfld_power_down(isp))
15531550
dev_err(&dev->dev, "Failed to switch off ISP\n");
15541551
}
1555-
#ifdef ISP2401
1556-
1557-
#endif
15581552
pci_dev_put(isp->pci_root);
15591553
return err;
15601554
}

0 commit comments

Comments
 (0)