mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Stefan Wahren <stefan.wahren@i2se.com>
To: Ojaswin Mujoo <ojaswin98@gmail.com>,
	nsaenz@kernel.org, gregkh@linuxfoundation.org
Cc: dan.carpenter@oracle.com, phil@raspberrypi.com,
	linux-arm-kernel@lists.infradead.org,
	linux-staging@lists.linux.dev, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/1] staging: vchiq: Replace global state with per device state
Date: Mon, 1 Nov 2021 13:19:17 +0100	[thread overview]
Message-ID: <84300618-98c8-0f44-e5a5-8d7fd6c853b0@i2se.com> (raw)
In-Reply-To: <5b51970f601c4bf5165fc70174085a809b3c0316.1635764115.git.ojaswin98@gmail.com>

Hi Ojaswin,

Am 01.11.21 um 12:09 schrieb Ojaswin Mujoo:
> Currently, the driver has a global g_state variable which is initialised
> during probe and directly used all over the driver code. However, this
> prevents the driver to support multiple VideoCore VPUs at the same time.
>
> Replace this global state with a per device state which is initialised
> and allocated during probing.
>
> Signed-off-by: Ojaswin Mujoo <ojaswin98@gmail.com>
...
>  
>  /*
> @@ -1763,6 +1795,7 @@ static int vchiq_probe(struct platform_device *pdev)
>  	struct device_node *fw_node;
>  	const struct of_device_id *of_id;
>  	struct vchiq_drvdata *drvdata;
> +	struct vchiq_device *vchiq_dev;
>  	int err;
>  
>  	of_id = of_match_node(vchiq_of_match, pdev->dev.of_node);
> @@ -1784,7 +1817,18 @@ static int vchiq_probe(struct platform_device *pdev)
>  
>  	platform_set_drvdata(pdev, drvdata);
>  
> -	err = vchiq_platform_init(pdev, &g_state);
> +	vchiq_dev = kzalloc(sizeof(struct vchiq_device), GFP_KERNEL);
> +	vchiq_dev->state = kzalloc(sizeof(struct vchiq_state), GFP_KERNEL);
> +	vchiq_dev->vchiq_pdev = *pdev;
> +
> +	g_state = vchiq_dev->state;
> +

just a quick idea: how about storing the global state within vchiq_drvdata?

So there is no need to reinvent somekind of vchiq device which is the
"same" as the platform device. After that you are able to access the
private driver data via platform_get_drvdata().

Best regards



  reply	other threads:[~2021-11-01 12:19 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-01 11:09 [PATCH 0/1] vchiq: Replacing global structs with per device Ojaswin Mujoo
2021-11-01 11:09 ` [PATCH 1/1] staging: vchiq: Replace global state with per device state Ojaswin Mujoo
2021-11-01 12:19   ` Stefan Wahren [this message]
2021-11-01 17:31     ` Ojaswin Mujoo
2021-11-01 18:58       ` Stefan Wahren
2021-11-01 16:07   ` kernel test robot
2021-11-01 16:45   ` kernel test robot

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=84300618-98c8-0f44-e5a5-8d7fd6c853b0@i2se.com \
    --to=stefan.wahren@i2se.com \
    --cc=dan.carpenter@oracle.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-staging@lists.linux.dev \
    --cc=nsaenz@kernel.org \
    --cc=ojaswin98@gmail.com \
    --cc=phil@raspberrypi.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

all inboxes | Powered by JetHome®