From patchwork Wed May 18 19:11:18 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adrien Thierry X-Patchwork-Id: 12854010 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 C1DC4C433EF for ; Wed, 18 May 2022 19:15:12 +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=fA7vfadhkFXEIZ3RrWXV9ENgHyz25VdHy8oRkHkUB1U=; b=dfpG2VQQlBjCha k6g6HqBxx6zMHzmxHybv8cxTFtI9hNh3E5UD7LmZYAOo1vmuUkVJndY6/hoahywFQfNQvBRpYg1jC ad6hu5SCFdBBvwm673FTMLcMepdX022IzHwhf3VGZTcPbzuJssuRt7rayTJmb1tEmngRi5fIjiFnh macI00Y5ftU0U0Wb15QVGIP7Qkb4Z1uOHcC4m/Gt0AUx4aGwyUhb18MvhCRfo2vrN9zyeuXL5lAmG iyyMu3IA/LOGt3uDQNTbvvbDuujosURYEi04yQSqw1w9s2ZQTirm1HLBRKfJr/hV/HcLfmtkbK1tx 9/7UUHDLow/k4cug6agg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nrP7Q-003Yo8-Cb; Wed, 18 May 2022 19:14:00 +0000 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1nrP5i-003Y4O-Eb for linux-arm-kernel@lists.infradead.org; Wed, 18 May 2022 19:12:19 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1652901133; 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=sg20xHDfgN1BOulN0eUcyhyNQewPpaOynO81ybyXei4=; b=cCU4g46VbC/Rjck83uUySJ0hfNq4DGb4YL8I1IPUJiMmi3Cxi+ORmbpJrS/Y2lclGPjKPr UMCswjT0LAX/SIKzeYC6QG9hKIric98RhQyHnX+p9uBTkwoQ7iir33UzAR9prOXmV1C4R7 +Ux1oEs1ptnefubYkICthbwk/nga+ok= Received: from mail-qk1-f199.google.com (mail-qk1-f199.google.com [209.85.222.199]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-108-fogCgGgKMICqWgCUWoUpNQ-1; Wed, 18 May 2022 15:12:12 -0400 X-MC-Unique: fogCgGgKMICqWgCUWoUpNQ-1 Received: by mail-qk1-f199.google.com with SMTP id c84-20020a379a57000000b0069fcf83c373so2223024qke.20 for ; Wed, 18 May 2022 12:12:12 -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=sg20xHDfgN1BOulN0eUcyhyNQewPpaOynO81ybyXei4=; b=fxSoSVZQfaGObF/Ya4CjI4vJb7FEWMpKFmGgdAPcNCKbkQQPf3VaKQwlrKg1X/7Yh6 wCOuvjJmT+Qy1MhAHI6QcImd2nj8WHdIEr0eO/Xn0URL5JK39zeHb7chBSKP408EU2fw E2u1XWnZzquoM3Jr6AYGL5vqKUOInAjPCDuNOlrDPmimxlgMXLy4zrn5YrOgGhNKL0zz PQiyfmHTldJCM/1llU2iYjSU34hs8WDD016BqUR9GJwV3ZXKLrawtVxEYASCUqmwnsUV +FnmYgVboQvN4+XCs6f8o3kctz6kvh/Sb22A8n3qthvAaNqu4e0ar+T0ksnOfzO6E0NV iK7A== X-Gm-Message-State: AOAM532utKgAk/SgLQeObx86SwF5iq0fp2R//VBlpWzPQLrPs72JYzdn WhNSRHVdCfbvSV9SERJyGn2xnoUViQ/SvK0IA+1ym8u6smkfeNlu6MGRQiVX762IOW/F6HSF6OL sUZB3V+L4R3V4uoQ6RRtfCKCazBdtNkQvAuc= X-Received: by 2002:ac8:5714:0:b0:2f3:b4b0:6fd6 with SMTP id 20-20020ac85714000000b002f3b4b06fd6mr1112664qtw.651.1652901132057; Wed, 18 May 2022 12:12:12 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwh0+WH0NPDmgbKF6DlJhlfeSM9pTOADC8yCFrSczYQJ12yEUnIZSa+7/ysBsupBMjymlmmzA== X-Received: by 2002:ac8:5714:0:b0:2f3:b4b0:6fd6 with SMTP id 20-20020ac85714000000b002f3b4b06fd6mr1112649qtw.651.1652901131856; Wed, 18 May 2022 12:12:11 -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.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 May 2022 12:12:11 -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 7/9] staging: vchiq_arm: pass vchiq instance to 'handle_to_service' Date: Wed, 18 May 2022 15:11:18 -0400 Message-Id: <20220518191126.60396-8-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_121214_621044_EE1CE1AE X-CRM114-Status: GOOD ( 14.19 ) 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. This will allow accessing the vchiq state through the vchiq instance instead of through the global array. Signed-off-by: Adrien Thierry --- .../vc04_services/interface/vchiq_arm/vchiq_arm.c | 2 +- .../vc04_services/interface/vchiq_arm/vchiq_core.c | 10 +++++----- .../vc04_services/interface/vchiq_arm/vchiq_core.h | 2 +- 3 files changed, 7 insertions(+), 7 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 a5f0a756b32c..3bcb893d14a1 100644 --- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c +++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c @@ -1059,7 +1059,7 @@ service_callback(struct vchiq_instance *instance, enum vchiq_reason reason, DEBUG_TRACE(SERVICE_CALLBACK_LINE); rcu_read_lock(); - service = handle_to_service(handle); + service = handle_to_service(instance, handle); if (WARN_ON(!service)) { rcu_read_unlock(); return VCHIQ_SUCCESS; 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 d4fed18b1baa..be2ee84686b7 100644 --- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c +++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c @@ -240,7 +240,7 @@ find_service_by_handle(struct vchiq_instance *instance, unsigned int handle) struct vchiq_service *service; rcu_read_lock(); - service = handle_to_service(handle); + service = handle_to_service(instance, handle); if (service && service->srvstate != VCHIQ_SRVSTATE_FREE && service->handle == handle && kref_get_unless_zero(&service->ref_count)) { @@ -281,7 +281,7 @@ find_service_for_instance(struct vchiq_instance *instance, unsigned int handle) struct vchiq_service *service; rcu_read_lock(); - service = handle_to_service(handle); + service = handle_to_service(instance, handle); if (service && service->srvstate != VCHIQ_SRVSTATE_FREE && service->handle == handle && service->instance == instance && @@ -302,7 +302,7 @@ find_closed_service_for_instance(struct vchiq_instance *instance, unsigned int h struct vchiq_service *service; rcu_read_lock(); - service = handle_to_service(handle); + service = handle_to_service(instance, handle); if (service && (service->srvstate == VCHIQ_SRVSTATE_FREE || service->srvstate == VCHIQ_SRVSTATE_CLOSED) && @@ -404,7 +404,7 @@ vchiq_get_client_id(struct vchiq_instance *instance, unsigned int handle) int id; rcu_read_lock(); - service = handle_to_service(handle); + service = handle_to_service(instance, handle); id = service ? service->client_id : 0; rcu_read_unlock(); return id; @@ -417,7 +417,7 @@ vchiq_get_service_userdata(struct vchiq_instance *instance, unsigned int handle) struct vchiq_service *service; rcu_read_lock(); - service = handle_to_service(handle); + service = handle_to_service(instance, handle); userdata = service ? service->base.userdata : NULL; rcu_read_unlock(); return userdata; 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 45c3d7d1a86a..07c3a82e6084 100644 --- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.h +++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.h @@ -510,7 +510,7 @@ request_poll(struct vchiq_state *state, struct vchiq_service *service, int poll_type); static inline struct vchiq_service * -handle_to_service(unsigned int handle) +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) &