scan.c (493837009665a5ea1d91ed5fe4bab0ed546cae86) | scan.c (46ec8598fde74ba59703575c22a6fb0b6b151bb6) |
---|---|
1/* 2 * scan.c - support for transforming the ACPI namespace into individual objects 3 */ 4 5#include <linux/module.h> 6#include <linux/init.h> 7#include <linux/kernel.h> 8#include <linux/acpi.h> --- 345 unchanged lines hidden (view full) --- 354 len = create_modalias(acpi_dev, &env->buf[env->buflen - 1], 355 sizeof(env->buf) - env->buflen); 356 if (len >= (sizeof(env->buf) - env->buflen)) 357 return -ENOMEM; 358 env->buflen += len; 359 return 0; 360} 361 | 1/* 2 * scan.c - support for transforming the ACPI namespace into individual objects 3 */ 4 5#include <linux/module.h> 6#include <linux/init.h> 7#include <linux/kernel.h> 8#include <linux/acpi.h> --- 345 unchanged lines hidden (view full) --- 354 len = create_modalias(acpi_dev, &env->buf[env->buflen - 1], 355 sizeof(env->buf) - env->buflen); 356 if (len >= (sizeof(env->buf) - env->buflen)) 357 return -ENOMEM; 358 env->buflen += len; 359 return 0; 360} 361 |
362static void acpi_device_notify(acpi_handle handle, u32 event, void *data) 363{ 364 struct acpi_device *device = data; 365 366 device->driver->ops.notify(device, event); 367} 368 369static acpi_status acpi_device_notify_fixed(void *data) 370{ 371 struct acpi_device *device = data; 372 373 acpi_device_notify(device->handle, ACPI_FIXED_HARDWARE_EVENT, device); 374 return AE_OK; 375} 376 377static int acpi_device_install_notify_handler(struct acpi_device *device) 378{ 379 acpi_status status; 380 char *hid; 381 382 hid = acpi_device_hid(device); 383 if (!strcmp(hid, ACPI_BUTTON_HID_POWERF)) 384 status = 385 acpi_install_fixed_event_handler(ACPI_EVENT_POWER_BUTTON, 386 acpi_device_notify_fixed, 387 device); 388 else if (!strcmp(hid, ACPI_BUTTON_HID_SLEEPF)) 389 status = 390 acpi_install_fixed_event_handler(ACPI_EVENT_SLEEP_BUTTON, 391 acpi_device_notify_fixed, 392 device); 393 else 394 status = acpi_install_notify_handler(device->handle, 395 ACPI_DEVICE_NOTIFY, 396 acpi_device_notify, 397 device); 398 399 if (ACPI_FAILURE(status)) 400 return -EINVAL; 401 return 0; 402} 403 404static void acpi_device_remove_notify_handler(struct acpi_device *device) 405{ 406 if (!strcmp(acpi_device_hid(device), ACPI_BUTTON_HID_POWERF)) 407 acpi_remove_fixed_event_handler(ACPI_EVENT_POWER_BUTTON, 408 acpi_device_notify_fixed); 409 else if (!strcmp(acpi_device_hid(device), ACPI_BUTTON_HID_SLEEPF)) 410 acpi_remove_fixed_event_handler(ACPI_EVENT_SLEEP_BUTTON, 411 acpi_device_notify_fixed); 412 else 413 acpi_remove_notify_handler(device->handle, ACPI_DEVICE_NOTIFY, 414 acpi_device_notify); 415} 416 |
|
362static int acpi_bus_driver_init(struct acpi_device *, struct acpi_driver *); 363static int acpi_start_single_object(struct acpi_device *); 364static int acpi_device_probe(struct device * dev) 365{ 366 struct acpi_device *acpi_dev = to_acpi_device(dev); 367 struct acpi_driver *acpi_drv = to_acpi_driver(dev->driver); 368 int ret; 369 370 ret = acpi_bus_driver_init(acpi_dev, acpi_drv); 371 if (!ret) { 372 if (acpi_dev->bus_ops.acpi_op_start) 373 acpi_start_single_object(acpi_dev); | 417static int acpi_bus_driver_init(struct acpi_device *, struct acpi_driver *); 418static int acpi_start_single_object(struct acpi_device *); 419static int acpi_device_probe(struct device * dev) 420{ 421 struct acpi_device *acpi_dev = to_acpi_device(dev); 422 struct acpi_driver *acpi_drv = to_acpi_driver(dev->driver); 423 int ret; 424 425 ret = acpi_bus_driver_init(acpi_dev, acpi_drv); 426 if (!ret) { 427 if (acpi_dev->bus_ops.acpi_op_start) 428 acpi_start_single_object(acpi_dev); |
429 430 if (acpi_drv->ops.notify) { 431 ret = acpi_device_install_notify_handler(acpi_dev); 432 if (ret) { 433 if (acpi_drv->ops.stop) 434 acpi_drv->ops.stop(acpi_dev, 435 acpi_dev->removal_type); 436 if (acpi_drv->ops.remove) 437 acpi_drv->ops.remove(acpi_dev, 438 acpi_dev->removal_type); 439 return ret; 440 } 441 } 442 |
|
374 ACPI_DEBUG_PRINT((ACPI_DB_INFO, 375 "Found driver [%s] for device [%s]\n", 376 acpi_drv->name, acpi_dev->pnp.bus_id)); 377 get_device(dev); 378 } 379 return ret; 380} 381 382static int acpi_device_remove(struct device * dev) 383{ 384 struct acpi_device *acpi_dev = to_acpi_device(dev); 385 struct acpi_driver *acpi_drv = acpi_dev->driver; 386 387 if (acpi_drv) { | 443 ACPI_DEBUG_PRINT((ACPI_DB_INFO, 444 "Found driver [%s] for device [%s]\n", 445 acpi_drv->name, acpi_dev->pnp.bus_id)); 446 get_device(dev); 447 } 448 return ret; 449} 450 451static int acpi_device_remove(struct device * dev) 452{ 453 struct acpi_device *acpi_dev = to_acpi_device(dev); 454 struct acpi_driver *acpi_drv = acpi_dev->driver; 455 456 if (acpi_drv) { |
457 if (acpi_drv->ops.notify) 458 acpi_device_remove_notify_handler(acpi_dev); |
|
388 if (acpi_drv->ops.stop) 389 acpi_drv->ops.stop(acpi_dev, acpi_dev->removal_type); 390 if (acpi_drv->ops.remove) 391 acpi_drv->ops.remove(acpi_dev, acpi_dev->removal_type); 392 } 393 acpi_dev->driver = NULL; 394 acpi_dev->driver_data = NULL; 395 --- 1158 unchanged lines hidden --- | 459 if (acpi_drv->ops.stop) 460 acpi_drv->ops.stop(acpi_dev, acpi_dev->removal_type); 461 if (acpi_drv->ops.remove) 462 acpi_drv->ops.remove(acpi_dev, acpi_dev->removal_type); 463 } 464 acpi_dev->driver = NULL; 465 acpi_dev->driver_data = NULL; 466 --- 1158 unchanged lines hidden --- |