Linux kernel staging patches
 help / color / mirror / Atom feed
From: Stefan Wahren <wahrenst@gmx.net>
To: Umang Jain <umang.jain@ideasonboard.com>, linux-staging@lists.linux.dev
Cc: Dan Carpenter <error27@gmail.com>,
	Kieran Bingham <kieran.bingham@ideasonboard.com>,
	Laurent Pinchart <laurent.pinchart@ideasonboard.com>,
	Dave Stevenson <dave.stevenson@raspberrypi.com>,
	Phil Elwell <phil@raspberrypi.com>, Greg KH <greg@kroah.com>
Subject: Re: [PATCH v5 04/11] staging: vc04_services: Move variables for tracking connections
Date: Sun, 14 Apr 2024 12:41:04 +0200	[thread overview]
Message-ID: <407ceb37-82f0-4eab-81ee-4df3f185618a@gmx.net> (raw)
In-Reply-To: <20240412075743.60712-5-umang.jain@ideasonboard.com>

Am 12.04.24 um 09:57 schrieb Umang Jain:
> Connections to the vchiq driver are tracked using global variables.
> Drop those and introduce them as members of struct vchiq_drv_mgmt.
> Hence, struct vchiq_drv_mgmt will be used to track the connections.
>
> Also, store a vchiq_drv_mgmt pointer to struct vchiq_device to
> have easy access to struct vchiq_drv_mgmt across vchiq devices.
>
> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
> Signed-off-by: Umang Jain <umang.jain@ideasonboard.com>
> ---
>   .../interface/vchiq_arm/vchiq_arm.c           |  3 +-
>   .../interface/vchiq_arm/vchiq_arm.h           |  9 +++++
>   .../interface/vchiq_arm/vchiq_bus.c           |  3 ++
>   .../interface/vchiq_arm/vchiq_bus.h           |  3 ++
>   .../interface/vchiq_arm/vchiq_connected.c     | 36 +++++++++----------
>   .../interface/vchiq_arm/vchiq_connected.h     |  4 ++-
>   6 files changed, 37 insertions(+), 21 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 af74d7268717..ac12ed0784a4 100644
> --- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c
> +++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c
> @@ -545,7 +545,8 @@ static int vchiq_platform_init(struct platform_device *pdev, struct vchiq_state
>   	dev_dbg(&pdev->dev, "arm: vchiq_init - done (slots %pK, phys %pad)\n",
>   		vchiq_slot_zero, &slot_phys);
>
> -	vchiq_call_connected_callbacks();
> +	mutex_init(&drv_mgmt->connected_mutex);
> +	vchiq_call_connected_callbacks(drv_mgmt);
>
>   	return 0;
>   }
> diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.h b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.h
> index 04683d98cd00..b4ed50e4072d 100644
> --- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.h
> +++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.h
> @@ -20,6 +20,8 @@
>   #define MAX_ELEMENTS 8
>   #define MSG_QUEUE_SIZE 128
>
> +#define VCHIQ_DRV_MAX_CALLBACKS 10
> +
>   struct rpi_firmware;
>
>   enum USE_TYPE_E {
> @@ -34,6 +36,13 @@ struct vchiq_platform_info {
>   struct vchiq_drv_mgmt {
>   	struct rpi_firmware *fw;
>   	const struct vchiq_platform_info *info;
> +
> +	bool connected;
> +	int num_deferred_callbacks;
> +	/* Protects connected and num_deferred_callbacks */
> +	struct mutex connected_mutex;
> +
> +	void (*deferred_callback[VCHIQ_DRV_MAX_CALLBACKS])(void);
>   };
>
>   struct user_service {
> diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_bus.c b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_bus.c
> index 93609716df84..3f87b93c6537 100644
> --- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_bus.c
> +++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_bus.c
> @@ -11,6 +11,7 @@
>   #include <linux/slab.h>
>   #include <linux/string.h>
>
> +#include "vchiq_arm.h"
>   #include "vchiq_bus.h"
>
>   static int vchiq_bus_type_match(struct device *dev, struct device_driver *drv)
> @@ -77,6 +78,8 @@ vchiq_device_register(struct device *parent, const char *name)
>   	device->dev.dma_mask = &device->dev.coherent_dma_mask;
>   	device->dev.release = vchiq_device_release;
>
> +	device->drv_mgmt = dev_get_drvdata(parent);
> +
>   	of_dma_configure(&device->dev, parent->of_node, true);
>
>   	ret = device_register(&device->dev);
> diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_bus.h b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_bus.h
> index 4db86e76edbd..9de179b39f85 100644
> --- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_bus.h
> +++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_bus.h
> @@ -9,8 +9,11 @@
>   #include <linux/device.h>
>   #include <linux/mod_devicetable.h>
>
> +struct vchiq_drv_mgmt;
> +
>   struct vchiq_device {
>   	struct device dev;
> +	struct vchiq_drv_mgmt *drv_mgmt;
>   };
>
>   struct vchiq_driver {
> diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_connected.c b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_connected.c
> index 4604a2f4d2de..049b3f2d1bd4 100644
> --- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_connected.c
> +++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_connected.c
> @@ -1,6 +1,7 @@
>   // SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause
>   /* Copyright (c) 2010-2012 Broadcom. All rights reserved. */
>
> +#include "vchiq_arm.h"
>   #include "vchiq_connected.h"
>   #include "vchiq_core.h"
>   #include <linux/module.h>
> @@ -8,11 +9,6 @@
>
>   #define  MAX_CALLBACKS  10
I think with the introduction of VCHIQ_DRV_MAX_CALLBACKS this define
should be removed in this patch and not in patch 5. So you will avoid
two different things in patch 5.

  reply	other threads:[~2024-04-14 10:41 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-04-12  7:57 [PATCH v5 00/11] staging: vc04_services: Drop non-essential global members Umang Jain
2024-04-12  7:57 ` [PATCH v5 01/11] staging: vc04_services: Drop g_once_init global variable Umang Jain
2024-04-14 10:23   ` Stefan Wahren
2024-04-12  7:57 ` [PATCH v5 02/11] staging: vc04_services: vchiq_arm: Split driver static and runtime data Umang Jain
2024-04-14 12:04   ` Stefan Wahren
2024-04-19 13:58   ` Stefan Wahren
2024-04-12  7:57 ` [PATCH v5 03/11] staging: vc04_services: vchiq_arm: Drop g_cache_line_size Umang Jain
2024-04-14 12:09   ` Stefan Wahren
2024-04-19 14:04   ` Stefan Wahren
2024-04-21  8:58     ` Umang Jain
2024-04-12  7:57 ` [PATCH v5 04/11] staging: vc04_services: Move variables for tracking connections Umang Jain
2024-04-14 10:41   ` Stefan Wahren [this message]
2024-04-12  7:57 ` [PATCH v5 05/11] staging: vc04_services: Drop vchiq_connected.[ch] files Umang Jain
2024-04-12  7:57 ` [PATCH v5 06/11] staging: vc04_services: Move global variables tracking allocated pages Umang Jain
2024-04-14 11:45   ` Stefan Wahren
2024-04-12  7:57 ` [PATCH v5 07/11] staging: vc04_services: Move global memory mapped pointer Umang Jain
2024-04-14 11:58   ` Stefan Wahren
2024-04-16  6:42     ` Laurent Pinchart
2024-04-12  7:57 ` [PATCH v5 08/11] staging: vc04_services: Move spinlocks to vchiq_state Umang Jain
2024-04-14 11:59   ` Stefan Wahren
2024-04-12  7:57 ` [PATCH v5 09/11] staging: vc04_services: vchiq_mmal: Rename service_callback() Umang Jain
2024-04-14 11:06   ` Stefan Wahren
2024-04-12  7:57 ` [PATCH v5 10/11] staging: vc04_services: Move global g_state to vchiq_state Umang Jain
2024-04-14 11:26   ` Stefan Wahren
2024-04-12  7:57 ` [PATCH v5 11/11] staging: vc04_services: Drop completed TODO item Umang Jain

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=407ceb37-82f0-4eab-81ee-4df3f185618a@gmx.net \
    --to=wahrenst@gmx.net \
    --cc=dave.stevenson@raspberrypi.com \
    --cc=error27@gmail.com \
    --cc=greg@kroah.com \
    --cc=kieran.bingham@ideasonboard.com \
    --cc=laurent.pinchart@ideasonboard.com \
    --cc=linux-staging@lists.linux.dev \
    --cc=phil@raspberrypi.com \
    --cc=umang.jain@ideasonboard.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).