@@ -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) {
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(-)