From patchwork Wed May 27 11:53:41 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nicolas Saenz Julienne X-Patchwork-Id: 11572761 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 3B3BB90 for ; Wed, 27 May 2020 12:08:35 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (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 EF205207D8 for ; Wed, 27 May 2020 12:08:34 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="E5VVz7eQ" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org EF205207D8 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=suse.de 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=bombadil.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=AmCIncIFztoFtUYY6RQOa8Rdo6WktB5TSUir9A8TZSc=; b=E5VVz7eQqQ75uc k0frqIjl/T5xNCiArn0Rm6E/4kRdRHrtqwcAb4Qg7HfjPrDohL42MqlYMrVNPUtG7NSTqURoxx/bz GUAl8B/dq8shjEEbxoBdqhoAs8dTesPgGbmXt9HBCnTGP8UO4XC3CCEuP4+SxuYSeF1O42Sb8VQ/D WphY5g/VyaAjne/shbE9AmCrSkBbVSZhqwayb6lf1oUHTyHBow7t4f7A4/0RWy2uSnaYSuVkfh2iW buliTU+gf5Y4smgLm8W8rlM3XdzaAHEVJ8nqSaRUHhTv1oa78DpShqCdl0s2d1OIMDwfge1Iw9JLg /pf+0xX+mg+w5k29DmtQ==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jdurG-0008Nl-Sd; Wed, 27 May 2020 12:08:30 +0000 Received: from mx2.suse.de ([195.135.220.15]) by bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jdue3-000782-Fv; Wed, 27 May 2020 11:54:54 +0000 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id DF2FAACF2; Wed, 27 May 2020 11:54:51 +0000 (UTC) From: Nicolas Saenz Julienne To: bcm-kernel-feedback-list@broadcom.com, linux-rpi-kernel@lists.infradead.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [RFC 36/50] staging: vchi: Rework vchi_msg_hold() to match vchiq_msg_hold() Date: Wed, 27 May 2020 13:53:41 +0200 Message-Id: <20200527115400.31391-37-nsaenzjulienne@suse.de> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200527115400.31391-1-nsaenzjulienne@suse.de> References: <20200527115400.31391-1-nsaenzjulienne@suse.de> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200527_045451_831204_01040A6A X-CRM114-Status: GOOD ( 13.51 ) X-Spam-Score: -2.3 (--) X-Spam-Report: SpamAssassin version 3.4.4 on bombadil.infradead.org summary: Content analysis details: (-2.3 points) pts rule name description ---- ---------------------- -------------------------------------------------- -2.3 RCVD_IN_DNSWL_MED RBL: Sender listed at https://www.dnswl.org/, medium trust [195.135.220.15 listed in list.dnswl.org] 0.0 RCVD_IN_MSPIKE_H3 RBL: Good reputation (+3) [195.135.220.15 listed in wl.mailspike.net] -0.0 SPF_PASS SPF: sender matches SPF record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record 0.0 RCVD_IN_MSPIKE_WL Mailspike good senders 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: devel@driverdev.osuosl.org, kernel-list@raspberrypi.com, laurent.pinchart@ideasonboard.com, Nicolas Saenz Julienne , gregkh@linuxfoundation.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org The services have access to struct vchiq_header's internals, so we can let them get the data pointer. This pretty much makes both functions exactly the same, which will allow us to make a switch to vchiq_msg_hold() further down the road. Signed-off-by: Nicolas Saenz Julienne --- .../staging/vc04_services/interface/vchi/vchi.h | 5 +---- .../interface/vchiq_arm/vchiq_shim.c | 15 ++------------- .../vc04_services/vc-sm-cma/vc_sm_cma_vchi.c | 9 +++++++-- 3 files changed, 10 insertions(+), 19 deletions(-) diff --git a/drivers/staging/vc04_services/interface/vchi/vchi.h b/drivers/staging/vc04_services/interface/vchi/vchi.h index 72771fdee9d6..59559d4cd5f1 100644 --- a/drivers/staging/vc04_services/interface/vchi/vchi.h +++ b/drivers/staging/vc04_services/interface/vchi/vchi.h @@ -54,10 +54,7 @@ extern int vchi_queue_kernel_message(unsigned handle, void *data, // Routine to look at a message in place. // The message is dequeued, so the caller is left holding it; the descriptor is // filled in and must be released when the user has finished with the message. -extern int32_t vchi_msg_hold(unsigned handle, - void **data, // } may be NULL, as info can be - uint32_t *msg_size, // } obtained from HELD_MSG_T - struct vchiq_header **message); +struct vchiq_header *vchi_msg_hold(unsigned handle); /******************************************************************************* * Global service support API - operations on held messages diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_shim.c b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_shim.c index 6eb9a9878641..fc12b76617d1 100644 --- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_shim.c +++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_shim.c @@ -154,20 +154,9 @@ EXPORT_SYMBOL(vchi_held_msg_release); * Returns: int32_t - success == 0 * ***********************************************************/ -int32_t vchi_msg_hold(unsigned handle, void **data, uint32_t *msg_size, - struct vchiq_header **message) +struct vchiq_header *vchi_msg_hold(unsigned handle) { - struct vchiq_header *header; - - header = vchiq_msg_hold(handle); - if (!header) - return -ENOENT; - - *data = header->data; - *msg_size = header->size; - *message = header; - - return 0; + return vchiq_msg_hold(handle); } EXPORT_SYMBOL(vchi_msg_hold); diff --git a/drivers/staging/vc04_services/vc-sm-cma/vc_sm_cma_vchi.c b/drivers/staging/vc04_services/vc-sm-cma/vc_sm_cma_vchi.c index 08979502f551..2de67ce18be2 100644 --- a/drivers/staging/vc04_services/vc-sm-cma/vc_sm_cma_vchi.c +++ b/drivers/staging/vc04_services/vc-sm-cma/vc_sm_cma_vchi.c @@ -233,8 +233,13 @@ static int vc_sm_cma_vchi_videocore_io(void *arg) } while (1); - while (!vchi_msg_hold(instance->service_handle, - (void **)&reply, &reply_len, &message)) { + while (1) { + message = vchi_msg_hold(instance->service_handle); + if (!message) + break; + reply = (struct vc_sm_result_t *)message->data; + reply_len = message->size; + if (reply->trans_id & 0x80000000) { /* Async event or cmd from the VPU */ if (instance->vpu_event)