public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Greg KH <gregkh@linuxfoundation.org>
To: Moritz Fischer <mdf@kernel.org>
Cc: atull@kernel.org, linux-kernel@vger.kernel.org,
	linux-fpga@vger.kernel.org
Subject: Re: [PATCH 3/6] fpga: bridge: don't use drvdata in common fpga code
Date: Thu, 29 Mar 2018 19:04:20 +0200	[thread overview]
Message-ID: <20180329170420.GD8501@kroah.com> (raw)
In-Reply-To: <20180329153658.11614-4-mdf@kernel.org>

On Thu, Mar 29, 2018 at 08:36:55AM -0700, Moritz Fischer wrote:
> From: Alan Tull <atull@kernel.org>
> 
> Change fpga_bridge_register to not set drvdata.
> 
> Change the register/unregister functions parameters to take the
> bridge struct:
> * int fpga_bridge_register(struct fpga_bridge *bridge);
> * void fpga_bridge_unregister(struct fpga_bridge *bridge);
> 
> Change the drivers that call fpga_bridge_register to alloc the struct
> fpga_bridge (using devm_kzalloc) and partly fill it, adding name,
> ops, parent device, and priv.
> 
> The rationale is that setting drvdata is fine for DT based devices
> that will have one manager, bridge, or region per platform device.
> However PCIe based devices may have multiple FPGA mgr/bridge/regions
> under one pcie device.  Without these changes, the PCIe solution has
> to create an extra device for each child mgr/bridge/region to hold
> drvdata.
> 
> Signed-off-by: Alan Tull <atull@kernel.org>
> Reported-by: Jiuyue Ma <majiuyue@huawei.com>
> Signed-off-by: Moritz Fischer <mdf@kernel.org>
> ---
>  drivers/fpga/altera-fpga2sdram.c    | 20 +++++++++++++----
>  drivers/fpga/altera-freeze-bridge.c | 18 +++++++++++++---
>  drivers/fpga/altera-hps2fpga.c      | 16 +++++++++++---
>  drivers/fpga/fpga-bridge.c          | 43 ++++++++++++++-----------------------
>  drivers/fpga/xilinx-pr-decoupler.c  | 15 ++++++++++---
>  include/linux/fpga/fpga-bridge.h    |  7 +++---
>  6 files changed, 76 insertions(+), 43 deletions(-)
> 
> diff --git a/drivers/fpga/altera-fpga2sdram.c b/drivers/fpga/altera-fpga2sdram.c
> index d4eeb74388da..a4593c0f5e42 100644
> --- a/drivers/fpga/altera-fpga2sdram.c
> +++ b/drivers/fpga/altera-fpga2sdram.c
> @@ -106,10 +106,15 @@ static int alt_fpga_bridge_probe(struct platform_device *pdev)
>  {
>  	struct device *dev = &pdev->dev;
>  	struct alt_fpga2sdram_data *priv;
> +	struct fpga_bridge *br;
>  	u32 enable;
>  	struct regmap *sysmgr;
>  	int ret = 0;
>  
> +	br = devm_kzalloc(dev, sizeof(*br), GFP_KERNEL);
> +	if (!br)
> +		return -ENOMEM;
> +
>  	priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL);
>  	if (!priv)
>  		return -ENOMEM;
> @@ -131,8 +136,13 @@ static int alt_fpga_bridge_probe(struct platform_device *pdev)
>  	/* Get f2s bridge configuration saved in handoff register */
>  	regmap_read(sysmgr, SYSMGR_ISWGRP_HANDOFF3, &priv->mask);
>  
> -	ret = fpga_bridge_register(dev, F2S_BRIDGE_NAME,
> -				   &altera_fpga2sdram_br_ops, priv);
> +	br->parent = dev;
> +	br->name = F2S_BRIDGE_NAME;
> +	br->br_ops = &altera_fpga2sdram_br_ops;
> +	br->priv = priv;
> +	platform_set_drvdata(pdev, br);

Same question here, why not fpga_bridge_create(...)?

thanks,

greg k-h

  reply	other threads:[~2018-03-29 17:04 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-03-29 15:36 [PATCH 0/6] FPGA Manager Patches for 4.17 Moritz Fischer
2018-03-29 15:36 ` [PATCH 1/6] fpga: region: don't use drvdata in common fpga code Moritz Fischer
2018-03-29 17:01   ` Greg KH
2018-03-29 20:38     ` Alan Tull
2018-03-29 15:36 ` [PATCH 2/6] fpga: manager: " Moritz Fischer
2018-03-29 17:03   ` Greg KH
2018-03-29 18:26     ` Alan Tull
2018-03-30  9:09       ` Greg KH
2018-03-29 15:36 ` [PATCH 3/6] fpga: bridge: " Moritz Fischer
2018-03-29 17:04   ` Greg KH [this message]
2018-03-29 15:36 ` [PATCH 4/6] fpga: region: change fpga_region_register to have one param Moritz Fischer
2018-03-29 17:06   ` Greg KH
2018-03-29 20:42     ` Alan Tull
2018-03-29 21:39       ` Moritz Fischer
2018-03-30 15:27         ` Alan Tull
2018-03-29 15:36 ` [PATCH 5/6] fpga: fpga-region: comment on fpga_region_program_fpga locking Moritz Fischer
2018-03-29 15:36 ` [PATCH 6/6] fpga-manager: altera-ps-spi: preserve nCONFIG state Moritz Fischer
2018-03-29 16:59 ` [PATCH 0/6] FPGA Manager Patches for 4.17 Greg KH

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=20180329170420.GD8501@kroah.com \
    --to=gregkh@linuxfoundation.org \
    --cc=atull@kernel.org \
    --cc=linux-fpga@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mdf@kernel.org \
    /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