Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp6648230imu; Wed, 14 Nov 2018 05:01:56 -0800 (PST) X-Google-Smtp-Source: AJdET5dSDJVZ4ezx7ffRQQ6i6Ieo2OuT5hrj/flS2XSlb6wKqvQcds6amAK4hdiRTbau2p7TDA2G X-Received: by 2002:a62:1a44:: with SMTP id a65mr1936026pfa.30.1542200516196; Wed, 14 Nov 2018 05:01:56 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1542200516; cv=none; d=google.com; s=arc-20160816; b=N48pcronVL8563Wzueeujfa/mYDdPcvAYu0bE7u20BBGy9kriY6zrIqmnvFbxSKZZ5 XqBnNtiQUB5Dw+7oLVkkhKHdxdNzs5qyJ6ROfMeispgcTiL3wo10qi6caBlINCnk38Dt 73BjgNRYuw0HlilhM2B6NQlG8yldo+luIUUjJXGPF7aohbMz5XPIsN8Z9zYgEvgI2ibV iVs0gKI4kQ/3RTQJSmwwEBJZ351Bp0bQsN//hPBpskfjcP3sc+5r+5cLxelB23hr5jhP uA0UGW0qiFUjUFC5KaDIHGirBEUFfQUnkpITKUD9GCD12QQp74M9KGsyogE+/tUMATgQ jdFQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=PtAkbbjE4QIWEfH1rmTGlxzCMRcV7ENI5wCn7mDyDJ8=; b=nO9M2o1MdZDwcFrVouO4CSR9FX0+AtVKpa+3rMo7K1ytArsP3a12AOoimhfS2SW3AA dXs5Ra42Iqxvf0orgx7yZkENhbiN51MvJbYNSTAzhkyEse6Z/89zASbeXHVQFM54W8Ph ZoLvyvc20Yq0Rm9NFLdxSBJGWMNIGLbSsZNewFSmmK/Z4q2JhpQvNIAgWrLKi2r4WADo Tfkhbc7MajF9TOPPDm/mSJNxOq36j5GgHKu7REAk7RX8I+6rtaURP8WfDR9O1HIfEGqa CPxbCNVWjFMORbowS8Y2MklX38j0eDv1nwP/6OB4OzcHisVh2jXGlJQYEqnqyQUXfVOU EGiA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 82si4817009pfa.115.2018.11.14.05.01.39; Wed, 14 Nov 2018 05:01:56 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732932AbeKNXDd (ORCPT + 99 others); Wed, 14 Nov 2018 18:03:33 -0500 Received: from mx2.suse.de ([195.135.220.15]:44634 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1728343AbeKNXDb (ORCPT ); Wed, 14 Nov 2018 18:03:31 -0500 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay1.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id DE62EB0E9; Wed, 14 Nov 2018 13:00:20 +0000 (UTC) From: Nicolas Saenz Julienne To: stefan.wahren@i2se.com, eric@anholt.net, dave.stevenson@raspberrypi.org Cc: linux-rpi-kernel@lists.infradead.org, gregkh@linuxfoundation.org, linux-arm-kernel@lists.infradead.org, devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org, Nicolas Saenz Julienne Subject: [PATCH 09/16] staging: vchiq_core: do not initialize semaphores twice Date: Wed, 14 Nov 2018 13:59:35 +0100 Message-Id: <20181114125942.25163-10-nsaenzjulienne@suse.de> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20181114125942.25163-1-nsaenzjulienne@suse.de> References: <20181114125942.25163-1-nsaenzjulienne@suse.de> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org vchiq_init_state() initialises a series of semaphores to then call remote_event_create() on the same semaphores, which initializes them again. We get rid of the second initialization. Signed-off-by: Nicolas Saenz Julienne --- .../vc04_services/interface/vchiq_arm/vchiq_core.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c index dee5ea7bfe4f..8b23ea5322e8 100644 --- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c +++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c @@ -418,12 +418,11 @@ vchiq_set_conn_state(VCHIQ_STATE_T *state, VCHIQ_CONNSTATE_T newstate) } static inline void -remote_event_create(VCHIQ_STATE_T *state, REMOTE_EVENT_T *event) +remote_event_create(REMOTE_EVENT_T *event) { event->armed = 0; /* Don't clear the 'fired' flag because it may already have been set ** by the other side. */ - sema_init((struct semaphore *)((char *)state + event->event), 0); } static inline int @@ -2237,18 +2236,18 @@ vchiq_init_state(VCHIQ_STATE_T *state, VCHIQ_SLOT_ZERO_T *slot_zero) state->data_quota = state->slot_queue_available - 1; local->trigger.event = offsetof(VCHIQ_STATE_T, trigger_event); - remote_event_create(state, &local->trigger); + remote_event_create(&local->trigger); local->tx_pos = 0; local->recycle.event = offsetof(VCHIQ_STATE_T, recycle_event); - remote_event_create(state, &local->recycle); + remote_event_create(&local->recycle); local->slot_queue_recycle = state->slot_queue_available; local->sync_trigger.event = offsetof(VCHIQ_STATE_T, sync_trigger_event); - remote_event_create(state, &local->sync_trigger); + remote_event_create(&local->sync_trigger); local->sync_release.event = offsetof(VCHIQ_STATE_T, sync_release_event); - remote_event_create(state, &local->sync_release); + remote_event_create(&local->sync_release); /* At start-of-day, the slot is empty and available */ ((VCHIQ_HEADER_T *)SLOT_DATA_FROM_INDEX(state, local->slot_sync))->msgid -- 2.19.1