Commit b3ec8b99 authored by Alessandro Rubini's avatar Alessandro Rubini Committed by Federico Vaga

core: include buffer-kmalloc and trigger-user in zio-core.ko

Signed-off-by: Alessandro Rubini's avatarAlessandro Rubini <rubini@gnudd.com>
Acked-by: 's avatarFederico Vaga <federico.vaga@gmail.com>
parent f90fc7e5
LINUX ?= /lib/modules/$(shell uname -r)/build
zio-core-objs := zio-cdev.o zio-sys.o
zio-core-objs += buffers/zio-buf-kmalloc.o triggers/zio-trig-user.o
obj-m = zio-core.o
obj-m += drivers/
obj-m += buffers/
......
......@@ -2,7 +2,7 @@ LINUX ?= /lib/modules/$(shell uname -r)/build
EXTRA_CFLAGS += -I$(obj)/../include/
obj-m = zio-buf-kmalloc.o
# zio-buf-kmalloc.o is now part of zio-core
all:
$(MAKE) -C $(LINUX) M=$(shell /bin/pwd) modules
......@@ -263,18 +263,17 @@ static struct zio_buffer_type zbk_buffer = {
.f_op = &zbk_file_ops,
};
static int zbk_init(void)
static int __init zbk_init(void)
{
return zio_register_buf(&zbk_buffer, "kmalloc");
}
static void zbk_exit(void)
static void __exit zbk_exit(void)
{
zio_unregister_buf(&zbk_buffer);
/* FIXME REMOVE all instances left */
}
module_init(zbk_init);
module_exit(zbk_exit);
MODULE_AUTHOR("Alessandro Rubini");
MODULE_LICENSE("GPL");
/* This is the default buffer, and is part of zio-core: no module init/exit */
int __init __attribute__((alias("zbk_init"))) zio_default_buffer_init(void);
void __exit __attribute__((alias("zbk_exit"))) zio_default_buffer_exit(void);
......@@ -260,7 +260,13 @@ void __zio_unregister_cdev(void);
int zio_create_chan_devices(struct zio_channel *zchan);
void zio_destroy_chan_devices(struct zio_channel *zchan);
#endif /* INTERNAL */
int zio_default_buffer_init(void);
void zio_default_buffer_exit(void);
int zio_default_trigger_init(void);
void zio_default_trigger_exit(void);
#endif /* __ZIO_INTERNAL__ */
#endif /* __KERNEL__ */
#endif /* __ZIO_H__ */
......@@ -2,9 +2,9 @@ LINUX ?= /lib/modules/$(shell uname -r)/build
EXTRA_CFLAGS += -I$(obj)/../include/
# zio-trig-user.o is now part of zio-core
obj-m = zio-trig-timer.o
obj-m += zio-trig-irq.o
obj-m += zio-trig-user.o
all:
$(MAKE) -C $(LINUX) M=$(shell /bin/pwd) modules
......@@ -123,7 +123,7 @@ static void __exit ztu_exit(void)
zio_unregister_trig(&ztu_trigger);
}
module_init(ztu_init);
module_exit(ztu_exit);
MODULE_AUTHOR("Alessandro Rubini");
MODULE_LICENSE("GPL");
/* This is the default trigger, and is part of zio-core: no module init/exit */
int __init __attribute__((alias("ztu_init"))) zio_default_trigger_init(void);
void __exit __attribute__((alias("ztu_exit"))) zio_default_trigger_exit(void);
......@@ -1762,6 +1762,12 @@ static int __init zio_init(void)
"triggers");
zlist_register(&zstat->all_buffer_types, zstat->kobj, ZBUF,
"buffers");
err = zio_default_buffer_init();
if (err)
pr_warn("%s: cannot register default buffer\n", __func__);
err = zio_default_trigger_init();
if (err)
pr_warn("%s: cannot register default trigger\n", __func__);
pr_info("zio-core had been loaded\n");
return 0;
......@@ -1773,6 +1779,8 @@ out_cdev:
static void __exit zio_exit(void)
{
zio_default_trigger_exit();
zio_default_buffer_exit();
/* Remove the three object lists*/
zlist_unregister(&zstat->all_devices);
zlist_unregister(&zstat->all_buffer_types);
......@@ -1792,6 +1800,7 @@ static void __exit zio_exit(void)
subsys_initcall(zio_init);
module_exit(zio_exit);
MODULE_AUTHOR("Federico Vaga <federico.vaga@gmail.com>");
MODULE_AUTHOR("Federico Vaga and Alessandro Rubini");
/* Federico wrote the core, Alessandro wrote default trigger and buffer */
MODULE_DESCRIPTION("ZIO - ZIO Input Output");
MODULE_LICENSE("GPL");
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