diff options
Diffstat (limited to 'drivers/media/video/bttv-gpio.c')
-rw-r--r-- | drivers/media/video/bttv-gpio.c | 45 |
1 files changed, 23 insertions, 22 deletions
diff --git a/drivers/media/video/bttv-gpio.c b/drivers/media/video/bttv-gpio.c index 616a5b7e510c..c4d5e2b70c28 100644 --- a/drivers/media/video/bttv-gpio.c +++ b/drivers/media/video/bttv-gpio.c @@ -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); @@ -64,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; @@ -113,24 +132,6 @@ void bttv_gpio_irq(struct bttv_core *core) } } -int bttv_any_irq(struct bttv_core *core) -{ - struct bttv_sub_driver *drv; - struct bttv_sub_device *dev; - struct list_head *item; - int handled = 0; - - list_for_each(item,&core->subs) { - dev = list_entry(item,struct bttv_sub_device,list); - drv = to_bttv_sub_drv(dev->dev.driver); - if (drv && drv->any_irq) { - if (drv->any_irq(dev)) - handled = 1; - } - } - return handled; -} - /* ----------------------------------------------------------------------- */ /* external: sub-driver register/unregister */ |