aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/acpi/bay.c
diff options
context:
space:
mode:
authorKristen Carlson Accardi <kristen.c.accardi@intel.com>2006-12-18 18:06:00 -0500
committerLen Brown <len.brown@intel.com>2007-02-03 01:11:50 -0500
commite9dd85e5bdff2a3981dfaa55869ba920e985ea8a (patch)
tree6b46b4d14615f9cff9729b95474feb183e0074d1 /drivers/acpi/bay.c
parent5447cbb278fd01c402180ab1e820b95101e782fa (diff)
ACPI: bay: remove prototype procfs code
Remove all the procfs related code. Signed-off-by: Kristen Carlson Accardi <kristen.c.accardi@intel.com> Signed-off-by: Len Brown <len.brown@intel.com>
Diffstat (limited to 'drivers/acpi/bay.c')
-rw-r--r--drivers/acpi/bay.c154
1 files changed, 2 insertions, 152 deletions
diff --git a/drivers/acpi/bay.c b/drivers/acpi/bay.c
index 412590d48011..0c0a6204d167 100644
--- a/drivers/acpi/bay.c
+++ b/drivers/acpi/bay.c
@@ -28,7 +28,6 @@
28#include <linux/notifier.h> 28#include <linux/notifier.h>
29#include <acpi/acpi_bus.h> 29#include <acpi/acpi_bus.h>
30#include <acpi/acpi_drivers.h> 30#include <acpi/acpi_drivers.h>
31#include <linux/proc_fs.h>
32#include <linux/seq_file.h> 31#include <linux/seq_file.h>
33#include <asm/uaccess.h> 32#include <asm/uaccess.h>
34 33
@@ -67,12 +66,10 @@ struct bay {
67 acpi_handle handle; 66 acpi_handle handle;
68 char *name; 67 char *name;
69 struct list_head list; 68 struct list_head list;
70 struct proc_dir_entry *proc;
71}; 69};
72 70
73LIST_HEAD(drive_bays); 71LIST_HEAD(drive_bays);
74 72
75static struct proc_dir_entry *acpi_bay_dir;
76 73
77/***************************************************************************** 74/*****************************************************************************
78 * Drive Bay functions * 75 * Drive Bay functions *
@@ -219,147 +216,16 @@ static int acpi_bay_add(struct acpi_device *device)
219 return 0; 216 return 0;
220} 217}
221 218
222static int acpi_bay_status_seq_show(struct seq_file *seq, void *offset)
223{
224 struct bay *bay = (struct bay *)seq->private;
225
226 if (!bay)
227 return 0;
228
229 if (bay_present(bay))
230 seq_printf(seq, "present\n");
231 else
232 seq_printf(seq, "removed\n");
233
234 return 0;
235}
236
237static ssize_t
238acpi_bay_write_eject(struct file *file,
239 const char __user * buffer,
240 size_t count, loff_t * data)
241{
242 struct seq_file *m = (struct seq_file *)file->private_data;
243 struct bay *bay = (struct bay *)m->private;
244 char str[12] = { 0 };
245 u32 state = 0;
246
247 /* FIXME - our only valid value here is 1 */
248 if (!bay || count + 1 > sizeof str)
249 return -EINVAL;
250
251 if (copy_from_user(str, buffer, count))
252 return -EFAULT;
253
254 str[count] = 0;
255 state = simple_strtoul(str, NULL, 0);
256 if (state)
257 eject_device(bay->handle);
258
259 return count;
260}
261
262static int
263acpi_bay_status_open_fs(struct inode *inode, struct file *file)
264{
265 return single_open(file, acpi_bay_status_seq_show,
266 PDE(inode)->data);
267}
268
269static int
270acpi_bay_eject_open_fs(struct inode *inode, struct file *file)
271{
272 return single_open(file, acpi_bay_status_seq_show,
273 PDE(inode)->data);
274}
275
276static struct file_operations acpi_bay_status_fops = {
277 .open = acpi_bay_status_open_fs,
278 .read = seq_read,
279 .llseek = seq_lseek,
280 .release = single_release,
281};
282
283static struct file_operations acpi_bay_eject_fops = {
284 .open = acpi_bay_eject_open_fs,
285 .read = seq_read,
286 .write = acpi_bay_write_eject,
287 .llseek = seq_lseek,
288 .release = single_release,
289};
290#if 0
291static struct file_operations acpi_bay_insert_fops = {
292 .open = acpi_bay_insert_open_fs,
293 .read = seq_read,
294 .llseek = seq_lseek,
295 .release = single_release,
296};
297#endif
298static int acpi_bay_add_fs(struct bay *bay) 219static int acpi_bay_add_fs(struct bay *bay)
299{ 220{
300 struct proc_dir_entry *entry = NULL;
301
302 if (!bay) 221 if (!bay)
303 return -EINVAL; 222 return -EINVAL;
304
305 /*
306 * create a proc entry for this device
307 * we need to do this a little bit differently than normal
308 * acpi device drivers because our device may not be present
309 * at the moment, and therefore we have no acpi_device struct
310 */
311
312 bay->proc = proc_mkdir(bay->name, acpi_bay_dir);
313
314 /* 'status' [R] */
315 entry = create_proc_entry("status",
316 S_IRUGO, bay->proc);
317 if (!entry)
318 return -EIO;
319 else {
320 entry->proc_fops = &acpi_bay_status_fops;
321 entry->data = bay;
322 entry->owner = THIS_MODULE;
323 }
324 /* 'eject' [W] */
325 entry = create_proc_entry("eject",
326 S_IWUGO, bay->proc);
327 if (!entry)
328 return -EIO;
329 else {
330 entry->proc_fops = &acpi_bay_eject_fops;
331 entry->data = bay;
332 entry->owner = THIS_MODULE;
333 }
334#if 0
335 /* 'insert' [W] */
336 entry = create_proc_entry("insert",
337 S_IWUGO, bay->proc);
338 if (!entry)
339 return -EIO;
340 else {
341 entry->proc_fops = &acpi_bay_insert_fops;
342 entry->data = bay;
343 entry->owner = THIS_MODULE;
344 }
345#endif
346 return 0;
347} 223}
348 224
349static void acpi_bay_remove_fs(struct bay *bay) 225static void acpi_bay_remove_fs(struct bay *bay)
350{ 226{
351 if (!bay) 227 if (!bay)
352 return; 228 return;
353
354 if (bay->proc) {
355 remove_proc_entry("status", bay->proc);
356 remove_proc_entry("eject", bay->proc);
357#if 0
358 remove_proc_entry("insert", bay->proc);
359#endif
360 remove_proc_entry(bay->name, acpi_bay_dir);
361 bay->proc = NULL;
362 }
363} 229}
364 230
365static int bay_is_dock_device(acpi_handle handle) 231static int bay_is_dock_device(acpi_handle handle)
@@ -384,13 +250,6 @@ static int bay_add(acpi_handle handle)
384 bay_dprintk(handle, "Adding notify handler"); 250 bay_dprintk(handle, "Adding notify handler");
385 251
386 /* 252 /*
387 * if this is the first bay device found, make the root
388 * proc entry
389 */
390 if (acpi_bay_dir == NULL)
391 acpi_bay_dir = proc_mkdir(ACPI_BAY_CLASS, acpi_root_dir);
392
393 /*
394 * Initialize bay device structure 253 * Initialize bay device structure
395 */ 254 */
396 new_bay = kmalloc(GFP_ATOMIC, sizeof(*new_bay)); 255 new_bay = kmalloc(GFP_ATOMIC, sizeof(*new_bay));
@@ -544,21 +403,15 @@ static int __init bay_init(void)
544{ 403{
545 int bays = 0; 404 int bays = 0;
546 405
547 acpi_bay_dir = NULL;
548 INIT_LIST_HEAD(&drive_bays); 406 INIT_LIST_HEAD(&drive_bays);
549 407
550 /* look for dockable drive bays */ 408 /* look for dockable drive bays */
551 acpi_walk_namespace(ACPI_TYPE_DEVICE, ACPI_ROOT_OBJECT, 409 acpi_walk_namespace(ACPI_TYPE_DEVICE, ACPI_ROOT_OBJECT,
552 ACPI_UINT32_MAX, find_bay, &bays, NULL); 410 ACPI_UINT32_MAX, find_bay, &bays, NULL);
553 411
554 if (bays) { 412 if (bays)
555 if ((acpi_bus_register_driver(&acpi_bay_driver) < 0)) { 413 if ((acpi_bus_register_driver(&acpi_bay_driver) < 0))
556 printk(KERN_ERR "Unable to register bay driver\n"); 414 printk(KERN_ERR "Unable to register bay driver\n");
557 if (acpi_bay_dir)
558 remove_proc_entry(ACPI_BAY_CLASS,
559 acpi_root_dir);
560 }
561 }
562 415
563 if (!bays) 416 if (!bays)
564 return -ENODEV; 417 return -ENODEV;
@@ -580,9 +433,6 @@ static void __exit bay_exit(void)
580 kfree(bay); 433 kfree(bay);
581 } 434 }
582 435
583 if (acpi_bay_dir)
584 remove_proc_entry(ACPI_BAY_CLASS, acpi_root_dir);
585
586 acpi_bus_unregister_driver(&acpi_bay_driver); 436 acpi_bus_unregister_driver(&acpi_bay_driver);
587} 437}
588 438