From patchwork Tue Jun 23 16:41:47 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: 11621063 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 A602192A for ; Tue, 23 Jun 2020 16:49:18 +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 658DE204EA for ; Tue, 23 Jun 2020 16:49:18 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="FGh3LiEb" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 658DE204EA 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=A5iGd4xW+4cjlT6gB7rDOn7FrNcU1jf4iG+RyGnK820=; b=FGh3LiEbLsXWF0+SPUusExXi1 XjuxLjiGL4inGrDskIZEGewjDNUZsaHjEACqWmgqi+bf98EKNxhNm0FEk3Rniamr+JqdjQ1NhqnHp RtOkkObmHNpcPT3Dr0jc83V9mcvaOuo4xxES7UmtQwmSPD9RGFOt2vF6kC8jdq9d63M2qzqUn1S5U jfqUA6bEEhwKou+cBls0KyY34EZQ6wLI8lnB6CE26kkpR2QoiECwvk8oeHvcZ0D5DvKF0KZ/p4Zcy kNQX0NluN7la+FCQhAoMSdHzdQ9+i0mRiVOlSGr2hNV5l31yCNodPVgkAy02Q0FHZcGB0/FhUB7hx eHpZ2cM7A==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jnm4A-0005rK-CU; Tue, 23 Jun 2020 16:46:34 +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 1jnm2p-0005L7-8F; Tue, 23 Jun 2020 16:45:17 +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 9C3B2AEBE; Tue, 23 Jun 2020 16:45:07 +0000 (UTC) From: Nicolas Saenz Julienne To: gregkh@linuxfoundation.org Subject: [PATCH 01/50] staging: bcm2835: Break MMAL support out from camera Date: Tue, 23 Jun 2020 18:41:47 +0200 Message-Id: <20200623164235.29566-2-nsaenzjulienne@suse.de> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20200623164235.29566-1-nsaenzjulienne@suse.de> References: <20200623164235.29566-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_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, Jacopo Mondi , 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 From: Jacopo Mondi The BCM2835 camera host is currently the only component that uses the VCHIQ MMAL interface. This will soon change with the upporting of BCM2835 ISP, which make use of the same interface. Break VCHIQ MMAL interface support out from camera host directory to make it possible for the ISP driver to use it as well. The only modification to the existing mmal code is the introduction of EXPORT_SYMBOL() for symbols required by bcm2835-camera and the addition of the module author and licenses. Signed-off-by: Jacopo Mondi Signed-off-by: Nicolas Saenz Julienne Reported-by: kernel test robot --- drivers/staging/vc04_services/Kconfig | 2 ++ drivers/staging/vc04_services/Makefile | 5 +++-- .../vc04_services/bcm2835-camera/Kconfig | 1 + .../vc04_services/bcm2835-camera/Makefile | 4 ++-- .../staging/vc04_services/vchiq-mmal/Kconfig | 7 +++++++ .../staging/vc04_services/vchiq-mmal/Makefile | 8 +++++++ .../mmal-common.h | 0 .../mmal-encodings.h | 0 .../mmal-msg-common.h | 0 .../mmal-msg-format.h | 0 .../mmal-msg-port.h | 0 .../{bcm2835-camera => vchiq-mmal}/mmal-msg.h | 0 .../mmal-parameters.h | 0 .../mmal-vchiq.c | 21 +++++++++++++++++++ .../mmal-vchiq.h | 0 15 files changed, 44 insertions(+), 4 deletions(-) create mode 100644 drivers/staging/vc04_services/vchiq-mmal/Kconfig create mode 100644 drivers/staging/vc04_services/vchiq-mmal/Makefile rename drivers/staging/vc04_services/{bcm2835-camera => vchiq-mmal}/mmal-common.h (100%) rename drivers/staging/vc04_services/{bcm2835-camera => vchiq-mmal}/mmal-encodings.h (100%) rename drivers/staging/vc04_services/{bcm2835-camera => vchiq-mmal}/mmal-msg-common.h (100%) rename drivers/staging/vc04_services/{bcm2835-camera => vchiq-mmal}/mmal-msg-format.h (100%) rename drivers/staging/vc04_services/{bcm2835-camera => vchiq-mmal}/mmal-msg-port.h (100%) rename drivers/staging/vc04_services/{bcm2835-camera => vchiq-mmal}/mmal-msg.h (100%) rename drivers/staging/vc04_services/{bcm2835-camera => vchiq-mmal}/mmal-parameters.h (100%) rename drivers/staging/vc04_services/{bcm2835-camera => vchiq-mmal}/mmal-vchiq.c (98%) rename drivers/staging/vc04_services/{bcm2835-camera => vchiq-mmal}/mmal-vchiq.h (100%) diff --git a/drivers/staging/vc04_services/Kconfig b/drivers/staging/vc04_services/Kconfig index 6baf9dd57f1f..4b886293f198 100644 --- a/drivers/staging/vc04_services/Kconfig +++ b/drivers/staging/vc04_services/Kconfig @@ -23,5 +23,7 @@ source "drivers/staging/vc04_services/bcm2835-audio/Kconfig" source "drivers/staging/vc04_services/bcm2835-camera/Kconfig" +source "drivers/staging/vc04_services/vchiq-mmal/Kconfig" + endif diff --git a/drivers/staging/vc04_services/Makefile b/drivers/staging/vc04_services/Makefile index 54d9e2f31916..d37f21d1a219 100644 --- a/drivers/staging/vc04_services/Makefile +++ b/drivers/staging/vc04_services/Makefile @@ -10,8 +10,9 @@ vchiq-objs := \ interface/vchiq_arm/vchiq_util.o \ interface/vchiq_arm/vchiq_connected.o \ -obj-$(CONFIG_SND_BCM2835) += bcm2835-audio/ -obj-$(CONFIG_VIDEO_BCM2835) += bcm2835-camera/ +obj-$(CONFIG_SND_BCM2835) += bcm2835-audio/ +obj-$(CONFIG_VIDEO_BCM2835) += bcm2835-camera/ +obj-$(CONFIG_BCM2835_VCHIQ_MMAL) += vchiq-mmal/ ccflags-y += -D__VCCOREVER__=0x04000000 diff --git a/drivers/staging/vc04_services/bcm2835-camera/Kconfig b/drivers/staging/vc04_services/bcm2835-camera/Kconfig index c81baf2c111e..d0653d1ed3c7 100644 --- a/drivers/staging/vc04_services/bcm2835-camera/Kconfig +++ b/drivers/staging/vc04_services/bcm2835-camera/Kconfig @@ -4,6 +4,7 @@ config VIDEO_BCM2835 depends on MEDIA_SUPPORT depends on VIDEO_V4L2 && (ARCH_BCM2835 || COMPILE_TEST) select BCM2835_VCHIQ + select BCM2835_VCHIQ_MMAL select VIDEOBUF2_VMALLOC select BTREE help diff --git a/drivers/staging/vc04_services/bcm2835-camera/Makefile b/drivers/staging/vc04_services/bcm2835-camera/Makefile index 472f21e1f2a1..3a76d6ade428 100644 --- a/drivers/staging/vc04_services/bcm2835-camera/Makefile +++ b/drivers/staging/vc04_services/bcm2835-camera/Makefile @@ -1,11 +1,11 @@ # SPDX-License-Identifier: GPL-2.0 bcm2835-v4l2-$(CONFIG_VIDEO_BCM2835) := \ bcm2835-camera.o \ - controls.o \ - mmal-vchiq.o + controls.o obj-$(CONFIG_VIDEO_BCM2835) += bcm2835-v4l2.o ccflags-y += \ -I $(srctree)/$(src)/.. \ + -I $(srctree)/$(src)/../vchiq-mmal/ \ -D__VCCOREVER__=0x04000000 diff --git a/drivers/staging/vc04_services/vchiq-mmal/Kconfig b/drivers/staging/vc04_services/vchiq-mmal/Kconfig new file mode 100644 index 000000000000..500c0d12e4ff --- /dev/null +++ b/drivers/staging/vc04_services/vchiq-mmal/Kconfig @@ -0,0 +1,7 @@ +config BCM2835_VCHIQ_MMAL + tristate "BCM2835 MMAL VCHIQ service" + depends on (ARCH_BCM2835 || COMPILE_TEST) + help + Enables the MMAL API over VCHIQ interface as used for the + majority of the multimedia services on VideoCore. + Defaults to Y when the Broadcomd BCM2835 camera host is selected. diff --git a/drivers/staging/vc04_services/vchiq-mmal/Makefile b/drivers/staging/vc04_services/vchiq-mmal/Makefile new file mode 100644 index 000000000000..f8164c33aec3 --- /dev/null +++ b/drivers/staging/vc04_services/vchiq-mmal/Makefile @@ -0,0 +1,8 @@ +# SPDX-License-Identifier: GPL-2.0 +bcm2835-mmal-vchiq-objs := mmal-vchiq.o + +obj-$(CONFIG_BCM2835_VCHIQ_MMAL) += bcm2835-mmal-vchiq.o + +ccflags-y += \ + -I$(srctree)/$(src)/.. \ + -D__VCCOREVER__=0x04000000 diff --git a/drivers/staging/vc04_services/bcm2835-camera/mmal-common.h b/drivers/staging/vc04_services/vchiq-mmal/mmal-common.h similarity index 100% rename from drivers/staging/vc04_services/bcm2835-camera/mmal-common.h rename to drivers/staging/vc04_services/vchiq-mmal/mmal-common.h diff --git a/drivers/staging/vc04_services/bcm2835-camera/mmal-encodings.h b/drivers/staging/vc04_services/vchiq-mmal/mmal-encodings.h similarity index 100% rename from drivers/staging/vc04_services/bcm2835-camera/mmal-encodings.h rename to drivers/staging/vc04_services/vchiq-mmal/mmal-encodings.h diff --git a/drivers/staging/vc04_services/bcm2835-camera/mmal-msg-common.h b/drivers/staging/vc04_services/vchiq-mmal/mmal-msg-common.h similarity index 100% rename from drivers/staging/vc04_services/bcm2835-camera/mmal-msg-common.h rename to drivers/staging/vc04_services/vchiq-mmal/mmal-msg-common.h diff --git a/drivers/staging/vc04_services/bcm2835-camera/mmal-msg-format.h b/drivers/staging/vc04_services/vchiq-mmal/mmal-msg-format.h similarity index 100% rename from drivers/staging/vc04_services/bcm2835-camera/mmal-msg-format.h rename to drivers/staging/vc04_services/vchiq-mmal/mmal-msg-format.h diff --git a/drivers/staging/vc04_services/bcm2835-camera/mmal-msg-port.h b/drivers/staging/vc04_services/vchiq-mmal/mmal-msg-port.h similarity index 100% rename from drivers/staging/vc04_services/bcm2835-camera/mmal-msg-port.h rename to drivers/staging/vc04_services/vchiq-mmal/mmal-msg-port.h diff --git a/drivers/staging/vc04_services/bcm2835-camera/mmal-msg.h b/drivers/staging/vc04_services/vchiq-mmal/mmal-msg.h similarity index 100% rename from drivers/staging/vc04_services/bcm2835-camera/mmal-msg.h rename to drivers/staging/vc04_services/vchiq-mmal/mmal-msg.h diff --git a/drivers/staging/vc04_services/bcm2835-camera/mmal-parameters.h b/drivers/staging/vc04_services/vchiq-mmal/mmal-parameters.h similarity index 100% rename from drivers/staging/vc04_services/bcm2835-camera/mmal-parameters.h rename to drivers/staging/vc04_services/vchiq-mmal/mmal-parameters.h diff --git a/drivers/staging/vc04_services/bcm2835-camera/mmal-vchiq.c b/drivers/staging/vc04_services/vchiq-mmal/mmal-vchiq.c similarity index 98% rename from drivers/staging/vc04_services/bcm2835-camera/mmal-vchiq.c rename to drivers/staging/vc04_services/vchiq-mmal/mmal-vchiq.c index de03b90021a8..daf21087f8f9 100644 --- a/drivers/staging/vc04_services/bcm2835-camera/mmal-vchiq.c +++ b/drivers/staging/vc04_services/vchiq-mmal/mmal-vchiq.c @@ -17,6 +17,7 @@ #include #include +#include #include #include #include @@ -1396,6 +1397,7 @@ int vchiq_mmal_port_set_format(struct vchiq_mmal_instance *instance, return ret; } +EXPORT_SYMBOL_GPL(vchiq_mmal_port_set_format); int vchiq_mmal_port_parameter_set(struct vchiq_mmal_instance *instance, struct vchiq_mmal_port *port, @@ -1412,6 +1414,7 @@ int vchiq_mmal_port_parameter_set(struct vchiq_mmal_instance *instance, return ret; } +EXPORT_SYMBOL_GPL(vchiq_mmal_port_parameter_set); int vchiq_mmal_port_parameter_get(struct vchiq_mmal_instance *instance, struct vchiq_mmal_port *port, @@ -1428,6 +1431,7 @@ int vchiq_mmal_port_parameter_get(struct vchiq_mmal_instance *instance, return ret; } +EXPORT_SYMBOL_GPL(vchiq_mmal_port_parameter_get); /* enable a port * @@ -1458,6 +1462,7 @@ int vchiq_mmal_port_enable(struct vchiq_mmal_instance *instance, return ret; } +EXPORT_SYMBOL_GPL(vchiq_mmal_port_enable); int vchiq_mmal_port_disable(struct vchiq_mmal_instance *instance, struct vchiq_mmal_port *port) @@ -1478,6 +1483,7 @@ int vchiq_mmal_port_disable(struct vchiq_mmal_instance *instance, return ret; } +EXPORT_SYMBOL_GPL(vchiq_mmal_port_disable); /* ports will be connected in a tunneled manner so data buffers * are not handled by client. @@ -1565,6 +1571,7 @@ int vchiq_mmal_port_connect_tunnel(struct vchiq_mmal_instance *instance, return ret; } +EXPORT_SYMBOL_GPL(vchiq_mmal_port_connect_tunnel); int vchiq_mmal_submit_buffer(struct vchiq_mmal_instance *instance, struct vchiq_mmal_port *port, @@ -1583,6 +1590,7 @@ int vchiq_mmal_submit_buffer(struct vchiq_mmal_instance *instance, return 0; } +EXPORT_SYMBOL_GPL(vchiq_mmal_submit_buffer); int mmal_vchi_buffer_init(struct vchiq_mmal_instance *instance, struct mmal_buffer *buf) @@ -1595,6 +1603,7 @@ int mmal_vchi_buffer_init(struct vchiq_mmal_instance *instance, buf->msg_context = msg_context; return 0; } +EXPORT_SYMBOL_GPL(mmal_vchi_buffer_init); int mmal_vchi_buffer_cleanup(struct mmal_buffer *buf) { @@ -1606,6 +1615,7 @@ int mmal_vchi_buffer_cleanup(struct mmal_buffer *buf) return 0; } +EXPORT_SYMBOL_GPL(mmal_vchi_buffer_cleanup); /* Initialise a mmal component and its ports * @@ -1693,6 +1703,7 @@ int vchiq_mmal_component_init(struct vchiq_mmal_instance *instance, return ret; } +EXPORT_SYMBOL_GPL(vchiq_mmal_component_init); /* * cause a mmal component to be destroyed @@ -1714,6 +1725,7 @@ int vchiq_mmal_component_finalise(struct vchiq_mmal_instance *instance, return ret; } +EXPORT_SYMBOL_GPL(vchiq_mmal_component_finalise); /* * cause a mmal component to be enabled @@ -1739,6 +1751,7 @@ int vchiq_mmal_component_enable(struct vchiq_mmal_instance *instance, return ret; } +EXPORT_SYMBOL_GPL(vchiq_mmal_component_enable); /* * cause a mmal component to be enabled @@ -1764,6 +1777,7 @@ int vchiq_mmal_component_disable(struct vchiq_mmal_instance *instance, return ret; } +EXPORT_SYMBOL_GPL(vchiq_mmal_component_disable); int vchiq_mmal_version(struct vchiq_mmal_instance *instance, u32 *major_out, u32 *minor_out) @@ -1779,6 +1793,7 @@ int vchiq_mmal_version(struct vchiq_mmal_instance *instance, return ret; } +EXPORT_SYMBOL_GPL(vchiq_mmal_version); int vchiq_mmal_finalise(struct vchiq_mmal_instance *instance) { @@ -1809,6 +1824,7 @@ int vchiq_mmal_finalise(struct vchiq_mmal_instance *instance) return status; } +EXPORT_SYMBOL_GPL(vchiq_mmal_finalise); int vchiq_mmal_init(struct vchiq_mmal_instance **out_instance) { @@ -1889,3 +1905,8 @@ int vchiq_mmal_init(struct vchiq_mmal_instance **out_instance) kfree(instance); return -ENODEV; } +EXPORT_SYMBOL_GPL(vchiq_mmal_init); + +MODULE_DESCRIPTION("BCM2835 MMAL VCHIQ interface"); +MODULE_AUTHOR("Dave Stevenson, "); +MODULE_LICENSE("GPL"); diff --git a/drivers/staging/vc04_services/bcm2835-camera/mmal-vchiq.h b/drivers/staging/vc04_services/vchiq-mmal/mmal-vchiq.h similarity index 100% rename from drivers/staging/vc04_services/bcm2835-camera/mmal-vchiq.h rename to drivers/staging/vc04_services/vchiq-mmal/mmal-vchiq.h From patchwork Tue Jun 23 16:41:48 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: 11621059 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 877FA913 for ; Tue, 23 Jun 2020 16:48:31 +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 5E9F7204EA for ; Tue, 23 Jun 2020 16:48:31 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="eioPT0yE" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 5E9F7204EA 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=q8yBtLtkjbYdvd4RmSJRH2/OTGc7QfG27UcnnhYMdk8=; b=eioPT0yEAyY2QgwwKe3l2NIM0 mE9Roojgot5B9wTw7TbpAAAmKw7/jce888AkKNinwXWTDjF2r1rccph8nMRuzNBc71MwyQ+NLUFI5 mOClBT1qbF0pizahxqeVD/gKkO3OxVpup/1X8amWr39mPEjvrfBshlS/GZyxXa/kZqmVanL2S5OKU jf4PFq6NN4J/YDuvAl4SOQbk5lNcxfCVTTNwH1/FFjuBJ8uMzj2anPIaa6EFXnLeh/WBWk1IsiFOP FFBMtkMGfcqKlK4sJk29VFxk4J0tQr0QOVv7GTqY5/Pi1yGfmo5TcKhx4G7P4W0v+B+dUOVS0frWi UO/xiXQww==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jnm3p-0005kj-Jq; Tue, 23 Jun 2020 16:46:13 +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 1jnm2p-0005L6-BA; Tue, 23 Jun 2020 16:45:15 +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 1B8EDAECE; Tue, 23 Jun 2020 16:45:08 +0000 (UTC) From: Nicolas Saenz Julienne To: gregkh@linuxfoundation.org Subject: [PATCH 02/50] staging: mmal-vchiq: Allocate and free components as required Date: Tue, 23 Jun 2020 18:41:48 +0200 Message-Id: <20200623164235.29566-3-nsaenzjulienne@suse.de> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20200623164235.29566-1-nsaenzjulienne@suse.de> References: <20200623164235.29566-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_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, Jacopo Mondi , kernel-list@raspberrypi.com, linux-kernel@vger.kernel.org, Nicolas Saenz Julienne , laurent.pinchart@ideasonboard.com, Dave Stevenson , 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 From: Dave Stevenson The existing code assumed that there would only ever be 4 components, and never freed the entries once used. Allow arbitrary creation and destruction of components. Signed-off-by: Dave Stevenson Signed-off-by: Jacopo Mondi Signed-off-by: Nicolas Saenz Julienne --- .../vc04_services/vchiq-mmal/mmal-vchiq.c | 29 ++++++++++++------- .../vc04_services/vchiq-mmal/mmal-vchiq.h | 1 + 2 files changed, 20 insertions(+), 10 deletions(-) diff --git a/drivers/staging/vc04_services/vchiq-mmal/mmal-vchiq.c b/drivers/staging/vc04_services/vchiq-mmal/mmal-vchiq.c index daf21087f8f9..cbe262b111fe 100644 --- a/drivers/staging/vc04_services/vchiq-mmal/mmal-vchiq.c +++ b/drivers/staging/vc04_services/vchiq-mmal/mmal-vchiq.c @@ -32,8 +32,11 @@ #define USE_VCHIQ_ARM #include "interface/vchi/vchi.h" -/* maximum number of components supported */ -#define VCHIQ_MMAL_MAX_COMPONENTS 4 +/* + * maximum number of components supported. + * This matches the maximum permitted by default on the VPU + */ +#define VCHIQ_MMAL_MAX_COMPONENTS 64 /*#define FULL_MSG_DUMP 1*/ @@ -168,8 +171,6 @@ struct vchiq_mmal_instance { /* protect accesses to context_map */ struct mutex context_map_lock; - /* component to use next */ - int component_idx; struct vchiq_mmal_component component[VCHIQ_MMAL_MAX_COMPONENTS]; /* ordered workqueue to process all bulk operations */ @@ -1626,18 +1627,24 @@ int vchiq_mmal_component_init(struct vchiq_mmal_instance *instance, { int ret; int idx; /* port index */ - struct vchiq_mmal_component *component; + struct vchiq_mmal_component *component = NULL; if (mutex_lock_interruptible(&instance->vchiq_mutex)) return -EINTR; - if (instance->component_idx == VCHIQ_MMAL_MAX_COMPONENTS) { + for (idx = 0; idx < VCHIQ_MMAL_MAX_COMPONENTS; idx++) { + if (!instance->component[idx].in_use) { + component = &instance->component[idx]; + component->in_use = 1; + break; + } + } + + if (!component) { ret = -EINVAL; /* todo is this correct error? */ goto unlock; } - component = &instance->component[instance->component_idx]; - ret = create_component(instance, component, name); if (ret < 0) { pr_err("%s: failed to create component %d (Not enough GPU mem?)\n", @@ -1688,8 +1695,6 @@ int vchiq_mmal_component_init(struct vchiq_mmal_instance *instance, goto release_component; } - instance->component_idx++; - *component_out = component; mutex_unlock(&instance->vchiq_mutex); @@ -1699,6 +1704,8 @@ int vchiq_mmal_component_init(struct vchiq_mmal_instance *instance, release_component: destroy_component(instance, component); unlock: + if (component) + component->in_use = 0; mutex_unlock(&instance->vchiq_mutex); return ret; @@ -1721,6 +1728,8 @@ int vchiq_mmal_component_finalise(struct vchiq_mmal_instance *instance, ret = destroy_component(instance, component); + component->in_use = 0; + mutex_unlock(&instance->vchiq_mutex); return ret; diff --git a/drivers/staging/vc04_services/vchiq-mmal/mmal-vchiq.h b/drivers/staging/vc04_services/vchiq-mmal/mmal-vchiq.h index 47897e81ec58..4e34728d87e5 100644 --- a/drivers/staging/vc04_services/vchiq-mmal/mmal-vchiq.h +++ b/drivers/staging/vc04_services/vchiq-mmal/mmal-vchiq.h @@ -82,6 +82,7 @@ struct vchiq_mmal_port { }; struct vchiq_mmal_component { + u32 in_use:1; u32 enabled:1; u32 handle; /* VideoCore handle for component */ u32 inputs; /* Number of input ports */ From patchwork Tue Jun 23 16:41:49 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: 11621057 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 0908292A for ; Tue, 23 Jun 2020 16:48:18 +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 D5E7F204EA for ; Tue, 23 Jun 2020 16:48:17 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="3SPp/b4t" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org D5E7F204EA 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=FLoLBMTavD3s4P2XJe8xPSMO76ZpHm2PqSUjbC5+PIM=; b=3SPp/b4tQalj7iy2KRA/qx5YZ PDRsrnDp//nQUbcY27TGf9aCOyoEf/U3ZdnRvd1ndYtyMo8wZiaIWgaswEo58F2x0w1twszMVeRl9 M3oQLiB3yKI6+vEkwCPinWQdSqUWBQQ9mGdFgHSUqYi1yCeP+5CBV9KrDDhTge2YpebtAS9XBfqQE x0LoFjT8/ka8RLMDYlWp/YAnnkWhr0Q+MLwmxwE02T6x/56eb6NA7VHkOHQ1yNT8zXw3Ye/NHFMsf oesdIFvv6N0eU4R3LXWkaWG+lKSWtBwFMEnpM50zuIwzMFB1o3mLmFOwOshBQUTDSqvjpO75c4LNp ZwNOnR/tw==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jnm3V-0005Vr-2E; Tue, 23 Jun 2020 16:45:53 +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 1jnm2p-0005LC-B7; Tue, 23 Jun 2020 16:45:12 +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 8EE79AECB; Tue, 23 Jun 2020 16:45:08 +0000 (UTC) From: Nicolas Saenz Julienne To: gregkh@linuxfoundation.org Subject: [PATCH 03/50] staging: mmal-vchiq: Avoid use of bool in structures Date: Tue, 23 Jun 2020 18:41:49 +0200 Message-Id: <20200623164235.29566-4-nsaenzjulienne@suse.de> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20200623164235.29566-1-nsaenzjulienne@suse.de> References: <20200623164235.29566-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 ---- ---------------------- -------------------------------------------------- 0.0 RCVD_IN_MSPIKE_H3 RBL: Good reputation (+3) [195.135.220.15 listed in wl.mailspike.net] -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 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, Jacopo Mondi , kernel-list@raspberrypi.com, linux-kernel@vger.kernel.org, Nicolas Saenz Julienne , laurent.pinchart@ideasonboard.com, Dave Stevenson , 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 From: Dave Stevenson Fixes up a checkpatch error "Avoid using bool structure members because of possible alignment issues". Signed-off-by: Dave Stevenson Signed-off-by: Jacopo Mondi Signed-off-by: Nicolas Saenz Julienne --- drivers/staging/vc04_services/vchiq-mmal/mmal-vchiq.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/vc04_services/vchiq-mmal/mmal-vchiq.c b/drivers/staging/vc04_services/vchiq-mmal/mmal-vchiq.c index cbe262b111fe..c30caad75253 100644 --- a/drivers/staging/vc04_services/vchiq-mmal/mmal-vchiq.c +++ b/drivers/staging/vc04_services/vchiq-mmal/mmal-vchiq.c @@ -1754,7 +1754,7 @@ int vchiq_mmal_component_enable(struct vchiq_mmal_instance *instance, ret = enable_component(instance, component); if (ret == 0) - component->enabled = true; + component->enabled = 1; mutex_unlock(&instance->vchiq_mutex); From patchwork Tue Jun 23 16:41:50 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: 11621055 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 78E0892A for ; Tue, 23 Jun 2020 16:47:51 +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 4EA9D2070E for ; Tue, 23 Jun 2020 16:47:51 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="MhLtpqRb" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 4EA9D2070E 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=Z1NrEO8k9cDI2yzaKPgFjayky4TxUunV3e5npmiuo8k=; b=MhLtpqRb6C7lps/Fdts2s4zvd /xV6PgzVfegxisdZNxYZk8WAAmkFCi+TQn2VN7Nlu8l7QyCFa7mAj6tefaeEZ3Ncx/2KPbXhHDbYp 78cO6HWMKN0QXhVMwPdY0F/QZGvZSrKKi361jjfcglBQ3sAzhUfbAsA0v0vyp5ae7XwgIIqWVFMXm eYZVRD2A/VYuGfwEg6BBGPsfWZrY5VXVFYMj0HobqG8lTxY0dm9vUixs7hwWbB9FLZfsnRI9QjNly DahtOmkhknKYyxm5CdJpAxlwZptnk/Pev5a2wEIeqRRB5YffMxDzFdtZN+h3jlaKfVOq7j5Y9U0m1 dFouI4pcA==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jnm2u-0005N1-7o; Tue, 23 Jun 2020 16:45:16 +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 1jnm2p-0005LJ-BB; Tue, 23 Jun 2020 16:45:12 +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 151CDAED2; Tue, 23 Jun 2020 16:45:09 +0000 (UTC) From: Nicolas Saenz Julienne To: gregkh@linuxfoundation.org Subject: [PATCH 04/50] staging: mmal-vchiq: Make timeout a defined parameter Date: Tue, 23 Jun 2020 18:41:50 +0200 Message-Id: <20200623164235.29566-5-nsaenzjulienne@suse.de> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20200623164235.29566-1-nsaenzjulienne@suse.de> References: <20200623164235.29566-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 ---- ---------------------- -------------------------------------------------- 0.0 RCVD_IN_MSPIKE_H3 RBL: Good reputation (+3) [195.135.220.15 listed in wl.mailspike.net] -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 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, Jacopo Mondi , kernel-list@raspberrypi.com, linux-kernel@vger.kernel.org, Nicolas Saenz Julienne , laurent.pinchart@ideasonboard.com, Dave Stevenson , 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 From: Dave Stevenson The timeout period for VPU communications is a useful thing to extend when debugging. Set it via a define, rather than a magic number buried in the code. Signed-off-by: Dave Stevenson Signed-off-by: Jacopo Mondi Signed-off-by: Nicolas Saenz Julienne --- drivers/staging/vc04_services/vchiq-mmal/mmal-vchiq.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/drivers/staging/vc04_services/vchiq-mmal/mmal-vchiq.c b/drivers/staging/vc04_services/vchiq-mmal/mmal-vchiq.c index c30caad75253..070ff63b3850 100644 --- a/drivers/staging/vc04_services/vchiq-mmal/mmal-vchiq.c +++ b/drivers/staging/vc04_services/vchiq-mmal/mmal-vchiq.c @@ -38,6 +38,12 @@ */ #define VCHIQ_MMAL_MAX_COMPONENTS 64 +/* + * Timeout for synchronous msg responses in seconds. + * Helpful to increase this if stopping in the VPU debugger. + */ +#define SYNC_MSG_TIMEOUT 3 + /*#define FULL_MSG_DUMP 1*/ #ifdef DEBUG @@ -686,7 +692,7 @@ static int send_synchronous_mmal_msg(struct vchiq_mmal_instance *instance, } timeout = wait_for_completion_timeout(&msg_context->u.sync.cmplt, - 3 * HZ); + SYNC_MSG_TIMEOUT * HZ); if (timeout == 0) { pr_err("timed out waiting for sync completion\n"); ret = -ETIME; From patchwork Tue Jun 23 16:41:51 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: 11621081 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 2BE4F138C for ; Tue, 23 Jun 2020 16:50:52 +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 94AA92076E for ; Tue, 23 Jun 2020 16:50:51 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="Q9MOQYHi" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 94AA92076E 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=r3Gk3n9s7QL6gfTA+WF/4yfRe4HNa/ArC7IAydSxANc=; b=Q9MOQYHiUG9JFDDS5TzkmXFG5 U1Sy2PvtVh5SbHLFURdhFBgaTkyCaCUUv9MvKvvANhZqEiCRVdfDD59x2WifkZwNxKFm+bw7yI/Ap F/wEMnp2oc1jlk07Nkx8jemoTQ938qJuHd+6XpR3964aoYjiDezn22v/+sOE2Jc8E5T46clrUwiZb WEoGM4Xl0ilzGdFMFo8EE+7+znwJRXSdhMw9DPPxReBqeMVhoJUaSyP88fjOc18/Ua1ffgg9NPDCd UU+Ah/7nGX6xgQ/lRUp3D7E8aHQomOcWv500+qsp/cWDHtKvxVPHDlnjFlV/yHHanTqQTn50oLFEA Gl92lzKnA==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jnm5C-0006Rt-Jz; Tue, 23 Jun 2020 16:47:38 +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 1jnm2r-0005MK-DM; Tue, 23 Jun 2020 16:45:21 +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 8A771B03C; Tue, 23 Jun 2020 16:45:09 +0000 (UTC) From: Nicolas Saenz Julienne To: gregkh@linuxfoundation.org Subject: [PATCH 05/50] staging: mmal-vchiq: Make a mmal_buf struct for passing parameters Date: Tue, 23 Jun 2020 18:41:51 +0200 Message-Id: <20200623164235.29566-6-nsaenzjulienne@suse.de> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20200623164235.29566-1-nsaenzjulienne@suse.de> References: <20200623164235.29566-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_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, Jacopo Mondi , kernel-list@raspberrypi.com, linux-kernel@vger.kernel.org, Nicolas Saenz Julienne , laurent.pinchart@ideasonboard.com, Dave Stevenson , 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 From: Dave Stevenson The callback from vchi_mmal to the client was growing lots of extra parameters. Consolidate them into a single struct instead of growing the list further. The struct is associated with the client buffer, therefore there are various changes to setup various containers for the struct, and pass the appropriate members. Signed-off-by: Dave Stevenson Signed-off-by: Jacopo Mondi Signed-off-by: Nicolas Saenz Julienne --- .../bcm2835-camera/bcm2835-camera.c | 64 +++++++++++-------- .../vc04_services/vchiq-mmal/mmal-common.h | 5 ++ .../vc04_services/vchiq-mmal/mmal-vchiq.c | 29 ++++++--- .../vc04_services/vchiq-mmal/mmal-vchiq.h | 3 +- 4 files changed, 65 insertions(+), 36 deletions(-) diff --git a/drivers/staging/vc04_services/bcm2835-camera/bcm2835-camera.c b/drivers/staging/vc04_services/bcm2835-camera/bcm2835-camera.c index 4f1adddb804f..73b2354a6bb7 100644 --- a/drivers/staging/vc04_services/bcm2835-camera/bcm2835-camera.c +++ b/drivers/staging/vc04_services/bcm2835-camera/bcm2835-camera.c @@ -75,6 +75,12 @@ static const struct v4l2_fract tpf_max = {.numerator = 1, .denominator = FPS_MIN}, tpf_default = {.numerator = 1000, .denominator = 30000}; +/* Container for MMAL and VB2 buffers*/ +struct vb2_mmal_buffer { + struct vb2_v4l2_buffer vb; + struct mmal_buffer mmal; +}; + /* video formats */ static struct mmal_fmt formats[] = { { @@ -261,14 +267,15 @@ static int buffer_init(struct vb2_buffer *vb) { struct bm2835_mmal_dev *dev = vb2_get_drv_priv(vb->vb2_queue); struct vb2_v4l2_buffer *vb2 = to_vb2_v4l2_buffer(vb); - struct mmal_buffer *buf = container_of(vb2, struct mmal_buffer, vb); + struct vb2_mmal_buffer *buf = + container_of(vb2, struct vb2_mmal_buffer, vb); v4l2_dbg(1, bcm2835_v4l2_debug, &dev->v4l2_dev, "%s: dev:%p, vb %p\n", __func__, dev, vb); - buf->buffer = vb2_plane_vaddr(&buf->vb.vb2_buf, 0); - buf->buffer_size = vb2_plane_size(&buf->vb.vb2_buf, 0); + buf->mmal.buffer = vb2_plane_vaddr(&buf->vb.vb2_buf, 0); + buf->mmal.buffer_size = vb2_plane_size(&buf->vb.vb2_buf, 0); - return mmal_vchi_buffer_init(dev->instance, buf); + return mmal_vchi_buffer_init(dev->instance, &buf->mmal); } static int buffer_prepare(struct vb2_buffer *vb) @@ -297,11 +304,13 @@ static void buffer_cleanup(struct vb2_buffer *vb) { struct bm2835_mmal_dev *dev = vb2_get_drv_priv(vb->vb2_queue); struct vb2_v4l2_buffer *vb2 = to_vb2_v4l2_buffer(vb); - struct mmal_buffer *buf = container_of(vb2, struct mmal_buffer, vb); + struct vb2_mmal_buffer *buf = + container_of(vb2, struct vb2_mmal_buffer, vb); v4l2_dbg(1, bcm2835_v4l2_debug, &dev->v4l2_dev, "%s: dev:%p, vb %p\n", __func__, dev, vb); - mmal_vchi_buffer_cleanup(buf); + + mmal_vchi_buffer_cleanup(&buf->mmal); } static inline bool is_capturing(struct bm2835_mmal_dev *dev) @@ -313,14 +322,16 @@ static inline bool is_capturing(struct bm2835_mmal_dev *dev) static void buffer_cb(struct vchiq_mmal_instance *instance, struct vchiq_mmal_port *port, int status, - struct mmal_buffer *buf, - unsigned long length, u32 mmal_flags, s64 dts, s64 pts) + struct mmal_buffer *mmal_buf) { struct bm2835_mmal_dev *dev = port->cb_ctx; + struct vb2_mmal_buffer *buf = + container_of(mmal_buf, struct vb2_mmal_buffer, mmal); v4l2_dbg(1, bcm2835_v4l2_debug, &dev->v4l2_dev, "%s: status:%d, buf:%p, length:%lu, flags %u, pts %lld\n", - __func__, status, buf, length, mmal_flags, pts); + __func__, status, buf, mmal_buf->length, mmal_buf->mmal_flags, + mmal_buf->pts); if (status) { /* error in transfer */ @@ -331,7 +342,7 @@ static void buffer_cb(struct vchiq_mmal_instance *instance, return; } - if (length == 0) { + if (mmal_buf->length == 0) { /* stream ended */ if (dev->capture.frame_count) { /* empty buffer whilst capturing - expected to be an @@ -347,7 +358,8 @@ static void buffer_cb(struct vchiq_mmal_instance *instance, &dev->capture.frame_count, sizeof(dev->capture.frame_count)); } - if (vchiq_mmal_submit_buffer(instance, port, buf)) + if (vchiq_mmal_submit_buffer(instance, port, + &buf->mmal)) v4l2_dbg(1, bcm2835_v4l2_debug, &dev->v4l2_dev, "Failed to return EOS buffer"); } else { @@ -367,16 +379,16 @@ static void buffer_cb(struct vchiq_mmal_instance *instance, return; } - if (dev->capture.vc_start_timestamp != -1 && pts) { + if (dev->capture.vc_start_timestamp != -1 && mmal_buf->pts) { ktime_t timestamp; - s64 runtime_us = pts - dev->capture.vc_start_timestamp; - + s64 runtime_us = mmal_buf->pts - + dev->capture.vc_start_timestamp; timestamp = ktime_add_us(dev->capture.kernel_start_ts, runtime_us); v4l2_dbg(1, bcm2835_v4l2_debug, &dev->v4l2_dev, "Convert start time %llu and %llu with offset %llu to %llu\n", ktime_to_ns(dev->capture.kernel_start_ts), - dev->capture.vc_start_timestamp, pts, + dev->capture.vc_start_timestamp, mmal_buf->pts, ktime_to_ns(timestamp)); buf->vb.vb2_buf.timestamp = ktime_to_ns(timestamp); } else { @@ -385,13 +397,13 @@ static void buffer_cb(struct vchiq_mmal_instance *instance, buf->vb.sequence = dev->capture.sequence++; buf->vb.field = V4L2_FIELD_NONE; - vb2_set_plane_payload(&buf->vb.vb2_buf, 0, length); - if (mmal_flags & MMAL_BUFFER_HEADER_FLAG_KEYFRAME) + vb2_set_plane_payload(&buf->vb.vb2_buf, 0, mmal_buf->length); + if (mmal_buf->mmal_flags & MMAL_BUFFER_HEADER_FLAG_KEYFRAME) buf->vb.flags |= V4L2_BUF_FLAG_KEYFRAME; vb2_buffer_done(&buf->vb.vb2_buf, VB2_BUF_STATE_DONE); - if (mmal_flags & MMAL_BUFFER_HEADER_FLAG_EOS && + if (mmal_buf->mmal_flags & MMAL_BUFFER_HEADER_FLAG_EOS && is_capturing(dev)) { v4l2_dbg(1, bcm2835_v4l2_debug, &dev->v4l2_dev, "Grab another frame as buffer has EOS"); @@ -472,14 +484,16 @@ static void buffer_queue(struct vb2_buffer *vb) { struct bm2835_mmal_dev *dev = vb2_get_drv_priv(vb->vb2_queue); struct vb2_v4l2_buffer *vb2 = to_vb2_v4l2_buffer(vb); - struct mmal_buffer *buf = container_of(vb2, struct mmal_buffer, vb); + struct vb2_mmal_buffer *buf = + container_of(vb2, struct vb2_mmal_buffer, vb); int ret; v4l2_dbg(1, bcm2835_v4l2_debug, &dev->v4l2_dev, "%s: dev:%p buf:%p, idx %u\n", __func__, dev, buf, vb2->vb2_buf.index); - ret = vchiq_mmal_submit_buffer(dev->instance, dev->capture.port, buf); + ret = vchiq_mmal_submit_buffer(dev->instance, dev->capture.port, + &buf->mmal); if (ret < 0) v4l2_err(&dev->v4l2_dev, "%s: error submitting buffer\n", __func__); @@ -592,7 +606,7 @@ static void stop_streaming(struct vb2_queue *vq) dev->capture.frame_count = 0; /* ensure a format has actually been set */ - if (!dev->capture.port) { + if (!port) { v4l2_err(&dev->v4l2_dev, "no capture port - stream not started?\n"); return; @@ -612,11 +626,11 @@ static void stop_streaming(struct vb2_queue *vq) /* disable the connection from camera to encoder */ ret = vchiq_mmal_port_disable(dev->instance, dev->capture.camera_port); - if (!ret && dev->capture.camera_port != dev->capture.port) { + if (!ret && dev->capture.camera_port != port) { v4l2_dbg(1, bcm2835_v4l2_debug, &dev->v4l2_dev, "disabling port\n"); - ret = vchiq_mmal_port_disable(dev->instance, dev->capture.port); - } else if (dev->capture.camera_port != dev->capture.port) { + ret = vchiq_mmal_port_disable(dev->instance, port); + } else if (dev->capture.camera_port != port) { v4l2_err(&dev->v4l2_dev, "port_disable failed, error %d\n", ret); } @@ -1916,7 +1930,7 @@ static int bcm2835_mmal_probe(struct platform_device *pdev) q->type = V4L2_BUF_TYPE_VIDEO_CAPTURE; q->io_modes = VB2_MMAP | VB2_USERPTR | VB2_READ; q->drv_priv = dev; - q->buf_struct_size = sizeof(struct mmal_buffer); + q->buf_struct_size = sizeof(struct vb2_mmal_buffer); q->ops = &bm2835_mmal_video_qops; q->mem_ops = &vb2_vmalloc_memops; q->timestamp_flags = V4L2_BUF_FLAG_TIMESTAMP_MONOTONIC; diff --git a/drivers/staging/vc04_services/vchiq-mmal/mmal-common.h b/drivers/staging/vc04_services/vchiq-mmal/mmal-common.h index ce88fac7c24b..5bd7410a034a 100644 --- a/drivers/staging/vc04_services/vchiq-mmal/mmal-common.h +++ b/drivers/staging/vc04_services/vchiq-mmal/mmal-common.h @@ -49,6 +49,11 @@ struct mmal_buffer { unsigned long buffer_size; /* size of allocated buffer */ struct mmal_msg_context *msg_context; + + unsigned long length; + u32 mmal_flags; + s64 dts; + s64 pts; }; /* */ diff --git a/drivers/staging/vc04_services/vchiq-mmal/mmal-vchiq.c b/drivers/staging/vc04_services/vchiq-mmal/mmal-vchiq.c index 070ff63b3850..48feeef60091 100644 --- a/drivers/staging/vc04_services/vchiq-mmal/mmal-vchiq.c +++ b/drivers/staging/vc04_services/vchiq-mmal/mmal-vchiq.c @@ -253,17 +253,25 @@ static void buffer_work_cb(struct work_struct *work) { struct mmal_msg_context *msg_context = container_of(work, struct mmal_msg_context, u.bulk.work); + struct mmal_buffer *buffer = msg_context->u.bulk.buffer; + + if (!buffer) { + pr_err("%s: ctx: %p, No mmal buffer to pass details\n", + __func__, msg_context); + return; + } + + buffer->length = msg_context->u.bulk.buffer_used; + buffer->mmal_flags = msg_context->u.bulk.mmal_flags; + buffer->dts = msg_context->u.bulk.dts; + buffer->pts = msg_context->u.bulk.pts; atomic_dec(&msg_context->u.bulk.port->buffers_with_vpu); msg_context->u.bulk.port->buffer_cb(msg_context->u.bulk.instance, msg_context->u.bulk.port, msg_context->u.bulk.status, - msg_context->u.bulk.buffer, - msg_context->u.bulk.buffer_used, - msg_context->u.bulk.mmal_flags, - msg_context->u.bulk.dts, - msg_context->u.bulk.pts); + msg_context->u.bulk.buffer); } /* workqueue scheduled callback to handle receiving buffers @@ -1321,11 +1329,14 @@ static int port_disable(struct vchiq_mmal_instance *instance, mmalbuf = list_entry(buf_head, struct mmal_buffer, list); list_del(buf_head); - if (port->buffer_cb) + if (port->buffer_cb) { + mmalbuf->length = 0; + mmalbuf->mmal_flags = 0; + mmalbuf->dts = MMAL_TIME_UNKNOWN; + mmalbuf->pts = MMAL_TIME_UNKNOWN; port->buffer_cb(instance, - port, 0, mmalbuf, 0, 0, - MMAL_TIME_UNKNOWN, - MMAL_TIME_UNKNOWN); + port, 0, mmalbuf); + } } spin_unlock_irqrestore(&port->slock, flags); diff --git a/drivers/staging/vc04_services/vchiq-mmal/mmal-vchiq.h b/drivers/staging/vc04_services/vchiq-mmal/mmal-vchiq.h index 4e34728d87e5..cca7289761c2 100644 --- a/drivers/staging/vc04_services/vchiq-mmal/mmal-vchiq.h +++ b/drivers/staging/vc04_services/vchiq-mmal/mmal-vchiq.h @@ -44,8 +44,7 @@ struct vchiq_mmal_port; typedef void (*vchiq_mmal_buffer_cb)( struct vchiq_mmal_instance *instance, struct vchiq_mmal_port *port, - int status, struct mmal_buffer *buffer, - unsigned long length, u32 mmal_flags, s64 dts, s64 pts); + int status, struct mmal_buffer *buffer); struct vchiq_mmal_port { u32 enabled:1; From patchwork Tue Jun 23 16:41:52 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: 11621061 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 C000892A for ; Tue, 23 Jun 2020 16:49:00 +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 75374204EA for ; Tue, 23 Jun 2020 16:49:00 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="ANIF6ZU3" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 75374204EA 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=7zWXc18DZ5M7esTkH51Y/LoH6B4N5etfUw0s29d736I=; b=ANIF6ZU3noq9GbvSSb5PeJU1T fJQnS4KytnQDXq6S4bOdYS3IhXBZvgrDSwkuSl5zqfB6dIPyVgLqdK5Xwsvt2N4VlAMf1dfpcj0fz GpBhzBVTasXSE0X2Eeayg4ZgiT4JKD8ZFuXDGQ7OtlxCJWKdJ1Zl5jsU4swevjpaCtSuKlO3VeWJK ncHG/xySsXAN4HRXkeett91G9CM16xgBsOwTwaqbZo+dQhTnqRj6ElYyFMUMp0e6Z+BbxbzUUd+in lh7y7dhT34WYwh6151gb+8nUxvLJhqzI0vleyoRQpil4BY9qtrhWFeaLERh5rbVsTh61KuBghIyx7 yqOVKLmvA==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jnm41-0005nq-Dq; Tue, 23 Jun 2020 16:46:25 +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 1jnm2r-0005MJ-D7; Tue, 23 Jun 2020 16:45:17 +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 0EADCB05D; Tue, 23 Jun 2020 16:45:10 +0000 (UTC) From: Nicolas Saenz Julienne To: gregkh@linuxfoundation.org Subject: [PATCH 06/50] staging: mmal-vchiq: Fixup vchiq-mmal include ordering Date: Tue, 23 Jun 2020 18:41:52 +0200 Message-Id: <20200623164235.29566-7-nsaenzjulienne@suse.de> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20200623164235.29566-1-nsaenzjulienne@suse.de> References: <20200623164235.29566-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_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, Jacopo Mondi , kernel-list@raspberrypi.com, linux-kernel@vger.kernel.org, Nicolas Saenz Julienne , laurent.pinchart@ideasonboard.com, Dave Stevenson , 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 From: Dave Stevenson There were dependencies on including the headers in the correct order. Fix up the headers so that they include the other headers that they depend on themselves. Signed-off-by: Dave Stevenson Signed-off-by: Jacopo Mondi Signed-off-by: Nicolas Saenz Julienne --- drivers/staging/vc04_services/vchiq-mmal/mmal-msg.h | 1 + drivers/staging/vc04_services/vchiq-mmal/mmal-vchiq.h | 1 + 2 files changed, 2 insertions(+) diff --git a/drivers/staging/vc04_services/vchiq-mmal/mmal-msg.h b/drivers/staging/vc04_services/vchiq-mmal/mmal-msg.h index 43cc59316f90..91f9b400d8dc 100644 --- a/drivers/staging/vc04_services/vchiq-mmal/mmal-msg.h +++ b/drivers/staging/vc04_services/vchiq-mmal/mmal-msg.h @@ -38,6 +38,7 @@ #include "mmal-msg-common.h" #include "mmal-msg-format.h" #include "mmal-msg-port.h" +#include "mmal-vchiq.h" enum mmal_msg_type { MMAL_MSG_TYPE_QUIT = 1, diff --git a/drivers/staging/vc04_services/vchiq-mmal/mmal-vchiq.h b/drivers/staging/vc04_services/vchiq-mmal/mmal-vchiq.h index cca7289761c2..df608585063b 100644 --- a/drivers/staging/vc04_services/vchiq-mmal/mmal-vchiq.h +++ b/drivers/staging/vc04_services/vchiq-mmal/mmal-vchiq.h @@ -16,6 +16,7 @@ #ifndef MMAL_VCHIQ_H #define MMAL_VCHIQ_H +#include "mmal-common.h" #include "mmal-msg-format.h" #define MAX_PORT_COUNT 4 From patchwork Tue Jun 23 16:41:53 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: 11621067 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 B939F913 for ; Tue, 23 Jun 2020 16:49:20 +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 9267E2070E for ; Tue, 23 Jun 2020 16:49:20 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="CZPs4VRR" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 9267E2070E 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=XAOSvuqBnPXGSKGZ61fm+WjhHvpTmZ0sX8rCjFdwD4g=; b=CZPs4VRRguezWqBPMusR9FkiE Z5t6rxqU4TayDHgd2ft6oGnJ36/Jg7CLPa/ktD7zGvbeTSREQrj+dMSpmXjYq9NogFWz0xdZlOURM 1xDb1LV9ZcUTbWt3mCdrkWy2TIf0vMaloug9v+DzmmJInIXsMkOfGstTZJIB2LmvW5pBwBCPyFAD0 1x/I9zufU4EgV8RAr+6eGMD0jd2564ERPNCT6Fi+4UhMrdXU3Q/I6zeXKVMT2EU3vT0DSiiwTv7Xa o9C4K8nbxXH26K+zYpzXj8ATRLoLhz0zS6HH2+HvZdawub0U5xHFTMyOaGRCXY0fmldmWfXu6xlw5 flwWVCiDQ==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jnm4V-00061j-2T; Tue, 23 Jun 2020 16:46:56 +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 1jnm2r-0005ML-D7; Tue, 23 Jun 2020 16:45:19 +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 88BC7B066; Tue, 23 Jun 2020 16:45:10 +0000 (UTC) From: Nicolas Saenz Julienne To: gregkh@linuxfoundation.org Subject: [PATCH 07/50] staging: mmal-vchiq: Fix client_component for 64 bit kernel Date: Tue, 23 Jun 2020 18:41:53 +0200 Message-Id: <20200623164235.29566-8-nsaenzjulienne@suse.de> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20200623164235.29566-1-nsaenzjulienne@suse.de> References: <20200623164235.29566-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_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, Jacopo Mondi , kernel-list@raspberrypi.com, linux-kernel@vger.kernel.org, Nicolas Saenz Julienne , laurent.pinchart@ideasonboard.com, Dave Stevenson , 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 From: Dave Stevenson The MMAL client_component field is used with the event mechanism to allow the client to identify the component for which the event is generated. The field is only 32bits in size, therefore we can't use a pointer to the component in a 64 bit kernel. Component handles are already held in an array per VCHI instance, so use the array index as the client_component handle to avoid having to create a new IDR for this purpose. Signed-off-by: Dave Stevenson Signed-off-by: Jacopo Mondi Signed-off-by: Nicolas Saenz Julienne --- drivers/staging/vc04_services/vchiq-mmal/mmal-vchiq.c | 8 +++++++- drivers/staging/vc04_services/vchiq-mmal/mmal-vchiq.h | 1 + 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/drivers/staging/vc04_services/vchiq-mmal/mmal-vchiq.c b/drivers/staging/vc04_services/vchiq-mmal/mmal-vchiq.c index 48feeef60091..c598a10452be 100644 --- a/drivers/staging/vc04_services/vchiq-mmal/mmal-vchiq.c +++ b/drivers/staging/vc04_services/vchiq-mmal/mmal-vchiq.c @@ -943,7 +943,7 @@ static int create_component(struct vchiq_mmal_instance *instance, /* build component create message */ m.h.type = MMAL_MSG_TYPE_COMPONENT_CREATE; - m.u.component_create.client_component = (u32)(unsigned long)component; + m.u.component_create.client_component = component->client_component; strncpy(m.u.component_create.name, name, sizeof(m.u.component_create.name)); @@ -1662,6 +1662,12 @@ int vchiq_mmal_component_init(struct vchiq_mmal_instance *instance, goto unlock; } + /* We need a handle to reference back to our component structure. + * Use the array index in instance->component rather than rolling + * another IDR. + */ + component->client_component = idx; + ret = create_component(instance, component, name); if (ret < 0) { pr_err("%s: failed to create component %d (Not enough GPU mem?)\n", diff --git a/drivers/staging/vc04_services/vchiq-mmal/mmal-vchiq.h b/drivers/staging/vc04_services/vchiq-mmal/mmal-vchiq.h index df608585063b..1dc81ecf9268 100644 --- a/drivers/staging/vc04_services/vchiq-mmal/mmal-vchiq.h +++ b/drivers/staging/vc04_services/vchiq-mmal/mmal-vchiq.h @@ -92,6 +92,7 @@ struct vchiq_mmal_component { struct vchiq_mmal_port input[MAX_PORT_COUNT]; /* input ports */ struct vchiq_mmal_port output[MAX_PORT_COUNT]; /* output ports */ struct vchiq_mmal_port clock[MAX_PORT_COUNT]; /* clock ports */ + u32 client_component; /* Used to ref back to client struct */ }; int vchiq_mmal_init(struct vchiq_mmal_instance **out_instance); From patchwork Tue Jun 23 16:41:54 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: 11621069 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 0AE61913 for ; Tue, 23 Jun 2020 16:49:28 +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 AE540204EA for ; Tue, 23 Jun 2020 16:49:27 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="QvkXxluv" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org AE540204EA 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=X+ravYZrJTRe7nDfNJkXTASi0GJar6Nm1wWHy7GP8TQ=; b=QvkXxluveIWS/krS7YnfZ4063 5wyDNsVDT2BpZGvXcHn4i0M0RaZwClMupDRctH9ETyKNG2ZOm+Lj8Jdh9z0CSPsAvpt/UlQp8pjAG 4zA4uWRAnWbcCzH97mUr9Dgg0WUgM9s/+XI+WLreiMuyuuPFJo35fry6n2ILiWEtzZ0VwLGNBQ/Qp JkvEj+2U4kZTVi4MzydNY/jTzBUq3gmfynnegAvusyJ+KmK71elsDqZxWeSVyX1fGGdX23/6oCaiU NOxdpLe5kYtznyvGbehsQCVQMUt9yY9P16WPCqcnCknmCPXZPEIiTvCe1DYFh0N82l873MHv9KnQN wlYlrAuQw==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jnm4O-0005yi-Q2; Tue, 23 Jun 2020 16:46:48 +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 1jnm2r-0005MM-DO; Tue, 23 Jun 2020 16:45:17 +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 0B796B03F; Tue, 23 Jun 2020 16:45:11 +0000 (UTC) From: Nicolas Saenz Julienne To: gregkh@linuxfoundation.org Subject: [PATCH 08/50] staging: mmal-vchiq: Always return the param size from param_get Date: Tue, 23 Jun 2020 18:41:54 +0200 Message-Id: <20200623164235.29566-9-nsaenzjulienne@suse.de> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20200623164235.29566-1-nsaenzjulienne@suse.de> References: <20200623164235.29566-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_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, Jacopo Mondi , kernel-list@raspberrypi.com, linux-kernel@vger.kernel.org, Nicolas Saenz Julienne , laurent.pinchart@ideasonboard.com, Dave Stevenson , 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 From: Dave Stevenson mmal-vchiq is a reimplementation of the userland library for MMAL. When getting a parameter, the client provides the storage and the size of the storage. The VPU then returns the size of the parameter that it wished to return, and as much as possible of that parameter is returned to the client. The implementation previously only returned the size provided by the VPU should it exceed the buffer size. So for parameters such as the supported encodings list the client had no idea how much of the provided storage had been populated. Signed-off-by: Dave Stevenson Signed-off-by: Jacopo Mondi Signed-off-by: Nicolas Saenz Julienne --- drivers/staging/vc04_services/vchiq-mmal/mmal-vchiq.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/staging/vc04_services/vchiq-mmal/mmal-vchiq.c b/drivers/staging/vc04_services/vchiq-mmal/mmal-vchiq.c index c598a10452be..df2957abc37c 100644 --- a/drivers/staging/vc04_services/vchiq-mmal/mmal-vchiq.c +++ b/drivers/staging/vc04_services/vchiq-mmal/mmal-vchiq.c @@ -1282,11 +1282,12 @@ static int port_parameter_get(struct vchiq_mmal_instance *instance, */ memcpy(value, &rmsg->u.port_parameter_get_reply.value, *value_size); - *value_size = rmsg->u.port_parameter_get_reply.size; } else { memcpy(value, &rmsg->u.port_parameter_get_reply.value, rmsg->u.port_parameter_get_reply.size); } + /* Always report the size of the returned parameter to the caller */ + *value_size = rmsg->u.port_parameter_get_reply.size; pr_debug("%s:result:%d component:0x%x port:%d parameter:%d\n", __func__, ret, port->component->handle, port->handle, parameter_id); From patchwork Tue Jun 23 16:41:55 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: 11621071 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 70EF0913 for ; Tue, 23 Jun 2020 16:49:52 +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 493EC204EA for ; Tue, 23 Jun 2020 16:49:52 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="lEBpeSUr" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 493EC204EA 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=X4vC/g4PCinCFsedPA0RoAcdDOoTHbUHsPwN+krEudE=; b=lEBpeSUrayZS2Zc30mdbvvo4C KsnbaoG12z9Zvi7CWStxQddarP3jbhIWcjUIMpCL42dxBRcKLNjZy9PfqLaFrrz3dtHtr9HgL64BB TyO7L6X9LH9ycSdY0OzziDVV/xy7ssM/jllFj2JycNPCWBah05FS8GtD8nLI2kbrhOYEh3llHi7wF fjpvQZBHy8lT4LmWLDPhiVuAiX48BXCSva4JaOquaRBeZi4xVSo3mrerK4ZPlWeAwWnelWb/yXhBn 9wK00XBaPnfYVI2/542A6rDW3ZHXsnkRNlMl/EXUYHWrNl2bIg1NktTrT/smmQfnPFTpnCpLZYNzl vzGRR+y7g==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jnm4a-00064l-Ev; Tue, 23 Jun 2020 16:47:00 +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 1jnm2u-0005NU-K8; Tue, 23 Jun 2020 16:45:19 +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 810E8AEDD; Tue, 23 Jun 2020 16:45:11 +0000 (UTC) From: Nicolas Saenz Julienne To: gregkh@linuxfoundation.org Subject: [PATCH 09/50] staging: mmal-vchiq: If the VPU returns an error, don't negate it Date: Tue, 23 Jun 2020 18:41:55 +0200 Message-Id: <20200623164235.29566-10-nsaenzjulienne@suse.de> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20200623164235.29566-1-nsaenzjulienne@suse.de> References: <20200623164235.29566-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_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, Jacopo Mondi , kernel-list@raspberrypi.com, linux-kernel@vger.kernel.org, Nicolas Saenz Julienne , laurent.pinchart@ideasonboard.com, Dave Stevenson , 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 From: Dave Stevenson There is an enum for the errors that the VPU can return. port_parameter_get was negating that value, but also using -EINVAL from the Linux error codes. Pass the VPU error code as positive values. Should the function need to pass a Linux failure, then return that as negative. Signed-off-by: Dave Stevenson Signed-off-by: Jacopo Mondi Signed-off-by: Nicolas Saenz Julienne --- drivers/staging/vc04_services/vchiq-mmal/mmal-vchiq.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/staging/vc04_services/vchiq-mmal/mmal-vchiq.c b/drivers/staging/vc04_services/vchiq-mmal/mmal-vchiq.c index df2957abc37c..a7ab0e521184 100644 --- a/drivers/staging/vc04_services/vchiq-mmal/mmal-vchiq.c +++ b/drivers/staging/vc04_services/vchiq-mmal/mmal-vchiq.c @@ -1270,7 +1270,8 @@ static int port_parameter_get(struct vchiq_mmal_instance *instance, goto release_msg; } - ret = -rmsg->u.port_parameter_get_reply.status; + ret = rmsg->u.port_parameter_get_reply.status; + /* port_parameter_get_reply.size includes the header, * whilst *value_size doesn't. */ From patchwork Tue Jun 23 16:41:56 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: 11621075 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 25162138C for ; Tue, 23 Jun 2020 16:50:04 +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 F0A9B2070E for ; Tue, 23 Jun 2020 16:50:03 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="HmSbRax/" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org F0A9B2070E 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=Pxp2hrUmuuSZNZkrULeCW/8KYz7hPw0r+wkHijiZuAg=; b=HmSbRax/rspNRA4PnEzwdqHy+ LmCFRLpFRgf607kPLpLBy/6ZcnQyUNoTqj6lR1mG7AeaQjLx7TxJdie4boZvkO+m13ecM9tC5jwGW Lh3kY9pbBBdQ0lKLUYE7I6crfvE07JEjYSvcLq8hy4j6xJu7bNmqS/7ZOFd0oMocG06QPq89T+lkV O3LSV9HIW5V6GtfIs+JYWrgUA6AFhq9yN02SQ+j4IVyNT+AHpm3AQyjk6KzlVLVuFe2CDLQjvbf6G z4Lxej74K1EIvTLvIqhxz32D+GCWDpMGI3A9mCvlRWuLiALutDY3/U6VMGCLl/SEo/NjKUz/d3bIg yPu831zqA==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jnm4o-0006B1-Fl; Tue, 23 Jun 2020 16:47:14 +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 1jnm2u-0005NT-K6; Tue, 23 Jun 2020 16:45:20 +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 0B2E9AEE5; Tue, 23 Jun 2020 16:45:12 +0000 (UTC) From: Nicolas Saenz Julienne To: gregkh@linuxfoundation.org Subject: [PATCH 10/50] staging: mmal-vchiq: Fix formatting errors in mmal_parameters.h Date: Tue, 23 Jun 2020 18:41:56 +0200 Message-Id: <20200623164235.29566-11-nsaenzjulienne@suse.de> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20200623164235.29566-1-nsaenzjulienne@suse.de> References: <20200623164235.29566-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_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, Jacopo Mondi , kernel-list@raspberrypi.com, linux-kernel@vger.kernel.org, Nicolas Saenz Julienne , Naushir Patuck , 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 From: Naushir Patuck No functional changes in this commit. - Remove erroneous whitespace. - Remove _t postfix label on structs and enums. Signed-off-by: Naushir Patuck Signed-off-by: Jacopo Mondi Signed-off-by: Nicolas Saenz Julienne --- .../bcm2835-camera/bcm2835-camera.c | 2 +- .../vchiq-mmal/mmal-parameters.h | 32 +++++++++---------- 2 files changed, 17 insertions(+), 17 deletions(-) diff --git a/drivers/staging/vc04_services/bcm2835-camera/bcm2835-camera.c b/drivers/staging/vc04_services/bcm2835-camera/bcm2835-camera.c index 73b2354a6bb7..df90c1f9d148 100644 --- a/drivers/staging/vc04_services/bcm2835-camera/bcm2835-camera.c +++ b/drivers/staging/vc04_services/bcm2835-camera/bcm2835-camera.c @@ -1497,7 +1497,7 @@ static int get_num_cameras(struct vchiq_mmal_instance *instance, { int ret; struct vchiq_mmal_component *cam_info_component; - struct mmal_parameter_camera_info_t cam_info = {0}; + struct mmal_parameter_camera_info cam_info = {0}; u32 param_size = sizeof(cam_info); int i; diff --git a/drivers/staging/vc04_services/vchiq-mmal/mmal-parameters.h b/drivers/staging/vc04_services/vchiq-mmal/mmal-parameters.h index f4ac5a6149ea..a1e39b1b1701 100644 --- a/drivers/staging/vc04_services/vchiq-mmal/mmal-parameters.h +++ b/drivers/staging/vc04_services/vchiq-mmal/mmal-parameters.h @@ -23,21 +23,21 @@ #define MMAL_PARAMETERS_H /** Common parameter ID group, used with many types of component. */ -#define MMAL_PARAMETER_GROUP_COMMON (0 << 16) +#define MMAL_PARAMETER_GROUP_COMMON (0 << 16) /** Camera-specific parameter ID group. */ -#define MMAL_PARAMETER_GROUP_CAMERA (1 << 16) +#define MMAL_PARAMETER_GROUP_CAMERA (1 << 16) /** Video-specific parameter ID group. */ -#define MMAL_PARAMETER_GROUP_VIDEO (2 << 16) +#define MMAL_PARAMETER_GROUP_VIDEO (2 << 16) /** Audio-specific parameter ID group. */ -#define MMAL_PARAMETER_GROUP_AUDIO (3 << 16) +#define MMAL_PARAMETER_GROUP_AUDIO (3 << 16) /** Clock-specific parameter ID group. */ -#define MMAL_PARAMETER_GROUP_CLOCK (4 << 16) +#define MMAL_PARAMETER_GROUP_CLOCK (4 << 16) /** Miracast-specific parameter ID group. */ -#define MMAL_PARAMETER_GROUP_MIRACAST (5 << 16) +#define MMAL_PARAMETER_GROUP_MIRACAST (5 << 16) /* Common parameters */ enum mmal_parameter_common_type { - /**< Never a valid parameter ID */ + /**< Never a valid parameter ID */ MMAL_PARAMETER_UNUSED = MMAL_PARAMETER_GROUP_COMMON, /**< MMAL_PARAMETER_ENCODING_T */ @@ -341,7 +341,7 @@ enum mmal_parameter_imagefx { MMAL_PARAM_IMAGEFX_CARTOON, }; -enum MMAL_PARAM_FLICKERAVOID_T { +enum MMAL_PARAM_FLICKERAVOID { MMAL_PARAM_FLICKERAVOID_OFF, MMAL_PARAM_FLICKERAVOID_AUTO, MMAL_PARAM_FLICKERAVOID_50HZ, @@ -723,7 +723,7 @@ struct mmal_parameter_imagefx_parameters { #define MMAL_PARAMETER_CAMERA_INFO_MAX_FLASHES 2 #define MMAL_PARAMETER_CAMERA_INFO_MAX_STR_LEN 16 -struct mmal_parameter_camera_info_camera_t { +struct mmal_parameter_camera_info_camera { u32 port_id; u32 max_width; u32 max_height; @@ -731,7 +731,7 @@ struct mmal_parameter_camera_info_camera_t { u8 camera_name[MMAL_PARAMETER_CAMERA_INFO_MAX_STR_LEN]; }; -enum mmal_parameter_camera_info_flash_type_t { +enum mmal_parameter_camera_info_flash_type { /* Make values explicit to ensure they match values in config ini */ MMAL_PARAMETER_CAMERA_INFO_FLASH_TYPE_XENON = 0, MMAL_PARAMETER_CAMERA_INFO_FLASH_TYPE_LED = 1, @@ -739,16 +739,16 @@ enum mmal_parameter_camera_info_flash_type_t { MMAL_PARAMETER_CAMERA_INFO_FLASH_TYPE_MAX = 0x7FFFFFFF }; -struct mmal_parameter_camera_info_flash_t { - enum mmal_parameter_camera_info_flash_type_t flash_type; +struct mmal_parameter_camera_info_flash { + enum mmal_parameter_camera_info_flash_type flash_type; }; -struct mmal_parameter_camera_info_t { +struct mmal_parameter_camera_info { u32 num_cameras; u32 num_flashes; - struct mmal_parameter_camera_info_camera_t - cameras[MMAL_PARAMETER_CAMERA_INFO_MAX_CAMERAS]; - struct mmal_parameter_camera_info_flash_t + struct mmal_parameter_camera_info_camera + cameras[MMAL_PARAMETER_CAMERA_INFO_MAX_CAMERAS]; + struct mmal_parameter_camera_info_flash flashes[MMAL_PARAMETER_CAMERA_INFO_MAX_FLASHES]; }; From patchwork Tue Jun 23 16:41:57 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: 11621077 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 1D39B92A for ; Tue, 23 Jun 2020 16:50:17 +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 EAA8A2070E for ; Tue, 23 Jun 2020 16:50:16 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="vEXdnhRF" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org EAA8A2070E 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=t2VqFfzDbxzDwUnAo4roSsckbPv3KpMUAF/KSBZbdX8=; b=vEXdnhRF/WORgpavcfYmpmDjE HoDqayAhNkyO3pyB1sKhEXGEWzBk63Jyz60jDdaxQ9ERi4auBT6wPU/USro9XfT9jHY9/tMPTccWO DwaOoQj9gC7nyYBJujQYhAEqBew67bK8L91FzdQ2eSeDFYoIioj2hkavfFnqBqaCogi27eSOFlz5m NP+dlGITXOs3gfVEqZ6vOte/4JrF8O2YAgn4qiM3URceJYOo9JsKv0aritWwmju6WMw/pOszV8VXO nX6/Nw79dmZH/8/uwwp2zwLK8AqCnFMt8smTlds1JpJYm0NNns+/x2wv0UDIN7/m43m61YD/4lNqm owG9gZl8Q==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jnm50-0006KS-2C; Tue, 23 Jun 2020 16:47:26 +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 1jnm2w-0005OG-3u; Tue, 23 Jun 2020 16:45:21 +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 80FEDAEF3; Tue, 23 Jun 2020 16:45:12 +0000 (UTC) From: Nicolas Saenz Julienne To: gregkh@linuxfoundation.org Subject: [PATCH 11/50] staging: vchiq_arm: Add a matching unregister call Date: Tue, 23 Jun 2020 18:41:57 +0200 Message-Id: <20200623164235.29566-12-nsaenzjulienne@suse.de> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20200623164235.29566-1-nsaenzjulienne@suse.de> References: <20200623164235.29566-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_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, Jacopo Mondi , kernel-list@raspberrypi.com, linux-kernel@vger.kernel.org, Nicolas Saenz Julienne , laurent.pinchart@ideasonboard.com, Phil Elwell , 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 From: Phil Elwell All the registered children of vchiq have a corresponding call to platform_device_unregister except bcm2835_audio. Fix that. Fixes: 25c7597af20d ("staging: vchiq_arm: Register a platform device for audio") Signed-off-by: Phil Elwell Signed-off-by: Jacopo Mondi Signed-off-by: Nicolas Saenz Julienne --- drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c index 28ea8c3a4cba..355590f1e130 100644 --- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c +++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c @@ -2805,6 +2805,7 @@ static int vchiq_probe(struct platform_device *pdev) static int vchiq_remove(struct platform_device *pdev) { + platform_device_unregister(bcm2835_audio); platform_device_unregister(bcm2835_camera); vchiq_debugfs_deinit(); device_destroy(vchiq_class, vchiq_devid); From patchwork Tue Jun 23 16:41:58 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: 11621073 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 70C5A913 for ; Tue, 23 Jun 2020 16:49:53 +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 47E5F204EA for ; Tue, 23 Jun 2020 16:49:53 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="Rnag1tqT" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 47E5F204EA 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=VJwO1U19kV4EgmM+9sTp4/Lzh01lUXfd3xg1/4NQnQA=; b=Rnag1tqTct1xqkUaY3hpDjvWg Kq8ySt10m8jnvpNrSFG5aNvgdnHv4GIWKFoQZ22oWHKOs5X1aWY0e08PgLMit5M76G0JaZopMhrbz h+kp4a6oynQo8Hs1WCha/bjVCD+7PMcX+hJNDdJLxLKj2i/+6iPI77Js876DHHg/xK2LOwepBCyys KvQ+7/qV3CjvXpzG8FmtA/ovCyyKLixavO9A9vCrfJ9thhVlsbPtchmSeIBA5jpYFmMqz7AUOR3vu FppplE9+GyQxVHiRsHMV4ZZ0D2W5J1DDH2LdnLM+mBz0JmnKtMHKBDzE53+iLdCTeqe/SDlfb3IUE uFpA+tmGw==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jnm4s-0006EZ-F7; Tue, 23 Jun 2020 16:47:18 +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 1jnm2w-0005OF-3p; Tue, 23 Jun 2020 16:45:20 +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 E12C6AECB; Tue, 23 Jun 2020 16:45:12 +0000 (UTC) From: Nicolas Saenz Julienne To: gregkh@linuxfoundation.org Subject: [PATCH 12/50] staging: vchi: Get rid of all useless callback reasons Date: Tue, 23 Jun 2020 18:41:58 +0200 Message-Id: <20200623164235.29566-13-nsaenzjulienne@suse.de> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20200623164235.29566-1-nsaenzjulienne@suse.de> References: <20200623164235.29566-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_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, 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 They are neither produced nor expected, so just delete them. Signed-off-by: Nicolas Saenz Julienne --- .../interface/vchi/vchi_common.h | 40 ++----------------- 1 file changed, 3 insertions(+), 37 deletions(-) diff --git a/drivers/staging/vc04_services/interface/vchi/vchi_common.h b/drivers/staging/vc04_services/interface/vchi/vchi_common.h index 7fc04e38936d..0f79bea4757d 100644 --- a/drivers/staging/vc04_services/interface/vchi/vchi_common.h +++ b/drivers/staging/vc04_services/interface/vchi/vchi_common.h @@ -31,8 +31,6 @@ enum vchi_crc_control { //callback reasons when an event occurs on a service enum vchi_callback_reason { - VCHI_CALLBACK_REASON_MIN, - /* * This indicates that there is data available handle is the msg id that * was transmitted with the data @@ -41,44 +39,12 @@ enum vchi_callback_reason { * 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_MSG_SENT, - VCHI_CALLBACK_MSG_SPACE_AVAILABLE, // XXX not yet implemented - - // This indicates that a transfer from the other side has completed - VCHI_CALLBACK_BULK_RECEIVED, - //This indicates that data queued up to be sent has now gone - //handle is the msg id that was used when sending the data VCHI_CALLBACK_BULK_SENT, - VCHI_CALLBACK_BULK_RX_SPACE_AVAILABLE, // XXX not yet implemented - VCHI_CALLBACK_BULK_TX_SPACE_AVAILABLE, // XXX not yet implemented - - VCHI_CALLBACK_SERVICE_CLOSED, - - /* - * this side has sent XOFF to peer due to lack of data consumption by - * service (suggests the service may need to take some recovery action - * if it has been deliberately holding off consuming data) - */ - VCHI_CALLBACK_SENT_XOFF, - VCHI_CALLBACK_SENT_XON, - - // indicates that a bulk transfer has finished reading the source buffer - VCHI_CALLBACK_BULK_DATA_READ, - - // power notification events (currently host side only) - VCHI_CALLBACK_PEER_OFF, - VCHI_CALLBACK_PEER_SUSPENDED, - VCHI_CALLBACK_PEER_ON, - VCHI_CALLBACK_PEER_RESUMED, - VCHI_CALLBACK_FORCED_POWER_OFF, - - // some extra notifications provided by vchiq_arm - VCHI_CALLBACK_SERVICE_OPENED, - VCHI_CALLBACK_BULK_RECEIVE_ABORTED, + VCHI_CALLBACK_BULK_RECEIVED, VCHI_CALLBACK_BULK_TRANSMIT_ABORTED, - - VCHI_CALLBACK_REASON_MAX + VCHI_CALLBACK_BULK_RECEIVE_ABORTED, }; // service control options From patchwork Tue Jun 23 16:41:59 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: 11621079 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 B062092A for ; Tue, 23 Jun 2020 16:50:40 +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 7931A2076E for ; Tue, 23 Jun 2020 16:50:40 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="VZmwJzhX" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 7931A2076E 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=H1HheO0hoMue6twfBbAjMe++oUdRB/HJSCimsNAo978=; b=VZmwJzhX+biaNenzhRmct+cx7 MkuyK98PkHFXkEaW+HeJApKlK1PbDrDIfoLDw+jIeEI2gYr1stFE6Ssp7mqUnkihzercTAIXy5lGO 14Nm09Mrculz+wJvwPZDBlzPPWXu9eFauy6mWsCh3MNF+b+lMmaxIRn/NjpfqFvlvDaJjPLQddQGZ C+Wt0c/ALbAxxiqDCkF8e9QSsCeowLvySd6WKsvweIo3MoDDT10gMTMrtU0Kh1F3wXMeGXcykzrbc eelAPwEO3S9w6fShvpZYBJCd9j4ipKnpo0MsLUPT0+uGd3/r/XgD9/M2DQseoe8KsQkNK+gpAk8i1 5W3IA8Pqg==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jnm5O-0006Zo-Vj; Tue, 23 Jun 2020 16:47:51 +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 1jnm2w-0005ON-6u; Tue, 23 Jun 2020 16:45:22 +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 A19AEAED2; Tue, 23 Jun 2020 16:45:13 +0000 (UTC) From: Nicolas Saenz Julienne To: gregkh@linuxfoundation.org Subject: [PATCH 13/50] staging: vchi: Get rid of vchi_msg_peek() Date: Tue, 23 Jun 2020 18:41:59 +0200 Message-Id: <20200623164235.29566-14-nsaenzjulienne@suse.de> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20200623164235.29566-1-nsaenzjulienne@suse.de> References: <20200623164235.29566-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_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, 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 There already is a function that covers most of the functionality vchi_msg_peek() provides: vchi_msg_hold(). The main difference being that the later removes the message from vchu's queue while the other does it later on, while releasing the message. There are no users of this function that can't be trivially converted to vchi_msg_hold(). So, for the sake of removing duplicate code, get rid of vchi_msg_peek(). Note that the opposite change could be performed as well. But vchi_msg_peek()'s implementation was deemed less robust as messages have to be released in order. Signed-off-by: Nicolas Saenz Julienne --- .../vc04_services/interface/vchi/vchi.h | 12 ---- .../interface/vchiq_arm/vchiq_shim.c | 64 ------------------- .../interface/vchiq_arm/vchiq_util.c | 12 ---- .../interface/vchiq_arm/vchiq_util.h | 1 - 4 files changed, 89 deletions(-) diff --git a/drivers/staging/vc04_services/interface/vchi/vchi.h b/drivers/staging/vc04_services/interface/vchi/vchi.h index 1a981e98e82b..1daef5ad70f1 100644 --- a/drivers/staging/vc04_services/interface/vchi/vchi.h +++ b/drivers/staging/vc04_services/interface/vchi/vchi.h @@ -103,18 +103,6 @@ extern int32_t vchi_msg_dequeue(struct vchi_service_handle *handle, uint32_t *actual_msg_size, enum vchi_flags flags); -// Routine to look at a message in place. -// The message is not dequeued, so a subsequent call to peek or dequeue -// will return the same message. -extern int32_t vchi_msg_peek(struct vchi_service_handle *handle, - void **data, - uint32_t *msg_size, - enum vchi_flags flags); - -// Routine to remove a message after it has been read in place with peek -// The first message on the queue is dequeued. -extern int32_t vchi_msg_remove(struct vchi_service_handle *handle); - // 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. 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 75d87b6992c4..54c2492b7c83 100644 --- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_shim.c +++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_shim.c @@ -18,70 +18,6 @@ struct shim_service { void *callback_param; }; -/*********************************************************** - * Name: vchi_msg_peek - * - * Arguments: struct vchi_service_handle *handle, - * void **data, - * uint32_t *msg_size, - - * enum vchi_flags flags - * - * Description: Routine to return a pointer to the current message (to allow in - * place processing). The message can be removed using - * vchi_msg_remove when you're finished - * - * Returns: int32_t - success == 0 - * - ***********************************************************/ -int32_t vchi_msg_peek(struct vchi_service_handle *handle, - void **data, - uint32_t *msg_size, - enum vchi_flags flags) -{ - struct shim_service *service = (struct shim_service *)handle; - struct vchiq_header *header; - - WARN_ON((flags != VCHI_FLAGS_NONE) && - (flags != VCHI_FLAGS_BLOCK_UNTIL_OP_COMPLETE)); - - if (flags == VCHI_FLAGS_NONE) - if (vchiu_queue_is_empty(&service->queue)) - return -1; - - header = vchiu_queue_peek(&service->queue); - - *data = header->data; - *msg_size = header->size; - - return 0; -} -EXPORT_SYMBOL(vchi_msg_peek); - -/*********************************************************** - * Name: vchi_msg_remove - * - * Arguments: struct vchi_service_handle *handle, - * - * Description: Routine to remove a message (after it has been read with - * vchi_msg_peek) - * - * Returns: int32_t - success == 0 - * - ***********************************************************/ -int32_t vchi_msg_remove(struct vchi_service_handle *handle) -{ - struct shim_service *service = (struct shim_service *)handle; - struct vchiq_header *header; - - header = vchiu_queue_pop(&service->queue); - - vchiq_release_message(service->handle, header); - - return 0; -} -EXPORT_SYMBOL(vchi_msg_remove); - int vchi_queue_kernel_message(struct vchi_service_handle *handle, void *data, unsigned int size) { diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_util.c b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_util.c index 644844d88fed..c1c81f9ab9e6 100644 --- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_util.c +++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_util.c @@ -55,18 +55,6 @@ void vchiu_queue_push(struct vchiu_queue *queue, struct vchiq_header *header) complete(&queue->push); } -struct vchiq_header *vchiu_queue_peek(struct vchiu_queue *queue) -{ - while (queue->write == queue->read) { - if (wait_for_completion_interruptible(&queue->push)) - flush_signals(current); - } - - complete(&queue->push); // We haven't removed anything from the queue. - - return queue->storage[queue->read & (queue->size - 1)]; -} - struct vchiq_header *vchiu_queue_pop(struct vchiu_queue *queue) { struct vchiq_header *header; diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_util.h b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_util.h index f03a4250de0d..1c90a8da1a92 100644 --- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_util.h +++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_util.h @@ -44,7 +44,6 @@ extern int vchiu_queue_is_empty(struct vchiu_queue *queue); extern void vchiu_queue_push(struct vchiu_queue *queue, struct vchiq_header *header); -extern struct vchiq_header *vchiu_queue_peek(struct vchiu_queue *queue); extern struct vchiq_header *vchiu_queue_pop(struct vchiu_queue *queue); #endif From patchwork Tue Jun 23 16:42:00 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: 11621087 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 B629092A for ; Tue, 23 Jun 2020 16:51:26 +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 7DE6820774 for ; Tue, 23 Jun 2020 16:51:26 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="IgxuVw3h" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 7DE6820774 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=V0NdsHfWm8w1wcCO5cm5XVktJzUrHIjhd8v6o13RSDU=; b=IgxuVw3hGrBBJn8tRG4fKrBin FsZ8nAtd4MnH/Hs/oD1HfFol8HHwdNkTsGF+1fWLRqMaQGMq7tJHU3oayjSMSL94gh8OJ+l9Knpos t+ju2WLlBeIDQYwmrRqIwgbxcGWoxFKSA023cLuZXFZc0As1JKa7y4CA5tWYP3HpQZ7042PfoE/rb 5AeLYJ6lzlSPuynl5dA9x8rIvhLcHhca40tKFUyXncfjU0dJwzlBnCPapFVRMEZ5gqi6VmAJWMrF3 Z5JBGXm1v1VFZfvfMmRPu6QN8VUtEqWTZLUQ+spJHHTi6BG6LYOYe/glupJ4PBrrfd+29P/MI4gUa O9pox7Y4A==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jnm6B-0007Bs-Ex; Tue, 23 Jun 2020 16:48:40 +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 1jnm2w-0005OO-7P; Tue, 23 Jun 2020 16:45:24 +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 86924AEC1; Tue, 23 Jun 2020 16:45:14 +0000 (UTC) From: Nicolas Saenz Julienne To: gregkh@linuxfoundation.org Subject: [PATCH 14/50] staging: vchi: Get rid of struct vchi_instance_handle Date: Tue, 23 Jun 2020 18:42:00 +0200 Message-Id: <20200623164235.29566-15-nsaenzjulienne@suse.de> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20200623164235.29566-1-nsaenzjulienne@suse.de> References: <20200623164235.29566-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_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, 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 The idea behind this was to create an opaque handle to struct vchiq_instance. This can be achieved without creating a new type by means of a forward declaration of struct vchiq_instance. This saves us from a lot of useless casting and overall simplifies code. Signed-off-by: Nicolas Saenz Julienne --- .../bcm2835-audio/bcm2835-vchiq.c | 20 ++++++------- .../vc04_services/bcm2835-audio/bcm2835.h | 2 +- .../vc04_services/interface/vchi/vchi.h | 12 ++++---- .../interface/vchiq_arm/vchiq_shim.c | 30 ++++++------------- .../vc04_services/vchiq-mmal/mmal-vchiq.c | 8 ++--- 5 files changed, 30 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 73144f1ce45e..8c9390153a26 100644 --- a/drivers/staging/vc04_services/bcm2835-audio/bcm2835-vchiq.c +++ b/drivers/staging/vc04_services/bcm2835-audio/bcm2835-vchiq.c @@ -122,7 +122,7 @@ static void audio_vchi_callback(void *param, } static int -vc_vchi_audio_init(struct vchi_instance_handle *vchi_instance, +vc_vchi_audio_init(struct vchiq_instance *vchiq_instance, struct bcm2835_audio_instance *instance) { struct service_creation params = { @@ -134,7 +134,7 @@ vc_vchi_audio_init(struct vchi_instance_handle *vchi_instance, int status; /* Open the VCHI service connections */ - status = vchi_service_open(vchi_instance, ¶ms, + status = vchi_service_open(vchiq_instance, ¶ms, &instance->vchi_handle); if (status) { @@ -173,20 +173,20 @@ int bcm2835_new_vchi_ctx(struct device *dev, struct bcm2835_vchi_ctx *vchi_ctx) int ret; /* Initialize and create a VCHI connection */ - ret = vchi_initialise(&vchi_ctx->vchi_instance); + ret = vchi_initialise(&vchi_ctx->instance); if (ret) { dev_err(dev, "failed to initialise VCHI instance (ret=%d)\n", ret); return -EIO; } - ret = vchi_connect(vchi_ctx->vchi_instance); + ret = vchi_connect(vchi_ctx->instance); if (ret) { dev_dbg(dev, "failed to connect VCHI instance (ret=%d)\n", ret); - kfree(vchi_ctx->vchi_instance); - vchi_ctx->vchi_instance = NULL; + kfree(vchi_ctx->instance); + vchi_ctx->instance = NULL; return -EIO; } @@ -196,10 +196,10 @@ int bcm2835_new_vchi_ctx(struct device *dev, struct bcm2835_vchi_ctx *vchi_ctx) void bcm2835_free_vchi_ctx(struct bcm2835_vchi_ctx *vchi_ctx) { - /* Close the VCHI connection - it will also free vchi_instance */ - WARN_ON(vchi_disconnect(vchi_ctx->vchi_instance)); + /* Close the VCHI connection - it will also free vchi_ctx->instance */ + WARN_ON(vchi_disconnect(vchi_ctx->instance)); - vchi_ctx->vchi_instance = NULL; + vchi_ctx->instance = NULL; } int bcm2835_audio_open(struct bcm2835_alsa_stream *alsa_stream) @@ -217,7 +217,7 @@ int bcm2835_audio_open(struct bcm2835_alsa_stream *alsa_stream) instance->alsa_stream = alsa_stream; alsa_stream->instance = instance; - err = vc_vchi_audio_init(vchi_ctx->vchi_instance, + err = vc_vchi_audio_init(vchi_ctx->instance, instance); if (err < 0) goto free_instance; diff --git a/drivers/staging/vc04_services/bcm2835-audio/bcm2835.h b/drivers/staging/vc04_services/bcm2835-audio/bcm2835.h index d2fe8d36ab7d..2a94e825194f 100644 --- a/drivers/staging/vc04_services/bcm2835-audio/bcm2835.h +++ b/drivers/staging/vc04_services/bcm2835-audio/bcm2835.h @@ -44,7 +44,7 @@ enum snd_bcm2835_ctrl { }; struct bcm2835_vchi_ctx { - struct vchi_instance_handle *vchi_instance; + struct vchiq_instance *instance; }; /* definition of the chip-specific record */ diff --git a/drivers/staging/vc04_services/interface/vchi/vchi.h b/drivers/staging/vc04_services/interface/vchi/vchi.h index 1daef5ad70f1..6b73d8fb394a 100644 --- a/drivers/staging/vc04_services/interface/vchi/vchi.h +++ b/drivers/staging/vc04_services/interface/vchi/vchi.h @@ -49,8 +49,8 @@ struct service_creation { void *callback_param; }; -// Opaque handle for a VCHI instance -struct vchi_instance_handle; +// Opaque handle for a VCHIQ instance +struct vchiq_instance; // Opaque handle for a server or client struct vchi_service_handle; @@ -61,19 +61,19 @@ struct vchi_service_handle; *****************************************************************************/ // Routine used to initialise the vchi on both local + remote connections -extern int32_t vchi_initialise(struct vchi_instance_handle **instance_handle); +extern int32_t vchi_initialise(struct vchiq_instance **instance); -extern int32_t vchi_connect(struct vchi_instance_handle *instance_handle); +extern int32_t vchi_connect(struct vchiq_instance *instance); //When this is called, ensure that all services have no data pending. //Bulk transfers can remain 'queued' -extern int32_t vchi_disconnect(struct vchi_instance_handle *instance_handle); +extern int32_t vchi_disconnect(struct vchiq_instance *instance); /****************************************************************************** * Global service API *****************************************************************************/ // Routine to open a named service -extern int32_t vchi_service_open(struct vchi_instance_handle *instance_handle, +extern int32_t vchi_service_open(struct vchiq_instance *instance, struct service_creation *setup, struct vchi_service_handle **handle); 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 54c2492b7c83..8758704d61c9 100644 --- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_shim.c +++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_shim.c @@ -287,7 +287,7 @@ EXPORT_SYMBOL(vchi_msg_hold); /*********************************************************** * Name: vchi_initialise * - * Arguments: struct vchi_instance_handle **instance_handle + * Arguments: struct vchiq_instance **instance * * Description: Initialises the hardware but does not transmit anything * When run as a Host App this will be called twice hence the need @@ -297,23 +297,16 @@ EXPORT_SYMBOL(vchi_msg_hold); * ***********************************************************/ -int32_t vchi_initialise(struct vchi_instance_handle **instance_handle) +int32_t vchi_initialise(struct vchiq_instance **instance) { - struct vchiq_instance *instance; - enum vchiq_status status; - - status = vchiq_initialise(&instance); - - *instance_handle = (struct vchi_instance_handle *)instance; - - return status; + return vchiq_initialise(instance); } EXPORT_SYMBOL(vchi_initialise); /*********************************************************** * Name: vchi_connect * - * Arguments: struct vchi_instance_handle *instance_handle + * Arguments: struct vchiq_instance *instance * * Description: Starts the command service on each connection, * causing INIT messages to be pinged back and forth @@ -321,10 +314,8 @@ EXPORT_SYMBOL(vchi_initialise); * Returns: 0 if successful, failure otherwise * ***********************************************************/ -int32_t vchi_connect(struct vchi_instance_handle *instance_handle) +int32_t vchi_connect(struct vchiq_instance *instance) { - struct vchiq_instance *instance = (struct vchiq_instance *)instance_handle; - return vchiq_connect(instance); } EXPORT_SYMBOL(vchi_connect); @@ -332,7 +323,7 @@ EXPORT_SYMBOL(vchi_connect); /*********************************************************** * Name: vchi_disconnect * - * Arguments: struct vchi_instance_handle *instance_handle + * Arguments: struct vchiq_instance *instance * * Description: Stops the command service on each connection, * causing DE-INIT messages to be pinged back and forth @@ -340,10 +331,8 @@ EXPORT_SYMBOL(vchi_connect); * Returns: 0 if successful, failure otherwise * ***********************************************************/ -int32_t vchi_disconnect(struct vchi_instance_handle *instance_handle) +int32_t vchi_disconnect(struct vchiq_instance *instance) { - struct vchiq_instance *instance = (struct vchiq_instance *)instance_handle; - return vchiq_shutdown(instance); } EXPORT_SYMBOL(vchi_disconnect); @@ -352,7 +341,7 @@ EXPORT_SYMBOL(vchi_disconnect); * Name: vchi_service_open * Name: vchi_service_create * - * Arguments: struct vchi_instance_handle *instance_handle + * Arguments: struct vchiq_instance *instance * struct service_creation *setup, * struct vchi_service_handle **handle * @@ -446,11 +435,10 @@ static void service_free(struct shim_service *service) } } -int32_t vchi_service_open(struct vchi_instance_handle *instance_handle, +int32_t vchi_service_open(struct vchiq_instance *instance, struct service_creation *setup, struct vchi_service_handle **handle) { - struct vchiq_instance *instance = (struct vchiq_instance *)instance_handle; struct shim_service *service = service_alloc(instance, setup); *handle = (struct vchi_service_handle *)service; diff --git a/drivers/staging/vc04_services/vchiq-mmal/mmal-vchiq.c b/drivers/staging/vc04_services/vchiq-mmal/mmal-vchiq.c index a7ab0e521184..d5a7a5b9abf9 100644 --- a/drivers/staging/vc04_services/vchiq-mmal/mmal-vchiq.c +++ b/drivers/staging/vc04_services/vchiq-mmal/mmal-vchiq.c @@ -1864,7 +1864,7 @@ int vchiq_mmal_init(struct vchiq_mmal_instance **out_instance) { int status; struct vchiq_mmal_instance *instance; - static struct vchi_instance_handle *vchi_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, @@ -1886,14 +1886,14 @@ int vchiq_mmal_init(struct vchiq_mmal_instance **out_instance) BUILD_BUG_ON(sizeof(struct mmal_port) != 64); /* create a vchi instance */ - status = vchi_initialise(&vchi_instance); + status = vchi_initialise(&vchiq_instance); if (status) { pr_err("Failed to initialise VCHI instance (status=%d)\n", status); return -EIO; } - status = vchi_connect(vchi_instance); + status = vchi_connect(vchiq_instance); if (status) { pr_err("Failed to connect VCHI instance (status=%d)\n", status); return -EIO; @@ -1918,7 +1918,7 @@ int vchiq_mmal_init(struct vchiq_mmal_instance **out_instance) if (!instance->bulk_wq) goto err_free; - status = vchi_service_open(vchi_instance, ¶ms, &instance->handle); + status = vchi_service_open(vchiq_instance, ¶ms, &instance->handle); if (status) { pr_err("Failed to open VCHI service connection (status=%d)\n", status); From patchwork Tue Jun 23 16:42:01 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: 11621111 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 CBD32138C for ; Tue, 23 Jun 2020 16:53:35 +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 96EF72076E for ; Tue, 23 Jun 2020 16:53:35 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="FfC7Fjcz" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 96EF72076E 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=ChuASjlRKhV7VLhvwP8d2JsYpQpcmLEkGnpJZbvTA3g=; b=FfC7FjczDb+WnI0ElN7MR0A8n jwjg02F1/es/8y3mCOkMiGBMj/KU+QC4SMNFGHQdU0VQSiqJFlsxVKdA5VCqpMd4cMhkTMbH6KDxX CBw8jWhC8nqvg9x1BPf/HMBhY7O7hHA5vIGzKNGYG4fv1KpduiCDDtptdeRXtCKv7nDUk7eXi9YHY skkr6Js9tSt3HYoK5MJ34mOP/yOsJ80e6IBK6fqUS4QrIqIBW9qBaBUN/AC7dYVrX+W4ug7QHU4P7 LDDReOf2W7swjDID6zGmvswx0LzdngoWB9BJPp5B9h7D1spjG7mqnoe5xOACumeUEITK1viQwlI7N DRUh/r1cg==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jnm89-0000Ak-IX; Tue, 23 Jun 2020 16:50:41 +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 1jnm2w-0005OQ-Cn; Tue, 23 Jun 2020 16:45:29 +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 0062EB049; Tue, 23 Jun 2020 16:45:14 +0000 (UTC) From: Nicolas Saenz Julienne To: gregkh@linuxfoundation.org Subject: [PATCH 15/50] staging: vchi: Unify struct shim_service and struct vchi_service_handle Date: Tue, 23 Jun 2020 18:42:01 +0200 Message-Id: <20200623164235.29566-16-nsaenzjulienne@suse.de> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20200623164235.29566-1-nsaenzjulienne@suse.de> References: <20200623164235.29566-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_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, 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 The idea behind struct vchi_service_handle is to create an opaque handle to struct shim_service. This can be achieved by doing a forward declaration of struct shim_service, which will avoid unwarranted casts and pointer play. Ultimately as a rename is due all over the vchi user space, rename struct shim_service into struvt vchi_service, which is more consistent with the rest of the exposed API. Signed-off-by: Nicolas Saenz Julienne --- .../bcm2835-audio/bcm2835-vchiq.c | 24 +++---- .../vc04_services/interface/vchi/vchi.h | 27 ++++---- .../interface/vchiq_arm/vchiq_shim.c | 68 ++++++++----------- .../vc04_services/vchiq-mmal/mmal-vchiq.c | 34 +++++----- 4 files changed, 69 insertions(+), 84 deletions(-) diff --git a/drivers/staging/vc04_services/bcm2835-audio/bcm2835-vchiq.c b/drivers/staging/vc04_services/bcm2835-audio/bcm2835-vchiq.c index 8c9390153a26..62eef233275f 100644 --- a/drivers/staging/vc04_services/bcm2835-audio/bcm2835-vchiq.c +++ b/drivers/staging/vc04_services/bcm2835-audio/bcm2835-vchiq.c @@ -9,7 +9,7 @@ struct bcm2835_audio_instance { struct device *dev; - struct vchi_service_handle *vchi_handle; + struct vchi_service *service; struct completion msg_avail_comp; struct mutex vchi_mutex; struct bcm2835_alsa_stream *alsa_stream; @@ -25,12 +25,12 @@ MODULE_PARM_DESC(force_bulk, "Force use of vchiq bulk for audio"); static void bcm2835_audio_lock(struct bcm2835_audio_instance *instance) { mutex_lock(&instance->vchi_mutex); - vchi_service_use(instance->vchi_handle); + vchi_service_use(instance->service); } static void bcm2835_audio_unlock(struct bcm2835_audio_instance *instance) { - vchi_service_release(instance->vchi_handle); + vchi_service_release(instance->service); mutex_unlock(&instance->vchi_mutex); } @@ -44,7 +44,7 @@ static int bcm2835_audio_send_msg_locked(struct bcm2835_audio_instance *instance init_completion(&instance->msg_avail_comp); } - status = vchi_queue_kernel_message(instance->vchi_handle, + status = vchi_queue_kernel_message(instance->service, m, sizeof(*m)); if (status) { dev_err(instance->dev, @@ -101,7 +101,7 @@ static void audio_vchi_callback(void *param, if (reason != VCHI_CALLBACK_MSG_AVAILABLE) return; - status = vchi_msg_dequeue(instance->vchi_handle, + status = vchi_msg_dequeue(instance->service, &m, sizeof(m), &msg_len, VCHI_FLAGS_NONE); if (status) return; @@ -135,7 +135,7 @@ vc_vchi_audio_init(struct vchiq_instance *vchiq_instance, /* Open the VCHI service connections */ status = vchi_service_open(vchiq_instance, ¶ms, - &instance->vchi_handle); + &instance->service); if (status) { dev_err(instance->dev, @@ -145,7 +145,7 @@ vc_vchi_audio_init(struct vchiq_instance *vchiq_instance, } /* Finished with the service for now */ - vchi_service_release(instance->vchi_handle); + vchi_service_release(instance->service); return 0; } @@ -155,10 +155,10 @@ static void vc_vchi_audio_deinit(struct bcm2835_audio_instance *instance) int status; mutex_lock(&instance->vchi_mutex); - vchi_service_use(instance->vchi_handle); + vchi_service_use(instance->service); /* Close all VCHI service connections */ - status = vchi_service_close(instance->vchi_handle); + status = vchi_service_close(instance->service); if (status) { dev_err(instance->dev, "failed to close VCHI service connection (status=%d)\n", @@ -228,7 +228,7 @@ int bcm2835_audio_open(struct bcm2835_alsa_stream *alsa_stream) goto deinit; bcm2835_audio_lock(instance); - vchi_get_peer_version(instance->vchi_handle, &instance->peer_version); + vchi_get_peer_version(instance->service, &instance->peer_version); bcm2835_audio_unlock(instance); if (instance->peer_version < 2 || force_bulk) instance->max_packet = 0; /* bulk transfer */ @@ -344,7 +344,7 @@ int bcm2835_audio_write(struct bcm2835_alsa_stream *alsa_stream, count = size; if (!instance->max_packet) { /* Send the message to the videocore */ - status = vchi_bulk_queue_transmit(instance->vchi_handle, + status = vchi_bulk_queue_transmit(instance->service, src, count, VCHI_FLAGS_BLOCK_UNTIL_DATA_READ, NULL); @@ -352,7 +352,7 @@ int bcm2835_audio_write(struct bcm2835_alsa_stream *alsa_stream, while (count > 0) { int bytes = min(instance->max_packet, count); - status = vchi_queue_kernel_message(instance->vchi_handle, + status = vchi_queue_kernel_message(instance->service, src, bytes); src += bytes; count -= bytes; diff --git a/drivers/staging/vc04_services/interface/vchi/vchi.h b/drivers/staging/vc04_services/interface/vchi/vchi.h index 6b73d8fb394a..ff302e6b8b1b 100644 --- a/drivers/staging/vc04_services/interface/vchi/vchi.h +++ b/drivers/staging/vc04_services/interface/vchi/vchi.h @@ -53,7 +53,7 @@ struct service_creation { struct vchiq_instance; // Opaque handle for a server or client -struct vchi_service_handle; +struct vchi_service; /****************************************************************************** * Global funcs - implementation is specific to which side you are on @@ -75,30 +75,27 @@ 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 vchi_service_handle **handle); + struct vchi_service **service); -extern int32_t vchi_get_peer_version(const struct vchi_service_handle *handle, +extern int32_t vchi_get_peer_version(struct vchi_service *service, short *peer_version); // Routine to close a named service -extern int32_t vchi_service_close(const struct vchi_service_handle *handle); +extern int32_t vchi_service_close(struct vchi_service *service); // Routine to increment ref count on a named service -extern int32_t vchi_service_use(const struct vchi_service_handle *handle); +extern int32_t vchi_service_use(struct vchi_service *service); // Routine to decrement ref count on a named service -extern int32_t vchi_service_release(const struct vchi_service_handle *handle); +extern int32_t vchi_service_release(struct vchi_service *service); /* Routine to send a message from kernel memory across a service */ -extern int -vchi_queue_kernel_message(struct vchi_service_handle *handle, - void *data, - unsigned int size); +extern int vchi_queue_kernel_message(struct vchi_service *service, void *data, + unsigned int size); // Routine to receive a msg from a service // Dequeue is equivalent to hold, copy into client buffer, release -extern int32_t vchi_msg_dequeue(struct vchi_service_handle *handle, - void *data, +extern int32_t vchi_msg_dequeue(struct vchi_service *service, void *data, uint32_t max_data_size_to_read, uint32_t *actual_msg_size, enum vchi_flags flags); @@ -106,7 +103,7 @@ extern int32_t vchi_msg_dequeue(struct vchi_service_handle *handle, // 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(struct vchi_service_handle *handle, +extern int32_t vchi_msg_hold(struct vchi_service *service, void **data, // } may be NULL, as info can be uint32_t *msg_size, // } obtained from HELD_MSG_T enum vchi_flags flags, @@ -125,14 +122,14 @@ extern int32_t vchi_held_msg_release(struct vchi_held_msg *message); *****************************************************************************/ // Routine to prepare interface for a transfer from the other side -extern int32_t vchi_bulk_queue_receive(struct vchi_service_handle *handle, +extern int32_t vchi_bulk_queue_receive(struct vchi_service *service, void *data_dst, uint32_t data_size, enum vchi_flags flags, void *transfer_handle); // Routine to queue up data ready for transfer to the other (once they have signalled they are ready) -extern int32_t vchi_bulk_queue_transmit(struct vchi_service_handle *handle, +extern int32_t vchi_bulk_queue_transmit(struct vchi_service *service, const void *data_src, uint32_t data_size, enum vchi_flags flags, 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 8758704d61c9..99eb7a5ccce6 100644 --- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_shim.c +++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_shim.c @@ -9,7 +9,7 @@ #include "vchiq_util.h" -struct shim_service { +struct vchi_service { unsigned int handle; struct vchiu_queue queue; @@ -18,10 +18,9 @@ struct shim_service { void *callback_param; }; -int vchi_queue_kernel_message(struct vchi_service_handle *handle, void *data, - unsigned int size) +int vchi_queue_kernel_message(struct vchi_service *service, void *data, + unsigned int size) { - struct shim_service *service = (struct shim_service *)handle; enum vchiq_status status; while (1) { @@ -57,11 +56,10 @@ EXPORT_SYMBOL(vchi_queue_kernel_message); * Returns: int32_t - success == 0 * ***********************************************************/ -int32_t vchi_bulk_queue_receive(struct vchi_service_handle *handle, void *data_dst, +int32_t vchi_bulk_queue_receive(struct vchi_service *service, void *data_dst, uint32_t data_size, enum vchi_flags flags, void *bulk_handle) { - struct shim_service *service = (struct shim_service *)handle; enum vchiq_bulk_mode mode; enum vchiq_status status; @@ -115,13 +113,12 @@ EXPORT_SYMBOL(vchi_bulk_queue_receive); * Returns: int32_t - success == 0 * ***********************************************************/ -int32_t vchi_bulk_queue_transmit(struct vchi_service_handle *handle, +int32_t vchi_bulk_queue_transmit(struct vchi_service *service, const void *data_src, uint32_t data_size, enum vchi_flags flags, void *bulk_handle) { - struct shim_service *service = (struct shim_service *)handle; enum vchiq_bulk_mode mode; enum vchiq_status status; @@ -166,7 +163,7 @@ EXPORT_SYMBOL(vchi_bulk_queue_transmit); /*********************************************************** * Name: vchi_msg_dequeue * - * Arguments: struct vchi_service_handle *handle, + * Arguments: struct vchi_service *service, * void *data, * uint32_t max_data_size_to_read, * uint32_t *actual_msg_size @@ -177,11 +174,10 @@ EXPORT_SYMBOL(vchi_bulk_queue_transmit); * Returns: int32_t - success == 0 * ***********************************************************/ -int32_t vchi_msg_dequeue(struct vchi_service_handle *handle, void *data, +int32_t vchi_msg_dequeue(struct vchi_service *service, void *data, uint32_t max_data_size_to_read, uint32_t *actual_msg_size, enum vchi_flags flags) { - struct shim_service *service = (struct shim_service *)handle; struct vchiq_header *header; WARN_ON((flags != VCHI_FLAGS_NONE) && @@ -235,7 +231,7 @@ EXPORT_SYMBOL(vchi_held_msg_release); /*********************************************************** * Name: vchi_msg_hold * - * Arguments: struct vchi_service_handle *handle, + * Arguments: struct vchi_service *service, * void **data, * uint32_t *msg_size, * enum vchi_flags flags, @@ -249,11 +245,10 @@ EXPORT_SYMBOL(vchi_held_msg_release); * Returns: int32_t - success == 0 * ***********************************************************/ -int32_t vchi_msg_hold(struct vchi_service_handle *handle, void **data, +int32_t vchi_msg_hold(struct vchi_service *service, void **data, uint32_t *msg_size, enum vchi_flags flags, struct vchi_held_msg *message_handle) { - struct shim_service *service = (struct shim_service *)handle; struct vchiq_header *header; WARN_ON((flags != VCHI_FLAGS_NONE) && @@ -343,7 +338,7 @@ EXPORT_SYMBOL(vchi_disconnect); * * Arguments: struct vchiq_instance *instance * struct service_creation *setup, - * struct vchi_service_handle **handle + * struct vchi_service **service * * Description: Routine to open a service * @@ -356,8 +351,8 @@ static enum vchiq_status shim_callback(enum vchiq_reason reason, unsigned int handle, void *bulk_user) { - struct shim_service *service = - (struct shim_service *)VCHIQ_GET_SERVICE_USERDATA(handle); + struct vchi_service *service = + (struct vchi_service *)VCHIQ_GET_SERVICE_USERDATA(handle); if (!service->callback) goto release; @@ -407,10 +402,10 @@ static enum vchiq_status shim_callback(enum vchiq_reason reason, return VCHIQ_SUCCESS; } -static struct shim_service *service_alloc(struct vchiq_instance *instance, +static struct vchi_service *service_alloc(struct vchiq_instance *instance, struct service_creation *setup) { - struct shim_service *service = kzalloc(sizeof(struct shim_service), GFP_KERNEL); + struct vchi_service *service = kzalloc(sizeof(struct vchi_service), GFP_KERNEL); (void)instance; @@ -427,7 +422,7 @@ static struct shim_service *service_alloc(struct vchiq_instance *instance, return service; } -static void service_free(struct shim_service *service) +static void service_free(struct vchi_service *service) { if (service) { vchiu_queue_delete(&service->queue); @@ -437,12 +432,10 @@ static void service_free(struct shim_service *service) int32_t vchi_service_open(struct vchiq_instance *instance, struct service_creation *setup, - struct vchi_service_handle **handle) + struct vchi_service **service) { - struct shim_service *service = service_alloc(instance, setup); - - *handle = (struct vchi_service_handle *)service; + *service = service_alloc(instance, setup); if (service) { struct vchiq_service_params params; enum vchiq_status status; @@ -450,27 +443,25 @@ int32_t vchi_service_open(struct vchiq_instance *instance, memset(¶ms, 0, sizeof(params)); params.fourcc = setup->service_id; params.callback = shim_callback; - params.userdata = service; + params.userdata = *service; params.version = setup->version.version; params.version_min = setup->version.version_min; status = vchiq_open_service(instance, ¶ms, - &service->handle); + &((*service)->handle)); if (status != VCHIQ_SUCCESS) { - service_free(service); - service = NULL; - *handle = NULL; + service_free(*service); + *service = NULL; } } - return service ? 0 : -1; + return *service ? 0 : -1; } EXPORT_SYMBOL(vchi_service_open); -int32_t vchi_service_close(const struct vchi_service_handle *handle) +int32_t vchi_service_close(struct vchi_service *service) { int32_t ret = -1; - struct shim_service *service = (struct shim_service *)handle; if (service) { enum vchiq_status status = vchiq_close_service(service->handle); @@ -483,10 +474,9 @@ int32_t vchi_service_close(const struct vchi_service_handle *handle) } EXPORT_SYMBOL(vchi_service_close); -int32_t vchi_get_peer_version(const struct vchi_service_handle *handle, short *peer_version) +int32_t vchi_get_peer_version(struct vchi_service *service, short *peer_version) { int32_t ret = -1; - struct shim_service *service = (struct shim_service *)handle; if (service) { enum vchiq_status status; @@ -501,18 +491,17 @@ EXPORT_SYMBOL(vchi_get_peer_version); /*********************************************************** * Name: vchi_service_use * - * Arguments: const struct vchi_service_handle *handle + * Arguments: struct vchi_service *service * * Description: Routine to increment refcount on a service * * Returns: void * ***********************************************************/ -int32_t vchi_service_use(const struct vchi_service_handle *handle) +int32_t vchi_service_use(struct vchi_service *service) { int32_t ret = -1; - struct shim_service *service = (struct shim_service *)handle; if (service) ret = vchiq_use_service(service->handle); return ret; @@ -522,18 +511,17 @@ EXPORT_SYMBOL(vchi_service_use); /*********************************************************** * Name: vchi_service_release * - * Arguments: const struct vchi_service_handle *handle + * Arguments: struct vchi_service *service * * Description: Routine to decrement refcount on a service * * Returns: void * ***********************************************************/ -int32_t vchi_service_release(const struct vchi_service_handle *handle) +int32_t vchi_service_release(struct vchi_service *service) { int32_t ret = -1; - struct shim_service *service = (struct shim_service *)handle; if (service) ret = vchiq_release_service(service->handle); return ret; diff --git a/drivers/staging/vc04_services/vchiq-mmal/mmal-vchiq.c b/drivers/staging/vc04_services/vchiq-mmal/mmal-vchiq.c index d5a7a5b9abf9..350726710631 100644 --- a/drivers/staging/vc04_services/vchiq-mmal/mmal-vchiq.c +++ b/drivers/staging/vc04_services/vchiq-mmal/mmal-vchiq.c @@ -165,7 +165,7 @@ struct mmal_msg_context { }; struct vchiq_mmal_instance { - struct vchi_service_handle *handle; + struct vchi_service *service; /* ensure serialised access to service */ struct mutex vchiq_mutex; @@ -294,8 +294,8 @@ static void buffer_to_host_work_cb(struct work_struct *work) /* Dummy receive to ensure the buffers remain in order */ len = 8; /* queue the bulk submission */ - vchi_service_use(instance->handle); - ret = vchi_bulk_queue_receive(instance->handle, + vchi_service_use(instance->service); + ret = vchi_bulk_queue_receive(instance->service, msg_context->u.bulk.buffer->buffer, /* Actual receive needs to be a multiple * of 4 bytes @@ -305,7 +305,7 @@ static void buffer_to_host_work_cb(struct work_struct *work) VCHI_FLAGS_BLOCK_UNTIL_QUEUED, msg_context); - vchi_service_release(instance->handle); + vchi_service_release(instance->service); if (ret != 0) pr_err("%s: ctx: %p, vchi_bulk_queue_receive failed %d\n", @@ -384,7 +384,7 @@ buffer_from_host(struct vchiq_mmal_instance *instance, if (!port->enabled) return -EINVAL; - pr_debug("instance:%p buffer:%p\n", instance->handle, buf); + pr_debug("instance:%p buffer:%p\n", instance->service, buf); /* get context */ if (!buf->msg_context) { @@ -439,14 +439,14 @@ buffer_from_host(struct vchiq_mmal_instance *instance, /* no payload in message */ m.u.buffer_from_host.payload_in_message = 0; - vchi_service_use(instance->handle); + vchi_service_use(instance->service); - ret = vchi_queue_kernel_message(instance->handle, + ret = vchi_queue_kernel_message(instance->service, &m, sizeof(struct mmal_msg_header) + sizeof(m.u.buffer_from_host)); - vchi_service_release(instance->handle); + vchi_service_release(instance->service); return ret; } @@ -568,7 +568,7 @@ static void service_callback(void *param, switch (reason) { case VCHI_CALLBACK_MSG_AVAILABLE: - status = vchi_msg_hold(instance->handle, (void **)&msg, + status = vchi_msg_hold(instance->service, (void **)&msg, &msg_len, VCHI_FLAGS_NONE, &msg_handle); if (status) { pr_err("Unable to dequeue a message (%d)\n", status); @@ -684,14 +684,14 @@ static int send_synchronous_mmal_msg(struct vchiq_mmal_instance *instance, DBG_DUMP_MSG(msg, (sizeof(struct mmal_msg_header) + payload_len), ">>> sync message"); - vchi_service_use(instance->handle); + vchi_service_use(instance->service); - ret = vchi_queue_kernel_message(instance->handle, + ret = vchi_queue_kernel_message(instance->service, msg, sizeof(struct mmal_msg_header) + payload_len); - vchi_service_release(instance->handle); + vchi_service_release(instance->service); if (ret) { pr_err("error %d queuing message\n", ret); @@ -1839,9 +1839,9 @@ int vchiq_mmal_finalise(struct vchiq_mmal_instance *instance) if (mutex_lock_interruptible(&instance->vchiq_mutex)) return -EINTR; - vchi_service_use(instance->handle); + vchi_service_use(instance->service); - status = vchi_service_close(instance->handle); + status = vchi_service_close(instance->service); if (status != 0) pr_err("mmal-vchiq: VCHIQ close failed\n"); @@ -1918,21 +1918,21 @@ int vchiq_mmal_init(struct vchiq_mmal_instance **out_instance) if (!instance->bulk_wq) goto err_free; - status = vchi_service_open(vchiq_instance, ¶ms, &instance->handle); + status = vchi_service_open(vchiq_instance, ¶ms, &instance->service); if (status) { pr_err("Failed to open VCHI service connection (status=%d)\n", status); goto err_close_services; } - vchi_service_release(instance->handle); + vchi_service_release(instance->service); *out_instance = instance; return 0; err_close_services: - vchi_service_close(instance->handle); + vchi_service_close(instance->service); destroy_workqueue(instance->bulk_wq); err_free: vfree(instance->bulk_scratch); From patchwork Tue Jun 23 16:42:02 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: 11621085 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 C96D1138C for ; Tue, 23 Jun 2020 16:51:02 +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 A0ACE2076E for ; Tue, 23 Jun 2020 16:51:02 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="AngjldA0" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org A0ACE2076E 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=0tkUFGHUvMr1W/hUsQ0iPjWqqwZU/oqxq/z3EkYAloM=; b=AngjldA0qr8CealapGxMnGcE6 fWjPGjRNm1z2m0cfQlB6QfE9xcKCJRZ9Q74hzr5QeYNiQeUo8b0f7GL/M7BWmj95znkZPRUaWV0Zd +cT9go6VaW7mlW9SXCt7X2pDTx4/BXFHoi4U+B5KfAo+8xOjKh82CETK8Gs0GHFLM6oNVNTerXeYk +P05+QEd+opO0kOXOqtZBiwt/7ZbS2c++lCroZ4lNcz/p0/fUh/MSG49jnh+cya1PoePLazx0BofK 5a1/Vl9PQlTtghAgWfNZWa4oprL5f6OPQXvDkKF8wuQbTV43gt5KL+wBbHexsG6kZHymzWDhz7gRz Tx86Av/PQ==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jnm5s-0006xF-Fb; Tue, 23 Jun 2020 16:48:20 +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 1jnm2w-0005OP-D4; Tue, 23 Jun 2020 16:45:23 +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 6114DB077; Tue, 23 Jun 2020 16:45:16 +0000 (UTC) From: Nicolas Saenz Julienne To: gregkh@linuxfoundation.org Subject: [PATCH 16/50] staging: vc04_services: bcm2835-audio: Use vchi_msg_hold() Date: Tue, 23 Jun 2020 18:42:02 +0200 Message-Id: <20200623164235.29566-17-nsaenzjulienne@suse.de> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20200623164235.29566-1-nsaenzjulienne@suse.de> References: <20200623164235.29566-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_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, 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 vchi_msg_dequeue() provides the same functionality as vchi_msg_hold() except it copies the message data as opposed to the later which provides the data in place. The copying is done on a local variable, so there is no need to keep the message out the function's bounds, so use vchi_msg_hold() instead. Signed-off-by: Nicolas Saenz Julienne --- .../bcm2835-audio/bcm2835-vchiq.c | 25 +++++++++++-------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/drivers/staging/vc04_services/bcm2835-audio/bcm2835-vchiq.c b/drivers/staging/vc04_services/bcm2835-audio/bcm2835-vchiq.c index 62eef233275f..5018b5baa009 100644 --- a/drivers/staging/vc04_services/bcm2835-audio/bcm2835-vchiq.c +++ b/drivers/staging/vc04_services/bcm2835-audio/bcm2835-vchiq.c @@ -94,31 +94,34 @@ static void audio_vchi_callback(void *param, void *msg_handle) { struct bcm2835_audio_instance *instance = param; - struct vc_audio_msg m; - int msg_len; + struct vchi_held_msg handle; + struct vc_audio_msg *m; + unsigned size; int status; if (reason != VCHI_CALLBACK_MSG_AVAILABLE) return; - status = vchi_msg_dequeue(instance->service, - &m, sizeof(m), &msg_len, VCHI_FLAGS_NONE); + status = vchi_msg_hold(instance->service, (void **)&m, &size, + VCHI_FLAGS_NONE, &handle); if (status) return; - if (m.type == VC_AUDIO_MSG_TYPE_RESULT) { - instance->result = m.result.success; + if (m->type == VC_AUDIO_MSG_TYPE_RESULT) { + instance->result = m->result.success; complete(&instance->msg_avail_comp); - } else if (m.type == VC_AUDIO_MSG_TYPE_COMPLETE) { - if (m.complete.cookie1 != VC_AUDIO_WRITE_COOKIE1 || - m.complete.cookie2 != VC_AUDIO_WRITE_COOKIE2) + } else if (m->type == VC_AUDIO_MSG_TYPE_COMPLETE) { + if (m->complete.cookie1 != VC_AUDIO_WRITE_COOKIE1 || + m->complete.cookie2 != VC_AUDIO_WRITE_COOKIE2) dev_err(instance->dev, "invalid cookie\n"); else bcm2835_playback_fifo(instance->alsa_stream, - m.complete.count); + m->complete.count); } else { - dev_err(instance->dev, "unexpected callback type=%d\n", m.type); + dev_err(instance->dev, "unexpected callback type=%d\n", m->type); } + + vchi_held_msg_release(&handle); } static int From patchwork Tue Jun 23 16:42:03 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: 11621083 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 83C5C92A for ; Tue, 23 Jun 2020 16:50:57 +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 57DD42076E for ; Tue, 23 Jun 2020 16:50:57 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="E3pL5XOG" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 57DD42076E 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=7eUg58wC451Sv4DQM666EdUA35IjnZmKuIFMWlViwhM=; b=E3pL5XOGiYyGYFlOKUVx171bX EZ6C07/96vn9ug/UThHny+7KaoIJE8FDGX6tBaipG0RcIDq7KzmfOPLeGl7G9TCGm60geqfMrzGJu w/qp8svDEqzDfBu60PNn6mx0FK/14HhHl1KLKpBFFwfNxXNBx6lolb47tLe5sTAdRk6IFkXIQaxrQ u9D7QRFt+AvPLZhnj09cAJPMSVL4qbhEOmpapnpNZRN5aKGSzE2/kin3luyIV5C78vjy3wEMiT77n NgxLgwNynZeYdj87yflR+h2O9LJ5Xo3UXYIDWRjKLrKeTxpgb6FPSQRBIT1IeO/GBDCqiHoRpCSrn S3jVGf2lg==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jnm5h-0006m4-59; Tue, 23 Jun 2020 16:48:09 +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 1jnm2w-0005OV-CM; Tue, 23 Jun 2020 16:45:23 +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 C63ABAECE; Tue, 23 Jun 2020 16:45:16 +0000 (UTC) From: Nicolas Saenz Julienne To: gregkh@linuxfoundation.org Subject: [PATCH 17/50] staging: vchi: Get rid of vchi_msg_dequeue() Date: Tue, 23 Jun 2020 18:42:03 +0200 Message-Id: <20200623164235.29566-18-nsaenzjulienne@suse.de> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20200623164235.29566-1-nsaenzjulienne@suse.de> References: <20200623164235.29566-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_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, 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 Nobody uses it. Get rid of it. Signed-off-by: Nicolas Saenz Julienne --- .../vc04_services/interface/vchi/vchi.h | 7 ---- .../interface/vchiq_arm/vchiq_shim.c | 39 ------------------- 2 files changed, 46 deletions(-) diff --git a/drivers/staging/vc04_services/interface/vchi/vchi.h b/drivers/staging/vc04_services/interface/vchi/vchi.h index ff302e6b8b1b..a369feb3a448 100644 --- a/drivers/staging/vc04_services/interface/vchi/vchi.h +++ b/drivers/staging/vc04_services/interface/vchi/vchi.h @@ -93,13 +93,6 @@ extern int32_t vchi_service_release(struct vchi_service *service); extern int vchi_queue_kernel_message(struct vchi_service *service, void *data, unsigned int size); -// Routine to receive a msg from a service -// Dequeue is equivalent to hold, copy into client buffer, release -extern int32_t vchi_msg_dequeue(struct vchi_service *service, void *data, - uint32_t max_data_size_to_read, - uint32_t *actual_msg_size, - enum vchi_flags flags); - // 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. 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 99eb7a5ccce6..0c3473861a8d 100644 --- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_shim.c +++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_shim.c @@ -160,45 +160,6 @@ int32_t vchi_bulk_queue_transmit(struct vchi_service *service, } EXPORT_SYMBOL(vchi_bulk_queue_transmit); -/*********************************************************** - * Name: vchi_msg_dequeue - * - * Arguments: struct vchi_service *service, - * void *data, - * uint32_t max_data_size_to_read, - * uint32_t *actual_msg_size - * enum vchi_flags flags - * - * Description: Routine to dequeue a message into the supplied buffer - * - * Returns: int32_t - success == 0 - * - ***********************************************************/ -int32_t vchi_msg_dequeue(struct vchi_service *service, void *data, - uint32_t max_data_size_to_read, - uint32_t *actual_msg_size, enum vchi_flags flags) -{ - struct vchiq_header *header; - - WARN_ON((flags != VCHI_FLAGS_NONE) && - (flags != VCHI_FLAGS_BLOCK_UNTIL_OP_COMPLETE)); - - if (flags == VCHI_FLAGS_NONE) - if (vchiu_queue_is_empty(&service->queue)) - return -1; - - header = vchiu_queue_pop(&service->queue); - - memcpy(data, header->data, header->size < max_data_size_to_read ? - header->size : max_data_size_to_read); - - *actual_msg_size = header->size; - - vchiq_release_message(service->handle, header); - - return 0; -} -EXPORT_SYMBOL(vchi_msg_dequeue); /*********************************************************** * Name: vchi_held_msg_release From patchwork Tue Jun 23 16:42:04 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: 11621089 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 72B6C138C for ; Tue, 23 Jun 2020 16:51:58 +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 4CC8920774 for ; Tue, 23 Jun 2020 16:51:58 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="rk9yO3nw" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 4CC8920774 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=/4ZgcDL4rBVsvB1Il7zPV204yKUuu8uaJjc2kxcbkRM=; b=rk9yO3nwTf8icL5FIFv/WJ2vy wKNzxVH1M2JY8kS3l+C5j/KoJxdUS+yCwtDYEVdo9EPGeyaW5bQ3+BFmnzv+OZNzcsCwkuvwzRshI U659zzH+oeR8R6OJg5rdikttdVfx9W3Br9FNqLKubSgSjGNgOCjWFQ5bbNrkbKpkY4qfajVqvTWen vkThb29Kgj5uB0b+SEFMq072Jg1cPKFAEp31db3YMJxlf26kpNtu0nFciUSMlQOFi8Jj0aBgQ3tcL TKMWp7DnR9AmBDIRGOI2Mv6dHO46DcrOoaWq7YkepY8YjJuoZRk6k0sHhhLd4fxJh88gr/APyoeuv IM0yK7hcg==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jnm6W-0007NN-Pd; Tue, 23 Jun 2020 16:49:00 +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 1jnm2w-0005On-UM; Tue, 23 Jun 2020 16:45:25 +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 6B41BAEB1; Tue, 23 Jun 2020 16:45:17 +0000 (UTC) From: Nicolas Saenz Julienne To: gregkh@linuxfoundation.org Subject: [PATCH 18/50] staging: vchi_common: Get rid of all unused definitions Date: Tue, 23 Jun 2020 18:42:04 +0200 Message-Id: <20200623164235.29566-19-nsaenzjulienne@suse.de> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20200623164235.29566-1-nsaenzjulienne@suse.de> References: <20200623164235.29566-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_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, 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 There is a series of structures and enums defined but never used. Get rid of them. Signed-off-by: Nicolas Saenz Julienne --- .../interface/vchi/vchi_common.h | 65 ------------------- 1 file changed, 65 deletions(-) diff --git a/drivers/staging/vc04_services/interface/vchi/vchi_common.h b/drivers/staging/vc04_services/interface/vchi/vchi_common.h index 0f79bea4757d..e07376fe4dfd 100644 --- a/drivers/staging/vc04_services/interface/vchi/vchi_common.h +++ b/drivers/staging/vc04_services/interface/vchi/vchi_common.h @@ -10,23 +10,7 @@ enum vchi_flags { VCHI_FLAGS_BLOCK_UNTIL_OP_COMPLETE = 0x1, // waits for message to be received, or sent (NB. not the same as being seen on other side) VCHI_FLAGS_CALLBACK_WHEN_OP_COMPLETE = 0x2, // run a callback when message sent VCHI_FLAGS_BLOCK_UNTIL_QUEUED = 0x4, // return once the transfer is in a queue ready to go - VCHI_FLAGS_ALLOW_PARTIAL = 0x8, VCHI_FLAGS_BLOCK_UNTIL_DATA_READ = 0x10, - VCHI_FLAGS_CALLBACK_WHEN_DATA_READ = 0x20, - - VCHI_FLAGS_ALIGN_SLOT = 0x000080, // internal use only - VCHI_FLAGS_BULK_AUX_QUEUED = 0x010000, // internal use only - VCHI_FLAGS_BULK_AUX_COMPLETE = 0x020000, // internal use only - VCHI_FLAGS_BULK_DATA_QUEUED = 0x040000, // internal use only - VCHI_FLAGS_BULK_DATA_COMPLETE = 0x080000, // internal use only - VCHI_FLAGS_INTERNAL = 0xFF0000 -}; - -// constants for vchi_crc_control() -enum vchi_crc_control { - VCHI_CRC_NOTHING = -1, - VCHI_CRC_PER_SERVICE = 0, - VCHI_CRC_EVERYTHING = 1, }; //callback reasons when an event occurs on a service @@ -47,58 +31,9 @@ enum vchi_callback_reason { VCHI_CALLBACK_BULK_RECEIVE_ABORTED, }; -// service control options -enum vchi_service_option { - VCHI_SERVICE_OPTION_MIN, - - VCHI_SERVICE_OPTION_TRACE, - VCHI_SERVICE_OPTION_SYNCHRONOUS, - - VCHI_SERVICE_OPTION_MAX -}; - //Callback used by all services / bulk transfers typedef void (*vchi_callback)(void *callback_param, //my service local param enum vchi_callback_reason reason, void *handle); //for transmitting msg's only -/* - * Define vector struct for scatter-gather (vector) operations - * Vectors can be nested - if a vector element has negative length, then - * the data pointer is treated as pointing to another vector array, with - * '-vec_len' elements. Thus to append a header onto an existing vector, - * you can do this: - * - * void foo(const struct vchi_msg_vector *v, int n) - * { - * struct vchi_msg_vector nv[2]; - * nv[0].vec_base = my_header; - * nv[0].vec_len = sizeof my_header; - * nv[1].vec_base = v; - * nv[1].vec_len = -n; - * ... - * - */ -struct vchi_msg_vector { - const void *vec_base; - int32_t vec_len; -}; - -/* - * Iterator structure for reading ahead through received message queue. - * Allocated by client, initialised by vchi_msg_look_ahead. Fields are for - * internal VCHI use only. - * Iterates over messages in queue at the instant of the call to - * vchi_msg_lookahead - will not proceed to messages received since. - * Behaviour is undefined if an iterator is used again after messages for that - * service are removed/dequeued by any means other than vchi_msg_iter_... - * calls on the iterator itself. - */ -struct vchi_msg_iter { - struct opaque_vchi_service_t *service; - void *last; - void *next; - void *remove; -}; - #endif // VCHI_COMMON_H_ From patchwork Tue Jun 23 16:42:05 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: 11621091 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 AEB16138C for ; Tue, 23 Jun 2020 16:52:31 +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 8367B2076E for ; Tue, 23 Jun 2020 16:52:31 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="Pkv1/Rhf" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 8367B2076E 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=0Y+qMfB3381nsIoZbMaTbC4vtLURYapccMjWYkHouSQ=; b=Pkv1/RhfKKe2Z6lbF6pqsTXF6 gqIvyxFvpBgshHkrLoHtM/r5FsZyKw8DgC91ajrzbUp/30NLJh9+HgN4AX6ZgySDUIM0psHOl5Hxz EM1O6aHCuKif+gOfpsaHusW+xeKvCv7huUGSjmQNRFhTOBSJ2UEtU4G2fIANxowa+hQal0nrAyZgH NNUOjbz7aliQKXpHcUK4zPJp31gs7yhf7Rjk0Re2f6/EcqBeJiiMyqvJCkJnBT1r7VIUR8Bl9LG6b Wd38BFL1rRfJy2tQVUWCZI/jwJCQ7IqFU6bptlrDDnPcovLy6w40Vd/eBfdViq+77HXyqJD8G0NMn PLQBQGJmA==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jnm79-0007n1-4K; Tue, 23 Jun 2020 16:49:39 +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 1jnm2y-0005PD-EL; Tue, 23 Jun 2020 16:45:25 +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 48992AEBE; Tue, 23 Jun 2020 16:45:18 +0000 (UTC) From: Nicolas Saenz Julienne To: gregkh@linuxfoundation.org Subject: [PATCH 19/50] staging: vchi: Get rid of unnecessary defines Date: Tue, 23 Jun 2020 18:42:05 +0200 Message-Id: <20200623164235.29566-20-nsaenzjulienne@suse.de> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20200623164235.29566-1-nsaenzjulienne@suse.de> References: <20200623164235.29566-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_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, 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 Those defines aren't used by anyone. Get rid of them. Signed-off-by: Nicolas Saenz Julienne --- drivers/staging/vc04_services/interface/vchi/vchi.h | 11 ----------- drivers/staging/vc04_services/vchiq-mmal/mmal-vchiq.c | 1 - 2 files changed, 12 deletions(-) diff --git a/drivers/staging/vc04_services/interface/vchi/vchi.h b/drivers/staging/vc04_services/interface/vchi/vchi.h index a369feb3a448..bf0c7a496f5a 100644 --- a/drivers/staging/vc04_services/interface/vchi/vchi.h +++ b/drivers/staging/vc04_services/interface/vchi/vchi.h @@ -11,21 +11,10 @@ * Global defs *****************************************************************************/ -#define VCHI_BULK_ROUND_UP(x) ((((unsigned long)(x)) + VCHI_BULK_ALIGN - 1) & ~(VCHI_BULK_ALIGN - 1)) -#define VCHI_BULK_ROUND_DOWN(x) (((unsigned long)(x)) & ~(VCHI_BULK_ALIGN - 1)) -#define VCHI_BULK_ALIGN_NBYTES(x) (VCHI_BULK_ALIGNED(x) ? 0 : (VCHI_BULK_ALIGN - ((unsigned long)(x) & (VCHI_BULK_ALIGN - 1)))) - -#ifdef USE_VCHIQ_ARM -#define VCHI_BULK_ALIGNED(x) 1 -#else -#define VCHI_BULK_ALIGNED(x) (((unsigned long)(x) & (VCHI_BULK_ALIGN - 1)) == 0) -#endif - struct vchi_version { uint32_t version; uint32_t version_min; }; -#define VCHI_VERSION(v_) { v_, v_ } #define VCHI_VERSION_EX(v_, m_) { v_, m_ } // Macros to manipulate 'FOURCC' values diff --git a/drivers/staging/vc04_services/vchiq-mmal/mmal-vchiq.c b/drivers/staging/vc04_services/vchiq-mmal/mmal-vchiq.c index 350726710631..f49e45673e34 100644 --- a/drivers/staging/vc04_services/vchiq-mmal/mmal-vchiq.c +++ b/drivers/staging/vc04_services/vchiq-mmal/mmal-vchiq.c @@ -29,7 +29,6 @@ #include "mmal-vchiq.h" #include "mmal-msg.h" -#define USE_VCHIQ_ARM #include "interface/vchi/vchi.h" /* From patchwork Tue Jun 23 16:42:06 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: 11621109 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 115C892A for ; Tue, 23 Jun 2020 16:53:15 +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 D853D2076E for ; Tue, 23 Jun 2020 16:53:14 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="FC0sdR2u" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org D853D2076E 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=2Rz+8brE5IvynpLTGRzqdlg3MHBxs1JIQGK2ef/Z1XU=; b=FC0sdR2ugFjBdnQ57f80F/Stx ZxYWjVzktJ5FjrK03Kahix882MPSvFmawNjuDKRMnj48ijxk2jIMZso3yV4vJ8uyvUpF5mpCdMmJV zVOenC1LakJyyMqViybCTxCdj5JtlgCVDMXPliRwjiQrPm7I7K07bzRy9BaBORq4mceqiz2zZ0OJQ EcZm3fIr9qKjbuBHgUKNQgN18kUVzl08pzPhMfRJIHtYNCaO79GnRbK+D0Dv/ZFWHPAWk+5g8J5On 5W1VtjPSqq53uuvD7fSSS/0q61/aEfRsm/V6TOP6fUrNpHgRT9Y9kOBUA3nruJHQM2lsO4iy7ucrw XKpmOXZgg==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jnm7p-0008Oz-Cg; Tue, 23 Jun 2020 16:50:21 +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 1jnm2y-0005PC-EM; Tue, 23 Jun 2020 16:45:28 +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 BB881B03F; Tue, 23 Jun 2020 16:45:18 +0000 (UTC) From: Nicolas Saenz Julienne To: gregkh@linuxfoundation.org Subject: [PATCH 20/50] staging: vc04_services: Get rid of vchi_cfg.h Date: Tue, 23 Jun 2020 18:42:06 +0200 Message-Id: <20200623164235.29566-21-nsaenzjulienne@suse.de> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20200623164235.29566-1-nsaenzjulienne@suse.de> References: <20200623164235.29566-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_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, 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 Nothing in it is being used. Signed-off-by: Nicolas Saenz Julienne --- .../vc04_services/interface/vchi/vchi.h | 1 - .../vc04_services/interface/vchi/vchi_cfg.h | 238 ------------------ 2 files changed, 239 deletions(-) delete mode 100644 drivers/staging/vc04_services/interface/vchi/vchi_cfg.h diff --git a/drivers/staging/vc04_services/interface/vchi/vchi.h b/drivers/staging/vc04_services/interface/vchi/vchi.h index bf0c7a496f5a..55e51e5a1fdc 100644 --- a/drivers/staging/vc04_services/interface/vchi/vchi.h +++ b/drivers/staging/vc04_services/interface/vchi/vchi.h @@ -4,7 +4,6 @@ #ifndef VCHI_H_ #define VCHI_H_ -#include "vchi_cfg.h" #include "vchi_common.h" /****************************************************************************** diff --git a/drivers/staging/vc04_services/interface/vchi/vchi_cfg.h b/drivers/staging/vc04_services/interface/vchi/vchi_cfg.h deleted file mode 100644 index 138c36151a22..000000000000 --- a/drivers/staging/vc04_services/interface/vchi/vchi_cfg.h +++ /dev/null @@ -1,238 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause */ -/* Copyright (c) 2010-2012 Broadcom. All rights reserved. */ - -#ifndef VCHI_CFG_H_ -#define VCHI_CFG_H_ - -/******************************************************************************* - * Defines in this first section are part of the VCHI API and may be examined by - * VCHI services. - ******************************************************************************/ - -/* - * Required alignment of base addresses for bulk transfer, if unaligned - * transfers are not enabled - * Really determined by the message driver, and should be available from - * a run-time call. - */ -#ifndef VCHI_BULK_ALIGN -# if __VCCOREVER__ >= 0x04000000 -# define VCHI_BULK_ALIGN 32 // Allows for the need to do cache cleans -# else -# define VCHI_BULK_ALIGN 16 -# endif -#endif - -/* - * Required length multiple for bulk transfers, if unaligned transfers are - * not enabled - * May be less than or greater than VCHI_BULK_ALIGN - * Really determined by the message driver, and should be available from - * a run-time call. - */ -#ifndef VCHI_BULK_GRANULARITY -# if __VCCOREVER__ >= 0x04000000 -# define VCHI_BULK_GRANULARITY 32 // Allows for the need to do cache cleans -# else -# define VCHI_BULK_GRANULARITY 16 -# endif -#endif - -/* The largest possible message to be queued with vchi_msg_queue. */ -#ifndef VCHI_MAX_MSG_SIZE -# if defined VCHI_LOCAL_HOST_PORT -# define VCHI_MAX_MSG_SIZE 16384 // makes file transfers fast, but should they be using bulk? -# else -# define VCHI_MAX_MSG_SIZE 4096 // NOTE: THIS MUST BE LARGER THAN OR EQUAL TO THE SIZE OF THE KHRONOS MERGE BUFFER!! -# endif -#endif - -/****************************************************************************** - * Defines below are system configuration options, and should not be used by - * VCHI services. - ******************************************************************************/ - -/* - * How many connections can we support? A localhost implementation uses - * 2 connections, 1 for host-app, 1 for VMCS, and these are hooked together - * by a loopback MPHI VCFW driver. - */ -#ifndef VCHI_MAX_NUM_CONNECTIONS -# define VCHI_MAX_NUM_CONNECTIONS 3 -#endif - -/* - * How many services can we open per connection? Extending this doesn't cost - * processing time, just a small amount of static memory. - */ -#ifndef VCHI_MAX_SERVICES_PER_CONNECTION -# define VCHI_MAX_SERVICES_PER_CONNECTION 36 -#endif - -/* Adjust if using a message driver that supports more logical TX channels */ -#ifndef VCHI_MAX_BULK_TX_CHANNELS_PER_CONNECTION -# define VCHI_MAX_BULK_TX_CHANNELS_PER_CONNECTION 9 // 1 MPHI + 8 CCP2 logical channels -#endif - -/* Adjust if using a message driver that supports more logical RX channels */ -#ifndef VCHI_MAX_BULK_RX_CHANNELS_PER_CONNECTION -# define VCHI_MAX_BULK_RX_CHANNELS_PER_CONNECTION 1 // 1 MPHI -#endif - -/* - * How many receive slots do we use. This times VCHI_MAX_MSG_SIZE gives the - * effective receive queue space, less message headers. - */ -#ifndef VCHI_NUM_READ_SLOTS -# if defined(VCHI_LOCAL_HOST_PORT) -# define VCHI_NUM_READ_SLOTS 4 -# else -# define VCHI_NUM_READ_SLOTS 48 -# endif -#endif - -/* - * Do we utilise overrun facility for receive message slots? Can aid peer - * transmit performance. Only define on VideoCore end, talking to host. - */ -//#define VCHI_MSG_RX_OVERRUN - -/* - * How many transmit slots do we use. Generally don't need many, - * as the hardware driver underneath VCHI will usually have its own buffering. - */ -#ifndef VCHI_NUM_WRITE_SLOTS -# define VCHI_NUM_WRITE_SLOTS 4 -#endif - -/* - * If a service has held or queued received messages in VCHI_XOFF_THRESHOLD or - * more slots, then it's taking up too much buffer space, - * and the peer service will be told to stop transmitting with an XOFF message. - * For this to be effective, the VCHI_NUM_READ_SLOTS needs to be considerably - * bigger than VCHI_NUM_WRITE_SLOTS, or the transmit latency is too high. - */ -#ifndef VCHI_XOFF_THRESHOLD -# define VCHI_XOFF_THRESHOLD (VCHI_NUM_READ_SLOTS / 2) -#endif - -/* - * After we've sent an XOFF, the peer will be told to resume transmission - * once the local service has dequeued/released enough messages that it's now - * occupying VCHI_XON_THRESHOLD slots or fewer. - */ -#ifndef VCHI_XON_THRESHOLD -# define VCHI_XON_THRESHOLD (VCHI_NUM_READ_SLOTS / 4) -#endif - -/* - * A size below which a bulk transfer omits the handshake completely and always - * goes via the message channel, if bulk auxiliary is being sent on that - * service. (The user can guarantee this by enabling unaligned transmits). - * Not API. - */ -#ifndef VCHI_MIN_BULK_SIZE -# define VCHI_MIN_BULK_SIZE (VCHI_MAX_MSG_SIZE / 2 < 4096 ? VCHI_MAX_MSG_SIZE / 2 : 4096) -#endif - -/* - * Maximum size of bulk transmission chunks, for each interface type. - * A trade-off between speed and latency; the smaller the chunk size the better - * change of messages and other bulk transmissions getting in when big bulk - * transfers are happening. Set to 0 to not break transmissions into chunks. - */ -#ifndef VCHI_MAX_BULK_CHUNK_SIZE_MPHI -# define VCHI_MAX_BULK_CHUNK_SIZE_MPHI (16 * 1024) -#endif - -/* - * NB Chunked CCP2 transmissions violate the letter of the CCP2 spec - * by using "JPEG8" mode with multiple-line frames. Only use if the receiver - * can cope. - */ -#ifndef VCHI_MAX_BULK_CHUNK_SIZE_CCP2 -# define VCHI_MAX_BULK_CHUNK_SIZE_CCP2 0 -#endif - -/* - * How many TX messages can we have pending in our transmit slots. - * Once exhausted, vchi_msg_queue will be blocked. - */ -#ifndef VCHI_TX_MSG_QUEUE_SIZE -# define VCHI_TX_MSG_QUEUE_SIZE 256 -#endif - -/* - * How many RX messages can we have parsed in the receive slots. Once exhausted, - * parsing will be suspended until older messages are dequeued/released. - */ -#ifndef VCHI_RX_MSG_QUEUE_SIZE -# define VCHI_RX_MSG_QUEUE_SIZE 256 -#endif - -/* - * Really should be able to cope if we run out of received message descriptors, - * by suspending parsing as the comment above says, but we don't. - * This sweeps the issue under the carpet. - */ -#if VCHI_RX_MSG_QUEUE_SIZE < (VCHI_MAX_MSG_SIZE / 16 + 1) * VCHI_NUM_READ_SLOTS -# undef VCHI_RX_MSG_QUEUE_SIZE -# define VCHI_RX_MSG_QUEUE_SIZE ((VCHI_MAX_MSG_SIZE / 16 + 1) * VCHI_NUM_READ_SLOTS) -#endif - -/* - * How many bulk transmits can we have pending. Once exhausted, - * vchi_bulk_queue_transmit will be blocked. - */ -#ifndef VCHI_TX_BULK_QUEUE_SIZE -# define VCHI_TX_BULK_QUEUE_SIZE 64 -#endif - -/* - * How many bulk receives can we have pending. Once exhausted, - *vchi_bulk_queue_receive will be blocked. - */ -#ifndef VCHI_RX_BULK_QUEUE_SIZE -# define VCHI_RX_BULK_QUEUE_SIZE 64 -#endif - -/* - * A limit on how many outstanding bulk requests we expect the peer to give us. - * If the peer asks for more than this, VCHI will fail and assert. - * The number is determined by the peer's hardware - * - it's the number of outstanding requests that can be queued - * on all bulk channels. VC3's MPHI peripheral allows 16. - */ -#ifndef VCHI_MAX_PEER_BULK_REQUESTS -# define VCHI_MAX_PEER_BULK_REQUESTS 32 -#endif - -/* - * Define VCHI_CCP2TX_MANUAL_POWER if the host tells us when to turn the CCP2 - * transmitter on and off. - */ -/*#define VCHI_CCP2TX_MANUAL_POWER*/ - -#ifndef VCHI_CCP2TX_MANUAL_POWER - -/* - * Timeout (in milliseconds) for putting the CCP2TX interface into IDLE state. - * Set negative for no IDLE. - */ -# ifndef VCHI_CCP2TX_IDLE_TIMEOUT -# define VCHI_CCP2TX_IDLE_TIMEOUT 5 -# endif - -/* - * Timeout (in milliseconds) for putting the CCP2TX interface into OFF state. - * Set negative for no OFF. - */ -# ifndef VCHI_CCP2TX_OFF_TIMEOUT -# define VCHI_CCP2TX_OFF_TIMEOUT 1000 -# endif - -#endif /* VCHI_CCP2TX_MANUAL_POWER */ - -#endif /* VCHI_CFG_H_ */ - -/****************************** End of file **********************************/ From patchwork Tue Jun 23 16:42:07 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: 11621103 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 B0FD4138C for ; Tue, 23 Jun 2020 16:52:56 +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 354402076E for ; Tue, 23 Jun 2020 16:52:56 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="e1d6s+3x" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 354402076E 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=5eaUB011cgGzvOnfXZxJnsZwzRUHRDcPLWsfBdbQguM=; b=e1d6s+3xnKVxDFCbBLN4+bLkW z6mo995rL8GvjzF1vdeDuvQAz2k8SjXO2BorfRpt1V/qj0l8EAi00ZKw1OX2gDb4nzk1lRdD++y58 y4gbI+k7e7ZiFvF+gqzAos5TQMSkaaw6QNnu7l9zKiZnWirQAWz0lf7C9Uapz527dMv3f7gju/mT4 Gtu0CGSPezyHru3072pOvcbweT7Y1FPeYLkYrjcETyN+jUgE/V8lCG6Mn2b767diCDkgbrEZOGnWK 6bIw7uYuamy4sZ/L4tQ65Cb/fIUyjeeyZTiqV5cKXd6imBv4sNbWaTPo44XavFXVs0RcwGG45Zken 38DmyAB+w==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jnm7a-00089n-7A; Tue, 23 Jun 2020 16:50:08 +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 1jnm2y-0005PS-O8; Tue, 23 Jun 2020 16:45:27 +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 4FC55AEDD; Tue, 23 Jun 2020 16:45:19 +0000 (UTC) From: Nicolas Saenz Julienne To: gregkh@linuxfoundation.org Subject: [PATCH 21/50] staging: vchi: Get rid of flags argument in vchi_msg_hold() Date: Tue, 23 Jun 2020 18:42:07 +0200 Message-Id: <20200623164235.29566-22-nsaenzjulienne@suse.de> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20200623164235.29566-1-nsaenzjulienne@suse.de> References: <20200623164235.29566-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_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, 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 All users are ignoring the flags argument. So for the sake of simplicity delete it. Signed-off-by: Nicolas Saenz Julienne --- .../vc04_services/bcm2835-audio/bcm2835-vchiq.c | 3 +-- drivers/staging/vc04_services/interface/vchi/vchi.h | 1 - .../vc04_services/interface/vchiq_arm/vchiq_shim.c | 12 +++--------- .../staging/vc04_services/vchiq-mmal/mmal-vchiq.c | 2 +- 4 files changed, 5 insertions(+), 13 deletions(-) diff --git a/drivers/staging/vc04_services/bcm2835-audio/bcm2835-vchiq.c b/drivers/staging/vc04_services/bcm2835-audio/bcm2835-vchiq.c index 5018b5baa009..68119246f10b 100644 --- a/drivers/staging/vc04_services/bcm2835-audio/bcm2835-vchiq.c +++ b/drivers/staging/vc04_services/bcm2835-audio/bcm2835-vchiq.c @@ -102,8 +102,7 @@ static void audio_vchi_callback(void *param, if (reason != VCHI_CALLBACK_MSG_AVAILABLE) return; - status = vchi_msg_hold(instance->service, (void **)&m, &size, - VCHI_FLAGS_NONE, &handle); + status = vchi_msg_hold(instance->service, (void **)&m, &size, &handle); if (status) return; diff --git a/drivers/staging/vc04_services/interface/vchi/vchi.h b/drivers/staging/vc04_services/interface/vchi/vchi.h index 55e51e5a1fdc..92ce811fc28d 100644 --- a/drivers/staging/vc04_services/interface/vchi/vchi.h +++ b/drivers/staging/vc04_services/interface/vchi/vchi.h @@ -87,7 +87,6 @@ extern int vchi_queue_kernel_message(struct vchi_service *service, void *data, extern int32_t vchi_msg_hold(struct vchi_service *service, void **data, // } may be NULL, as info can be uint32_t *msg_size, // } obtained from HELD_MSG_T - enum vchi_flags flags, struct vchi_held_msg *message_descriptor); /******************************************************************************* 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 0c3473861a8d..0466512cfe3c 100644 --- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_shim.c +++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_shim.c @@ -195,7 +195,6 @@ EXPORT_SYMBOL(vchi_held_msg_release); * Arguments: struct vchi_service *service, * void **data, * uint32_t *msg_size, - * enum vchi_flags flags, * struct vchi_held_msg *message_handle * * Description: Routine to return a pointer to the current message (to allow @@ -207,17 +206,12 @@ EXPORT_SYMBOL(vchi_held_msg_release); * ***********************************************************/ int32_t vchi_msg_hold(struct vchi_service *service, void **data, - uint32_t *msg_size, enum vchi_flags flags, - struct vchi_held_msg *message_handle) + uint32_t *msg_size, struct vchi_held_msg *message_handle) { struct vchiq_header *header; - WARN_ON((flags != VCHI_FLAGS_NONE) && - (flags != VCHI_FLAGS_BLOCK_UNTIL_OP_COMPLETE)); - - if (flags == VCHI_FLAGS_NONE) - if (vchiu_queue_is_empty(&service->queue)) - return -1; + if (vchiu_queue_is_empty(&service->queue)) + return -1; header = vchiu_queue_pop(&service->queue); diff --git a/drivers/staging/vc04_services/vchiq-mmal/mmal-vchiq.c b/drivers/staging/vc04_services/vchiq-mmal/mmal-vchiq.c index f49e45673e34..4ee4601cba1c 100644 --- a/drivers/staging/vc04_services/vchiq-mmal/mmal-vchiq.c +++ b/drivers/staging/vc04_services/vchiq-mmal/mmal-vchiq.c @@ -568,7 +568,7 @@ static void service_callback(void *param, switch (reason) { case VCHI_CALLBACK_MSG_AVAILABLE: status = vchi_msg_hold(instance->service, (void **)&msg, - &msg_len, VCHI_FLAGS_NONE, &msg_handle); + &msg_len, &msg_handle); if (status) { pr_err("Unable to dequeue a message (%d)\n", status); break; From patchwork Tue Jun 23 16:42:08 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: 11621115 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 282A692A for ; Tue, 23 Jun 2020 16:54:28 +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 F23BD2076E for ; Tue, 23 Jun 2020 16:54:27 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="DJaehh79" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org F23BD2076E 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=zoB77UWScic//AzsBz+F94onBCB0IoHctPYKg8LbqK8=; b=DJaehh798EFmL/MpPYCJ2jEVn zoOY5njen5K5XMKacZcSZSWh9L6V3Ey9KB2jf4UTKPGh9Z5jdDtVp4fErALBLyXiUbzKxdr5IiUZQ 1IhiuZlMV9wYSmGHcKHoNmk9eEJDkkySx8pS3/PeXJmWMk36uAu31aReQsHMcg+dJp+ZYZOKNyzt3 ROUEayw9Goj1tPFvoYwUy9T21NJjeWNu71Ko1swmYsxfH/iyL+LjRdw+BPh2sBTJoqLpf6UVLnu0S HHZVaCozX8V/Ktoxs/5bqhJ0ihxa6+IM9qSVj1VnnXPSF/kMlPMhADeRXwp2GlKRHCVpZi8eaYy8p mRlhxdv4A==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jnm8y-0000cG-J0; Tue, 23 Jun 2020 16:51:32 +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 1jnm2z-0005Pv-Mw; Tue, 23 Jun 2020 16:45:29 +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 4FDDEAECB; Tue, 23 Jun 2020 16:45:20 +0000 (UTC) From: Nicolas Saenz Julienne To: gregkh@linuxfoundation.org Subject: [PATCH 22/50] staging: vchi: Use enum vchiq_bulk_mode instead of vchi's transmission flags Date: Tue, 23 Jun 2020 18:42:08 +0200 Message-Id: <20200623164235.29566-23-nsaenzjulienne@suse.de> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20200623164235.29566-1-nsaenzjulienne@suse.de> References: <20200623164235.29566-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_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, 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 vchi has a set of transfer flags which almost map 1:1 to vchiq's own transfer modes. For the sake of simplicity let's use the later and delete vchi's. Signed-off-by: Nicolas Saenz Julienne --- .../bcm2835-audio/bcm2835-vchiq.c | 2 +- .../vc04_services/bcm2835-audio/bcm2835.h | 1 + .../vc04_services/interface/vchi/vchi.h | 4 +- .../interface/vchi/vchi_common.h | 9 ---- .../interface/vchiq_arm/vchiq_shim.c | 44 ++----------------- .../vc04_services/vchiq-mmal/mmal-vchiq.c | 4 +- 6 files changed, 9 insertions(+), 55 deletions(-) diff --git a/drivers/staging/vc04_services/bcm2835-audio/bcm2835-vchiq.c b/drivers/staging/vc04_services/bcm2835-audio/bcm2835-vchiq.c index 68119246f10b..565853ec1e7a 100644 --- a/drivers/staging/vc04_services/bcm2835-audio/bcm2835-vchiq.c +++ b/drivers/staging/vc04_services/bcm2835-audio/bcm2835-vchiq.c @@ -348,7 +348,7 @@ int bcm2835_audio_write(struct bcm2835_alsa_stream *alsa_stream, /* Send the message to the videocore */ status = vchi_bulk_queue_transmit(instance->service, src, count, - VCHI_FLAGS_BLOCK_UNTIL_DATA_READ, + VCHIQ_BULK_MODE_BLOCKING, NULL); } else { while (count > 0) { diff --git a/drivers/staging/vc04_services/bcm2835-audio/bcm2835.h b/drivers/staging/vc04_services/bcm2835-audio/bcm2835.h index 2a94e825194f..7a0e4ab50fc7 100644 --- a/drivers/staging/vc04_services/bcm2835-audio/bcm2835.h +++ b/drivers/staging/vc04_services/bcm2835-audio/bcm2835.h @@ -9,6 +9,7 @@ #include #include #include +#include "interface/vchiq_arm/vchiq_if.h" #include "interface/vchi/vchi.h" #define MAX_SUBSTREAMS (8) diff --git a/drivers/staging/vc04_services/interface/vchi/vchi.h b/drivers/staging/vc04_services/interface/vchi/vchi.h index 92ce811fc28d..9a74ca4e1062 100644 --- a/drivers/staging/vc04_services/interface/vchi/vchi.h +++ b/drivers/staging/vc04_services/interface/vchi/vchi.h @@ -105,14 +105,14 @@ extern int32_t vchi_held_msg_release(struct vchi_held_msg *message); extern int32_t vchi_bulk_queue_receive(struct vchi_service *service, void *data_dst, uint32_t data_size, - enum vchi_flags flags, + enum vchiq_bulk_mode mode, void *transfer_handle); // Routine to queue up data ready for transfer to the other (once they have signalled they are ready) extern int32_t vchi_bulk_queue_transmit(struct vchi_service *service, const void *data_src, uint32_t data_size, - enum vchi_flags flags, + enum vchiq_bulk_mode mode, void *transfer_handle); /****************************************************************************** diff --git a/drivers/staging/vc04_services/interface/vchi/vchi_common.h b/drivers/staging/vc04_services/interface/vchi/vchi_common.h index e07376fe4dfd..52b447c19445 100644 --- a/drivers/staging/vc04_services/interface/vchi/vchi_common.h +++ b/drivers/staging/vc04_services/interface/vchi/vchi_common.h @@ -4,15 +4,6 @@ #ifndef VCHI_COMMON_H_ #define VCHI_COMMON_H_ -//flags used when sending messages (must be bitmapped) -enum vchi_flags { - VCHI_FLAGS_NONE = 0x0, - VCHI_FLAGS_BLOCK_UNTIL_OP_COMPLETE = 0x1, // waits for message to be received, or sent (NB. not the same as being seen on other side) - VCHI_FLAGS_CALLBACK_WHEN_OP_COMPLETE = 0x2, // run a callback when message sent - VCHI_FLAGS_BLOCK_UNTIL_QUEUED = 0x4, // return once the transfer is in a queue ready to go - VCHI_FLAGS_BLOCK_UNTIL_DATA_READ = 0x10, -}; - //callback reasons when an event occurs on a service enum vchi_callback_reason { /* 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 0466512cfe3c..3a5545e0db6b 100644 --- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_shim.c +++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_shim.c @@ -3,6 +3,7 @@ #include #include +#include "vchiq_if.h" #include "../vchi/vchi.h" #include "vchiq.h" #include "vchiq_core.h" @@ -57,30 +58,11 @@ EXPORT_SYMBOL(vchi_queue_kernel_message); * ***********************************************************/ int32_t vchi_bulk_queue_receive(struct vchi_service *service, void *data_dst, - uint32_t data_size, enum vchi_flags flags, + uint32_t data_size, enum vchiq_bulk_mode mode, void *bulk_handle) { - enum vchiq_bulk_mode mode; enum vchiq_status status; - switch ((int)flags) { - case VCHI_FLAGS_CALLBACK_WHEN_OP_COMPLETE - | VCHI_FLAGS_BLOCK_UNTIL_QUEUED: - WARN_ON(!service->callback); - mode = VCHIQ_BULK_MODE_CALLBACK; - break; - case VCHI_FLAGS_BLOCK_UNTIL_OP_COMPLETE: - mode = VCHIQ_BULK_MODE_BLOCKING; - break; - case VCHI_FLAGS_BLOCK_UNTIL_QUEUED: - case VCHI_FLAGS_NONE: - mode = VCHIQ_BULK_MODE_NOCALLBACK; - break; - default: - WARN(1, "unsupported message\n"); - return VCHIQ_ERROR; - } - while (1) { status = vchiq_bulk_receive(service->handle, data_dst, data_size, bulk_handle, mode); @@ -116,31 +98,11 @@ EXPORT_SYMBOL(vchi_bulk_queue_receive); int32_t vchi_bulk_queue_transmit(struct vchi_service *service, const void *data_src, uint32_t data_size, - enum vchi_flags flags, + enum vchiq_bulk_mode mode, void *bulk_handle) { - enum vchiq_bulk_mode mode; enum vchiq_status status; - switch ((int)flags) { - case VCHI_FLAGS_CALLBACK_WHEN_OP_COMPLETE - | VCHI_FLAGS_BLOCK_UNTIL_QUEUED: - WARN_ON(!service->callback); - mode = VCHIQ_BULK_MODE_CALLBACK; - break; - case VCHI_FLAGS_BLOCK_UNTIL_DATA_READ: - case VCHI_FLAGS_BLOCK_UNTIL_OP_COMPLETE: - mode = VCHIQ_BULK_MODE_BLOCKING; - break; - case VCHI_FLAGS_BLOCK_UNTIL_QUEUED: - case VCHI_FLAGS_NONE: - mode = VCHIQ_BULK_MODE_NOCALLBACK; - break; - default: - WARN(1, "unsupported message\n"); - return VCHIQ_ERROR; - } - while (1) { status = vchiq_bulk_transmit(service->handle, data_src, data_size, bulk_handle, mode); diff --git a/drivers/staging/vc04_services/vchiq-mmal/mmal-vchiq.c b/drivers/staging/vc04_services/vchiq-mmal/mmal-vchiq.c index 4ee4601cba1c..153a81a11ffc 100644 --- a/drivers/staging/vc04_services/vchiq-mmal/mmal-vchiq.c +++ b/drivers/staging/vc04_services/vchiq-mmal/mmal-vchiq.c @@ -29,6 +29,7 @@ #include "mmal-vchiq.h" #include "mmal-msg.h" +#include "interface/vchiq_arm/vchiq_if.h" #include "interface/vchi/vchi.h" /* @@ -300,8 +301,7 @@ static void buffer_to_host_work_cb(struct work_struct *work) * of 4 bytes */ (len + 3) & ~3, - VCHI_FLAGS_CALLBACK_WHEN_OP_COMPLETE | - VCHI_FLAGS_BLOCK_UNTIL_QUEUED, + VCHIQ_BULK_MODE_CALLBACK, msg_context); vchi_service_release(instance->service); From patchwork Tue Jun 23 16:42:09 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: 11621121 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 1950A92A for ; Tue, 23 Jun 2020 16:55:52 +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 AFA612076E for ; Tue, 23 Jun 2020 16:55:51 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="Z4/a4NzR" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org AFA612076E 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=IRJOa3dxwrnYcDczovOJqhZoX8vu22jI9OGmS7f6GEc=; b=Z4/a4NzR5QQrdu/WTA+Y36vE6 fIhYCWh3+xWC8F32C3BT1CAGdkU10GrKZVe7n8DDWTif7ngG7D7Y94xooiulbUOrEOh1svLkL5QXU kOjS6KfbCmCafLCdL9cYxmBFTJlo5pgsRcc9iYNXO2ts5XIZb8vH2gU9u5WMo/NKvz5K7KU3zEZyo TH37M5cxYi0r8hyE60X2ELpkvPp3Nf/5MAXJ+4sP/pNPAnH2cfuFV+iP8CCD6P/KlJzGio7xC7O1P DRLSE1SgK7nEvxytGVqqB5Fs5AJlVeA3X9rA4YqHWWAnRYCTwUdB99ZPa7nC1aDN0qcw4V/A6iNIL 33O3/VFwQ==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jnmA5-0001S0-Hi; Tue, 23 Jun 2020 16:52:41 +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 1jnm30-0005QD-CO; Tue, 23 Jun 2020 16:45:31 +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 D56B8AEF3; Tue, 23 Jun 2020 16:45:20 +0000 (UTC) From: Nicolas Saenz Julienne To: gregkh@linuxfoundation.org Subject: [PATCH 23/50] staging: vchi: Use vchiq's enum vchiq_reason Date: Tue, 23 Jun 2020 18:42:09 +0200 Message-Id: <20200623164235.29566-24-nsaenzjulienne@suse.de> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20200623164235.29566-1-nsaenzjulienne@suse.de> References: <20200623164235.29566-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_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, 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 3a5545e0db6b..649a65f02578 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 153a81a11ffc..0a33d97572ec 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 */ From patchwork Tue Jun 23 16:42:10 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: 11621117 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 0B00292A for ; Tue, 23 Jun 2020 16:55:01 +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 53B8D20774 for ; Tue, 23 Jun 2020 16:55:00 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="UytNZG8q" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 53B8D20774 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=Pu0zB7zRMOKF8sdkriI548mnwKWzV1IZ76JZY4tSMdo=; b=UytNZG8q5Gfy+VX5JGEoLXrt1 RtSZfU876X8IOLye5lS8wWiXGc+y6s62ljU2O/ogPVz/G6fIr4vrc/S/e1ve0hfCGFCDIH9adLoh8 xZC40F3xerx5eEub4phZIyQ0tij/Y9VNKTF+4q01/eBIEUfNVwGeq4kfQbLMpNLubQIAcdCcg0uvL OLgD4er5Kn/d6Koa7YZBsurOBg6QIrD8bo/pe8qqEMN7MrW6FcMVkadyMRpwV5EJHl3j8z7Jyo2ED EQPvTYLxblawWR+em2vrvLLFlGFjvDIaJfElYQO1n3tG3ZhUEiu0mAf3St1H9mGjiRUOfBTRzfFDY gEnr7l9Yw==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jnm9d-0001AU-Eb; Tue, 23 Jun 2020 16:52:13 +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 1jnm31-0005QW-32; Tue, 23 Jun 2020 16:45:30 +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 593BDB053; Tue, 23 Jun 2020 16:45:21 +0000 (UTC) From: Nicolas Saenz Julienne To: gregkh@linuxfoundation.org Subject: [PATCH 24/50] staging: vchi: Get rid of effect less expression Date: Tue, 23 Jun 2020 18:42:10 +0200 Message-Id: <20200623164235.29566-25-nsaenzjulienne@suse.de> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20200623164235.29566-1-nsaenzjulienne@suse.de> References: <20200623164235.29566-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_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, 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 It was probably there to trick compilers into ignoring unused variables, which isn't needed in Linux. Signed-off-by: Nicolas Saenz Julienne --- drivers/staging/vc04_services/interface/vchiq_arm/vchiq_shim.c | 2 -- 1 file changed, 2 deletions(-) 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 649a65f02578..e09c595d6f9d 100644 --- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_shim.c +++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_shim.c @@ -288,8 +288,6 @@ static struct vchi_service *service_alloc(struct vchiq_instance *instance, { struct vchi_service *service = kzalloc(sizeof(struct vchi_service), GFP_KERNEL); - (void)instance; - if (service) { if (!vchiu_queue_init(&service->queue, 64)) { service->callback = setup->callback; From patchwork Tue Jun 23 16:42:11 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: 11621125 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 3C5FB92A for ; Tue, 23 Jun 2020 16:58:18 +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 14BB82076E for ; Tue, 23 Jun 2020 16:58:18 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="G6CC3Tm/" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 14BB82076E 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=8uk4lRXAx9uZpuH1l/Hr4K+DGDX+qbeMFdwBmxwvE+Q=; b=G6CC3Tm/YGRfcvbwsEFO5dP/k dgWhTzbhryrdZChnHWx9d6Tb8nZLhAk380W+Fc9kYEK2GIILImABa7qrpOu3JsAANSyqGMkIbTHWA 24zTDyBK+en57Jk45ctFeL6AnvtsfFZEv5Cfb+2pt3w5M90MNg6m2RSbygx67n8rIW5f8gr7kHNs4 dWa7h7huWnr/J1ykb9sen8dOf9/z3WMMCS6/pErJBvuZZ/SMvHsv+baBkqi6WKDTBUBHG47xk2uxP cwcm4JVpLYOTEpX8sheRkZw266OCEbeRno6fPdqv6nDpzTmYWz7L2qPe++utB23HS0FJ2KFIVldZl 9oqbQgesA==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jnmCO-0002hF-L2; Tue, 23 Jun 2020 16:55:05 +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 1jnm31-0005Qs-I8; Tue, 23 Jun 2020 16:45:32 +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 C9213B13E; Tue, 23 Jun 2020 16:45:21 +0000 (UTC) From: Nicolas Saenz Julienne To: gregkh@linuxfoundation.org Subject: [PATCH 25/50] staging: vchiq: Introduce vchiq_validate_params() Date: Tue, 23 Jun 2020 18:42:11 +0200 Message-Id: <20200623164235.29566-26-nsaenzjulienne@suse.de> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20200623164235.29566-1-nsaenzjulienne@suse.de> References: <20200623164235.29566-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_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, 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 When adding a new service validate the configuration parameters provided, and remove unnecessary checks in vchi, now that we have validated service's config. Signed-off-by: Nicolas Saenz Julienne --- .../interface/vchiq_arm/vchiq_core.c | 15 +++++++++++++++ .../interface/vchiq_arm/vchiq_shim.c | 4 ---- 2 files changed, 15 insertions(+), 4 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 ae9183db44ee..46b09b7154f8 100644 --- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c +++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c @@ -2265,6 +2265,16 @@ vchiq_init_state(struct vchiq_state *state, struct vchiq_slot_zero *slot_zero) return VCHIQ_ERROR; } +static int vchiq_validate_params(const struct vchiq_service_params *params) +{ + if (!params->callback || !params->fourcc) { + vchiq_loud_error("Can't add service, invalid params\n"); + return -EINVAL; + } + + return 0; +} + /* Called from application thread when a client or server service is created. */ struct vchiq_service * vchiq_add_service_internal(struct vchiq_state *state, @@ -2275,8 +2285,13 @@ vchiq_add_service_internal(struct vchiq_state *state, struct vchiq_service *service; struct vchiq_service __rcu **pservice = NULL; struct vchiq_service_quota *service_quota; + int ret; int i; + ret = vchiq_validate_params(params); + if (ret) + return NULL; + service = kmalloc(sizeof(*service), GFP_KERNEL); if (!service) return 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 e09c595d6f9d..dcf8776834b1 100644 --- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_shim.c +++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_shim.c @@ -271,15 +271,11 @@ static enum vchiq_status shim_callback(enum vchiq_reason reason, struct vchi_service *service = (struct vchi_service *)VCHIQ_GET_SERVICE_USERDATA(handle); - if (!service->callback) - goto release; - if (reason == VCHIQ_MESSAGE_AVAILABLE) vchiu_queue_push(&service->queue, header); service->callback(service->callback_param, reason, bulk_user); -release: return VCHIQ_SUCCESS; } From patchwork Tue Jun 23 16:42:12 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: 11621131 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 3F551618 for ; Tue, 23 Jun 2020 17:01:37 +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 916A620774 for ; Tue, 23 Jun 2020 17:01:36 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="3R0BHlIH" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 916A620774 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=HUp7p0H5bmko/qXDmnaC4kYflnP69sgJLOS70B1th0w=; b=3R0BHlIH6dI3KSLHvuIu6qsa+ eB8cwyO6C+M1LxNyqUR/OrvdS4gOzOYhLftwrydMDFiJSjE5jLEnlCDTAmrUXMDJ9QW56Ji9A+YbH RcTwKh0FPcdBhPuQ2QxOJ4f3t8wcfGz2Wh2zMGP9dYBET1Dti4JpQDWS1eZjmZWCB5jPkoEETH04D aH+o0j5W48w/ZImSrgtE02GP19WBjOr+1g9/JeNB8ORpbMc93wljex/x3OnEhsUlUbLYilmWyYQ9+ v8t6GYk4fRCb/+05BnOALSKGJZIFYHUzGIA4QrBYI6Z6CvSvtcC+6dJFk4+G6deTIuY8AT9uUTyXr dRBy+7Opg==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jnmFI-0004Bp-Fc; Tue, 23 Jun 2020 16:58:04 +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 1jnm31-0005R0-RG; Tue, 23 Jun 2020 16:45:34 +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 624E6B03C; Tue, 23 Jun 2020 16:45:22 +0000 (UTC) From: Nicolas Saenz Julienne To: gregkh@linuxfoundation.org Subject: [PATCH 26/50] staging: vchiq: Move message queue into struct vchiq_service Date: Tue, 23 Jun 2020 18:42:12 +0200 Message-Id: <20200623164235.29566-27-nsaenzjulienne@suse.de> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20200623164235.29566-1-nsaenzjulienne@suse.de> References: <20200623164235.29566-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_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, 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 This has historically been handled by vchi, but there is no reason why this couldn't be handled directly in vchiq. The patch tries to avoid altering any behavior, with the exception of the msg_queue size, which is now fixed to VCHIQ_MAX_SLOTS (it was set to VCHIQ_MAX_SLOTS / 2). This is done to match vchiq's user_service message queue, which could be merged with this one in the future. Signed-off-by: Nicolas Saenz Julienne --- drivers/staging/vc04_services/Makefile | 1 - .../interface/vchiq_arm/vchiq_core.c | 46 ++++++++++++ .../interface/vchiq_arm/vchiq_core.h | 6 ++ .../interface/vchiq_arm/vchiq_if.h | 2 + .../interface/vchiq_arm/vchiq_shim.c | 24 ++---- .../interface/vchiq_arm/vchiq_util.c | 73 ------------------- .../interface/vchiq_arm/vchiq_util.h | 22 ------ 7 files changed, 61 insertions(+), 113 deletions(-) delete mode 100644 drivers/staging/vc04_services/interface/vchiq_arm/vchiq_util.c diff --git a/drivers/staging/vc04_services/Makefile b/drivers/staging/vc04_services/Makefile index d37f21d1a219..922990919c40 100644 --- a/drivers/staging/vc04_services/Makefile +++ b/drivers/staging/vc04_services/Makefile @@ -7,7 +7,6 @@ vchiq-objs := \ interface/vchiq_arm/vchiq_2835_arm.o \ interface/vchiq_arm/vchiq_debugfs.o \ interface/vchiq_arm/vchiq_shim.o \ - interface/vchiq_arm/vchiq_util.o \ interface/vchiq_arm/vchiq_connected.o \ obj-$(CONFIG_SND_BCM2835) += bcm2835-audio/ 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 46b09b7154f8..0e9680904e68 100644 --- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c +++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c @@ -2265,6 +2265,47 @@ vchiq_init_state(struct vchiq_state *state, struct vchiq_slot_zero *slot_zero) return VCHIQ_ERROR; } +void vchiq_msg_queue_push(unsigned handle, struct vchiq_header *header) +{ + struct vchiq_service *service = find_service_by_handle(handle); + int pos; + + while (service->msg_queue_write == service->msg_queue_read + + VCHIQ_MAX_SLOTS) { + if (wait_for_completion_interruptible(&service->msg_queue_pop)) + flush_signals(current); + } + + pos = service->msg_queue_write++ & (VCHIQ_MAX_SLOTS - 1); + service->msg_queue[pos] = header; + + complete(&service->msg_queue_push); +} +EXPORT_SYMBOL(vchiq_msg_queue_push); + +struct vchiq_header *vchiq_msg_hold(unsigned handle) +{ + struct vchiq_service *service = find_service_by_handle(handle); + struct vchiq_header *header; + int pos; + + if (service->msg_queue_write == service->msg_queue_read) + return NULL; + + while (service->msg_queue_write == service->msg_queue_read) { + if (wait_for_completion_interruptible(&service->msg_queue_push)) + flush_signals(current); + } + + pos = service->msg_queue_read++ & (VCHIQ_MAX_SLOTS - 1); + header = service->msg_queue[pos]; + + complete(&service->msg_queue_pop); + + return header; +} +EXPORT_SYMBOL(vchiq_msg_hold); + static int vchiq_validate_params(const struct vchiq_service_params *params) { if (!params->callback || !params->fourcc) { @@ -2319,12 +2360,17 @@ vchiq_add_service_internal(struct vchiq_state *state, service->state = state; service->instance = instance; service->service_use_count = 0; + service->msg_queue_read = 0; + service->msg_queue_write = 0; init_bulk_queue(&service->bulk_tx); init_bulk_queue(&service->bulk_rx); init_completion(&service->remove_event); init_completion(&service->bulk_remove_event); + init_completion(&service->msg_queue_pop); + init_completion(&service->msg_queue_push); mutex_init(&service->bulk_mutex); memset(&service->stats, 0, sizeof(service->stats)); + memset(&service->msg_queue, 0, sizeof(service->msg_queue)); /* Although it is perfectly possible to use a spinlock ** to protect the creation of services, it is overkill as it diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.h b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.h index 1fe6cd8b86c0..b97b661bea1c 100644 --- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.h +++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.h @@ -297,6 +297,12 @@ struct vchiq_service { uint64_t bulk_tx_bytes; uint64_t bulk_rx_bytes; } stats; + + int msg_queue_read; + int msg_queue_write; + struct completion msg_queue_pop; + struct completion msg_queue_push; + struct vchiq_header *msg_queue[VCHIQ_MAX_SLOTS]; }; /* The quota information is outside struct vchiq_service so that it can diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_if.h b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_if.h index b62fd6d6f1ac..8fd51d885a18 100644 --- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_if.h +++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_if.h @@ -136,5 +136,7 @@ extern enum vchiq_status vchiq_dump_phys_mem(unsigned int service, extern enum vchiq_status vchiq_get_peer_version(unsigned int handle, short *peer_version); +extern void vchiq_msg_queue_push(unsigned handle, struct vchiq_header *header); +extern struct vchiq_header *vchiq_msg_hold(unsigned handle); #endif /* VCHIQ_IF_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 dcf8776834b1..85d79d0033bf 100644 --- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_shim.c +++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_shim.c @@ -13,8 +13,6 @@ struct vchi_service { unsigned int handle; - struct vchiu_queue queue; - vchi_callback callback; void *callback_param; }; @@ -172,10 +170,9 @@ int32_t vchi_msg_hold(struct vchi_service *service, void **data, { struct vchiq_header *header; - if (vchiu_queue_is_empty(&service->queue)) - return -1; - - header = vchiu_queue_pop(&service->queue); + header = vchiq_msg_hold(service->handle); + if (!header) + return -ENOENT; *data = header->data; *msg_size = header->size; @@ -272,7 +269,7 @@ static enum vchiq_status shim_callback(enum vchiq_reason reason, (struct vchi_service *)VCHIQ_GET_SERVICE_USERDATA(handle); if (reason == VCHIQ_MESSAGE_AVAILABLE) - vchiu_queue_push(&service->queue, header); + vchiq_msg_queue_push(service->handle, header); service->callback(service->callback_param, reason, bulk_user); @@ -285,13 +282,8 @@ static struct vchi_service *service_alloc(struct vchiq_instance *instance, struct vchi_service *service = kzalloc(sizeof(struct vchi_service), GFP_KERNEL); if (service) { - if (!vchiu_queue_init(&service->queue, 64)) { - service->callback = setup->callback; - service->callback_param = setup->callback_param; - } else { - kfree(service); - service = NULL; - } + service->callback = setup->callback; + service->callback_param = setup->callback_param; } return service; @@ -299,10 +291,8 @@ static struct vchi_service *service_alloc(struct vchiq_instance *instance, static void service_free(struct vchi_service *service) { - if (service) { - vchiu_queue_delete(&service->queue); + if (service) kfree(service); - } } int32_t vchi_service_open(struct vchiq_instance *instance, diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_util.c b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_util.c deleted file mode 100644 index c1c81f9ab9e6..000000000000 --- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_util.c +++ /dev/null @@ -1,73 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause -/* Copyright (c) 2010-2012 Broadcom. All rights reserved. */ - -#include "vchiq_util.h" - -static inline int is_pow2(int i) -{ - return i && !(i & (i - 1)); -} - -int vchiu_queue_init(struct vchiu_queue *queue, int size) -{ - WARN_ON(!is_pow2(size)); - - queue->size = size; - queue->read = 0; - queue->write = 0; - queue->initialized = 1; - - init_completion(&queue->pop); - init_completion(&queue->push); - - queue->storage = kcalloc(size, sizeof(struct vchiq_header *), - GFP_KERNEL); - if (!queue->storage) { - vchiu_queue_delete(queue); - return -ENOMEM; - } - return 0; -} - -void vchiu_queue_delete(struct vchiu_queue *queue) -{ - kfree(queue->storage); -} - -int vchiu_queue_is_empty(struct vchiu_queue *queue) -{ - return queue->read == queue->write; -} - -void vchiu_queue_push(struct vchiu_queue *queue, struct vchiq_header *header) -{ - if (!queue->initialized) - return; - - while (queue->write == queue->read + queue->size) { - if (wait_for_completion_interruptible(&queue->pop)) - flush_signals(current); - } - - queue->storage[queue->write & (queue->size - 1)] = header; - queue->write++; - - complete(&queue->push); -} - -struct vchiq_header *vchiu_queue_pop(struct vchiu_queue *queue) -{ - struct vchiq_header *header; - - while (queue->write == queue->read) { - if (wait_for_completion_interruptible(&queue->push)) - flush_signals(current); - } - - header = queue->storage[queue->read & (queue->size - 1)]; - queue->read++; - - complete(&queue->pop); - - return header; -} diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_util.h b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_util.h index 1c90a8da1a92..dcf081079c39 100644 --- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_util.h +++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_util.h @@ -24,26 +24,4 @@ #include "vchiq_if.h" -struct vchiu_queue { - int size; - int read; - int write; - int initialized; - - struct completion pop; - struct completion push; - - struct vchiq_header **storage; -}; - -extern int vchiu_queue_init(struct vchiu_queue *queue, int size); -extern void vchiu_queue_delete(struct vchiu_queue *queue); - -extern int vchiu_queue_is_empty(struct vchiu_queue *queue); - -extern void vchiu_queue_push(struct vchiu_queue *queue, - struct vchiq_header *header); - -extern struct vchiq_header *vchiu_queue_pop(struct vchiu_queue *queue); - #endif From patchwork Tue Jun 23 16:42:13 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: 11621129 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 4D2E6138C for ; Tue, 23 Jun 2020 17:00:45 +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 268AC206EB for ; Tue, 23 Jun 2020 17:00:45 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="eKkGvK3d" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 268AC206EB 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=/tnmRBdVRmV2FS6wBtSaOfKemWmbv6ifM6jB2xA/n04=; b=eKkGvK3d0jgfbICbUTDe/TsTq q76uiZdK4vut5q8xm+EJ9s5SkebxILZT1w0zwNs8Ov1abfrvm/L9JD/LbMhJXXslOwnOJxCtQ4mqi OhSP+OmRxaiaI+GbH1Qm56slIV02VzMYGQ4Hg3TZKimF9YvgQzqueilXGKTkbwOdMCpImsddVLyF3 85CfgdPu2btY3nKuRttHMuhqjRgbxT1aDrRWLJaryj9Q90CBoc7vJM0uyGkCmkt5CNQLXKPEi7aIP 6ng8qQxSa0Z+48EvJsuYkxc42g0p85G3xyMPr33CBEsdEqpMSkzko8OgE8+n4kq/SIAVdLZXz25sC kwOkcJXVw==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jnmEJ-0003l3-SP; Tue, 23 Jun 2020 16:57:04 +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 1jnm32-0005RU-Qs; Tue, 23 Jun 2020 16:45:34 +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 4CAF1B162; Tue, 23 Jun 2020 16:45:23 +0000 (UTC) From: Nicolas Saenz Julienne To: gregkh@linuxfoundation.org Subject: [PATCH 27/50] staging: vchiq: Get rid of vchiq_util.h Date: Tue, 23 Jun 2020 18:42:13 +0200 Message-Id: <20200623164235.29566-28-nsaenzjulienne@suse.de> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20200623164235.29566-1-nsaenzjulienne@suse.de> References: <20200623164235.29566-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_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, 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 The header file only provides other includes. Move the relevant includes to their respective C files and delete it for good. Signed-off-by: Nicolas Saenz Julienne --- .../vc04_services/interface/vchiq_arm/vchiq.h | 1 - .../interface/vchiq_arm/vchiq_2835_arm.c | 1 + .../interface/vchiq_arm/vchiq_arm.c | 1 + .../interface/vchiq_arm/vchiq_core.c | 9 +++++++ .../interface/vchiq_arm/vchiq_shim.c | 4 +-- .../interface/vchiq_arm/vchiq_util.h | 27 ------------------- 6 files changed, 13 insertions(+), 30 deletions(-) delete mode 100644 drivers/staging/vc04_services/interface/vchiq_arm/vchiq_util.h diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq.h b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq.h index 25af99a0f394..211b20705e36 100644 --- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq.h +++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq.h @@ -5,7 +5,6 @@ #define VCHIQ_VCHIQ_H #include "vchiq_if.h" -#include "vchiq_util.h" /* Do this so that we can test-build the code on non-rpi systems */ #if IS_ENABLED(CONFIG_RASPBERRYPI_FIRMWARE) diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_2835_arm.c b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_2835_arm.c index 38a13e4618a8..1caa2a269c0e 100644 --- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_2835_arm.c +++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_2835_arm.c @@ -12,6 +12,7 @@ #include #include #include +#include #include #define TOTAL_SLOTS (VCHIQ_SLOT_ZERO_SLOTS + 2 * 32) diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c index 355590f1e130..96c6205368ab 100644 --- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c +++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c @@ -23,6 +23,7 @@ #include #include #include +#include #include #include "vchiq_core.h" 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 0e9680904e68..5b55d32e62a0 100644 --- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c +++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c @@ -1,8 +1,17 @@ // SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause /* Copyright (c) 2010-2012 Broadcom. All rights reserved. */ +#include +#include +#include +#include +#include +#include +#include +#include #include #include +#include #include "vchiq_core.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 85d79d0033bf..9728667adbd9 100644 --- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_shim.c +++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_shim.c @@ -2,14 +2,14 @@ /* Copyright (c) 2010-2012 Broadcom. All rights reserved. */ #include #include +#include +#include #include "vchiq_if.h" #include "../vchi/vchi.h" #include "vchiq.h" #include "vchiq_core.h" -#include "vchiq_util.h" - struct vchi_service { unsigned int handle; diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_util.h b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_util.h deleted file mode 100644 index dcf081079c39..000000000000 --- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_util.h +++ /dev/null @@ -1,27 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause */ -/* Copyright (c) 2010-2012 Broadcom. All rights reserved. */ - -#ifndef VCHIQ_UTIL_H -#define VCHIQ_UTIL_H - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include /* for time_t */ -#include - -#include "vchiq_if.h" - -#endif From patchwork Tue Jun 23 16:42:14 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: 11621119 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 B85BC138C for ; Tue, 23 Jun 2020 16:55:10 +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 078412076E for ; Tue, 23 Jun 2020 16:55:10 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="gVw1tNgh"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="Te6asL/0" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 078412076E 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=sdp8CNyo/OhphQEwgJDlcsqUdsv24JRd8Rmyr2ShR4g=; b=gVw1tNghZwfBxOao2HNRmLXk8 +ShkRb5Rl4PbeCh+5ptQwI2i9NmobSivjBxDvORKGh4VdXiATtvLJO3sorsjK0ve/8PpCATKdWKj9 yN9ST2Rkrcu6RYYi/ENY5yxDJqDaQc4dC7PnDtM1L/j+dE4llkfVaHIQL08ks2R/0XGPt5OIE4rZh 6BpfVVW2xJ18/JpnKADlE92wp/1gO1kpA6mtrYW8lC61cZ8RoQso9tF89C+g7iz5zL/or5DRKoRzj a8xiKq+8gVdolChX/YnslaDmbdfFiO+de/yRNwer8kS20t1enbodJ25cfIcnFG3NNSn2KAvDHd7Dc CZ1eYpyZg==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jnm9O-0000xp-Mj; Tue, 23 Jun 2020 16:51:58 +0000 Received: from casper.infradead.org ([2001:8b0:10b:1236::1]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jnm38-0005TP-DA; Tue, 23 Jun 2020 16:45:30 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=Content-Transfer-Encoding:MIME-Version: References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To: Content-Type:Content-ID:Content-Description; bh=MVtog4JICwBgVhGmM32bkh5aGRQAd6FHOIQXnIIBmtw=; b=Te6asL/0PKviZjnFdMULPN1aXD CAQ/bupRDAYRYHeWAB1euj773eJQQIk71WUH/V+2zUctS3ql4U6h3ouLBY7zL6sH68Xd4kAYaetrN Nn9su13s0ikd3i5LdODB3kRL4POBiP+osi1Atc6VWUbVg/EKt4ZHnCoFq14j3eIa+t7qv9wkPIi6s SGzvq5+CKvGGTwXAfnacsOyUkjTtJW6FvDLGGv5qoN1OpzHvZavQZl9qmv2aerqFvVlw4keIlSPGI tHRlVllTEKQh5ogacs1IUvJM1OXY6lvcz4qavYEmiiIIqM3QdB/IJ7PXjXc/8GoCE1J7SahwNJvRA g3gbSbFQ==; Received: from mx2.suse.de ([195.135.220.15]) by casper.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jnm33-0002rl-VD; Tue, 23 Jun 2020 16:45:29 +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 B1AC4AED2; Tue, 23 Jun 2020 16:45:23 +0000 (UTC) From: Nicolas Saenz Julienne To: gregkh@linuxfoundation.org Subject: [PATCH 28/50] staging: vchi: Expose struct vchi_service Date: Tue, 23 Jun 2020 18:42:14 +0200 Message-Id: <20200623164235.29566-29-nsaenzjulienne@suse.de> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20200623164235.29566-1-nsaenzjulienne@suse.de> References: <20200623164235.29566-1-nsaenzjulienne@suse.de> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200623_174526_273537_BEC53075 X-CRM114-Status: UNSURE ( 8.72 ) X-CRM114-Notice: Please train this message. X-Spam-Score: -4.2 (----) X-Spam-Report: SpamAssassin version 3.4.4 on casper.infradead.org summary: Content analysis details: (-4.2 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] 0.0 RCVD_IN_MSPIKE_H3 RBL: Good reputation (+3) [195.135.220.15 listed in wl.mailspike.net] -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 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, 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 This will make further changes easier. The struct will ultimately disappear. Signed-off-by: Nicolas Saenz Julienne --- drivers/staging/vc04_services/interface/vchi/vchi.h | 10 +++++++--- .../vc04_services/interface/vchiq_arm/vchiq_shim.c | 7 ------- 2 files changed, 7 insertions(+), 10 deletions(-) diff --git a/drivers/staging/vc04_services/interface/vchi/vchi.h b/drivers/staging/vc04_services/interface/vchi/vchi.h index 9a74ca4e1062..789acb7999d1 100644 --- a/drivers/staging/vc04_services/interface/vchi/vchi.h +++ b/drivers/staging/vc04_services/interface/vchi/vchi.h @@ -29,6 +29,13 @@ struct vchi_held_msg { void *message; }; +struct vchi_service { + unsigned int handle; + + vchi_callback callback; + void *callback_param; +}; + // structure used to provide the information needed to open a server or a client struct service_creation { struct vchi_version version; @@ -40,9 +47,6 @@ struct service_creation { // Opaque handle for a VCHIQ instance struct vchiq_instance; -// Opaque handle for a server or client -struct vchi_service; - /****************************************************************************** * Global funcs - implementation is specific to which side you are on * (local / remote) 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 9728667adbd9..843ee978928f 100644 --- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_shim.c +++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_shim.c @@ -10,13 +10,6 @@ #include "vchiq.h" #include "vchiq_core.h" -struct vchi_service { - unsigned int handle; - - vchi_callback callback; - void *callback_param; -}; - int vchi_queue_kernel_message(struct vchi_service *service, void *data, unsigned int size) { From patchwork Tue Jun 23 16:42:15 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: 11621113 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 195B692A for ; Tue, 23 Jun 2020 16:54:14 +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 8E66D2076E for ; Tue, 23 Jun 2020 16:54:13 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="RRgL01cd"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="UAZDPTmA" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 8E66D2076E 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=b0qMl4VJ3XYGlE2rVlFTYJGYbHDd3Pqare/Wz4ucS34=; b=RRgL01cdVVfHyh1pvmvLtnGox v+5EXVxpg3uBeMbClmLIKjXNJZJ04A6B0TvH/Kt2i/RKM/ALL/atQ0Ehfk0RJcuKQTtvYkzioz/oZ xLYxdFq348hofeYyFp+D53Dee6Vz5mGj6P0UYmzYr4xTC+5ipIrVHGTxBsJ+P7hbK2nTuMlPtSMdY dceG6BXn297eWq5p2L4QmyZvxuPTI7NjrcG6yfqPvjTDahvHpPuUM5gbd2AY4yyTxaL0zyCAfQH+t mW6lV6PNndmBCD/EU9noZUCNTJOlkeDAM4WOoUVafL4JIfxCnI4CgMsmX1QDFeRhQSsyhm2qDGlKM Guzo68AiA==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jnm8V-0000SA-Ek; Tue, 23 Jun 2020 16:51:03 +0000 Received: from casper.infradead.org ([2001:8b0:10b:1236::1]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jnm37-0005T9-IB; Tue, 23 Jun 2020 16:45:29 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=Content-Transfer-Encoding:MIME-Version: References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To: Content-Type:Content-ID:Content-Description; bh=OsqQg0S24FhzwrR/UelJbR+sFRN0sXwQiVfL4v773aQ=; b=UAZDPTmA6+yAUAyhzsSCwQxVqh qb9lO7SCGz9gZyeQnDVxV4uXtjaiyngfDOMavTBzPNi68mc+ehzflrohtHWjAke8H3LiuCG+lqZ7w eIGqUa4gwM+9PfqDsMhMCMdlOv6NDQosFXr7f+5fx/L0z0bo5I/z/WyhswFEcp3O7cygjAgVJtJGe 2NOkttCtio8ucqSy4S5i3YvHT0g/J4dvIjmQSr6lZ3flZtUizjejYGAMB/4y3OfjR4oo2acvjF+MK C3oPZSltRhQ8f+aR0b4prVAb8xTGN94tcedYR2c59fpvU7DfUcA/3yAVLEDyHNc9BvCAwCo62T+JQ OxeS33vw==; Received: from mx2.suse.de ([195.135.220.15]) by casper.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jnm33-0002rm-VP; Tue, 23 Jun 2020 16:45:28 +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 1FEF8B077; Tue, 23 Jun 2020 16:45:24 +0000 (UTC) From: Nicolas Saenz Julienne To: gregkh@linuxfoundation.org Subject: [PATCH 29/50] staging: vchiq: Export vchiq_get_service_userdata() Date: Tue, 23 Jun 2020 18:42:15 +0200 Message-Id: <20200623164235.29566-30-nsaenzjulienne@suse.de> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20200623164235.29566-1-nsaenzjulienne@suse.de> References: <20200623164235.29566-1-nsaenzjulienne@suse.de> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200623_174526_312568_257500E8 X-CRM114-Status: UNSURE ( 6.21 ) X-CRM114-Notice: Please train this message. X-Spam-Score: -4.2 (----) X-Spam-Report: SpamAssassin version 3.4.4 on casper.infradead.org summary: Content analysis details: (-4.2 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- 0.0 RCVD_IN_MSPIKE_H3 RBL: Good reputation (+3) [195.135.220.15 listed in wl.mailspike.net] -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] -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] -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, 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 This is for service's callbacks to get their private data. Signed-off-by: Nicolas Saenz Julienne --- drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c | 1 + 1 file changed, 1 insertion(+) 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 5b55d32e62a0..01a9331dbff4 100644 --- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c +++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c @@ -332,6 +332,7 @@ vchiq_get_service_userdata(unsigned int handle) rcu_read_unlock(); return userdata; } +EXPORT_SYMBOL(vchiq_get_service_userdata); static void mark_service_closing_internal(struct vchiq_service *service, int sh_thread) From patchwork Tue Jun 23 16:42:16 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: 11621123 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 F2B08138C for ; Tue, 23 Jun 2020 16:57:44 +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 7600B2076E for ; Tue, 23 Jun 2020 16:57:44 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="Te0bhPXo" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 7600B2076E 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=qf9edfPI7DtjT7X7nwqoQvYxvKYrvZNIvnmUOSFFasA=; b=Te0bhPXobw3R2eMFYwX1aeYiG MuKrxJ/NFs+KI5eIPoXpKgRRDnceV7TahZAo3T9I6W8l3umEg+25zfZpyfYzP1DWZCX9YWY4T5LFY HamN9AceVIkNawRM/IsrwQyLQ6HzgLOiox0aRm7xrShyFrG4QyY0M4+5VgW1rM+h1MAMi0ILFk79p 4aPXHAa7qIzH8sqgENtrRpBD90OcUzySK1CN6AIZlS2JJhmVfv5c3nG26C5Xhg6R7fS5khMgdNrqX GZtNC4vN5EBsuZvO8M4g6woXzPqG6MW3eBtPPMSXDcO64yCGt6dNNx9wPqcJCUNnE3ddoyecuYKoc qHpy/cpHQ==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jnmBt-0002Rz-3q; Tue, 23 Jun 2020 16:54:33 +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 1jnm34-0005S8-TL; Tue, 23 Jun 2020 16:45:34 +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 08E25AEB1; Tue, 23 Jun 2020 16:45:25 +0000 (UTC) From: Nicolas Saenz Julienne To: gregkh@linuxfoundation.org Subject: [PATCH 30/50] staging: vchiq: Export vchiq_msg_queue_push Date: Tue, 23 Jun 2020 18:42:16 +0200 Message-Id: <20200623164235.29566-31-nsaenzjulienne@suse.de> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20200623164235.29566-1-nsaenzjulienne@suse.de> References: <20200623164235.29566-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_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, 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 vchiq consumer drivers may need to use this function in order to get the benefits of vchiq's per service message queueing mechanism. Signed-off-by: Nicolas Saenz Julienne --- drivers/staging/vc04_services/interface/vchiq_arm/vchiq_if.h | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_if.h b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_if.h index 8fd51d885a18..c99caa3add57 100644 --- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_if.h +++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_if.h @@ -107,6 +107,7 @@ extern enum vchiq_status vchiq_use_service(unsigned int service); extern enum vchiq_status vchiq_release_service(unsigned int service); extern enum vchiq_status vchiq_queue_kernel_message(unsigned int handle, void *context, size_t size); +extern void vchiq_msg_queue_push(unsigned handle, struct vchiq_header *header); extern void vchiq_release_message(unsigned int service, struct vchiq_header *header); extern enum vchiq_status vchiq_bulk_transmit(unsigned int service, From patchwork Tue Jun 23 16:42:17 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: 11621143 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 92F02138C for ; Tue, 23 Jun 2020 17:05:21 +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 4AB2920706 for ; Tue, 23 Jun 2020 17:05:21 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="CBLDGUhY" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 4AB2920706 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=aBRPR3iHJeieYPqqnj9B71VjwdWQoHoEnrcUBtDktnc=; b=CBLDGUhYSUPE7NcvGBkqrSOmp UWqPVknqwAEQ/ARRW57Q//0rknsCaqJ2EG+uwWyNJQ5pyf+l/nm2Fo87WA7bw24P2LeilaQKA/Xsq IP2P8/5A/l8zvxW+zy2xjA0CZyOfSWUEXFrH0I9SOs4VQxtjjsVqoMXu20+kt/Azd4SNMxVrbvKOb 1M14IMRl4Nu/Ht8mWSDJZ0yuhkh1yvYISxWQzCrZrdu0SNg86rTSjDOKXwxFUV8zxB2wz++4OTpiv f/NMM7WfB1cnmXcXtT0+zNLl61LUrPa5N/Ub8RzGRjn2OmJYVWvX0pgTX/oSefp08/UFdS46KtOMI bxGbCp3sw==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jnmJ2-00067n-8F; Tue, 23 Jun 2020 17:01:56 +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 1jnm35-0005SS-GV; Tue, 23 Jun 2020 16:45:38 +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 6DD1CAEC1; Tue, 23 Jun 2020 16:45:25 +0000 (UTC) From: Nicolas Saenz Julienne To: gregkh@linuxfoundation.org Subject: [PATCH 31/50] staging: vchi: Get rid of vchiq_shim's message callback Date: Tue, 23 Jun 2020 18:42:17 +0200 Message-Id: <20200623164235.29566-32-nsaenzjulienne@suse.de> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20200623164235.29566-1-nsaenzjulienne@suse.de> References: <20200623164235.29566-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_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, 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 As vchiq_shim's callback does nothing aside from pushing messages into the service's queue, let's bypass it and jump directly to the service's callbacks, letting them choose whether to use the message queue. It turns out most services don't need to use the message queue, which makes for simpler code in the end. Signed-off-by: Nicolas Saenz Julienne --- .../bcm2835-audio/bcm2835-vchiq.c | 20 ++--- .../vc04_services/interface/vchi/vchi.h | 9 +- .../interface/vchi/vchi_common.h | 12 --- .../interface/vchiq_arm/vchiq_shim.c | 42 ++-------- .../vc04_services/vchiq-mmal/mmal-vchiq.c | 83 +++++++++---------- 5 files changed, 59 insertions(+), 107 deletions(-) delete mode 100644 drivers/staging/vc04_services/interface/vchi/vchi_common.h diff --git a/drivers/staging/vc04_services/bcm2835-audio/bcm2835-vchiq.c b/drivers/staging/vc04_services/bcm2835-audio/bcm2835-vchiq.c index 0f97eda4ec90..71750ef891dd 100644 --- a/drivers/staging/vc04_services/bcm2835-audio/bcm2835-vchiq.c +++ b/drivers/staging/vc04_services/bcm2835-audio/bcm2835-vchiq.c @@ -89,22 +89,17 @@ 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 vchiq_reason reason, - void *msg_handle) +static enum vchiq_status audio_vchi_callback(enum vchiq_reason reason, + struct vchiq_header *header, + unsigned handle, void *userdata) { - struct bcm2835_audio_instance *instance = param; - struct vchi_held_msg handle; + struct bcm2835_audio_instance *instance = vchiq_get_service_userdata(handle); struct vc_audio_msg *m; - unsigned size; - int status; if (reason != VCHIQ_MESSAGE_AVAILABLE) - return; - - status = vchi_msg_hold(instance->service, (void **)&m, &size, &handle); - if (status) - return; + return VCHIQ_SUCCESS; + m = (void *)header->data; if (m->type == VC_AUDIO_MSG_TYPE_RESULT) { instance->result = m->result.success; complete(&instance->msg_avail_comp); @@ -119,7 +114,8 @@ static void audio_vchi_callback(void *param, const enum vchiq_reason reason, dev_err(instance->dev, "unexpected callback type=%d\n", m->type); } - vchi_held_msg_release(&handle); + vchiq_release_message(handle, header); + return VCHIQ_SUCCESS; } static int diff --git a/drivers/staging/vc04_services/interface/vchi/vchi.h b/drivers/staging/vc04_services/interface/vchi/vchi.h index 789acb7999d1..fdc243f3f60a 100644 --- a/drivers/staging/vc04_services/interface/vchi/vchi.h +++ b/drivers/staging/vc04_services/interface/vchi/vchi.h @@ -4,8 +4,6 @@ #ifndef VCHI_H_ #define VCHI_H_ -#include "vchi_common.h" - /****************************************************************************** * Global defs *****************************************************************************/ @@ -31,16 +29,13 @@ struct vchi_held_msg { struct vchi_service { unsigned int handle; - - vchi_callback callback; - void *callback_param; }; // 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; - vchi_callback callback; + vchiq_callback callback; void *callback_param; }; @@ -88,7 +83,7 @@ extern int vchi_queue_kernel_message(struct vchi_service *service, 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(struct vchi_service *service, +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 vchi_held_msg *message_descriptor); diff --git a/drivers/staging/vc04_services/interface/vchi/vchi_common.h b/drivers/staging/vc04_services/interface/vchi/vchi_common.h deleted file mode 100644 index 24e8665e214a..000000000000 --- a/drivers/staging/vc04_services/interface/vchi/vchi_common.h +++ /dev/null @@ -1,12 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause */ -/* Copyright (c) 2010-2012 Broadcom. All rights reserved. */ - -#ifndef VCHI_COMMON_H_ -#define VCHI_COMMON_H_ - -//Callback used by all services / bulk transfers -typedef void (*vchi_callback)(void *callback_param, //my service local param - 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 843ee978928f..e6773cd51b44 100644 --- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_shim.c +++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_shim.c @@ -158,12 +158,12 @@ EXPORT_SYMBOL(vchi_held_msg_release); * Returns: int32_t - success == 0 * ***********************************************************/ -int32_t vchi_msg_hold(struct vchi_service *service, void **data, - uint32_t *msg_size, struct vchi_held_msg *message_handle) +int32_t vchi_msg_hold(unsigned handle, void **data, uint32_t *msg_size, + struct vchi_held_msg *message_handle) { struct vchiq_header *header; - header = vchiq_msg_hold(service->handle); + header = vchiq_msg_hold(handle); if (!header) return -ENOENT; @@ -179,7 +179,7 @@ int32_t vchi_msg_hold(struct vchi_service *service, void **data, */ message_handle->service = - (struct opaque_vchi_service_t *)(long)service->handle; + (struct opaque_vchi_service_t *)(long)handle; message_handle->message = header; return 0; @@ -253,33 +253,9 @@ EXPORT_SYMBOL(vchi_disconnect); * ***********************************************************/ -static enum vchiq_status shim_callback(enum vchiq_reason reason, - struct vchiq_header *header, - unsigned int handle, - void *bulk_user) +static struct vchi_service *service_alloc(void) { - struct vchi_service *service = - (struct vchi_service *)VCHIQ_GET_SERVICE_USERDATA(handle); - - if (reason == VCHIQ_MESSAGE_AVAILABLE) - vchiq_msg_queue_push(service->handle, header); - - service->callback(service->callback_param, reason, bulk_user); - - return VCHIQ_SUCCESS; -} - -static struct vchi_service *service_alloc(struct vchiq_instance *instance, - struct service_creation *setup) -{ - struct vchi_service *service = kzalloc(sizeof(struct vchi_service), GFP_KERNEL); - - if (service) { - service->callback = setup->callback; - service->callback_param = setup->callback_param; - } - - return service; + return kzalloc(sizeof(struct vchi_service), GFP_KERNEL); } static void service_free(struct vchi_service *service) @@ -293,15 +269,15 @@ int32_t vchi_service_open(struct vchiq_instance *instance, struct vchi_service **service) { - *service = service_alloc(instance, setup); + *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 = shim_callback; - params.userdata = *service; + params.callback = setup->callback; + params.userdata = setup->callback_param; params.version = setup->version.version; params.version_min = setup->version.version_min; diff --git a/drivers/staging/vc04_services/vchiq-mmal/mmal-vchiq.c b/drivers/staging/vc04_services/vchiq-mmal/mmal-vchiq.c index 0a33d97572ec..5ca4d5e77027 100644 --- a/drivers/staging/vc04_services/vchiq-mmal/mmal-vchiq.c +++ b/drivers/staging/vc04_services/vchiq-mmal/mmal-vchiq.c @@ -152,7 +152,7 @@ struct mmal_msg_context { struct { /* message handle to release */ - struct vchi_held_msg msg_handle; + struct vchiq_header *msg_handle; /* pointer to received message */ struct mmal_msg *msg; /* received message length */ @@ -549,54 +549,49 @@ static void bulk_abort_cb(struct vchiq_mmal_instance *instance, } /* incoming event service callback */ -static void service_callback(void *param, const enum vchiq_reason reason, - void *bulk_ctx) +static enum vchiq_status service_callback(enum vchiq_reason reason, + struct vchiq_header *header, + unsigned handle, void *bulk_ctx) { - struct vchiq_mmal_instance *instance = param; - int status; + struct vchiq_mmal_instance *instance = vchiq_get_service_userdata(handle); u32 msg_len; struct mmal_msg *msg; - struct vchi_held_msg msg_handle; struct mmal_msg_context *msg_context; if (!instance) { pr_err("Message callback passed NULL instance\n"); - return; + return VCHIQ_SUCCESS; } switch (reason) { case VCHIQ_MESSAGE_AVAILABLE: - status = vchi_msg_hold(instance->service, (void **)&msg, - &msg_len, &msg_handle); - if (status) { - pr_err("Unable to dequeue a message (%d)\n", status); - break; - } + msg = (void *)header->data; + msg_len = header->size; DBG_DUMP_MSG(msg, msg_len, "<<< reply message"); /* handling is different for buffer messages */ switch (msg->h.type) { case MMAL_MSG_TYPE_BUFFER_FROM_HOST: - vchi_held_msg_release(&msg_handle); + vchiq_release_message(handle, header); break; case MMAL_MSG_TYPE_EVENT_TO_HOST: event_to_host_cb(instance, msg, msg_len); - vchi_held_msg_release(&msg_handle); + vchiq_release_message(handle, header); break; case MMAL_MSG_TYPE_BUFFER_TO_HOST: buffer_to_host_cb(instance, msg, msg_len); - vchi_held_msg_release(&msg_handle); + vchiq_release_message(handle, header); break; default: /* messages dependent on header context to complete */ if (!msg->h.context) { pr_err("received message context was null!\n"); - vchi_held_msg_release(&msg_handle); + vchiq_release_message(handle, header); break; } @@ -605,12 +600,12 @@ static void service_callback(void *param, const enum vchiq_reason reason, if (!msg_context) { pr_err("received invalid message context %u!\n", msg->h.context); - vchi_held_msg_release(&msg_handle); + vchiq_release_message(handle, header); break; } /* fill in context values */ - msg_context->u.sync.msg_handle = msg_handle; + msg_context->u.sync.msg_handle = header; msg_context->u.sync.msg = msg; msg_context->u.sync.msg_len = msg_len; @@ -648,13 +643,15 @@ static void service_callback(void *param, const enum vchiq_reason reason, pr_err("Received unhandled message reason %d\n", reason); break; } + + return VCHIQ_SUCCESS; } static int send_synchronous_mmal_msg(struct vchiq_mmal_instance *instance, struct mmal_msg *msg, unsigned int payload_len, struct mmal_msg **msg_out, - struct vchi_held_msg *msg_handle_out) + struct vchiq_header **msg_handle) { struct mmal_msg_context *msg_context; int ret; @@ -708,7 +705,7 @@ static int send_synchronous_mmal_msg(struct vchiq_mmal_instance *instance, } *msg_out = msg_context->u.sync.msg; - *msg_handle_out = msg_context->u.sync.msg_handle; + *msg_handle = msg_context->u.sync.msg_handle; release_msg_context(msg_context); return 0; @@ -780,7 +777,7 @@ static int port_info_set(struct vchiq_mmal_instance *instance, int ret; struct mmal_msg m; struct mmal_msg *rmsg; - struct vchi_held_msg rmsg_handle; + struct vchiq_header *rmsg_handle; pr_debug("setting port info port %p\n", port); if (!port) @@ -829,7 +826,7 @@ static int port_info_set(struct vchiq_mmal_instance *instance, port->component->handle, port->handle); release_msg: - vchi_held_msg_release(&rmsg_handle); + vchiq_release_message(instance->service->handle, rmsg_handle); return ret; } @@ -841,7 +838,7 @@ static int port_info_get(struct vchiq_mmal_instance *instance, int ret; struct mmal_msg m; struct mmal_msg *rmsg; - struct vchi_held_msg rmsg_handle; + struct vchiq_header *rmsg_handle; /* port info time */ m.h.type = MMAL_MSG_TYPE_PORT_INFO_GET; @@ -924,7 +921,7 @@ static int port_info_get(struct vchiq_mmal_instance *instance, pr_debug("%s:result:%d component:0x%x port:%d\n", __func__, ret, port->component->handle, port->handle); - vchi_held_msg_release(&rmsg_handle); + vchiq_release_message(instance->service->handle, rmsg_handle); return ret; } @@ -937,7 +934,7 @@ static int create_component(struct vchiq_mmal_instance *instance, int ret; struct mmal_msg m; struct mmal_msg *rmsg; - struct vchi_held_msg rmsg_handle; + struct vchiq_header *rmsg_handle; /* build component create message */ m.h.type = MMAL_MSG_TYPE_COMPONENT_CREATE; @@ -972,7 +969,7 @@ static int create_component(struct vchiq_mmal_instance *instance, component->inputs, component->outputs, component->clocks); release_msg: - vchi_held_msg_release(&rmsg_handle); + vchiq_release_message(instance->service->handle, rmsg_handle); return ret; } @@ -984,7 +981,7 @@ static int destroy_component(struct vchiq_mmal_instance *instance, int ret; struct mmal_msg m; struct mmal_msg *rmsg; - struct vchi_held_msg rmsg_handle; + struct vchiq_header *rmsg_handle; m.h.type = MMAL_MSG_TYPE_COMPONENT_DESTROY; m.u.component_destroy.component_handle = component->handle; @@ -1005,7 +1002,7 @@ static int destroy_component(struct vchiq_mmal_instance *instance, release_msg: - vchi_held_msg_release(&rmsg_handle); + vchiq_release_message(instance->service->handle, rmsg_handle); return ret; } @@ -1017,7 +1014,7 @@ static int enable_component(struct vchiq_mmal_instance *instance, int ret; struct mmal_msg m; struct mmal_msg *rmsg; - struct vchi_held_msg rmsg_handle; + struct vchiq_header *rmsg_handle; m.h.type = MMAL_MSG_TYPE_COMPONENT_ENABLE; m.u.component_enable.component_handle = component->handle; @@ -1037,7 +1034,7 @@ static int enable_component(struct vchiq_mmal_instance *instance, ret = -rmsg->u.component_enable_reply.status; release_msg: - vchi_held_msg_release(&rmsg_handle); + vchiq_release_message(instance->service->handle, rmsg_handle); return ret; } @@ -1049,7 +1046,7 @@ static int disable_component(struct vchiq_mmal_instance *instance, int ret; struct mmal_msg m; struct mmal_msg *rmsg; - struct vchi_held_msg rmsg_handle; + struct vchiq_header *rmsg_handle; m.h.type = MMAL_MSG_TYPE_COMPONENT_DISABLE; m.u.component_disable.component_handle = component->handle; @@ -1070,7 +1067,7 @@ static int disable_component(struct vchiq_mmal_instance *instance, release_msg: - vchi_held_msg_release(&rmsg_handle); + vchiq_release_message(instance->service->handle, rmsg_handle); return ret; } @@ -1082,7 +1079,7 @@ static int get_version(struct vchiq_mmal_instance *instance, int ret; struct mmal_msg m; struct mmal_msg *rmsg; - struct vchi_held_msg rmsg_handle; + struct vchiq_header *rmsg_handle; m.h.type = MMAL_MSG_TYPE_GET_VERSION; @@ -1102,7 +1099,7 @@ static int get_version(struct vchiq_mmal_instance *instance, *minor_out = rmsg->u.version.minor; release_msg: - vchi_held_msg_release(&rmsg_handle); + vchiq_release_message(instance->service->handle, rmsg_handle); return ret; } @@ -1115,7 +1112,7 @@ static int port_action_port(struct vchiq_mmal_instance *instance, int ret; struct mmal_msg m; struct mmal_msg *rmsg; - struct vchi_held_msg rmsg_handle; + struct vchiq_header *rmsg_handle; m.h.type = MMAL_MSG_TYPE_PORT_ACTION; m.u.port_action_port.component_handle = port->component->handle; @@ -1144,7 +1141,7 @@ static int port_action_port(struct vchiq_mmal_instance *instance, port_action_type_names[action_type], action_type); release_msg: - vchi_held_msg_release(&rmsg_handle); + vchiq_release_message(instance->service->handle, rmsg_handle); return ret; } @@ -1159,7 +1156,7 @@ static int port_action_handle(struct vchiq_mmal_instance *instance, int ret; struct mmal_msg m; struct mmal_msg *rmsg; - struct vchi_held_msg rmsg_handle; + struct vchiq_header *rmsg_handle; m.h.type = MMAL_MSG_TYPE_PORT_ACTION; @@ -1192,7 +1189,7 @@ static int port_action_handle(struct vchiq_mmal_instance *instance, action_type, connect_component_handle, connect_port_handle); release_msg: - vchi_held_msg_release(&rmsg_handle); + vchiq_release_message(instance->service->handle, rmsg_handle); return ret; } @@ -1204,7 +1201,7 @@ static int port_parameter_set(struct vchiq_mmal_instance *instance, int ret; struct mmal_msg m; struct mmal_msg *rmsg; - struct vchi_held_msg rmsg_handle; + struct vchiq_header *rmsg_handle; m.h.type = MMAL_MSG_TYPE_PORT_PARAMETER_SET; @@ -1233,7 +1230,7 @@ static int port_parameter_set(struct vchiq_mmal_instance *instance, ret, port->component->handle, port->handle, parameter_id); release_msg: - vchi_held_msg_release(&rmsg_handle); + vchiq_release_message(instance->service->handle, rmsg_handle); return ret; } @@ -1245,7 +1242,7 @@ static int port_parameter_get(struct vchiq_mmal_instance *instance, int ret; struct mmal_msg m; struct mmal_msg *rmsg; - struct vchi_held_msg rmsg_handle; + struct vchiq_header *rmsg_handle; m.h.type = MMAL_MSG_TYPE_PORT_PARAMETER_GET; @@ -1292,7 +1289,7 @@ static int port_parameter_get(struct vchiq_mmal_instance *instance, ret, port->component->handle, port->handle, parameter_id); release_msg: - vchi_held_msg_release(&rmsg_handle); + vchiq_release_message(instance->service->handle, rmsg_handle); return ret; } From patchwork Tue Jun 23 16:42: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: 11621135 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 1EAC8138C for ; Tue, 23 Jun 2020 17:02:42 +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 E944820780 for ; Tue, 23 Jun 2020 17:02:41 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="nBzuN2VN" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org E944820780 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=hsBgEI7+QCF2ujvp4qWM9s1/WgAk+gqa797XtGBMdHA=; b=nBzuN2VNMX9CL0ODZKqGVqMdk rQLTMYX5Xmrv29/vh7drTrlJLS40KbrIkf/qnCfDe1gTJAulDPpex6fuzAZipRxncmIm8lmXtWr5w IAeM2hoWjGKla9o3VkXiSS6XEEigyrBo7i80Tmy1o/gZEPJfBND3U5nBkyVcfMUK52k13ygQLg2M3 Geezh1o21v+BwNCgVrOtxXrcGiHjqIkyPta4hvkDKnviY+r/AFyL9uYKhaXqwc3Y4hUiuq2z6JUhf IasNjY2CwjdczMww6FimiZ/1iwwI4EB9RAWFUgdyJR/qRNXV2ymvSls6W6T1T4v+o9Bg/6MPs7U1l gAMYKLinQ==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jnmGW-0004pF-BL; Tue, 23 Jun 2020 16:59:20 +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 1jnm35-0005Sf-Vy; Tue, 23 Jun 2020 16:45:36 +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 D84C6AEBE; Tue, 23 Jun 2020 16:45:25 +0000 (UTC) From: Nicolas Saenz Julienne To: gregkh@linuxfoundation.org Subject: [PATCH 32/50] staging: vchiq: Don't use a typedef for vchiq_callback Date: Tue, 23 Jun 2020 18:42:18 +0200 Message-Id: <20200623164235.29566-33-nsaenzjulienne@suse.de> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20200623164235.29566-1-nsaenzjulienne@suse.de> References: <20200623164235.29566-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_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, 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 Linux coding style says to avoid typdefs. Signed-off-by: Nicolas Saenz Julienne --- .../staging/vc04_services/interface/vchi/vchi.h | 5 ++++- .../vc04_services/interface/vchiq_arm/vchiq_if.h | 14 ++++++++------ 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/drivers/staging/vc04_services/interface/vchi/vchi.h b/drivers/staging/vc04_services/interface/vchi/vchi.h index fdc243f3f60a..cb66ea1ffad2 100644 --- a/drivers/staging/vc04_services/interface/vchi/vchi.h +++ b/drivers/staging/vc04_services/interface/vchi/vchi.h @@ -35,7 +35,10 @@ struct vchi_service { struct service_creation { struct vchi_version version; int32_t service_id; - vchiq_callback callback; + enum vchiq_status (*callback)(enum vchiq_reason reason, + struct vchiq_header *header, + unsigned int handle, + void *bulk_userdata); void *callback_param; }; diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_if.h b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_if.h index c99caa3add57..b3d4c14536bd 100644 --- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_if.h +++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_if.h @@ -60,19 +60,21 @@ struct vchiq_element { unsigned int size; }; -typedef enum vchiq_status (*vchiq_callback)(enum vchiq_reason, - struct vchiq_header *, - unsigned int, void *); - struct vchiq_service_base { int fourcc; - vchiq_callback callback; + enum vchiq_status (*callback)(enum vchiq_reason reason, + struct vchiq_header *header, + unsigned int handle, + void *bulk_userdata); void *userdata; }; struct vchiq_service_params { int fourcc; - vchiq_callback callback; + enum vchiq_status (*callback)(enum vchiq_reason reason, + struct vchiq_header *header, + unsigned int handle, + void *bulk_userdata); void *userdata; short version; /* Increment for non-trivial changes */ short version_min; /* Update for incompatible changes */ From patchwork Tue Jun 23 16:42:19 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: 11621137 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 91DBA138C for ; Tue, 23 Jun 2020 17:03: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 EB9A020774 for ; Tue, 23 Jun 2020 17:03:24 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="XoWeN/7B" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org EB9A020774 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=mtVKrrSqx02YHMWhKOtVuYwUj5QVKaRNYEsVZSO7jWg=; b=XoWeN/7Bst3gTTwc7bCwbkn8F mSd4dKqf/jVFRxEjvUnr9xo5q1j5kLYMD72n7EvOznBzW1kzfUC31BpPATnvjbse3QrwOyHbKC1MD /UStAVuX8cg2OVS0f9cfuI0AYSOYApln6VVexjMYiLL+3wSV9HrBlVZ0GPANsQoLOSL+4ws6KW+al zTW3fqeCMp9VMe76BrtCWxkN2wr3mnxA9AYc8VvSahqmcgbtQXal+GazN0fcn0q3j/84TxuiiQUQd OXwaR7+jAorz399GCp/LGn4q7cNfyCqY/SD6k2ob3+zPAcckYFWbLKEgDasuw4OW3SIKrxmra7vYy QorYSQnaw==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jnmHH-00057z-8M; Tue, 23 Jun 2020 17:00:07 +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 1jnm36-0005Sj-C0; Tue, 23 Jun 2020 16:45:37 +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 46F6CAECE; Tue, 23 Jun 2020 16:45:26 +0000 (UTC) From: Nicolas Saenz Julienne To: gregkh@linuxfoundation.org Subject: [PATCH 33/50] staging: vchi: Use struct vchiq_service_params Date: Tue, 23 Jun 2020 18:42:19 +0200 Message-Id: <20200623164235.29566-34-nsaenzjulienne@suse.de> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20200623164235.29566-1-nsaenzjulienne@suse.de> References: <20200623164235.29566-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_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, 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 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/vchiq-mmal/mmal-vchiq.c | 11 ++++++----- 4 files changed, 14 insertions(+), 37 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/vchiq-mmal/mmal-vchiq.c b/drivers/staging/vc04_services/vchiq-mmal/mmal-vchiq.c index 5ca4d5e77027..627e11c8f5eb 100644 --- a/drivers/staging/vc04_services/vchiq-mmal/mmal-vchiq.c +++ b/drivers/staging/vc04_services/vchiq-mmal/mmal-vchiq.c @@ -1860,11 +1860,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 @@ -1906,7 +1907,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); From patchwork Tue Jun 23 16:42:20 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: 11621127 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 23FD1138C for ; Tue, 23 Jun 2020 17:00:05 +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 9BC6E2076E for ; Tue, 23 Jun 2020 17:00:04 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="AvgskEY/"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="FlwQ0rZW" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 9BC6E2076E 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=u/pVCnj7ls5WuPMKp/AqW++rM6t8y1XB6qDTz7CBiII=; b=AvgskEY/ml1puPlOxI6Um0iIJ yAKvqZxm6nIELmm6DyvE5nBYaOid3J5UthyMX7M9flPDW6bMp/icsz/eOWY4t2PDnxPB5YFOqWTn2 LtwLt0pED8QlHfvyz5a1T630+mhxiGM0U7QEcJ8YDEFsSwGEkRlhqNWdPYnAJNlDV525yuOrQY8Q0 y69e7HUucVC5YysurJTV/QMWQrxtBh0CXlYepNyEHl0k4Hf7WG96ldat1ZnChnvyjYiHAUfX47GX6 X7z6rK09zRM6bt3Yw1TdWalLIg8gXMBdYhieKCst1vI3pRZ72v/aLFnstWBOR0vIT6tJNXj4qbPfF TdIN+BmxQ==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jnmDg-0003Kx-4f; Tue, 23 Jun 2020 16:56:24 +0000 Received: from casper.infradead.org ([90.155.50.34]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jnm3A-0005Ud-RT; Tue, 23 Jun 2020 16:45:34 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=Content-Transfer-Encoding:MIME-Version: References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To: Content-Type:Content-ID:Content-Description; bh=alTzfYPgwcbeCBVmLIMrcEG4CB1y1o0UwRs9OEXvHEI=; b=FlwQ0rZWhrF/ImVSbPTlCEg+Wm xFZrMlonfaVWD/2/GAznUjo6eEPLdqiDoTqHLGCzhHSwaETDSZmXcdYMsN2QtdoVkyEJP434I75J/ xsSgtfOgo+w1vgEgINvEWk/+9ZjDwTowuJ+JVu45H7Zn2tuG4FqDwYwzaV8rrYYFv6O6yrVZYGl+h Nl3jdKAu45pF4gL62bJ54olQw8/D4nsBX6iJXRGXEqNATnqEuAAvegHONL6U0qKr3ykaPWw3DyOPb O3UBAeCEfjFi+9a3bhXk1/rVMoqtV6MgWXOYEvlQfDN2Dk+kqniXXoUR8f0scMK3v9t+muuzMepkA MBqb8nyQ==; Received: from mx2.suse.de ([195.135.220.15]) by casper.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jnm35-0002sF-RH; Tue, 23 Jun 2020 16:45:31 +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 C1256AEE5; Tue, 23 Jun 2020 16:45:26 +0000 (UTC) From: Nicolas Saenz Julienne To: gregkh@linuxfoundation.org Subject: [PATCH 34/50] staging: vchi: Get rid of struct vchi_service Date: Tue, 23 Jun 2020 18:42:20 +0200 Message-Id: <20200623164235.29566-35-nsaenzjulienne@suse.de> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20200623164235.29566-1-nsaenzjulienne@suse.de> References: <20200623164235.29566-1-nsaenzjulienne@suse.de> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200623_174528_090674_B1516724 X-CRM114-Status: GOOD ( 19.81 ) X-Spam-Score: -4.2 (----) X-Spam-Report: SpamAssassin version 3.4.4 on casper.infradead.org summary: Content analysis details: (-4.2 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- 0.0 RCVD_IN_MSPIKE_H3 RBL: Good reputation (+3) [195.135.220.15 listed in wl.mailspike.net] -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] -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] -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, 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 The structure only contains a single parameter, which is the underlying vchiq handle. Get rid of the struct and directly pass the handle around. Signed-off-by: Nicolas Saenz Julienne --- .../bcm2835-audio/bcm2835-vchiq.c | 23 ++--- .../vc04_services/interface/vchi/vchi.h | 25 ++--- .../interface/vchiq_arm/vchiq_shim.c | 99 +++++-------------- .../vc04_services/vchiq-mmal/mmal-vchiq.c | 55 ++++++----- 4 files changed, 73 insertions(+), 129 deletions(-) diff --git a/drivers/staging/vc04_services/bcm2835-audio/bcm2835-vchiq.c b/drivers/staging/vc04_services/bcm2835-audio/bcm2835-vchiq.c index c1537a41a2fe..18309578e9a2 100644 --- a/drivers/staging/vc04_services/bcm2835-audio/bcm2835-vchiq.c +++ b/drivers/staging/vc04_services/bcm2835-audio/bcm2835-vchiq.c @@ -9,7 +9,7 @@ struct bcm2835_audio_instance { struct device *dev; - struct vchi_service *service; + unsigned service_handle; struct completion msg_avail_comp; struct mutex vchi_mutex; struct bcm2835_alsa_stream *alsa_stream; @@ -25,12 +25,12 @@ MODULE_PARM_DESC(force_bulk, "Force use of vchiq bulk for audio"); static void bcm2835_audio_lock(struct bcm2835_audio_instance *instance) { mutex_lock(&instance->vchi_mutex); - vchi_service_use(instance->service); + vchi_service_use(instance->service_handle); } static void bcm2835_audio_unlock(struct bcm2835_audio_instance *instance) { - vchi_service_release(instance->service); + vchi_service_release(instance->service_handle); mutex_unlock(&instance->vchi_mutex); } @@ -44,7 +44,7 @@ static int bcm2835_audio_send_msg_locked(struct bcm2835_audio_instance *instance init_completion(&instance->msg_avail_comp); } - status = vchi_queue_kernel_message(instance->service, + status = vchi_queue_kernel_message(instance->service_handle, m, sizeof(*m)); if (status) { dev_err(instance->dev, @@ -133,7 +133,7 @@ vc_vchi_audio_init(struct vchiq_instance *vchiq_instance, /* Open the VCHI service connections */ status = vchi_service_open(vchiq_instance, ¶ms, - &instance->service); + &instance->service_handle); if (status) { dev_err(instance->dev, @@ -143,7 +143,7 @@ vc_vchi_audio_init(struct vchiq_instance *vchiq_instance, } /* Finished with the service for now */ - vchi_service_release(instance->service); + vchi_service_release(instance->service_handle); return 0; } @@ -153,10 +153,10 @@ static void vc_vchi_audio_deinit(struct bcm2835_audio_instance *instance) int status; mutex_lock(&instance->vchi_mutex); - vchi_service_use(instance->service); + vchi_service_use(instance->service_handle); /* Close all VCHI service connections */ - status = vchi_service_close(instance->service); + status = vchi_service_close(instance->service_handle); if (status) { dev_err(instance->dev, "failed to close VCHI service connection (status=%d)\n", @@ -226,7 +226,8 @@ int bcm2835_audio_open(struct bcm2835_alsa_stream *alsa_stream) goto deinit; bcm2835_audio_lock(instance); - vchi_get_peer_version(instance->service, &instance->peer_version); + vchi_get_peer_version(instance->service_handle, + &instance->peer_version); bcm2835_audio_unlock(instance); if (instance->peer_version < 2 || force_bulk) instance->max_packet = 0; /* bulk transfer */ @@ -342,7 +343,7 @@ int bcm2835_audio_write(struct bcm2835_alsa_stream *alsa_stream, count = size; if (!instance->max_packet) { /* Send the message to the videocore */ - status = vchi_bulk_queue_transmit(instance->service, + status = vchi_bulk_queue_transmit(instance->service_handle, src, count, VCHIQ_BULK_MODE_BLOCKING, NULL); @@ -350,7 +351,7 @@ int bcm2835_audio_write(struct bcm2835_alsa_stream *alsa_stream, while (count > 0) { int bytes = min(instance->max_packet, count); - status = vchi_queue_kernel_message(instance->service, + status = vchi_queue_kernel_message(instance->service_handle, src, bytes); src += bytes; count -= bytes; diff --git a/drivers/staging/vc04_services/interface/vchi/vchi.h b/drivers/staging/vc04_services/interface/vchi/vchi.h index 4afa6e9f57c4..74fd169e079a 100644 --- a/drivers/staging/vc04_services/interface/vchi/vchi.h +++ b/drivers/staging/vc04_services/interface/vchi/vchi.h @@ -21,10 +21,6 @@ struct vchi_held_msg { void *message; }; -struct vchi_service { - unsigned int handle; -}; - // Opaque handle for a VCHIQ instance struct vchiq_instance; @@ -46,24 +42,23 @@ extern int32_t vchi_disconnect(struct vchiq_instance *instance); * Global service API *****************************************************************************/ // Routine to open a named service -extern int32_t vchi_service_open(struct vchiq_instance *instance, - struct vchiq_service_params *setup, - struct vchi_service **service); +extern int vchi_service_open(struct vchiq_instance *instance, + struct vchiq_service_params *params, + unsigned *handle); -extern int32_t vchi_get_peer_version(struct vchi_service *service, - short *peer_version); +extern int32_t vchi_get_peer_version(unsigned handle, short *peer_version); // Routine to close a named service -extern int32_t vchi_service_close(struct vchi_service *service); +extern int32_t vchi_service_close(unsigned handle); // Routine to increment ref count on a named service -extern int32_t vchi_service_use(struct vchi_service *service); +extern int32_t vchi_service_use(unsigned handle); // Routine to decrement ref count on a named service -extern int32_t vchi_service_release(struct vchi_service *service); +extern int32_t vchi_service_release(unsigned handle); /* Routine to send a message from kernel memory across a service */ -extern int vchi_queue_kernel_message(struct vchi_service *service, void *data, +extern int vchi_queue_kernel_message(unsigned handle, void *data, unsigned int size); // Routine to look at a message in place. @@ -87,14 +82,14 @@ extern int32_t vchi_held_msg_release(struct vchi_held_msg *message); *****************************************************************************/ // Routine to prepare interface for a transfer from the other side -extern int32_t vchi_bulk_queue_receive(struct vchi_service *service, +extern int32_t vchi_bulk_queue_receive(unsigned handle, void *data_dst, uint32_t data_size, enum vchiq_bulk_mode mode, void *transfer_handle); // Routine to queue up data ready for transfer to the other (once they have signalled they are ready) -extern int32_t vchi_bulk_queue_transmit(struct vchi_service *service, +extern int32_t vchi_bulk_queue_transmit(unsigned handle, const void *data_src, uint32_t data_size, enum vchiq_bulk_mode mode, 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 e76399e083f6..578346965da6 100644 --- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_shim.c +++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_shim.c @@ -10,14 +10,12 @@ #include "vchiq.h" #include "vchiq_core.h" -int vchi_queue_kernel_message(struct vchi_service *service, void *data, - unsigned int size) +int vchi_queue_kernel_message(unsigned handle, void *data, unsigned int size) { enum vchiq_status status; while (1) { - status = vchiq_queue_kernel_message(service->handle, data, - size); + status = vchiq_queue_kernel_message(handle, data, size); /* * vchiq_queue_message() may return VCHIQ_RETRY, so we need to @@ -48,15 +46,15 @@ EXPORT_SYMBOL(vchi_queue_kernel_message); * Returns: int32_t - success == 0 * ***********************************************************/ -int32_t vchi_bulk_queue_receive(struct vchi_service *service, void *data_dst, +int32_t vchi_bulk_queue_receive(unsigned handle, void *data_dst, uint32_t data_size, enum vchiq_bulk_mode mode, void *bulk_handle) { enum vchiq_status status; while (1) { - status = vchiq_bulk_receive(service->handle, data_dst, - data_size, bulk_handle, mode); + status = vchiq_bulk_receive(handle, data_dst, data_size, + bulk_handle, mode); /* * vchiq_bulk_receive() may return VCHIQ_RETRY, so we need to * implement a retry mechanism since this function is supposed @@ -86,17 +84,15 @@ EXPORT_SYMBOL(vchi_bulk_queue_receive); * Returns: int32_t - success == 0 * ***********************************************************/ -int32_t vchi_bulk_queue_transmit(struct vchi_service *service, - const void *data_src, - uint32_t data_size, - enum vchiq_bulk_mode mode, +int32_t vchi_bulk_queue_transmit(unsigned handle, const void *data_src, + uint32_t data_size, enum vchiq_bulk_mode mode, void *bulk_handle) { enum vchiq_status status; while (1) { - status = vchiq_bulk_transmit(service->handle, data_src, - data_size, bulk_handle, mode); + status = vchiq_bulk_transmit(handle, data_src, data_size, + bulk_handle, mode); /* * vchiq_bulk_transmit() may return VCHIQ_RETRY, so we need to @@ -245,7 +241,7 @@ EXPORT_SYMBOL(vchi_disconnect); * * Arguments: struct vchiq_instance *instance * struct service_creation *setup, - * struct vchi_service **service + * unsigned *handle * * Description: Routine to open a service * @@ -253,103 +249,54 @@ EXPORT_SYMBOL(vchi_disconnect); * ***********************************************************/ -static struct vchi_service *service_alloc(void) -{ - return kzalloc(sizeof(struct vchi_service), GFP_KERNEL); -} - -static void service_free(struct vchi_service *service) -{ - if (service) - kfree(service); -} - int32_t vchi_service_open(struct vchiq_instance *instance, - struct vchiq_service_params *params, - struct vchi_service **service) + struct vchiq_service_params *params, + unsigned *handle) { - - *service = service_alloc(); - if (service) { - enum vchiq_status status; - - status = vchiq_open_service(instance, params, - &((*service)->handle)); - if (status != VCHIQ_SUCCESS) { - service_free(*service); - *service = NULL; - } - } - - return *service ? 0 : -1; + return vchiq_open_service(instance, params, handle); } EXPORT_SYMBOL(vchi_service_open); -int32_t vchi_service_close(struct vchi_service *service) +int32_t vchi_service_close(unsigned handle) { - int32_t ret = -1; - - if (service) { - enum vchiq_status status = vchiq_close_service(service->handle); - if (status == VCHIQ_SUCCESS) - service_free(service); - - ret = status; - } - return ret; + return vchiq_close_service(handle); } EXPORT_SYMBOL(vchi_service_close); -int32_t vchi_get_peer_version(struct vchi_service *service, short *peer_version) +int32_t vchi_get_peer_version(unsigned handle, short *peer_version) { - int32_t ret = -1; - - if (service) { - enum vchiq_status status; - - status = vchiq_get_peer_version(service->handle, peer_version); - ret = status; - } - return ret; + return vchiq_get_peer_version(handle, peer_version); } EXPORT_SYMBOL(vchi_get_peer_version); /*********************************************************** * Name: vchi_service_use * - * Arguments: struct vchi_service *service + * Arguments: unsigned handle * * Description: Routine to increment refcount on a service * * Returns: void * ***********************************************************/ -int32_t vchi_service_use(struct vchi_service *service) +int32_t vchi_service_use(unsigned handle) { - int32_t ret = -1; - - if (service) - ret = vchiq_use_service(service->handle); - return ret; + return vchiq_use_service(handle); } EXPORT_SYMBOL(vchi_service_use); /*********************************************************** * Name: vchi_service_release * - * Arguments: struct vchi_service *service + * Arguments: unsigned handle * * Description: Routine to decrement refcount on a service * * Returns: void * ***********************************************************/ -int32_t vchi_service_release(struct vchi_service *service) +int32_t vchi_service_release(unsigned handle) { - int32_t ret = -1; - - if (service) - ret = vchiq_release_service(service->handle); - return ret; + return vchiq_release_service(handle); } EXPORT_SYMBOL(vchi_service_release); diff --git a/drivers/staging/vc04_services/vchiq-mmal/mmal-vchiq.c b/drivers/staging/vc04_services/vchiq-mmal/mmal-vchiq.c index 627e11c8f5eb..ec5827531b55 100644 --- a/drivers/staging/vc04_services/vchiq-mmal/mmal-vchiq.c +++ b/drivers/staging/vc04_services/vchiq-mmal/mmal-vchiq.c @@ -165,7 +165,7 @@ struct mmal_msg_context { }; struct vchiq_mmal_instance { - struct vchi_service *service; + unsigned service_handle; /* ensure serialised access to service */ struct mutex vchiq_mutex; @@ -294,8 +294,8 @@ static void buffer_to_host_work_cb(struct work_struct *work) /* Dummy receive to ensure the buffers remain in order */ len = 8; /* queue the bulk submission */ - vchi_service_use(instance->service); - ret = vchi_bulk_queue_receive(instance->service, + vchi_service_use(instance->service_handle); + ret = vchi_bulk_queue_receive(instance->service_handle, msg_context->u.bulk.buffer->buffer, /* Actual receive needs to be a multiple * of 4 bytes @@ -304,7 +304,7 @@ static void buffer_to_host_work_cb(struct work_struct *work) VCHIQ_BULK_MODE_CALLBACK, msg_context); - vchi_service_release(instance->service); + vchi_service_release(instance->service_handle); if (ret != 0) pr_err("%s: ctx: %p, vchi_bulk_queue_receive failed %d\n", @@ -383,7 +383,7 @@ buffer_from_host(struct vchiq_mmal_instance *instance, if (!port->enabled) return -EINVAL; - pr_debug("instance:%p buffer:%p\n", instance->service, buf); + pr_debug("instance:%u buffer:%p\n", instance->service_handle, buf); /* get context */ if (!buf->msg_context) { @@ -438,14 +438,14 @@ buffer_from_host(struct vchiq_mmal_instance *instance, /* no payload in message */ m.u.buffer_from_host.payload_in_message = 0; - vchi_service_use(instance->service); + vchi_service_use(instance->service_handle); - ret = vchi_queue_kernel_message(instance->service, + ret = vchi_queue_kernel_message(instance->service_handle, &m, sizeof(struct mmal_msg_header) + sizeof(m.u.buffer_from_host)); - vchi_service_release(instance->service); + vchi_service_release(instance->service_handle); return ret; } @@ -679,14 +679,14 @@ static int send_synchronous_mmal_msg(struct vchiq_mmal_instance *instance, DBG_DUMP_MSG(msg, (sizeof(struct mmal_msg_header) + payload_len), ">>> sync message"); - vchi_service_use(instance->service); + vchi_service_use(instance->service_handle); - ret = vchi_queue_kernel_message(instance->service, + ret = vchi_queue_kernel_message(instance->service_handle, msg, sizeof(struct mmal_msg_header) + payload_len); - vchi_service_release(instance->service); + vchi_service_release(instance->service_handle); if (ret) { pr_err("error %d queuing message\n", ret); @@ -826,7 +826,7 @@ static int port_info_set(struct vchiq_mmal_instance *instance, port->component->handle, port->handle); release_msg: - vchiq_release_message(instance->service->handle, rmsg_handle); + vchiq_release_message(instance->service_handle, rmsg_handle); return ret; } @@ -921,7 +921,7 @@ static int port_info_get(struct vchiq_mmal_instance *instance, pr_debug("%s:result:%d component:0x%x port:%d\n", __func__, ret, port->component->handle, port->handle); - vchiq_release_message(instance->service->handle, rmsg_handle); + vchiq_release_message(instance->service_handle, rmsg_handle); return ret; } @@ -969,7 +969,7 @@ static int create_component(struct vchiq_mmal_instance *instance, component->inputs, component->outputs, component->clocks); release_msg: - vchiq_release_message(instance->service->handle, rmsg_handle); + vchiq_release_message(instance->service_handle, rmsg_handle); return ret; } @@ -1002,7 +1002,7 @@ static int destroy_component(struct vchiq_mmal_instance *instance, release_msg: - vchiq_release_message(instance->service->handle, rmsg_handle); + vchiq_release_message(instance->service_handle, rmsg_handle); return ret; } @@ -1034,7 +1034,7 @@ static int enable_component(struct vchiq_mmal_instance *instance, ret = -rmsg->u.component_enable_reply.status; release_msg: - vchiq_release_message(instance->service->handle, rmsg_handle); + vchiq_release_message(instance->service_handle, rmsg_handle); return ret; } @@ -1067,7 +1067,7 @@ static int disable_component(struct vchiq_mmal_instance *instance, release_msg: - vchiq_release_message(instance->service->handle, rmsg_handle); + vchiq_release_message(instance->service_handle, rmsg_handle); return ret; } @@ -1099,7 +1099,7 @@ static int get_version(struct vchiq_mmal_instance *instance, *minor_out = rmsg->u.version.minor; release_msg: - vchiq_release_message(instance->service->handle, rmsg_handle); + vchiq_release_message(instance->service_handle, rmsg_handle); return ret; } @@ -1141,7 +1141,7 @@ static int port_action_port(struct vchiq_mmal_instance *instance, port_action_type_names[action_type], action_type); release_msg: - vchiq_release_message(instance->service->handle, rmsg_handle); + vchiq_release_message(instance->service_handle, rmsg_handle); return ret; } @@ -1189,7 +1189,7 @@ static int port_action_handle(struct vchiq_mmal_instance *instance, action_type, connect_component_handle, connect_port_handle); release_msg: - vchiq_release_message(instance->service->handle, rmsg_handle); + vchiq_release_message(instance->service_handle, rmsg_handle); return ret; } @@ -1230,7 +1230,7 @@ static int port_parameter_set(struct vchiq_mmal_instance *instance, ret, port->component->handle, port->handle, parameter_id); release_msg: - vchiq_release_message(instance->service->handle, rmsg_handle); + vchiq_release_message(instance->service_handle, rmsg_handle); return ret; } @@ -1289,7 +1289,7 @@ static int port_parameter_get(struct vchiq_mmal_instance *instance, ret, port->component->handle, port->handle, parameter_id); release_msg: - vchiq_release_message(instance->service->handle, rmsg_handle); + vchiq_release_message(instance->service_handle, rmsg_handle); return ret; } @@ -1834,9 +1834,9 @@ int vchiq_mmal_finalise(struct vchiq_mmal_instance *instance) if (mutex_lock_interruptible(&instance->vchiq_mutex)) return -EINTR; - vchi_service_use(instance->service); + vchi_service_use(instance->service_handle); - status = vchi_service_close(instance->service); + status = vchi_service_close(instance->service_handle); if (status != 0) pr_err("mmal-vchiq: VCHIQ close failed\n"); @@ -1914,21 +1914,22 @@ int vchiq_mmal_init(struct vchiq_mmal_instance **out_instance) if (!instance->bulk_wq) goto err_free; - status = vchi_service_open(vchiq_instance, ¶ms, &instance->service); + status = vchi_service_open(vchiq_instance, ¶ms, + &instance->service_handle); if (status) { pr_err("Failed to open VCHI service connection (status=%d)\n", status); goto err_close_services; } - vchi_service_release(instance->service); + vchi_service_release(instance->service_handle); *out_instance = instance; return 0; err_close_services: - vchi_service_close(instance->service); + vchi_service_close(instance->service_handle); destroy_workqueue(instance->bulk_wq); err_free: vfree(instance->bulk_scratch); From patchwork Tue Jun 23 16:42:21 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: 11621141 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 E205B618 for ; Tue, 23 Jun 2020 17:05:00 +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 91DBC20774 for ; Tue, 23 Jun 2020 17:05:00 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="Fouq0T/0" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 91DBC20774 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=RmzwmuTmW9isCJkbZ6vmecXGmLSgq01d6nHqM+Cyb6w=; b=Fouq0T/06gKm19hjrXiQi0GAB R7GGN8k3mhCnNv8QZYUn7Zt7fGdOLEx8vds6rGzLO80XugeE/CUHQ6bPzSbK8KubZaiPqjn/8jAcW CTRJr8Wed/WtMKCckTlqYtzz85+uolrLnMzC+aV2huERoRo5IMLNW0D09M3apVs+UJPNqlgznohnE 4g3TyTLjhFgeFmBPTsOw1vudsY/22tQcbCIXoHJX1ZzDZFSaZ20PQgvkTZwP5RZrAA+f2ucX7FXjU NyV0eevkBo8ZORaURdX4CsLZ2TMnaiWMqI2Py2VHNN2hG4MMEi3vwR36QFeIUmxyrwolywhBifx5L zhiMoj8tw==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jnmJB-0006DX-Vb; Tue, 23 Jun 2020 17:02:06 +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 1jnm37-0005T1-9u; Tue, 23 Jun 2020 16:45:38 +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 4D154B07B; Tue, 23 Jun 2020 16:45:27 +0000 (UTC) From: Nicolas Saenz Julienne To: gregkh@linuxfoundation.org Subject: [PATCH 35/50] staging: vchiq: Pass vchiq's message when holding a message Date: Tue, 23 Jun 2020 18:42:21 +0200 Message-Id: <20200623164235.29566-36-nsaenzjulienne@suse.de> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20200623164235.29566-1-nsaenzjulienne@suse.de> References: <20200623164235.29566-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_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, 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 vchi created an opaque structure to be held by services while they process callback messages. The contents of this opaque structure are the service handle, which all services already maintain, and a pointer to vchiq's message structure, struct vchiq_header. Let's get rid of this opaque structure and directly pass struct vchiq_header, which is what ultimately vchiq consumes when handling callback messages. Signed-off-by: Nicolas Saenz Julienne --- .../vc04_services/interface/vchi/vchi.h | 14 ++--------- .../interface/vchiq_arm/vchiq_shim.c | 25 ++++++------------- 2 files changed, 9 insertions(+), 30 deletions(-) diff --git a/drivers/staging/vc04_services/interface/vchi/vchi.h b/drivers/staging/vc04_services/interface/vchi/vchi.h index 74fd169e079a..72771fdee9d6 100644 --- a/drivers/staging/vc04_services/interface/vchi/vchi.h +++ b/drivers/staging/vc04_services/interface/vchi/vchi.h @@ -11,16 +11,6 @@ // Macros to manipulate 'FOURCC' values #define MAKE_FOURCC(x) ((int32_t)((x[0] << 24) | (x[1] << 16) | (x[2] << 8) | x[3])) -// Opaque service information -struct opaque_vchi_service_t; - -// Descriptor for a held message. Allocated by client, initialised by vchi_msg_hold, -// vchi_msg_iter_hold or vchi_msg_iter_hold_next. Fields are for internal VCHI use only. -struct vchi_held_msg { - struct opaque_vchi_service_t *service; - void *message; -}; - // Opaque handle for a VCHIQ instance struct vchiq_instance; @@ -67,7 +57,7 @@ extern int vchi_queue_kernel_message(unsigned handle, void *data, 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 vchi_held_msg *message_descriptor); + struct vchiq_header **message); /******************************************************************************* * Global service support API - operations on held messages @@ -75,7 +65,7 @@ extern int32_t vchi_msg_hold(unsigned handle, ******************************************************************************/ // Routine to release a held message after it has been processed -extern int32_t vchi_held_msg_release(struct vchi_held_msg *message); +extern int32_t vchi_held_msg_release(unsigned handle, struct vchiq_header *message); /****************************************************************************** * Global bulk API 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 578346965da6..6eb9a9878641 100644 --- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_shim.c +++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_shim.c @@ -113,7 +113,8 @@ EXPORT_SYMBOL(vchi_bulk_queue_transmit); /*********************************************************** * Name: vchi_held_msg_release * - * Arguments: struct vchi_held_msg *message + * Arguments: unsgined handle + * struct vchiq_header *message * * Description: Routine to release a held message (after it has been read with * vchi_msg_hold) @@ -121,7 +122,7 @@ EXPORT_SYMBOL(vchi_bulk_queue_transmit); * Returns: int32_t - success == 0 * ***********************************************************/ -int32_t vchi_held_msg_release(struct vchi_held_msg *message) +int32_t vchi_held_msg_release(unsigned handle, struct vchiq_header *message) { /* * Convert the service field pointer back to an @@ -131,8 +132,7 @@ int32_t vchi_held_msg_release(struct vchi_held_msg *message) * to a pointer. */ - vchiq_release_message((unsigned int)(long)message->service, - (struct vchiq_header *)message->message); + vchiq_release_message(handle, message); return 0; } @@ -144,7 +144,7 @@ EXPORT_SYMBOL(vchi_held_msg_release); * Arguments: struct vchi_service *service, * void **data, * uint32_t *msg_size, - * struct vchi_held_msg *message_handle + * struct vchiq_header **message * * Description: Routine to return a pointer to the current message (to allow * in place processing). The message is dequeued - don't forget @@ -155,7 +155,7 @@ EXPORT_SYMBOL(vchi_held_msg_release); * ***********************************************************/ int32_t vchi_msg_hold(unsigned handle, void **data, uint32_t *msg_size, - struct vchi_held_msg *message_handle) + struct vchiq_header **message) { struct vchiq_header *header; @@ -165,18 +165,7 @@ int32_t vchi_msg_hold(unsigned handle, void **data, uint32_t *msg_size, *data = header->data; *msg_size = header->size; - - /* - * upcast the unsigned int which is an int - * to a pointer and stuff it in the held message. - * This pointer is opaque to everything except - * vchi_held_msg_release which simply downcasts it back - * to an int. - */ - - message_handle->service = - (struct opaque_vchi_service_t *)(long)handle; - message_handle->message = header; + *message = header; return 0; } From patchwork Tue Jun 23 16:42:22 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: 11621145 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 CC33B6C1 for ; Tue, 23 Jun 2020 17:05:31 +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 A463320706 for ; Tue, 23 Jun 2020 17:05:31 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="u1eNHMqZ" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org A463320706 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=PWA6ksPxWcunHNhhfB1ZXKMczrv0rzC+JBxr+4sbRXc=; b=u1eNHMqZkkU6yxIi1HTm7Xe1a kk3AYaegPFbFBeoBfm6oFUA8XK4mhhaggHZA8iY9YdTEIXorboUF748CdpD6tDNodZc5gmtBMho+x zjrhxrrNSuxdXAc9m1wxs+BpSFHSlmLRUnNAK/bp39SXkJ8Onw4jrge6qObFa2mn/pid3Qy6WaF80 RXmWQLSJY9xzhSV3XNwsXMyZzKJNUWZpjpqLungUmHIKqk8rqG+WwgGaPDOO0p/nygIJY1yjt4Ody U96UO39t43lDCMbzSS9lPm0LKtqbdV+nqe1QYBXcxFoMDcnrxvaZAAIvGtSJwnCCi9vE6cIjaPZzV 9oyzjimfQ==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jnmJk-0006XH-Ol; Tue, 23 Jun 2020 17:02:40 +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 1jnm38-0005TK-FA; Tue, 23 Jun 2020 16:45:38 +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 4E9CEAEDD; Tue, 23 Jun 2020 16:45:28 +0000 (UTC) From: Nicolas Saenz Julienne To: gregkh@linuxfoundation.org Subject: [PATCH 36/50] staging: vchi: Rework vchi_msg_hold() to match vchiq_msg_hold() Date: Tue, 23 Jun 2020 18:42:22 +0200 Message-Id: <20200623164235.29566-37-nsaenzjulienne@suse.de> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20200623164235.29566-1-nsaenzjulienne@suse.de> References: <20200623164235.29566-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_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, 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 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 ++------------- 2 files changed, 3 insertions(+), 17 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); From patchwork Tue Jun 23 16:42:23 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: 11621133 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 6B047618 for ; Tue, 23 Jun 2020 17:02:01 +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 26E8F206EB for ; Tue, 23 Jun 2020 17:02:01 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="ZJ1CS/WI"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="cUsOEgF8" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 26E8F206EB 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=ULJGNF+WQSlahvnhTjujNr2iWDg/cbNgJd6R0g9inQQ=; b=ZJ1CS/WIl43WJVuqRNJLWcReq QR/7RhUNZyIABs1l9xP/qa50MSyW8beWdouXcJVw0IVjDl5iejSPBLpv2JqdO42SFjImpUtK8cZaX G91XbtDHxWELV4K/2TATAt5N0bjiOTWHOLs76GC+qgq8gT0hEncfcTvrNs8NSBD+l8G/W3uYa+sD3 +gozNQKXpEqLpRxGpTAsLZ/IGzxD1FXOR4BE9KhVuzQjBeof5xGEn6IWLfiqBkyfEQ6+7hGvxBoEl UyrhiQFkDERcopy325MiB7NwIxlfeO/v74ZovkKXWB4kgB7dPFF0HclfBPhLU8jMjA/yUH+vJcjug j9g2wuPnA==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jnmG2-0004af-Am; Tue, 23 Jun 2020 16:58:50 +0000 Received: from casper.infradead.org ([90.155.50.34]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jnm3E-0005Ud-WF; Tue, 23 Jun 2020 16:45:37 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=Content-Transfer-Encoding:MIME-Version: References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To: Content-Type:Content-ID:Content-Description; bh=ug37VNOJ8jYqocJfcRbWdaoKTnaHTgobDccW7pVI5BQ=; b=cUsOEgF8P5VRQIyZXf4WOY1XuZ w8cqSkSjmE1JgDj15ILURbsaHPPbM/xmxTaI/t67UtSDSa5U+5+Ieaw9r64u3z0gj8xgHwsHoeWwJ fConEIx0GFlkfdQDZNfVwyrLlB9v/rtUu31CQpqeM/T/ea8KCF0NAU89InlPHuGd0ifOLG+TvjPt1 nozYUwWSg5XYTXQR+mlBHDXxXTBgNqEcrKEcDyp1pvXzfQFXOfOV+VL+tK5cXaw5GK76+gKMXgWRW iFQ3C0DZgjVZPkTpmJa7iWtr0IW3sfmHgY545PY4gLUeaOQcnLBe7w7YmckaV1DvFIfWMdmYcYCFO VyiDii4Q==; Received: from mx2.suse.de ([195.135.220.15]) by casper.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jnm38-0002ss-16; Tue, 23 Jun 2020 16:45:32 +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 E49C5B080; Tue, 23 Jun 2020 16:45:28 +0000 (UTC) From: Nicolas Saenz Julienne To: gregkh@linuxfoundation.org Subject: [PATCH 37/50] staging: vchiq: Unify fourcc definition mechanisms Date: Tue, 23 Jun 2020 18:42:23 +0200 Message-Id: <20200623164235.29566-38-nsaenzjulienne@suse.de> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20200623164235.29566-1-nsaenzjulienne@suse.de> References: <20200623164235.29566-1-nsaenzjulienne@suse.de> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200623_174530_197894_255550FD X-CRM114-Status: GOOD ( 11.50 ) X-Spam-Score: -4.2 (----) X-Spam-Report: SpamAssassin version 3.4.4 on casper.infradead.org summary: Content analysis details: (-4.2 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- 0.0 RCVD_IN_MSPIKE_H3 RBL: Good reputation (+3) [195.135.220.15 listed in wl.mailspike.net] -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] -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] -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, 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 There is already enough duplication with regard to fourcc generation in the kernel. Let's at least use the same macro all over the vchiq ecosystem. Signed-off-by: Nicolas Saenz Julienne --- drivers/staging/vc04_services/bcm2835-audio/bcm2835-vchiq.c | 2 +- .../vc04_services/bcm2835-audio/vc_vchi_audioserv_defs.h | 5 ++--- drivers/staging/vc04_services/interface/vchi/vchi.h | 3 --- drivers/staging/vc04_services/vchiq-mmal/mmal-msg.h | 1 - drivers/staging/vc04_services/vchiq-mmal/mmal-vchiq.c | 2 +- 5 files changed, 4 insertions(+), 9 deletions(-) diff --git a/drivers/staging/vc04_services/bcm2835-audio/bcm2835-vchiq.c b/drivers/staging/vc04_services/bcm2835-audio/bcm2835-vchiq.c index 18309578e9a2..55f1e684eef1 100644 --- a/drivers/staging/vc04_services/bcm2835-audio/bcm2835-vchiq.c +++ b/drivers/staging/vc04_services/bcm2835-audio/bcm2835-vchiq.c @@ -125,7 +125,7 @@ vc_vchi_audio_init(struct vchiq_instance *vchiq_instance, struct vchiq_service_params params = { .version = VC_AUDIOSERV_VER, .version_min = VC_AUDIOSERV_MIN_VER, - .fourcc = VC_AUDIO_SERVER_NAME, + .fourcc = VCHIQ_MAKE_FOURCC('A', 'U', 'D', 'S'), .callback = audio_vchi_callback, .userdata = instance, }; diff --git a/drivers/staging/vc04_services/bcm2835-audio/vc_vchi_audioserv_defs.h b/drivers/staging/vc04_services/bcm2835-audio/vc_vchi_audioserv_defs.h index d6401e914ac9..b4fa239c5ebe 100644 --- a/drivers/staging/vc04_services/bcm2835-audio/vc_vchi_audioserv_defs.h +++ b/drivers/staging/vc04_services/bcm2835-audio/vc_vchi_audioserv_defs.h @@ -8,9 +8,8 @@ #define VC_AUDIOSERV_VER 2 /* FourCC codes used for VCHI communication */ -#define VC_AUDIO_SERVER_NAME MAKE_FOURCC("AUDS") -#define VC_AUDIO_WRITE_COOKIE1 MAKE_FOURCC("BCMA") -#define VC_AUDIO_WRITE_COOKIE2 MAKE_FOURCC("DATA") +#define VC_AUDIO_WRITE_COOKIE1 VCHIQ_MAKE_FOURCC('B', 'C', 'M', 'A') +#define VC_AUDIO_WRITE_COOKIE2 VCHIQ_MAKE_FOURCC('D', 'A', 'T', 'A') /* * List of screens that are currently supported diff --git a/drivers/staging/vc04_services/interface/vchi/vchi.h b/drivers/staging/vc04_services/interface/vchi/vchi.h index 59559d4cd5f1..7108c254a38a 100644 --- a/drivers/staging/vc04_services/interface/vchi/vchi.h +++ b/drivers/staging/vc04_services/interface/vchi/vchi.h @@ -8,9 +8,6 @@ * Global defs *****************************************************************************/ -// Macros to manipulate 'FOURCC' values -#define MAKE_FOURCC(x) ((int32_t)((x[0] << 24) | (x[1] << 16) | (x[2] << 8) | x[3])) - // Opaque handle for a VCHIQ instance struct vchiq_instance; diff --git a/drivers/staging/vc04_services/vchiq-mmal/mmal-msg.h b/drivers/staging/vc04_services/vchiq-mmal/mmal-msg.h index 91f9b400d8dc..b636e889c8a1 100644 --- a/drivers/staging/vc04_services/vchiq-mmal/mmal-msg.h +++ b/drivers/staging/vc04_services/vchiq-mmal/mmal-msg.h @@ -28,7 +28,6 @@ #define VC_MMAL_VER 15 #define VC_MMAL_MIN_VER 10 -#define VC_MMAL_SERVER_NAME MAKE_FOURCC("mmal") /* max total message size is 512 bytes */ #define MMAL_MSG_MAX_SIZE 512 diff --git a/drivers/staging/vc04_services/vchiq-mmal/mmal-vchiq.c b/drivers/staging/vc04_services/vchiq-mmal/mmal-vchiq.c index ec5827531b55..09eef9e6fb9a 100644 --- a/drivers/staging/vc04_services/vchiq-mmal/mmal-vchiq.c +++ b/drivers/staging/vc04_services/vchiq-mmal/mmal-vchiq.c @@ -1863,7 +1863,7 @@ int vchiq_mmal_init(struct vchiq_mmal_instance **out_instance) struct vchiq_service_params params = { .version = VC_MMAL_VER, .version_min = VC_MMAL_MIN_VER, - .fourcc = VC_MMAL_SERVER_NAME, + .fourcc = VCHIQ_MAKE_FOURCC('m', 'm', 'a', 'l'), .callback = service_callback, .userdata = NULL, }; From patchwork Tue Jun 23 16:42:24 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: 11621151 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 EDBC1618 for ; Tue, 23 Jun 2020 17:06:54 +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 C599520706 for ; Tue, 23 Jun 2020 17:06:54 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="fkG2yKWo" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org C599520706 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=vK0Xqxy2l/DnX93Z7f1G+C1h5/sLVtN2xq0lx9CohOg=; b=fkG2yKWofekWBCsa1fJB8z5hO xUS3sg+YYFiTIbzsbsXJvvxG4vqLuNEpw1qwUzUoGTyoCEOVQcTjrEWjcAOzftPOsBGF2WeUw9kLx bqJ6D/7KuTN6iMVO3+zt3/trvrBQ9aIp92Tzttyp4wJdiLp9ZYXtf3A+ZeepZZBYgJoBlWaEI9haS aHtt2mXWnNPENL0K8HYq/0uXMn1TaZTm+2lNSCGiH8/KOr/j5l2Oertel130Riv0Wxb10vDTgBPtH RpFBKoQ7b+Hi942gvwb7R39W2yWhxqU5mRu5Zc2a9Op/hNVf0YARJH+srb5owhTa3rNZeXHhL4r2G FRVRQ14ow==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jnmLI-0007QQ-De; Tue, 23 Jun 2020 17:04:16 +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 1jnm39-0005Tp-Jw; Tue, 23 Jun 2020 16:45:40 +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 5762CB090; Tue, 23 Jun 2020 16:45:29 +0000 (UTC) From: Nicolas Saenz Julienne To: gregkh@linuxfoundation.org Subject: [PATCH 38/50] staging: vchi: Get rid of struct vchiq_instance forward declaration Date: Tue, 23 Jun 2020 18:42:24 +0200 Message-Id: <20200623164235.29566-39-nsaenzjulienne@suse.de> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20200623164235.29566-1-nsaenzjulienne@suse.de> References: <20200623164235.29566-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_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, 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 It's already forward declared in vchiq_if.h. So no need to insist Signed-off-by: Nicolas Saenz Julienne --- drivers/staging/vc04_services/interface/vchi/vchi.h | 7 ------- 1 file changed, 7 deletions(-) diff --git a/drivers/staging/vc04_services/interface/vchi/vchi.h b/drivers/staging/vc04_services/interface/vchi/vchi.h index 7108c254a38a..d24e7027c08f 100644 --- a/drivers/staging/vc04_services/interface/vchi/vchi.h +++ b/drivers/staging/vc04_services/interface/vchi/vchi.h @@ -4,13 +4,6 @@ #ifndef VCHI_H_ #define VCHI_H_ -/****************************************************************************** - * Global defs - *****************************************************************************/ - -// Opaque handle for a VCHIQ instance -struct vchiq_instance; - /****************************************************************************** * Global funcs - implementation is specific to which side you are on * (local / remote) From patchwork Tue Jun 23 16:42:25 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: 11621149 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 37DEB161F for ; Tue, 23 Jun 2020 17:06:36 +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 F031720706 for ; Tue, 23 Jun 2020 17:06:35 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="Kk0UrF9C" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org F031720706 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=FdxE+cqZAZHwpp0J4ImrEp0T4l1Y8vFBa9QHq2tBSxg=; b=Kk0UrF9Cch9FvPqA/X+yA2Pg9 pMi+aX2uD2WPjSVWiLc3H9tfyUznKaApVdxnvy5HbGVVArp9gggjXZ+0SaI1iSfv7AlY3sxhMtede u8SsnQ/JPuq5CjRnl5q92rYD3U1b5tPsbP57RYdg+dhnGqNVV8k49n47ogOKlFShUp2r6YK+Xnc2/ 0Y11ckjxyf9WE13kSVXy+m8QCmlvJdHClMJNLM/kwb5hF292XYIJCnbBhxQU5vKeamMaKB+j2jQLE XmeWVw0Ez7eAEq4SqTnVn787h5G5d4tRMcwO95t2nIlaNC0zjM9szIpktE0ZmAUhmrlVA7l03jcna /8n/Jro8A==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jnmKw-0007KS-Bs; Tue, 23 Jun 2020 17:03:54 +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 1jnm3A-0005Tv-2o; Tue, 23 Jun 2020 16:45:40 +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 C927CAECB; Tue, 23 Jun 2020 16:45:29 +0000 (UTC) From: Nicolas Saenz Julienne To: gregkh@linuxfoundation.org Subject: [PATCH 39/50] staging: vchi: Don't include vchiq_core.h Date: Tue, 23 Jun 2020 18:42:25 +0200 Message-Id: <20200623164235.29566-40-nsaenzjulienne@suse.de> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20200623164235.29566-1-nsaenzjulienne@suse.de> References: <20200623164235.29566-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_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, 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 This file is internal to vchiq. Signed-off-by: Nicolas Saenz Julienne --- drivers/staging/vc04_services/interface/vchiq_arm/vchiq_shim.c | 1 - 1 file changed, 1 deletion(-) 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 fc12b76617d1..52654123463d 100644 --- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_shim.c +++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_shim.c @@ -8,7 +8,6 @@ #include "vchiq_if.h" #include "../vchi/vchi.h" #include "vchiq.h" -#include "vchiq_core.h" int vchi_queue_kernel_message(unsigned handle, void *data, unsigned int size) { From patchwork Tue Jun 23 16:42:26 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: 11621155 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 38719618 for ; Tue, 23 Jun 2020 17:08:06 +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 1109020706 for ; Tue, 23 Jun 2020 17:08:06 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="i6pMgE/p" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 1109020706 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=LrQ/zrBF9GMyw/ljFsFdIsHWUpM06CT/yYYadaGnnNA=; b=i6pMgE/pi7IX27gqbL+0C2hiA mHupydPzg/ItQtZs7X0uDkONDVrvt7ZiEcKArPM2vKM1dcLeMdFElW6lTnobc0FJxNWYn7MTD7VaG N40w9ZTEkkpdRTvnyuvEg+5sBU/i65J6bSzJ+iePi/Zwg5lyBEOQPRTLGsabjFQau/4Pw8AO+9MSw bgZvm+pGp8QlKdaQaJYjqIFI09IdpVAoyCTRfWI2HOnRRCHEXxMvZYMavQTTK1DBZ0+dX8JsZACP5 IMD/gu1+rIYdH7AuMIn9MJF3REGpElTv1bKtpE2wDwXi+5DWfOtD/Utu2DXggbUxRWwlJJrjdQdrX y3AERWuzg==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jnmMS-00089j-Aw; Tue, 23 Jun 2020 17:05:28 +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 1jnm3A-0005UJ-Ks; Tue, 23 Jun 2020 16:45:41 +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 A41F0AED2; Tue, 23 Jun 2020 16:45:30 +0000 (UTC) From: Nicolas Saenz Julienne To: gregkh@linuxfoundation.org Subject: [PATCH 40/50] staging: vchiq: Get rid of unnecessary definitions in vchiq_if.h Date: Tue, 23 Jun 2020 18:42:26 +0200 Message-Id: <20200623164235.29566-41-nsaenzjulienne@suse.de> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20200623164235.29566-1-nsaenzjulienne@suse.de> References: <20200623164235.29566-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_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, 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 Those functions don't actually exist, nor have any use, nor the macros. Signed-off-by: Nicolas Saenz Julienne --- .../interface/vchiq_arm/vchiq_if.h | 17 ----------------- 1 file changed, 17 deletions(-) diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_if.h b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_if.h index b3d4c14536bd..407e7dc31108 100644 --- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_if.h +++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_if.h @@ -8,11 +8,9 @@ #define VCHIQ_SLOT_SIZE 4096 #define VCHIQ_MAX_MSG_SIZE (VCHIQ_SLOT_SIZE - sizeof(struct vchiq_header)) -#define VCHIQ_CHANNEL_SIZE VCHIQ_MAX_MSG_SIZE /* For backwards compatibility */ #define VCHIQ_MAKE_FOURCC(x0, x1, x2, x3) \ (((x0) << 24) | ((x1) << 16) | ((x2) << 8) | (x3)) -#define VCHIQ_GET_SERVICE_USERDATA(service) vchiq_get_service_userdata(service) enum vchiq_reason { VCHIQ_SERVICE_OPENED, /* service, -, - */ @@ -92,7 +90,6 @@ struct vchiq_config { }; struct vchiq_instance; -typedef void (*vchiq_remote_callback)(void *cb_arg); extern enum vchiq_status vchiq_initialise(struct vchiq_instance **pinstance); extern enum vchiq_status vchiq_shutdown(struct vchiq_instance *instance); @@ -118,25 +115,11 @@ extern enum vchiq_status vchiq_bulk_transmit(unsigned int service, extern enum vchiq_status vchiq_bulk_receive(unsigned int service, void *data, unsigned int size, void *userdata, enum vchiq_bulk_mode mode); -extern enum vchiq_status vchiq_bulk_transmit_handle(unsigned int service, - const void *offset, unsigned int size, - void *userdata, enum vchiq_bulk_mode mode); -extern enum vchiq_status vchiq_bulk_receive_handle(unsigned int service, - void *offset, unsigned int size, void *userdata, - enum vchiq_bulk_mode mode); extern int vchiq_get_client_id(unsigned int service); extern void *vchiq_get_service_userdata(unsigned int service); extern void vchiq_get_config(struct vchiq_config *config); extern enum vchiq_status vchiq_set_service_option(unsigned int service, enum vchiq_service_option option, int value); - -extern enum vchiq_status vchiq_remote_use(struct vchiq_instance *instance, - vchiq_remote_callback callback, void *cb_arg); -extern enum vchiq_status vchiq_remote_release(struct vchiq_instance *instance); - -extern enum vchiq_status vchiq_dump_phys_mem(unsigned int service, - void *ptr, size_t num_bytes); - extern enum vchiq_status vchiq_get_peer_version(unsigned int handle, short *peer_version); extern void vchiq_msg_queue_push(unsigned handle, struct vchiq_header *header); From patchwork Tue Jun 23 16:42:27 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: 11621139 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 75FA5618 for ; Tue, 23 Jun 2020 17:04:30 +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 4F2C220774 for ; Tue, 23 Jun 2020 17:04:30 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="T1eW5QpI"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="Flcbawo9" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 4F2C220774 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=cLHJMGNZhJBwWrCQISeK0M+gU+ffOE0Z2tcx1u3siEA=; b=T1eW5QpIj/WZqkXXFpL4exKuh Fo9Bfr5Kaijsd0sB6V3+usv6AQF6pVK2iphgfYbQgcd1Y8szK+TFkpvobqNmrNrbUwKS/zkkXwVZT DwbswWcndGkrXC3tDTJ58Oc6o74gKQ1EnvwtgK1PNQ6TU1czglqi2UkA2EoQ293Ste2uEUNNqe2Mx yezbPg4Afsx8b3lVvRn8aJUwXZZuF5jwf57USNhO2FU0yD0ASCPJvxxPfzmiTEeXGDcE87sRnGeYU Ysv0wakEQa0HGN0w1nKKN2iMduVxLQgZyUQrxH1RAAwTRchruVrKJUBjuggzbBknpfdYCmBwxvCLY /h9uyXLGQ==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jnmIP-0005kl-Gc; Tue, 23 Jun 2020 17:01:18 +0000 Received: from casper.infradead.org ([90.155.50.34]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jnm3G-0005Ud-7v; Tue, 23 Jun 2020 16:45:38 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=Content-Transfer-Encoding:MIME-Version: References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To: Content-Type:Content-ID:Content-Description; bh=DPZmmzP0tPyXObnm+OxQh28C+kktshtPq46fvEyovFo=; b=Flcbawo9tu5s61cqGx81VPK45G HtHQ7LXTwa2q0N/Gdk8L1ibx74W9YWQLYMjYDOIQR/oP2I+88GlvsqZdVzG+2UgEMxTO+PjBf8hNL b494pRcoWehbKHF2fTbELleGNisDf4nyBXal/XCLgQDbEk5T1Agkz/w0A5DC+q6icXySpg2+uwxH1 sc3Q5SelgbLwSzf1iEsakGmuNpf72zjx5AJN1JSltLlHGOK//95Pb2vGSS4z3aUxip4unQcijMNY6 hJOeqJ+ADGSlNX4Mr0P6ZpdieAVHLyjjZaYD22Ag6NY1azMKz7AQSOLqH0mBW/DzT0ejFwsgC7wXf clzNek4g==; Received: from mx2.suse.de ([195.135.220.15]) by casper.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jnm3A-0002tD-IW; Tue, 23 Jun 2020 16:45:34 +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 6A06DAEE5; Tue, 23 Jun 2020 16:45:31 +0000 (UTC) From: Nicolas Saenz Julienne To: gregkh@linuxfoundation.org Subject: [PATCH 41/50] staging: vchiq: Make vchiq_add_service() local Date: Tue, 23 Jun 2020 18:42:27 +0200 Message-Id: <20200623164235.29566-42-nsaenzjulienne@suse.de> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20200623164235.29566-1-nsaenzjulienne@suse.de> References: <20200623164235.29566-1-nsaenzjulienne@suse.de> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200623_174532_770360_193ABA71 X-CRM114-Status: UNSURE ( 8.42 ) X-CRM114-Notice: Please train this message. X-Spam-Score: -4.2 (----) X-Spam-Report: SpamAssassin version 3.4.4 on casper.infradead.org summary: Content analysis details: (-4.2 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- 0.0 RCVD_IN_MSPIKE_H3 RBL: Good reputation (+3) [195.135.220.15 listed in wl.mailspike.net] -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] -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] -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, 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 The function is being exported although there is no use for it outside of vchiq's core code. Keep it local then. Signed-off-by: Nicolas Saenz Julienne --- drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c | 3 +-- drivers/staging/vc04_services/interface/vchiq_arm/vchiq_if.h | 3 --- 2 files changed, 1 insertion(+), 5 deletions(-) diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c index 96c6205368ab..41b069275b9b 100644 --- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c +++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c @@ -270,7 +270,7 @@ enum vchiq_status vchiq_connect(struct vchiq_instance *instance) } EXPORT_SYMBOL(vchiq_connect); -enum vchiq_status vchiq_add_service( +static enum vchiq_status vchiq_add_service( struct vchiq_instance *instance, const struct vchiq_service_params *params, unsigned int *phandle) @@ -307,7 +307,6 @@ enum vchiq_status vchiq_add_service( return status; } -EXPORT_SYMBOL(vchiq_add_service); enum vchiq_status vchiq_open_service( struct vchiq_instance *instance, diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_if.h b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_if.h index 407e7dc31108..b852980447dc 100644 --- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_if.h +++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_if.h @@ -94,9 +94,6 @@ struct vchiq_instance; extern enum vchiq_status vchiq_initialise(struct vchiq_instance **pinstance); extern enum vchiq_status vchiq_shutdown(struct vchiq_instance *instance); extern enum vchiq_status vchiq_connect(struct vchiq_instance *instance); -extern enum vchiq_status vchiq_add_service(struct vchiq_instance *instance, - const struct vchiq_service_params *params, - unsigned int *pservice); extern enum vchiq_status vchiq_open_service(struct vchiq_instance *instance, const struct vchiq_service_params *params, unsigned int *pservice); From patchwork Tue Jun 23 16:42:28 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: 11621159 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 634DB60D for ; Tue, 23 Jun 2020 17:08:38 +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 3BB8D20780 for ; Tue, 23 Jun 2020 17:08:38 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="etXzQTVA"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="vqMElCEZ" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 3BB8D20780 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=tmW5xBTzoFT+uUmMUkOYaZHRVyIz7D9dsl5xe3jZBNw=; b=etXzQTVAuEwTNBop9Ev5gM8n0 1PXhdfNSJNNq4wkjxGReE3LoRIJg0XeHEdAVkerbGM9+qF1rhZlnrqdimN+0Mg0Y8cJjRYdVS7A0N SknTKIKNDhmfq0GbEVhklPmIuhAwWXZpzddEHvlWuplonPXRvVpcdslt6FJxs+XXdCxNr1HtX3I2Q kfX/17H2ZVVq1Eiy4Mu10Odh00ovqICFGJ7tigifNzNJWS1dR5DfrvJZCPSDkfmu8Yv8By3Fo4XxM rc0yKY+pJb6yc52ZfKWiAm4QUWLA4jGFieDRzzc3Bi3s85mWfMFFZmwCR7Okvoy5cgKVf+Dft5Vi8 4USpAuWXw==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jnmMx-00005V-1S; Tue, 23 Jun 2020 17:05:59 +0000 Received: from casper.infradead.org ([90.155.50.34]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jnm3K-0005YO-DG; Tue, 23 Jun 2020 16:45:42 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=Content-Transfer-Encoding:MIME-Version: References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To: Content-Type:Content-ID:Content-Description; bh=ZFmHBe5NmogZKw2kjGtjddaOKiyeYdwE64toDIPcPJU=; b=vqMElCEZ4BBjv+FT1GBnpmzlIR qyqpqI3b07aIPq5YTRllI/RupKDF50EPiJVC8rOob/CkGpKlqlj1zw0aZg1t/0oNzTZ4gtKuEKRT+ SNeDKC99p23oizu7SjWNkVKANFMTXf9JeMwUJi0s+qBkAIqtnEQ1hH/qMbg9NQ1DA3jKfz4qvBIDt c3zzejeQAeaHqu9Ezq6Wbnv+OCFmduk/rKAdwteFMfvwY/Uad19lKguLdhWsOre/TpazY3aCZW/pw PCUAgHzAHZFdY4Ck4aJpM7aOnJQesxJA44ONrE8GrW9/7lskXb99RRX9C84ydxpHHuYbMff5hxpAu 48/XNzEA==; Received: from mx2.suse.de ([195.135.220.15]) by casper.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jnm3A-0002tH-U7; Tue, 23 Jun 2020 16:45:36 +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 CF9D6AEF3; Tue, 23 Jun 2020 16:45:31 +0000 (UTC) From: Nicolas Saenz Julienne To: gregkh@linuxfoundation.org Subject: [PATCH 42/50] staging: vchiq: Move definitions only used by core into core header Date: Tue, 23 Jun 2020 18:42:28 +0200 Message-Id: <20200623164235.29566-43-nsaenzjulienne@suse.de> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20200623164235.29566-1-nsaenzjulienne@suse.de> References: <20200623164235.29566-1-nsaenzjulienne@suse.de> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200623_174533_128547_58E714A2 X-CRM114-Status: GOOD ( 11.69 ) X-Spam-Score: -4.2 (----) X-Spam-Report: SpamAssassin version 3.4.4 on casper.infradead.org summary: Content analysis details: (-4.2 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- 0.0 RCVD_IN_MSPIKE_H3 RBL: Good reputation (+3) [195.135.220.15 listed in wl.mailspike.net] -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] -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] -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, 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 vchiq_if.h is used by service consumers and only the exported API should be present. Move the rest of definitions, which were not exported by the way, to vchiq_core.h where they belong. Signed-off-by: Nicolas Saenz Julienne --- .../interface/vchiq_arm/vchiq_core.h | 22 +++++++++++++++++++ .../interface/vchiq_arm/vchiq_if.h | 16 -------------- 2 files changed, 22 insertions(+), 16 deletions(-) diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.h b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.h index b97b661bea1c..ff91c04ba6b9 100644 --- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.h +++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.h @@ -486,6 +486,18 @@ struct bulk_waiter { int actual; }; +struct vchiq_config { + unsigned int max_msg_size; + unsigned int bulk_threshold; /* The message size above which it + is better to use a bulk transfer + (<= max_msg_size) */ + unsigned int max_outstanding_bulks; + unsigned int max_services; + short version; /* The version of VCHIQ */ + short version_min; /* The minimum compatible version of VCHIQ */ +}; + + extern spinlock_t bulk_waiter_spinlock; extern int vchiq_core_log_level; @@ -665,4 +677,14 @@ extern void vchiq_log_dump_mem(const char *label, uint32_t addr, const void *voidMem, size_t numBytes); +extern enum vchiq_status vchiq_remove_service(unsigned int service); + +extern int vchiq_get_client_id(unsigned int service); + +extern void vchiq_get_config(struct vchiq_config *config); + +extern enum vchiq_status +vchiq_set_service_option(unsigned int service, enum vchiq_service_option option, + int value); + #endif diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_if.h b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_if.h index b852980447dc..931debcd6492 100644 --- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_if.h +++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_if.h @@ -78,17 +78,6 @@ struct vchiq_service_params { short version_min; /* Update for incompatible changes */ }; -struct vchiq_config { - unsigned int max_msg_size; - unsigned int bulk_threshold; /* The message size above which it - is better to use a bulk transfer - (<= max_msg_size) */ - unsigned int max_outstanding_bulks; - unsigned int max_services; - short version; /* The version of VCHIQ */ - short version_min; /* The minimum compatible version of VCHIQ */ -}; - struct vchiq_instance; extern enum vchiq_status vchiq_initialise(struct vchiq_instance **pinstance); @@ -98,7 +87,6 @@ extern enum vchiq_status vchiq_open_service(struct vchiq_instance *instance, const struct vchiq_service_params *params, unsigned int *pservice); extern enum vchiq_status vchiq_close_service(unsigned int service); -extern enum vchiq_status vchiq_remove_service(unsigned int service); extern enum vchiq_status vchiq_use_service(unsigned int service); extern enum vchiq_status vchiq_release_service(unsigned int service); extern enum vchiq_status vchiq_queue_kernel_message(unsigned int handle, @@ -112,11 +100,7 @@ extern enum vchiq_status vchiq_bulk_transmit(unsigned int service, extern enum vchiq_status vchiq_bulk_receive(unsigned int service, void *data, unsigned int size, void *userdata, enum vchiq_bulk_mode mode); -extern int vchiq_get_client_id(unsigned int service); extern void *vchiq_get_service_userdata(unsigned int service); -extern void vchiq_get_config(struct vchiq_config *config); -extern enum vchiq_status vchiq_set_service_option(unsigned int service, - enum vchiq_service_option option, int value); extern enum vchiq_status vchiq_get_peer_version(unsigned int handle, short *peer_version); extern void vchiq_msg_queue_push(unsigned handle, struct vchiq_header *header); From patchwork Tue Jun 23 16:42:29 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: 11621153 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 12C4260D for ; Tue, 23 Jun 2020 17:07: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 E030320780 for ; Tue, 23 Jun 2020 17:07:24 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="UI7PSrgg"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="MS2NBFFc" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org E030320780 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=qldtR6HAyYQwyu18zZmqDZ/XnpObIggTwZcUZPJ3bbQ=; b=UI7PSrggpFqgTX3BytCCB3GOv 2NsxDbfUeXWQa1S6RVtB18dSL5IbtHD82ar0nh0wRENG5qdrZ5I7qskQ0crnwDBz2S2IEvd/uQk69 6k00T+eY13lLGqZLeoPronz7UF/v5GpIQGBjfJL8+sUo3OR1TfkFFI5KkyLJRBsp9CKGmjdpavej/ KL6FVEOI4PaQQ5QZoL3itaRRXRLB9KPuk+omWXEFrzmxA4dLx+6vwhgyCVXSYplB3WHtyUNcy4LEc x2CpnkAZ241pMUi7EAfFO+igrV7EB2r8RABaqpdOOUW5W8MetA/TwUfLBrvME3oqlmNO3ec1FqIr4 h+oEgLcTw==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jnmLh-0007kG-Lj; Tue, 23 Jun 2020 17:04:41 +0000 Received: from casper.infradead.org ([90.155.50.34]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jnm3J-0005Ud-DJ; Tue, 23 Jun 2020 16:45:41 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=Content-Transfer-Encoding:MIME-Version: References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To: Content-Type:Content-ID:Content-Description; bh=QzPXaLxUqCJqOrhKxXw9BuK6RgKu7WI8G00w0bqOBBA=; b=MS2NBFFcqoPflNatMT7NSzns+x RgSQPmramJQGLPXWDeN5DmN2goLEA9lhMm/5eyxqCpH6Dt6Qzhyiil2pXyUxybw4WmI71w8SBuoQP cYLYvq//1ximAFvv0wjT1GEaT8eCjGaitnNqmwqOay2wTXKOCAOin3y6ZrkBN5aHafqJWKAjocywB C5Vssg7SYI8bWmT1AQczal0hJGC02ODKDamIvMEBGV70TEAYnvvrLGUTy22x2i4rcRwzmqXSy/s10 q9XZucCONvA2Ka3XTsduarOSK4Ew/4+47wck+Jzsw/ky+BVW3/Q1AC3yxI+ozB83w6oE6jzrOsWnd Fey1AYuA==; Received: from mx2.suse.de ([195.135.220.15]) by casper.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jnm3B-0002tY-An; Tue, 23 Jun 2020 16:45:37 +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 43638B03F; Tue, 23 Jun 2020 16:45:32 +0000 (UTC) From: Nicolas Saenz Julienne To: gregkh@linuxfoundation.org Subject: [PATCH 43/50] staging: vchi: Get rid of vchi_bulk_queue_receive() Date: Tue, 23 Jun 2020 18:42:29 +0200 Message-Id: <20200623164235.29566-44-nsaenzjulienne@suse.de> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20200623164235.29566-1-nsaenzjulienne@suse.de> References: <20200623164235.29566-1-nsaenzjulienne@suse.de> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200623_174533_477500_F7E83C71 X-CRM114-Status: GOOD ( 16.56 ) X-Spam-Score: -4.2 (----) X-Spam-Report: SpamAssassin version 3.4.4 on casper.infradead.org summary: Content analysis details: (-4.2 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- 0.0 RCVD_IN_MSPIKE_H3 RBL: Good reputation (+3) [195.135.220.15 listed in wl.mailspike.net] -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] -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] -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, 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 Its vchiq counterpart, vchiq_bulk_receive() is only used by vchi. We can then merge both functions by moving vchi_bulk_queue_receive()'s retry mechanism into vchiq_bulk_receive() and let services call the later. Signed-off-by: Nicolas Saenz Julienne --- .../vc04_services/interface/vchi/vchi.h | 7 ---- .../interface/vchiq_arm/vchiq_arm.c | 42 ++++++++++++------- .../interface/vchiq_arm/vchiq_shim.c | 38 ----------------- .../vc04_services/vchiq-mmal/mmal-vchiq.c | 20 ++++----- 4 files changed, 37 insertions(+), 70 deletions(-) diff --git a/drivers/staging/vc04_services/interface/vchi/vchi.h b/drivers/staging/vc04_services/interface/vchi/vchi.h index d24e7027c08f..ca20b99122f2 100644 --- a/drivers/staging/vc04_services/interface/vchi/vchi.h +++ b/drivers/staging/vc04_services/interface/vchi/vchi.h @@ -58,13 +58,6 @@ extern int32_t vchi_held_msg_release(unsigned handle, struct vchiq_header *messa * Global bulk API *****************************************************************************/ -// Routine to prepare interface for a transfer from the other side -extern int32_t vchi_bulk_queue_receive(unsigned handle, - void *data_dst, - uint32_t data_size, - enum vchiq_bulk_mode mode, - void *transfer_handle); - // Routine to queue up data ready for transfer to the other (once they have signalled they are ready) extern int32_t vchi_bulk_queue_transmit(unsigned handle, const void *data_src, diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c index 41b069275b9b..50294930ed27 100644 --- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c +++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c @@ -373,24 +373,36 @@ vchiq_bulk_transmit(unsigned int handle, const void *data, } EXPORT_SYMBOL(vchiq_bulk_transmit); -enum vchiq_status -vchiq_bulk_receive(unsigned int handle, void *data, - unsigned int size, void *userdata, enum vchiq_bulk_mode mode) +enum vchiq_status vchiq_bulk_receive(unsigned int handle, void *data, + unsigned int size, void *userdata, + enum vchiq_bulk_mode mode) { enum vchiq_status status; - switch (mode) { - case VCHIQ_BULK_MODE_NOCALLBACK: - case VCHIQ_BULK_MODE_CALLBACK: - status = vchiq_bulk_transfer(handle, data, size, userdata, - mode, VCHIQ_BULK_RECEIVE); - break; - case VCHIQ_BULK_MODE_BLOCKING: - status = vchiq_blocking_bulk_transfer(handle, - (void *)data, size, VCHIQ_BULK_RECEIVE); - break; - default: - return VCHIQ_ERROR; + while (1) { + switch (mode) { + case VCHIQ_BULK_MODE_NOCALLBACK: + case VCHIQ_BULK_MODE_CALLBACK: + status = vchiq_bulk_transfer(handle, data, size, userdata, + mode, VCHIQ_BULK_RECEIVE); + break; + case VCHIQ_BULK_MODE_BLOCKING: + status = vchiq_blocking_bulk_transfer(handle, + (void *)data, size, VCHIQ_BULK_RECEIVE); + break; + default: + return VCHIQ_ERROR; + } + + /* + * vchiq_*_bulk_transfer() may return VCHIQ_RETRY, so we need + * to implement a retry mechanism since this function is + * supposed to block until queued + */ + if (status != VCHIQ_RETRY) + break; + + msleep(1); } return status; 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 52654123463d..f69936a9eb29 100644 --- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_shim.c +++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_shim.c @@ -31,44 +31,6 @@ int vchi_queue_kernel_message(unsigned handle, void *data, unsigned int size) } EXPORT_SYMBOL(vchi_queue_kernel_message); -/*********************************************************** - * Name: vchi_bulk_queue_receive - * - * Arguments: VCHI_BULK_HANDLE_T handle, - * void *data_dst, - * const uint32_t data_size, - * enum vchi_flags flags - * void *bulk_handle - * - * Description: Routine to setup a rcv buffer - * - * Returns: int32_t - success == 0 - * - ***********************************************************/ -int32_t vchi_bulk_queue_receive(unsigned handle, void *data_dst, - uint32_t data_size, enum vchiq_bulk_mode mode, - void *bulk_handle) -{ - enum vchiq_status status; - - while (1) { - status = vchiq_bulk_receive(handle, data_dst, data_size, - bulk_handle, mode); - /* - * vchiq_bulk_receive() may return VCHIQ_RETRY, so we need to - * implement a retry mechanism since this function is supposed - * to block until queued - */ - if (status != VCHIQ_RETRY) - break; - - msleep(1); - } - - return status; -} -EXPORT_SYMBOL(vchi_bulk_queue_receive); - /*********************************************************** * Name: vchi_bulk_queue_transmit * diff --git a/drivers/staging/vc04_services/vchiq-mmal/mmal-vchiq.c b/drivers/staging/vc04_services/vchiq-mmal/mmal-vchiq.c index 09eef9e6fb9a..34a1627754f3 100644 --- a/drivers/staging/vc04_services/vchiq-mmal/mmal-vchiq.c +++ b/drivers/staging/vc04_services/vchiq-mmal/mmal-vchiq.c @@ -279,7 +279,7 @@ static void buffer_work_cb(struct work_struct *work) * VCHI will allow up to 4 bulk receives to be scheduled before blocking. * If we block in the service_callback context then we can't process the * VCHI_CALLBACK_BULK_RECEIVED message that would otherwise allow the blocked - * vchi_bulk_queue_receive() call to complete. + * vchiq_bulk_receive() call to complete. */ static void buffer_to_host_work_cb(struct work_struct *work) { @@ -295,19 +295,19 @@ static void buffer_to_host_work_cb(struct work_struct *work) len = 8; /* queue the bulk submission */ vchi_service_use(instance->service_handle); - ret = vchi_bulk_queue_receive(instance->service_handle, - msg_context->u.bulk.buffer->buffer, - /* Actual receive needs to be a multiple - * of 4 bytes - */ - (len + 3) & ~3, - VCHIQ_BULK_MODE_CALLBACK, - msg_context); + ret = vchiq_bulk_receive(instance->service_handle, + msg_context->u.bulk.buffer->buffer, + /* Actual receive needs to be a multiple + * of 4 bytes + */ + (len + 3) & ~3, + msg_context, + VCHIQ_BULK_MODE_CALLBACK); vchi_service_release(instance->service_handle); if (ret != 0) - pr_err("%s: ctx: %p, vchi_bulk_queue_receive failed %d\n", + pr_err("%s: ctx: %p, vchiq_bulk_receive failed %d\n", __func__, msg_context, ret); } From patchwork Tue Jun 23 16:42:30 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: 11621147 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 4B436161F for ; Tue, 23 Jun 2020 17:06:33 +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 14CBD20706 for ; Tue, 23 Jun 2020 17:06:33 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="yJfxUM3a"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="csg21Vo4" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 14CBD20706 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=gn2Y0sMbLIo/ccarc0pNZC+O0w/yLqlJI1ZJ1CLZUjo=; b=yJfxUM3a7VGHmY1KbOgxGJyah wppOQlRSrrvjvYCvGNHslrwUXRvGENy/HJA01J6xpVjsZN484s80B5HceYc6afNA8+kEwcWcjTRA5 6eFq7Re8iRrBj4YpMjfY6Tm8v794+bfEMfgOII/j9Z+8s2gG5AP51soEgdWj7b/u4omWNOqJmS6U2 Iy1j9MTbSmURNMrOS/+FFNux5EWQYwDakW6bEg4keNq9zeYqJmjwjEQhekZcxHCyao9KylP2dffaL WhP+Ra3mw7vHe0XpWEeVSkxNKsKO+3cv9M33yXbs/r6OIcV8N1J1C0brXTV7R7Mpy8nVXeE8o2fzh ztQgW8WqA==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jnmKn-0007CN-R8; Tue, 23 Jun 2020 17:03:46 +0000 Received: from casper.infradead.org ([90.155.50.34]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jnm3I-0005Ud-BB; Tue, 23 Jun 2020 16:45:40 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=Content-Transfer-Encoding:MIME-Version: References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To: Content-Type:Content-ID:Content-Description; bh=+MKqRmxNbZ8ZALOfDcmb3CtVhMRcjXLvZKnBZAp6kOg=; b=csg21Vo4JTQtE4oB2qzOqnZkGl qRKlXqNEaER4MrPzCrG7BrGw+O9P7X1pn4VUyFkoLpLKZsMF2PoqegY5jOo1WzbCdtfchP+jS5wYx nm5DL/RfoXdROCL1KX7ykW5if+myTuxBqe2GCd3mqPCQvV8Z9/FU137zVb9O90ruAzXNKHegYH4df tMIX+0E05KXfaqRFY2KNsOeBgOG0tUdAFqODjOpBtMPURUwi5gb2x8g0wjNrnuVDu483YhGmy78iE z7Gp1iutDXUkNllIhzRlei0twZyrLNqps4/y66npVwVAbiCbp+iKibJhyuQMka7gMxQx6YwKRQUVb uAD2QPkQ==; Received: from mx2.suse.de ([195.135.220.15]) by casper.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jnm3B-0002ts-NO; Tue, 23 Jun 2020 16:45:38 +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 AB915B049; Tue, 23 Jun 2020 16:45:32 +0000 (UTC) From: Nicolas Saenz Julienne To: gregkh@linuxfoundation.org Subject: [PATCH 44/50] staging: vchi: Get rid of vchi_bulk_queue_transmit() Date: Tue, 23 Jun 2020 18:42:30 +0200 Message-Id: <20200623164235.29566-45-nsaenzjulienne@suse.de> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20200623164235.29566-1-nsaenzjulienne@suse.de> References: <20200623164235.29566-1-nsaenzjulienne@suse.de> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200623_174533_896275_814B59B3 X-CRM114-Status: GOOD ( 18.87 ) X-Spam-Score: -4.2 (----) X-Spam-Report: SpamAssassin version 3.4.4 on casper.infradead.org summary: Content analysis details: (-4.2 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- 0.0 RCVD_IN_MSPIKE_H3 RBL: Good reputation (+3) [195.135.220.15 listed in wl.mailspike.net] -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] -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] -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, 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 Its vchiq counterpart, vchiq_bulk_transmit() is only used by vchi. We can then merge both functions by moving vchi_bulk_queue_transmit()'s retry mechanism into vchiq_bulk_transmit() and let services call the later. Signed-off-by: Nicolas Saenz Julienne --- .../bcm2835-audio/bcm2835-vchiq.c | 7 +- .../vc04_services/interface/vchi/vchi.h | 11 ---- .../interface/vchiq_arm/vchiq_arm.c | 38 +++++++---- .../interface/vchiq_arm/vchiq_shim.c | 66 ++++--------------- 4 files changed, 41 insertions(+), 81 deletions(-) diff --git a/drivers/staging/vc04_services/bcm2835-audio/bcm2835-vchiq.c b/drivers/staging/vc04_services/bcm2835-audio/bcm2835-vchiq.c index 55f1e684eef1..28d64bc895cd 100644 --- a/drivers/staging/vc04_services/bcm2835-audio/bcm2835-vchiq.c +++ b/drivers/staging/vc04_services/bcm2835-audio/bcm2835-vchiq.c @@ -343,10 +343,9 @@ int bcm2835_audio_write(struct bcm2835_alsa_stream *alsa_stream, count = size; if (!instance->max_packet) { /* Send the message to the videocore */ - status = vchi_bulk_queue_transmit(instance->service_handle, - src, count, - VCHIQ_BULK_MODE_BLOCKING, - NULL); + status = vchiq_bulk_transmit(instance->service_handle, src, + count, NULL, + VCHIQ_BULK_MODE_BLOCKING); } else { while (count > 0) { int bytes = min(instance->max_packet, count); diff --git a/drivers/staging/vc04_services/interface/vchi/vchi.h b/drivers/staging/vc04_services/interface/vchi/vchi.h index ca20b99122f2..c800796f9986 100644 --- a/drivers/staging/vc04_services/interface/vchi/vchi.h +++ b/drivers/staging/vc04_services/interface/vchi/vchi.h @@ -54,17 +54,6 @@ struct vchiq_header *vchi_msg_hold(unsigned handle); // Routine to release a held message after it has been processed extern int32_t vchi_held_msg_release(unsigned handle, struct vchiq_header *message); -/****************************************************************************** - * Global bulk API - *****************************************************************************/ - -// Routine to queue up data ready for transfer to the other (once they have signalled they are ready) -extern int32_t vchi_bulk_queue_transmit(unsigned handle, - const void *data_src, - uint32_t data_size, - enum vchiq_bulk_mode mode, - void *transfer_handle); - /****************************************************************************** * Configuration plumbing *****************************************************************************/ diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c index 50294930ed27..d25d1031ed96 100644 --- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c +++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c @@ -354,19 +354,31 @@ vchiq_bulk_transmit(unsigned int handle, const void *data, { enum vchiq_status status; - switch (mode) { - case VCHIQ_BULK_MODE_NOCALLBACK: - case VCHIQ_BULK_MODE_CALLBACK: - status = vchiq_bulk_transfer(handle, (void *)data, size, - userdata, mode, - VCHIQ_BULK_TRANSMIT); - break; - case VCHIQ_BULK_MODE_BLOCKING: - status = vchiq_blocking_bulk_transfer(handle, - (void *)data, size, VCHIQ_BULK_TRANSMIT); - break; - default: - return VCHIQ_ERROR; + while (1) { + switch (mode) { + case VCHIQ_BULK_MODE_NOCALLBACK: + case VCHIQ_BULK_MODE_CALLBACK: + status = vchiq_bulk_transfer(handle, (void *)data, size, + userdata, mode, + VCHIQ_BULK_TRANSMIT); + break; + case VCHIQ_BULK_MODE_BLOCKING: + status = vchiq_blocking_bulk_transfer(handle, + (void *)data, size, VCHIQ_BULK_TRANSMIT); + break; + default: + return VCHIQ_ERROR; + } + + /* + * vchiq_*_bulk_transfer() may return VCHIQ_RETRY, so we need + * to implement a retry mechanism since this function is + * supposed to block until queued + */ + if (status != VCHIQ_RETRY) + break; + + msleep(1); } return status; 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 f69936a9eb29..33493643b5f8 100644 --- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_shim.c +++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_shim.c @@ -31,46 +31,6 @@ int vchi_queue_kernel_message(unsigned handle, void *data, unsigned int size) } EXPORT_SYMBOL(vchi_queue_kernel_message); -/*********************************************************** - * Name: vchi_bulk_queue_transmit - * - * Arguments: VCHI_BULK_HANDLE_T handle, - * const void *data_src, - * uint32_t data_size, - * enum vchi_flags flags, - * void *bulk_handle - * - * Description: Routine to transmit some data - * - * Returns: int32_t - success == 0 - * - ***********************************************************/ -int32_t vchi_bulk_queue_transmit(unsigned handle, const void *data_src, - uint32_t data_size, enum vchiq_bulk_mode mode, - void *bulk_handle) -{ - enum vchiq_status status; - - while (1) { - status = vchiq_bulk_transmit(handle, data_src, data_size, - bulk_handle, mode); - - /* - * vchiq_bulk_transmit() may return VCHIQ_RETRY, so we need to - * implement a retry mechanism since this function is supposed - * to block until queued - */ - if (status != VCHIQ_RETRY) - break; - - msleep(1); - } - - return status; -} -EXPORT_SYMBOL(vchi_bulk_queue_transmit); - - /*********************************************************** * Name: vchi_held_msg_release * @@ -80,10 +40,10 @@ EXPORT_SYMBOL(vchi_bulk_queue_transmit); * Description: Routine to release a held message (after it has been read with * vchi_msg_hold) * - * Returns: int32_t - success == 0 + * Returns: int - success == 0 * ***********************************************************/ -int32_t vchi_held_msg_release(unsigned handle, struct vchiq_header *message) +int vchi_held_msg_release(unsigned handle, struct vchiq_header *message) { /* * Convert the service field pointer back to an @@ -104,7 +64,7 @@ EXPORT_SYMBOL(vchi_held_msg_release); * * Arguments: struct vchi_service *service, * void **data, - * uint32_t *msg_size, + * unsigned *msg_size, * struct vchiq_header **message * * Description: Routine to return a pointer to the current message (to allow @@ -112,7 +72,7 @@ EXPORT_SYMBOL(vchi_held_msg_release); * to release the message using vchi_held_msg_release when you're * finished. * - * Returns: int32_t - success == 0 + * Returns: int - success == 0 * ***********************************************************/ struct vchiq_header *vchi_msg_hold(unsigned handle) @@ -134,7 +94,7 @@ EXPORT_SYMBOL(vchi_msg_hold); * ***********************************************************/ -int32_t vchi_initialise(struct vchiq_instance **instance) +int vchi_initialise(struct vchiq_instance **instance) { return vchiq_initialise(instance); } @@ -151,7 +111,7 @@ EXPORT_SYMBOL(vchi_initialise); * Returns: 0 if successful, failure otherwise * ***********************************************************/ -int32_t vchi_connect(struct vchiq_instance *instance) +int vchi_connect(struct vchiq_instance *instance) { return vchiq_connect(instance); } @@ -168,7 +128,7 @@ EXPORT_SYMBOL(vchi_connect); * Returns: 0 if successful, failure otherwise * ***********************************************************/ -int32_t vchi_disconnect(struct vchiq_instance *instance) +int vchi_disconnect(struct vchiq_instance *instance) { return vchiq_shutdown(instance); } @@ -184,11 +144,11 @@ EXPORT_SYMBOL(vchi_disconnect); * * Description: Routine to open a service * - * Returns: int32_t - success == 0 + * Returns: int - success == 0 * ***********************************************************/ -int32_t vchi_service_open(struct vchiq_instance *instance, +int vchi_service_open(struct vchiq_instance *instance, struct vchiq_service_params *params, unsigned *handle) { @@ -196,13 +156,13 @@ int32_t vchi_service_open(struct vchiq_instance *instance, } EXPORT_SYMBOL(vchi_service_open); -int32_t vchi_service_close(unsigned handle) +int vchi_service_close(unsigned handle) { return vchiq_close_service(handle); } EXPORT_SYMBOL(vchi_service_close); -int32_t vchi_get_peer_version(unsigned handle, short *peer_version) +int vchi_get_peer_version(unsigned handle, short *peer_version) { return vchiq_get_peer_version(handle, peer_version); } @@ -218,7 +178,7 @@ EXPORT_SYMBOL(vchi_get_peer_version); * Returns: void * ***********************************************************/ -int32_t vchi_service_use(unsigned handle) +int vchi_service_use(unsigned handle) { return vchiq_use_service(handle); } @@ -234,7 +194,7 @@ EXPORT_SYMBOL(vchi_service_use); * Returns: void * ***********************************************************/ -int32_t vchi_service_release(unsigned handle) +int vchi_service_release(unsigned handle) { return vchiq_release_service(handle); } From patchwork Tue Jun 23 16:42:31 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: 11621157 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 31CA160D for ; Tue, 23 Jun 2020 17:08:07 +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 071A320706 for ; Tue, 23 Jun 2020 17:08:07 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="kDP0dfJs"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="KyAifUVQ" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 071A320706 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=Sv4B0Z3jyvHzwud+1aN7LeQxS8QyGXYG+UYrK7EH+EY=; b=kDP0dfJs24fSH0WmmcivualXV d6wB2Gca9T/DbvHAkRMHd4n9wKAhlCSZn3XCv0dH7036MVeAa5e+wEBEPsCAZ+C84IBPDkiDZVbA7 TVlmVoHgqtOsrbTtdegfRHEqBednUHRrwNYS+7BYli+JUhMDg/PHDKgWI35k5dKl7vPxaItbPGYss Zm8hUFwF7x/8Lr/KtfyhTVWOa0k8BcPtI1958p/hki5a/p++BYXq4y6DL+WDQBG+0U78dZhkY2mdU +8q9+5Svv1vL2m4XhWSXoEmGUuxmhQvb/ro43StWrdBuh8OD6lIrm3Y9xyiFnu7DF7HHFuH0L4add 1NjzW0Dig==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jnmMh-0008IN-Tw; Tue, 23 Jun 2020 17:05:43 +0000 Received: from casper.infradead.org ([90.155.50.34]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jnm3J-0005YV-GY; Tue, 23 Jun 2020 16:45:41 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=Content-Transfer-Encoding:MIME-Version: References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To: Content-Type:Content-ID:Content-Description; bh=Rd+6dW5HDDrUl1TiE4ebBdUbX9fm322L+unVUcaEcaI=; b=KyAifUVQeX7Uf5nHY9Dbr9ccDB Bh8eQsFdHFYfitTm/OotlMF68prCW8LFHp5HsolaZnk5q4FHB6o0wJeqHS4pduP+DEocmanrqTi6m jXOwCUcwEGcrL0E69NazcoiHTR8SRUZ3EYpxeKe2ghCRrU5hJU0oX25FEPXZXKPZvsPxDV1nWcx3t RDxJjZaQMoqEd1psniM8yQ8qjsdWHuSLsUo6VkkPskCf9wgD1SMC+7MjIAIM/Yhspv6H+oCr2B03J bLDxU8+1K1U6VjbXwL5coq7Ty0+vwSF+Xi0ahrApIEiUYHp0X6yMY7Y0onx0kP6/iFu04tou2qiFC ieW2jWxA==; Received: from mx2.suse.de ([195.135.220.15]) by casper.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jnm3C-0002u6-4n; Tue, 23 Jun 2020 16:45:40 +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 1F319B066; Tue, 23 Jun 2020 16:45:33 +0000 (UTC) From: Nicolas Saenz Julienne To: gregkh@linuxfoundation.org Subject: [PATCH 45/50] staging: vchi: Move vchi_queue_kernel_message() into vchiq Date: Tue, 23 Jun 2020 18:42:31 +0200 Message-Id: <20200623164235.29566-46-nsaenzjulienne@suse.de> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20200623164235.29566-1-nsaenzjulienne@suse.de> References: <20200623164235.29566-1-nsaenzjulienne@suse.de> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200623_174534_313864_9B154FE3 X-CRM114-Status: GOOD ( 15.33 ) X-Spam-Score: -4.2 (----) X-Spam-Report: SpamAssassin version 3.4.4 on casper.infradead.org summary: Content analysis details: (-4.2 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- 0.0 RCVD_IN_MSPIKE_H3 RBL: Good reputation (+3) [195.135.220.15 listed in wl.mailspike.net] -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] -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] -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, 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 We can't really merge it with vchiq_queue_message() as it has internal users that will not benefit from the retry mechanism vchiq_queue_kernel_message() uses. So, for the sake of getting rid of vchi, move it into vchiq. Signed-off-by: Nicolas Saenz Julienne --- .../bcm2835-audio/bcm2835-vchiq.c | 8 +++---- .../vc04_services/interface/vchi/vchi.h | 4 ---- .../interface/vchiq_arm/vchiq_core.c | 23 ++++++++++++++++--- .../interface/vchiq_arm/vchiq_if.h | 4 ++-- .../interface/vchiq_arm/vchiq_shim.c | 22 ------------------ .../vc04_services/vchiq-mmal/mmal-vchiq.c | 14 +++++------ 6 files changed, 32 insertions(+), 43 deletions(-) diff --git a/drivers/staging/vc04_services/bcm2835-audio/bcm2835-vchiq.c b/drivers/staging/vc04_services/bcm2835-audio/bcm2835-vchiq.c index 28d64bc895cd..efaa2ae11f52 100644 --- a/drivers/staging/vc04_services/bcm2835-audio/bcm2835-vchiq.c +++ b/drivers/staging/vc04_services/bcm2835-audio/bcm2835-vchiq.c @@ -44,8 +44,8 @@ static int bcm2835_audio_send_msg_locked(struct bcm2835_audio_instance *instance init_completion(&instance->msg_avail_comp); } - status = vchi_queue_kernel_message(instance->service_handle, - m, sizeof(*m)); + status = vchiq_queue_kernel_message(instance->service_handle, + m, sizeof(*m)); if (status) { dev_err(instance->dev, "vchi message queue failed: %d, msg=%d\n", @@ -350,8 +350,8 @@ int bcm2835_audio_write(struct bcm2835_alsa_stream *alsa_stream, while (count > 0) { int bytes = min(instance->max_packet, count); - status = vchi_queue_kernel_message(instance->service_handle, - src, bytes); + status = vchiq_queue_kernel_message(instance->service_handle, + src, bytes); src += bytes; count -= bytes; } diff --git a/drivers/staging/vc04_services/interface/vchi/vchi.h b/drivers/staging/vc04_services/interface/vchi/vchi.h index c800796f9986..6de5df43cc29 100644 --- a/drivers/staging/vc04_services/interface/vchi/vchi.h +++ b/drivers/staging/vc04_services/interface/vchi/vchi.h @@ -37,10 +37,6 @@ extern int32_t vchi_service_use(unsigned handle); // Routine to decrement ref count on a named service extern int32_t vchi_service_release(unsigned handle); -/* Routine to send a message from kernel memory across a service */ -extern int vchi_queue_kernel_message(unsigned handle, void *data, - unsigned int size); - // 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. 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 01a9331dbff4..ee11707b7476 100644 --- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c +++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c @@ -3213,11 +3213,28 @@ vchiq_queue_message(unsigned int handle, return status; } -enum vchiq_status vchiq_queue_kernel_message(unsigned int handle, void *context, - size_t size) +int vchiq_queue_kernel_message(unsigned handle, void *data, unsigned size) { - return vchiq_queue_message(handle, memcpy_copy_callback, context, size); + enum vchiq_status status; + + while (1) { + status = vchiq_queue_message(handle, memcpy_copy_callback, + data, size); + + /* + * vchiq_queue_message() may return VCHIQ_RETRY, so we need to + * implement a retry mechanism since this function is supposed + * to block until queued + */ + if (status != VCHIQ_RETRY) + break; + + msleep(1); + } + + return status; } +EXPORT_SYMBOL(vchiq_queue_kernel_message); void vchiq_release_message(unsigned int handle, diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_if.h b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_if.h index 931debcd6492..6374eda4ea0c 100644 --- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_if.h +++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_if.h @@ -89,8 +89,8 @@ extern enum vchiq_status vchiq_open_service(struct vchiq_instance *instance, extern enum vchiq_status vchiq_close_service(unsigned int service); extern enum vchiq_status vchiq_use_service(unsigned int service); extern enum vchiq_status vchiq_release_service(unsigned int service); -extern enum vchiq_status vchiq_queue_kernel_message(unsigned int handle, - void *context, size_t size); +extern int vchiq_queue_kernel_message(unsigned handle, void *data, + unsigned size); extern void vchiq_msg_queue_push(unsigned handle, struct vchiq_header *header); extern void vchiq_release_message(unsigned int service, struct vchiq_header *header); 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 33493643b5f8..57ac6a289a08 100644 --- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_shim.c +++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_shim.c @@ -9,28 +9,6 @@ #include "../vchi/vchi.h" #include "vchiq.h" -int vchi_queue_kernel_message(unsigned handle, void *data, unsigned int size) -{ - enum vchiq_status status; - - while (1) { - status = vchiq_queue_kernel_message(handle, data, size); - - /* - * vchiq_queue_message() may return VCHIQ_RETRY, so we need to - * implement a retry mechanism since this function is supposed - * to block until queued - */ - if (status != VCHIQ_RETRY) - break; - - msleep(1); - } - - return status; -} -EXPORT_SYMBOL(vchi_queue_kernel_message); - /*********************************************************** * Name: vchi_held_msg_release * diff --git a/drivers/staging/vc04_services/vchiq-mmal/mmal-vchiq.c b/drivers/staging/vc04_services/vchiq-mmal/mmal-vchiq.c index 34a1627754f3..4cb0fdcc6750 100644 --- a/drivers/staging/vc04_services/vchiq-mmal/mmal-vchiq.c +++ b/drivers/staging/vc04_services/vchiq-mmal/mmal-vchiq.c @@ -440,10 +440,9 @@ buffer_from_host(struct vchiq_mmal_instance *instance, vchi_service_use(instance->service_handle); - ret = vchi_queue_kernel_message(instance->service_handle, - &m, - sizeof(struct mmal_msg_header) + - sizeof(m.u.buffer_from_host)); + ret = vchiq_queue_kernel_message(instance->service_handle, &m, + sizeof(struct mmal_msg_header) + + sizeof(m.u.buffer_from_host)); vchi_service_release(instance->service_handle); @@ -681,10 +680,9 @@ static int send_synchronous_mmal_msg(struct vchiq_mmal_instance *instance, vchi_service_use(instance->service_handle); - ret = vchi_queue_kernel_message(instance->service_handle, - msg, - sizeof(struct mmal_msg_header) + - payload_len); + ret = vchiq_queue_kernel_message(instance->service_handle, msg, + sizeof(struct mmal_msg_header) + + payload_len); vchi_service_release(instance->service_handle); From patchwork Tue Jun 23 16:42:32 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: 11621169 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 25078618 for ; Tue, 23 Jun 2020 17:10:40 +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 C6994206EB for ; Tue, 23 Jun 2020 17:10:39 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="Zde2p0LD" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org C6994206EB 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=GuSC3vn0W72g9FLBW952sErSpSFjZTjE8MBZQ6q7HlM=; b=Zde2p0LD08MHNxeT0ZBDdYpku aCuVmC8GKoZ97yjRqRyqZMDHWySBiw/es7VQAfOgtFRY0YkB2H/r2Pre5ESgJMmPlBDGPRPq1EivB cd8+G5oSLVq4MGtbGyTP3UONuevWa7YlHlKAeYbJII7DBSLlJXCR5VmUt7Xn1FB4j4VPqFryZ8E0I YqarncHV7qagxmw/mk/XK1gysHKkycV6kCUN+eRE2ZFzq2Jdvlyh1BwSQCAMbYXuFpUGxYRCY59dX coQELqhZLv3Z+fyirWqdTj6GcxBD2H4Aed5INvmLYeJhqTDlJzba0cq+7oU+lWcwJO/lPetvpB9sQ btycLtR1Q==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jnmOJ-0000uS-82; Tue, 23 Jun 2020 17:07:23 +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 1jnm3E-0005Vs-Ec; Tue, 23 Jun 2020 16:45:48 +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 371B1AEB1; Tue, 23 Jun 2020 16:45:34 +0000 (UTC) From: Nicolas Saenz Julienne To: gregkh@linuxfoundation.org Subject: [PATCH 46/50] staging: vchiq: Get rid of vchi Date: Tue, 23 Jun 2020 18:42:32 +0200 Message-Id: <20200623164235.29566-47-nsaenzjulienne@suse.de> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20200623164235.29566-1-nsaenzjulienne@suse.de> References: <20200623164235.29566-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_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, 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 All the functions that vchi currently provides are a 1:1 mapping to its vchiq counterparts. Get rid of vchi altogether and use vchiq's on all services. In the process also get rid of the vchi directory, as the only remaining file was a TODO file, which now lives in the parent directory. Signed-off-by: Nicolas Saenz Julienne --- drivers/staging/vc04_services/Makefile | 1 - .../bcm2835-audio/bcm2835-vchiq.c | 24 +-- .../vc04_services/bcm2835-audio/bcm2835.h | 1 - .../vc04_services/interface/{vchi => }/TODO | 0 .../vc04_services/interface/vchi/vchi.h | 59 ------ .../interface/vchiq_arm/vchiq_arm.c | 2 + .../interface/vchiq_arm/vchiq_core.c | 3 + .../interface/vchiq_arm/vchiq_shim.c | 179 ------------------ .../vc04_services/vchiq-mmal/mmal-vchiq.c | 29 ++- 9 files changed, 31 insertions(+), 267 deletions(-) rename drivers/staging/vc04_services/interface/{vchi => }/TODO (100%) delete mode 100644 drivers/staging/vc04_services/interface/vchi/vchi.h delete mode 100644 drivers/staging/vc04_services/interface/vchiq_arm/vchiq_shim.c diff --git a/drivers/staging/vc04_services/Makefile b/drivers/staging/vc04_services/Makefile index 922990919c40..e02a9c2abf77 100644 --- a/drivers/staging/vc04_services/Makefile +++ b/drivers/staging/vc04_services/Makefile @@ -6,7 +6,6 @@ vchiq-objs := \ interface/vchiq_arm/vchiq_arm.o \ interface/vchiq_arm/vchiq_2835_arm.o \ interface/vchiq_arm/vchiq_debugfs.o \ - interface/vchiq_arm/vchiq_shim.o \ interface/vchiq_arm/vchiq_connected.o \ obj-$(CONFIG_SND_BCM2835) += bcm2835-audio/ diff --git a/drivers/staging/vc04_services/bcm2835-audio/bcm2835-vchiq.c b/drivers/staging/vc04_services/bcm2835-audio/bcm2835-vchiq.c index efaa2ae11f52..8c9ddd86fbbd 100644 --- a/drivers/staging/vc04_services/bcm2835-audio/bcm2835-vchiq.c +++ b/drivers/staging/vc04_services/bcm2835-audio/bcm2835-vchiq.c @@ -25,12 +25,12 @@ MODULE_PARM_DESC(force_bulk, "Force use of vchiq bulk for audio"); static void bcm2835_audio_lock(struct bcm2835_audio_instance *instance) { mutex_lock(&instance->vchi_mutex); - vchi_service_use(instance->service_handle); + vchiq_use_service(instance->service_handle); } static void bcm2835_audio_unlock(struct bcm2835_audio_instance *instance) { - vchi_service_release(instance->service_handle); + vchiq_release_service(instance->service_handle); mutex_unlock(&instance->vchi_mutex); } @@ -132,8 +132,8 @@ vc_vchi_audio_init(struct vchiq_instance *vchiq_instance, int status; /* Open the VCHI service connections */ - status = vchi_service_open(vchiq_instance, ¶ms, - &instance->service_handle); + status = vchiq_open_service(vchiq_instance, ¶ms, + &instance->service_handle); if (status) { dev_err(instance->dev, @@ -143,7 +143,7 @@ vc_vchi_audio_init(struct vchiq_instance *vchiq_instance, } /* Finished with the service for now */ - vchi_service_release(instance->service_handle); + vchiq_release_service(instance->service_handle); return 0; } @@ -153,10 +153,10 @@ static void vc_vchi_audio_deinit(struct bcm2835_audio_instance *instance) int status; mutex_lock(&instance->vchi_mutex); - vchi_service_use(instance->service_handle); + vchiq_use_service(instance->service_handle); /* Close all VCHI service connections */ - status = vchi_service_close(instance->service_handle); + status = vchiq_close_service(instance->service_handle); if (status) { dev_err(instance->dev, "failed to close VCHI service connection (status=%d)\n", @@ -171,14 +171,14 @@ int bcm2835_new_vchi_ctx(struct device *dev, struct bcm2835_vchi_ctx *vchi_ctx) int ret; /* Initialize and create a VCHI connection */ - ret = vchi_initialise(&vchi_ctx->instance); + ret = vchiq_initialise(&vchi_ctx->instance); if (ret) { dev_err(dev, "failed to initialise VCHI instance (ret=%d)\n", ret); return -EIO; } - ret = vchi_connect(vchi_ctx->instance); + ret = vchiq_connect(vchi_ctx->instance); if (ret) { dev_dbg(dev, "failed to connect VCHI instance (ret=%d)\n", ret); @@ -195,7 +195,7 @@ int bcm2835_new_vchi_ctx(struct device *dev, struct bcm2835_vchi_ctx *vchi_ctx) void bcm2835_free_vchi_ctx(struct bcm2835_vchi_ctx *vchi_ctx) { /* Close the VCHI connection - it will also free vchi_ctx->instance */ - WARN_ON(vchi_disconnect(vchi_ctx->instance)); + WARN_ON(vchiq_shutdown(vchi_ctx->instance)); vchi_ctx->instance = NULL; } @@ -226,8 +226,8 @@ int bcm2835_audio_open(struct bcm2835_alsa_stream *alsa_stream) goto deinit; bcm2835_audio_lock(instance); - vchi_get_peer_version(instance->service_handle, - &instance->peer_version); + vchiq_get_peer_version(instance->service_handle, + &instance->peer_version); bcm2835_audio_unlock(instance); if (instance->peer_version < 2 || force_bulk) instance->max_packet = 0; /* bulk transfer */ diff --git a/drivers/staging/vc04_services/bcm2835-audio/bcm2835.h b/drivers/staging/vc04_services/bcm2835-audio/bcm2835.h index 7a0e4ab50fc7..a15f251033ac 100644 --- a/drivers/staging/vc04_services/bcm2835-audio/bcm2835.h +++ b/drivers/staging/vc04_services/bcm2835-audio/bcm2835.h @@ -10,7 +10,6 @@ #include #include #include "interface/vchiq_arm/vchiq_if.h" -#include "interface/vchi/vchi.h" #define MAX_SUBSTREAMS (8) #define AVAIL_SUBSTREAMS_MASK (0xff) diff --git a/drivers/staging/vc04_services/interface/vchi/TODO b/drivers/staging/vc04_services/interface/TODO similarity index 100% rename from drivers/staging/vc04_services/interface/vchi/TODO rename to drivers/staging/vc04_services/interface/TODO diff --git a/drivers/staging/vc04_services/interface/vchi/vchi.h b/drivers/staging/vc04_services/interface/vchi/vchi.h deleted file mode 100644 index 6de5df43cc29..000000000000 --- a/drivers/staging/vc04_services/interface/vchi/vchi.h +++ /dev/null @@ -1,59 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause */ -/* Copyright (c) 2010-2012 Broadcom. All rights reserved. */ - -#ifndef VCHI_H_ -#define VCHI_H_ - -/****************************************************************************** - * Global funcs - implementation is specific to which side you are on - * (local / remote) - *****************************************************************************/ - -// Routine used to initialise the vchi on both local + remote connections -extern int32_t vchi_initialise(struct vchiq_instance **instance); - -extern int32_t vchi_connect(struct vchiq_instance *instance); - -//When this is called, ensure that all services have no data pending. -//Bulk transfers can remain 'queued' -extern int32_t vchi_disconnect(struct vchiq_instance *instance); - -/****************************************************************************** - * Global service API - *****************************************************************************/ -// Routine to open a named service -extern int vchi_service_open(struct vchiq_instance *instance, - struct vchiq_service_params *params, - unsigned *handle); - -extern int32_t vchi_get_peer_version(unsigned handle, short *peer_version); - -// Routine to close a named service -extern int32_t vchi_service_close(unsigned handle); - -// Routine to increment ref count on a named service -extern int32_t vchi_service_use(unsigned handle); - -// Routine to decrement ref count on a named service -extern int32_t vchi_service_release(unsigned handle); - -// 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. -struct vchiq_header *vchi_msg_hold(unsigned handle); - -/******************************************************************************* - * Global service support API - operations on held messages - * and message iterators - ******************************************************************************/ - -// Routine to release a held message after it has been processed -extern int32_t vchi_held_msg_release(unsigned handle, struct vchiq_header *message); - -/****************************************************************************** - * Configuration plumbing - *****************************************************************************/ - -#endif /* VCHI_H_ */ - -/****************************** End of file **********************************/ diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c index d25d1031ed96..c8ae752730fe 100644 --- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c +++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c @@ -2571,6 +2571,7 @@ vchiq_use_service(unsigned int handle) } return ret; } +EXPORT_SYMBOL(vchiq_use_service); enum vchiq_status vchiq_release_service(unsigned int handle) @@ -2584,6 +2585,7 @@ vchiq_release_service(unsigned int handle) } return ret; } +EXPORT_SYMBOL(vchiq_release_service); struct service_data_struct { int fourcc; 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 ee11707b7476..a0525edc3093 100644 --- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c +++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c @@ -2946,6 +2946,7 @@ vchiq_close_service(unsigned int handle) return status; } +EXPORT_SYMBOL(vchiq_close_service); enum vchiq_status vchiq_remove_service(unsigned int handle) @@ -3268,6 +3269,7 @@ vchiq_release_message(unsigned int handle, unlock_service(service); } +EXPORT_SYMBOL(vchiq_release_message); static void release_message_sync(struct vchiq_state *state, struct vchiq_header *header) @@ -3294,6 +3296,7 @@ vchiq_get_peer_version(unsigned int handle, short *peer_version) unlock_service(service); return status; } +EXPORT_SYMBOL(vchiq_get_peer_version); void vchiq_get_config(struct vchiq_config *config) { diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_shim.c b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_shim.c deleted file mode 100644 index 57ac6a289a08..000000000000 --- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_shim.c +++ /dev/null @@ -1,179 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause -/* Copyright (c) 2010-2012 Broadcom. All rights reserved. */ -#include -#include -#include -#include - -#include "vchiq_if.h" -#include "../vchi/vchi.h" -#include "vchiq.h" - -/*********************************************************** - * Name: vchi_held_msg_release - * - * Arguments: unsgined handle - * struct vchiq_header *message - * - * Description: Routine to release a held message (after it has been read with - * vchi_msg_hold) - * - * Returns: int - success == 0 - * - ***********************************************************/ -int vchi_held_msg_release(unsigned handle, struct vchiq_header *message) -{ - /* - * Convert the service field pointer back to an - * unsigned int which is an int. - * This pointer is opaque to everything except - * vchi_msg_hold which simply upcasted the int - * to a pointer. - */ - - vchiq_release_message(handle, message); - - return 0; -} -EXPORT_SYMBOL(vchi_held_msg_release); - -/*********************************************************** - * Name: vchi_msg_hold - * - * Arguments: struct vchi_service *service, - * void **data, - * unsigned *msg_size, - * struct vchiq_header **message - * - * Description: Routine to return a pointer to the current message (to allow - * in place processing). The message is dequeued - don't forget - * to release the message using vchi_held_msg_release when you're - * finished. - * - * Returns: int - success == 0 - * - ***********************************************************/ -struct vchiq_header *vchi_msg_hold(unsigned handle) -{ - return vchiq_msg_hold(handle); -} -EXPORT_SYMBOL(vchi_msg_hold); - -/*********************************************************** - * Name: vchi_initialise - * - * Arguments: struct vchiq_instance **instance - * - * Description: Initialises the hardware but does not transmit anything - * When run as a Host App this will be called twice hence the need - * to malloc the state information - * - * Returns: 0 if successful, failure otherwise - * - ***********************************************************/ - -int vchi_initialise(struct vchiq_instance **instance) -{ - return vchiq_initialise(instance); -} -EXPORT_SYMBOL(vchi_initialise); - -/*********************************************************** - * Name: vchi_connect - * - * Arguments: struct vchiq_instance *instance - * - * Description: Starts the command service on each connection, - * causing INIT messages to be pinged back and forth - * - * Returns: 0 if successful, failure otherwise - * - ***********************************************************/ -int vchi_connect(struct vchiq_instance *instance) -{ - return vchiq_connect(instance); -} -EXPORT_SYMBOL(vchi_connect); - -/*********************************************************** - * Name: vchi_disconnect - * - * Arguments: struct vchiq_instance *instance - * - * Description: Stops the command service on each connection, - * causing DE-INIT messages to be pinged back and forth - * - * Returns: 0 if successful, failure otherwise - * - ***********************************************************/ -int vchi_disconnect(struct vchiq_instance *instance) -{ - return vchiq_shutdown(instance); -} -EXPORT_SYMBOL(vchi_disconnect); - -/*********************************************************** - * Name: vchi_service_open - * Name: vchi_service_create - * - * Arguments: struct vchiq_instance *instance - * struct service_creation *setup, - * unsigned *handle - * - * Description: Routine to open a service - * - * Returns: int - success == 0 - * - ***********************************************************/ - -int vchi_service_open(struct vchiq_instance *instance, - struct vchiq_service_params *params, - unsigned *handle) -{ - return vchiq_open_service(instance, params, handle); -} -EXPORT_SYMBOL(vchi_service_open); - -int vchi_service_close(unsigned handle) -{ - return vchiq_close_service(handle); -} -EXPORT_SYMBOL(vchi_service_close); - -int vchi_get_peer_version(unsigned handle, short *peer_version) -{ - return vchiq_get_peer_version(handle, peer_version); -} -EXPORT_SYMBOL(vchi_get_peer_version); - -/*********************************************************** - * Name: vchi_service_use - * - * Arguments: unsigned handle - * - * Description: Routine to increment refcount on a service - * - * Returns: void - * - ***********************************************************/ -int vchi_service_use(unsigned handle) -{ - return vchiq_use_service(handle); -} -EXPORT_SYMBOL(vchi_service_use); - -/*********************************************************** - * Name: vchi_service_release - * - * Arguments: unsigned handle - * - * Description: Routine to decrement refcount on a service - * - * Returns: void - * - ***********************************************************/ -int vchi_service_release(unsigned handle) -{ - return vchiq_release_service(handle); -} -EXPORT_SYMBOL(vchi_service_release); diff --git a/drivers/staging/vc04_services/vchiq-mmal/mmal-vchiq.c b/drivers/staging/vc04_services/vchiq-mmal/mmal-vchiq.c index 4cb0fdcc6750..f2a0341f6fc2 100644 --- a/drivers/staging/vc04_services/vchiq-mmal/mmal-vchiq.c +++ b/drivers/staging/vc04_services/vchiq-mmal/mmal-vchiq.c @@ -30,7 +30,6 @@ #include "mmal-msg.h" #include "interface/vchiq_arm/vchiq_if.h" -#include "interface/vchi/vchi.h" /* * maximum number of components supported. @@ -294,7 +293,7 @@ static void buffer_to_host_work_cb(struct work_struct *work) /* Dummy receive to ensure the buffers remain in order */ len = 8; /* queue the bulk submission */ - vchi_service_use(instance->service_handle); + vchiq_use_service(instance->service_handle); ret = vchiq_bulk_receive(instance->service_handle, msg_context->u.bulk.buffer->buffer, /* Actual receive needs to be a multiple @@ -304,7 +303,7 @@ static void buffer_to_host_work_cb(struct work_struct *work) msg_context, VCHIQ_BULK_MODE_CALLBACK); - vchi_service_release(instance->service_handle); + vchiq_release_service(instance->service_handle); if (ret != 0) pr_err("%s: ctx: %p, vchiq_bulk_receive failed %d\n", @@ -438,13 +437,13 @@ buffer_from_host(struct vchiq_mmal_instance *instance, /* no payload in message */ m.u.buffer_from_host.payload_in_message = 0; - vchi_service_use(instance->service_handle); + vchiq_use_service(instance->service_handle); ret = vchiq_queue_kernel_message(instance->service_handle, &m, sizeof(struct mmal_msg_header) + sizeof(m.u.buffer_from_host)); - vchi_service_release(instance->service_handle); + vchiq_release_service(instance->service_handle); return ret; } @@ -678,13 +677,13 @@ static int send_synchronous_mmal_msg(struct vchiq_mmal_instance *instance, DBG_DUMP_MSG(msg, (sizeof(struct mmal_msg_header) + payload_len), ">>> sync message"); - vchi_service_use(instance->service_handle); + vchiq_use_service(instance->service_handle); ret = vchiq_queue_kernel_message(instance->service_handle, msg, sizeof(struct mmal_msg_header) + payload_len); - vchi_service_release(instance->service_handle); + vchiq_release_service(instance->service_handle); if (ret) { pr_err("error %d queuing message\n", ret); @@ -1832,9 +1831,9 @@ int vchiq_mmal_finalise(struct vchiq_mmal_instance *instance) if (mutex_lock_interruptible(&instance->vchiq_mutex)) return -EINTR; - vchi_service_use(instance->service_handle); + vchiq_use_service(instance->service_handle); - status = vchi_service_close(instance->service_handle); + status = vchiq_close_service(instance->service_handle); if (status != 0) pr_err("mmal-vchiq: VCHIQ close failed\n"); @@ -1880,14 +1879,14 @@ int vchiq_mmal_init(struct vchiq_mmal_instance **out_instance) BUILD_BUG_ON(sizeof(struct mmal_port) != 64); /* create a vchi instance */ - status = vchi_initialise(&vchiq_instance); + status = vchiq_initialise(&vchiq_instance); if (status) { pr_err("Failed to initialise VCHI instance (status=%d)\n", status); return -EIO; } - status = vchi_connect(vchiq_instance); + status = vchiq_connect(vchiq_instance); if (status) { pr_err("Failed to connect VCHI instance (status=%d)\n", status); return -EIO; @@ -1912,22 +1911,22 @@ int vchiq_mmal_init(struct vchiq_mmal_instance **out_instance) if (!instance->bulk_wq) goto err_free; - status = vchi_service_open(vchiq_instance, ¶ms, - &instance->service_handle); + status = vchiq_open_service(vchiq_instance, ¶ms, + &instance->service_handle); if (status) { pr_err("Failed to open VCHI service connection (status=%d)\n", status); goto err_close_services; } - vchi_service_release(instance->service_handle); + vchiq_release_service(instance->service_handle); *out_instance = instance; return 0; err_close_services: - vchi_service_close(instance->service_handle); + vchiq_close_service(instance->service_handle); destroy_workqueue(instance->bulk_wq); err_free: vfree(instance->bulk_scratch); From patchwork Tue Jun 23 16:42:33 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: 11621161 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 A147E618 for ; Tue, 23 Jun 2020 17:09:18 +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 6DF9120706 for ; Tue, 23 Jun 2020 17:09:18 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="CGu1W+N6" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 6DF9120706 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=5yt2uP2XBUNbuVyOHnSdCNSJj25nFuJPDgfFw3qhs3I=; b=CGu1W+N6nIJUwsgdh3yWD60Al AqtxcC6povAoUPhqcY1lc+bq9ecpwB2EiYLcOVq6dllE37YB0Bq03U+8he3SVYnDn0ejTK0ukw+Na hnTpm95+nUJ9kgYZ5k2wSn614c5hbYCxZokNjeldaS8JJjsi+Pe0ZvXugtuszh4/liT+erWwfJeZy Oba557W04ajhpfZcX0dYDMK182sbCSs228mRm1AGYkMVqhUamYJ1uj4Gmc3scQ4GC4KmwW++YTya4 xrItEufxeYci2cHJxq/NppHpqyuEPJT8YfvZvXSk47xa/Gbxo25EGT8ooF6xMrYO2L+jez6/1C2ZV 1KVjebapQ==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jnmNa-0000Sw-Ho; Tue, 23 Jun 2020 17:06:38 +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 1jnm3F-0005W9-Ck; Tue, 23 Jun 2020 16:45:43 +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 C0536B03C; Tue, 23 Jun 2020 16:45:34 +0000 (UTC) From: Nicolas Saenz Julienne To: gregkh@linuxfoundation.org Subject: [PATCH 47/50] staging: vchiq: Move conditional barrier definition into vchiq_core.h Date: Tue, 23 Jun 2020 18:42:33 +0200 Message-Id: <20200623164235.29566-48-nsaenzjulienne@suse.de> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20200623164235.29566-1-nsaenzjulienne@suse.de> References: <20200623164235.29566-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_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, 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 The barrier is only used by core code. So keep the barrier definition in the core header. Signed-off-by: Nicolas Saenz Julienne --- .../vc04_services/interface/vchiq_arm/vchiq.h | 11 ----------- .../vc04_services/interface/vchiq_arm/vchiq_core.h | 12 ++++++++++++ 2 files changed, 12 insertions(+), 11 deletions(-) diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq.h b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq.h index 211b20705e36..57fe7d5e9a85 100644 --- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq.h +++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq.h @@ -6,15 +6,4 @@ #include "vchiq_if.h" -/* Do this so that we can test-build the code on non-rpi systems */ -#if IS_ENABLED(CONFIG_RASPBERRYPI_FIRMWARE) - -#else - -#ifndef dsb -#define dsb(a) -#endif - -#endif /* IS_ENABLED(CONFIG_RASPBERRYPI_FIRMWARE) */ - #endif diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.h b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.h index ff91c04ba6b9..15e9867f78f4 100644 --- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.h +++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.h @@ -15,6 +15,18 @@ #include "vchiq.h" +/* Do this so that we can test-build the code on non-rpi systems */ +#if IS_ENABLED(CONFIG_RASPBERRYPI_FIRMWARE) + +#else + +#ifndef dsb +#define dsb(a) +#endif + +#endif /* IS_ENABLED(CONFIG_RASPBERRYPI_FIRMWARE) */ + + /* Run time control of log level, based on KERN_XXX level. */ #define VCHIQ_LOG_DEFAULT 4 #define VCHIQ_LOG_ERROR 3 From patchwork Tue Jun 23 16:42:34 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: 11621167 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 16C2A60D for ; Tue, 23 Jun 2020 17:10:12 +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 D64D920706 for ; Tue, 23 Jun 2020 17:10:11 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="YkFUQxUQ" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org D64D920706 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=URHJoDhNlyzh6meJOGRff9irbARxS0OF6FcxfWf4slA=; b=YkFUQxUQ1zJrMKzn5CI7YhUhl QOF9YhRzlXGBJnJO8UBzHK0cJ3bLj3XpAuj8/C3v4sa/waeuEC6RIZazHzl55C7k+g+GQljSi2NNN ZH7tB5gleUng7i3JOQYLgAbsqvTytqnl4PDv3PWJWEyJFlnvH00S8HNuJ9XNRYUCcXZyKz2WvGoa4 9dLhVEllfwREt1Lqo+UWq6A/S7CVp8qnFJKh7u5pggZ1uQuHFM8+p7UJsSNlvQ9FZjinLlcr8u0zg 3kmsWbXjBfh2YYuoIlGgUGkfFBn4tqJJia0yLr94936QyTi342IIZMC1gUiO1+xc3YrNc+dVMzHnH VY7Iq2tOQ==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jnmO3-0000lz-3M; Tue, 23 Jun 2020 17:07:07 +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 1jnm3F-0005WT-VO; Tue, 23 Jun 2020 16:45:47 +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 4677EB080; Tue, 23 Jun 2020 16:45:35 +0000 (UTC) From: Nicolas Saenz Julienne To: gregkh@linuxfoundation.org Subject: [PATCH 48/50] staging: vchiq: Use vchiq.h as the main header file for services Date: Tue, 23 Jun 2020 18:42:34 +0200 Message-Id: <20200623164235.29566-49-nsaenzjulienne@suse.de> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20200623164235.29566-1-nsaenzjulienne@suse.de> References: <20200623164235.29566-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_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, 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 This used to be vchiq_if.h but vchiq.h is more concise for an include file that will hopefully be in the future in the includes directory. Signed-off-by: Nicolas Saenz Julienne --- .../vc04_services/bcm2835-audio/bcm2835.h | 2 +- .../vc04_services/interface/vchiq_arm/vchiq.h | 107 ++++++++++++++++- .../interface/vchiq_arm/vchiq_if.h | 109 ------------------ .../interface/vchiq_arm/vchiq_ioctl.h | 2 +- .../vc04_services/vchiq-mmal/mmal-vchiq.c | 2 +- 5 files changed, 106 insertions(+), 116 deletions(-) delete mode 100644 drivers/staging/vc04_services/interface/vchiq_arm/vchiq_if.h diff --git a/drivers/staging/vc04_services/bcm2835-audio/bcm2835.h b/drivers/staging/vc04_services/bcm2835-audio/bcm2835.h index a15f251033ac..ca220f5230ec 100644 --- a/drivers/staging/vc04_services/bcm2835-audio/bcm2835.h +++ b/drivers/staging/vc04_services/bcm2835-audio/bcm2835.h @@ -9,7 +9,7 @@ #include #include #include -#include "interface/vchiq_arm/vchiq_if.h" +#include "interface/vchiq_arm/vchiq.h" #define MAX_SUBSTREAMS (8) #define AVAIL_SUBSTREAMS_MASK (0xff) diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq.h b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq.h index 57fe7d5e9a85..04b7ff41a025 100644 --- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq.h +++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq.h @@ -1,9 +1,108 @@ /* SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause */ /* Copyright (c) 2010-2012 Broadcom. All rights reserved. */ -#ifndef VCHIQ_VCHIQ_H -#define VCHIQ_VCHIQ_H +#ifndef VCHIQ_H +#define VCHIQ_H -#include "vchiq_if.h" +#define VCHIQ_SERVICE_HANDLE_INVALID 0 -#endif +#define VCHIQ_SLOT_SIZE 4096 +#define VCHIQ_MAX_MSG_SIZE (VCHIQ_SLOT_SIZE - sizeof(struct vchiq_header)) + +#define VCHIQ_MAKE_FOURCC(x0, x1, x2, x3) \ + (((x0) << 24) | ((x1) << 16) | ((x2) << 8) | (x3)) + +enum vchiq_reason { + VCHIQ_SERVICE_OPENED, /* service, -, - */ + VCHIQ_SERVICE_CLOSED, /* service, -, - */ + VCHIQ_MESSAGE_AVAILABLE, /* service, header, - */ + VCHIQ_BULK_TRANSMIT_DONE, /* service, -, bulk_userdata */ + VCHIQ_BULK_RECEIVE_DONE, /* service, -, bulk_userdata */ + VCHIQ_BULK_TRANSMIT_ABORTED, /* service, -, bulk_userdata */ + VCHIQ_BULK_RECEIVE_ABORTED /* service, -, bulk_userdata */ +}; + +enum vchiq_status { + VCHIQ_ERROR = -1, + VCHIQ_SUCCESS = 0, + VCHIQ_RETRY = 1 +}; + +enum vchiq_bulk_mode { + VCHIQ_BULK_MODE_CALLBACK, + VCHIQ_BULK_MODE_BLOCKING, + VCHIQ_BULK_MODE_NOCALLBACK, + VCHIQ_BULK_MODE_WAITING /* Reserved for internal use */ +}; + +enum vchiq_service_option { + VCHIQ_SERVICE_OPTION_AUTOCLOSE, + VCHIQ_SERVICE_OPTION_SLOT_QUOTA, + VCHIQ_SERVICE_OPTION_MESSAGE_QUOTA, + VCHIQ_SERVICE_OPTION_SYNCHRONOUS, + VCHIQ_SERVICE_OPTION_TRACE +}; + +struct vchiq_header { + /* The message identifier - opaque to applications. */ + int msgid; + + /* Size of message data. */ + unsigned int size; + + char data[0]; /* message */ +}; + +struct vchiq_element { + const void __user *data; + unsigned int size; +}; + +struct vchiq_service_base { + int fourcc; + enum vchiq_status (*callback)(enum vchiq_reason reason, + struct vchiq_header *header, + unsigned int handle, + void *bulk_userdata); + void *userdata; +}; + +struct vchiq_service_params { + int fourcc; + enum vchiq_status (*callback)(enum vchiq_reason reason, + struct vchiq_header *header, + unsigned int handle, + void *bulk_userdata); + void *userdata; + short version; /* Increment for non-trivial changes */ + short version_min; /* Update for incompatible changes */ +}; + +struct vchiq_instance; + +extern enum vchiq_status vchiq_initialise(struct vchiq_instance **pinstance); +extern enum vchiq_status vchiq_shutdown(struct vchiq_instance *instance); +extern enum vchiq_status vchiq_connect(struct vchiq_instance *instance); +extern enum vchiq_status vchiq_open_service(struct vchiq_instance *instance, + const struct vchiq_service_params *params, + unsigned int *pservice); +extern enum vchiq_status vchiq_close_service(unsigned int service); +extern enum vchiq_status vchiq_use_service(unsigned int service); +extern enum vchiq_status vchiq_release_service(unsigned int service); +extern void vchiq_msg_queue_push(unsigned handle, struct vchiq_header *header); +extern void vchiq_release_message(unsigned int service, + struct vchiq_header *header); +extern int vchiq_queue_kernel_message(unsigned handle, void *data, + unsigned size); +extern enum vchiq_status vchiq_bulk_transmit(unsigned int service, + const void *data, unsigned int size, void *userdata, + enum vchiq_bulk_mode mode); +extern enum vchiq_status vchiq_bulk_receive(unsigned int service, + void *data, unsigned int size, void *userdata, + enum vchiq_bulk_mode mode); +extern void *vchiq_get_service_userdata(unsigned int service); +extern enum vchiq_status vchiq_get_peer_version(unsigned int handle, + short *peer_version); +extern struct vchiq_header *vchiq_msg_hold(unsigned handle); + +#endif /* VCHIQ_H */ diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_if.h b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_if.h deleted file mode 100644 index 6374eda4ea0c..000000000000 --- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_if.h +++ /dev/null @@ -1,109 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause */ -/* Copyright (c) 2010-2012 Broadcom. All rights reserved. */ - -#ifndef VCHIQ_IF_H -#define VCHIQ_IF_H - -#define VCHIQ_SERVICE_HANDLE_INVALID 0 - -#define VCHIQ_SLOT_SIZE 4096 -#define VCHIQ_MAX_MSG_SIZE (VCHIQ_SLOT_SIZE - sizeof(struct vchiq_header)) - -#define VCHIQ_MAKE_FOURCC(x0, x1, x2, x3) \ - (((x0) << 24) | ((x1) << 16) | ((x2) << 8) | (x3)) - -enum vchiq_reason { - VCHIQ_SERVICE_OPENED, /* service, -, - */ - VCHIQ_SERVICE_CLOSED, /* service, -, - */ - VCHIQ_MESSAGE_AVAILABLE, /* service, header, - */ - VCHIQ_BULK_TRANSMIT_DONE, /* service, -, bulk_userdata */ - VCHIQ_BULK_RECEIVE_DONE, /* service, -, bulk_userdata */ - VCHIQ_BULK_TRANSMIT_ABORTED, /* service, -, bulk_userdata */ - VCHIQ_BULK_RECEIVE_ABORTED /* service, -, bulk_userdata */ -}; - -enum vchiq_status { - VCHIQ_ERROR = -1, - VCHIQ_SUCCESS = 0, - VCHIQ_RETRY = 1 -}; - -enum vchiq_bulk_mode { - VCHIQ_BULK_MODE_CALLBACK, - VCHIQ_BULK_MODE_BLOCKING, - VCHIQ_BULK_MODE_NOCALLBACK, - VCHIQ_BULK_MODE_WAITING /* Reserved for internal use */ -}; - -enum vchiq_service_option { - VCHIQ_SERVICE_OPTION_AUTOCLOSE, - VCHIQ_SERVICE_OPTION_SLOT_QUOTA, - VCHIQ_SERVICE_OPTION_MESSAGE_QUOTA, - VCHIQ_SERVICE_OPTION_SYNCHRONOUS, - VCHIQ_SERVICE_OPTION_TRACE -}; - -struct vchiq_header { - /* The message identifier - opaque to applications. */ - int msgid; - - /* Size of message data. */ - unsigned int size; - - char data[0]; /* message */ -}; - -struct vchiq_element { - const void __user *data; - unsigned int size; -}; - -struct vchiq_service_base { - int fourcc; - enum vchiq_status (*callback)(enum vchiq_reason reason, - struct vchiq_header *header, - unsigned int handle, - void *bulk_userdata); - void *userdata; -}; - -struct vchiq_service_params { - int fourcc; - enum vchiq_status (*callback)(enum vchiq_reason reason, - struct vchiq_header *header, - unsigned int handle, - void *bulk_userdata); - void *userdata; - short version; /* Increment for non-trivial changes */ - short version_min; /* Update for incompatible changes */ -}; - -struct vchiq_instance; - -extern enum vchiq_status vchiq_initialise(struct vchiq_instance **pinstance); -extern enum vchiq_status vchiq_shutdown(struct vchiq_instance *instance); -extern enum vchiq_status vchiq_connect(struct vchiq_instance *instance); -extern enum vchiq_status vchiq_open_service(struct vchiq_instance *instance, - const struct vchiq_service_params *params, - unsigned int *pservice); -extern enum vchiq_status vchiq_close_service(unsigned int service); -extern enum vchiq_status vchiq_use_service(unsigned int service); -extern enum vchiq_status vchiq_release_service(unsigned int service); -extern int vchiq_queue_kernel_message(unsigned handle, void *data, - unsigned size); -extern void vchiq_msg_queue_push(unsigned handle, struct vchiq_header *header); -extern void vchiq_release_message(unsigned int service, - struct vchiq_header *header); -extern enum vchiq_status vchiq_bulk_transmit(unsigned int service, - const void *data, unsigned int size, void *userdata, - enum vchiq_bulk_mode mode); -extern enum vchiq_status vchiq_bulk_receive(unsigned int service, - void *data, unsigned int size, void *userdata, - enum vchiq_bulk_mode mode); -extern void *vchiq_get_service_userdata(unsigned int service); -extern enum vchiq_status vchiq_get_peer_version(unsigned int handle, - short *peer_version); -extern void vchiq_msg_queue_push(unsigned handle, struct vchiq_header *header); -extern struct vchiq_header *vchiq_msg_hold(unsigned handle); - -#endif /* VCHIQ_IF_H */ diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_ioctl.h b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_ioctl.h index 202889b3774f..f285d754ad28 100644 --- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_ioctl.h +++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_ioctl.h @@ -5,7 +5,7 @@ #define VCHIQ_IOCTLS_H #include -#include "vchiq_if.h" +#include "vchiq.h" #define VCHIQ_IOC_MAGIC 0xc4 #define VCHIQ_INVALID_HANDLE (~0) diff --git a/drivers/staging/vc04_services/vchiq-mmal/mmal-vchiq.c b/drivers/staging/vc04_services/vchiq-mmal/mmal-vchiq.c index f2a0341f6fc2..72afa4319bd3 100644 --- a/drivers/staging/vc04_services/vchiq-mmal/mmal-vchiq.c +++ b/drivers/staging/vc04_services/vchiq-mmal/mmal-vchiq.c @@ -29,7 +29,7 @@ #include "mmal-vchiq.h" #include "mmal-msg.h" -#include "interface/vchiq_arm/vchiq_if.h" +#include "interface/vchiq_arm/vchiq.h" /* * maximum number of components supported. From patchwork Tue Jun 23 16:42:35 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: 11621165 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 16FEA618 for ; Tue, 23 Jun 2020 17:09:46 +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 DF90F20706 for ; Tue, 23 Jun 2020 17:09:45 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="pQw+loO/" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org DF90F20706 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=9jNGHBAqNjm8/kpGDzSkUZjEUJlZyxapLKWUaGE7ed8=; b=pQw+loO/3u8eWX5PhZJT8GKUA t6OPurzTwXz+96g0p9wDMpTS2OxHBaW8IYCdQdSAScU21y72xWcPxZ4JTZWvivMvmrY1qvjmwA1ET sL3xfOVX6RqpsLjVuThAW6oidBsE/969DVapyiZGhSBwFZkWaMnpxTIDEy4gdLes0qv7Vh3GmQiRl Rye8+AGs0ro7FHqCptMVJkxAMGjzluJ6k6Ao1ljlg/CBHVk+X0JHxWiQfxDo6o6PkSxD1t5kmw+FI bNZnw3RxdS3k9qYw5JE05vmUGxTrUZ+7CiMywaW7S8VqDcDu8HJfrY56pI4JiqWGQv2+wE2qQQMss IQA13mlfQ==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jnmNu-0000eO-3F; Tue, 23 Jun 2020 17:06:58 +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 1jnm3G-0005Wi-9y; Tue, 23 Jun 2020 16:45:45 +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 ACC4AB053; Tue, 23 Jun 2020 16:45:35 +0000 (UTC) From: Nicolas Saenz Julienne To: gregkh@linuxfoundation.org Subject: [PATCH 49/50] staging: vchiq: Move defines into core header Date: Tue, 23 Jun 2020 18:42:35 +0200 Message-Id: <20200623164235.29566-50-nsaenzjulienne@suse.de> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20200623164235.29566-1-nsaenzjulienne@suse.de> References: <20200623164235.29566-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_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, 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 Those are only used in the core vchiq code, while present in vchiq's 'public' API header. Move them into the right place. Signed-off-by: Nicolas Saenz Julienne --- drivers/staging/vc04_services/interface/vchiq_arm/vchiq.h | 5 ----- .../staging/vc04_services/interface/vchiq_arm/vchiq_core.h | 4 ++++ 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq.h b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq.h index 04b7ff41a025..cb9ef9a4150b 100644 --- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq.h +++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq.h @@ -4,11 +4,6 @@ #ifndef VCHIQ_H #define VCHIQ_H -#define VCHIQ_SERVICE_HANDLE_INVALID 0 - -#define VCHIQ_SLOT_SIZE 4096 -#define VCHIQ_MAX_MSG_SIZE (VCHIQ_SLOT_SIZE - sizeof(struct vchiq_header)) - #define VCHIQ_MAKE_FOURCC(x0, x1, x2, x3) \ (((x0) << 24) | ((x1) << 16) | ((x2) << 8) | (x3)) diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.h b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.h index 15e9867f78f4..8a27f3d7217e 100644 --- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.h +++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.h @@ -26,6 +26,10 @@ #endif /* IS_ENABLED(CONFIG_RASPBERRYPI_FIRMWARE) */ +#define VCHIQ_SERVICE_HANDLE_INVALID 0 + +#define VCHIQ_SLOT_SIZE 4096 +#define VCHIQ_MAX_MSG_SIZE (VCHIQ_SLOT_SIZE - sizeof(struct vchiq_header)) /* Run time control of log level, based on KERN_XXX level. */ #define VCHIQ_LOG_DEFAULT 4 From patchwork Tue Jun 23 16:42:36 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: 11621163 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 7FC54618 for ; Tue, 23 Jun 2020 17:09:19 +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 57DDA20780 for ; Tue, 23 Jun 2020 17:09:19 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="veeEfka9"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="jx2lmcBg" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 57DDA20780 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=a7IoRbsG1/YIfBfz3N2I978+yK8qwauEJbRWC3a/atA=; b=veeEfka9cq55wHD4L3BvDRISz 2jF2PX/sc5tSCWS4jFNIM7cmOt+2RlSQLEJyri0yw1Vz6PO4sDEZBKsjw/JPRlborsBGRCMGxnkVF e+7SF1iU/xSHcXsUGO3IocmJlOKobBfWmNOk37BaSkhqVq9zjplCRmmcFfHentgSXH3oSVkm6n2il JIapydEqJ+fGe8bRnm+OvCCmkQDW2DPmdsEEYdUG3j6qM7glXah73Deh67hpjb/1ixziSs/VRUrqm kLkpPzBdB6AmqdKuvwVIh2CRMa6o3ZjObi7MK20T0GUTx/krwnTegdmp1Y2pradSarPdg9Yx8Pg2A Gl/RCyD/A==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jnmNA-0000HB-Ky; Tue, 23 Jun 2020 17:06:12 +0000 Received: from casper.infradead.org ([90.155.50.34]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jnm3K-0005Yv-C4; Tue, 23 Jun 2020 16:45:42 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=Content-Transfer-Encoding:MIME-Version: References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To: Content-Type:Content-ID:Content-Description; bh=qTUCsn53Me0JK6I0cnJQUTholY/wqVdTqBhIB52bh7g=; b=jx2lmcBgpU/0j8JnhdxVNeeMdv yyfDO1g9TtaFJpPU7vI5UepbR3YWHt5DEaUZg+pE3Ppo7mBHb8wpznL+E2XFj/YgB55PaYdiPkyik 88ZcHbadtDSweXI4q1S9YylomXXxj7NxZfqy++EdQbfg/o79OWZPdbwWZxy5TxBVYkQOY5IJp3ImH 8mXs8m+C0yGngy4vzbBLK0+Zq3wwn0XCHe9ug3ZR1TBQGkNp+OH0kQGYYQswxVFKrnAht5CkvC4CI 88nPV2Pm2QdyGv3cDt9UDXizVuwqUqJ5pNNNNuVN95ZGR0sb1ncgnzko/xO17PNB15c1VSDkxkOm/ BUmKD1bg==; Received: from mx2.suse.de ([195.135.220.15]) by casper.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jnm3F-0002ut-9r; Tue, 23 Jun 2020 16:45:40 +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 1EA8DAEBE; Tue, 23 Jun 2020 16:45:36 +0000 (UTC) From: Nicolas Saenz Julienne To: gregkh@linuxfoundation.org Subject: [PATCH 50/50] staging: vchiq: Move vchiq.h into include directory Date: Tue, 23 Jun 2020 18:42:36 +0200 Message-Id: <20200623164235.29566-51-nsaenzjulienne@suse.de> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20200623164235.29566-1-nsaenzjulienne@suse.de> References: <20200623164235.29566-1-nsaenzjulienne@suse.de> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200623_174537_690357_B6F9BE56 X-CRM114-Status: GOOD ( 10.97 ) X-Spam-Score: -4.2 (----) X-Spam-Report: SpamAssassin version 3.4.4 on casper.infradead.org summary: Content analysis details: (-4.2 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- 0.0 RCVD_IN_MSPIKE_H3 RBL: Good reputation (+3) [195.135.220.15 listed in wl.mailspike.net] -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] -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] -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, 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 To make the separation clear between vchiq's header files and vchiq.h, which is to be used by services and is the 'public' API, move it into a dedicated includes directory. Signed-off-by: Nicolas Saenz Julienne --- drivers/staging/vc04_services/Makefile | 2 +- drivers/staging/vc04_services/bcm2835-audio/Makefile | 2 +- drivers/staging/vc04_services/bcm2835-audio/bcm2835.h | 2 +- .../vchiq_arm => include/linux/raspberrypi}/vchiq.h | 0 .../staging/vc04_services/interface/vchiq_arm/vchiq_core.h | 2 +- .../staging/vc04_services/interface/vchiq_arm/vchiq_ioctl.h | 2 +- drivers/staging/vc04_services/vchiq-mmal/Makefile | 1 + drivers/staging/vc04_services/vchiq-mmal/mmal-vchiq.c | 4 ++-- 8 files changed, 8 insertions(+), 7 deletions(-) rename drivers/staging/vc04_services/{interface/vchiq_arm => include/linux/raspberrypi}/vchiq.h (100%) diff --git a/drivers/staging/vc04_services/Makefile b/drivers/staging/vc04_services/Makefile index e02a9c2abf77..7546d70116a0 100644 --- a/drivers/staging/vc04_services/Makefile +++ b/drivers/staging/vc04_services/Makefile @@ -12,5 +12,5 @@ obj-$(CONFIG_SND_BCM2835) += bcm2835-audio/ obj-$(CONFIG_VIDEO_BCM2835) += bcm2835-camera/ obj-$(CONFIG_BCM2835_VCHIQ_MMAL) += vchiq-mmal/ -ccflags-y += -D__VCCOREVER__=0x04000000 +ccflags-y += -I $(srctree)/$(src)/include -D__VCCOREVER__=0x04000000 diff --git a/drivers/staging/vc04_services/bcm2835-audio/Makefile b/drivers/staging/vc04_services/bcm2835-audio/Makefile index 13fa6d7d9745..d59fe4dde615 100644 --- a/drivers/staging/vc04_services/bcm2835-audio/Makefile +++ b/drivers/staging/vc04_services/bcm2835-audio/Makefile @@ -2,4 +2,4 @@ obj-$(CONFIG_SND_BCM2835) += snd-bcm2835.o snd-bcm2835-objs := bcm2835.o bcm2835-ctl.o bcm2835-pcm.o bcm2835-vchiq.o -ccflags-y += -I $(srctree)/$(src)/.. -D__VCCOREVER__=0x04000000 +ccflags-y += -I $(srctree)/$(src)/../include -D__VCCOREVER__=0x04000000 diff --git a/drivers/staging/vc04_services/bcm2835-audio/bcm2835.h b/drivers/staging/vc04_services/bcm2835-audio/bcm2835.h index ca220f5230ec..1b36475872d6 100644 --- a/drivers/staging/vc04_services/bcm2835-audio/bcm2835.h +++ b/drivers/staging/vc04_services/bcm2835-audio/bcm2835.h @@ -6,10 +6,10 @@ #include #include +#include #include #include #include -#include "interface/vchiq_arm/vchiq.h" #define MAX_SUBSTREAMS (8) #define AVAIL_SUBSTREAMS_MASK (0xff) diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq.h b/drivers/staging/vc04_services/include/linux/raspberrypi/vchiq.h similarity index 100% rename from drivers/staging/vc04_services/interface/vchiq_arm/vchiq.h rename to drivers/staging/vc04_services/include/linux/raspberrypi/vchiq.h diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.h b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.h index 8a27f3d7217e..e67692879249 100644 --- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.h +++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.h @@ -10,10 +10,10 @@ #include #include #include +#include #include "vchiq_cfg.h" -#include "vchiq.h" /* Do this so that we can test-build the code on non-rpi systems */ #if IS_ENABLED(CONFIG_RASPBERRYPI_FIRMWARE) diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_ioctl.h b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_ioctl.h index f285d754ad28..3653fd99d8a1 100644 --- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_ioctl.h +++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_ioctl.h @@ -5,7 +5,7 @@ #define VCHIQ_IOCTLS_H #include -#include "vchiq.h" +#include #define VCHIQ_IOC_MAGIC 0xc4 #define VCHIQ_INVALID_HANDLE (~0) diff --git a/drivers/staging/vc04_services/vchiq-mmal/Makefile b/drivers/staging/vc04_services/vchiq-mmal/Makefile index f8164c33aec3..b2a830f48acc 100644 --- a/drivers/staging/vc04_services/vchiq-mmal/Makefile +++ b/drivers/staging/vc04_services/vchiq-mmal/Makefile @@ -5,4 +5,5 @@ obj-$(CONFIG_BCM2835_VCHIQ_MMAL) += bcm2835-mmal-vchiq.o ccflags-y += \ -I$(srctree)/$(src)/.. \ + -I$(srctree)/$(src)/../include \ -D__VCCOREVER__=0x04000000 diff --git a/drivers/staging/vc04_services/vchiq-mmal/mmal-vchiq.c b/drivers/staging/vc04_services/vchiq-mmal/mmal-vchiq.c index 72afa4319bd3..b99b7555a8fb 100644 --- a/drivers/staging/vc04_services/vchiq-mmal/mmal-vchiq.c +++ b/drivers/staging/vc04_services/vchiq-mmal/mmal-vchiq.c @@ -23,14 +23,14 @@ #include #include #include +#include #include +#include #include "mmal-common.h" #include "mmal-vchiq.h" #include "mmal-msg.h" -#include "interface/vchiq_arm/vchiq.h" - /* * maximum number of components supported. * This matches the maximum permitted by default on the VPU