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

[media] ov2659: Don't depend on subdev API

The subdev API is optional. No driver should depend on it.

Avoid compilation breakages if subdev API is not selected:

drivers/media/i2c/ov2659.c: In function ‘ov2659_get_fmt’:
drivers/media/i2c/ov2659.c:1054:3: error: implicit declaration of function ‘v4l2_subdev_get_try_format’ [-Werror=implicit-function-declaration]
mf = v4l2_subdev_get_try_format(sd, cfg, 0);
^
drivers/media/i2c/ov2659.c:1054:6: warning: assignment makes pointer from integer without a cast
mf = v4l2_subdev_get_try_format(sd, cfg, 0);
^
drivers/media/i2c/ov2659.c: In function ‘ov2659_set_fmt’:
drivers/media/i2c/ov2659.c:1129:6: warning: assignment makes pointer from integer without a cast
mf = v4l2_subdev_get_try_format(sd, cfg, fmt->pad);
^
drivers/media/i2c/ov2659.c: In function ‘ov2659_open’:
drivers/media/i2c/ov2659.c:1264:38: error: ‘struct v4l2_subdev_fh’ has no member named ‘pad’
v4l2_subdev_get_try_format(sd, fh->pad, 0);
^

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Tested-by: Lad, Prabhakar <prabhakar.csengg@gmail.com>

+16 -1
+16 -1
drivers/media/i2c/ov2659.c
··· 1046 1046 { 1047 1047 struct i2c_client *client = v4l2_get_subdevdata(sd); 1048 1048 struct ov2659 *ov2659 = to_ov2659(sd); 1049 - struct v4l2_mbus_framefmt *mf; 1050 1049 1051 1050 dev_dbg(&client->dev, "ov2659_get_fmt\n"); 1052 1051 1053 1052 if (fmt->which == V4L2_SUBDEV_FORMAT_TRY) { 1053 + #ifdef CONFIG_VIDEO_V4L2_SUBDEV_API 1054 + struct v4l2_mbus_framefmt *mf; 1055 + 1054 1056 mf = v4l2_subdev_get_try_format(sd, cfg, 0); 1055 1057 mutex_lock(&ov2659->lock); 1056 1058 fmt->format = *mf; 1057 1059 mutex_unlock(&ov2659->lock); 1058 1060 return 0; 1061 + #else 1062 + return -ENOTTY; 1063 + #endif 1059 1064 } 1060 1065 1061 1066 mutex_lock(&ov2659->lock); ··· 1131 1126 mutex_lock(&ov2659->lock); 1132 1127 1133 1128 if (fmt->which == V4L2_SUBDEV_FORMAT_TRY) { 1129 + #ifdef CONFIG_VIDEO_V4L2_SUBDEV_API 1134 1130 mf = v4l2_subdev_get_try_format(sd, cfg, fmt->pad); 1135 1131 *mf = fmt->format; 1132 + #else 1133 + return -ENOTTY; 1134 + #endif 1136 1135 } else { 1137 1136 s64 val; 1138 1137 ··· 1266 1257 * V4L2 subdev internal operations 1267 1258 */ 1268 1259 1260 + #ifdef CONFIG_VIDEO_V4L2_SUBDEV_API 1269 1261 static int ov2659_open(struct v4l2_subdev *sd, struct v4l2_subdev_fh *fh) 1270 1262 { 1271 1263 struct i2c_client *client = v4l2_get_subdevdata(sd); ··· 1279 1269 1280 1270 return 0; 1281 1271 } 1272 + #endif 1282 1273 1283 1274 static const struct v4l2_subdev_core_ops ov2659_subdev_core_ops = { 1284 1275 .log_status = v4l2_ctrl_subdev_log_status, ··· 1298 1287 .set_fmt = ov2659_set_fmt, 1299 1288 }; 1300 1289 1290 + #ifdef CONFIG_VIDEO_V4L2_SUBDEV_API 1301 1291 static const struct v4l2_subdev_ops ov2659_subdev_ops = { 1302 1292 .core = &ov2659_subdev_core_ops, 1303 1293 .video = &ov2659_subdev_video_ops, ··· 1308 1296 static const struct v4l2_subdev_internal_ops ov2659_subdev_internal_ops = { 1309 1297 .open = ov2659_open, 1310 1298 }; 1299 + #endif 1311 1300 1312 1301 static int ov2659_detect(struct v4l2_subdev *sd) 1313 1302 { ··· 1439 1426 1440 1427 sd = &ov2659->sd; 1441 1428 client->flags |= I2C_CLIENT_SCCB; 1429 + #ifdef CONFIG_VIDEO_V4L2_SUBDEV_API 1442 1430 v4l2_i2c_subdev_init(sd, client, &ov2659_subdev_ops); 1443 1431 1444 1432 sd->internal_ops = &ov2659_subdev_internal_ops; 1445 1433 sd->flags |= V4L2_SUBDEV_FL_HAS_DEVNODE | 1446 1434 V4L2_SUBDEV_FL_HAS_EVENTS; 1435 + #endif 1447 1436 1448 1437 #if defined(CONFIG_MEDIA_CONTROLLER) 1449 1438 ov2659->pad.flags = MEDIA_PAD_FL_SOURCE;