Commit 9a0c1982 authored by Dominik Brodowski's avatar Dominik Brodowski Committed by Linus Torvalds

[PATCH] pcmcia: add bus_type pcmcia_bus_type

Register a bus_type pcmcia_bus_type. This means the initialization of
the ds module needs to be done in two levels: one quite early
(subsys_initcall) so that drivers may use the bus_type; the other one
must stay that late (late_initcall). As only one initcall can be
specified within one module, some tweaking is needed.
parent 1ab10ae7
...@@ -881,7 +881,18 @@ EXPORT_SYMBOL(unregister_pccard_driver); ...@@ -881,7 +881,18 @@ EXPORT_SYMBOL(unregister_pccard_driver);
/*====================================================================*/ /*====================================================================*/
int __init init_pcmcia_ds(void) struct bus_type pcmcia_bus_type = {
.name = "pcmcia",
};
EXPORT_SYMBOL(pcmcia_bus_type);
static int __init init_pcmcia_bus(void)
{
bus_register(&pcmcia_bus_type);
return 0;
}
static int __init init_pcmcia_ds(void)
{ {
client_reg_t client_reg; client_reg_t client_reg;
servinfo_t serv; servinfo_t serv;
...@@ -967,11 +978,8 @@ int __init init_pcmcia_ds(void) ...@@ -967,11 +978,8 @@ int __init init_pcmcia_ds(void)
return 0; return 0;
} }
late_initcall(init_pcmcia_ds);
#ifdef MODULE static void __exit exit_pcmcia_ds(void)
void __exit cleanup_module(void)
{ {
int i; int i;
#ifdef CONFIG_PROC_FS #ifdef CONFIG_PROC_FS
...@@ -984,6 +992,23 @@ void __exit cleanup_module(void) ...@@ -984,6 +992,23 @@ void __exit cleanup_module(void)
pcmcia_deregister_client(socket_table[i].handle); pcmcia_deregister_client(socket_table[i].handle);
sockets = 0; sockets = 0;
kfree(socket_table); kfree(socket_table);
bus_unregister(&pcmcia_bus_type);
} }
#ifdef MODULE
/* init_pcmcia_bus must be done early, init_pcmcia_ds late. If we load this
* as a module, we can only specify one initcall, though...
*/
static int __init init_pcmcia_module(void) {
init_pcmcia_bus();
return init_pcmcia_ds();
}
module_init(init_pcmcia_module);
#else /* !MODULE */
subsys_initcall(init_pcmcia_bus);
late_initcall(init_pcmcia_ds);
#endif #endif
module_exit(exit_pcmcia_ds);
...@@ -32,6 +32,7 @@ ...@@ -32,6 +32,7 @@
#include <pcmcia/driver_ops.h> #include <pcmcia/driver_ops.h>
#include <pcmcia/bulkmem.h> #include <pcmcia/bulkmem.h>
#include <linux/device.h>
typedef struct tuple_parse_t { typedef struct tuple_parse_t {
tuple_t tuple; tuple_t tuple;
...@@ -143,6 +144,8 @@ int unregister_pccard_driver(dev_info_t *dev_info); ...@@ -143,6 +144,8 @@ int unregister_pccard_driver(dev_info_t *dev_info);
#define register_pcmcia_driver register_pccard_driver #define register_pcmcia_driver register_pccard_driver
#define unregister_pcmcia_driver unregister_pccard_driver #define unregister_pcmcia_driver unregister_pccard_driver
extern struct bus_type pcmcia_bus_type;
#endif /* __KERNEL__ */ #endif /* __KERNEL__ */
#endif /* _LINUX_DS_H */ #endif /* _LINUX_DS_H */
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