[PATCH] Add bttv sub bus_type probe and remove methods

Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>

authored by Russell King and committed by Greg Kroah-Hartman 348290a4 d78967fb

+35 -14
+11 -12
drivers/media/dvb/bt8xx/dvb-bt8xx.c
··· 779 779 return 0; 780 780 } 781 781 782 - static int dvb_bt8xx_probe(struct device *dev) 782 + static int dvb_bt8xx_probe(struct bttv_sub_device *sub) 783 783 { 784 - struct bttv_sub_device *sub = to_bttv_sub_dev(dev); 785 784 struct dvb_bt8xx_card *card; 786 785 struct pci_dev* bttv_pci_dev; 787 786 int ret; ··· 889 890 return ret; 890 891 } 891 892 892 - dev_set_drvdata(dev, card); 893 + dev_set_drvdata(&sub->dev, card); 893 894 return 0; 894 895 } 895 896 896 - static int dvb_bt8xx_remove(struct device *dev) 897 + static int dvb_bt8xx_remove(struct bttv_sub_device *sub) 897 898 { 898 - struct dvb_bt8xx_card *card = dev_get_drvdata(dev); 899 + struct dvb_bt8xx_card *card = dev_get_drvdata(&sub->dev); 899 900 900 901 dprintk("dvb_bt8xx: unloading card%d\n", card->bttv_nr); 901 902 ··· 918 919 static struct bttv_sub_driver driver = { 919 920 .drv = { 920 921 .name = "dvb-bt8xx", 921 - .probe = dvb_bt8xx_probe, 922 - .remove = dvb_bt8xx_remove, 923 - /* FIXME: 924 - * .shutdown = dvb_bt8xx_shutdown, 925 - * .suspend = dvb_bt8xx_suspend, 926 - * .resume = dvb_bt8xx_resume, 927 - */ 928 922 }, 923 + .probe = dvb_bt8xx_probe, 924 + .remove = dvb_bt8xx_remove, 925 + /* FIXME: 926 + * .shutdown = dvb_bt8xx_shutdown, 927 + * .suspend = dvb_bt8xx_suspend, 928 + * .resume = dvb_bt8xx_resume, 929 + */ 929 930 }; 930 931 931 932 static int __init dvb_bt8xx_init(void)
+22 -2
drivers/media/video/bttv-gpio.c
··· 47 47 return 0; 48 48 } 49 49 50 + static int bttv_sub_probe(struct device *dev) 51 + { 52 + struct bttv_sub_device *sdev = to_bttv_sub_dev(dev); 53 + struct bttv_sub_driver *sub = to_bttv_sub_drv(dev->driver); 54 + 55 + return sub->probe ? sub->probe(sdev) : -ENODEV; 56 + } 57 + 58 + static int bttv_sub_remove(struct device *dev) 59 + { 60 + struct bttv_sub_device *sdev = to_bttv_sub_dev(dev); 61 + struct bttv_sub_driver *sub = to_bttv_sub_drv(dev->driver); 62 + 63 + if (sub->remove) 64 + sub->remove(sdev); 65 + return 0; 66 + } 67 + 50 68 struct bus_type bttv_sub_bus_type = { 51 - .name = "bttv-sub", 52 - .match = &bttv_sub_bus_match, 69 + .name = "bttv-sub", 70 + .match = &bttv_sub_bus_match, 71 + .probe = bttv_sub_probe, 72 + .remove = bttv_sub_remove, 53 73 }; 54 74 EXPORT_SYMBOL(bttv_sub_bus_type); 55 75
+2
drivers/media/video/bttv.h
··· 365 365 struct bttv_sub_driver { 366 366 struct device_driver drv; 367 367 char wanted[BUS_ID_SIZE]; 368 + int (*probe)(struct bttv_sub_device *sub); 369 + void (*remove)(struct bttv_sub_device *sub); 368 370 void (*gpio_irq)(struct bttv_sub_device *sub); 369 371 }; 370 372 #define to_bttv_sub_drv(x) container_of((x), struct bttv_sub_driver, drv)