Permalink
Browse files

+debugfs

  • Loading branch information...
1 parent 6825c67 commit d85fab102ff9e4cb6d5c4ec703bd740659a67098 @makelinux committed Oct 4, 2012
Showing with 7 additions and 3 deletions.
  1. +1 −0 ldt-test
  2. +6 −3 ldt.c
View
@@ -139,6 +139,7 @@ echo expected $data
echo received $received
fi
+sudo ls -l /sys/kernel/debug/ldt
#grep ldt /proc/interrupts || true
tracing_stop || true
sudo dmesg --notime --read-clear 2>/dev/null > kernel.log || \
View
@@ -23,15 +23,14 @@
* work
* kthread
* misc device
- * proc fs
+ * debugfs
* platform_driver and platform_device in another module
* simple UART driver on port 0x3f8 with IRQ 4
*
* TODO:
* multiple devices
* classic tracing
* linked list
- * debugfs
*
*/
@@ -50,6 +49,7 @@
#include <linux/miscdevice.h>
#include <linux/platform_device.h>
#include <linux/serial_reg.h>
+#include <linux/debugfs.h>
static int bufsize = PFN_ALIGN(16 * 1024);
static void *in_buf;
@@ -475,6 +475,7 @@ static int uart_probe(void)
}
static struct task_struct *thread;
+static struct dentry * debugfs;
/*
* ldt_probe - main initialization function
@@ -536,6 +537,7 @@ static __devinit int ldt_probe(struct platform_device *pdev)
thread = kthread_run(ldt_thread, NULL, "%s", KBUILD_MODNAME);
if (IS_ERR(thread))
ret = PTR_ERR(thread);
+ debugfs = debugfs_create_file(KBUILD_MODNAME, S_IRUGO, NULL, NULL, &ldt_fops);
exit:
trl_();
trvd(ret);
@@ -552,7 +554,8 @@ static int __devexit ldt_remove(struct platform_device *pdev)
if (pdev)
dev_dbg(&pdev->dev, "%s:%d %s detaching driver\n", __file__, __LINE__, __func__);
/* remove_proc_entry(KBUILD_MODNAME, NULL); depricated */
-
+ if (debugfs)
+ debugfs_remove(debugfs);
misc_deregister(&ldt_miscdev);
if (!IS_ERR(thread)) {
send_sig(SIGINT, thread, 1);

0 comments on commit d85fab1

Please sign in to comment.