linux-pci.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Magnus Damm <magnus.damm@gmail.com>
To: Geert Uytterhoeven <geert@linux-m68k.org>
Cc: linux-pci@vger.kernel.org,
	Linux-sh list <linux-sh@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	Valentine <valentine.barshak@cogentembedded.com>,
	Simon Horman <horms@verge.net.au>,
	Bjorn Helgaas <bhelgaas@google.com>,
	Ben Dooks <ben.dooks@codethink.co.uk>
Subject: Re: [PATCH 01/04] PCI: rcar: Register each instance independently
Date: Wed, 5 Feb 2014 17:39:13 +0900	[thread overview]
Message-ID: <CANqRtoTLdBVj9EF2nsZm2QXc-gCGigB8vfsVJGCjS1Ger0zFTg@mail.gmail.com> (raw)
In-Reply-To: <CAMuHMdVrkPybrONnw5fZaMZ-vuaq_arrBMZvnRYZ9EnvE8Y4cA@mail.gmail.com>

On Wed, Feb 5, 2014 at 5:02 PM, Geert Uytterhoeven <geert@linux-m68k.org> wrote:
> On Wed, Feb 5, 2014 at 7:52 AM, Magnus Damm <magnus.damm@gmail.com> wrote:
>> +static int rcar_pci_probe(struct platform_device *pdev)
>>  {
>>         struct resource *cfg_res, *mem_res;
>>         struct rcar_pci_priv *priv;
>>         void __iomem *reg;
>> +       struct hw_pci hw;
>>
>>         cfg_res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
>>         reg = devm_ioremap_resource(&pdev->dev, cfg_res);
>> @@ -308,31 +271,26 @@ static int __init rcar_pci_probe(struct
>>         priv->reg = reg;
>>         priv->dev = &pdev->dev;
>>
>> -       return rcar_pci_add_controller(priv);
>> +       memset(&hw, 0, sizeof(hw));
>> +       hw.nr_controllers = 1;
>> +       hw.private_data = (void **)&priv;
>
> This raised a red flag: taking the address of a variable on the stack.
> I know it's correct, as hw.private_data is an array of pointers copied
> by pci_common_init_dev() below.
> But perhaps it's a good idea to turn priv into an array with one element,
> to make this clearer, and avoid the ugly cast?

I simply followed the same style as pci-tegra.c, but I agree that it
can be made prettier. Also, there may be some better way how to
register independent instances, not sure.

Thanks,

/ magnus

  reply	other threads:[~2014-02-05  8:39 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-02-05  6:52 [PATCH 00/04] PCI: rcar: Driver model and physical address space update Magnus Damm
2014-02-05  6:52 ` [PATCH 01/04] PCI: rcar: Register each instance independently Magnus Damm
2014-02-05  8:02   ` Geert Uytterhoeven
2014-02-05  8:39     ` Magnus Damm [this message]
2014-02-05  8:29   ` Ben Dooks
2014-02-05  8:43     ` Magnus Damm
2014-02-05  6:53 ` [PATCH 02/04] PCI: rcar: Break out window size handling Magnus Damm
2014-02-05  6:53 ` [PATCH 03/04] PCI: rcar: Add DMABOUNCE support Magnus Damm
2014-02-05  6:53 ` [PATCH 04/04] PCI: rcar: Enable BOUNCE in case of HIGHMEM Magnus Damm
2014-02-05  8:33 ` [PATCH 00/04] PCI: rcar: Driver model and physical address space update Ben Dooks
2014-02-05  9:00   ` Magnus Damm
2014-02-05  9:25     ` Ben Dooks
2014-02-05  9:40       ` Magnus Damm
2014-02-05 10:12         ` Ben Dooks
2014-02-12 20:59 ` Bjorn Helgaas
2014-02-13  4:37   ` Simon Horman

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=CANqRtoTLdBVj9EF2nsZm2QXc-gCGigB8vfsVJGCjS1Ger0zFTg@mail.gmail.com \
    --to=magnus.damm@gmail.com \
    --cc=ben.dooks@codethink.co.uk \
    --cc=bhelgaas@google.com \
    --cc=geert@linux-m68k.org \
    --cc=horms@verge.net.au \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=linux-sh@vger.kernel.org \
    --cc=valentine.barshak@cogentembedded.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 NNTP newsgroup(s).