static int acpi_power_add_fs ( struct acpi_device *device) { struct proc_dir_entry *entry = NULL; ACPI_FUNCTION_TRACE("acpi_power_add_fs"); if (!device) return_VALUE(-EINVAL); if (!acpi_device_dir(device)) { acpi_device_dir(device) = proc_mkdir(acpi_device_bid(device), acpi_power_dir); if (!acpi_device_dir(device)) return_VALUE(-ENODEV); } /* 'status' [R] */ entry = create_proc_entry(ACPI_POWER_FILE_STATUS, S_IRUGO, acpi_device_dir(device)); if (!entry) ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Unable to create '%s' fs entry\n", ACPI_POWER_FILE_STATUS)); else { entry->read_proc = acpi_power_read_status; entry->data = acpi_driver_data(device); } return_VALUE(0); }
static int acpi_fan_add_fs ( struct acpi_device *device) { struct proc_dir_entry *entry = NULL; ACPI_FUNCTION_TRACE("acpi_fan_add_fs"); if (!device) return_VALUE(-EINVAL); if (!acpi_device_dir(device)) { acpi_device_dir(device) = proc_mkdir(acpi_device_bid(device), acpi_fan_dir); if (!acpi_device_dir(device)) return_VALUE(-ENODEV); acpi_device_dir(device)->owner = THIS_MODULE; } /* 'status' [R/W] */ entry = create_proc_entry(ACPI_FAN_FILE_STATE, S_IFREG|S_IRUGO|S_IWUSR, acpi_device_dir(device)); if (!entry) ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Unable to create '%s' fs entry\n", ACPI_FAN_FILE_STATE)); else { entry->read_proc = acpi_fan_read_state; entry->write_proc = acpi_fan_write_state; entry->data = acpi_driver_data(device); entry->owner = THIS_MODULE; } return_VALUE(0); }
static int acpi_fan_add_fs(struct acpi_device *device) { struct proc_dir_entry *entry = NULL; if (!device) return -EINVAL; if (!acpi_device_dir(device)) { acpi_device_dir(device) = proc_mkdir(acpi_device_bid(device), acpi_fan_dir); if (!acpi_device_dir(device)) return -ENODEV; } /* 'status' [R/W] */ entry = proc_create_data(ACPI_FAN_FILE_STATE, S_IFREG | S_IRUGO | S_IWUSR, acpi_device_dir(device), &acpi_fan_state_ops, device); if (!entry) return -ENODEV; return 0; }
static int acpi_button_add_fs(struct acpi_device *device) { struct acpi_button *button = acpi_driver_data(device); struct proc_dir_entry *entry = NULL; int ret = 0; /* procfs I/F for ACPI lid device only */ if (button->type != ACPI_BUTTON_TYPE_LID) return 0; if (acpi_button_dir || acpi_lid_dir) { printk(KERN_ERR PREFIX "More than one Lid device found!\n"); return -EEXIST; } /* create /proc/acpi/button */ acpi_button_dir = proc_mkdir(ACPI_BUTTON_CLASS, acpi_root_dir); if (!acpi_button_dir) return -ENODEV; /* create /proc/acpi/button/lid */ acpi_lid_dir = proc_mkdir(ACPI_BUTTON_SUBCLASS_LID, acpi_button_dir); if (!acpi_lid_dir) { ret = -ENODEV; goto remove_button_dir; } /* create /proc/acpi/button/lid/LID/ */ acpi_device_dir(device) = proc_mkdir(acpi_device_bid(device), acpi_lid_dir); if (!acpi_device_dir(device)) { ret = -ENODEV; goto remove_lid_dir; } /* create /proc/acpi/button/lid/LID/state */ entry = proc_create_data(ACPI_BUTTON_FILE_STATE, S_IRUGO, acpi_device_dir(device), &acpi_button_state_fops, device); if (!entry) { ret = -ENODEV; goto remove_dev_dir; } done: return ret; remove_dev_dir: remove_proc_entry(acpi_device_bid(device), acpi_lid_dir); acpi_device_dir(device) = NULL; remove_lid_dir: remove_proc_entry(ACPI_BUTTON_SUBCLASS_LID, acpi_button_dir); acpi_lid_dir = NULL; remove_button_dir: remove_proc_entry(ACPI_BUTTON_CLASS, acpi_root_dir); acpi_button_dir = NULL; goto done; }
static int acpi_fan_remove_fs(struct acpi_device *device) { if (acpi_device_dir(device)) { remove_proc_entry(ACPI_FAN_FILE_STATE, acpi_device_dir(device)); remove_proc_entry(acpi_device_bid(device), acpi_fan_dir); acpi_device_dir(device) = NULL; } return 0; }
static int acpi_battery_remove_fs ( struct acpi_device *device) { ACPI_FUNCTION_TRACE("acpi_battery_remove_fs"); if (acpi_device_dir(device)) { remove_proc_entry(acpi_device_bid(device), acpi_battery_dir); acpi_device_dir(device) = NULL; } return_VALUE(0); }
int acpi_processor_power_exit(struct acpi_processor *pr, struct acpi_device *device) { if (boot_option_idle_override) return 0; cpuidle_unregister_device(&pr->power.dev); pr->flags.power_setup_done = 0; if (acpi_device_dir(device)) remove_proc_entry(ACPI_PROCESSOR_FILE_POWER, acpi_device_dir(device)); return 0; }
static int acpi_fan_remove_fs ( struct acpi_device *device) { ACPI_FUNCTION_TRACE("acpi_fan_remove_fs"); if (acpi_device_dir(device)) { remove_proc_entry(ACPI_FAN_FILE_STATE, acpi_device_dir(device)); remove_proc_entry(acpi_device_bid(device), acpi_fan_dir); acpi_device_dir(device) = NULL; } return_VALUE(0); }
static int acpi_processor_remove_fs(struct acpi_device *device) { if (acpi_device_dir(device)) { remove_proc_entry(ACPI_PROCESSOR_FILE_INFO, acpi_device_dir(device)); remove_proc_entry(ACPI_PROCESSOR_FILE_THROTTLING, acpi_device_dir(device)); remove_proc_entry(ACPI_PROCESSOR_FILE_LIMIT, acpi_device_dir(device)); remove_proc_entry(acpi_device_bid(device), acpi_processor_dir); acpi_device_dir(device) = NULL; } return 0; }
static void acpi_cpufreq_add_file(struct acpi_processor *pr) { struct proc_dir_entry *entry = NULL; struct acpi_device *device = NULL; ACPI_FUNCTION_TRACE("acpi_cpufreq_addfile"); if (acpi_bus_get_device(pr->handle, &device)) return_VOID; /* add file 'performance' [R/W] */ entry = create_proc_entry(ACPI_PROCESSOR_FILE_PERFORMANCE, S_IFREG | S_IRUGO | S_IWUSR, acpi_device_dir(device)); if (!entry) ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Unable to create '%s' fs entry\n", ACPI_PROCESSOR_FILE_PERFORMANCE)); else { entry->proc_fops = &acpi_processor_perf_fops; entry->proc_fops->write = acpi_processor_write_performance; entry->data = acpi_driver_data(device); entry->owner = THIS_MODULE; } return_VOID; }
static int acpi_battery_remove_fs(struct acpi_device *device) { if (acpi_device_dir(device)) { remove_proc_entry(ACPI_BATTERY_FILE_ALARM, acpi_device_dir(device)); remove_proc_entry(ACPI_BATTERY_FILE_STATUS, acpi_device_dir(device)); remove_proc_entry(ACPI_BATTERY_FILE_INFO, acpi_device_dir(device)); remove_proc_entry(acpi_device_bid(device), acpi_battery_dir); acpi_device_dir(device) = NULL; } return 0; }
static int acpi_processor_remove_fs(struct acpi_device *device) { ACPI_FUNCTION_TRACE("acpi_processor_remove_fs"); if (acpi_device_dir(device)) { remove_proc_entry(ACPI_PROCESSOR_FILE_INFO, acpi_device_dir(device)); remove_proc_entry(ACPI_PROCESSOR_FILE_THROTTLING, acpi_device_dir(device)); remove_proc_entry(ACPI_PROCESSOR_FILE_LIMIT, acpi_device_dir(device)); remove_proc_entry(acpi_device_bid(device), acpi_processor_dir); acpi_device_dir(device) = NULL; } return_VALUE(0); }
static int acpi_system_remove_fs ( struct acpi_device *device) { ACPI_FUNCTION_TRACE("acpi_system_remove_fs"); if (!device) return_VALUE(-EINVAL); remove_proc_entry(ACPI_SYSTEM_FILE_INFO, acpi_device_dir(device)); remove_proc_entry(ACPI_SYSTEM_FILE_DSDT, acpi_device_dir(device)); remove_proc_entry(ACPI_SYSTEM_FILE_EVENT, acpi_device_dir(device)); #ifdef CONFIG_ACPI_SLEEP remove_proc_entry(ACPI_SYSTEM_FILE_SLEEP, acpi_device_dir(device)); remove_proc_entry(ACPI_SYSTEM_FILE_ALARM, acpi_device_dir(device)); #endif #ifdef ACPI_DEBUG_OUTPUT remove_proc_entry(ACPI_SYSTEM_FILE_DEBUG_LAYER, acpi_device_dir(device)); remove_proc_entry(ACPI_SYSTEM_FILE_DEBUG_LEVEL, acpi_device_dir(device)); #endif return_VALUE(0); }
static int acpi_battery_remove_fs(struct acpi_device *device) { ACPI_FUNCTION_TRACE("acpi_battery_remove_fs"); if (acpi_device_dir(device)) { remove_proc_entry(ACPI_BATTERY_FILE_ALARM, acpi_device_dir(device)); remove_proc_entry(ACPI_BATTERY_FILE_STATUS, acpi_device_dir(device)); remove_proc_entry(ACPI_BATTERY_FILE_INFO, acpi_device_dir(device)); remove_proc_entry(acpi_device_bid(device), acpi_battery_dir); acpi_device_dir(device) = NULL; } return_VALUE(0); }
static int acpi_processor_add_fs(struct acpi_device *device) { struct proc_dir_entry *entry = NULL; ACPI_FUNCTION_TRACE("acpi_processor_add_fs"); if (!acpi_device_dir(device)) { acpi_device_dir(device) = proc_mkdir(acpi_device_bid(device), acpi_processor_dir); if (!acpi_device_dir(device)) return_VALUE(-ENODEV); } acpi_device_dir(device)->owner = THIS_MODULE; /* 'info' [R] */ entry = create_proc_entry(ACPI_PROCESSOR_FILE_INFO, S_IRUGO, acpi_device_dir(device)); if (!entry) ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Unable to create '%s' fs entry\n", ACPI_PROCESSOR_FILE_INFO)); else { entry->proc_fops = &acpi_processor_info_fops; entry->data = acpi_driver_data(device); entry->owner = THIS_MODULE; } /* 'throttling' [R/W] */ entry = create_proc_entry(ACPI_PROCESSOR_FILE_THROTTLING, S_IFREG | S_IRUGO | S_IWUSR, acpi_device_dir(device)); if (!entry) ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Unable to create '%s' fs entry\n", ACPI_PROCESSOR_FILE_THROTTLING)); else { entry->proc_fops = &acpi_processor_throttling_fops; entry->proc_fops->write = acpi_processor_write_throttling; entry->data = acpi_driver_data(device); entry->owner = THIS_MODULE; } /* 'limit' [R/W] */ entry = create_proc_entry(ACPI_PROCESSOR_FILE_LIMIT, S_IFREG | S_IRUGO | S_IWUSR, acpi_device_dir(device)); if (!entry) ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Unable to create '%s' fs entry\n", ACPI_PROCESSOR_FILE_LIMIT)); else { entry->proc_fops = &acpi_processor_limit_fops; entry->proc_fops->write = acpi_processor_write_limit; entry->data = acpi_driver_data(device); entry->owner = THIS_MODULE; } return_VALUE(0); }
static int acpi_button_remove_fs(struct acpi_device *device) { struct acpi_button *button = acpi_driver_data(device); if (button->type != ACPI_BUTTON_TYPE_LID) return 0; remove_proc_entry(ACPI_BUTTON_FILE_STATE, acpi_device_dir(device)); remove_proc_entry(acpi_device_bid(device), acpi_lid_dir); acpi_device_dir(device) = NULL; remove_proc_entry(ACPI_BUTTON_SUBCLASS_LID, acpi_button_dir); acpi_lid_dir = NULL; remove_proc_entry(ACPI_BUTTON_CLASS, acpi_root_dir); acpi_button_dir = NULL; return 0; }
static int acpi_battery_add_fs ( struct acpi_device *device) { struct proc_dir_entry *entry = NULL; ACPI_FUNCTION_TRACE("acpi_battery_add_fs"); if (!acpi_device_dir(device)) { acpi_device_dir(device) = proc_mkdir(acpi_device_bid(device), acpi_battery_dir); if (!acpi_device_dir(device)) return_VALUE(-ENODEV); acpi_device_dir(device)->owner = THIS_MODULE; } /* 'info' [R] */ entry = create_proc_entry(ACPI_BATTERY_FILE_INFO, S_IRUGO, acpi_device_dir(device)); if (!entry) ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Unable to create '%s' fs entry\n", ACPI_BATTERY_FILE_INFO)); else { entry->read_proc = acpi_battery_read_info; entry->data = acpi_driver_data(device); entry->owner = THIS_MODULE; } /* 'status' [R] */ entry = create_proc_entry(ACPI_BATTERY_FILE_STATUS, S_IRUGO, acpi_device_dir(device)); if (!entry) ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Unable to create '%s' fs entry\n", ACPI_BATTERY_FILE_STATUS)); else { entry->read_proc = acpi_battery_read_state; entry->data = acpi_driver_data(device); entry->owner = THIS_MODULE; } /* 'alarm' [R/W] */ entry = create_proc_entry(ACPI_BATTERY_FILE_ALARM, S_IFREG|S_IRUGO|S_IWUSR, acpi_device_dir(device)); if (!entry) ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Unable to create '%s' fs entry\n", ACPI_BATTERY_FILE_ALARM)); else { entry->read_proc = acpi_battery_read_alarm; entry->write_proc = acpi_battery_write_alarm; entry->data = acpi_driver_data(device); entry->owner = THIS_MODULE; } return_VALUE(0); }
static void acpi_cpufreq_add_file(struct acpi_processor *pr) { struct acpi_device *device = NULL; if (acpi_bus_get_device(pr->handle, &device)) return; /* add file 'performance' [R/W] */ proc_create_data(ACPI_PROCESSOR_FILE_PERFORMANCE, S_IFREG | S_IRUGO, acpi_device_dir(device), &acpi_processor_perf_fops, acpi_driver_data(device)); return; }
static void acpi_cpufreq_remove_file(struct acpi_processor *pr) { struct acpi_device *device = NULL; if (acpi_bus_get_device(pr->handle, &device)) return; /* remove file 'performance' */ remove_proc_entry(ACPI_PROCESSOR_FILE_PERFORMANCE, acpi_device_dir(device)); return; }
static int acpi_processor_add_fs(struct acpi_device *device) { struct proc_dir_entry *entry = NULL; if (!acpi_device_dir(device)) { acpi_device_dir(device) = proc_mkdir(acpi_device_bid(device), acpi_processor_dir); if (!acpi_device_dir(device)) return -ENODEV; } acpi_device_dir(device)->owner = THIS_MODULE; /* 'info' [R] */ entry = create_proc_entry(ACPI_PROCESSOR_FILE_INFO, S_IRUGO, acpi_device_dir(device)); if (!entry) return -EIO; else { entry->proc_fops = &acpi_processor_info_fops; entry->data = acpi_driver_data(device); entry->owner = THIS_MODULE; } /* 'throttling' [R/W] */ entry = create_proc_entry(ACPI_PROCESSOR_FILE_THROTTLING, S_IFREG | S_IRUGO | S_IWUSR, acpi_device_dir(device)); if (!entry) return -EIO; else { entry->proc_fops = &acpi_processor_throttling_fops; entry->data = acpi_driver_data(device); entry->owner = THIS_MODULE; } /* 'limit' [R/W] */ entry = create_proc_entry(ACPI_PROCESSOR_FILE_LIMIT, S_IFREG | S_IRUGO | S_IWUSR, acpi_device_dir(device)); if (!entry) return -EIO; else { entry->proc_fops = &acpi_processor_limit_fops; entry->data = acpi_driver_data(device); entry->owner = THIS_MODULE; } return 0; }
static int acpi_battery_add_fs(struct acpi_device *device) { struct proc_dir_entry *entry = NULL; if (!acpi_device_dir(device)) { acpi_device_dir(device) = proc_mkdir(acpi_device_bid(device), acpi_battery_dir); if (!acpi_device_dir(device)) return -ENODEV; acpi_device_dir(device)->owner = THIS_MODULE; } /* 'info' [R] */ entry = create_proc_entry(ACPI_BATTERY_FILE_INFO, S_IRUGO, acpi_device_dir(device)); if (!entry) return -ENODEV; else { entry->proc_fops = &acpi_battery_info_ops; entry->data = acpi_driver_data(device); entry->owner = THIS_MODULE; } /* 'status' [R] */ entry = create_proc_entry(ACPI_BATTERY_FILE_STATUS, S_IRUGO, acpi_device_dir(device)); if (!entry) return -ENODEV; else { entry->proc_fops = &acpi_battery_state_ops; entry->data = acpi_driver_data(device); entry->owner = THIS_MODULE; } /* 'alarm' [R/W] */ entry = create_proc_entry(ACPI_BATTERY_FILE_ALARM, S_IFREG | S_IRUGO | S_IWUSR, acpi_device_dir(device)); if (!entry) return -ENODEV; else { entry->proc_fops = &acpi_battery_alarm_ops; entry->data = acpi_driver_data(device); entry->owner = THIS_MODULE; } return 0; }
static void acpi_cpufreq_add_file(struct acpi_processor *pr) { struct proc_dir_entry *entry = NULL; struct acpi_device *device = NULL; if (acpi_bus_get_device(pr->handle, &device)) return; /* add file 'performance' [R/W] */ entry = create_proc_entry(ACPI_PROCESSOR_FILE_PERFORMANCE, S_IFREG | S_IRUGO, acpi_device_dir(device)); if (entry){ entry->proc_fops = &acpi_processor_perf_fops; entry->data = acpi_driver_data(device); entry->owner = THIS_MODULE; } return; }
static int acpi_thermal_remove_fs ( struct acpi_device *device) { ACPI_FUNCTION_TRACE("acpi_thermal_remove_fs"); if (acpi_device_dir(device)) { remove_proc_entry(ACPI_THERMAL_FILE_POLLING_FREQ, acpi_device_dir(device)); remove_proc_entry(ACPI_THERMAL_FILE_COOLING_MODE, acpi_device_dir(device)); remove_proc_entry(ACPI_THERMAL_FILE_TRIP_POINTS, acpi_device_dir(device)); remove_proc_entry(ACPI_THERMAL_FILE_TEMPERATURE, acpi_device_dir(device)); remove_proc_entry(ACPI_THERMAL_FILE_STATE, acpi_device_dir(device)); remove_proc_entry(acpi_device_bid(device), acpi_thermal_dir); acpi_device_dir(device) = NULL; } return_VALUE(0); }
static int acpi_processor_add_fs(struct acpi_device *device) { struct proc_dir_entry *entry = NULL; if (!acpi_device_dir(device)) { acpi_device_dir(device) = proc_mkdir(acpi_device_bid(device), acpi_processor_dir); if (!acpi_device_dir(device)) return -ENODEV; } /* 'info' [R] */ entry = proc_create_data(ACPI_PROCESSOR_FILE_INFO, S_IRUGO, acpi_device_dir(device), &acpi_processor_info_fops, acpi_driver_data(device)); if (!entry) return -EIO; /* 'throttling' [R/W] */ entry = proc_create_data(ACPI_PROCESSOR_FILE_THROTTLING, S_IFREG | S_IRUGO | S_IWUSR, acpi_device_dir(device), &acpi_processor_throttling_fops, acpi_driver_data(device)); if (!entry) return -EIO; /* 'limit' [R/W] */ entry = proc_create_data(ACPI_PROCESSOR_FILE_LIMIT, S_IFREG | S_IRUGO | S_IWUSR, acpi_device_dir(device), &acpi_processor_limit_fops, acpi_driver_data(device)); if (!entry) return -EIO; return 0; }
static int acpi_thermal_add_fs ( struct acpi_device *device) { struct proc_dir_entry *entry = NULL; ACPI_FUNCTION_TRACE("acpi_thermal_add_fs"); if (!acpi_device_dir(device)) { acpi_device_dir(device) = proc_mkdir(acpi_device_bid(device), acpi_thermal_dir); if (!acpi_device_dir(device)) return_VALUE(-ENODEV); } /* 'state' [R] */ entry = create_proc_entry(ACPI_THERMAL_FILE_STATE, S_IRUGO, acpi_device_dir(device)); if (!entry) ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Unable to create '%s' fs entry\n", ACPI_THERMAL_FILE_STATE)); else { entry->read_proc = acpi_thermal_read_state; entry->data = acpi_driver_data(device); } /* 'temperature' [R] */ entry = create_proc_entry(ACPI_THERMAL_FILE_TEMPERATURE, S_IRUGO, acpi_device_dir(device)); if (!entry) ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Unable to create '%s' fs entry\n", ACPI_THERMAL_FILE_TEMPERATURE)); else { entry->read_proc = acpi_thermal_read_temperature; entry->data = acpi_driver_data(device); } /* 'trip_points' [R/W] */ entry = create_proc_entry(ACPI_THERMAL_FILE_TRIP_POINTS, S_IFREG|S_IRUGO|S_IWUSR, acpi_device_dir(device)); if (!entry) ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Unable to create '%s' fs entry\n", ACPI_THERMAL_FILE_POLLING_FREQ)); else { entry->read_proc = acpi_thermal_read_trip_points; entry->write_proc = acpi_thermal_write_trip_points; entry->data = acpi_driver_data(device); } /* 'cooling_mode' [R/W] */ entry = create_proc_entry(ACPI_THERMAL_FILE_COOLING_MODE, S_IFREG|S_IRUGO|S_IWUSR, acpi_device_dir(device)); if (!entry) ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Unable to create '%s' fs entry\n", ACPI_THERMAL_FILE_COOLING_MODE)); else { entry->read_proc = acpi_thermal_read_cooling_mode; entry->write_proc = acpi_thermal_write_cooling_mode; entry->data = acpi_driver_data(device); } /* 'polling_frequency' [R/W] */ entry = create_proc_entry(ACPI_THERMAL_FILE_POLLING_FREQ, S_IFREG|S_IRUGO|S_IWUSR, acpi_device_dir(device)); if (!entry) ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Unable to create '%s' fs entry\n", ACPI_THERMAL_FILE_POLLING_FREQ)); else { entry->read_proc = acpi_thermal_read_polling; entry->write_proc = acpi_thermal_write_polling; entry->data = acpi_driver_data(device); } return_VALUE(0); }
static int acpi_button_add_fs ( struct acpi_device *device) { struct proc_dir_entry *entry = NULL; struct acpi_button *button = NULL; ACPI_FUNCTION_TRACE("acpi_button_add_fs"); if (!device || !acpi_driver_data(device)) return_VALUE(-EINVAL); button = acpi_driver_data(device); switch (button->type) { case ACPI_BUTTON_TYPE_POWER: case ACPI_BUTTON_TYPE_POWERF: entry = proc_mkdir(ACPI_BUTTON_SUBCLASS_POWER, acpi_button_dir); break; case ACPI_BUTTON_TYPE_SLEEP: case ACPI_BUTTON_TYPE_SLEEPF: entry = proc_mkdir(ACPI_BUTTON_SUBCLASS_SLEEP, acpi_button_dir); break; case ACPI_BUTTON_TYPE_LID: entry = proc_mkdir(ACPI_BUTTON_SUBCLASS_LID, acpi_button_dir); break; } acpi_device_dir(device) = proc_mkdir(acpi_device_bid(device), entry); if (!acpi_device_dir(device)) return_VALUE(-ENODEV); /* 'info' [R] */ entry = create_proc_entry(ACPI_BUTTON_FILE_INFO, S_IRUGO, acpi_device_dir(device)); if (!entry) ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Unable to create '%s' fs entry\n", ACPI_BUTTON_FILE_INFO)); else { entry->read_proc = acpi_button_read_info; entry->data = acpi_driver_data(device); } if (button->type==ACPI_BUTTON_TYPE_LID){ /* 'state' [R] */ entry = create_proc_entry(ACPI_BUTTON_FILE_STATE, S_IRUGO, acpi_device_dir(device)); if (!entry) ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Unable to create '%s' fs entry\n", ACPI_BUTTON_FILE_STATE)); else { entry->read_proc = acpi_button_lid_read_state; entry->data = acpi_driver_data(device); } } return_VALUE(0); }
static int acpi_system_add_fs ( struct acpi_device *device) { struct proc_dir_entry *entry = NULL; ACPI_FUNCTION_TRACE("acpi_system_add_fs"); if (!device) return_VALUE(-EINVAL); /* 'info' [R] */ entry = create_proc_entry(ACPI_SYSTEM_FILE_INFO, S_IRUGO, acpi_device_dir(device)); if (!entry) ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Unable to create '%s' fs entry\n", ACPI_SYSTEM_FILE_INFO)); else { entry->read_proc = acpi_system_read_info; entry->data = acpi_driver_data(device); } /* 'dsdt' [R] */ entry = create_proc_entry(ACPI_SYSTEM_FILE_DSDT, S_IRUSR, acpi_device_dir(device)); if (!entry) ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Unable to create '%s' fs entry\n", ACPI_SYSTEM_FILE_DSDT)); else entry->proc_fops = &acpi_system_dsdt_ops; /* 'fadt' [R] */ entry = create_proc_entry(ACPI_SYSTEM_FILE_FADT, S_IRUSR, acpi_device_dir(device)); if (!entry) ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Unable to create '%s' fs entry\n", ACPI_SYSTEM_FILE_FADT)); else entry->proc_fops = &acpi_system_fadt_ops; /* 'event' [R] */ entry = create_proc_entry(ACPI_SYSTEM_FILE_EVENT, S_IRUSR, acpi_device_dir(device)); if (!entry) ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Unable to create '%s' fs entry\n", ACPI_SYSTEM_FILE_EVENT)); else entry->proc_fops = &acpi_system_event_ops; #ifdef CONFIG_ACPI_SLEEP /* 'sleep' [R/W]*/ entry = create_proc_entry(ACPI_SYSTEM_FILE_SLEEP, S_IFREG|S_IRUGO|S_IWUSR, acpi_device_dir(device)); if (!entry) ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Unable to create '%s' fs entry\n", ACPI_SYSTEM_FILE_SLEEP)); else { entry->read_proc = acpi_system_read_sleep; entry->write_proc = acpi_system_write_sleep; entry->data = acpi_driver_data(device); } /* 'alarm' [R/W] */ entry = create_proc_entry(ACPI_SYSTEM_FILE_ALARM, S_IFREG|S_IRUGO|S_IWUSR, acpi_device_dir(device)); if (!entry) ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Unable to create '%s' fs entry\n", ACPI_SYSTEM_FILE_ALARM)); else { entry->read_proc = acpi_system_read_alarm; entry->write_proc = acpi_system_write_alarm; entry->data = acpi_driver_data(device); } #endif /*CONFIG_ACPI_SLEEP*/ #ifdef ACPI_DEBUG_OUTPUT /* 'debug_layer' [R/W] */ entry = create_proc_entry(ACPI_SYSTEM_FILE_DEBUG_LAYER, S_IFREG|S_IRUGO|S_IWUSR, acpi_device_dir(device)); if (!entry) ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Unable to create '%s' fs entry\n", ACPI_SYSTEM_FILE_DEBUG_LAYER)); else { entry->read_proc = acpi_system_read_debug; entry->write_proc = acpi_system_write_debug; entry->data = (void *) 0; } /* 'debug_level' [R/W] */ entry = create_proc_entry(ACPI_SYSTEM_FILE_DEBUG_LEVEL, S_IFREG|S_IRUGO|S_IWUSR, acpi_device_dir(device)); if (!entry) ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Unable to create '%s' fs entry\n", ACPI_SYSTEM_FILE_DEBUG_LEVEL)); else { entry->read_proc = acpi_system_read_debug; entry->write_proc = acpi_system_write_debug; entry->data = (void *) 1; } #endif /*ACPI_DEBUG_OUTPUT */ return_VALUE(0); }
int __cpuinit acpi_processor_power_init(struct acpi_processor *pr, struct acpi_device *device) { acpi_status status = 0; static int first_run; #ifdef CONFIG_ACPI_PROCFS struct proc_dir_entry *entry = NULL; #endif if (boot_option_idle_override) return 0; if (!first_run) { if (idle_halt) { /* * When the boot option of "idle=halt" is added, halt * is used for CPU IDLE. * In such case C2/C3 is meaningless. So the max_cstate * is set to one. */ max_cstate = 1; } dmi_check_system(processor_power_dmi_table); max_cstate = acpi_processor_cstate_check(max_cstate); if (max_cstate < ACPI_C_STATES_MAX) printk(KERN_NOTICE "ACPI: processor limited to max C-state %d\n", max_cstate); first_run++; } if (!pr) return -EINVAL; if (acpi_gbl_FADT.cst_control && !nocst) { status = acpi_os_write_port(acpi_gbl_FADT.smi_command, acpi_gbl_FADT.cst_control, 8); if (ACPI_FAILURE(status)) { ACPI_EXCEPTION((AE_INFO, status, "Notifying BIOS of _CST ability failed")); } } acpi_processor_get_power_info(pr); pr->flags.power_setup_done = 1; /* * Install the idle handler if processor power management is supported. * Note that we use previously set idle handler will be used on * platforms that only support C1. */ if (pr->flags.power) { acpi_processor_setup_cpuidle(pr); if (cpuidle_register_device(&pr->power.dev)) return -EIO; } #ifdef CONFIG_ACPI_PROCFS /* 'power' [R] */ entry = proc_create_data(ACPI_PROCESSOR_FILE_POWER, S_IRUGO, acpi_device_dir(device), &acpi_processor_power_fops, acpi_driver_data(device)); if (!entry) return -EIO; #endif return 0; }