Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp859403imu; Tue, 20 Nov 2018 08:02:50 -0800 (PST) X-Google-Smtp-Source: AFSGD/XsDdovw6WoyEFAviuFYc33wwgg/fatwCLpjcfl6IzS+OegUpcHycvSQMcpMlDIVsyIapsS X-Received: by 2002:a63:5b1f:: with SMTP id p31mr2428908pgb.56.1542729770603; Tue, 20 Nov 2018 08:02:50 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1542729770; cv=none; d=google.com; s=arc-20160816; b=NY1HUJ7yz5NZIorbjv+XaH0gZOdpO1bT3myKqHPgcqzOo2qkbnAcXx7Cpi5hygN02J QlZDShmIOmNGQZ3CC6u0C/l1tlP73k74xdR0CfCLG30aqcLOuogKYROiFX5O1fuJZHdS JEW1Vipro/R2DqfbEUEDaoxE3F9/vP3cDmgQMRGn2OpcwipoorzIStlC3gS2ahojoF9j JK/33IBK9cOkYNLyYg25bKGGa8NarUEnwzuVGxwFizVIjH6Aehdf/I76e7+474Xi70kM sN/c/ucR/RF6PMION5Y0HgGd3kjDyIT4u/2zmWDrZz1g0vIB8BizINF5E25SJf6+ufXb gvqw== 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=yuf0gM55Mw+JD/OyQZY6bfYtaYt96llz+8GysxaKKHgoqu38KP8Dkx1h1gj8WExqy5 Iyi61ByIdH9nFO0bVEmhPXpTgRX8A3S1XnRUJLxL3MKXdc8gX0hW3CvvXUDCc3UzUgjb 2/qNXxqkBuAlX8jrUMARgCAoHPRbp4DKOV4VK10yHOGrVYrV1W1Docp8qikYj0gXS6+t J/sDJrDMGyMDoQs5JOOCJFuhVE2k2SEgHsChVg8xsg2EqFwz89pNbfcwYYOQ1CmQ86MQ cv3R8vYu9hp7BwkoNfv8HbztBMkFKtfcQBlS0/GdyfTcVzwCgOfvo0XTEFJ/Uh1XdKVd 6ZAA== 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 a24si38128433pgd.248.2018.11.20.08.02.33; Tue, 20 Nov 2018 08:02:50 -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 S1729944AbeKUBXn (ORCPT + 99 others); Tue, 20 Nov 2018 20:23:43 -0500 Received: from mx2.suse.de ([195.135.220.15]:39318 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727788AbeKUBXn (ORCPT ); Tue, 20 Nov 2018 20:23:43 -0500 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id 7C6BDAF9F; Tue, 20 Nov 2018 14:54:10 +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: Tue, 20 Nov 2018 15:53:44 +0100 Message-Id: <20181120145351.30390-10-nsaenzjulienne@suse.de> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20181120145351.30390-1-nsaenzjulienne@suse.de> References: <20181120145351.30390-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