mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] hp-bioscfg: Update steps how order list elements are evaluated
@ 2023-08-09 21:07 Jorge Lopez
  2023-08-14  8:41 ` Hans de Goede
  0 siblings, 1 reply; 5+ messages in thread
From: Jorge Lopez @ 2023-08-09 21:07 UTC (permalink / raw)
  To: hdegoede, platform-driver-x86, linux-kernel, thomas,
	ilpo.jarvinen, dan.carpenter

Update steps how order list elements data and elements size are
evaluated

Signed-off-by: Jorge Lopez <jorge.lopez2@hp.com>

---
Based on the latest platform-drivers-x86.git/for-next
---
 .../x86/hp/hp-bioscfg/order-list-attributes.c    | 16 ++++++++++++++--
 1 file changed, 14 insertions(+), 2 deletions(-)

diff --git a/drivers/platform/x86/hp/hp-bioscfg/order-list-attributes.c b/drivers/platform/x86/hp/hp-bioscfg/order-list-attributes.c
index b19644ed12e0..d2b61ab950d4 100644
--- a/drivers/platform/x86/hp/hp-bioscfg/order-list-attributes.c
+++ b/drivers/platform/x86/hp/hp-bioscfg/order-list-attributes.c
@@ -152,7 +152,7 @@ static int hp_populate_ordered_list_elements_from_package(union acpi_object *ord
 
 		switch (order_obj[elem].type) {
 		case ACPI_TYPE_STRING:
-			if (elem != PREREQUISITES && elem != ORD_LIST_ELEMENTS) {
+			if (elem != PREREQUISITES) {
 				ret = hp_convert_hexstr_to_str(order_obj[elem].string.pointer,
 							       order_obj[elem].string.length,
 							       &str_value, &value_len);
@@ -266,6 +266,15 @@ static int hp_populate_ordered_list_elements_from_package(union acpi_object *ord
 			if (ret)
 				goto exit_list;
 
+			/*
+			 * It is expected for the element size value
+			 * to be 1 and not to represent the actual
+			 * number of elements stored in comma
+			 * separated format. element size value is
+			 * recalculated to report the correct number
+			 * of data elements found.
+			 */
+
 			part_tmp = tmpstr;
 			part = strsep(&part_tmp, COMMA_SEP);
 			if (!part)
@@ -273,11 +282,14 @@ static int hp_populate_ordered_list_elements_from_package(union acpi_object *ord
 					tmpstr,
 					sizeof(ordered_list_data->elements[0]));
 
-			for (olist_elem = 1; olist_elem < MAX_ELEMENTS_SIZE && part; olist_elem++) {
+			for (olist_elem = 0; olist_elem < MAX_ELEMENTS_SIZE && part; olist_elem++) {
 				strscpy(ordered_list_data->elements[olist_elem],
 					part,
 					sizeof(ordered_list_data->elements[olist_elem]));
+
 				part = strsep(&part_tmp, COMMA_SEP);
+				if (part && ordered_list_data->elements_size < MAX_ELEMENTS_SIZE)
+					ordered_list_data->elements_size++;
 			}
 
 			kfree(str_value);
-- 
2.34.1


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2023-08-21 14:27 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-08-09 21:07 [PATCH] hp-bioscfg: Update steps how order list elements are evaluated Jorge Lopez
2023-08-14  8:41 ` Hans de Goede
2023-08-14 13:44   ` Jorge Lopez
2023-08-21 11:55     ` Hans de Goede
2023-08-21 14:26       ` Jorge Lopez

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®