Skip to content

Commit bff782d

Browse files
khilmanmchehab
authored andcommitted
[media] davinci: VPIF: fix module loading, init errors
Fix problems with automatic module loading by adding MODULE_ALIAS. Also fix various load-time errors cause by incorrect or not present platform_data. Acked-by: Sakari Ailus <sakari.ailus@linux.intel.com> Signed-off-by: Kevin Hilman <khilman@baylibre.com> Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
1 parent e3bb3cd commit bff782d

3 files changed

Lines changed: 23 additions & 1 deletion

File tree

‎drivers/media/platform/davinci/vpif.c‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,9 @@
3232
MODULE_DESCRIPTION("TI DaVinci Video Port Interface driver");
3333
MODULE_LICENSE("GPL");
3434

35+
#define VPIF_DRIVER_NAME "vpif"
36+
MODULE_ALIAS("platform:" VPIF_DRIVER_NAME);
37+
3538
#define VPIF_CH0_MAX_MODES 22
3639
#define VPIF_CH1_MAX_MODES 2
3740
#define VPIF_CH2_MAX_MODES 15
@@ -466,7 +469,7 @@ static const struct dev_pm_ops vpif_pm = {
466469

467470
static struct platform_driver vpif_driver = {
468471
.driver = {
469-
.name = "vpif",
472+
.name = VPIF_DRIVER_NAME,
470473
.pm = vpif_pm_ops,
471474
},
472475
.remove = vpif_remove,

‎drivers/media/platform/davinci/vpif_capture.c‎

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ module_param(debug, int, 0644);
4141
MODULE_PARM_DESC(debug, "Debug level 0-1");
4242

4343
#define VPIF_DRIVER_NAME "vpif_capture"
44+
MODULE_ALIAS("platform:" VPIF_DRIVER_NAME);
4445

4546
/* global variables */
4647
static struct vpif_device vpif_obj = { {NULL} };
@@ -643,6 +644,10 @@ static int vpif_input_to_subdev(
643644

644645
vpif_dbg(2, debug, "vpif_input_to_subdev\n");
645646

647+
if (!chan_cfg)
648+
return -1;
649+
if (input_index >= chan_cfg->input_count)
650+
return -1;
646651
subdev_name = chan_cfg->inputs[input_index].subdev_name;
647652
if (!subdev_name)
648653
return -1;
@@ -681,6 +686,9 @@ static int vpif_set_input(
681686
if (sd_index >= 0) {
682687
sd = vpif_obj.sd[sd_index];
683688
subdev_info = &vpif_cfg->subdev_info[sd_index];
689+
} else {
690+
/* no subdevice, no input to setup */
691+
return 0;
684692
}
685693

686694
/* first setup input path from sub device to vpif */
@@ -1426,6 +1434,11 @@ static __init int vpif_probe(struct platform_device *pdev)
14261434
int res_idx = 0;
14271435
int i, err;
14281436

1437+
if (!pdev->dev.platform_data) {
1438+
dev_warn(&pdev->dev, "Missing platform data. Giving up.\n");
1439+
return -EINVAL;
1440+
}
1441+
14291442
vpif_dev = &pdev->dev;
14301443

14311444
err = initialize_vpif();

‎drivers/media/platform/davinci/vpif_display.c‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ module_param(debug, int, 0644);
4242
MODULE_PARM_DESC(debug, "Debug level 0-1");
4343

4444
#define VPIF_DRIVER_NAME "vpif_display"
45+
MODULE_ALIAS("platform:" VPIF_DRIVER_NAME);
4546

4647
/* Is set to 1 in case of SDTV formats, 2 in case of HDTV formats. */
4748
static int ycmux_mode;
@@ -1244,6 +1245,11 @@ static __init int vpif_probe(struct platform_device *pdev)
12441245
int res_idx = 0;
12451246
int i, err;
12461247

1248+
if (!pdev->dev.platform_data) {
1249+
dev_warn(&pdev->dev, "Missing platform data. Giving up.\n");
1250+
return -EINVAL;
1251+
}
1252+
12471253
vpif_dev = &pdev->dev;
12481254
err = initialize_vpif();
12491255

0 commit comments

Comments
 (0)