aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/acpi/bay.c
diff options
context:
space:
mode:
authorKristen Carlson Accardi <kristen.c.accardi@intel.com>2007-02-05 19:09:07 -0500
committerLen Brown <len.brown@intel.com>2007-02-09 00:38:01 -0500
commitc41458aca0defd5b16239ffd65630d1b87672ee5 (patch)
tree7e547b57e5591c57073a9ef88290765bf354771c /drivers/acpi/bay.c
parent5986a2ec35836a878350c54af4bd91b1de6abc59 (diff)
ACPI: bay: remove ACPI driver struct
The bay driver is a platform driver, and doesn't need to also be an acpi driver. Remove the acpi driver related structures and callbacks, they didn't do anything anyway. Switch to uevent for user space event notification. Signed-off-by: Kristen Carlson Accardi <kristen.c.accardi@intel.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Len Brown <len.brown@intel.com>
Diffstat (limited to 'drivers/acpi/bay.c')
-rw-r--r--drivers/acpi/bay.c99
1 files changed, 4 insertions, 95 deletions
diff --git a/drivers/acpi/bay.c b/drivers/acpi/bay.c
index 667fa1dfa1a3..9fdee610ae05 100644
--- a/drivers/acpi/bay.c
+++ b/drivers/acpi/bay.c
@@ -47,18 +47,6 @@ MODULE_LICENSE("GPL");
47 acpi_get_name(h, ACPI_FULL_PATHNAME, &buffer);\ 47 acpi_get_name(h, ACPI_FULL_PATHNAME, &buffer);\
48 printk(KERN_DEBUG PREFIX "%s: %s\n", prefix, s); } 48 printk(KERN_DEBUG PREFIX "%s: %s\n", prefix, s); }
49static void bay_notify(acpi_handle handle, u32 event, void *data); 49static void bay_notify(acpi_handle handle, u32 event, void *data);
50static int acpi_bay_add(struct acpi_device *device);
51static int acpi_bay_remove(struct acpi_device *device, int type);
52
53static struct acpi_driver acpi_bay_driver = {
54 .name = ACPI_BAY_DRIVER_NAME,
55 .class = ACPI_BAY_CLASS,
56 .ids = ACPI_BAY_HID,
57 .ops = {
58 .add = acpi_bay_add,
59 .remove = acpi_bay_remove,
60 },
61};
62 50
63struct bay { 51struct bay {
64 acpi_handle handle; 52 acpi_handle handle;
@@ -234,14 +222,6 @@ int eject_removable_drive(struct device *dev)
234} 222}
235EXPORT_SYMBOL_GPL(eject_removable_drive); 223EXPORT_SYMBOL_GPL(eject_removable_drive);
236 224
237static int acpi_bay_add(struct acpi_device *device)
238{
239 bay_dprintk(device->handle, "adding bay device");
240 strcpy(acpi_device_name(device), "Dockable Bay");
241 strcpy(acpi_device_class(device), "bay");
242 return 0;
243}
244
245static int acpi_bay_add_fs(struct bay *bay) 225static int acpi_bay_add_fs(struct bay *bay)
246{ 226{
247 int ret; 227 int ret;
@@ -339,52 +319,6 @@ bay_add_err:
339 return -ENODEV; 319 return -ENODEV;
340} 320}
341 321
342static int acpi_bay_remove(struct acpi_device *device, int type)
343{
344 /*** FIXME: do something here */
345 return 0;
346}
347
348/**
349 * bay_create_acpi_device - add new devices to acpi
350 * @handle - handle of the device to add
351 *
352 * This function will create a new acpi_device for the given
353 * handle if one does not exist already. This should cause
354 * acpi to scan for drivers for the given devices, and call
355 * matching driver's add routine.
356 *
357 * Returns a pointer to the acpi_device corresponding to the handle.
358 */
359static struct acpi_device * bay_create_acpi_device(acpi_handle handle)
360{
361 struct acpi_device *device = NULL;
362 struct acpi_device *parent_device;
363 acpi_handle parent;
364 int ret;
365
366 bay_dprintk(handle, "Trying to get device");
367 if (acpi_bus_get_device(handle, &device)) {
368 /*
369 * no device created for this object,
370 * so we should create one.
371 */
372 bay_dprintk(handle, "No device for handle");
373 acpi_get_parent(handle, &parent);
374 if (acpi_bus_get_device(parent, &parent_device))
375 parent_device = NULL;
376
377 ret = acpi_bus_add(&device, parent_device, handle,
378 ACPI_BUS_TYPE_DEVICE);
379 if (ret) {
380 pr_debug("error adding bus, %x\n",
381 -ret);
382 return NULL;
383 }
384 }
385 return device;
386}
387
388/** 322/**
389 * bay_notify - act upon an acpi bay notification 323 * bay_notify - act upon an acpi bay notification
390 * @handle: the bay handle 324 * @handle: the bay handle
@@ -394,38 +328,19 @@ static struct acpi_device * bay_create_acpi_device(acpi_handle handle)
394 */ 328 */
395static void bay_notify(acpi_handle handle, u32 event, void *data) 329static void bay_notify(acpi_handle handle, u32 event, void *data)
396{ 330{
397 struct acpi_device *dev; 331 struct bay *bay_dev = (struct bay *)data;
332 struct device *dev = &bay_dev->pdev->dev;
398 333
399 bay_dprintk(handle, "Bay event"); 334 bay_dprintk(handle, "Bay event");
400 335
401 switch(event) { 336 switch(event) {
402 case ACPI_NOTIFY_BUS_CHECK: 337 case ACPI_NOTIFY_BUS_CHECK:
403 printk("Bus Check\n");
404 case ACPI_NOTIFY_DEVICE_CHECK: 338 case ACPI_NOTIFY_DEVICE_CHECK:
405 printk("Device Check\n");
406 dev = bay_create_acpi_device(handle);
407 if (dev)
408 acpi_bus_generate_event(dev, event, 0);
409 else
410 printk("No device for generating event\n");
411 /* wouldn't it be a good idea to just rescan SATA
412 * right here?
413 */
414 break;
415 case ACPI_NOTIFY_EJECT_REQUEST: 339 case ACPI_NOTIFY_EJECT_REQUEST:
416 printk("Eject request\n"); 340 kobject_uevent(&dev->kobj, KOBJ_CHANGE);
417 dev = bay_create_acpi_device(handle);
418 if (dev)
419 acpi_bus_generate_event(dev, event, 0);
420 else
421 printk("No device for generating eventn");
422
423 /* wouldn't it be a good idea to just call the
424 * eject_device here if we were a SATA device?
425 */
426 break; 341 break;
427 default: 342 default:
428 printk("unknown event %d\n", event); 343 printk(KERN_ERR PREFIX "Bay: unknown event %d\n", event);
429 } 344 }
430} 345}
431 346
@@ -457,10 +372,6 @@ static int __init bay_init(void)
457 acpi_walk_namespace(ACPI_TYPE_DEVICE, ACPI_ROOT_OBJECT, 372 acpi_walk_namespace(ACPI_TYPE_DEVICE, ACPI_ROOT_OBJECT,
458 ACPI_UINT32_MAX, find_bay, &bays, NULL); 373 ACPI_UINT32_MAX, find_bay, &bays, NULL);
459 374
460 if (bays)
461 if ((acpi_bus_register_driver(&acpi_bay_driver) < 0))
462 printk(KERN_ERR "Unable to register bay driver\n");
463
464 if (!bays) 375 if (!bays)
465 return -ENODEV; 376 return -ENODEV;
466 377
@@ -481,8 +392,6 @@ static void __exit bay_exit(void)
481 kfree(bay->name); 392 kfree(bay->name);
482 kfree(bay); 393 kfree(bay);
483 } 394 }
484
485 acpi_bus_unregister_driver(&acpi_bay_driver);
486} 395}
487 396
488postcore_initcall(bay_init); 397postcore_initcall(bay_init);