X-Git-Url: http://git.onelab.eu/?p=linux-2.6.git;a=blobdiff_plain;f=drivers%2Fmedia%2Fvideo%2Fbttv-gpio.c;fp=drivers%2Fmedia%2Fvideo%2Fbttv-gpio.c;h=c4d5e2b70c28e12c28761b09713e5d669cb3fcdc;hp=77320cdf205fc5e7d6fa03303b0c5b7644597540;hb=64ba3f394c830ec48a1c31b53dcae312c56f1604;hpb=be1e6109ac94a859551f8e1774eb9a8469fe055c diff --git a/drivers/media/video/bttv-gpio.c b/drivers/media/video/bttv-gpio.c index 77320cdf2..c4d5e2b70 100644 --- a/drivers/media/video/bttv-gpio.c +++ b/drivers/media/video/bttv-gpio.c @@ -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 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;