Commit 348290a4 authored by Russell King's avatar Russell King Committed by Greg Kroah-Hartman

[PATCH] Add bttv sub bus_type probe and remove methods

Signed-off-by: default avatarRussell King <rmk+kernel@arm.linux.org.uk>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent d78967fb
...@@ -779,9 +779,8 @@ static int __init dvb_bt8xx_load_card(struct dvb_bt8xx_card *card, u32 type) ...@@ -779,9 +779,8 @@ static int __init dvb_bt8xx_load_card(struct dvb_bt8xx_card *card, u32 type)
return 0; 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 dvb_bt8xx_card *card;
struct pci_dev* bttv_pci_dev; struct pci_dev* bttv_pci_dev;
int ret; int ret;
...@@ -890,13 +889,13 @@ static int dvb_bt8xx_probe(struct device *dev) ...@@ -890,13 +889,13 @@ static int dvb_bt8xx_probe(struct device *dev)
return ret; return ret;
} }
dev_set_drvdata(dev, card); dev_set_drvdata(&sub->dev, card);
return 0; 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); dprintk("dvb_bt8xx: unloading card%d\n", card->bttv_nr);
...@@ -919,6 +918,7 @@ static int dvb_bt8xx_remove(struct device *dev) ...@@ -919,6 +918,7 @@ static int dvb_bt8xx_remove(struct device *dev)
static struct bttv_sub_driver driver = { static struct bttv_sub_driver driver = {
.drv = { .drv = {
.name = "dvb-bt8xx", .name = "dvb-bt8xx",
},
.probe = dvb_bt8xx_probe, .probe = dvb_bt8xx_probe,
.remove = dvb_bt8xx_remove, .remove = dvb_bt8xx_remove,
/* FIXME: /* FIXME:
...@@ -926,7 +926,6 @@ static struct bttv_sub_driver driver = { ...@@ -926,7 +926,6 @@ static struct bttv_sub_driver driver = {
* .suspend = dvb_bt8xx_suspend, * .suspend = dvb_bt8xx_suspend,
* .resume = dvb_bt8xx_resume, * .resume = dvb_bt8xx_resume,
*/ */
},
}; };
static int __init dvb_bt8xx_init(void) static int __init dvb_bt8xx_init(void)
......
...@@ -47,9 +47,29 @@ static int bttv_sub_bus_match(struct device *dev, struct device_driver *drv) ...@@ -47,9 +47,29 @@ static int bttv_sub_bus_match(struct device *dev, struct device_driver *drv)
return 0; 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 = { struct bus_type bttv_sub_bus_type = {
.name = "bttv-sub", .name = "bttv-sub",
.match = &bttv_sub_bus_match, .match = &bttv_sub_bus_match,
.probe = bttv_sub_probe,
.remove = bttv_sub_remove,
}; };
EXPORT_SYMBOL(bttv_sub_bus_type); EXPORT_SYMBOL(bttv_sub_bus_type);
......
...@@ -365,6 +365,8 @@ struct bttv_sub_device { ...@@ -365,6 +365,8 @@ struct bttv_sub_device {
struct bttv_sub_driver { struct bttv_sub_driver {
struct device_driver drv; struct device_driver drv;
char wanted[BUS_ID_SIZE]; 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); void (*gpio_irq)(struct bttv_sub_device *sub);
}; };
#define to_bttv_sub_drv(x) container_of((x), struct bttv_sub_driver, drv) #define to_bttv_sub_drv(x) container_of((x), struct bttv_sub_driver, drv)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment