From patchwork Wed May 27 11:53:38 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: 11572753 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 4541390 for ; Wed, 27 May 2020 12:08:16 +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 07F0A207CB for ; Wed, 27 May 2020 12:08:15 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="gKtGoQaQ" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 07F0A207CB 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=p8nX0SaWYkAdSckEIReODcId5lp+/rsr95RQsHtAqFA=; b=gKtGoQaQHW0hEt hwL/+KIbx2alSueVL9wLPaTU/lgN7Wpnaq9H95qyrl1rUgctMxr1YTG16NFM+yhqYZwi1/O+7mnXY Vdz9dnJcK/Rqmf6K658W8UeM4IVIqtM3MXKM2VV8GvoGTz7Ypl1DhDP44ShLBu1hdtg2pNlnlx8kV uVhUo0EFeQATMchVCMMv+/RqxSgBocdq2P1sNu25QAqemzJh6MqmEhOGWAFEXj2FChixLW7iG270U OvM8KG/XjhCJHnwCXXkVcH37brwtIX/73U5Ch+HZFsO4CmAFnvsePYtY3Z85xRAwuN5WCkIfFoDsY EK44AA6ocvOX3I0bd0JQ==; 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 1jduqt-0007sD-D4; Wed, 27 May 2020 12:08:07 +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 1jdudz-00074S-5o; Wed, 27 May 2020 11:54:51 +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 C13CEAC91; Wed, 27 May 2020 11:54:47 +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, Florian Fainelli , Ray Jui , Scott Branden , Nicolas Saenz Julienne Subject: [RFC 33/50] staging: vchi: Use struct vchiq_service_params Date: Wed, 27 May 2020 13:53:38 +0200 Message-Id: <20200527115400.31391-34-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_045447_532713_7D2D7039 X-CRM114-Status: GOOD ( 15.56 ) 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, linux-kernel@vger.kernel.org, gregkh@linuxfoundation.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org For initialization, vchi has its own params structure, which is then translated to vchiq's params structure. They are essentially the same, so lets directly use vchiq's. Signed-off-by: Nicolas Saenz Julienne --- .../bcm2835-audio/bcm2835-vchiq.c | 9 +++++---- .../vc04_services/interface/vchi/vchi.h | 19 +------------------ .../interface/vchiq_arm/vchiq_shim.c | 12 ++---------- .../vc04_services/vc-sm-cma/vc_sm_cma_vchi.c | 11 ++++++----- .../vc04_services/vchiq-mmal/mmal-vchiq.c | 11 ++++++----- 5 files changed, 20 insertions(+), 42 deletions(-) diff --git a/drivers/staging/vc04_services/bcm2835-audio/bcm2835-vchiq.c b/drivers/staging/vc04_services/bcm2835-audio/bcm2835-vchiq.c index 71750ef891dd..c1537a41a2fe 100644 --- a/drivers/staging/vc04_services/bcm2835-audio/bcm2835-vchiq.c +++ b/drivers/staging/vc04_services/bcm2835-audio/bcm2835-vchiq.c @@ -122,11 +122,12 @@ static int vc_vchi_audio_init(struct vchiq_instance *vchiq_instance, struct bcm2835_audio_instance *instance) { - struct service_creation params = { - .version = VCHI_VERSION_EX(VC_AUDIOSERV_VER, VC_AUDIOSERV_MIN_VER), - .service_id = VC_AUDIO_SERVER_NAME, + struct vchiq_service_params params = { + .version = VC_AUDIOSERV_VER, + .version_min = VC_AUDIOSERV_MIN_VER, + .fourcc = VC_AUDIO_SERVER_NAME, .callback = audio_vchi_callback, - .callback_param = instance, + .userdata = instance, }; int status; diff --git a/drivers/staging/vc04_services/interface/vchi/vchi.h b/drivers/staging/vc04_services/interface/vchi/vchi.h index cb66ea1ffad2..4afa6e9f57c4 100644 --- a/drivers/staging/vc04_services/interface/vchi/vchi.h +++ b/drivers/staging/vc04_services/interface/vchi/vchi.h @@ -8,12 +8,6 @@ * Global defs *****************************************************************************/ -struct vchi_version { - uint32_t version; - uint32_t version_min; -}; -#define VCHI_VERSION_EX(v_, m_) { v_, m_ } - // Macros to manipulate 'FOURCC' values #define MAKE_FOURCC(x) ((int32_t)((x[0] << 24) | (x[1] << 16) | (x[2] << 8) | x[3])) @@ -31,17 +25,6 @@ struct vchi_service { unsigned int handle; }; -// structure used to provide the information needed to open a server or a client -struct service_creation { - struct vchi_version version; - int32_t service_id; - enum vchiq_status (*callback)(enum vchiq_reason reason, - struct vchiq_header *header, - unsigned int handle, - void *bulk_userdata); - void *callback_param; -}; - // Opaque handle for a VCHIQ instance struct vchiq_instance; @@ -64,7 +47,7 @@ extern int32_t vchi_disconnect(struct vchiq_instance *instance); *****************************************************************************/ // Routine to open a named service extern int32_t vchi_service_open(struct vchiq_instance *instance, - struct service_creation *setup, + struct vchiq_service_params *setup, struct vchi_service **service); extern int32_t vchi_get_peer_version(struct vchi_service *service, 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 e6773cd51b44..e76399e083f6 100644 --- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_shim.c +++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_shim.c @@ -265,23 +265,15 @@ static void service_free(struct vchi_service *service) } int32_t vchi_service_open(struct vchiq_instance *instance, - struct service_creation *setup, + struct vchiq_service_params *params, struct vchi_service **service) { *service = service_alloc(); if (service) { - struct vchiq_service_params params; enum vchiq_status status; - memset(¶ms, 0, sizeof(params)); - params.fourcc = setup->service_id; - params.callback = setup->callback; - params.userdata = setup->callback_param; - params.version = setup->version.version; - params.version_min = setup->version.version_min; - - status = vchiq_open_service(instance, ¶ms, + status = vchiq_open_service(instance, params, &((*service)->handle)); if (status != VCHIQ_SUCCESS) { service_free(*service); 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 5088f72f57c9..a37607d07335 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 @@ -290,11 +290,12 @@ static enum vchiq_status vc_sm_cma_vchi_callback(enum vchiq_reason reason, struct sm_instance *vc_sm_cma_vchi_init(struct vchiq_instance *vchiq_instance, vpu_event_cb vpu_event) { - struct service_creation params = { - .version = VCHI_VERSION_EX(VC_SM_VER, VC_SM_MIN_VER), - .service_id = VC_SM_SERVER_NAME, + struct vchiq_service_params params = { + .version = VC_SM_VER, + .version_min = VC_SM_MIN_VER, + .fourcc = VC_SM_SERVER_NAME, .callback = vc_sm_cma_vchi_callback, - .callback_param = NULL, + .userdata = NULL, }; struct sm_instance *instance; int status; @@ -318,7 +319,7 @@ struct sm_instance *vc_sm_cma_vchi_init(struct vchiq_instance *vchiq_instance, init_completion(&instance->free_blk[i].cmplt); list_add(&instance->free_blk[i].head, &instance->free_list); } - params.callback_param = instance; + params.userdata = instance; /* Open the VCHI service connections */ status = vchi_service_open(vchiq_instance, ¶ms, &instance->service); diff --git a/drivers/staging/vc04_services/vchiq-mmal/mmal-vchiq.c b/drivers/staging/vc04_services/vchiq-mmal/mmal-vchiq.c index 3207d0612515..a3ad8aa8b8cc 100644 --- a/drivers/staging/vc04_services/vchiq-mmal/mmal-vchiq.c +++ b/drivers/staging/vc04_services/vchiq-mmal/mmal-vchiq.c @@ -2094,11 +2094,12 @@ int vchiq_mmal_init(struct vchiq_mmal_instance **out_instance) int status; struct vchiq_mmal_instance *instance; static struct vchiq_instance *vchiq_instance; - struct service_creation params = { - .version = VCHI_VERSION_EX(VC_MMAL_VER, VC_MMAL_MIN_VER), - .service_id = VC_MMAL_SERVER_NAME, + struct vchiq_service_params params = { + .version = VC_MMAL_VER, + .version_min = VC_MMAL_MIN_VER, + .fourcc = VC_MMAL_SERVER_NAME, .callback = service_callback, - .callback_param = NULL, + .userdata = NULL, }; /* compile time checks to ensure structure size as they are @@ -2140,7 +2141,7 @@ int vchiq_mmal_init(struct vchiq_mmal_instance **out_instance) mutex_init(&instance->context_map_lock); idr_init_base(&instance->context_map, 1); - params.callback_param = instance; + params.userdata = instance; instance->bulk_wq = alloc_ordered_workqueue("mmal-vchiq", WQ_MEM_RECLAIM);