public inbox for linux-efi@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] efi: use typed function pointers for runtime services table
@ 2016-11-23 10:42 Ard Biesheuvel
       [not found] ` <1479897764-29871-1-git-send-email-ard.biesheuvel-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
  0 siblings, 1 reply; 4+ messages in thread
From: Ard Biesheuvel @ 2016-11-23 10:42 UTC (permalink / raw)
  To: linux-efi-u79uwXL29TY76Z2rM5mHXA, dhowells-H+wXaHxf7aLQT0dZR+AlfA
  Cc: mark.rutland-5wv7dgnIgG8, lukas-JFq808J9C/izQB+pC5nmwQ,
	matt-mF/unelCI9GS6iBeEJttW/XRex20P6io, Ard Biesheuvel

Instead of using void pointers, and casting them to correctly typed
function pointers upon use, declare the runtime services pointers
as function pointers using their respective prototypes, for which
typedefs are already available.

Signed-off-by: Ard Biesheuvel <ard.biesheuvel-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
---

Build tested on arm64 only

 include/linux/efi.h | 36 ++++++++++----------
 1 file changed, 18 insertions(+), 18 deletions(-)

diff --git a/include/linux/efi.h b/include/linux/efi.h
index 2d089487d2da..8434be66daba 100644
--- a/include/linux/efi.h
+++ b/include/linux/efi.h
@@ -492,24 +492,6 @@ typedef struct {
 	u64 query_variable_info;
 } efi_runtime_services_64_t;
 
-typedef struct {
-	efi_table_hdr_t hdr;
-	void *get_time;
-	void *set_time;
-	void *get_wakeup_time;
-	void *set_wakeup_time;
-	void *set_virtual_address_map;
-	void *convert_pointer;
-	void *get_variable;
-	void *get_next_variable;
-	void *set_variable;
-	void *get_next_high_mono_count;
-	void *reset_system;
-	void *update_capsule;
-	void *query_capsule_caps;
-	void *query_variable_info;
-} efi_runtime_services_t;
-
 typedef efi_status_t efi_get_time_t (efi_time_t *tm, efi_time_cap_t *tc);
 typedef efi_status_t efi_set_time_t (efi_time_t *tm);
 typedef efi_status_t efi_get_wakeup_time_t (efi_bool_t *enabled, efi_bool_t *pending,
@@ -544,6 +526,24 @@ typedef efi_status_t efi_query_variable_store_t(u32 attributes,
 						unsigned long size,
 						bool nonblocking);
 
+typedef struct {
+	efi_table_hdr_t			hdr;
+	efi_get_time_t			*get_time;
+	efi_set_time_t			*set_time;
+	efi_get_wakeup_time_t		*get_wakeup_time;
+	efi_set_wakeup_time_t		*set_wakeup_time;
+	efi_set_virtual_address_map_t	*set_virtual_address_map;
+	void				*convert_pointer;
+	efi_get_variable_t		*get_variable;
+	efi_get_next_variable_t		*get_next_variable;
+	efi_set_variable_t		*set_variable;
+	efi_get_next_high_mono_count_t	*get_next_high_mono_count;
+	efi_reset_system_t		*reset_system;
+	efi_update_capsule_t		*update_capsule;
+	efi_query_capsule_caps_t	*query_capsule_caps;
+	efi_query_variable_info_t	*query_variable_info;
+} efi_runtime_services_t;
+
 void efi_native_runtime_setup(void);
 
 /*
-- 
2.7.4

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

* Re: [PATCH] efi: use typed function pointers for runtime services table
       [not found] ` <1479897764-29871-1-git-send-email-ard.biesheuvel-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
@ 2016-11-24 21:34   ` Matt Fleming
       [not found]     ` <20161124213451.GA3549-mF/unelCI9GS6iBeEJttW/XRex20P6io@public.gmane.org>
  0 siblings, 1 reply; 4+ messages in thread
From: Matt Fleming @ 2016-11-24 21:34 UTC (permalink / raw)
  To: Ard Biesheuvel
  Cc: linux-efi-u79uwXL29TY76Z2rM5mHXA, dhowells-H+wXaHxf7aLQT0dZR+AlfA,
	mark.rutland-5wv7dgnIgG8, lukas-JFq808J9C/izQB+pC5nmwQ

On Wed, 23 Nov, at 10:42:44AM, Ard Biesheuvel wrote:
> Instead of using void pointers, and casting them to correctly typed
> function pointers upon use, declare the runtime services pointers
> as function pointers using their respective prototypes, for which
> typedefs are already available.
> 
> Signed-off-by: Ard Biesheuvel <ard.biesheuvel-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
> ---
> 
> Build tested on arm64 only

