From: Liu Peibao <liupeibao@loongson.cn>
To: "Christophe JAILLET" <christophe.jaillet@wanadoo.fr>,
"Bjorn Helgaas" <bhelgaas@google.com>,
"Rob Herring" <robh+dt@kernel.org>,
"Krzysztof Kozlowski" <krzysztof.kozlowski+dt@linaro.org>,
"Lorenzo Pieralisi" <lpieralisi@kernel.org>,
"Krzysztof Wilczyński" <kw@linux.com>,
"Jiaxun Yang" <jiaxun.yang@flygoat.com>
Cc: Huacai Chen <chenhuacai@loongson.cn>,
Jianmin Lv <lvjianmin@loongson.cn>,
Yinbo Zhu <zhuyinbo@loongson.cn>,
linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2 1/1] PCI: loongson: skip scanning unavailable child device
Date: Fri, 4 Nov 2022 18:43:33 +0800 [thread overview]
Message-ID: <ea68d96d-a77e-aa68-0850-31bc232d4946@loongson.cn> (raw)
In-Reply-To: <d2f7deb7-ebe0-d880-1c4b-a210d65c6223@wanadoo.fr>
On 11/4/22 4:43 PM, Christophe JAILLET wrote:
> Le 04/11/2022 à 08:27, Liu Peibao a écrit :
>> +#ifdef CONFIG_OF
>> + /* Don't access devices in masklist */
>> + if (pci_is_root_bus(bus)) {
>> + struct list_head *list;
>> + struct mask_entry *entry;
>> +
>> + list_for_each(list, &priv->masklist) {
>> + entry = list_entry(list, struct mask_entry, entry);
>
> Hi,
>
> list_for_each_entry() is slighly less verbose.
>
OK, I will update the patch with list_for_each_entry().
>> + if (devfn == entry->devfn)
>> + return NULL;
>> + }
>> + }
>> +#endif
>> +
>> /* CFG0 can only access standard space */
>> if (where < PCI_CFG_SPACE_SIZE && priv->cfg0_base)
>> return cfg0_map(priv, bus, devfn, where);
>> @@ -206,6 +230,36 @@ static void __iomem *pci_loongson_map_bus(struct pci_bus *bus,
>> }
>> #ifdef CONFIG_OF
>> +static int setup_masklist(struct loongson_pci *priv)
>> +{
>> + struct device *dev = &priv->pdev->dev;
>> + struct device_node *dn, *parent = dev->of_node;
>> + struct mask_entry *entry;
>> + int devfn;
>> +
>> + INIT_LIST_HEAD(&priv->masklist);
>> +
>> + for_each_child_of_node(parent, dn) {
>> + /*
>> + * if device is not available, add this to masklist
>> + * to avoid scanning it.
>> + */
>> + if (!of_device_is_available(dn)) {
>> + devfn = of_pci_get_devfn(dn);
>> + if (devfn < 0)
>> + continue;
>> +
>> + entry = devm_kzalloc(dev, sizeof(entry), GFP_KERNEL);
>
> sizeof(*entry)?
>
That really is a bug, thanks!
BR,
Peibao
>> + if (!entry)
>> + return -ENOMEM;
>> +
prev parent reply other threads:[~2022-11-04 10:43 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-11-04 7:27 Liu Peibao
2022-11-04 8:43 ` Christophe JAILLET
2022-11-04 10:43 ` Liu Peibao [this message]
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=ea68d96d-a77e-aa68-0850-31bc232d4946@loongson.cn \
--to=liupeibao@loongson.cn \
--cc=bhelgaas@google.com \
--cc=chenhuacai@loongson.cn \
--cc=christophe.jaillet@wanadoo.fr \
--cc=jiaxun.yang@flygoat.com \
--cc=krzysztof.kozlowski+dt@linaro.org \
--cc=kw@linux.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pci@vger.kernel.org \
--cc=lpieralisi@kernel.org \
--cc=lvjianmin@loongson.cn \
--cc=robh+dt@kernel.org \
--cc=zhuyinbo@loongson.cn \
/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®