Commit 6cba9612 authored by Greg Kroah-Hartman's avatar Greg Kroah-Hartman

[PATCH] MEM: add sysfs class support for mem devices

This adds class/mem/ for all memory devices (random, raw, null, etc.)
parent 517b9727
...@@ -24,6 +24,7 @@ ...@@ -24,6 +24,7 @@
#include <linux/smp_lock.h> #include <linux/smp_lock.h>
#include <linux/devfs_fs_kernel.h> #include <linux/devfs_fs_kernel.h>
#include <linux/ptrace.h> #include <linux/ptrace.h>
#include <linux/device.h>
#include <asm/uaccess.h> #include <asm/uaccess.h>
#include <asm/io.h> #include <asm/io.h>
...@@ -676,6 +677,8 @@ static const struct { ...@@ -676,6 +677,8 @@ static const struct {
{11,"kmsg", S_IRUGO | S_IWUSR, &kmsg_fops}, {11,"kmsg", S_IRUGO | S_IWUSR, &kmsg_fops},
}; };
static struct class_simple *mem_class;
static int __init chr_dev_init(void) static int __init chr_dev_init(void)
{ {
int i; int i;
...@@ -683,7 +686,11 @@ static int __init chr_dev_init(void) ...@@ -683,7 +686,11 @@ static int __init chr_dev_init(void)
if (register_chrdev(MEM_MAJOR,"mem",&memory_fops)) if (register_chrdev(MEM_MAJOR,"mem",&memory_fops))
printk("unable to get major %d for memory devs\n", MEM_MAJOR); printk("unable to get major %d for memory devs\n", MEM_MAJOR);
mem_class = class_simple_create(THIS_MODULE, "mem");
for (i = 0; i < ARRAY_SIZE(devlist); i++) { for (i = 0; i < ARRAY_SIZE(devlist); i++) {
class_simple_device_add(mem_class,
MKDEV(MEM_MAJOR, devlist[i].minor),
NULL, devlist[i].name);
devfs_mk_cdev(MKDEV(MEM_MAJOR, devlist[i].minor), devfs_mk_cdev(MKDEV(MEM_MAJOR, devlist[i].minor),
S_IFCHR | devlist[i].mode, devlist[i].name); S_IFCHR | devlist[i].mode, devlist[i].name);
} }
......
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