diff options
author | Mauro Carvalho Chehab <devnull@localhost> | 2006-01-15 23:19:19 +0000 |
---|---|---|
committer | Mauro Carvalho Chehab <devnull@localhost> | 2006-01-15 23:19:19 +0000 |
commit | 8bd7bc82dd39ba77dd88c4dc39800dbe1a3346b6 (patch) | |
tree | 0262c82d88cf3885f0d0b6efab5e069cc2058f26 /linux | |
parent | a1a9178a0f1df6e336d6548ee508e772bde91119 (diff) | |
download | mediapointer-dvb-s2-8bd7bc82dd39ba77dd88c4dc39800dbe1a3346b6.tar.gz mediapointer-dvb-s2-8bd7bc82dd39ba77dd88c4dc39800dbe1a3346b6.tar.bz2 |
From: Russell King <rmk@arm.linux.org.uk>
Add bttv sub bus_type probe and remove methods
Add bttv sub bus_type probe and remove methods
kernel-sync
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
Diffstat (limited to 'linux')
-rw-r--r-- | linux/drivers/media/dvb/bt8xx/dvb-bt8xx.c | 29 | ||||
-rw-r--r-- | linux/drivers/media/video/bttv-gpio.c | 29 | ||||
-rw-r--r-- | linux/drivers/media/video/bttv.h | 6 |
3 files changed, 62 insertions, 2 deletions
diff --git a/linux/drivers/media/dvb/bt8xx/dvb-bt8xx.c b/linux/drivers/media/dvb/bt8xx/dvb-bt8xx.c index ad1ef4ca0..0183dc607 100644 --- a/linux/drivers/media/dvb/bt8xx/dvb-bt8xx.c +++ b/linux/drivers/media/dvb/bt8xx/dvb-bt8xx.c @@ -780,9 +780,15 @@ static int __init dvb_bt8xx_load_card(struct dvb_bt8xx_card *card, u32 type) return 0; } +#if LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,15) static int dvb_bt8xx_probe(struct device *dev) +#else +static int dvb_bt8xx_probe(struct bttv_sub_device *sub) +#endif { +#if LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,15) struct bttv_sub_device *sub = to_bttv_sub_dev(dev); +#endif struct dvb_bt8xx_card *card; struct pci_dev* bttv_pci_dev; int ret; @@ -891,13 +897,25 @@ static int dvb_bt8xx_probe(struct device *dev) return ret; } +#if LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,15) dev_set_drvdata(dev, card); +#else + dev_set_drvdata(&sub->dev, card); +#endif return 0; } +#if LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,15) static int dvb_bt8xx_remove(struct device *dev) +#else +static int dvb_bt8xx_remove(struct bttv_sub_device *sub) +#endif { +#if LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,15) struct dvb_bt8xx_card *card = dev_get_drvdata(dev); +#else + struct dvb_bt8xx_card *card = dev_get_drvdata(&sub->dev); +#endif dprintk("dvb_bt8xx: unloading card%d\n", card->bttv_nr); @@ -920,6 +938,7 @@ static int dvb_bt8xx_remove(struct device *dev) static struct bttv_sub_driver driver = { .drv = { .name = "dvb-bt8xx", +#if LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,15) .probe = dvb_bt8xx_probe, .remove = dvb_bt8xx_remove, /* FIXME: @@ -927,7 +946,17 @@ static struct bttv_sub_driver driver = { * .suspend = dvb_bt8xx_suspend, * .resume = dvb_bt8xx_resume, */ +#endif }, +#if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,15) + .probe = dvb_bt8xx_probe, + .remove = dvb_bt8xx_remove, + /* FIXME: + * .shutdown = dvb_bt8xx_shutdown, + * .suspend = dvb_bt8xx_suspend, + * .resume = dvb_bt8xx_resume, + */ +#endif }; static int __init dvb_bt8xx_init(void) diff --git a/linux/drivers/media/video/bttv-gpio.c b/linux/drivers/media/video/bttv-gpio.c index f2ec2e787..8682662b3 100644 --- a/linux/drivers/media/video/bttv-gpio.c +++ b/linux/drivers/media/video/bttv-gpio.c @@ -1,5 +1,5 @@ /* - $Id: bttv-gpio.c,v 1.11 2006/01/11 19:28:02 mchehab Exp $ + $Id: bttv-gpio.c,v 1.12 2006/01/15 23:19:19 mchehab Exp $ bttv-gpio.c -- gpio sub drivers @@ -48,9 +48,36 @@ static int bttv_sub_bus_match(struct device *dev, struct device_driver *drv) return 0; } +#if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,15) +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; +} + +#endif struct bus_type bttv_sub_bus_type = { +#if LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,15) .name = "bttv-sub", .match = &bttv_sub_bus_match, +#else + .name = "bttv-sub", + .match = &bttv_sub_bus_match, + .probe = bttv_sub_probe, + .remove = bttv_sub_remove, +#endif }; EXPORT_SYMBOL(bttv_sub_bus_type); diff --git a/linux/drivers/media/video/bttv.h b/linux/drivers/media/video/bttv.h index 39d79e10e..bdc3a19e3 100644 --- a/linux/drivers/media/video/bttv.h +++ b/linux/drivers/media/video/bttv.h @@ -1,5 +1,5 @@ /* - * $Id: bttv.h,v 1.37 2006/01/10 04:29:23 mkrufky Exp $ + * $Id: bttv.h,v 1.38 2006/01/15 23:19:19 mchehab Exp $ * * bttv - Bt848 frame grabber driver * @@ -374,6 +374,10 @@ struct bttv_sub_device { struct bttv_sub_driver { struct device_driver drv; char wanted[BUS_ID_SIZE]; +#if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,15) + int (*probe)(struct bttv_sub_device *sub); + void (*remove)(struct bttv_sub_device *sub); +#endif void (*gpio_irq)(struct bttv_sub_device *sub); }; #define to_bttv_sub_drv(x) container_of((x), struct bttv_sub_driver, drv) |