linux 2.6.16.38 w/ vs2.0.3-rc1
[linux-2.6.git] / drivers / media / video / bttv-gpio.c
index 77320cd..c4d5e2b 100644 (file)
@@ -1,5 +1,4 @@
 /*
-    $Id: bttv-gpio.c,v 1.7 2005/02/16 12:14:10 kraxel Exp $
 
     bttv-gpio.c  --  gpio sub drivers
 
@@ -8,7 +7,7 @@
 
 
     Copyright (C) 1996,97,98 Ralph  Metzler (rjkm@thp.uni-koeln.de)
-                           & Marcus Metzler (mocm@thp.uni-koeln.de)
+                          & Marcus Metzler (mocm@thp.uni-koeln.de)
     (c) 1999-2003 Gerd Knorr <kraxel@bytesex.org>
 
     This program is free software; you can redistribute it and/or modify
@@ -48,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);
 
@@ -65,10 +84,9 @@ int bttv_sub_add_device(struct bttv_core *core, char *name)
        struct bttv_sub_device *sub;
        int err;
 
-       sub = kmalloc(sizeof(*sub),GFP_KERNEL);
+       sub = kzalloc(sizeof(*sub),GFP_KERNEL);
        if (NULL == sub)
                return -ENOMEM;
-       memset(sub,0,sizeof(*sub));
 
        sub->core        = core;
        sub->dev.parent  = &core->pci->dev;