From patchwork Mon Jul 6 05:47:26 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gavin Shan X-Patchwork-Id: 11644877 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id CE4AC60D for ; Mon, 6 Jul 2020 05:50:37 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id A686B206E6 for ; Mon, 6 Jul 2020 05:50:37 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="cJaH0Oqd"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="ToikbCAf" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org A686B206E6 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To:Message-Id:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=HBM5NMwXZSqO7ZciA20Dfhkbps5Lf9wXP1hre0Np91g=; b=cJaH0OqdFtfi+sxqL7Oppge9r BRAHVhGKfMII8Nt0/4dg4VWpM/0uFPHVIhY+NJrw2mQuA74Bg6eY5F53o6FeqmGWSRfFxnJOIvWN2 FdyUfRBt97b3wHKH8BX4dXNp7LUEVFOxonAkt8z3Jp0JCdGNkEHAfZulGGV476p4ytKS/Z4l7A4e/ 6IUBgCC0OjXocCuQjFqvxUmlHJ8TV0/5HBxYX9kZJdP+l0DJ1yWV6q45oahOy004IXTM3wot0OJUr kQb/siMGXXcJQ9q10uTsCloWTnI/uNeifALNdPQ4FJjJDDcPqcgjetsM3okG2VgUNt8veBBgC9cp6 A4KaxUnrQ==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jsJzb-0003jp-4B; Mon, 06 Jul 2020 05:48:39 +0000 Received: from us-smtp-2.mimecast.com ([205.139.110.61] helo=us-smtp-delivery-1.mimecast.com) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jsJzE-0003bS-7U for linux-arm-kernel@lists.infradead.org; Mon, 06 Jul 2020 05:48:17 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1594014495; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=8ibpLY/Xa6vfyDyYqc8TXqwLLLzPrbQBsdtjZP1M5oY=; b=ToikbCAfBp/pRHr1P3l8L/BtfogM2cGJWfx2P3TmLEQqHuHgn0qdYyHhkwJ8PsWkfrHsOL +Wk6zLu/K9t/DUZUlFkbmcy4+YleYeYGoDHD6+jGcsAsUMtG53vOc1q2JL2GkH00Eb7GRl 3XYRG2OJwZGY1ODXIMjzGh4ybrCWChc= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-190-sxSbdTGuM9KPjMBSWqNhMg-1; Mon, 06 Jul 2020 01:48:11 -0400 X-MC-Unique: sxSbdTGuM9KPjMBSWqNhMg-1 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 7EFFE80183C; Mon, 6 Jul 2020 05:48:10 +0000 (UTC) Received: from localhost.localdomain.com (vpn2-54-159.bne.redhat.com [10.64.54.159]) by smtp.corp.redhat.com (Postfix) with ESMTP id 6AD25C0DBA; Mon, 6 Jul 2020 05:48:08 +0000 (UTC) From: Gavin Shan To: linux-arm-kernel@lists.infradead.org Subject: [PATCH 08/14] drivers/firmware/sdei: Cleanup on cross call functions Date: Mon, 6 Jul 2020 15:47:26 +1000 Message-Id: <20200706054732.99387-9-gshan@redhat.com> In-Reply-To: <20200706054732.99387-1-gshan@redhat.com> References: <20200706054732.99387-1-gshan@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=gshan@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200706_014816_360822_5EC8C80F X-CRM114-Status: GOOD ( 12.20 ) X-Spam-Score: -0.2 (/) X-Spam-Report: SpamAssassin version 3.4.4 on merlin.infradead.org summary: Content analysis details: (-0.2 points) pts rule name description ---- ---------------------- -------------------------------------------------- 0.0 RCVD_IN_MSPIKE_H3 RBL: Good reputation (+3) [205.139.110.61 listed in wl.mailspike.net] -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [205.139.110.61 listed in list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid 0.0 RCVD_IN_MSPIKE_WL Mailspike good senders -0.0 DKIMWL_WL_HIGH DKIMwl.org - Whitelisted High sender X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: mark.rutland@arm.com, will@kernel.org, james.morse@arm.com, shan.gavin@gmail.com, catalin.marinas@arm.com Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org 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 --- drivers/firmware/arm_sdei.c | 29 ++++++++++++++++------------- 1 file changed, 16 insertions(+), 13 deletions(-) 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) {