Lines Matching +full:power +full:- +full:friendly
1 // SPDX-License-Identifier: GPL-2.0
3 * Common methods for use with hp-bioscfg driver
45 return -EINVAL; in hp_get_integer_from_buffer()
49 *buffer_size -= sizeof(int); in hp_get_integer_from_buffer()
64 return -EINVAL; in hp_get_string_from_buffer()
74 return -EINVAL; in hp_get_string_from_buffer()
89 conv_dst_size = dst_size - 1; in hp_get_string_from_buffer()
92 * convert from UTF-16 unicode to ASCII in hp_get_string_from_buffer()
121 *buffer_size -= size * sizeof(u16); in hp_get_string_from_buffer()
133 ret = hp_get_string_from_buffer(buffer_ptr, buffer_size, common_data->path, in hp_get_common_data_from_buffer()
134 sizeof(common_data->path)); in hp_get_common_data_from_buffer()
140 &common_data->is_readonly); in hp_get_common_data_from_buffer()
146 &common_data->display_in_ui); in hp_get_common_data_from_buffer()
152 &common_data->requires_physical_presence); in hp_get_common_data_from_buffer()
158 &common_data->sequence); in hp_get_common_data_from_buffer()
164 &common_data->prerequisites_size); in hp_get_common_data_from_buffer()
168 if (common_data->prerequisites_size > MAX_PREREQUISITES_SIZE) { in hp_get_common_data_from_buffer()
171 common_data->prerequisites_size = MAX_PREREQUISITES_SIZE; in hp_get_common_data_from_buffer()
175 for (reqs = 0; reqs < common_data->prerequisites_size; reqs++) { in hp_get_common_data_from_buffer()
177 common_data->prerequisites[reqs], in hp_get_common_data_from_buffer()
178 sizeof(common_data->prerequisites[reqs])); in hp_get_common_data_from_buffer()
185 &common_data->security_level); in hp_get_common_data_from_buffer()
197 if (p == buf + count - 1) in hp_enforce_single_line_input()
200 return -EINVAL; /* enforce single line input */ in hp_enforce_single_line_input()
209 kobject_uevent(&bioscfg_drv.class_dev->kobj, KOBJ_CHANGE); in hp_set_reboot_and_signal_event()
213 * hp_calculate_string_buffer() - determines size of string buffer for
242 ret = -EINVAL; in hp_wmi_error_and_message()
246 ret = -EINVAL; in hp_wmi_error_and_message()
250 ret = -EOPNOTSUPP; in hp_wmi_error_and_message()
254 ret = -EINVAL; in hp_wmi_error_and_message()
258 ret = -EINVAL; in hp_wmi_error_and_message()
262 ret = -EINVAL; in hp_wmi_error_and_message()
266 ret = -EACCES; in hp_wmi_error_and_message()
270 ret = -EACCES; in hp_wmi_error_and_message()
274 ret = -EACCES; in hp_wmi_error_and_message()
278 ret = -EIO; in hp_wmi_error_and_message()
282 ret = -EACCES; in hp_wmi_error_and_message()
286 ret = -EINVAL; in hp_wmi_error_and_message()
290 ret = -EINVAL; in hp_wmi_error_and_message()
294 ret = -EIO; in hp_wmi_error_and_message()
298 ret = -EINVAL; in hp_wmi_error_and_message()
302 ret = -EPERM; in hp_wmi_error_and_message()
306 ret = -EPERM; in hp_wmi_error_and_message()
310 ret = -EINPROGRESS; in hp_wmi_error_and_message()
314 ret = -EPERM; in hp_wmi_error_and_message()
318 ret = -EPERM; in hp_wmi_error_and_message()
322 ret = -EINVAL; in hp_wmi_error_and_message()
326 ret = -EINVAL; in hp_wmi_error_and_message()
330 ret = -EIO; in hp_wmi_error_and_message()
350 * create_attributes_level_sysfs_files() - Creates pending_reboot attributes
354 return sysfs_create_file(&bioscfg_drv.main_dir_kset->kobj, in create_attributes_level_sysfs_files()
369 * hp_get_wmiobj_pointer() - Get Content of WMI block for particular instance
387 * hp_get_instance_count() - Compute total number of instances under guid_string
402 return i - 1; in hp_get_instance_count()
406 * hp_alloc_attributes_data() - Allocate attributes data for a particular type
443 return -EINVAL; in hp_convert_hexstr_to_str()
450 return -ENOMEM; in hp_convert_hexstr_to_str()
480 ret = -ENOMEM; in hp_convert_hexstr_to_str()
482 ret = -EFAULT; in hp_convert_hexstr_to_str()
494 return -EINVAL; in hp_encode_outsize_for_pvsz()
507 * Update friendly display name for several attributes associated to
508 * 'Schedule Power-On'
514 snprintf(attr_display, attr_size, "%s - %s", SCHEDULE_POWER_ON, attr_name); in hp_friendly_user_name_update()
520 * hp_update_attribute_permissions() - Update attributes permissions when
529 current_val->attr.mode = is_readonly ? 0444 : 0644; in hp_update_attribute_permissions()
533 * destroy_attribute_objs() - Free a kset of kobjects
542 list_for_each_entry_safe(pos, next, &kset->list, entry) in destroy_attribute_objs()
547 * release_attributes_data() - Clean-up all sysfs directories and files created
567 sysfs_remove_file(&bioscfg_drv.main_dir_kset->kobj, &pending_reboot.attr); in release_attributes_data()
576 * hp_add_other_attributes() - Initialize HP custom attributes not
596 return -ENOMEM; in hp_add_other_attributes()
603 attr_name_kobj->kset = bioscfg_drv.authentication_dir_kset; in hp_add_other_attributes()
608 attr_name_kobj->kset = bioscfg_drv.main_dir_kset; in hp_add_other_attributes()
614 ret = -EINVAL; in hp_add_other_attributes()
637 ret = -EINVAL; in hp_add_other_attributes()
667 if (obj->package.count < min_elements) { in hp_init_bios_package_attribute()
668 pr_err("ACPI-package does not have enough elements: %d < %d\n", in hp_init_bios_package_attribute()
669 obj->package.count, min_elements); in hp_init_bios_package_attribute()
673 elements = obj->package.elements; in hp_init_bios_package_attribute()
705 pr_debug("Duplicate attribute name found - %s\n", str_value); in hp_init_bios_package_attribute()
714 ret = -ENOMEM; in hp_init_bios_package_attribute()
718 attr_name_kobj->kset = temp_kset; in hp_init_bios_package_attribute()
780 buffer_size = obj->buffer.length; in hp_init_bios_buffer_attribute()
781 buffer_ptr = obj->buffer.pointer; in hp_init_bios_buffer_attribute()
798 pr_debug("Duplicate attribute name found - %s\n", str); in hp_init_bios_buffer_attribute()
807 ret = -ENOMEM; in hp_init_bios_buffer_attribute()
811 attr_name_kobj->kset = temp_kset; in hp_init_bios_buffer_attribute()
867 * hp_init_bios_attributes() - Initialize all attributes for a type
909 return -EINVAL; in hp_init_bios_attributes()
915 return -ENODEV; in hp_init_bios_attributes()
920 if (obj->type == ACPI_TYPE_PACKAGE) { in hp_init_bios_attributes()
925 } else if (obj->type == ACPI_TYPE_BUFFER) { in hp_init_bios_attributes()
931 pr_err("Expected ACPI-package or buffer type, got: %d\n", in hp_init_bios_attributes()
932 obj->type); in hp_init_bios_attributes()
933 ret = -EIO; in hp_init_bios_attributes()
962 pr_err("Unable to run on non-HP system\n"); in hp_init()
963 return -ENODEV; in hp_init()
968 return -ENODEV; in hp_init()
987 &bioscfg_drv.class_dev->kobj); in hp_init()
989 ret = -ENOMEM; in hp_init()
995 &bioscfg_drv.class_dev->kobj); in hp_init()
997 ret = -ENOMEM; in hp_init()
1004 * - pending_reboot in hp_init()