mirror of
https://github.com/torvalds/linux.git
synced 2024-12-04 18:13:04 +00:00
media: ddbridge: move ddb_wq and the wq+class initialisation to -core
Move the ddbridge module initialisation and cleanup code to ddbridge-core and set up the ddb_wq workqueue there, and create and destroy the ddb device class there aswell. Due to this, the prototypes for ddb_wq, ddb_class_create() and ddb_class_destroy() aren't required in ddbridge.h anymore, so remove them. Also, declare ddb_wq and the ddb_class_*() functions static. Picked up from the upstream dddvb-0.9.33 release. Signed-off-by: Daniel Scheller <d.scheller@gmx.net> Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
This commit is contained in:
parent
5589974ecd
commit
05ed62da03
@ -100,7 +100,7 @@ MODULE_PARM_DESC(stv0910_single, "use stv0910 cards as single demods");
|
||||
|
||||
static DEFINE_MUTEX(redirect_lock);
|
||||
|
||||
struct workqueue_struct *ddb_wq;
|
||||
static struct workqueue_struct *ddb_wq;
|
||||
|
||||
static struct ddb *ddbs[DDB_MAX_ADAPTER];
|
||||
|
||||
@ -3040,7 +3040,7 @@ static struct class ddb_class = {
|
||||
.devnode = ddb_devnode,
|
||||
};
|
||||
|
||||
int ddb_class_create(void)
|
||||
static int ddb_class_create(void)
|
||||
{
|
||||
ddb_major = register_chrdev(0, DDB_NAME, &ddb_fops);
|
||||
if (ddb_major < 0)
|
||||
@ -3050,7 +3050,7 @@ int ddb_class_create(void)
|
||||
return 0;
|
||||
}
|
||||
|
||||
void ddb_class_destroy(void)
|
||||
static void ddb_class_destroy(void)
|
||||
{
|
||||
class_unregister(&ddb_class);
|
||||
unregister_chrdev(ddb_major, DDB_NAME);
|
||||
@ -3322,3 +3322,29 @@ void ddb_unmap(struct ddb *dev)
|
||||
iounmap(dev->regs);
|
||||
vfree(dev);
|
||||
}
|
||||
|
||||
int ddb_exit_ddbridge(int stage, int error)
|
||||
{
|
||||
switch (stage) {
|
||||
default:
|
||||
case 2:
|
||||
destroy_workqueue(ddb_wq);
|
||||
/* fall-through */
|
||||
case 1:
|
||||
ddb_class_destroy();
|
||||
break;
|
||||
}
|
||||
|
||||
return error;
|
||||
}
|
||||
|
||||
int ddb_init_ddbridge(void)
|
||||
{
|
||||
if (ddb_class_create() < 0)
|
||||
return -1;
|
||||
ddb_wq = alloc_workqueue("ddbridge", 0, 0);
|
||||
if (!ddb_wq)
|
||||
return ddb_exit_ddbridge(1, -1);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -282,32 +282,25 @@ static struct pci_driver ddb_pci_driver = {
|
||||
|
||||
static __init int module_init_ddbridge(void)
|
||||
{
|
||||
int stat = -1;
|
||||
int stat;
|
||||
|
||||
pr_info("Digital Devices PCIE bridge driver "
|
||||
DDBRIDGE_VERSION
|
||||
", Copyright (C) 2010-17 Digital Devices GmbH\n");
|
||||
if (ddb_class_create() < 0)
|
||||
return -1;
|
||||
ddb_wq = create_workqueue("ddbridge");
|
||||
if (!ddb_wq)
|
||||
goto exit1;
|
||||
stat = ddb_init_ddbridge();
|
||||
if (stat < 0)
|
||||
return stat;
|
||||
stat = pci_register_driver(&ddb_pci_driver);
|
||||
if (stat < 0)
|
||||
goto exit2;
|
||||
return stat;
|
||||
exit2:
|
||||
destroy_workqueue(ddb_wq);
|
||||
exit1:
|
||||
ddb_class_destroy();
|
||||
ddb_exit_ddbridge(0, stat);
|
||||
|
||||
return stat;
|
||||
}
|
||||
|
||||
static __exit void module_exit_ddbridge(void)
|
||||
{
|
||||
pci_unregister_driver(&ddb_pci_driver);
|
||||
destroy_workqueue(ddb_wq);
|
||||
ddb_class_destroy();
|
||||
ddb_exit_ddbridge(0, 0);
|
||||
}
|
||||
|
||||
module_init(module_init_ddbridge);
|
||||
|
@ -368,9 +368,6 @@ int ddbridge_flashread(struct ddb *dev, u32 link, u8 *buf, u32 addr, u32 len);
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
/* ddbridge-main.c (modparams) */
|
||||
extern struct workqueue_struct *ddb_wq;
|
||||
|
||||
/* ddbridge-core.c */
|
||||
void ddb_ports_detach(struct ddb *dev);
|
||||
void ddb_ports_release(struct ddb *dev);
|
||||
@ -383,9 +380,9 @@ void ddb_ports_init(struct ddb *dev);
|
||||
int ddb_buffers_alloc(struct ddb *dev);
|
||||
int ddb_ports_attach(struct ddb *dev);
|
||||
int ddb_device_create(struct ddb *dev);
|
||||
int ddb_class_create(void);
|
||||
void ddb_class_destroy(void);
|
||||
int ddb_init(struct ddb *dev);
|
||||
void ddb_unmap(struct ddb *dev);
|
||||
int ddb_exit_ddbridge(int stage, int error);
|
||||
int ddb_init_ddbridge(void);
|
||||
|
||||
#endif /* DDBRIDGE_H */
|
||||
|
Loading…
Reference in New Issue
Block a user