Commit 953e4115 authored by Lubomir Rintel's avatar Lubomir Rintel Committed by Mauro Carvalho Chehab

media: cafe-driver: use drvdata instead of back-casting from v4l2_device

Since commit 95db3a60 ("[media] v4l: Add a media_device pointer
to the v4l2_device structure") the v4l core doesn't insist on using drvdata
itself.  Therefore we can use it ourselves, making things somewhat simpler.
Signed-off-by: default avatarLubomir Rintel <lkundrak@v3.sk>
Signed-off-by: default avatarHans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab+huawei@kernel.org>
parent 17621758
...@@ -497,6 +497,7 @@ static int cafe_pci_probe(struct pci_dev *pdev, ...@@ -497,6 +497,7 @@ static int cafe_pci_probe(struct pci_dev *pdev,
cam = kzalloc(sizeof(struct cafe_camera), GFP_KERNEL); cam = kzalloc(sizeof(struct cafe_camera), GFP_KERNEL);
if (cam == NULL) if (cam == NULL)
goto out; goto out;
pci_set_drvdata(pdev, cam);
cam->pdev = pdev; cam->pdev = pdev;
mcam = &cam->mcam; mcam = &cam->mcam;
mcam->chip_id = MCAM_CAFE; mcam->chip_id = MCAM_CAFE;
...@@ -592,8 +593,7 @@ static void cafe_shutdown(struct cafe_camera *cam) ...@@ -592,8 +593,7 @@ static void cafe_shutdown(struct cafe_camera *cam)
static void cafe_pci_remove(struct pci_dev *pdev) static void cafe_pci_remove(struct pci_dev *pdev)
{ {
struct v4l2_device *v4l2_dev = dev_get_drvdata(&pdev->dev); struct cafe_camera *cam = pci_get_drvdata(pdev);
struct cafe_camera *cam = to_cam(v4l2_dev);
if (cam == NULL) { if (cam == NULL) {
printk(KERN_WARNING "pci_remove on unknown pdev %p\n", pdev); printk(KERN_WARNING "pci_remove on unknown pdev %p\n", pdev);
...@@ -609,8 +609,7 @@ static void cafe_pci_remove(struct pci_dev *pdev) ...@@ -609,8 +609,7 @@ static void cafe_pci_remove(struct pci_dev *pdev)
*/ */
static int __maybe_unused cafe_pci_suspend(struct device *dev) static int __maybe_unused cafe_pci_suspend(struct device *dev)
{ {
struct v4l2_device *v4l2_dev = dev_get_drvdata(dev); struct cafe_camera *cam = dev_get_drvdata(dev);
struct cafe_camera *cam = to_cam(v4l2_dev);
mccic_suspend(&cam->mcam); mccic_suspend(&cam->mcam);
return 0; return 0;
...@@ -619,8 +618,7 @@ static int __maybe_unused cafe_pci_suspend(struct device *dev) ...@@ -619,8 +618,7 @@ static int __maybe_unused cafe_pci_suspend(struct device *dev)
static int __maybe_unused cafe_pci_resume(struct device *dev) static int __maybe_unused cafe_pci_resume(struct device *dev)
{ {
struct v4l2_device *v4l2_dev = dev_get_drvdata(dev); struct cafe_camera *cam = dev_get_drvdata(dev);
struct cafe_camera *cam = to_cam(v4l2_dev);
cafe_ctlr_init(&cam->mcam); cafe_ctlr_init(&cam->mcam);
return mccic_resume(&cam->mcam); return mccic_resume(&cam->mcam);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment