]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
[PATCH] Add bttv sub bus_type probe and remove methods
authorRussell King <rmk@arm.linux.org.uk>
Fri, 6 Jan 2006 11:42:03 +0000 (11:42 +0000)
committerGreg Kroah-Hartman <gregkh@suse.de>
Fri, 13 Jan 2006 19:26:11 +0000 (11:26 -0800)
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
drivers/media/dvb/bt8xx/dvb-bt8xx.c
drivers/media/video/bttv-gpio.c
drivers/media/video/bttv.h

index f65f64b00ff342aa5c0140198e13be55db99ff2b..44fcbe77c8f95b24e5d5d137e490c22144685800 100644 (file)
@@ -779,9 +779,8 @@ static int __init dvb_bt8xx_load_card(struct dvb_bt8xx_card *card, u32 type)
        return 0;
 }
 
-static int dvb_bt8xx_probe(struct device *dev)
+static int dvb_bt8xx_probe(struct bttv_sub_device *sub)
 {
-       struct bttv_sub_device *sub = to_bttv_sub_dev(dev);
        struct dvb_bt8xx_card *card;
        struct pci_dev* bttv_pci_dev;
        int ret;
@@ -890,13 +889,13 @@ static int dvb_bt8xx_probe(struct device *dev)
                return ret;
        }
 
-       dev_set_drvdata(dev, card);
+       dev_set_drvdata(&sub->dev, card);
        return 0;
 }
 
-static int dvb_bt8xx_remove(struct device *dev)
+static int dvb_bt8xx_remove(struct bttv_sub_device *sub)
 {
-       struct dvb_bt8xx_card *card = dev_get_drvdata(dev);
+       struct dvb_bt8xx_card *card = dev_get_drvdata(&sub->dev);
 
        dprintk("dvb_bt8xx: unloading card%d\n", card->bttv_nr);
 
@@ -919,14 +918,14 @@ static int dvb_bt8xx_remove(struct device *dev)
 static struct bttv_sub_driver driver = {
        .drv = {
                .name           = "dvb-bt8xx",
-               .probe          = dvb_bt8xx_probe,
-               .remove         = dvb_bt8xx_remove,
-               /* FIXME:
-                * .shutdown    = dvb_bt8xx_shutdown,
-                * .suspend     = dvb_bt8xx_suspend,
-                * .resume      = dvb_bt8xx_resume,
-                */
        },
+       .probe          = dvb_bt8xx_probe,
+       .remove         = dvb_bt8xx_remove,
+       /* FIXME:
+        * .shutdown    = dvb_bt8xx_shutdown,
+        * .suspend     = dvb_bt8xx_suspend,
+        * .resume      = dvb_bt8xx_resume,
+        */
 };
 
 static int __init dvb_bt8xx_init(void)
index d64accc17b0ef7854438845f6b4cb49096988e89..c4d5e2b70c28e12c28761b09713e5d669cb3fcdc 100644 (file)
@@ -47,9 +47,29 @@ static int bttv_sub_bus_match(struct device *dev, struct device_driver *drv)
        return 0;
 }
 
+static int bttv_sub_probe(struct device *dev)
+{
+       struct bttv_sub_device *sdev = to_bttv_sub_dev(dev);
+       struct bttv_sub_driver *sub = to_bttv_sub_drv(dev->driver);
+
+       return sub->probe ? sub->probe(sdev) : -ENODEV;
+}
+
+static int bttv_sub_remove(struct device *dev)
+{
+       struct bttv_sub_device *sdev = to_bttv_sub_dev(dev);
+       struct bttv_sub_driver *sub = to_bttv_sub_drv(dev->driver);
+
+       if (sub->remove)
+               sub->remove(sdev);
+       return 0;
+}
+
 struct bus_type bttv_sub_bus_type = {
-       .name  = "bttv-sub",
-       .match = &bttv_sub_bus_match,
+       .name   = "bttv-sub",
+       .match  = &bttv_sub_bus_match,
+       .probe  = bttv_sub_probe,
+       .remove = bttv_sub_remove,
 };
 EXPORT_SYMBOL(bttv_sub_bus_type);
 
index e370d74f2a1b1f50a17aaa0b4d8b75f6cdb7ab8e..9908c8e0c951636e68c1121f2e2b4a7262194020 100644 (file)
@@ -365,6 +365,8 @@ struct bttv_sub_device {
 struct bttv_sub_driver {
        struct device_driver   drv;
        char                   wanted[BUS_ID_SIZE];
+       int                    (*probe)(struct bttv_sub_device *sub);
+       void                   (*remove)(struct bttv_sub_device *sub);
        void                   (*gpio_irq)(struct bttv_sub_device *sub);
 };
 #define to_bttv_sub_drv(x) container_of((x), struct bttv_sub_driver, drv)