From patchwork Wed May 18 19:11:17 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adrien Thierry X-Patchwork-Id: 12854009 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 8FFE0C433F5 for ; Wed, 18 May 2022 19:14:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=swwUEklw9jyz1JDm523qMEq6KYFyrPjleK1l+knlE9w=; b=L11fSLhbV3hNKP rd6uADmsRbD86lTFJvfsgA97K9kQEnglTkrzim5sOxR5UYhlEvwrAaWSQTeFR0WWTdn2pI0ZK+Xfy pRhqkqlvRv2RkRi4yAtDImu90mCCOMKj2yOdGuN6uO+S18AnYfki4K/9bRbyTT78XAJ9joy1Zmvit UTIqonqUi+W/tAiLmeABfPVBZyayee85KDmRI2UoWEaeZVdM/MwaLBCOtr1Fvwl+2n34dqnA6kiXv 6KDAFjUg3ozczpObsIhDA+VcPBJU+HLrv8HQrtxTarQJPGG8Ud4gls22N+QqJ28NWbTteMN1YTcxf Hcvi00DOaWaP+vqFXKeA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nrP76-003Yf4-NU; Wed, 18 May 2022 19:13:41 +0000 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1nrP5h-003Y3Y-0E for linux-arm-kernel@lists.infradead.org; Wed, 18 May 2022 19:12:17 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1652901131; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=YHgYvCWJ1ZclCBJ4AaTahh2YKvVrozHphEEISDC4gW4=; b=fSxTTp1eMklkNjWbGdI4eAcbWfRuxGvayphHQcBBaHhxez/73JwkWbN+MwcJ/bbGGnfRpM 7z1YC1jqWf+gaH6sY8Ud89cnpvWcqZ22oeX9wibegX9BcmtQ1Hj43BLr6inziHRK2W0Eqp at79gD5g9KSAzjvowLkqgBkDfPSPQrg= Received: from mail-qk1-f197.google.com (mail-qk1-f197.google.com [209.85.222.197]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-473-vS8F0J3sMdGB07ApI6TSMQ-1; Wed, 18 May 2022 15:12:10 -0400 X-MC-Unique: vS8F0J3sMdGB07ApI6TSMQ-1 Received: by mail-qk1-f197.google.com with SMTP id q5-20020a05620a0d8500b004738c1b48beso2257022qkl.7 for ; Wed, 18 May 2022 12:12:10 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=YHgYvCWJ1ZclCBJ4AaTahh2YKvVrozHphEEISDC4gW4=; b=oXz+oKMETQ9P8D+Jq0NY/rtJaGfeqZyurTzvT9ug+QF7UcjAbdQLDYxV4f/J2kD1ZC an+ZApvxN1DbgHRa26GOluu4hXPKqq7ln/QVvkjmVa6SNJZO3SqdN5NLoisBP5t4vzn1 m9idYVW2ljpw8OHUHfYEUeXulIgu0EKe+sPeZfBGJQuzALu7SUHzucN92yKY5inWbUz8 ilDY30vMXamsxgxuxitKN0fmtknwIYGs7oW2xzzM9w826fxZja2vaiN9KllteR7eSQ8d tSUzLJuPhX3A7Jqxt340nrGksJMRLkUu/CZxw5Ygy5BDHLer68JuXRMDm2JFCiBDfsJT vJ0g== X-Gm-Message-State: AOAM531Fwt0W/ftTH8aPO2qf24JtPyDCC+zK7UI/1YT1y3VL6vp29nZ/ 3vFp6F4yuVfaPF5j+Yps4ydiQaM3AvdkYBXbwHYByKtte1VExLeNmF7rPQlOcbgBsxJXdP8FFhB wu6uRwCFvTvsfo6Yyo9TT1V4rHB5AEa5FifY= X-Received: by 2002:ac8:5e0c:0:b0:2f3:adfd:bd30 with SMTP id h12-20020ac85e0c000000b002f3adfdbd30mr1127872qtx.277.1652901130043; Wed, 18 May 2022 12:12:10 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw/EUV6JDOP0YocXPPDX5Y0ERBRZOeYORhcYNAJJR73zaqv4XXbB1uLv1okyVxUQqLD1seerg== X-Received: by 2002:ac8:5e0c:0:b0:2f3:adfd:bd30 with SMTP id h12-20020ac85e0c000000b002f3adfdbd30mr1127847qtx.277.1652901129783; Wed, 18 May 2022 12:12:09 -0700 (PDT) Received: from fedora.hitronhub.home (modemcable200.11-22-96.mc.videotron.ca. [96.22.11.200]) by smtp.gmail.com with ESMTPSA id z190-20020a37b0c7000000b006a32d491f92sm39183qke.39.2022.05.18.12.12.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 May 2022 12:12:09 -0700 (PDT) From: Adrien Thierry To: Greg Kroah-Hartman , Nicolas Saenz Julienne , Florian Fainelli , Ray Jui , Scott Branden , bcm-kernel-feedback-list@broadcom.com Cc: Stefan Wahren , Adrien Thierry , linux-staging@lists.linux.dev, linux-rpi-kernel@lists.infradead.org, linux-arm-kernel@lists.infradead.org Subject: [PATCH v2 6/9] staging: vchiq_arm: pass vchiq instance to 'vchiq_get_service_userdata' Date: Wed, 18 May 2022 15:11:17 -0400 Message-Id: <20220518191126.60396-7-athierry@redhat.com> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20220518191126.60396-1-athierry@redhat.com> References: <20220518191126.60396-1-athierry@redhat.com> MIME-Version: 1.0 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=athierry@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220518_121213_186178_33833672 X-CRM114-Status: GOOD ( 14.64 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org In order to remove the 'vchiq_states' global array, we need to pass the vchiq_instance reference to the 'handle_to_service' function, as well as to all functions that call 'handle_to_service'. This will allow accessing the vchiq state through the vchiq instance instead of through the global array. 'handle_to_service' is called by 'vchiq_get_service_userdata'. Therefore, pass the vchiq instance reference to it. Signed-off-by: Adrien Thierry --- drivers/staging/vc04_services/bcm2835-audio/bcm2835-vchiq.c | 3 ++- .../staging/vc04_services/include/linux/raspberrypi/vchiq.h | 2 +- drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c | 2 +- drivers/staging/vc04_services/vchiq-mmal/mmal-vchiq.c | 2 +- 4 files changed, 5 insertions(+), 4 deletions(-) diff --git a/drivers/staging/vc04_services/bcm2835-audio/bcm2835-vchiq.c b/drivers/staging/vc04_services/bcm2835-audio/bcm2835-vchiq.c index aa2ab0df7af5..f4c2c9506d86 100644 --- a/drivers/staging/vc04_services/bcm2835-audio/bcm2835-vchiq.c +++ b/drivers/staging/vc04_services/bcm2835-audio/bcm2835-vchiq.c @@ -96,7 +96,8 @@ static enum vchiq_status audio_vchi_callback(struct vchiq_instance *vchiq_instan struct vchiq_header *header, unsigned int handle, void *userdata) { - struct bcm2835_audio_instance *instance = vchiq_get_service_userdata(handle); + struct bcm2835_audio_instance *instance = vchiq_get_service_userdata(vchiq_instance, + handle); struct vc_audio_msg *m; if (reason != VCHIQ_MESSAGE_AVAILABLE) diff --git a/drivers/staging/vc04_services/include/linux/raspberrypi/vchiq.h b/drivers/staging/vc04_services/include/linux/raspberrypi/vchiq.h index 0d3833e9773c..db1441c0cc66 100644 --- a/drivers/staging/vc04_services/include/linux/raspberrypi/vchiq.h +++ b/drivers/staging/vc04_services/include/linux/raspberrypi/vchiq.h @@ -109,7 +109,7 @@ extern enum vchiq_status vchiq_bulk_transmit(struct vchiq_instance *instance, un extern enum vchiq_status vchiq_bulk_receive(struct vchiq_instance *instance, 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 void *vchiq_get_service_userdata(struct vchiq_instance *instance, unsigned int service); extern enum vchiq_status vchiq_get_peer_version(struct vchiq_instance *instance, unsigned int handle, short *peer_version); 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 d6853e23564c..d4fed18b1baa 100644 --- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c +++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c @@ -411,7 +411,7 @@ vchiq_get_client_id(struct vchiq_instance *instance, unsigned int handle) } void * -vchiq_get_service_userdata(unsigned int handle) +vchiq_get_service_userdata(struct vchiq_instance *instance, unsigned int handle) { void *userdata; struct vchiq_service *service; diff --git a/drivers/staging/vc04_services/vchiq-mmal/mmal-vchiq.c b/drivers/staging/vc04_services/vchiq-mmal/mmal-vchiq.c index 4c29cb7794a1..cb921c94996a 100644 --- a/drivers/staging/vc04_services/vchiq-mmal/mmal-vchiq.c +++ b/drivers/staging/vc04_services/vchiq-mmal/mmal-vchiq.c @@ -553,7 +553,7 @@ static enum vchiq_status service_callback(struct vchiq_instance *vchiq_instance, struct vchiq_header *header, unsigned int handle, void *bulk_ctx) { - struct vchiq_mmal_instance *instance = vchiq_get_service_userdata(handle); + struct vchiq_mmal_instance *instance = vchiq_get_service_userdata(vchiq_instance, handle); u32 msg_len; struct mmal_msg *msg; struct mmal_msg_context *msg_context;