tizen 2.4 release
[profile/mobile/platform/kernel/linux-3.10-sc7730.git] / arch / arm / mach-sc / board-grandprimeve3g-wlan-hw.c
1 #include <linux/err.h>
2 #include <linux/slab.h>
3 #include <linux/miscdevice.h>
4 #include <linux/fs.h>
5 #include <asm/uaccess.h>
6
7 static ssize_t read_check_wifi_chip(struct file *file,
8                 char __user *buffer, size_t count, loff_t *ppos)
9 {
10         ssize_t ret = 0;
11         char *buf;
12
13         if (*ppos < 0 || !count)
14                 return -EINVAL;
15
16         buf = kmalloc(count, GFP_KERNEL);
17         if (!buf)
18                 return -ENOMEM;
19
20         if(*ppos == 0)
21                 ret = sprintf(buf, "%s", "bcm43438 cob");
22
23         if (ret >= 0) {
24                 if (copy_to_user(buffer, buf, ret)) {
25                         kfree(buf);
26                         return -EFAULT;
27                 }
28                 *ppos += ret;
29         }
30
31         kfree(buf);
32         return ret;
33 }
34
35 static const struct file_operations check_wifi_chip_fops = {
36         .read = read_check_wifi_chip,
37 };
38
39 static struct miscdevice check_wifi_chip = {
40         .minor = MISC_DYNAMIC_MINOR,
41         .name = "check_wifi_chip",
42         .fops = &check_wifi_chip_fops,
43 };
44
45 static int __init check_wifi_chip_init(void)
46 {
47         return misc_register(&check_wifi_chip);
48 }
49
50 static void __exit check_wifi_chip_exit(void)
51 {
52         misc_deregister(&check_wifi_chip);
53 }
54
55 module_init(check_wifi_chip_init);
56 module_exit(check_wifi_chip_exit);