public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Johannes Thumshirn <morbidrsa@gmail.com>
To: Filip Jensen <dev-Felipe.Jensen@duagon.com>
Cc: linux-kernel@vger.kernel.org,
	 Jose Javier Rodriguez Barbarin
	<dev-josejavier.rodriguez@duagon.com>
Subject: Re: [PATCH v2 1/2] mcb: Use more than the first bar in pci devices
Date: Tue, 03 Mar 2026 18:12:03 +0100	[thread overview]
Message-ID: <m2pl5k25y4.fsf@MacBookPro.fritz.box> (raw)
In-Reply-To: <20260302134703.29913-2-dev-Felipe.Jensen@duagon.com> (Filip Jensen's message of "Mon, 2 Mar 2026 14:47:02 +0100")

Filip Jensen @ 2026-03-02 14:47 :


> +static int chameleon_get_bar(void __iomem **base, struct chameleon_bar **cb,
> +			     struct device *dev)
>  {
>  	struct chameleon_bar *c;
>  	int bar_count;
>  	__le32 reg;
>  	u32 dtype;
> +	struct pci_dev *pdev;

Sorry for not having noticed this in v1 but this...

>  	/*
>  	 * For those devices which are not connected
> @@ -153,12 +155,15 @@ static int chameleon_get_bar(void __iomem **base, phys_addr_t mapbase,
>  		chameleon_parse_bar(*base, c, bar_count);
>  		*base += BAR_DESC_SIZE(bar_count);
>  	} else {

can be declared here, as it's not used outside of this block.

> -		c = kzalloc_obj(struct chameleon_bar);
> +		pdev = to_pci_dev(dev);
> +		bar_count = PCI_STD_NUM_BARS;
> +		c = kzalloc_objs(struct chameleon_bar, bar_count);
>  		if (!c)
>  			return -ENOMEM;
> -
> -		bar_count = 1;
> -		c->addr = mapbase;
> +		for (int i = 0; i < bar_count; ++i) {
> +			c[i].addr = pci_resource_start(pdev, i);
> +			c[i].size = pci_resource_len(pdev, i);
> +		}
>  	}

  reply	other threads:[~2026-03-03 17:12 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-02 13:47 [PATCH v2 0/2] mcb: enable register PCI devices using any BAR Filip Jensen
2026-03-02 13:47 ` [PATCH v2 1/2] mcb: Use more than the first bar in pci devices Filip Jensen
2026-03-03 17:12   ` Johannes Thumshirn [this message]
2026-03-02 13:47 ` [PATCH v2 2/2] mcb: refactor the bus operations out of the common code Filip Jensen

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=m2pl5k25y4.fsf@MacBookPro.fritz.box \
    --to=morbidrsa@gmail.com \
    --cc=dev-Felipe.Jensen@duagon.com \
    --cc=dev-josejavier.rodriguez@duagon.com \
    --cc=linux-kernel@vger.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