aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFinn Thain <fthain@telegraphics.com.au>2019-01-14 23:18:56 -0500
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2019-01-22 04:21:45 -0500
commit537f3286ad8fdd96e56a027160867ef092651353 (patch)
tree84ceab3cab5b28c6cb7e4f60e3c4c4ed9dad6f77
parentf9c3a570f5fc584f2ca2dd222d1b8c8537fc55f6 (diff)
char/generic_nvram: Remove as unused
Signed-off-by: Finn Thain <fthain@telegraphics.com.au> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r--drivers/char/Makefile6
-rw-r--r--drivers/char/generic_nvram.c160
2 files changed, 1 insertions, 165 deletions
diff --git a/drivers/char/Makefile b/drivers/char/Makefile
index b8d42b4e979b..fbea7dd12932 100644
--- a/drivers/char/Makefile
+++ b/drivers/char/Makefile
@@ -26,11 +26,7 @@ obj-$(CONFIG_RTC) += rtc.o
26obj-$(CONFIG_HPET) += hpet.o 26obj-$(CONFIG_HPET) += hpet.o
27obj-$(CONFIG_EFI_RTC) += efirtc.o 27obj-$(CONFIG_EFI_RTC) += efirtc.o
28obj-$(CONFIG_XILINX_HWICAP) += xilinx_hwicap/ 28obj-$(CONFIG_XILINX_HWICAP) += xilinx_hwicap/
29ifeq ($(CONFIG_GENERIC_NVRAM),y) 29obj-$(CONFIG_NVRAM) += nvram.o
30 obj-$(CONFIG_NVRAM) += generic_nvram.o
31else
32 obj-$(CONFIG_NVRAM) += nvram.o
33endif
34obj-$(CONFIG_TOSHIBA) += toshiba.o 30obj-$(CONFIG_TOSHIBA) += toshiba.o
35obj-$(CONFIG_DS1620) += ds1620.o 31obj-$(CONFIG_DS1620) += ds1620.o
36obj-$(CONFIG_HW_RANDOM) += hw_random/ 32obj-$(CONFIG_HW_RANDOM) += hw_random/
diff --git a/drivers/char/generic_nvram.c b/drivers/char/generic_nvram.c
deleted file mode 100644
index 0c22b9503e84..000000000000
--- a/drivers/char/generic_nvram.c
+++ /dev/null
@@ -1,160 +0,0 @@
1/*
2 * Generic /dev/nvram driver for architectures providing some
3 * "generic" hooks, that is :
4 *
5 * nvram_read_byte, nvram_write_byte, nvram_sync, nvram_get_size
6 *
7 * Note that an additional hook is supported for PowerMac only
8 * for getting the nvram "partition" informations
9 *
10 */
11
12#define NVRAM_VERSION "1.1"
13
14#include <linux/module.h>
15
16#include <linux/types.h>
17#include <linux/errno.h>
18#include <linux/fs.h>
19#include <linux/miscdevice.h>
20#include <linux/fcntl.h>
21#include <linux/init.h>
22#include <linux/mutex.h>
23#include <linux/nvram.h>
24#include <linux/pagemap.h>
25#include <linux/uaccess.h>
26#include <asm/nvram.h>
27#ifdef CONFIG_PPC_PMAC
28#include <asm/machdep.h>
29#endif
30
31#define NVRAM_SIZE 8192
32
33static DEFINE_MUTEX(nvram_mutex);
34static ssize_t nvram_len;
35
36static loff_t nvram_llseek(struct file *file, loff_t offset, int origin)
37{
38 return generic_file_llseek_size(file, offset, origin,
39 MAX_LFS_FILESIZE, nvram_len);
40}
41
42static ssize_t read_nvram(struct file *file, char __user *buf,
43 size_t count, loff_t *ppos)
44{
45 unsigned int i;
46 char __user *p = buf;
47
48 if (!access_ok(buf, count))
49 return -EFAULT;
50 if (*ppos >= nvram_len)
51 return 0;
52 for (i = *ppos; count > 0 && i < nvram_len; ++i, ++p, --count)
53 if (__put_user(nvram_read_byte(i), p))
54 return -EFAULT;
55 *ppos = i;
56 return p - buf;
57}
58
59static ssize_t write_nvram(struct file *file, const char __user *buf,
60 size_t count, loff_t *ppos)
61{
62 unsigned int i;
63 const char __user *p = buf;
64 char c;
65
66 if (!access_ok(buf, count))
67 return -EFAULT;
68 if (*ppos >= nvram_len)
69 return 0;
70 for (i = *ppos; count > 0 && i < nvram_len; ++i, ++p, --count) {
71 if (__get_user(c, p))
72 return -EFAULT;
73 nvram_write_byte(c, i);
74 }
75 *ppos = i;
76 return p - buf;
77}
78
79static int nvram_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
80{
81 switch(cmd) {
82#ifdef CONFIG_PPC_PMAC
83 case OBSOLETE_PMAC_NVRAM_GET_OFFSET:
84 printk(KERN_WARNING "nvram: Using obsolete PMAC_NVRAM_GET_OFFSET ioctl\n");
85 case IOC_NVRAM_GET_OFFSET: {
86 int part, offset;
87
88 if (!machine_is(powermac))
89 return -EINVAL;
90 if (copy_from_user(&part, (void __user*)arg, sizeof(part)) != 0)
91 return -EFAULT;
92 if (part < pmac_nvram_OF || part > pmac_nvram_NR)
93 return -EINVAL;
94 offset = pmac_get_partition(part);
95 if (copy_to_user((void __user*)arg, &offset, sizeof(offset)) != 0)
96 return -EFAULT;
97 break;
98 }
99#endif /* CONFIG_PPC_PMAC */
100 case IOC_NVRAM_SYNC:
101 nvram_sync();
102 break;
103 default:
104 return -EINVAL;
105 }
106
107 return 0;
108}
109
110static long nvram_unlocked_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
111{
112 int ret;
113
114 mutex_lock(&nvram_mutex);
115 ret = nvram_ioctl(file, cmd, arg);
116 mutex_unlock(&nvram_mutex);
117
118 return ret;
119}
120
121const struct file_operations nvram_fops = {
122 .owner = THIS_MODULE,
123 .llseek = nvram_llseek,
124 .read = read_nvram,
125 .write = write_nvram,
126 .unlocked_ioctl = nvram_unlocked_ioctl,
127};
128
129static struct miscdevice nvram_dev = {
130 NVRAM_MINOR,
131 "nvram",
132 &nvram_fops
133};
134
135int __init nvram_init(void)
136{
137 int ret = 0;
138
139 printk(KERN_INFO "Generic non-volatile memory driver v%s\n",
140 NVRAM_VERSION);
141 ret = misc_register(&nvram_dev);
142 if (ret != 0)
143 goto out;
144
145 nvram_len = nvram_get_size();
146 if (nvram_len < 0)
147 nvram_len = NVRAM_SIZE;
148
149out:
150 return ret;
151}
152
153void __exit nvram_cleanup(void)
154{
155 misc_deregister( &nvram_dev );
156}
157
158module_init(nvram_init);
159module_exit(nvram_cleanup);
160MODULE_LICENSE("GPL");