* [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[parent not found: <20180122141709.41898-1-andriy.shevchenko-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>]
* Re: [PATCH v1] efi/apple-properties: Device core takes care of empty properties [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> 0 siblings, 1 reply; 3+ messages in thread From: Lukas Wunner @ 2018-01-22 21:46 UTC (permalink / raw) To: Andy Shevchenko; +Cc: Ard Biesheuvel, linux-efi-u79uwXL29TY76Z2rM5mHXA On Mon, Jan 22, 2018 at 04:17:09PM +0200, Andy Shevchenko wrote: > 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: Reviewed-and-tested-by: Lukas Wunner <lukas-JFq808J9C/izQB+pC5nmwQ@public.gmane.org> Thanks Andy! Ard, could you pick this up please? Kind regards, Lukas ^ permalink raw reply [flat|nested] 3+ messages in thread
[parent not found: <20180122214609.GA18579-JFq808J9C/izQB+pC5nmwQ@public.gmane.org>]
* Re: [PATCH v1] efi/apple-properties: Device core takes care of empty properties [not found] ` <20180122214609.GA18579-JFq808J9C/izQB+pC5nmwQ@public.gmane.org> @ 2018-01-23 18:50 ` Ard Biesheuvel 0 siblings, 0 replies; 3+ messages in thread From: Ard Biesheuvel @ 2018-01-23 18:50 UTC (permalink / raw) To: Lukas Wunner; +Cc: Andy Shevchenko, linux-efi-u79uwXL29TY76Z2rM5mHXA On 22 January 2018 at 21:46, Lukas Wunner <lukas-JFq808J9C/izQB+pC5nmwQ@public.gmane.org> wrote: > On Mon, Jan 22, 2018 at 04:17:09PM +0200, Andy Shevchenko wrote: >> 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: > > Reviewed-and-tested-by: Lukas Wunner <lukas-JFq808J9C/izQB+pC5nmwQ@public.gmane.org> > > Thanks Andy! Ard, could you pick this up please? > Applied, thanks. ^ permalink raw reply [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