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

[media] saa7146: embed video_device

Embed the video_device struct to simplify the error handling and in
order to (eventually) get rid of video_device_alloc/release.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>

authored by

Hans Verkuil and committed by
Mauro Carvalho Chehab
3ae863e0 09365420

+13 -24
+4 -15
drivers/media/common/saa7146/saa7146_fops.c
··· 587 587 } 588 588 EXPORT_SYMBOL_GPL(saa7146_vv_release); 589 589 590 - int saa7146_register_device(struct video_device **vid, struct saa7146_dev* dev, 590 + int saa7146_register_device(struct video_device *vfd, struct saa7146_dev *dev, 591 591 char *name, int type) 592 592 { 593 - struct video_device *vfd; 594 593 int err; 595 594 int i; 596 595 597 596 DEB_EE("dev:%p, name:'%s', type:%d\n", dev, name, type); 598 - 599 - // released by vfd->release 600 - vfd = video_device_alloc(); 601 - if (vfd == NULL) 602 - return -ENOMEM; 603 597 604 598 vfd->fops = &video_fops; 605 599 if (type == VFL_TYPE_GRABBER) 606 600 vfd->ioctl_ops = &dev->ext_vv_data->vid_ops; 607 601 else 608 602 vfd->ioctl_ops = &dev->ext_vv_data->vbi_ops; 609 - vfd->release = video_device_release; 603 + vfd->release = video_device_release_empty; 610 604 vfd->lock = &dev->v4l2_lock; 611 605 vfd->v4l2_dev = &dev->v4l2_dev; 612 606 vfd->tvnorms = 0; ··· 612 618 err = video_register_device(vfd, type, -1); 613 619 if (err < 0) { 614 620 ERR("cannot register v4l2 device. skipping.\n"); 615 - video_device_release(vfd); 616 621 return err; 617 622 } 618 623 619 624 pr_info("%s: registered device %s [v4l2]\n", 620 625 dev->name, video_device_node_name(vfd)); 621 - 622 - *vid = vfd; 623 626 return 0; 624 627 } 625 628 EXPORT_SYMBOL_GPL(saa7146_register_device); 626 629 627 - int saa7146_unregister_device(struct video_device **vid, struct saa7146_dev* dev) 630 + int saa7146_unregister_device(struct video_device *vfd, struct saa7146_dev *dev) 628 631 { 629 632 DEB_EE("dev:%p\n", dev); 630 633 631 - video_unregister_device(*vid); 632 - *vid = NULL; 633 - 634 + video_unregister_device(vfd); 634 635 return 0; 635 636 } 636 637 EXPORT_SYMBOL_GPL(saa7146_unregister_device);
+1 -1
drivers/media/pci/saa7146/hexium_gemini.c
··· 66 66 { 67 67 int type; 68 68 69 - struct video_device *video_dev; 69 + struct video_device video_dev; 70 70 struct i2c_adapter i2c_adapter; 71 71 72 72 int cur_input; /* current input */
+1 -1
drivers/media/pci/saa7146/hexium_orion.c
··· 63 63 struct hexium 64 64 { 65 65 int type; 66 - struct video_device *video_dev; 66 + struct video_device video_dev; 67 67 struct i2c_adapter i2c_adapter; 68 68 69 69 int cur_input; /* current input */
+2 -2
drivers/media/pci/saa7146/mxb.c
··· 151 151 152 152 struct mxb 153 153 { 154 - struct video_device *video_dev; 155 - struct video_device *vbi_dev; 154 + struct video_device video_dev; 155 + struct video_device vbi_dev; 156 156 157 157 struct i2c_adapter i2c_adapter; 158 158
+2 -2
drivers/media/pci/ttpci/av7110.h
··· 102 102 struct dvb_device dvb_dev; 103 103 struct dvb_net dvb_net; 104 104 105 - struct video_device *v4l_dev; 106 - struct video_device *vbi_dev; 105 + struct video_device v4l_dev; 106 + struct video_device vbi_dev; 107 107 108 108 struct saa7146_dev *dev; 109 109
+1 -1
drivers/media/pci/ttpci/budget-av.c
··· 68 68 69 69 struct budget_av { 70 70 struct budget budget; 71 - struct video_device *vd; 71 + struct video_device vd; 72 72 int cur_input; 73 73 int has_saa7113; 74 74 struct tasklet_struct ciintf_irq_tasklet;
+2 -2
include/media/saa7146_vv.h
··· 178 178 }; 179 179 180 180 /* from saa7146_fops.c */ 181 - int saa7146_register_device(struct video_device **vid, struct saa7146_dev* dev, char *name, int type); 182 - int saa7146_unregister_device(struct video_device **vid, struct saa7146_dev* dev); 181 + int saa7146_register_device(struct video_device *vid, struct saa7146_dev *dev, char *name, int type); 182 + int saa7146_unregister_device(struct video_device *vid, struct saa7146_dev *dev); 183 183 void saa7146_buffer_finish(struct saa7146_dev *dev, struct saa7146_dmaqueue *q, int state); 184 184 void saa7146_buffer_next(struct saa7146_dev *dev, struct saa7146_dmaqueue *q,int vbi); 185 185 int saa7146_buffer_queue(struct saa7146_dev *dev, struct saa7146_dmaqueue *q, struct saa7146_buf *buf);