Lines Matching +full:power +full:- +full:friendly
1 // SPDX-License-Identifier: GPL-2.0
3 * Common methods for use with hp-bioscfg driver
43 return -EINVAL; in hp_get_integer_from_buffer()
47 *buffer_size -= sizeof(int); in hp_get_integer_from_buffer()
62 return -EINVAL; in hp_get_string_from_buffer()
72 return -EINVAL; in hp_get_string_from_buffer()
87 conv_dst_size = dst_size - 1; in hp_get_string_from_buffer()
90 * convert from UTF-16 unicode to ASCII in hp_get_string_from_buffer()
119 *buffer_size -= size * sizeof(u16); in hp_get_string_from_buffer()
131 ret = hp_get_string_from_buffer(buffer_ptr, buffer_size, common_data->path, in hp_get_common_data_from_buffer()
132 sizeof(common_data->path)); in hp_get_common_data_from_buffer()
138 &common_data->is_readonly); in hp_get_common_data_from_buffer()
144 &common_data->display_in_ui); in hp_get_common_data_from_buffer()
150 &common_data->requires_physical_presence); in hp_get_common_data_from_buffer()
156 &common_data->sequence); in hp_get_common_data_from_buffer()
162 &common_data->prerequisites_size); in hp_get_common_data_from_buffer()
166 if (common_data->prerequisites_size > MAX_PREREQUISITES_SIZE) { in hp_get_common_data_from_buffer()
169 common_data->prerequisites_size = MAX_PREREQUISITES_SIZE; in hp_get_common_data_from_buffer()
173 for (reqs = 0; reqs < common_data->prerequisites_size; reqs++) { in hp_get_common_data_from_buffer()
175 common_data->prerequisites[reqs], in hp_get_common_data_from_buffer()
176 sizeof(common_data->prerequisites[reqs])); in hp_get_common_data_from_buffer()
183 &common_data->security_level); in hp_get_common_data_from_buffer()
195 if (p == buf + count - 1) in hp_enforce_single_line_input()
198 return -EINVAL; /* enforce single line input */ in hp_enforce_single_line_input()
207 kobject_uevent(&bioscfg_drv.class_dev->kobj, KOBJ_CHANGE); in hp_set_reboot_and_signal_event()
211 * hp_calculate_string_buffer() - determines size of string buffer for
240 ret = -EINVAL; in hp_wmi_error_and_message()
244 ret = -EINVAL; in hp_wmi_error_and_message()
248 ret = -EOPNOTSUPP; in hp_wmi_error_and_message()
252 ret = -EINVAL; in hp_wmi_error_and_message()
256 ret = -EINVAL; in hp_wmi_error_and_message()
260 ret = -EINVAL; in hp_wmi_error_and_message()
264 ret = -EACCES; in hp_wmi_error_and_message()
268 ret = -EACCES; in hp_wmi_error_and_message()
272 ret = -EACCES; in hp_wmi_error_and_message()
276 ret = -EIO; in hp_wmi_error_and_message()
280 ret = -EACCES; in hp_wmi_error_and_message()
284 ret = -EINVAL; in hp_wmi_error_and_message()
288 ret = -EINVAL; in hp_wmi_error_and_message()
292 ret = -EIO; in hp_wmi_error_and_message()
296 ret = -EINVAL; in hp_wmi_error_and_message()
300 ret = -EPERM; in hp_wmi_error_and_message()
304 ret = -EPERM; in hp_wmi_error_and_message()
308 ret = -EINPROGRESS; in hp_wmi_error_and_message()
312 ret = -EPERM; in hp_wmi_error_and_message()
316 ret = -EPERM; in hp_wmi_error_and_message()
320 ret = -EINVAL; in hp_wmi_error_and_message()
324 ret = -EINVAL; in hp_wmi_error_and_message()
328 ret = -EIO; in hp_wmi_error_and_message()
348 * create_attributes_level_sysfs_files() - Creates pending_reboot attributes
352 return sysfs_create_file(&bioscfg_drv.main_dir_kset->kobj, in create_attributes_level_sysfs_files()
367 * hp_get_wmiobj_pointer() - Get Content of WMI block for particular instance
385 * hp_get_instance_count() - Compute total number of instances under guid_string
401 * hp_alloc_attributes_data() - Allocate attributes data for a particular type
438 return -EINVAL; in hp_convert_hexstr_to_str()
445 return -ENOMEM; in hp_convert_hexstr_to_str()
475 ret = -ENOMEM; in hp_convert_hexstr_to_str()
477 ret = -EFAULT; in hp_convert_hexstr_to_str()
489 return -EINVAL; in hp_encode_outsize_for_pvsz()
502 * Update friendly display name for several attributes associated to
503 * 'Schedule Power-On'
509 snprintf(attr_display, attr_size, "%s - %s", SCHEDULE_POWER_ON, attr_name); in hp_friendly_user_name_update()
515 * hp_update_attribute_permissions() - Update attributes permissions when
524 current_val->attr.mode = is_readonly ? 0444 : 0644; in hp_update_attribute_permissions()
528 * destroy_attribute_objs() - Free a kset of kobjects
537 list_for_each_entry_safe(pos, next, &kset->list, entry) in destroy_attribute_objs()
542 * release_attributes_data() - Clean-up all sysfs directories and files created
562 sysfs_remove_file(&bioscfg_drv.main_dir_kset->kobj, &pending_reboot.attr); in release_attributes_data()
571 * hp_add_other_attributes() - Initialize HP custom attributes not
591 return -ENOMEM; in hp_add_other_attributes()
598 attr_name_kobj->kset = bioscfg_drv.authentication_dir_kset; in hp_add_other_attributes()
603 attr_name_kobj->kset = bioscfg_drv.main_dir_kset; in hp_add_other_attributes()
609 ret = -EINVAL; in hp_add_other_attributes()
632 ret = -EINVAL; in hp_add_other_attributes()
662 if (obj->package.count < min_elements) { in hp_init_bios_package_attribute()
663 pr_err("ACPI-package does not have enough elements: %d < %d\n", in hp_init_bios_package_attribute()
664 obj->package.count, min_elements); in hp_init_bios_package_attribute()
668 elements = obj->package.elements; in hp_init_bios_package_attribute()
700 pr_debug("Duplicate attribute name found - %s\n", str_value); in hp_init_bios_package_attribute()
709 ret = -ENOMEM; in hp_init_bios_package_attribute()
713 attr_name_kobj->kset = temp_kset; in hp_init_bios_package_attribute()
775 buffer_size = obj->buffer.length; in hp_init_bios_buffer_attribute()
776 buffer_ptr = obj->buffer.pointer; in hp_init_bios_buffer_attribute()
793 pr_debug("Duplicate attribute name found - %s\n", str); in hp_init_bios_buffer_attribute()
802 ret = -ENOMEM; in hp_init_bios_buffer_attribute()
806 attr_name_kobj->kset = temp_kset; in hp_init_bios_buffer_attribute()
862 * hp_init_bios_attributes() - Initialize all attributes for a type
904 return -EINVAL; in hp_init_bios_attributes()
910 return -ENODEV; in hp_init_bios_attributes()
915 if (obj->type == ACPI_TYPE_PACKAGE) { in hp_init_bios_attributes()
920 } else if (obj->type == ACPI_TYPE_BUFFER) { in hp_init_bios_attributes()
926 pr_err("Expected ACPI-package or buffer type, got: %d\n", in hp_init_bios_attributes()
927 obj->type); in hp_init_bios_attributes()
928 ret = -EIO; in hp_init_bios_attributes()
957 pr_err("Unable to run on non-HP system\n"); in hp_init()
958 return -ENODEV; in hp_init()
963 return -ENODEV; in hp_init()
978 &bioscfg_drv.class_dev->kobj); in hp_init()
980 ret = -ENOMEM; in hp_init()
986 &bioscfg_drv.class_dev->kobj); in hp_init()
988 ret = -ENOMEM; in hp_init()
995 * - pending_reboot in hp_init()