Thread (3 messages) flat view 3 messages, 3 authors, 2012-07-05

[PATCH v4 RESEND] mm: cma: add a simple kernel module as the helper to test CMA

From: Barry Song <hidden>
Date: 2012-07-05 08:44:53
Also in: lkml

Hi Arnd,

2012/7/5 Arnd Bergmann [off-list ref]:
I think it should be in mm/cma-test.c, along with kmemleak-test.c. It would be nice
if you could add some code that just runs at boot time (or when the module is
loaded) and allocates and frees memory using CMA.
quoted
+static struct device *cma_dev;
Do you actually need this device? It's not connected to hardware so
it doesn't actually do DMA and we might as well pass a NULL pointer
into dma_alloc_*().
quoted
+static const struct file_operations cma_test_fops = {
+     .owner =    THIS_MODULE,
+     .read  =    cma_test_read,
+     .write =    cma_test_write,
+};
+
+static struct miscdevice cma_test_misc = {
+     .name = "cma_test",
+     .fops = &cma_test_fops,
+};
+
+static int __init cma_test_init(void)
+{
+     int ret = misc_register(&cma_test_misc);
A better place for this is really debugfs. The driver is not meant as a stable
kernel interface that applications can rely on, it's purely a debugging help.

Just make this

        ret = debugfs_create_file("cma-test", 0600, NULL, NULL, &cma_test_fops);
we did have some discussions about this at:
http://www.spinics.net/lists/arm-kernel/msg163548.html

i'd say both are acceptable to me.
        Arnd
-barry
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help