diff options
author | Guennadi Liakhovetski <g.liakhovetski@gmx.de> | 2008-12-17 12:05:38 -0500 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2008-12-30 06:40:14 -0500 |
commit | 297a7ef700ce2e91ed0f941034541d1563ef0a7d (patch) | |
tree | 923b2e5c500f20c615ba5da1826c809b3043e801 | |
parent | 88f4b8990fd2b4d856f63c3689bb4df18029da06 (diff) |
V4L/DVB (10066): mt9m001 mt9v022: fix bus-width switch GPIO availability test
Testing for non-NULL platform-data is not enough, we have to check if the GPIO
in the platform data is valid or not. Also see my earlier patch:
[ARM] pxa/pcm990: use negative number for an invalid GPIO in camera data
Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
-rw-r--r-- | drivers/media/video/mt9m001.c | 5 | ||||
-rw-r--r-- | drivers/media/video/mt9v022.c | 5 |
2 files changed, 6 insertions, 4 deletions
diff --git a/drivers/media/video/mt9m001.c b/drivers/media/video/mt9m001.c index 0bcfef7b1c17..a7f0e6971fe1 100644 --- a/drivers/media/video/mt9m001.c +++ b/drivers/media/video/mt9m001.c | |||
@@ -578,6 +578,7 @@ static int mt9m001_set_control(struct soc_camera_device *icd, struct v4l2_contro | |||
578 | static int mt9m001_video_probe(struct soc_camera_device *icd) | 578 | static int mt9m001_video_probe(struct soc_camera_device *icd) |
579 | { | 579 | { |
580 | struct mt9m001 *mt9m001 = container_of(icd, struct mt9m001, icd); | 580 | struct mt9m001 *mt9m001 = container_of(icd, struct mt9m001, icd); |
581 | struct soc_camera_link *icl = mt9m001->client->dev.platform_data; | ||
581 | s32 data; | 582 | s32 data; |
582 | int ret; | 583 | int ret; |
583 | 584 | ||
@@ -600,7 +601,7 @@ static int mt9m001_video_probe(struct soc_camera_device *icd) | |||
600 | case 0x8421: | 601 | case 0x8421: |
601 | mt9m001->model = V4L2_IDENT_MT9M001C12ST; | 602 | mt9m001->model = V4L2_IDENT_MT9M001C12ST; |
602 | icd->formats = mt9m001_colour_formats; | 603 | icd->formats = mt9m001_colour_formats; |
603 | if (mt9m001->client->dev.platform_data) | 604 | if (gpio_is_valid(icl->gpio)) |
604 | icd->num_formats = ARRAY_SIZE(mt9m001_colour_formats); | 605 | icd->num_formats = ARRAY_SIZE(mt9m001_colour_formats); |
605 | else | 606 | else |
606 | icd->num_formats = 1; | 607 | icd->num_formats = 1; |
@@ -608,7 +609,7 @@ static int mt9m001_video_probe(struct soc_camera_device *icd) | |||
608 | case 0x8431: | 609 | case 0x8431: |
609 | mt9m001->model = V4L2_IDENT_MT9M001C12STM; | 610 | mt9m001->model = V4L2_IDENT_MT9M001C12STM; |
610 | icd->formats = mt9m001_monochrome_formats; | 611 | icd->formats = mt9m001_monochrome_formats; |
611 | if (mt9m001->client->dev.platform_data) | 612 | if (gpio_is_valid(icl->gpio)) |
612 | icd->num_formats = ARRAY_SIZE(mt9m001_monochrome_formats); | 613 | icd->num_formats = ARRAY_SIZE(mt9m001_monochrome_formats); |
613 | else | 614 | else |
614 | icd->num_formats = 1; | 615 | icd->num_formats = 1; |
diff --git a/drivers/media/video/mt9v022.c b/drivers/media/video/mt9v022.c index 3a39f0288599..82e1a3381a7a 100644 --- a/drivers/media/video/mt9v022.c +++ b/drivers/media/video/mt9v022.c | |||
@@ -690,6 +690,7 @@ static int mt9v022_set_control(struct soc_camera_device *icd, | |||
690 | static int mt9v022_video_probe(struct soc_camera_device *icd) | 690 | static int mt9v022_video_probe(struct soc_camera_device *icd) |
691 | { | 691 | { |
692 | struct mt9v022 *mt9v022 = container_of(icd, struct mt9v022, icd); | 692 | struct mt9v022 *mt9v022 = container_of(icd, struct mt9v022, icd); |
693 | struct soc_camera_link *icl = mt9v022->client->dev.platform_data; | ||
693 | s32 data; | 694 | s32 data; |
694 | int ret; | 695 | int ret; |
695 | 696 | ||
@@ -725,7 +726,7 @@ static int mt9v022_video_probe(struct soc_camera_device *icd) | |||
725 | ret = reg_write(icd, MT9V022_PIXEL_OPERATION_MODE, 4 | 0x11); | 726 | ret = reg_write(icd, MT9V022_PIXEL_OPERATION_MODE, 4 | 0x11); |
726 | mt9v022->model = V4L2_IDENT_MT9V022IX7ATC; | 727 | mt9v022->model = V4L2_IDENT_MT9V022IX7ATC; |
727 | icd->formats = mt9v022_colour_formats; | 728 | icd->formats = mt9v022_colour_formats; |
728 | if (mt9v022->client->dev.platform_data) | 729 | if (gpio_is_valid(icl->gpio)) |
729 | icd->num_formats = ARRAY_SIZE(mt9v022_colour_formats); | 730 | icd->num_formats = ARRAY_SIZE(mt9v022_colour_formats); |
730 | else | 731 | else |
731 | icd->num_formats = 1; | 732 | icd->num_formats = 1; |
@@ -733,7 +734,7 @@ static int mt9v022_video_probe(struct soc_camera_device *icd) | |||
733 | ret = reg_write(icd, MT9V022_PIXEL_OPERATION_MODE, 0x11); | 734 | ret = reg_write(icd, MT9V022_PIXEL_OPERATION_MODE, 0x11); |
734 | mt9v022->model = V4L2_IDENT_MT9V022IX7ATM; | 735 | mt9v022->model = V4L2_IDENT_MT9V022IX7ATM; |
735 | icd->formats = mt9v022_monochrome_formats; | 736 | icd->formats = mt9v022_monochrome_formats; |
736 | if (mt9v022->client->dev.platform_data) | 737 | if (gpio_is_valid(icl->gpio)) |
737 | icd->num_formats = ARRAY_SIZE(mt9v022_monochrome_formats); | 738 | icd->num_formats = ARRAY_SIZE(mt9v022_monochrome_formats); |
738 | else | 739 | else |
739 | icd->num_formats = 1; | 740 | icd->num_formats = 1; |