diff options
author | Pavel Machek <pavel@ucw.cz> | 2009-03-31 18:24:26 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2009-04-01 11:59:21 -0400 |
commit | be84cfc588b19f14764d78556dc7b630ee8c914c (patch) | |
tree | eb9e812f10199e8a8bddf8dd8f9dfa2f02b04e62 /drivers/hwmon | |
parent | 2b872903c5d66bccdf4306a35e3e94d4da8555d3 (diff) |
hp_accel: adev is poor name of exported symbol
As Andrew noted, adev is pretty poor name for symbol being exported.
Rename it to lis3.
Signed-off-by: Pavel Machek <pavel@ucw.cz>
Cc: Eric Piel <eric.piel@tremplin-utc.net>
Cc: Vladimir Botka <vbotka@suse.cz>
Cc: <Quoc.Pham@hp.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers/hwmon')
-rw-r--r-- | drivers/hwmon/hp_accel.c | 48 | ||||
-rw-r--r-- | drivers/hwmon/lis3lv02d.c | 172 | ||||
-rw-r--r-- | drivers/hwmon/lis3lv02d.h | 2 |
3 files changed, 116 insertions, 106 deletions
diff --git a/drivers/hwmon/hp_accel.c b/drivers/hwmon/hp_accel.c index 29c83b5b9697..ee1ed4270df7 100644 --- a/drivers/hwmon/hp_accel.c +++ b/drivers/hwmon/hp_accel.c | |||
@@ -140,7 +140,7 @@ acpi_status lis3lv02d_acpi_write(acpi_handle handle, int reg, u8 val) | |||
140 | 140 | ||
141 | static int lis3lv02d_dmi_matched(const struct dmi_system_id *dmi) | 141 | static int lis3lv02d_dmi_matched(const struct dmi_system_id *dmi) |
142 | { | 142 | { |
143 | adev.ac = *((struct axis_conversion *)dmi->driver_data); | 143 | lis3_dev.ac = *((struct axis_conversion *)dmi->driver_data); |
144 | printk(KERN_INFO DRIVER_NAME ": hardware type %s found.\n", dmi->ident); | 144 | printk(KERN_INFO DRIVER_NAME ": hardware type %s found.\n", dmi->ident); |
145 | 145 | ||
146 | return 1; | 146 | return 1; |
@@ -214,7 +214,7 @@ static struct dmi_system_id lis3lv02d_dmi_ids[] = { | |||
214 | 214 | ||
215 | static void hpled_set(struct delayed_led_classdev *led_cdev, enum led_brightness value) | 215 | static void hpled_set(struct delayed_led_classdev *led_cdev, enum led_brightness value) |
216 | { | 216 | { |
217 | acpi_handle handle = adev.device->handle; | 217 | acpi_handle handle = lis3_dev.device->handle; |
218 | unsigned long long ret; /* Not used when writing */ | 218 | unsigned long long ret; /* Not used when writing */ |
219 | union acpi_object in_obj[1]; | 219 | union acpi_object in_obj[1]; |
220 | struct acpi_object_list args = { 1, in_obj }; | 220 | struct acpi_object_list args = { 1, in_obj }; |
@@ -254,7 +254,7 @@ static void lis3lv02d_enum_resources(struct acpi_device *device) | |||
254 | acpi_status status; | 254 | acpi_status status; |
255 | 255 | ||
256 | status = acpi_walk_resources(device->handle, METHOD_NAME__CRS, | 256 | status = acpi_walk_resources(device->handle, METHOD_NAME__CRS, |
257 | lis3lv02d_get_resource, &adev.irq); | 257 | lis3lv02d_get_resource, &lis3_dev.irq); |
258 | if (ACPI_FAILURE(status)) | 258 | if (ACPI_FAILURE(status)) |
259 | printk(KERN_DEBUG DRIVER_NAME ": Error getting resources\n"); | 259 | printk(KERN_DEBUG DRIVER_NAME ": Error getting resources\n"); |
260 | } | 260 | } |
@@ -263,8 +263,8 @@ static s16 lis3lv02d_read_16(acpi_handle handle, int reg) | |||
263 | { | 263 | { |
264 | u8 lo, hi; | 264 | u8 lo, hi; |
265 | 265 | ||
266 | adev.read(handle, reg - 1, &lo); | 266 | lis3_dev.read(handle, reg - 1, &lo); |
267 | adev.read(handle, reg, &hi); | 267 | lis3_dev.read(handle, reg, &hi); |
268 | /* In "12 bit right justified" mode, bit 6, bit 7, bit 8 = bit 5 */ | 268 | /* In "12 bit right justified" mode, bit 6, bit 7, bit 8 = bit 5 */ |
269 | return (s16)((hi << 8) | lo); | 269 | return (s16)((hi << 8) | lo); |
270 | } | 270 | } |
@@ -272,7 +272,7 @@ static s16 lis3lv02d_read_16(acpi_handle handle, int reg) | |||
272 | static s16 lis3lv02d_read_8(acpi_handle handle, int reg) | 272 | static s16 lis3lv02d_read_8(acpi_handle handle, int reg) |
273 | { | 273 | { |
274 | s8 lo; | 274 | s8 lo; |
275 | adev.read(handle, reg, &lo); | 275 | lis3_dev.read(handle, reg, &lo); |
276 | return lo; | 276 | return lo; |
277 | } | 277 | } |
278 | 278 | ||
@@ -283,29 +283,29 @@ static int lis3lv02d_add(struct acpi_device *device) | |||
283 | if (!device) | 283 | if (!device) |
284 | return -EINVAL; | 284 | return -EINVAL; |
285 | 285 | ||
286 | adev.device = device; | 286 | lis3_dev.device = device; |
287 | adev.init = lis3lv02d_acpi_init; | 287 | lis3_dev.init = lis3lv02d_acpi_init; |
288 | adev.read = lis3lv02d_acpi_read; | 288 | lis3_dev.read = lis3lv02d_acpi_read; |
289 | adev.write = lis3lv02d_acpi_write; | 289 | lis3_dev.write = lis3lv02d_acpi_write; |
290 | strcpy(acpi_device_name(device), DRIVER_NAME); | 290 | strcpy(acpi_device_name(device), DRIVER_NAME); |
291 | strcpy(acpi_device_class(device), ACPI_MDPS_CLASS); | 291 | strcpy(acpi_device_class(device), ACPI_MDPS_CLASS); |
292 | device->driver_data = &adev; | 292 | device->driver_data = &lis3_dev; |
293 | 293 | ||
294 | lis3lv02d_acpi_read(device->handle, WHO_AM_I, &adev.whoami); | 294 | lis3lv02d_acpi_read(device->handle, WHO_AM_I, &lis3_dev.whoami); |
295 | switch (adev.whoami) { | 295 | switch (lis3_dev.whoami) { |
296 | case LIS_DOUBLE_ID: | 296 | case LIS_DOUBLE_ID: |
297 | printk(KERN_INFO DRIVER_NAME ": 2-byte sensor found\n"); | 297 | printk(KERN_INFO DRIVER_NAME ": 2-byte sensor found\n"); |
298 | adev.read_data = lis3lv02d_read_16; | 298 | lis3_dev.read_data = lis3lv02d_read_16; |
299 | adev.mdps_max_val = 2048; | 299 | lis3_dev.mdps_max_val = 2048; |
300 | break; | 300 | break; |
301 | case LIS_SINGLE_ID: | 301 | case LIS_SINGLE_ID: |
302 | printk(KERN_INFO DRIVER_NAME ": 1-byte sensor found\n"); | 302 | printk(KERN_INFO DRIVER_NAME ": 1-byte sensor found\n"); |
303 | adev.read_data = lis3lv02d_read_8; | 303 | lis3_dev.read_data = lis3lv02d_read_8; |
304 | adev.mdps_max_val = 128; | 304 | lis3_dev.mdps_max_val = 128; |
305 | break; | 305 | break; |
306 | default: | 306 | default: |
307 | printk(KERN_ERR DRIVER_NAME | 307 | printk(KERN_ERR DRIVER_NAME |
308 | ": unknown sensor type 0x%X\n", adev.whoami); | 308 | ": unknown sensor type 0x%X\n", lis3_dev.whoami); |
309 | return -EINVAL; | 309 | return -EINVAL; |
310 | } | 310 | } |
311 | 311 | ||
@@ -313,7 +313,7 @@ static int lis3lv02d_add(struct acpi_device *device) | |||
313 | if (dmi_check_system(lis3lv02d_dmi_ids) == 0) { | 313 | if (dmi_check_system(lis3lv02d_dmi_ids) == 0) { |
314 | printk(KERN_INFO DRIVER_NAME ": laptop model unknown, " | 314 | printk(KERN_INFO DRIVER_NAME ": laptop model unknown, " |
315 | "using default axes configuration\n"); | 315 | "using default axes configuration\n"); |
316 | adev.ac = lis3lv02d_axis_normal; | 316 | lis3_dev.ac = lis3lv02d_axis_normal; |
317 | } | 317 | } |
318 | 318 | ||
319 | INIT_WORK(&hpled_led.work, delayed_set_status_worker); | 319 | INIT_WORK(&hpled_led.work, delayed_set_status_worker); |
@@ -322,9 +322,9 @@ static int lis3lv02d_add(struct acpi_device *device) | |||
322 | return ret; | 322 | return ret; |
323 | 323 | ||
324 | /* obtain IRQ number of our device from ACPI */ | 324 | /* obtain IRQ number of our device from ACPI */ |
325 | lis3lv02d_enum_resources(adev.device); | 325 | lis3lv02d_enum_resources(lis3_dev.device); |
326 | 326 | ||
327 | ret = lis3lv02d_init_device(&adev); | 327 | ret = lis3lv02d_init_device(&lis3_dev); |
328 | if (ret) { | 328 | if (ret) { |
329 | flush_work(&hpled_led.work); | 329 | flush_work(&hpled_led.work); |
330 | led_classdev_unregister(&hpled_led.led_classdev); | 330 | led_classdev_unregister(&hpled_led.led_classdev); |
@@ -360,12 +360,12 @@ static int lis3lv02d_suspend(struct acpi_device *device, pm_message_t state) | |||
360 | static int lis3lv02d_resume(struct acpi_device *device) | 360 | static int lis3lv02d_resume(struct acpi_device *device) |
361 | { | 361 | { |
362 | /* put back the device in the right state (ACPI might turn it on) */ | 362 | /* put back the device in the right state (ACPI might turn it on) */ |
363 | mutex_lock(&adev.lock); | 363 | mutex_lock(&lis3_dev.lock); |
364 | if (adev.usage > 0) | 364 | if (lis3_dev.usage > 0) |
365 | lis3lv02d_poweron(device->handle); | 365 | lis3lv02d_poweron(device->handle); |
366 | else | 366 | else |
367 | lis3lv02d_poweroff(device->handle); | 367 | lis3lv02d_poweroff(device->handle); |
368 | mutex_unlock(&adev.lock); | 368 | mutex_unlock(&lis3_dev.lock); |
369 | return 0; | 369 | return 0; |
370 | } | 370 | } |
371 | #else | 371 | #else |
diff --git a/drivers/hwmon/lis3lv02d.c b/drivers/hwmon/lis3lv02d.c index 8bb2158f0453..4888ac5ba8cc 100644 --- a/drivers/hwmon/lis3lv02d.c +++ b/drivers/hwmon/lis3lv02d.c | |||
@@ -53,14 +53,24 @@ | |||
53 | * joystick. | 53 | * joystick. |
54 | */ | 54 | */ |
55 | 55 | ||
56 | struct acpi_lis3lv02d adev = { | 56 | struct acpi_lis3lv02d lis3_dev = { |
57 | .misc_wait = __WAIT_QUEUE_HEAD_INITIALIZER(adev.misc_wait), | 57 | .misc_wait = __WAIT_QUEUE_HEAD_INITIALIZER(lis3_dev.misc_wait), |
58 | }; | 58 | }; |
59 | 59 | ||
60 | EXPORT_SYMBOL_GPL(adev); | 60 | EXPORT_SYMBOL_GPL(lis3_dev); |
61 | 61 | ||
62 | static int lis3lv02d_add_fs(struct acpi_device *device); | 62 | static int lis3lv02d_add_fs(struct acpi_device *device); |
63 | 63 | ||
64 | static s16 lis3lv02d_read_16(acpi_handle handle, int reg) | ||
65 | { | ||
66 | u8 lo, hi; | ||
67 | |||
68 | lis3_dev.read(handle, reg, &lo); | ||
69 | lis3_dev.read(handle, reg + 1, &hi); | ||
70 | /* In "12 bit right justified" mode, bit 6, bit 7, bit 8 = bit 5 */ | ||
71 | return (s16)((hi << 8) | lo); | ||
72 | } | ||
73 | |||
64 | /** | 74 | /** |
65 | * lis3lv02d_get_axis - For the given axis, give the value converted | 75 | * lis3lv02d_get_axis - For the given axis, give the value converted |
66 | * @axis: 1,2,3 - can also be negative | 76 | * @axis: 1,2,3 - can also be negative |
@@ -89,25 +99,25 @@ static void lis3lv02d_get_xyz(acpi_handle handle, int *x, int *y, int *z) | |||
89 | { | 99 | { |
90 | int position[3]; | 100 | int position[3]; |
91 | 101 | ||
92 | position[0] = adev.read_data(handle, OUTX); | 102 | position[0] = lis3_dev.read_data(handle, OUTX); |
93 | position[1] = adev.read_data(handle, OUTY); | 103 | position[1] = lis3_dev.read_data(handle, OUTY); |
94 | position[2] = adev.read_data(handle, OUTZ); | 104 | position[2] = lis3_dev.read_data(handle, OUTZ); |
95 | 105 | ||
96 | *x = lis3lv02d_get_axis(adev.ac.x, position); | 106 | *x = lis3lv02d_get_axis(lis3_dev.ac.x, position); |
97 | *y = lis3lv02d_get_axis(adev.ac.y, position); | 107 | *y = lis3lv02d_get_axis(lis3_dev.ac.y, position); |
98 | *z = lis3lv02d_get_axis(adev.ac.z, position); | 108 | *z = lis3lv02d_get_axis(lis3_dev.ac.z, position); |
99 | } | 109 | } |
100 | 110 | ||
101 | void lis3lv02d_poweroff(acpi_handle handle) | 111 | void lis3lv02d_poweroff(acpi_handle handle) |
102 | { | 112 | { |
103 | adev.is_on = 0; | 113 | lis3_dev.is_on = 0; |
104 | } | 114 | } |
105 | EXPORT_SYMBOL_GPL(lis3lv02d_poweroff); | 115 | EXPORT_SYMBOL_GPL(lis3lv02d_poweroff); |
106 | 116 | ||
107 | void lis3lv02d_poweron(acpi_handle handle) | 117 | void lis3lv02d_poweron(acpi_handle handle) |
108 | { | 118 | { |
109 | adev.is_on = 1; | 119 | lis3_dev.is_on = 1; |
110 | adev.init(handle); | 120 | lis3_dev.init(handle); |
111 | } | 121 | } |
112 | EXPORT_SYMBOL_GPL(lis3lv02d_poweron); | 122 | EXPORT_SYMBOL_GPL(lis3lv02d_poweron); |
113 | 123 | ||
@@ -147,10 +157,10 @@ static irqreturn_t lis302dl_interrupt(int irq, void *dummy) | |||
147 | * the lid is closed. This leads to interrupts as soon as a little move | 157 | * the lid is closed. This leads to interrupts as soon as a little move |
148 | * is done. | 158 | * is done. |
149 | */ | 159 | */ |
150 | atomic_inc(&adev.count); | 160 | atomic_inc(&lis3_dev.count); |
151 | 161 | ||
152 | wake_up_interruptible(&adev.misc_wait); | 162 | wake_up_interruptible(&lis3_dev.misc_wait); |
153 | kill_fasync(&adev.async_queue, SIGIO, POLL_IN); | 163 | kill_fasync(&lis3_dev.async_queue, SIGIO, POLL_IN); |
154 | return IRQ_HANDLED; | 164 | return IRQ_HANDLED; |
155 | } | 165 | } |
156 | 166 | ||
@@ -158,10 +168,10 @@ static int lis3lv02d_misc_open(struct inode *inode, struct file *file) | |||
158 | { | 168 | { |
159 | int ret; | 169 | int ret; |
160 | 170 | ||
161 | if (test_and_set_bit(0, &adev.misc_opened)) | 171 | if (test_and_set_bit(0, &lis3_dev.misc_opened)) |
162 | return -EBUSY; /* already open */ | 172 | return -EBUSY; /* already open */ |
163 | 173 | ||
164 | atomic_set(&adev.count, 0); | 174 | atomic_set(&lis3_dev.count, 0); |
165 | 175 | ||
166 | /* | 176 | /* |
167 | * The sensor can generate interrupts for free-fall and direction | 177 | * The sensor can generate interrupts for free-fall and direction |
@@ -174,25 +184,25 @@ static int lis3lv02d_misc_open(struct inode *inode, struct file *file) | |||
174 | * io-apic is not configurable (and generates a warning) but I keep it | 184 | * io-apic is not configurable (and generates a warning) but I keep it |
175 | * in case of support for other hardware. | 185 | * in case of support for other hardware. |
176 | */ | 186 | */ |
177 | ret = request_irq(adev.irq, lis302dl_interrupt, IRQF_TRIGGER_RISING, | 187 | ret = request_irq(lis3_dev.irq, lis302dl_interrupt, IRQF_TRIGGER_RISING, |
178 | DRIVER_NAME, &adev); | 188 | DRIVER_NAME, &lis3_dev); |
179 | 189 | ||
180 | if (ret) { | 190 | if (ret) { |
181 | clear_bit(0, &adev.misc_opened); | 191 | clear_bit(0, &lis3_dev.misc_opened); |
182 | printk(KERN_ERR DRIVER_NAME ": IRQ%d allocation failed\n", adev.irq); | 192 | printk(KERN_ERR DRIVER_NAME ": IRQ%d allocation failed\n", lis3_dev.irq); |
183 | return -EBUSY; | 193 | return -EBUSY; |
184 | } | 194 | } |
185 | lis3lv02d_increase_use(&adev); | 195 | lis3lv02d_increase_use(&lis3_dev); |
186 | printk("lis3: registered interrupt %d\n", adev.irq); | 196 | printk("lis3: registered interrupt %d\n", lis3_dev.irq); |
187 | return 0; | 197 | return 0; |
188 | } | 198 | } |
189 | 199 | ||
190 | static int lis3lv02d_misc_release(struct inode *inode, struct file *file) | 200 | static int lis3lv02d_misc_release(struct inode *inode, struct file *file) |
191 | { | 201 | { |
192 | fasync_helper(-1, file, 0, &adev.async_queue); | 202 | fasync_helper(-1, file, 0, &lis3_dev.async_queue); |
193 | lis3lv02d_decrease_use(&adev); | 203 | lis3lv02d_decrease_use(&lis3_dev); |
194 | free_irq(adev.irq, &adev); | 204 | free_irq(lis3_dev.irq, &lis3_dev); |
195 | clear_bit(0, &adev.misc_opened); /* release the device */ | 205 | clear_bit(0, &lis3_dev.misc_opened); /* release the device */ |
196 | return 0; | 206 | return 0; |
197 | } | 207 | } |
198 | 208 | ||
@@ -207,10 +217,10 @@ static ssize_t lis3lv02d_misc_read(struct file *file, char __user *buf, | |||
207 | if (count < 1) | 217 | if (count < 1) |
208 | return -EINVAL; | 218 | return -EINVAL; |
209 | 219 | ||
210 | add_wait_queue(&adev.misc_wait, &wait); | 220 | add_wait_queue(&lis3_dev.misc_wait, &wait); |
211 | while (true) { | 221 | while (true) { |
212 | set_current_state(TASK_INTERRUPTIBLE); | 222 | set_current_state(TASK_INTERRUPTIBLE); |
213 | data = atomic_xchg(&adev.count, 0); | 223 | data = atomic_xchg(&lis3_dev.count, 0); |
214 | if (data) | 224 | if (data) |
215 | break; | 225 | break; |
216 | 226 | ||
@@ -240,22 +250,22 @@ static ssize_t lis3lv02d_misc_read(struct file *file, char __user *buf, | |||
240 | 250 | ||
241 | out: | 251 | out: |
242 | __set_current_state(TASK_RUNNING); | 252 | __set_current_state(TASK_RUNNING); |
243 | remove_wait_queue(&adev.misc_wait, &wait); | 253 | remove_wait_queue(&lis3_dev.misc_wait, &wait); |
244 | 254 | ||
245 | return retval; | 255 | return retval; |
246 | } | 256 | } |
247 | 257 | ||
248 | static unsigned int lis3lv02d_misc_poll(struct file *file, poll_table *wait) | 258 | static unsigned int lis3lv02d_misc_poll(struct file *file, poll_table *wait) |
249 | { | 259 | { |
250 | poll_wait(file, &adev.misc_wait, wait); | 260 | poll_wait(file, &lis3_dev.misc_wait, wait); |
251 | if (atomic_read(&adev.count)) | 261 | if (atomic_read(&lis3_dev.count)) |
252 | return POLLIN | POLLRDNORM; | 262 | return POLLIN | POLLRDNORM; |
253 | return 0; | 263 | return 0; |
254 | } | 264 | } |
255 | 265 | ||
256 | static int lis3lv02d_misc_fasync(int fd, struct file *file, int on) | 266 | static int lis3lv02d_misc_fasync(int fd, struct file *file, int on) |
257 | { | 267 | { |
258 | return fasync_helper(fd, file, on, &adev.async_queue); | 268 | return fasync_helper(fd, file, on, &lis3_dev.async_queue); |
259 | } | 269 | } |
260 | 270 | ||
261 | static const struct file_operations lis3lv02d_misc_fops = { | 271 | static const struct file_operations lis3lv02d_misc_fops = { |
@@ -283,12 +293,12 @@ static int lis3lv02d_joystick_kthread(void *data) | |||
283 | int x, y, z; | 293 | int x, y, z; |
284 | 294 | ||
285 | while (!kthread_should_stop()) { | 295 | while (!kthread_should_stop()) { |
286 | lis3lv02d_get_xyz(adev.device->handle, &x, &y, &z); | 296 | lis3lv02d_get_xyz(lis3_dev.device->handle, &x, &y, &z); |
287 | input_report_abs(adev.idev, ABS_X, x - adev.xcalib); | 297 | input_report_abs(lis3_dev.idev, ABS_X, x - lis3_dev.xcalib); |
288 | input_report_abs(adev.idev, ABS_Y, y - adev.ycalib); | 298 | input_report_abs(lis3_dev.idev, ABS_Y, y - lis3_dev.ycalib); |
289 | input_report_abs(adev.idev, ABS_Z, z - adev.zcalib); | 299 | input_report_abs(lis3_dev.idev, ABS_Z, z - lis3_dev.zcalib); |
290 | 300 | ||
291 | input_sync(adev.idev); | 301 | input_sync(lis3_dev.idev); |
292 | 302 | ||
293 | try_to_freeze(); | 303 | try_to_freeze(); |
294 | msleep_interruptible(MDPS_POLL_INTERVAL); | 304 | msleep_interruptible(MDPS_POLL_INTERVAL); |
@@ -299,11 +309,11 @@ static int lis3lv02d_joystick_kthread(void *data) | |||
299 | 309 | ||
300 | static int lis3lv02d_joystick_open(struct input_dev *input) | 310 | static int lis3lv02d_joystick_open(struct input_dev *input) |
301 | { | 311 | { |
302 | lis3lv02d_increase_use(&adev); | 312 | lis3lv02d_increase_use(&lis3_dev); |
303 | adev.kthread = kthread_run(lis3lv02d_joystick_kthread, NULL, "klis3lv02d"); | 313 | lis3_dev.kthread = kthread_run(lis3lv02d_joystick_kthread, NULL, "klis3lv02d"); |
304 | if (IS_ERR(adev.kthread)) { | 314 | if (IS_ERR(lis3_dev.kthread)) { |
305 | lis3lv02d_decrease_use(&adev); | 315 | lis3lv02d_decrease_use(&lis3_dev); |
306 | return PTR_ERR(adev.kthread); | 316 | return PTR_ERR(lis3_dev.kthread); |
307 | } | 317 | } |
308 | 318 | ||
309 | return 0; | 319 | return 0; |
@@ -311,45 +321,45 @@ static int lis3lv02d_joystick_open(struct input_dev *input) | |||
311 | 321 | ||
312 | static void lis3lv02d_joystick_close(struct input_dev *input) | 322 | static void lis3lv02d_joystick_close(struct input_dev *input) |
313 | { | 323 | { |
314 | kthread_stop(adev.kthread); | 324 | kthread_stop(lis3_dev.kthread); |
315 | lis3lv02d_decrease_use(&adev); | 325 | lis3lv02d_decrease_use(&lis3_dev); |
316 | } | 326 | } |
317 | 327 | ||
318 | static inline void lis3lv02d_calibrate_joystick(void) | 328 | static inline void lis3lv02d_calibrate_joystick(void) |
319 | { | 329 | { |
320 | lis3lv02d_get_xyz(adev.device->handle, &adev.xcalib, &adev.ycalib, &adev.zcalib); | 330 | lis3lv02d_get_xyz(lis3_dev.device->handle, &lis3_dev.xcalib, &lis3_dev.ycalib, &lis3_dev.zcalib); |
321 | } | 331 | } |
322 | 332 | ||
323 | int lis3lv02d_joystick_enable(void) | 333 | int lis3lv02d_joystick_enable(void) |
324 | { | 334 | { |
325 | int err; | 335 | int err; |
326 | 336 | ||
327 | if (adev.idev) | 337 | if (lis3_dev.idev) |
328 | return -EINVAL; | 338 | return -EINVAL; |
329 | 339 | ||
330 | adev.idev = input_allocate_device(); | 340 | lis3_dev.idev = input_allocate_device(); |
331 | if (!adev.idev) | 341 | if (!lis3_dev.idev) |
332 | return -ENOMEM; | 342 | return -ENOMEM; |
333 | 343 | ||
334 | lis3lv02d_calibrate_joystick(); | 344 | lis3lv02d_calibrate_joystick(); |
335 | 345 | ||
336 | adev.idev->name = "ST LIS3LV02DL Accelerometer"; | 346 | lis3_dev.idev->name = "ST LIS3LV02DL Accelerometer"; |
337 | adev.idev->phys = DRIVER_NAME "/input0"; | 347 | lis3_dev.idev->phys = DRIVER_NAME "/input0"; |
338 | adev.idev->id.bustype = BUS_HOST; | 348 | lis3_dev.idev->id.bustype = BUS_HOST; |
339 | adev.idev->id.vendor = 0; | 349 | lis3_dev.idev->id.vendor = 0; |
340 | adev.idev->dev.parent = &adev.pdev->dev; | 350 | lis3_dev.idev->dev.parent = &lis3_dev.pdev->dev; |
341 | adev.idev->open = lis3lv02d_joystick_open; | 351 | lis3_dev.idev->open = lis3lv02d_joystick_open; |
342 | adev.idev->close = lis3lv02d_joystick_close; | 352 | lis3_dev.idev->close = lis3lv02d_joystick_close; |
343 | 353 | ||
344 | set_bit(EV_ABS, adev.idev->evbit); | 354 | set_bit(EV_ABS, lis3_dev.idev->evbit); |
345 | input_set_abs_params(adev.idev, ABS_X, -adev.mdps_max_val, adev.mdps_max_val, 3, 3); | 355 | input_set_abs_params(lis3_dev.idev, ABS_X, -lis3_dev.mdps_max_val, lis3_dev.mdps_max_val, 3, 3); |
346 | input_set_abs_params(adev.idev, ABS_Y, -adev.mdps_max_val, adev.mdps_max_val, 3, 3); | 356 | input_set_abs_params(lis3_dev.idev, ABS_Y, -lis3_dev.mdps_max_val, lis3_dev.mdps_max_val, 3, 3); |
347 | input_set_abs_params(adev.idev, ABS_Z, -adev.mdps_max_val, adev.mdps_max_val, 3, 3); | 357 | input_set_abs_params(lis3_dev.idev, ABS_Z, -lis3_dev.mdps_max_val, lis3_dev.mdps_max_val, 3, 3); |
348 | 358 | ||
349 | err = input_register_device(adev.idev); | 359 | err = input_register_device(lis3_dev.idev); |
350 | if (err) { | 360 | if (err) { |
351 | input_free_device(adev.idev); | 361 | input_free_device(lis3_dev.idev); |
352 | adev.idev = NULL; | 362 | lis3_dev.idev = NULL; |
353 | } | 363 | } |
354 | 364 | ||
355 | return err; | 365 | return err; |
@@ -358,12 +368,12 @@ EXPORT_SYMBOL_GPL(lis3lv02d_joystick_enable); | |||
358 | 368 | ||
359 | void lis3lv02d_joystick_disable(void) | 369 | void lis3lv02d_joystick_disable(void) |
360 | { | 370 | { |
361 | if (!adev.idev) | 371 | if (!lis3_dev.idev) |
362 | return; | 372 | return; |
363 | 373 | ||
364 | misc_deregister(&lis3lv02d_misc_device); | 374 | misc_deregister(&lis3lv02d_misc_device); |
365 | input_unregister_device(adev.idev); | 375 | input_unregister_device(lis3_dev.idev); |
366 | adev.idev = NULL; | 376 | lis3_dev.idev = NULL; |
367 | } | 377 | } |
368 | EXPORT_SYMBOL_GPL(lis3lv02d_joystick_disable); | 378 | EXPORT_SYMBOL_GPL(lis3lv02d_joystick_disable); |
369 | 379 | ||
@@ -404,25 +414,25 @@ static ssize_t lis3lv02d_position_show(struct device *dev, | |||
404 | { | 414 | { |
405 | int x, y, z; | 415 | int x, y, z; |
406 | 416 | ||
407 | lis3lv02d_increase_use(&adev); | 417 | lis3lv02d_increase_use(&lis3_dev); |
408 | lis3lv02d_get_xyz(adev.device->handle, &x, &y, &z); | 418 | lis3lv02d_get_xyz(lis3_dev.device->handle, &x, &y, &z); |
409 | lis3lv02d_decrease_use(&adev); | 419 | lis3lv02d_decrease_use(&lis3_dev); |
410 | return sprintf(buf, "(%d,%d,%d)\n", x, y, z); | 420 | return sprintf(buf, "(%d,%d,%d)\n", x, y, z); |
411 | } | 421 | } |
412 | 422 | ||
413 | static ssize_t lis3lv02d_calibrate_show(struct device *dev, | 423 | static ssize_t lis3lv02d_calibrate_show(struct device *dev, |
414 | struct device_attribute *attr, char *buf) | 424 | struct device_attribute *attr, char *buf) |
415 | { | 425 | { |
416 | return sprintf(buf, "(%d,%d,%d)\n", adev.xcalib, adev.ycalib, adev.zcalib); | 426 | return sprintf(buf, "(%d,%d,%d)\n", lis3_dev.xcalib, lis3_dev.ycalib, lis3_dev.zcalib); |
417 | } | 427 | } |
418 | 428 | ||
419 | static ssize_t lis3lv02d_calibrate_store(struct device *dev, | 429 | static ssize_t lis3lv02d_calibrate_store(struct device *dev, |
420 | struct device_attribute *attr, | 430 | struct device_attribute *attr, |
421 | const char *buf, size_t count) | 431 | const char *buf, size_t count) |
422 | { | 432 | { |
423 | lis3lv02d_increase_use(&adev); | 433 | lis3lv02d_increase_use(&lis3_dev); |
424 | lis3lv02d_calibrate_joystick(); | 434 | lis3lv02d_calibrate_joystick(); |
425 | lis3lv02d_decrease_use(&adev); | 435 | lis3lv02d_decrease_use(&lis3_dev); |
426 | return count; | 436 | return count; |
427 | } | 437 | } |
428 | 438 | ||
@@ -434,9 +444,9 @@ static ssize_t lis3lv02d_rate_show(struct device *dev, | |||
434 | u8 ctrl; | 444 | u8 ctrl; |
435 | int val; | 445 | int val; |
436 | 446 | ||
437 | lis3lv02d_increase_use(&adev); | 447 | lis3lv02d_increase_use(&lis3_dev); |
438 | adev.read(adev.device->handle, CTRL_REG1, &ctrl); | 448 | lis3_dev.read(lis3_dev.device->handle, CTRL_REG1, &ctrl); |
439 | lis3lv02d_decrease_use(&adev); | 449 | lis3lv02d_decrease_use(&lis3_dev); |
440 | val = (ctrl & (CTRL1_DF0 | CTRL1_DF1)) >> 4; | 450 | val = (ctrl & (CTRL1_DF0 | CTRL1_DF1)) >> 4; |
441 | return sprintf(buf, "%d\n", lis3lv02dl_df_val[val]); | 451 | return sprintf(buf, "%d\n", lis3lv02dl_df_val[val]); |
442 | } | 452 | } |
@@ -460,17 +470,17 @@ static struct attribute_group lis3lv02d_attribute_group = { | |||
460 | 470 | ||
461 | static int lis3lv02d_add_fs(struct acpi_device *device) | 471 | static int lis3lv02d_add_fs(struct acpi_device *device) |
462 | { | 472 | { |
463 | adev.pdev = platform_device_register_simple(DRIVER_NAME, -1, NULL, 0); | 473 | lis3_dev.pdev = platform_device_register_simple(DRIVER_NAME, -1, NULL, 0); |
464 | if (IS_ERR(adev.pdev)) | 474 | if (IS_ERR(lis3_dev.pdev)) |
465 | return PTR_ERR(adev.pdev); | 475 | return PTR_ERR(lis3_dev.pdev); |
466 | 476 | ||
467 | return sysfs_create_group(&adev.pdev->dev.kobj, &lis3lv02d_attribute_group); | 477 | return sysfs_create_group(&lis3_dev.pdev->dev.kobj, &lis3lv02d_attribute_group); |
468 | } | 478 | } |
469 | 479 | ||
470 | int lis3lv02d_remove_fs(void) | 480 | int lis3lv02d_remove_fs(void) |
471 | { | 481 | { |
472 | sysfs_remove_group(&adev.pdev->dev.kobj, &lis3lv02d_attribute_group); | 482 | sysfs_remove_group(&lis3_dev.pdev->dev.kobj, &lis3lv02d_attribute_group); |
473 | platform_device_unregister(adev.pdev); | 483 | platform_device_unregister(lis3_dev.pdev); |
474 | return 0; | 484 | return 0; |
475 | } | 485 | } |
476 | EXPORT_SYMBOL_GPL(lis3lv02d_remove_fs); | 486 | EXPORT_SYMBOL_GPL(lis3lv02d_remove_fs); |
diff --git a/drivers/hwmon/lis3lv02d.h b/drivers/hwmon/lis3lv02d.h index 75972bf372ff..017fb2b754d5 100644 --- a/drivers/hwmon/lis3lv02d.h +++ b/drivers/hwmon/lis3lv02d.h | |||
@@ -194,4 +194,4 @@ void lis3lv02d_poweroff(acpi_handle handle); | |||
194 | void lis3lv02d_poweron(acpi_handle handle); | 194 | void lis3lv02d_poweron(acpi_handle handle); |
195 | int lis3lv02d_remove_fs(void); | 195 | int lis3lv02d_remove_fs(void); |
196 | 196 | ||
197 | extern struct acpi_lis3lv02d adev; | 197 | extern struct acpi_lis3lv02d lis3_dev; |