Lines Matching +full:integer +full:- +full:n

1 // SPDX-License-Identifier: GPL-2.0
3 * Functions corresponding to integer type attributes under
4 * BIOS Enumeration GUID for use with hp-bioscfg driver.
6 * Copyright (c) 2022 Hewlett-Packard Inc.
11 GET_INSTANCE_ID(integer);
18 return -EIO; in current_value_show()
20 return sysfs_emit(buf, "%d\n", in current_value_show()
25 * validate_integer_input() -
38 if (integer_data->common.is_readonly) in validate_integer_input()
39 return -EIO; in validate_integer_input()
45 if (in_val < integer_data->lower_bound || in validate_integer_input()
46 in_val > integer_data->upper_bound) in validate_integer_input()
47 return -ERANGE; in validate_integer_input()
60 integer_data->current_value = in_val; in update_integer_value()
62 pr_warn("Invalid integer value found: %s\n", attr_value); in update_integer_value()
65 ATTRIBUTE_S_COMMON_PROPERTY_SHOW(display_name, integer);
69 ATTRIBUTE_PROPERTY_STORE(current_value, integer);
73 ATTRIBUTE_N_PROPERTY_SHOW(lower_bound, integer);
77 ATTRIBUTE_N_PROPERTY_SHOW(upper_bound, integer);
81 ATTRIBUTE_N_PROPERTY_SHOW(scalar_increment, integer);
88 return sysfs_emit(buf, "integer\n"); in type_show()
117 return -ENOMEM; in hp_alloc_integer_data()
154 return -EINVAL; in hp_populate_integer_elements_from_package()
172 int_value = (u32)integer_obj[elem].integer.value; in hp_populate_integer_elements_from_package()
175 pr_warn("Unsupported object type [%d]\n", integer_obj[elem].type); in hp_populate_integer_elements_from_package()
180 pr_err("Error expected type %d for elem %d, but got type %d instead\n", in hp_populate_integer_elements_from_package()
183 return -EIO; in hp_populate_integer_elements_from_package()
192 integer_data->current_value = int_value; in hp_populate_integer_elements_from_package()
195 strscpy(integer_data->common.path, str_value, in hp_populate_integer_elements_from_package()
196 sizeof(integer_data->common.path)); in hp_populate_integer_elements_from_package()
199 integer_data->common.is_readonly = int_value; in hp_populate_integer_elements_from_package()
202 integer_data->common.display_in_ui = int_value; in hp_populate_integer_elements_from_package()
205 integer_data->common.requires_physical_presence = int_value; in hp_populate_integer_elements_from_package()
208 integer_data->common.sequence = int_value; in hp_populate_integer_elements_from_package()
212 …quisites size value exceeded the maximum number of elements supported or data may be malformed\n"); in hp_populate_integer_elements_from_package()
215 integer_data->common.prerequisites_size = int_value; in hp_populate_integer_elements_from_package()
224 if (integer_data->common.prerequisites_size == 0) in hp_populate_integer_elements_from_package()
228 size = min_t(u32, integer_data->common.prerequisites_size, MAX_PREREQUISITES_SIZE); in hp_populate_integer_elements_from_package()
232 pr_err("Error elem-objects package is too small\n"); in hp_populate_integer_elements_from_package()
233 return -EINVAL; in hp_populate_integer_elements_from_package()
243 strscpy(integer_data->common.prerequisites[reqs], in hp_populate_integer_elements_from_package()
245 sizeof(integer_data->common.prerequisites[reqs])); in hp_populate_integer_elements_from_package()
252 integer_data->common.security_level = int_value; in hp_populate_integer_elements_from_package()
255 integer_data->lower_bound = int_value; in hp_populate_integer_elements_from_package()
258 integer_data->upper_bound = int_value; in hp_populate_integer_elements_from_package()
261 integer_data->scalar_increment = int_value; in hp_populate_integer_elements_from_package()
264 pr_warn("Invalid element: %d found in Integer attribute or data may be malformed\n", elem); in hp_populate_integer_elements_from_package()
277 * hp_populate_integer_package_data() -
278 * Populate all properties of an instance under integer attribute
280 * @integer_obj: ACPI object with integer data
290 integer_data->attr_name_kobj = attr_name_kobj; in hp_populate_integer_package_data()
292 integer_obj->package.count, in hp_populate_integer_package_data()
294 hp_update_attribute_permissions(integer_data->common.is_readonly, in hp_populate_integer_package_data()
296 hp_friendly_user_name_update(integer_data->common.path, in hp_populate_integer_package_data()
297 attr_name_kobj->name, in hp_populate_integer_package_data()
298 integer_data->common.display_name, in hp_populate_integer_package_data()
299 sizeof(integer_data->common.display_name)); in hp_populate_integer_package_data()
313 return -ENOMEM; in hp_populate_integer_elements_from_buffer()
331 integer_data->current_value = 0; in hp_populate_integer_elements_from_buffer()
334 ret = kstrtoint(dst, 10, &integer_data->current_value); in hp_populate_integer_elements_from_buffer()
336 pr_warn("Unable to convert string to integer: %s\n", dst); in hp_populate_integer_elements_from_buffer()
340 ret = hp_get_common_data_from_buffer(&buffer_ptr, buffer_size, &integer_data->common); in hp_populate_integer_elements_from_buffer()
346 &integer_data->lower_bound); in hp_populate_integer_elements_from_buffer()
352 &integer_data->upper_bound); in hp_populate_integer_elements_from_buffer()
358 &integer_data->scalar_increment); in hp_populate_integer_elements_from_buffer()
365 * hp_populate_integer_buffer_data() -
366 * Populate all properties of an instance under integer attribute
379 integer_data->attr_name_kobj = attr_name_kobj; in hp_populate_integer_buffer_data()
381 /* Populate integer elements */ in hp_populate_integer_buffer_data()
387 hp_update_attribute_permissions(integer_data->common.is_readonly, in hp_populate_integer_buffer_data()
389 hp_friendly_user_name_update(integer_data->common.path, in hp_populate_integer_buffer_data()
390 attr_name_kobj->name, in hp_populate_integer_buffer_data()
391 integer_data->common.display_name, in hp_populate_integer_buffer_data()
392 sizeof(integer_data->common.display_name)); in hp_populate_integer_buffer_data()
398 * hp_exit_integer_attributes() - Clear all attribute data