public inbox for linux-efi@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH v1] efi/apple-properties: Device core takes care of empty properties
@ 2018-01-22 14:17 Andy Shevchenko
       [not found] ` <20180122141709.41898-1-andriy.shevchenko-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
  0 siblings, 1 reply; 3+ messages in thread
From: Andy Shevchenko @ 2018-01-22 14:17 UTC (permalink / raw)
  To: Ard Biesheuvel, linux-efi-u79uwXL29TY76Z2rM5mHXA, Lukas Wunner
  Cc: Andy Shevchenko

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.

Signed-off-by: Andy Shevchenko <andriy.shevchenko-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
---
 drivers/firmware/efi/apple-properties.c | 9 +--------
 1 file changed, 1 insertion(+), 8 deletions(-)

diff --git a/drivers/firmware/efi/apple-properties.c b/drivers/firmware/efi/apple-properties.c
index 9f6bcf173b0e..b9602e0d7b50 100644
--- a/drivers/firmware/efi/apple-properties.c
+++ b/drivers/firmware/efi/apple-properties.c
@@ -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);
-- 
2.15.1

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

end of thread, other threads:[~2018-01-23 18:50 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-01-22 14:17 [PATCH v1] efi/apple-properties: Device core takes care of empty properties Andy Shevchenko
     [not found] ` <20180122141709.41898-1-andriy.shevchenko-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
2018-01-22 21:46   ` Lukas Wunner
     [not found]     ` <20180122214609.GA18579-JFq808J9C/izQB+pC5nmwQ@public.gmane.org>
2018-01-23 18:50       ` Ard Biesheuvel

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