From patchwork Mon Jun 29 15:09:18 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: 11631095 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 E6261912 for ; Mon, 29 Jun 2020 15:18:25 +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 BF24823EF1 for ; Mon, 29 Jun 2020 15:18:25 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="DSSyGugC" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org BF24823EF1 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=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=LMFj9XBAuuF2/17LKcraHT8P6CjCNWrKj0SeM9lI31k=; b=DSSyGugCfxasfNJBdhbc8CFBg v/8Mibj3O58ZsCF0xOEowlyvrXO4ObLAO1AA6lKzMNP1t4+BgZSOc1w3t0ctT5mX15ApViqAVs92U hD5rtfJbmO96jVwRusgVAff5N0sKVgjlJaiM9aO1G2A+UhOQzg0xdvm0o6NsWlal/Ni5udWQOsNCx BAqtsmDl/M2C75S7hQqBGZJEuBbQZJwCT1Ga0/1+JosjsMw1d095A1YuGwuXVrLhp5/LmsGQT9ztR z6Hx2Bbx35/pMW7EY5iaUvj0b+JkYq91LgX0J32jnCB/nwjEObSj7sCXVtmBa1lKc+fU7UNVgipo4 vnHqFxdIw==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jpvVe-0005Nn-E7; Mon, 29 Jun 2020 15:15:50 +0000 Received: from mx2.suse.de ([195.135.220.15]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jpvQ4-0002fM-1B; Mon, 29 Jun 2020 15:10:14 +0000 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id 50BFBAF82; Mon, 29 Jun 2020 15:10:01 +0000 (UTC) From: Nicolas Saenz Julienne To: gregkh@linuxfoundation.org Subject: [PATCH v2 20/47] staging: vchi: Use vchiq's enum vchiq_reason Date: Mon, 29 Jun 2020 17:09:18 +0200 Message-Id: <20200629150945.10720-21-nsaenzjulienne@suse.de> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20200629150945.10720-1-nsaenzjulienne@suse.de> References: <20200629150945.10720-1-nsaenzjulienne@suse.de> MIME-Version: 1.0 X-Spam-Note: CRM114 invocation failed X-Spam-Score: -2.3 (--) X-Spam-Report: SpamAssassin version 3.4.4 on merlin.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_HELO_NONE SPF: HELO does not publish an SPF Record -0.0 SPF_PASS SPF: sender matches 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, linux-kernel@vger.kernel.org, Nicolas Saenz Julienne , laurent.pinchart@ideasonboard.com, linux-arm-kernel@lists.infradead.org, linux-rpi-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org enum vchi_callback_reason maps 1:1 to enum vchiq_reason, in an effort to simplify things, let's use the later, and get rid of the extra indirection. Signed-off-by: Nicolas Saenz Julienne --- .../bcm2835-audio/bcm2835-vchiq.c | 5 +-- .../interface/vchi/vchi_common.h | 20 +--------- .../interface/vchiq_arm/vchiq_shim.c | 40 +------------------ .../vc04_services/vchiq-mmal/mmal-vchiq.c | 11 +++-- 4 files changed, 10 insertions(+), 66 deletions(-) diff --git a/drivers/staging/vc04_services/bcm2835-audio/bcm2835-vchiq.c b/drivers/staging/vc04_services/bcm2835-audio/bcm2835-vchiq.c index 565853ec1e7a..0f97eda4ec90 100644 --- a/drivers/staging/vc04_services/bcm2835-audio/bcm2835-vchiq.c +++ b/drivers/staging/vc04_services/bcm2835-audio/bcm2835-vchiq.c @@ -89,8 +89,7 @@ static int bcm2835_audio_send_simple(struct bcm2835_audio_instance *instance, return bcm2835_audio_send_msg(instance, &m, wait); } -static void audio_vchi_callback(void *param, - const enum vchi_callback_reason reason, +static void audio_vchi_callback(void *param, const enum vchiq_reason reason, void *msg_handle) { struct bcm2835_audio_instance *instance = param; @@ -99,7 +98,7 @@ static void audio_vchi_callback(void *param, unsigned size; int status; - if (reason != VCHI_CALLBACK_MSG_AVAILABLE) + if (reason != VCHIQ_MESSAGE_AVAILABLE) return; status = vchi_msg_hold(instance->service, (void **)&m, &size, &handle); diff --git a/drivers/staging/vc04_services/interface/vchi/vchi_common.h b/drivers/staging/vc04_services/interface/vchi/vchi_common.h index 52b447c19445..24e8665e214a 100644 --- a/drivers/staging/vc04_services/interface/vchi/vchi_common.h +++ b/drivers/staging/vc04_services/interface/vchi/vchi_common.h @@ -4,27 +4,9 @@ #ifndef VCHI_COMMON_H_ #define VCHI_COMMON_H_ -//callback reasons when an event occurs on a service -enum vchi_callback_reason { - /* - * This indicates that there is data available handle is the msg id that - * was transmitted with the data - * When a message is received and there was no FULL message available - * previously, send callback - * Tasks get kicked by the callback, reset their event and try and read - * from the fifo until it fails - */ - VCHI_CALLBACK_SERVICE_CLOSED, - VCHI_CALLBACK_MSG_AVAILABLE, - VCHI_CALLBACK_BULK_SENT, - VCHI_CALLBACK_BULK_RECEIVED, - VCHI_CALLBACK_BULK_TRANSMIT_ABORTED, - VCHI_CALLBACK_BULK_RECEIVE_ABORTED, -}; - //Callback used by all services / bulk transfers typedef void (*vchi_callback)(void *callback_param, //my service local param - enum vchi_callback_reason reason, + enum vchiq_reason reason, void *handle); //for transmitting msg's only #endif // VCHI_COMMON_H_ 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 c6b14d31492b..f2998c0ca5b1 100644 --- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_shim.c +++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_shim.c @@ -274,46 +274,10 @@ static enum vchiq_status shim_callback(enum vchiq_reason reason, if (!service->callback) goto release; - switch (reason) { - case VCHIQ_MESSAGE_AVAILABLE: + if (reason == VCHIQ_MESSAGE_AVAILABLE) vchiu_queue_push(&service->queue, header); - service->callback(service->callback_param, - VCHI_CALLBACK_MSG_AVAILABLE, NULL); - - break; - - case VCHIQ_BULK_TRANSMIT_DONE: - service->callback(service->callback_param, - VCHI_CALLBACK_BULK_SENT, bulk_user); - break; - - case VCHIQ_BULK_RECEIVE_DONE: - service->callback(service->callback_param, - VCHI_CALLBACK_BULK_RECEIVED, bulk_user); - break; - - case VCHIQ_SERVICE_CLOSED: - service->callback(service->callback_param, - VCHI_CALLBACK_SERVICE_CLOSED, NULL); - break; - - case VCHIQ_BULK_TRANSMIT_ABORTED: - service->callback(service->callback_param, - VCHI_CALLBACK_BULK_TRANSMIT_ABORTED, - bulk_user); - break; - - case VCHIQ_BULK_RECEIVE_ABORTED: - service->callback(service->callback_param, - VCHI_CALLBACK_BULK_RECEIVE_ABORTED, - bulk_user); - break; - - default: - WARN(1, "not supported\n"); - break; - } + service->callback(service->callback_param, reason, bulk_user); release: return VCHIQ_SUCCESS; diff --git a/drivers/staging/vc04_services/vchiq-mmal/mmal-vchiq.c b/drivers/staging/vc04_services/vchiq-mmal/mmal-vchiq.c index 5c9fd354a7fe..f710ccccb14c 100644 --- a/drivers/staging/vc04_services/vchiq-mmal/mmal-vchiq.c +++ b/drivers/staging/vc04_services/vchiq-mmal/mmal-vchiq.c @@ -549,8 +549,7 @@ static void bulk_abort_cb(struct vchiq_mmal_instance *instance, } /* incoming event service callback */ -static void service_callback(void *param, - const enum vchi_callback_reason reason, +static void service_callback(void *param, const enum vchiq_reason reason, void *bulk_ctx) { struct vchiq_mmal_instance *instance = param; @@ -566,7 +565,7 @@ static void service_callback(void *param, } switch (reason) { - case VCHI_CALLBACK_MSG_AVAILABLE: + case VCHIQ_MESSAGE_AVAILABLE: status = vchi_msg_hold(instance->service, (void **)&msg, &msg_len, &msg_handle); if (status) { @@ -631,15 +630,15 @@ static void service_callback(void *param, break; - case VCHI_CALLBACK_BULK_RECEIVED: + case VCHIQ_BULK_RECEIVE_DONE: bulk_receive_cb(instance, bulk_ctx); break; - case VCHI_CALLBACK_BULK_RECEIVE_ABORTED: + case VCHIQ_BULK_RECEIVE_ABORTED: bulk_abort_cb(instance, bulk_ctx); break; - case VCHI_CALLBACK_SERVICE_CLOSED: + case VCHIQ_SERVICE_CLOSED: /* TODO: consider if this requires action if received when * driver is not explicitly closing the service */