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

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>

authored by

Alan Cox and committed by
Greg Kroah-Hartman
cc4e33d9 c9d9602f

+6 -133
+2 -27
drivers/staging/media/atomisp/pci/atomisp2/atomisp_cmd.c
··· 1099 1099 WARN_ON(!vb); 1100 1100 if (vb) 1101 1101 pipe->frame_config_id[vb->i] = frame->isp_config_id; 1102 - #ifndef ISP2401 1103 1102 if (css_pipe_id == IA_CSS_PIPE_ID_CAPTURE && 1104 1103 asd->pending_capture_request > 0) { 1105 1104 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 1111 1105 asd->params.offline_parm.num_captures, 1112 1106 asd->params.offline_parm.skip_frames, 1113 1107 asd->params.offline_parm.offset); ··· 1292 1298 */ 1293 1299 wake_up(&vb->done); 1294 1300 } 1295 - #ifndef ISP2401 1296 - 1297 - #else 1301 + #ifdef ISP2401 1298 1302 atomic_set(&pipe->wdt_count, 0); 1299 1303 #endif 1300 1304 /* ··· 4987 4995 { 4988 4996 struct atomisp_device *isp = video_get_drvdata(vdev); 4989 4997 struct atomisp_sub_device *asd = atomisp_to_video_pipe(vdev)->asd; 4990 - #ifndef ISP2401 4991 4998 struct v4l2_subdev_pad_config pad_cfg; 4992 - #else 4993 - struct v4l2_subdev_pad_config pad_cfg; 4994 - #endif 4995 4999 struct v4l2_subdev_format format = { 4996 5000 .which = V4L2_SUBDEV_FORMAT_TRY, 4997 - #ifndef ISP2401 4998 5001 }; 4999 - #else 5000 - }; 5001 - #endif 5002 + 5002 5003 struct v4l2_mbus_framefmt *snr_mbus_fmt = &format.format; 5003 5004 const struct atomisp_format_bridge *fmt; 5004 5005 struct atomisp_input_stream_info *stream_info = 5005 - #ifndef ISP2401 5006 5006 (struct atomisp_input_stream_info *)snr_mbus_fmt->reserved; 5007 - #else 5008 - (struct atomisp_input_stream_info *)snr_mbus_fmt->reserved; 5009 - #endif 5010 5007 uint16_t stream_index; 5011 5008 int source_pad = atomisp_subdev_source_pad(vdev); 5012 5009 int ret; ··· 5025 5044 snr_mbus_fmt->width, snr_mbus_fmt->height); 5026 5045 5027 5046 ret = v4l2_subdev_call(isp->inputs[asd->input_curr].camera, 5028 - #ifndef ISP2401 5029 5047 pad, set_fmt, &pad_cfg, &format); 5030 - #else 5031 - pad, set_fmt, &pad_cfg, &format); 5032 - #endif 5033 5048 if (ret) 5034 5049 return ret; 5035 5050 ··· 6431 6454 struct atomisp_ae_window *arg) 6432 6455 { 6433 6456 struct atomisp_device *isp = asd->isp; 6434 - #ifndef ISP2401 6435 6457 /* Coverity CID 298071 - initialzize struct */ 6436 - #endif 6437 6458 struct v4l2_subdev_selection sel = { 0 }; 6438 6459 6439 6460 sel.r.left = arg->x_left;
+1 -20
drivers/staging/media/atomisp/pci/atomisp2/atomisp_ioctl.c
··· 530 530 return NULL; 531 531 } 532 532 533 - #ifndef ISP2401 534 533 const struct atomisp_format_bridge *atomisp_get_format_bridge_from_mbus( 535 534 u32 mbus_code) 536 - #else 537 - const struct atomisp_format_bridge *atomisp_get_format_bridge_from_mbus(u32 538 - mbus_code) 539 - #endif 540 535 { 541 536 unsigned int i; 542 537 ··· 1298 1303 /* this buffer will have a per-frame parameter */ 1299 1304 pipe->frame_request_config_id[buf->index] = buf->reserved2 & 1300 1305 ~ATOMISP_BUFFER_HAS_PER_FRAME_SETTING; 1301 - #ifndef ISP2401 1302 1306 dev_dbg(isp->dev, "This buffer requires per_frame setting which has isp_config_id %d\n", 1303 1307 pipe->frame_request_config_id[buf->index]); 1304 - #else 1305 - dev_dbg(isp->dev, "This buffer requires per_frame setting \ 1306 - which has isp_config_id %d\n", 1307 - pipe->frame_request_config_id[buf->index]); 1308 - #endif 1309 1308 } else { 1310 1309 pipe->frame_request_config_id[buf->index] = 0; 1311 1310 } ··· 1483 1494 buf->reserved2 = pipe->frame_config_id[buf->index]; 1484 1495 rt_mutex_unlock(&isp->mutex); 1485 1496 1486 - #ifndef ISP2401 1487 1497 dev_dbg(isp->dev, "dqbuf buffer %d (%s) for asd%d with exp_id %d, isp_config_id %d\n", 1488 - #else 1489 - dev_dbg(isp->dev, "dqbuf buffer %d (%s) for asd%d with exp_id %d, \ 1490 - isp_config_id %d\n", 1491 - #endif 1492 1498 buf->index, vdev->name, asd->index, buf->reserved >> 16, 1493 1499 buf->reserved2); 1494 1500 return 0; ··· 1554 1570 else 1555 1571 return 1; 1556 1572 } 1557 - #ifndef ISP2401 1558 - int atomisp_stream_on_master_slave_sensor(struct atomisp_device *isp, bool isp_timeout) 1559 - #else 1573 + 1560 1574 int atomisp_stream_on_master_slave_sensor(struct atomisp_device *isp, 1561 1575 bool isp_timeout) 1562 - #endif 1563 1576 { 1564 1577 unsigned int master = -1, slave = -1, delay_slave = 0; 1565 1578 int i, ret;
+2 -79
drivers/staging/media/atomisp/pci/atomisp2/atomisp_subdev.c
··· 322 322 r.width = ffmt[pad]->width; 323 323 r.height = ffmt[pad]->height; 324 324 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); 328 327 break; 329 328 } 330 - #else 331 - atomisp_subdev_set_selection(sd, cfg, which, pad, 332 - target, flags, &r); 333 - break; 334 - } 335 - #endif 336 329 } 337 330 } 338 331 ··· 437 444 i < ATOMISP_SUBDEV_PADS_NUM; i++) { 438 445 struct v4l2_rect tmp = *crop[pad]; 439 446 440 - #ifndef ISP2401 441 447 atomisp_subdev_set_selection( 442 448 sd, cfg, which, i, V4L2_SEL_TGT_COMPOSE, 443 449 flags, &tmp); 444 450 } 445 - #else 446 - atomisp_subdev_set_selection(sd, cfg, 447 - which, i, 448 - V4L2_SEL_TGT_COMPOSE, 449 - flags, 450 - &tmp); 451 - } 452 - #endif 453 451 } 454 452 455 453 if (which == V4L2_SUBDEV_FORMAT_TRY) ··· 595 611 return hbin; 596 612 } 597 613 598 - #ifndef ISP2401 599 - void atomisp_subdev_set_ffmt(struct v4l2_subdev *sd, struct v4l2_subdev_pad_config *cfg, 600 - uint32_t which, uint32_t pad, 601 - struct v4l2_mbus_framefmt *ffmt) 602 - #else 603 614 void atomisp_subdev_set_ffmt(struct v4l2_subdev *sd, 604 615 struct v4l2_subdev_pad_config *cfg, uint32_t which, 605 616 uint32_t pad, struct v4l2_mbus_framefmt *ffmt) 606 - #endif 607 617 { 608 618 struct atomisp_sub_device *isp_sd = v4l2_get_subdevdata(sd); 609 619 struct atomisp_device *isp = isp_sd->isp; 610 620 struct v4l2_mbus_framefmt *__ffmt = 611 - #ifndef ISP2401 612 621 atomisp_subdev_get_ffmt(sd, cfg, which, pad); 613 - #else 614 - atomisp_subdev_get_ffmt(sd, cfg, which, pad); 615 - #endif 616 622 uint16_t vdev_pad = atomisp_subdev_source_pad(sd->devnode); 617 623 enum atomisp_input_stream_id stream_id; 618 624 ··· 666 692 * to the format type. 667 693 */ 668 694 static int isp_subdev_get_format(struct v4l2_subdev *sd, 669 - #ifndef ISP2401 670 - struct v4l2_subdev_pad_config *cfg, struct v4l2_subdev_format *fmt) 671 - #else 672 695 struct v4l2_subdev_pad_config *cfg, 673 696 struct v4l2_subdev_format *fmt) 674 - #endif 675 697 { 676 698 fmt->format = *atomisp_subdev_get_ffmt(sd, cfg, fmt->which, fmt->pad); 677 699 ··· 685 715 * to the format type. 686 716 */ 687 717 static int isp_subdev_set_format(struct v4l2_subdev *sd, 688 - #ifndef ISP2401 689 - struct v4l2_subdev_pad_config *cfg, struct v4l2_subdev_format *fmt) 690 - #else 691 718 struct v4l2_subdev_pad_config *cfg, 692 719 struct v4l2_subdev_format *fmt) 693 - #endif 694 720 { 695 721 atomisp_subdev_set_ffmt(sd, cfg, fmt->which, fmt->pad, &fmt->format); 696 722 ··· 702 736 703 737 /* V4L2 subdev pad operations */ 704 738 static const struct v4l2_subdev_pad_ops isp_subdev_v4l2_pad_ops = { 705 - #ifndef ISP2401 706 - .enum_mbus_code = isp_subdev_enum_mbus_code, 707 - .get_fmt = isp_subdev_get_format, .set_fmt = isp_subdev_set_format, 708 - .get_selection = isp_subdev_get_selection, 709 - .set_selection = isp_subdev_set_selection, 710 - .link_validate = v4l2_subdev_link_validate_default, 711 - #else 712 739 .enum_mbus_code = isp_subdev_enum_mbus_code, 713 740 .get_fmt = isp_subdev_get_format, 714 741 .set_fmt = isp_subdev_set_format, 715 742 .get_selection = isp_subdev_get_selection, 716 743 .set_selection = isp_subdev_set_selection, 717 744 .link_validate = v4l2_subdev_link_validate_default, 718 - #endif 719 745 }; 720 746 721 747 /* V4L2 subdev operations */ 722 748 static const struct v4l2_subdev_ops isp_subdev_v4l2_ops = { 723 - #ifndef ISP2401 724 - .core = &isp_subdev_v4l2_core_ops, .pad = &isp_subdev_v4l2_pad_ops, 725 - #else 726 749 .core = &isp_subdev_v4l2_core_ops, 727 750 .pad = &isp_subdev_v4l2_pad_ops, 728 - #endif 729 751 }; 730 752 731 753 static void isp_subdev_init_params(struct atomisp_sub_device *asd) ··· 1141 1187 pads[ATOMISP_SUBDEV_PAD_SOURCE_CAPTURE].flags = MEDIA_PAD_FL_SOURCE; 1142 1188 pads[ATOMISP_SUBDEV_PAD_SOURCE_VIDEO].flags = MEDIA_PAD_FL_SOURCE; 1143 1189 1144 - #ifndef ISP2401 1145 1190 asd->fmt[ATOMISP_SUBDEV_PAD_SINK].fmt.code = 1146 1191 MEDIA_BUS_FMT_SBGGR10_1X10; 1147 - #else 1148 - asd->fmt[ATOMISP_SUBDEV_PAD_SINK].fmt.code = MEDIA_BUS_FMT_SBGGR10_1X10; 1149 - #endif 1150 1192 asd->fmt[ATOMISP_SUBDEV_PAD_SOURCE_PREVIEW].fmt.code = 1151 1193 MEDIA_BUS_FMT_SBGGR10_1X10; 1152 1194 asd->fmt[ATOMISP_SUBDEV_PAD_SOURCE_VF].fmt.code = ··· 1159 1209 return ret; 1160 1210 1161 1211 atomisp_init_subdev_pipe(asd, &asd->video_in, 1162 - #ifndef ISP2401 1163 - V4L2_BUF_TYPE_VIDEO_OUTPUT); 1164 - #else 1165 1212 V4L2_BUF_TYPE_VIDEO_OUTPUT); 1166 - #endif 1167 1213 1168 1214 atomisp_init_subdev_pipe(asd, &asd->video_out_preview, 1169 - #ifndef ISP2401 1170 - V4L2_BUF_TYPE_VIDEO_CAPTURE); 1171 - #else 1172 1215 V4L2_BUF_TYPE_VIDEO_CAPTURE); 1173 - #endif 1174 1216 1175 1217 atomisp_init_subdev_pipe(asd, &asd->video_out_vf, 1176 - #ifndef ISP2401 1177 - V4L2_BUF_TYPE_VIDEO_CAPTURE); 1178 - #else 1179 1218 V4L2_BUF_TYPE_VIDEO_CAPTURE); 1180 - #endif 1181 1219 1182 1220 atomisp_init_subdev_pipe(asd, &asd->video_out_capture, 1183 - #ifndef ISP2401 1184 - V4L2_BUF_TYPE_VIDEO_CAPTURE); 1185 - #else 1186 1221 V4L2_BUF_TYPE_VIDEO_CAPTURE); 1187 - #endif 1188 1222 1189 1223 atomisp_init_subdev_pipe(asd, &asd->video_out_video_capture, 1190 - #ifndef ISP2401 1191 - V4L2_BUF_TYPE_VIDEO_CAPTURE); 1192 - #else 1193 1224 V4L2_BUF_TYPE_VIDEO_CAPTURE); 1194 - #endif 1195 1225 1196 1226 atomisp_init_acc_pipe(asd, &asd->video_acc); 1197 1227 ··· 1331 1401 unsigned int i, pending_event; 1332 1402 1333 1403 list_for_each_entry_safe(fh, fh_tmp, 1334 - #ifndef ISP2401 1335 1404 &asd->subdev.devnode->fh_list, list) { 1336 - #else 1337 - &asd->subdev.devnode->fh_list, list) { 1338 - #endif 1339 1405 pending_event = v4l2_event_pending(fh); 1340 1406 for (i = 0; i < pending_event; i++) 1341 1407 v4l2_event_dequeue(fh, &event, 1); ··· 1397 1471 return ret; 1398 1472 } 1399 1473 1400 - #ifndef ISP2401 1401 - 1402 - #endif 1403 1474 /* 1404 1475 * atomisp_subdev_init - ISP Subdevice initialization. 1405 1476 * @dev: Device pointer specific to the ATOM ISP.
+1 -7
drivers/staging/media/atomisp/pci/atomisp2/atomisp_v4l2.c
··· 906 906 907 907 strlcpy(isp->media_dev.model, "Intel Atom ISP", 908 908 sizeof(isp->media_dev.model)); 909 - #ifndef ISP2401 910 909 911 - #endif 912 910 media_device_init(&isp->media_dev); 913 911 isp->v4l2_dev.mdev = &isp->media_dev; 914 912 ret = v4l2_device_register(isp->dev, &isp->v4l2_dev); ··· 1543 1545 atomisp_msi_irq_uninit(isp, dev); 1544 1546 1545 1547 atomisp_ospm_dphy_down(isp); 1546 - #ifndef ISP2401 1548 + 1547 1549 /* Address later when we worry about the ...field chips */ 1548 - #endif 1549 1550 if (ATOMISP_INTERNAL_PM) { 1550 1551 if (atomisp_mrfld_power_down(isp)) 1551 1552 dev_err(&dev->dev, "Failed to switch off ISP\n"); 1552 1553 } 1553 - #ifdef ISP2401 1554 - 1555 - #endif 1556 1554 pci_dev_put(isp->pci_root); 1557 1555 return err; 1558 1556 }