Builds fine for i386, x86-64 and ia64 too.

Reviewed-by: Matt Fleming <matt-mF/unelCI9GS6iBeEJttW/XRex20P6io@public.gmane.org>

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

* Re: [PATCH] efi: use typed function pointers for runtime services table
       [not found]     ` <20161124213451.GA3549-mF/unelCI9GS6iBeEJttW/XRex20P6io@public.gmane.org>
@ 2017-01-02 10:42       ` Lukas Wunner
       [not found]         ` <20170102104255.GA20016-JFq808J9C/izQB+pC5nmwQ@public.gmane.org>
  0 siblings, 1 reply; 4+ messages in thread
From: Lukas Wunner @ 2017-01-02 10:42 UTC (permalink / raw)
  To: Matt Fleming
  Cc: Ard Biesheuvel, linux-efi-u79uwXL29TY76Z2rM5mHXA,
	dhowells-H+wXaHxf7aLQT0dZR+AlfA, mark.rutland-5wv7dgnIgG8

On Thu, Nov 24, 2016 at 09:34:51PM +0000, Matt Fleming wrote:
> On Wed, 23 Nov, at 10:42:44AM, Ard Biesheuvel wrote:
> > Instead of using void pointers, and casting them to correctly typed
> > function pointers upon use, declare the runtime services pointers
> > as function pointers using their respective prototypes, for which
> > typedefs are already available.
> > 
> > Signed-off-by: Ard Biesheuvel <ard.biesheuvel-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
> > ---
> > 
> > Build tested on arm64 only
> 
> Builds fine for i386, x86-64 and ia64 too.
> 
> Reviewed-by: Matt Fleming <matt-mF/unelCI9GS6iBeEJttW/XRex20P6io@public.gmane.org>

This hasn't been applied to efi.git/next yet so I resubmitted as part
of my consification series.  (And I'm afraid I forgot to include your
Reviewed-by, sorry.)

Thanks,

Lukas

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

* Re: [PATCH] efi: use typed function pointers for runtime services table
       [not found]         ` <20170102104255.GA20016-JFq808J9C/izQB+pC5nmwQ@public.gmane.org>
@ 2017-01-04 18:16           ` Ard Biesheuvel
  0 siblings, 0 replies; 4+ messages in thread
From: Ard Biesheuvel @ 2017-01-04 18:16 UTC (permalink / raw)
  To: Lukas Wunner
  Cc: Matt Fleming, linux-efi-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	David Howells, Mark Rutland

On 2 January 2017 at 10:42, Lukas Wunner <lukas-JFq808J9C/izQB+pC5nmwQ@public.gmane.org> wrote:
> On Thu, Nov 24, 2016 at 09:34:51PM +0000, Matt Fleming wrote:
>> On Wed, 23 Nov, at 10:42:44AM, Ard Biesheuvel wrote:
>> > Instead of using void pointers, and casting them to correctly typed
>> > function pointers upon use, declare the runtime services pointers
>> > as function pointers using their respective prototypes, for which
>> > typedefs are already available.
>> >
>> > Signed-off-by: Ard Biesheuvel <ard.biesheuvel-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
>> > ---
>> >
>> > Build tested on arm64 only
>>
>> Builds fine for i386, x86-64 and ia64 too.
>>
>> Reviewed-by: Matt Fleming <matt-mF/unelCI9GS6iBeEJttW/XRex20P6io@public.gmane.org>
>
> This hasn't been applied to efi.git/next yet so I resubmitted as part
> of my consification series.  (And I'm afraid I forgot to include your
> Reviewed-by, sorry.)
>

Given that there are now two series in flight that depend on this
patch, I have pushed it to efi/next (after rebasing it onto
v4.10-rc2), with Matt's Reviewed-by

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

end of thread, other threads:[~2017-01-04 18:16 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-11-23 10:42 [PATCH] efi: use typed function pointers for runtime services table Ard Biesheuvel
     [not found] ` <1479897764-29871-1-git-send-email-ard.biesheuvel-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
2016-11-24 21:34   ` Matt Fleming
     [not found]     ` <20161124213451.GA3549-mF/unelCI9GS6iBeEJttW/XRex20P6io@public.gmane.org>
2017-01-02 10:42       ` Lukas Wunner
     [not found]         ` <20170102104255.GA20016-JFq808J9C/izQB+pC5nmwQ@public.gmane.org>
2017-01-04 18:16           ` Ard Biesheuvel

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