aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/misc
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/misc')
-rw-r--r--drivers/misc/Kconfig12
-rw-r--r--drivers/misc/Makefile1
-rw-r--r--drivers/misc/atmel-ssc.c174
-rw-r--r--drivers/misc/hdpuftrs/hdpu_cpustate.c107
-rw-r--r--drivers/misc/hdpuftrs/hdpu_nexus.c88
-rw-r--r--drivers/misc/ibmasm/remote.c8
-rw-r--r--drivers/misc/msi-laptop.c2
-rw-r--r--drivers/misc/phantom.c97
-rw-r--r--drivers/misc/sony-laptop.c10
-rw-r--r--drivers/misc/thinkpad_acpi.c20
-rw-r--r--drivers/misc/thinkpad_acpi.h2
-rw-r--r--drivers/misc/tifm_core.c9
12 files changed, 411 insertions, 119 deletions
diff --git a/drivers/misc/Kconfig b/drivers/misc/Kconfig
index e0a1ff927a5b..cf02ddc3436f 100644
--- a/drivers/misc/Kconfig
+++ b/drivers/misc/Kconfig
@@ -220,4 +220,16 @@ config THINKPAD_ACPI_BAY
220 If you are not sure, say Y here. 220 If you are not sure, say Y here.
221 221
222 222
223config ATMEL_SSC
224 tristate "Device driver for Atmel SSC peripheral"
225 depends on AVR32 || ARCH_AT91
226 ---help---
227 This option enables device driver support for Atmel Syncronized
228 Serial Communication peripheral (SSC).
229
230 The SSC peripheral supports a wide variety of serial frame based
231 communications, i.e. I2S, SPI, etc.
232
233 If unsure, say N.
234
223endif # MISC_DEVICES 235endif # MISC_DEVICES
diff --git a/drivers/misc/Makefile b/drivers/misc/Makefile
index be90d483d2f9..87f2685d728f 100644
--- a/drivers/misc/Makefile
+++ b/drivers/misc/Makefile
@@ -7,6 +7,7 @@ obj-$(CONFIG_IBM_ASM) += ibmasm/
7obj-$(CONFIG_HDPU_FEATURES) += hdpuftrs/ 7obj-$(CONFIG_HDPU_FEATURES) += hdpuftrs/
8obj-$(CONFIG_MSI_LAPTOP) += msi-laptop.o 8obj-$(CONFIG_MSI_LAPTOP) += msi-laptop.o
9obj-$(CONFIG_ASUS_LAPTOP) += asus-laptop.o 9obj-$(CONFIG_ASUS_LAPTOP) += asus-laptop.o
10obj-$(CONFIG_ATMEL_SSC) += atmel-ssc.o
10obj-$(CONFIG_LKDTM) += lkdtm.o 11obj-$(CONFIG_LKDTM) += lkdtm.o
11obj-$(CONFIG_TIFM_CORE) += tifm_core.o 12obj-$(CONFIG_TIFM_CORE) += tifm_core.o
12obj-$(CONFIG_TIFM_7XX1) += tifm_7xx1.o 13obj-$(CONFIG_TIFM_7XX1) += tifm_7xx1.o
diff --git a/drivers/misc/atmel-ssc.c b/drivers/misc/atmel-ssc.c
new file mode 100644
index 000000000000..058ccac700d0
--- /dev/null
+++ b/drivers/misc/atmel-ssc.c
@@ -0,0 +1,174 @@
1/*
2 * Atmel SSC driver
3 *
4 * Copyright (C) 2007 Atmel Corporation
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 */
10
11#include <linux/platform_device.h>
12#include <linux/list.h>
13#include <linux/clk.h>
14#include <linux/err.h>
15#include <linux/io.h>
16#include <linux/list.h>
17#include <linux/spinlock.h>
18#include <linux/atmel-ssc.h>
19
20/* Serialize access to ssc_list and user count */
21static DEFINE_SPINLOCK(user_lock);
22static LIST_HEAD(ssc_list);
23
24struct ssc_device *ssc_request(unsigned int ssc_num)
25{
26 int ssc_valid = 0;
27 struct ssc_device *ssc;
28
29 spin_lock(&user_lock);
30 list_for_each_entry(ssc, &ssc_list, list) {
31 if (ssc->pdev->id == ssc_num) {
32 ssc_valid = 1;
33 break;
34 }
35 }
36
37 if (!ssc_valid) {
38 spin_unlock(&user_lock);
39 dev_dbg(&ssc->pdev->dev, "could not find requested device\n");
40 return ERR_PTR(-ENODEV);
41 }
42
43 if (ssc->user) {
44 spin_unlock(&user_lock);
45 dev_dbg(&ssc->pdev->dev, "module busy\n");
46 return ERR_PTR(-EBUSY);
47 }
48 ssc->user++;
49 spin_unlock(&user_lock);
50
51 clk_enable(ssc->clk);
52
53 return ssc;
54}
55EXPORT_SYMBOL(ssc_request);
56
57void ssc_free(struct ssc_device *ssc)
58{
59 spin_lock(&user_lock);
60 if (ssc->user) {
61 ssc->user--;
62 clk_disable(ssc->clk);
63 } else {
64 dev_dbg(&ssc->pdev->dev, "device already free\n");
65 }
66 spin_unlock(&user_lock);
67}
68EXPORT_SYMBOL(ssc_free);
69
70static int __init ssc_probe(struct platform_device *pdev)
71{
72 int retval = 0;
73 struct resource *regs;
74 struct ssc_device *ssc;
75
76 ssc = kzalloc(sizeof(struct ssc_device), GFP_KERNEL);
77 if (!ssc) {
78 dev_dbg(&pdev->dev, "out of memory\n");
79 retval = -ENOMEM;
80 goto out;
81 }
82
83 regs = platform_get_resource(pdev, IORESOURCE_MEM, 0);
84 if (!regs) {
85 dev_dbg(&pdev->dev, "no mmio resource defined\n");
86 retval = -ENXIO;
87 goto out_free;
88 }
89
90 ssc->clk = clk_get(&pdev->dev, "pclk");
91 if (IS_ERR(ssc->clk)) {
92 dev_dbg(&pdev->dev, "no pclk clock defined\n");
93 retval = -ENXIO;
94 goto out_free;
95 }
96
97 ssc->pdev = pdev;
98 ssc->regs = ioremap(regs->start, regs->end - regs->start + 1);
99 if (!ssc->regs) {
100 dev_dbg(&pdev->dev, "ioremap failed\n");
101 retval = -EINVAL;
102 goto out_clk;
103 }
104
105 /* disable all interrupts */
106 clk_enable(ssc->clk);
107 ssc_writel(ssc->regs, IDR, ~0UL);
108 ssc_readl(ssc->regs, SR);
109 clk_disable(ssc->clk);
110
111 ssc->irq = platform_get_irq(pdev, 0);
112 if (!ssc->irq) {
113 dev_dbg(&pdev->dev, "could not get irq\n");
114 retval = -ENXIO;
115 goto out_unmap;
116 }
117
118 spin_lock(&user_lock);
119 list_add_tail(&ssc->list, &ssc_list);
120 spin_unlock(&user_lock);
121
122 platform_set_drvdata(pdev, ssc);
123
124 dev_info(&pdev->dev, "Atmel SSC device at 0x%p (irq %d)\n",
125 ssc->regs, ssc->irq);
126
127 goto out;
128
129out_unmap:
130 iounmap(ssc->regs);
131out_clk:
132 clk_put(ssc->clk);
133out_free:
134 kfree(ssc);
135out:
136 return retval;
137}
138
139static int __devexit ssc_remove(struct platform_device *pdev)
140{
141 struct ssc_device *ssc = platform_get_drvdata(pdev);
142
143 spin_lock(&user_lock);
144 iounmap(ssc->regs);
145 clk_put(ssc->clk);
146 list_del(&ssc->list);
147 kfree(ssc);
148 spin_unlock(&user_lock);
149
150 return 0;
151}
152
153static struct platform_driver ssc_driver = {
154 .remove = __devexit_p(ssc_remove),
155 .driver = {
156 .name = "ssc",
157 },
158};
159
160static int __init ssc_init(void)
161{
162 return platform_driver_probe(&ssc_driver, ssc_probe);
163}
164module_init(ssc_init);
165
166static void __exit ssc_exit(void)
167{
168 platform_driver_unregister(&ssc_driver);
169}
170module_exit(ssc_exit);
171
172MODULE_AUTHOR("Hans-Christian Egtvedt <hcegtvedt@atmel.com>");
173MODULE_DESCRIPTION("SSC driver for Atmel AVR32 and AT91");
174MODULE_LICENSE("GPL");
diff --git a/drivers/misc/hdpuftrs/hdpu_cpustate.c b/drivers/misc/hdpuftrs/hdpu_cpustate.c
index 276ba3c5143f..aa8ce7abe922 100644
--- a/drivers/misc/hdpuftrs/hdpu_cpustate.c
+++ b/drivers/misc/hdpuftrs/hdpu_cpustate.c
@@ -19,16 +19,41 @@
19#include <linux/spinlock.h> 19#include <linux/spinlock.h>
20#include <linux/miscdevice.h> 20#include <linux/miscdevice.h>
21#include <linux/proc_fs.h> 21#include <linux/proc_fs.h>
22#include <linux/hdpu_features.h>
22#include <linux/platform_device.h> 23#include <linux/platform_device.h>
23#include <asm/uaccess.h> 24#include <asm/uaccess.h>
24#include <linux/hdpu_features.h> 25#include <linux/seq_file.h>
26#include <asm/io.h>
25 27
26#define SKY_CPUSTATE_VERSION "1.1" 28#define SKY_CPUSTATE_VERSION "1.1"
27 29
28static int hdpu_cpustate_probe(struct platform_device *pdev); 30static int hdpu_cpustate_probe(struct platform_device *pdev);
29static int hdpu_cpustate_remove(struct platform_device *pdev); 31static int hdpu_cpustate_remove(struct platform_device *pdev);
30 32
31struct cpustate_t cpustate; 33static unsigned char cpustate_get_state(void);
34static int cpustate_proc_open(struct inode *inode, struct file *file);
35static int cpustate_proc_read(struct seq_file *seq, void *offset);
36
37static struct cpustate_t cpustate;
38
39static const struct file_operations proc_cpustate = {
40 .open = cpustate_proc_open,
41 .read = seq_read,
42 .llseek = seq_lseek,
43 .release = single_release,
44 .owner = THIS_MODULE,
45};
46
47static int cpustate_proc_open(struct inode *inode, struct file *file)
48{
49 return single_open(file, cpustate_proc_read, NULL);
50}
51
52static int cpustate_proc_read(struct seq_file *seq, void *offset)
53{
54 seq_printf(seq, "CPU State: %04x\n", cpustate_get_state());
55 return 0;
56}
32 57
33static int cpustate_get_ref(int excl) 58static int cpustate_get_ref(int excl)
34{ 59{
@@ -66,13 +91,13 @@ static int cpustate_free_ref(void)
66 return 0; 91 return 0;
67} 92}
68 93
69unsigned char cpustate_get_state(void) 94static unsigned char cpustate_get_state(void)
70{ 95{
71 96
72 return cpustate.cached_val; 97 return cpustate.cached_val;
73} 98}
74 99
75void cpustate_set_state(unsigned char new_state) 100static void cpustate_set_state(unsigned char new_state)
76{ 101{
77 unsigned int state = (new_state << 21); 102 unsigned int state = (new_state << 21);
78 103
@@ -134,29 +159,6 @@ static int cpustate_release(struct inode *inode, struct file *file)
134 return cpustate_free_ref(); 159 return cpustate_free_ref();
135} 160}
136 161
137/*
138 * Info exported via "/proc/sky_cpustate".
139 */
140static int cpustate_read_proc(char *page, char **start, off_t off,
141 int count, int *eof, void *data)
142{
143 char *p = page;
144 int len = 0;
145
146 p += sprintf(p, "CPU State: %04x\n", cpustate_get_state());
147 len = p - page;
148
149 if (len <= off + count)
150 *eof = 1;
151 *start = page + off;
152 len -= off;
153 if (len > count)
154 len = count;
155 if (len < 0)
156 len = 0;
157 return len;
158}
159
160static struct platform_driver hdpu_cpustate_driver = { 162static struct platform_driver hdpu_cpustate_driver = {
161 .probe = hdpu_cpustate_probe, 163 .probe = hdpu_cpustate_probe,
162 .remove = hdpu_cpustate_remove, 164 .remove = hdpu_cpustate_remove,
@@ -169,22 +171,18 @@ static struct platform_driver hdpu_cpustate_driver = {
169 * The various file operations we support. 171 * The various file operations we support.
170 */ 172 */
171static const struct file_operations cpustate_fops = { 173static const struct file_operations cpustate_fops = {
172 owner:THIS_MODULE, 174 .owner = THIS_MODULE,
173 open:cpustate_open, 175 .open = cpustate_open,
174 release:cpustate_release, 176 .release = cpustate_release,
175 read:cpustate_read, 177 .read = cpustate_read,
176 write:cpustate_write, 178 .write = cpustate_write,
177 fasync:NULL, 179 .llseek = no_llseek,
178 poll:NULL,
179 ioctl:NULL,
180 llseek:no_llseek,
181
182}; 180};
183 181
184static struct miscdevice cpustate_dev = { 182static struct miscdevice cpustate_dev = {
185 MISC_DYNAMIC_MINOR, 183 .minor = MISC_DYNAMIC_MINOR,
186 "sky_cpustate", 184 .name = "sky_cpustate",
187 &cpustate_fops 185 .fops = &cpustate_fops,
188}; 186};
189 187
190static int hdpu_cpustate_probe(struct platform_device *pdev) 188static int hdpu_cpustate_probe(struct platform_device *pdev)
@@ -194,23 +192,31 @@ static int hdpu_cpustate_probe(struct platform_device *pdev)
194 int ret; 192 int ret;
195 193
196 res = platform_get_resource(pdev, IORESOURCE_MEM, 0); 194 res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
195 if (!res) {
196 printk(KERN_ERR "sky_cpustate: "
197 "Invalid memory resource.\n");
198 return -EINVAL;
199 }
197 cpustate.set_addr = (unsigned long *)res->start; 200 cpustate.set_addr = (unsigned long *)res->start;
198 cpustate.clr_addr = (unsigned long *)res->end - 1; 201 cpustate.clr_addr = (unsigned long *)res->end - 1;
199 202
200 ret = misc_register(&cpustate_dev); 203 ret = misc_register(&cpustate_dev);
201 if (ret) { 204 if (ret) {
202 printk(KERN_WARNING "sky_cpustate: Unable to register misc " 205 printk(KERN_WARNING "sky_cpustate: "
203 "device.\n"); 206 "Unable to register misc device.\n");
204 cpustate.set_addr = NULL; 207 cpustate.set_addr = NULL;
205 cpustate.clr_addr = NULL; 208 cpustate.clr_addr = NULL;
206 return ret; 209 return ret;
207 } 210 }
208 211
209 proc_de = create_proc_read_entry("sky_cpustate", 0, 0, 212 proc_de = create_proc_entry("sky_cpustate", 0666, &proc_root);
210 cpustate_read_proc, NULL); 213 if (!proc_de) {
211 if (proc_de == NULL) 214 printk(KERN_WARNING "sky_cpustate: "
212 printk(KERN_WARNING "sky_cpustate: Unable to create proc " 215 "Unable to create proc entry\n");
213 "dir entry\n"); 216 } else {
217 proc_de->proc_fops = &proc_cpustate;
218 proc_de->owner = THIS_MODULE;
219 }
214 220
215 printk(KERN_INFO "Sky CPU State Driver v" SKY_CPUSTATE_VERSION "\n"); 221 printk(KERN_INFO "Sky CPU State Driver v" SKY_CPUSTATE_VERSION "\n");
216 return 0; 222 return 0;
@@ -218,21 +224,18 @@ static int hdpu_cpustate_probe(struct platform_device *pdev)
218 224
219static int hdpu_cpustate_remove(struct platform_device *pdev) 225static int hdpu_cpustate_remove(struct platform_device *pdev)
220{ 226{
221
222 cpustate.set_addr = NULL; 227 cpustate.set_addr = NULL;
223 cpustate.clr_addr = NULL; 228 cpustate.clr_addr = NULL;
224 229
225 remove_proc_entry("sky_cpustate", NULL); 230 remove_proc_entry("sky_cpustate", NULL);
226 misc_deregister(&cpustate_dev); 231 misc_deregister(&cpustate_dev);
227 return 0;
228 232
233 return 0;
229} 234}
230 235
231static int __init cpustate_init(void) 236static int __init cpustate_init(void)
232{ 237{
233 int rc; 238 return platform_driver_register(&hdpu_cpustate_driver);
234 rc = platform_driver_register(&hdpu_cpustate_driver);
235 return rc;
236} 239}
237 240
238static void __exit cpustate_exit(void) 241static void __exit cpustate_exit(void)
diff --git a/drivers/misc/hdpuftrs/hdpu_nexus.c b/drivers/misc/hdpuftrs/hdpu_nexus.c
index 60c8b26f0678..2887b2147980 100644
--- a/drivers/misc/hdpuftrs/hdpu_nexus.c
+++ b/drivers/misc/hdpuftrs/hdpu_nexus.c
@@ -18,17 +18,38 @@
18#include <linux/kernel.h> 18#include <linux/kernel.h>
19#include <linux/proc_fs.h> 19#include <linux/proc_fs.h>
20#include <linux/hdpu_features.h> 20#include <linux/hdpu_features.h>
21
22#include <linux/platform_device.h> 21#include <linux/platform_device.h>
22#include <linux/seq_file.h>
23#include <asm/io.h>
23 24
24static int hdpu_nexus_probe(struct platform_device *pdev); 25static int hdpu_nexus_probe(struct platform_device *pdev);
25static int hdpu_nexus_remove(struct platform_device *pdev); 26static int hdpu_nexus_remove(struct platform_device *pdev);
27static int hdpu_slot_id_open(struct inode *inode, struct file *file);
28static int hdpu_slot_id_read(struct seq_file *seq, void *offset);
29static int hdpu_chassis_id_open(struct inode *inode, struct file *file);
30static int hdpu_chassis_id_read(struct seq_file *seq, void *offset);
26 31
27static struct proc_dir_entry *hdpu_slot_id; 32static struct proc_dir_entry *hdpu_slot_id;
28static struct proc_dir_entry *hdpu_chassis_id; 33static struct proc_dir_entry *hdpu_chassis_id;
29static int slot_id = -1; 34static int slot_id = -1;
30static int chassis_id = -1; 35static int chassis_id = -1;
31 36
37static const struct file_operations proc_slot_id = {
38 .open = hdpu_slot_id_open,
39 .read = seq_read,
40 .llseek = seq_lseek,
41 .release = single_release,
42 .owner = THIS_MODULE,
43};
44
45static const struct file_operations proc_chassis_id = {
46 .open = hdpu_chassis_id_open,
47 .read = seq_read,
48 .llseek = seq_lseek,
49 .release = single_release,
50 .owner = THIS_MODULE,
51};
52
32static struct platform_driver hdpu_nexus_driver = { 53static struct platform_driver hdpu_nexus_driver = {
33 .probe = hdpu_nexus_probe, 54 .probe = hdpu_nexus_probe,
34 .remove = hdpu_nexus_remove, 55 .remove = hdpu_nexus_remove,
@@ -37,43 +58,67 @@ static struct platform_driver hdpu_nexus_driver = {
37 }, 58 },
38}; 59};
39 60
40int hdpu_slot_id_read(char *buffer, char **buffer_location, off_t offset, 61static int hdpu_slot_id_open(struct inode *inode, struct file *file)
41 int buffer_length, int *zero, void *ptr)
42{ 62{
63 return single_open(file, hdpu_slot_id_read, NULL);
64}
43 65
44 if (offset > 0) 66static int hdpu_slot_id_read(struct seq_file *seq, void *offset)
45 return 0; 67{
46 return sprintf(buffer, "%d\n", slot_id); 68 seq_printf(seq, "%d\n", slot_id);
69 return 0;
47} 70}
48 71
49int hdpu_chassis_id_read(char *buffer, char **buffer_location, off_t offset, 72static int hdpu_chassis_id_open(struct inode *inode, struct file *file)
50 int buffer_length, int *zero, void *ptr)
51{ 73{
74 return single_open(file, hdpu_chassis_id_read, NULL);
75}
52 76
53 if (offset > 0) 77static int hdpu_chassis_id_read(struct seq_file *seq, void *offset)
54 return 0; 78{
55 return sprintf(buffer, "%d\n", chassis_id); 79 seq_printf(seq, "%d\n", chassis_id);
80 return 0;
56} 81}
57 82
58static int hdpu_nexus_probe(struct platform_device *pdev) 83static int hdpu_nexus_probe(struct platform_device *pdev)
59{ 84{
60 struct resource *res; 85 struct resource *res;
86 int *nexus_id_addr;
61 87
62 res = platform_get_resource(pdev, IORESOURCE_MEM, 0); 88 res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
63 int *nexus_id_addr; 89 if (!res) {
64 nexus_id_addr = 90 printk(KERN_ERR "sky_nexus: "
65 ioremap(res->start, (unsigned long)(res->end - res->start)); 91 "Invalid memory resource.\n");
92 return -EINVAL;
93 }
94 nexus_id_addr = ioremap(res->start,
95 (unsigned long)(res->end - res->start));
66 if (nexus_id_addr) { 96 if (nexus_id_addr) {
67 slot_id = (*nexus_id_addr >> 8) & 0x1f; 97 slot_id = (*nexus_id_addr >> 8) & 0x1f;
68 chassis_id = *nexus_id_addr & 0xff; 98 chassis_id = *nexus_id_addr & 0xff;
69 iounmap(nexus_id_addr); 99 iounmap(nexus_id_addr);
70 } else 100 } else {
71 printk("Could not map slot id\n"); 101 printk(KERN_ERR "sky_nexus: Could not map slot id\n");
102 }
103
72 hdpu_slot_id = create_proc_entry("sky_slot_id", 0666, &proc_root); 104 hdpu_slot_id = create_proc_entry("sky_slot_id", 0666, &proc_root);
73 hdpu_slot_id->read_proc = hdpu_slot_id_read; 105 if (!hdpu_slot_id) {
106 printk(KERN_WARNING "sky_nexus: "
107 "Unable to create proc dir entry: sky_slot_id\n");
108 } else {
109 hdpu_slot_id->proc_fops = &proc_slot_id;
110 hdpu_slot_id->owner = THIS_MODULE;
111 }
74 112
75 hdpu_chassis_id = create_proc_entry("sky_chassis_id", 0666, &proc_root); 113 hdpu_chassis_id = create_proc_entry("sky_chassis_id", 0666, &proc_root);
76 hdpu_chassis_id->read_proc = hdpu_chassis_id_read; 114 if (!hdpu_chassis_id) {
115 printk(KERN_WARNING "sky_nexus: "
116 "Unable to create proc dir entry: sky_chassis_id\n");
117 } else {
118 hdpu_chassis_id->proc_fops = &proc_chassis_id;
119 hdpu_chassis_id->owner = THIS_MODULE;
120 }
121
77 return 0; 122 return 0;
78} 123}
79 124
@@ -81,18 +126,19 @@ static int hdpu_nexus_remove(struct platform_device *pdev)
81{ 126{
82 slot_id = -1; 127 slot_id = -1;
83 chassis_id = -1; 128 chassis_id = -1;
129
84 remove_proc_entry("sky_slot_id", &proc_root); 130 remove_proc_entry("sky_slot_id", &proc_root);
85 remove_proc_entry("sky_chassis_id", &proc_root); 131 remove_proc_entry("sky_chassis_id", &proc_root);
132
86 hdpu_slot_id = 0; 133 hdpu_slot_id = 0;
87 hdpu_chassis_id = 0; 134 hdpu_chassis_id = 0;
135
88 return 0; 136 return 0;
89} 137}
90 138
91static int __init nexus_init(void) 139static int __init nexus_init(void)
92{ 140{
93 int rc; 141 return platform_driver_register(&hdpu_nexus_driver);
94 rc = platform_driver_register(&hdpu_nexus_driver);
95 return rc;
96} 142}
97 143
98static void __exit nexus_exit(void) 144static void __exit nexus_exit(void)
diff --git a/drivers/misc/ibmasm/remote.c b/drivers/misc/ibmasm/remote.c
index 0550ce075fc4..1d9defb1a10c 100644
--- a/drivers/misc/ibmasm/remote.c
+++ b/drivers/misc/ibmasm/remote.c
@@ -226,9 +226,9 @@ int ibmasm_init_remote_input_dev(struct service_processor *sp)
226 mouse_dev->id.product = pdev->device; 226 mouse_dev->id.product = pdev->device;
227 mouse_dev->id.version = 1; 227 mouse_dev->id.version = 1;
228 mouse_dev->dev.parent = sp->dev; 228 mouse_dev->dev.parent = sp->dev;
229 mouse_dev->evbit[0] = BIT(EV_KEY) | BIT(EV_ABS); 229 mouse_dev->evbit[0] = BIT_MASK(EV_KEY) | BIT_MASK(EV_ABS);
230 mouse_dev->keybit[LONG(BTN_MOUSE)] = BIT(BTN_LEFT) | 230 mouse_dev->keybit[BIT_WORD(BTN_MOUSE)] = BIT_MASK(BTN_LEFT) |
231 BIT(BTN_RIGHT) | BIT(BTN_MIDDLE); 231 BIT_MASK(BTN_RIGHT) | BIT_MASK(BTN_MIDDLE);
232 set_bit(BTN_TOUCH, mouse_dev->keybit); 232 set_bit(BTN_TOUCH, mouse_dev->keybit);
233 mouse_dev->name = "ibmasm RSA I remote mouse"; 233 mouse_dev->name = "ibmasm RSA I remote mouse";
234 input_set_abs_params(mouse_dev, ABS_X, 0, MOUSE_X_MAX, 0, 0); 234 input_set_abs_params(mouse_dev, ABS_X, 0, MOUSE_X_MAX, 0, 0);
@@ -239,7 +239,7 @@ int ibmasm_init_remote_input_dev(struct service_processor *sp)
239 keybd_dev->id.product = pdev->device; 239 keybd_dev->id.product = pdev->device;
240 keybd_dev->id.version = 2; 240 keybd_dev->id.version = 2;
241 keybd_dev->dev.parent = sp->dev; 241 keybd_dev->dev.parent = sp->dev;
242 keybd_dev->evbit[0] = BIT(EV_KEY); 242 keybd_dev->evbit[0] = BIT_MASK(EV_KEY);
243 keybd_dev->name = "ibmasm RSA I remote keyboard"; 243 keybd_dev->name = "ibmasm RSA I remote keyboard";
244 244
245 for (i = 0; i < XLATE_SIZE; i++) { 245 for (i = 0; i < XLATE_SIZE; i++) {
diff --git a/drivers/misc/msi-laptop.c b/drivers/misc/msi-laptop.c
index 349be934db7c..83679c762925 100644
--- a/drivers/misc/msi-laptop.c
+++ b/drivers/misc/msi-laptop.c
@@ -283,7 +283,7 @@ static struct platform_device *msipf_device;
283 283
284/* Initialization */ 284/* Initialization */
285 285
286static int dmi_check_cb(struct dmi_system_id *id) 286static int dmi_check_cb(const struct dmi_system_id *id)
287{ 287{
288 printk("msi-laptop: Identified laptop model '%s'.\n", id->ident); 288 printk("msi-laptop: Identified laptop model '%s'.\n", id->ident);
289 return 0; 289 return 0;
diff --git a/drivers/misc/phantom.c b/drivers/misc/phantom.c
index 5108b7c576df..cd221fd0fb94 100644
--- a/drivers/misc/phantom.c
+++ b/drivers/misc/phantom.c
@@ -9,6 +9,7 @@
9 * You need an userspace library to cooperate with this driver. It (and other 9 * You need an userspace library to cooperate with this driver. It (and other
10 * info) may be obtained here: 10 * info) may be obtained here:
11 * http://www.fi.muni.cz/~xslaby/phantom.html 11 * http://www.fi.muni.cz/~xslaby/phantom.html
12 * or alternatively, you might use OpenHaptics provided by Sensable.
12 */ 13 */
13 14
14#include <linux/kernel.h> 15#include <linux/kernel.h>
@@ -24,13 +25,14 @@
24#include <asm/atomic.h> 25#include <asm/atomic.h>
25#include <asm/io.h> 26#include <asm/io.h>
26 27
27#define PHANTOM_VERSION "n0.9.5" 28#define PHANTOM_VERSION "n0.9.7"
28 29
29#define PHANTOM_MAX_MINORS 8 30#define PHANTOM_MAX_MINORS 8
30 31
31#define PHN_IRQCTL 0x4c /* irq control in caddr space */ 32#define PHN_IRQCTL 0x4c /* irq control in caddr space */
32 33
33#define PHB_RUNNING 1 34#define PHB_RUNNING 1
35#define PHB_NOT_OH 2
34 36
35static struct class *phantom_class; 37static struct class *phantom_class;
36static int phantom_major; 38static int phantom_major;
@@ -47,7 +49,11 @@ struct phantom_device {
47 struct cdev cdev; 49 struct cdev cdev;
48 50
49 struct mutex open_lock; 51 struct mutex open_lock;
50 spinlock_t ioctl_lock; 52 spinlock_t regs_lock;
53
54 /* used in NOT_OH mode */
55 struct phm_regs oregs;
56 u32 ctl_reg;
51}; 57};
52 58
53static unsigned char phantom_devices[PHANTOM_MAX_MINORS]; 59static unsigned char phantom_devices[PHANTOM_MAX_MINORS];
@@ -82,6 +88,7 @@ static long phantom_ioctl(struct file *file, unsigned int cmd,
82 struct phm_regs rs; 88 struct phm_regs rs;
83 struct phm_reg r; 89 struct phm_reg r;
84 void __user *argp = (void __user *)arg; 90 void __user *argp = (void __user *)arg;
91 unsigned long flags;
85 unsigned int i; 92 unsigned int i;
86 93
87 if (_IOC_TYPE(cmd) != PH_IOC_MAGIC || 94 if (_IOC_TYPE(cmd) != PH_IOC_MAGIC ||
@@ -96,32 +103,45 @@ static long phantom_ioctl(struct file *file, unsigned int cmd,
96 if (r.reg > 7) 103 if (r.reg > 7)
97 return -EINVAL; 104 return -EINVAL;
98 105
99 spin_lock(&dev->ioctl_lock); 106 spin_lock_irqsave(&dev->regs_lock, flags);
100 if (r.reg == PHN_CONTROL && (r.value & PHN_CTL_IRQ) && 107 if (r.reg == PHN_CONTROL && (r.value & PHN_CTL_IRQ) &&
101 phantom_status(dev, dev->status | PHB_RUNNING)){ 108 phantom_status(dev, dev->status | PHB_RUNNING)){
102 spin_unlock(&dev->ioctl_lock); 109 spin_unlock_irqrestore(&dev->regs_lock, flags);
103 return -ENODEV; 110 return -ENODEV;
104 } 111 }
105 112
106 pr_debug("phantom: writing %x to %u\n", r.value, r.reg); 113 pr_debug("phantom: writing %x to %u\n", r.value, r.reg);
114
115 /* preserve amp bit (don't allow to change it when in NOT_OH) */
116 if (r.reg == PHN_CONTROL && (dev->status & PHB_NOT_OH)) {
117 r.value &= ~PHN_CTL_AMP;
118 r.value |= dev->ctl_reg & PHN_CTL_AMP;
119 dev->ctl_reg = r.value;
120 }
121
107 iowrite32(r.value, dev->iaddr + r.reg); 122 iowrite32(r.value, dev->iaddr + r.reg);
108 ioread32(dev->iaddr); /* PCI posting */ 123 ioread32(dev->iaddr); /* PCI posting */
109 124
110 if (r.reg == PHN_CONTROL && !(r.value & PHN_CTL_IRQ)) 125 if (r.reg == PHN_CONTROL && !(r.value & PHN_CTL_IRQ))
111 phantom_status(dev, dev->status & ~PHB_RUNNING); 126 phantom_status(dev, dev->status & ~PHB_RUNNING);
112 spin_unlock(&dev->ioctl_lock); 127 spin_unlock_irqrestore(&dev->regs_lock, flags);
113 break; 128 break;
114 case PHN_SET_REGS: 129 case PHN_SET_REGS:
115 if (copy_from_user(&rs, argp, sizeof(rs))) 130 if (copy_from_user(&rs, argp, sizeof(rs)))
116 return -EFAULT; 131 return -EFAULT;
117 132
118 pr_debug("phantom: SRS %u regs %x\n", rs.count, rs.mask); 133 pr_debug("phantom: SRS %u regs %x\n", rs.count, rs.mask);
119 spin_lock(&dev->ioctl_lock); 134 spin_lock_irqsave(&dev->regs_lock, flags);
120 for (i = 0; i < min(rs.count, 8U); i++) 135 if (dev->status & PHB_NOT_OH)
121 if ((1 << i) & rs.mask) 136 memcpy(&dev->oregs, &rs, sizeof(rs));
122 iowrite32(rs.values[i], dev->oaddr + i); 137 else {
123 ioread32(dev->iaddr); /* PCI posting */ 138 u32 m = min(rs.count, 8U);
124 spin_unlock(&dev->ioctl_lock); 139 for (i = 0; i < m; i++)
140 if (rs.mask & BIT(i))
141 iowrite32(rs.values[i], dev->oaddr + i);
142 ioread32(dev->iaddr); /* PCI posting */
143 }
144 spin_unlock_irqrestore(&dev->regs_lock, flags);
125 break; 145 break;
126 case PHN_GET_REG: 146 case PHN_GET_REG:
127 if (copy_from_user(&r, argp, sizeof(r))) 147 if (copy_from_user(&r, argp, sizeof(r)))
@@ -135,20 +155,35 @@ static long phantom_ioctl(struct file *file, unsigned int cmd,
135 if (copy_to_user(argp, &r, sizeof(r))) 155 if (copy_to_user(argp, &r, sizeof(r)))
136 return -EFAULT; 156 return -EFAULT;
137 break; 157 break;
138 case PHN_GET_REGS: 158 case PHN_GET_REGS: {
159 u32 m;
160
139 if (copy_from_user(&rs, argp, sizeof(rs))) 161 if (copy_from_user(&rs, argp, sizeof(rs)))
140 return -EFAULT; 162 return -EFAULT;
141 163
164 m = min(rs.count, 8U);
165
142 pr_debug("phantom: GRS %u regs %x\n", rs.count, rs.mask); 166 pr_debug("phantom: GRS %u regs %x\n", rs.count, rs.mask);
143 spin_lock(&dev->ioctl_lock); 167 spin_lock_irqsave(&dev->regs_lock, flags);
144 for (i = 0; i < min(rs.count, 8U); i++) 168 for (i = 0; i < m; i++)
145 if ((1 << i) & rs.mask) 169 if (rs.mask & BIT(i))
146 rs.values[i] = ioread32(dev->iaddr + i); 170 rs.values[i] = ioread32(dev->iaddr + i);
147 spin_unlock(&dev->ioctl_lock); 171 spin_unlock_irqrestore(&dev->regs_lock, flags);
148 172
149 if (copy_to_user(argp, &rs, sizeof(rs))) 173 if (copy_to_user(argp, &rs, sizeof(rs)))
150 return -EFAULT; 174 return -EFAULT;
151 break; 175 break;
176 } case PHN_NOT_OH:
177 spin_lock_irqsave(&dev->regs_lock, flags);
178 if (dev->status & PHB_RUNNING) {
179 printk(KERN_ERR "phantom: you need to set NOT_OH "
180 "before you start the device!\n");
181 spin_unlock_irqrestore(&dev->regs_lock, flags);
182 return -EINVAL;
183 }
184 dev->status |= PHB_NOT_OH;
185 spin_unlock_irqrestore(&dev->regs_lock, flags);
186 break;
152 default: 187 default:
153 return -ENOTTY; 188 return -ENOTTY;
154 } 189 }
@@ -171,8 +206,11 @@ static int phantom_open(struct inode *inode, struct file *file)
171 return -EINVAL; 206 return -EINVAL;
172 } 207 }
173 208
209 WARN_ON(dev->status & PHB_NOT_OH);
210
174 file->private_data = dev; 211 file->private_data = dev;
175 212
213 atomic_set(&dev->counter, 0);
176 dev->opened++; 214 dev->opened++;
177 mutex_unlock(&dev->open_lock); 215 mutex_unlock(&dev->open_lock);
178 216
@@ -187,6 +225,7 @@ static int phantom_release(struct inode *inode, struct file *file)
187 225
188 dev->opened = 0; 226 dev->opened = 0;
189 phantom_status(dev, dev->status & ~PHB_RUNNING); 227 phantom_status(dev, dev->status & ~PHB_RUNNING);
228 dev->status &= ~PHB_NOT_OH;
190 229
191 mutex_unlock(&dev->open_lock); 230 mutex_unlock(&dev->open_lock);
192 231
@@ -220,12 +259,32 @@ static struct file_operations phantom_file_ops = {
220static irqreturn_t phantom_isr(int irq, void *data) 259static irqreturn_t phantom_isr(int irq, void *data)
221{ 260{
222 struct phantom_device *dev = data; 261 struct phantom_device *dev = data;
262 unsigned int i;
263 u32 ctl;
223 264
224 if (!(ioread32(dev->iaddr + PHN_CONTROL) & PHN_CTL_IRQ)) 265 spin_lock(&dev->regs_lock);
266 ctl = ioread32(dev->iaddr + PHN_CONTROL);
267 if (!(ctl & PHN_CTL_IRQ)) {
268 spin_unlock(&dev->regs_lock);
225 return IRQ_NONE; 269 return IRQ_NONE;
270 }
226 271
227 iowrite32(0, dev->iaddr); 272 iowrite32(0, dev->iaddr);
228 iowrite32(0xc0, dev->iaddr); 273 iowrite32(0xc0, dev->iaddr);
274
275 if (dev->status & PHB_NOT_OH) {
276 struct phm_regs *r = &dev->oregs;
277 u32 m = min(r->count, 8U);
278
279 for (i = 0; i < m; i++)
280 if (r->mask & BIT(i))
281 iowrite32(r->values[i], dev->oaddr + i);
282
283 dev->ctl_reg ^= PHN_CTL_AMP;
284 iowrite32(dev->ctl_reg, dev->iaddr + PHN_CONTROL);
285 }
286 spin_unlock(&dev->regs_lock);
287
229 ioread32(dev->iaddr); /* PCI posting */ 288 ioread32(dev->iaddr); /* PCI posting */
230 289
231 atomic_inc(&dev->counter); 290 atomic_inc(&dev->counter);
@@ -297,7 +356,7 @@ static int __devinit phantom_probe(struct pci_dev *pdev,
297 } 356 }
298 357
299 mutex_init(&pht->open_lock); 358 mutex_init(&pht->open_lock);
300 spin_lock_init(&pht->ioctl_lock); 359 spin_lock_init(&pht->regs_lock);
301 init_waitqueue_head(&pht->wait); 360 init_waitqueue_head(&pht->wait);
302 cdev_init(&pht->cdev, &phantom_file_ops); 361 cdev_init(&pht->cdev, &phantom_file_ops);
303 pht->cdev.owner = THIS_MODULE; 362 pht->cdev.owner = THIS_MODULE;
@@ -378,6 +437,8 @@ static int phantom_suspend(struct pci_dev *pdev, pm_message_t state)
378 iowrite32(0, dev->caddr + PHN_IRQCTL); 437 iowrite32(0, dev->caddr + PHN_IRQCTL);
379 ioread32(dev->caddr + PHN_IRQCTL); /* PCI posting */ 438 ioread32(dev->caddr + PHN_IRQCTL); /* PCI posting */
380 439
440 synchronize_irq(pdev->irq);
441
381 return 0; 442 return 0;
382} 443}
383 444
diff --git a/drivers/misc/sony-laptop.c b/drivers/misc/sony-laptop.c
index f248080828f2..1bfbb87e5793 100644
--- a/drivers/misc/sony-laptop.c
+++ b/drivers/misc/sony-laptop.c
@@ -411,9 +411,9 @@ static int sony_laptop_setup_input(void)
411 jog_dev->id.bustype = BUS_ISA; 411 jog_dev->id.bustype = BUS_ISA;
412 jog_dev->id.vendor = PCI_VENDOR_ID_SONY; 412 jog_dev->id.vendor = PCI_VENDOR_ID_SONY;
413 413
414 jog_dev->evbit[0] = BIT(EV_KEY) | BIT(EV_REL); 414 jog_dev->evbit[0] = BIT_MASK(EV_KEY) | BIT_MASK(EV_REL);
415 jog_dev->keybit[LONG(BTN_MOUSE)] = BIT(BTN_MIDDLE); 415 jog_dev->keybit[BIT_WORD(BTN_MOUSE)] = BIT_MASK(BTN_MIDDLE);
416 jog_dev->relbit[0] = BIT(REL_WHEEL); 416 jog_dev->relbit[0] = BIT_MASK(REL_WHEEL);
417 417
418 error = input_register_device(jog_dev); 418 error = input_register_device(jog_dev);
419 if (error) 419 if (error)
@@ -807,7 +807,7 @@ static struct sony_nc_event *sony_nc_events;
807/* Vaio C* --maybe also FE*, N* and AR* ?-- special init sequence 807/* Vaio C* --maybe also FE*, N* and AR* ?-- special init sequence
808 * for Fn keys 808 * for Fn keys
809 */ 809 */
810static int sony_nc_C_enable(struct dmi_system_id *id) 810static int sony_nc_C_enable(const struct dmi_system_id *id)
811{ 811{
812 int result = 0; 812 int result = 0;
813 813
@@ -845,7 +845,7 @@ static struct sony_nc_event sony_C_events[] = {
845}; 845};
846 846
847/* SNC-only model map */ 847/* SNC-only model map */
848static struct dmi_system_id sony_nc_ids[] = { 848static const struct dmi_system_id sony_nc_ids[] = {
849 { 849 {
850 .ident = "Sony Vaio FE Series", 850 .ident = "Sony Vaio FE Series",
851 .callback = sony_nc_C_enable, 851 .callback = sony_nc_C_enable,
diff --git a/drivers/misc/thinkpad_acpi.c b/drivers/misc/thinkpad_acpi.c
index 37891a8c030a..e953276664a0 100644
--- a/drivers/misc/thinkpad_acpi.c
+++ b/drivers/misc/thinkpad_acpi.c
@@ -527,7 +527,7 @@ static char *next_cmd(char **cmds)
527 527
528static struct platform_device *tpacpi_pdev; 528static struct platform_device *tpacpi_pdev;
529static struct platform_device *tpacpi_sensors_pdev; 529static struct platform_device *tpacpi_sensors_pdev;
530static struct class_device *tpacpi_hwmon; 530static struct device *tpacpi_hwmon;
531static struct input_dev *tpacpi_inputdev; 531static struct input_dev *tpacpi_inputdev;
532static struct mutex tpacpi_inputdev_send_mutex; 532static struct mutex tpacpi_inputdev_send_mutex;
533 533
@@ -964,15 +964,15 @@ static int __init hotkey_init(struct ibm_init_struct *iibm)
964 KEY_UNKNOWN, /* 0x0C: FN+BACKSPACE */ 964 KEY_UNKNOWN, /* 0x0C: FN+BACKSPACE */
965 KEY_UNKNOWN, /* 0x0D: FN+INSERT */ 965 KEY_UNKNOWN, /* 0x0D: FN+INSERT */
966 KEY_UNKNOWN, /* 0x0E: FN+DELETE */ 966 KEY_UNKNOWN, /* 0x0E: FN+DELETE */
967 KEY_RESERVED, /* 0x0F: FN+HOME (brightness up) */ 967 KEY_BRIGHTNESSUP, /* 0x0F: FN+HOME (brightness up) */
968 /* Scan codes 0x10 to 0x1F: Extended ACPI HKEY hot keys */ 968 /* Scan codes 0x10 to 0x1F: Extended ACPI HKEY hot keys */
969 KEY_RESERVED, /* 0x10: FN+END (brightness down) */ 969 KEY_BRIGHTNESSDOWN, /* 0x10: FN+END (brightness down) */
970 KEY_RESERVED, /* 0x11: FN+PGUP (thinklight toggle) */ 970 KEY_RESERVED, /* 0x11: FN+PGUP (thinklight toggle) */
971 KEY_UNKNOWN, /* 0x12: FN+PGDOWN */ 971 KEY_UNKNOWN, /* 0x12: FN+PGDOWN */
972 KEY_ZOOM, /* 0x13: FN+SPACE (zoom) */ 972 KEY_ZOOM, /* 0x13: FN+SPACE (zoom) */
973 KEY_RESERVED, /* 0x14: VOLUME UP */ 973 KEY_VOLUMEUP, /* 0x14: VOLUME UP */
974 KEY_RESERVED, /* 0x15: VOLUME DOWN */ 974 KEY_VOLUMEDOWN, /* 0x15: VOLUME DOWN */
975 KEY_RESERVED, /* 0x16: MUTE */ 975 KEY_MUTE, /* 0x16: MUTE */
976 KEY_VENDOR, /* 0x17: Thinkpad/AccessIBM/Lenovo */ 976 KEY_VENDOR, /* 0x17: Thinkpad/AccessIBM/Lenovo */
977 /* (assignments unknown, please report if found) */ 977 /* (assignments unknown, please report if found) */
978 KEY_UNKNOWN, KEY_UNKNOWN, KEY_UNKNOWN, KEY_UNKNOWN, 978 KEY_UNKNOWN, KEY_UNKNOWN, KEY_UNKNOWN, KEY_UNKNOWN,
@@ -993,9 +993,9 @@ static int __init hotkey_init(struct ibm_init_struct *iibm)
993 KEY_RESERVED, /* 0x11: FN+PGUP (thinklight toggle) */ 993 KEY_RESERVED, /* 0x11: FN+PGUP (thinklight toggle) */
994 KEY_UNKNOWN, /* 0x12: FN+PGDOWN */ 994 KEY_UNKNOWN, /* 0x12: FN+PGDOWN */
995 KEY_ZOOM, /* 0x13: FN+SPACE (zoom) */ 995 KEY_ZOOM, /* 0x13: FN+SPACE (zoom) */
996 KEY_RESERVED, /* 0x14: VOLUME UP */ 996 KEY_VOLUMEUP, /* 0x14: VOLUME UP */
997 KEY_RESERVED, /* 0x15: VOLUME DOWN */ 997 KEY_VOLUMEDOWN, /* 0x15: VOLUME DOWN */
998 KEY_RESERVED, /* 0x16: MUTE */ 998 KEY_MUTE, /* 0x16: MUTE */
999 KEY_VENDOR, /* 0x17: Thinkpad/AccessIBM/Lenovo */ 999 KEY_VENDOR, /* 0x17: Thinkpad/AccessIBM/Lenovo */
1000 /* (assignments unknown, please report if found) */ 1000 /* (assignments unknown, please report if found) */
1001 KEY_UNKNOWN, KEY_UNKNOWN, KEY_UNKNOWN, KEY_UNKNOWN, 1001 KEY_UNKNOWN, KEY_UNKNOWN, KEY_UNKNOWN, KEY_UNKNOWN,
@@ -4534,7 +4534,7 @@ static void ibm_exit(struct ibm_struct *ibm)
4534 4534
4535static void __init get_thinkpad_model_data(struct thinkpad_id_data *tp) 4535static void __init get_thinkpad_model_data(struct thinkpad_id_data *tp)
4536{ 4536{
4537 struct dmi_device *dev = NULL; 4537 const struct dmi_device *dev = NULL;
4538 char ec_fw_string[18]; 4538 char ec_fw_string[18];
4539 4539
4540 if (!tp) 4540 if (!tp)
diff --git a/drivers/misc/thinkpad_acpi.h b/drivers/misc/thinkpad_acpi.h
index c5fdd688cc99..3abcc8120634 100644
--- a/drivers/misc/thinkpad_acpi.h
+++ b/drivers/misc/thinkpad_acpi.h
@@ -173,7 +173,7 @@ static int parse_strtoul(const char *buf, unsigned long max,
173/* Device model */ 173/* Device model */
174static struct platform_device *tpacpi_pdev; 174static struct platform_device *tpacpi_pdev;
175static struct platform_device *tpacpi_sensors_pdev; 175static struct platform_device *tpacpi_sensors_pdev;
176static struct class_device *tpacpi_hwmon; 176static struct device *tpacpi_hwmon;
177static struct platform_driver tpacpi_pdriver; 177static struct platform_driver tpacpi_pdriver;
178static struct input_dev *tpacpi_inputdev; 178static struct input_dev *tpacpi_inputdev;
179static int tpacpi_create_driver_attributes(struct device_driver *drv); 179static int tpacpi_create_driver_attributes(struct device_driver *drv);
diff --git a/drivers/misc/tifm_core.c b/drivers/misc/tifm_core.c
index d195fb088f4a..8f77949f93dd 100644
--- a/drivers/misc/tifm_core.c
+++ b/drivers/misc/tifm_core.c
@@ -57,16 +57,11 @@ static int tifm_bus_match(struct device *dev, struct device_driver *drv)
57 return 0; 57 return 0;
58} 58}
59 59
60static int tifm_uevent(struct device *dev, char **envp, int num_envp, 60static int tifm_uevent(struct device *dev, struct kobj_uevent_env *env)
61 char *buffer, int buffer_size)
62{ 61{
63 struct tifm_dev *sock = container_of(dev, struct tifm_dev, dev); 62 struct tifm_dev *sock = container_of(dev, struct tifm_dev, dev);
64 int i = 0;
65 int length = 0;
66 63
67 if (add_uevent_var(envp, num_envp, &i, buffer, buffer_size, &length, 64 if (add_uevent_var(env, "TIFM_CARD_TYPE=%s", tifm_media_type_name(sock->type, 1)))
68 "TIFM_CARD_TYPE=%s",
69 tifm_media_type_name(sock->type, 1)))
70 return -ENOMEM; 65 return -ENOMEM;
71 66
72 return 0; 67 return 0;