From: Kenji Kaneshige <kaneshige.kenji@jp.fujitsu.com>
To: Matthew Garrett <mjg59@srcf.ucam.org>
Cc: linux-pci@vger.kernel.org, kristen.c.accardi@intel.com,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] Add option to passively listen for PCIE hotplug events
Date: Tue, 04 Nov 2008 14:46:20 +0900 [thread overview]
Message-ID: <490FE1AC.5030608@jp.fujitsu.com> (raw)
In-Reply-To: <20081104050245.GA13466@srcf.ucam.org>
Matthew Garrett wrote:
> On Tue, Nov 04, 2008 at 02:07:00AM +0000, Matthew Garrett wrote:
>> On Tue, Nov 04, 2008 at 10:58:11AM +0900, Kenji Kaneshige wrote:
>>>> t_slot->hpc_ops->get_adapter_status(t_slot, &value); /* Check if
>>>> slot is occupied */
>>>> - if (value && pciehp_force) {
>>>> + if (value && (pciehp_force || pciehp_passive)) {
>>>> rc = pciehp_enable_slot(t_slot);
>>>> if (rc) /* -ENODEV: shouldn't happen, but deal with it */
>>>> value = 0;
>> This code no longer runs in the pciehp_passive case. However, by the
>> looks of it it still does in the resume case - that probably wants
>> fixing.
>
> Thinking about this - you said that the problem occurs because
> pciehp_force=1 causes it to try to enable an already enabled slot, and
> then tries to power down the slot as a result? It sounds like this code
> should actually be checking whether the return value is ENODEV or
> EINVAL, and in the latter case not powering the slot down. That sounds
> like a separate bugfix that I'll send later on.
>
I think the root cause of this problem is the following line.
>>>> value = 0;
I can't understand why the 'value' is set to 0 when pciehp_enable_slot()
returns error. The 'value' here is representing whether the slot is
occupied or not. Even if pciehp_enable_slot() returns error, it doesn't
mean slot is not occupied. So I think it is clearly wrong thing that
changing 'value' to 0 from 1 here.
How about just ignore the return value from pciehp_enable_slot()? The
code would be as follows.
t_slot = pciehp_find_slot(ctrl, ctrl->slot_device_offset);
t_slot->hpc_ops->get_adapter_status(t_slot, &value);
if (value) {
if (pciehp_force)
pciehp_enable_slot(t_slot);
} else {
/* Power off the slot if not occupied, just in case */
if (POWER_CTRL(ctrl))
if (t_slot->hpc_ops->power_off_slot(t_slot))
goto err_out_free_ctrl_slots;
}
Thanks,
Kenji Kaneshige
next prev parent reply other threads:[~2008-11-04 5:47 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-10-29 20:09 [PATCH] Add option to passively listen for PCIE hotplug events Matthew Garrett
2008-11-01 17:51 ` Grant Grundler
2008-11-03 13:26 ` [PATCH v2] " Matthew Garrett
2008-11-03 13:43 ` Fabio Comolli
2008-11-03 13:46 ` Matthew Garrett
2008-11-14 16:56 ` Randy Dunlap
2008-11-14 17:00 ` Matthew Garrett
2008-11-03 22:23 ` [PATCH] " Andrew Morton
2008-11-03 22:30 ` Matthew Garrett
2008-11-04 1:58 ` Kenji Kaneshige
2008-11-04 2:07 ` Matthew Garrett
2008-11-04 2:29 ` Kenji Kaneshige
2008-11-04 2:38 ` Matthew Garrett
2008-11-04 3:11 ` Kenji Kaneshige
2008-11-04 5:02 ` Matthew Garrett
2008-11-04 5:46 ` Kenji Kaneshige [this message]
2008-11-04 12:45 ` Matthew Garrett
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=490FE1AC.5030608@jp.fujitsu.com \
--to=kaneshige.kenji@jp.fujitsu.com \
--cc=kristen.c.accardi@intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pci@vger.kernel.org \
--cc=mjg59@srcf.ucam.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