Skip to contentSkip to conversation

efi/apple-properties: Device core takes care of empty properties

PATCH Applied Andy Shevchenko 3 participants 3 messages Jan 22, 2018 – Jan 23, 2018 2 messages not in the archive EFI

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 efi/apple-properties: Device core takes care of empty properties

There is no need to artificially supply a property length and fake data if property has type of boolean.

Remove redundant piece of data and code.

---
 drivers/firmware/efi/apple-properties.c | 9 +--------
 1 file changed, 1 insertion(+), 8 deletions(-)
drivers/firmware/efi/apple-properties.c +1 -8
index 9f6bcf173b0e..b9602e0d7b50 100644
@@ -52,8 +52,6 @@ struct properties_header {
 	struct dev_header dev_header[0];
 };
 
-static u8 one __initdata = 1;
-
 static void __init unmarshal_key_value_pairs(struct dev_header *dev_header,
 					     struct device *dev, void *ptr,
 					     struct property_entry entry[])
@@ -95,14 +93,9 @@ static void __init unmarshal_key_value_pairs(struct dev_header *dev_header,
 			     key_len - sizeof(key_len));
 
 		entry[i].name = key;
-		entry[i].is_array = true;
 		entry[i].length = val_len - sizeof(val_len);
+		entry[i].is_array = !!entry[i].length;
 		entry[i].pointer.raw_data = ptr + key_len + sizeof(val_len);
-		if (!entry[i].length) {
-			/* driver core doesn't accept empty properties */
-			entry[i].length = 1;
-			entry[i].pointer.raw_data = &one;
-		}
 
 		if (dump_properties) {
 			dev_info(dev, "property: %s\n", entry[i].name);
Signature · 1 line
2.15.1

A message that is not in the archive (sent off-list or not yet received): 20180122141709.41898-1-andriy.shevchenko-VuQAYsv1563Yd54FQh9/[email protected]

#2 lore raw
Quoted 2 lines · Andy Shevchenko

There is no need to artificially supply a property length and fake data if property has type of boolean.

You're right, I just didn't know better.

I've verified that with this patch applied, boolean properties are still listed with the "dump_apple_properties" command line option and I've also tested that it's still possible to test presence of boolean properties with device_property_present(), so FWIW:

Thanks Andy! Ard, could you pick this up please?

Kind regards,

Lukas

A message that is not in the archive (sent off-list or not yet received): 20180122214609.GA18579-JFq808J9C/[email protected]

#4 lore raw
Quoted 6 lines · Lukas Wunner
Quoted 2 lines · Andy Shevchenko

There is no need to artificially supply a property length and fake data if property has type of boolean.

You're right, I just didn't know better.

Quoted 9 lines

I've verified that with this patch applied, boolean properties are still listed with the "dump_apple_properties" command line option and I've also tested that it's still possible to test presence of boolean properties with device_property_present(), so FWIW:

Thanks Andy! Ard, could you pick this up please?

Applied, thanks.