From patchwork Wed May 18 19:11:19 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adrien Thierry X-Patchwork-Id: 12854011 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 6CB1DC433EF for ; Wed, 18 May 2022 19:15:44 +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=9b72EgMquutjBUF9vrxZ2IzxPJ3ybRWISk15N8KiD/Q=; b=IPq81clD0AHt3a GaecBC9riWhrz1c6OeGwwPcUxPpsFAUEXxXULTD8s4EByiaHwZTRr8eYhf8C+P5kPg9kCsG2s6sUb K4xLC3ZNvyeWqGAfsdDp07b7FhdTxr1KhlfRpxHwd82N5/I66Ys2kwc/X/KZEPPNEPdhA37o72acQ BbBYKWLMel3N4SPtLCcr7ALYHKiHIcOpATSJTxthXx98q72woJClDgE7SvSSLiQE747PTz1tQUWBv lWhuOu17o40auIyleDaHXMmmgmROGq8R4AvpqTk86vNtNmymxyAaE3k7EDHVjFu1yaBinckeX8pj9 oHMimWYkQFvhBQdHafEg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nrP7r-003Z0T-1H; Wed, 18 May 2022 19:14:27 +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 1nrP5k-003Y5b-15 for linux-arm-kernel@lists.infradead.org; Wed, 18 May 2022 19:12:21 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1652901135; 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=3kHmkFKa8N/b7P5EPu8Whry0f5IeaDhnc3ZXcXoC+G4=; b=IVomtGgeKdPhH3lf5jWSm2Cs+ukGo0rxMZVQQRf2tH8R2mlUzRx8fF4zMktmMYN8qShEmU f+pSD2VL0nxo3vFWCr7JdFyD9SkZnL2fa1WdWYajuQmAYXgRUX2iIuIBi+1Q/gzjw0yAas Kw+CkVEwYH6hnBz2EH6MWkqD9BpeJ0U= Received: from mail-qt1-f199.google.com (mail-qt1-f199.google.com [209.85.160.199]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-609-mxOaBJYdPou8s98y5FNrNg-1; Wed, 18 May 2022 15:12:14 -0400 X-MC-Unique: mxOaBJYdPou8s98y5FNrNg-1 Received: by mail-qt1-f199.google.com with SMTP id ay35-20020a05622a22a300b002f3fdcb1bb1so2371609qtb.8 for ; Wed, 18 May 2022 12:12:14 -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=3kHmkFKa8N/b7P5EPu8Whry0f5IeaDhnc3ZXcXoC+G4=; b=ZzLrclXt9LxpE/2Ke536hekBE1EOYqHiu+vL0+jGU885MyRtkyT4xXgUAGTbf0eAzL n4K4zgRaWpEltkEsB+U+biRrPWV+m+IrnzOv3SU22gnV6ULlr26pGvBDCk/4zDY5SOI+ md6yC3A4/arma6dpxvV8uYuMy1ZnLX5CN4gXKSC8OZllAumvsMSWD93VgxmL9LtSTg5E cTxCpZRWiDMXuQB7xkFXXHuwOn88AgwpvDvp7LkHORduv5lW+U4s8cGXkxm+hgGdlGaC la9gYEshS0OOOKSJF1C8ilLtk5RRuDzWLjg79XK+dLX3Y3mNhEkvjs/tapLQYMtVb/87 EPJQ== X-Gm-Message-State: AOAM532qzcg8WDtwxSYmL1HfznpRydLv6z0wgnzpuNvpqloVqpfzYfun WKK27fG5qaMYCcSdlC2u4DGC80JgGHQdiuDpJngKCm5GSehdyiALcSfkHtWHFkCgCVe6eVyp7ym J7N/ly7MKUahZSyViBPC5aIslDSw3McEEy6c= X-Received: by 2002:a05:622a:4d4:b0:2f3:c529:5f89 with SMTP id q20-20020a05622a04d400b002f3c5295f89mr1212230qtx.158.1652901133747; Wed, 18 May 2022 12:12:13 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyDTpVg+9NwiSLmevtf5g+Ysj1N5cOOcjxsuXhAJ6Go3ij17Z9lOG95DL7dwjCExXMq08rimA== X-Received: by 2002:a05:622a:4d4:b0:2f3:c529:5f89 with SMTP id q20-20020a05622a04d400b002f3c5295f89mr1212210qtx.158.1652901133568; Wed, 18 May 2022 12:12:13 -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.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 May 2022 12:12:13 -0700 (PDT) From: Adrien Thierry To: Nicolas Saenz Julienne , Greg Kroah-Hartman Cc: Stefan Wahren , Adrien Thierry , bcm-kernel-feedback-list@broadcom.com, linux-rpi-kernel@lists.infradead.org, linux-arm-kernel@lists.infradead.org, linux-staging@lists.linux.dev Subject: [PATCH v2 8/9] staging: vchiq_arm: use state from vchiq instance Date: Wed, 18 May 2022 15:11:19 -0400 Message-Id: <20220518191126.60396-9-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_121216_216523_1BBCF5DA X-CRM114-Status: GOOD ( 13.05 ) 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 'handle_to_service', access the vchiq state from the vchiq instance instead of the global 'vchiq_states' array. This will allow getting rid of the global 'vchiq_states' array. Signed-off-by: Adrien Thierry --- .../vc04_services/interface/vchiq_arm/vchiq_core.c | 7 +++++++ .../vc04_services/interface/vchiq_arm/vchiq_core.h | 12 +----------- 2 files changed, 8 insertions(+), 11 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 be2ee84686b7..cd23d18f8b3c 100644 --- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c +++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c @@ -13,6 +13,7 @@ #include #include +#include "vchiq_arm.h" #include "vchiq_core.h" #define VCHIQ_SLOT_HANDLER_STACK 8192 @@ -234,6 +235,12 @@ set_service_state(struct vchiq_service *service, int newstate) service->srvstate = newstate; } +struct vchiq_service *handle_to_service(struct vchiq_instance *instance, unsigned int handle) +{ + int idx = handle & (VCHIQ_MAX_SERVICES - 1); + + return rcu_dereference(instance->state->services[idx]); +} struct vchiq_service * find_service_by_handle(struct vchiq_instance *instance, unsigned int handle) { 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 07c3a82e6084..f87b4b9b3596 100644 --- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.h +++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.h @@ -509,17 +509,7 @@ extern void request_poll(struct vchiq_state *state, struct vchiq_service *service, int poll_type); -static inline struct vchiq_service * -handle_to_service(struct vchiq_instance *instance, unsigned int handle) -{ - int idx = handle & (VCHIQ_MAX_SERVICES - 1); - struct vchiq_state *state = vchiq_states[(handle / VCHIQ_MAX_SERVICES) & - (VCHIQ_MAX_STATES - 1)]; - - if (!state) - return NULL; - return rcu_dereference(state->services[idx]); -} +struct vchiq_service *handle_to_service(struct vchiq_instance *instance, unsigned int handle); extern struct vchiq_service * find_service_by_handle(struct vchiq_instance *instance, unsigned int handle);