[08/14] drivers/firmware/sdei: Cleanup on cross call functions
diff mbox series

Message ID 20200706054732.99387-9-gshan@redhat.com
State New
Headers show
Series
  • Refactor SDEI client driver
Related show

Commit Message

Gavin Shan July 6, 2020, 5:47 a.m. UTC
This applies cleanup on the corss call functions, no functional
changes is introduced:

   * Cleanup struct sdei_crosscall_arg to use tab between fields
     and their types.
   * Move sdei_cross_call_return() ahead of sdei_do_cross_call().
   * Refactor CROSSCALL_INIT to use "do { ... } while (0)".

Signed-off-by: Gavin Shan <gshan@redhat.com>
---
 drivers/firmware/arm_sdei.c | 29 ++++++++++++++++-------------
 1 file changed, 16 insertions(+), 13 deletions(-)

Patch
diff mbox series

diff --git a/drivers/firmware/arm_sdei.c b/drivers/firmware/arm_sdei.c
index e3efea40df88..3393f1650b20 100644
--- a/drivers/firmware/arm_sdei.c
+++ b/drivers/firmware/arm_sdei.c
@@ -73,14 +73,24 @@  static LIST_HEAD(sdei_list);
 
 /* Private events are registered/enabled via IPI passing one of these */
 struct sdei_crosscall_args {
-	struct sdei_event *event;
-	atomic_t errors;
-	int first_error;
+	struct sdei_event	*event;
+	atomic_t		errors;
+	int			first_error;
 };
 
-#define CROSSCALL_INIT(arg, event)	(arg.event = event, \
-					 arg.first_error = 0, \
-					 atomic_set(&arg.errors, 0))
+#define CROSSCALL_INIT(arg, event)		\
+	do {					\
+		arg.event = event;		\
+		arg.first_error = 0;		\
+		atomic_set(&arg.errors, 0);	\
+	} while (0)
+
+static inline void
+sdei_cross_call_return(struct sdei_crosscall_args *arg, int err)
+{
+	if (err && (atomic_inc_return(&arg->errors) == 1))
+		arg->first_error = err;
+}
 
 static inline int sdei_do_cross_call(void *fn, struct sdei_event * event)
 {
@@ -92,13 +102,6 @@  static inline int sdei_do_cross_call(void *fn, struct sdei_event * event)
 	return arg.first_error;
 }
 
-static inline void
-sdei_cross_call_return(struct sdei_crosscall_args *arg, int err)
-{
-	if (err && (atomic_inc_return(&arg->errors) == 1))
-		arg->first_error = err;
-}
-
 static int sdei_to_linux_errno(unsigned long sdei_err)
 {
 	switch (sdei_err) {