* [PATCH 7/9] PCI: use pdev->pm_cap instead of pci_find_capability(..,PCI_CAP_ID_PM)
@ 2013-06-18 8:22 Yijing Wang
2013-06-18 13:44 ` Rafael J. Wysocki
0 siblings, 1 reply; 3+ messages in thread
From: Yijing Wang @ 2013-06-18 8:22 UTC (permalink / raw)
To: Bjorn Helgaas; +Cc: linux-pci, linux-kernel, Hanjun Guo, jiang.liu, Yijing Wang
Pci pm cap register offset has been saved in pci_pm_init(),
so we can use pdev->pm_cap instead of using pci_find_capability(..)
here.
Signed-off-by: Yijing Wang <wangyijing@huawei.com>
Cc: linux-pci@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
---
drivers/pci/pci.c | 2 +-
drivers/pci/quirks.c | 6 ++----
2 files changed, 3 insertions(+), 5 deletions(-)
diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c
index a899d8b..1117f2c 100644
--- a/drivers/pci/pci.c
+++ b/drivers/pci/pci.c
@@ -805,7 +805,7 @@ pci_power_t pci_choose_state(struct pci_dev *dev, pm_message_t state)
{
pci_power_t ret;
- if (!pci_find_capability(dev, PCI_CAP_ID_PM))
+ if (!dev->pm_cap)
return PCI_D0;
ret = platform_pci_choose_state(dev);
diff --git a/drivers/pci/quirks.c b/drivers/pci/quirks.c
index 7d68aee..422812b 100644
--- a/drivers/pci/quirks.c
+++ b/drivers/pci/quirks.c
@@ -1832,7 +1832,6 @@ static void quirk_e100_interrupt(struct pci_dev *dev)
u16 command, pmcsr;
u8 __iomem *csr;
u8 cmd_hi;
- int pm;
switch (dev->device) {
/* PCI IDs taken from drivers/net/e100.c */
@@ -1870,9 +1869,8 @@ static void quirk_e100_interrupt(struct pci_dev *dev)
* Check that the device is in the D0 power state. If it's not,
* there is no point to look any further.
*/
- pm = pci_find_capability(dev, PCI_CAP_ID_PM);
- if (pm) {
- pci_read_config_word(dev, pm + PCI_PM_CTRL, &pmcsr);
+ if (dev->pm_cap) {
+ pci_read_config_word(dev, dev->pm_cap + PCI_PM_CTRL, &pmcsr);
if ((pmcsr & PCI_PM_CTRL_STATE_MASK) != PCI_D0)
return;
}
--
1.7.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH 7/9] PCI: use pdev->pm_cap instead of pci_find_capability(..,PCI_CAP_ID_PM)
2013-06-18 8:22 [PATCH 7/9] PCI: use pdev->pm_cap instead of pci_find_capability(..,PCI_CAP_ID_PM) Yijing Wang
@ 2013-06-18 13:44 ` Rafael J. Wysocki
2013-06-18 18:07 ` Bjorn Helgaas
0 siblings, 1 reply; 3+ messages in thread
From: Rafael J. Wysocki @ 2013-06-18 13:44 UTC (permalink / raw)
To: Yijing Wang; +Cc: Bjorn Helgaas, linux-pci, linux-kernel, Hanjun Guo, jiang.liu
On Tuesday, June 18, 2013 04:22:14 PM Yijing Wang wrote:
> Pci pm cap register offset has been saved in pci_pm_init(),
> so we can use pdev->pm_cap instead of using pci_find_capability(..)
> here.
>
> Signed-off-by: Yijing Wang <wangyijing@huawei.com>
> Cc: linux-pci@vger.kernel.org
> Cc: linux-kernel@vger.kernel.org
Acked-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
> ---
> drivers/pci/pci.c | 2 +-
> drivers/pci/quirks.c | 6 ++----
> 2 files changed, 3 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c
> index a899d8b..1117f2c 100644
> --- a/drivers/pci/pci.c
> +++ b/drivers/pci/pci.c
> @@ -805,7 +805,7 @@ pci_power_t pci_choose_state(struct pci_dev *dev, pm_message_t state)
> {
> pci_power_t ret;
>
> - if (!pci_find_capability(dev, PCI_CAP_ID_PM))
> + if (!dev->pm_cap)
> return PCI_D0;
>
> ret = platform_pci_choose_state(dev);
> diff --git a/drivers/pci/quirks.c b/drivers/pci/quirks.c
> index 7d68aee..422812b 100644
> --- a/drivers/pci/quirks.c
> +++ b/drivers/pci/quirks.c
> @@ -1832,7 +1832,6 @@ static void quirk_e100_interrupt(struct pci_dev *dev)
> u16 command, pmcsr;
> u8 __iomem *csr;
> u8 cmd_hi;
> - int pm;
>
> switch (dev->device) {
> /* PCI IDs taken from drivers/net/e100.c */
> @@ -1870,9 +1869,8 @@ static void quirk_e100_interrupt(struct pci_dev *dev)
> * Check that the device is in the D0 power state. If it's not,
> * there is no point to look any further.
> */
> - pm = pci_find_capability(dev, PCI_CAP_ID_PM);
> - if (pm) {
> - pci_read_config_word(dev, pm + PCI_PM_CTRL, &pmcsr);
> + if (dev->pm_cap) {
> + pci_read_config_word(dev, dev->pm_cap + PCI_PM_CTRL, &pmcsr);
> if ((pmcsr & PCI_PM_CTRL_STATE_MASK) != PCI_D0)
> return;
> }
>
--
I speak only for myself.
Rafael J. Wysocki, Intel Open Source Technology Center.
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH 7/9] PCI: use pdev->pm_cap instead of pci_find_capability(..,PCI_CAP_ID_PM)
2013-06-18 13:44 ` Rafael J. Wysocki
@ 2013-06-18 18:07 ` Bjorn Helgaas
0 siblings, 0 replies; 3+ messages in thread
From: Bjorn Helgaas @ 2013-06-18 18:07 UTC (permalink / raw)
To: Rafael J. Wysocki
Cc: Yijing Wang, linux-pci@vger.kernel.org,
linux-kernel@vger.kernel.org, Hanjun Guo, Jiang Liu
On Tue, Jun 18, 2013 at 7:44 AM, Rafael J. Wysocki <rjw@sisk.pl> wrote:
> On Tuesday, June 18, 2013 04:22:14 PM Yijing Wang wrote:
>> Pci pm cap register offset has been saved in pci_pm_init(),
>> so we can use pdev->pm_cap instead of using pci_find_capability(..)
>> here.
>>
>> Signed-off-by: Yijing Wang <wangyijing@huawei.com>
>> Cc: linux-pci@vger.kernel.org
>> Cc: linux-kernel@vger.kernel.org
>
> Acked-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Applied to my pci/misc branch for v3.11, thanks!
>> ---
>> drivers/pci/pci.c | 2 +-
>> drivers/pci/quirks.c | 6 ++----
>> 2 files changed, 3 insertions(+), 5 deletions(-)
>>
>> diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c
>> index a899d8b..1117f2c 100644
>> --- a/drivers/pci/pci.c
>> +++ b/drivers/pci/pci.c
>> @@ -805,7 +805,7 @@ pci_power_t pci_choose_state(struct pci_dev *dev, pm_message_t state)
>> {
>> pci_power_t ret;
>>
>> - if (!pci_find_capability(dev, PCI_CAP_ID_PM))
>> + if (!dev->pm_cap)
>> return PCI_D0;
>>
>> ret = platform_pci_choose_state(dev);
>> diff --git a/drivers/pci/quirks.c b/drivers/pci/quirks.c
>> index 7d68aee..422812b 100644
>> --- a/drivers/pci/quirks.c
>> +++ b/drivers/pci/quirks.c
>> @@ -1832,7 +1832,6 @@ static void quirk_e100_interrupt(struct pci_dev *dev)
>> u16 command, pmcsr;
>> u8 __iomem *csr;
>> u8 cmd_hi;
>> - int pm;
>>
>> switch (dev->device) {
>> /* PCI IDs taken from drivers/net/e100.c */
>> @@ -1870,9 +1869,8 @@ static void quirk_e100_interrupt(struct pci_dev *dev)
>> * Check that the device is in the D0 power state. If it's not,
>> * there is no point to look any further.
>> */
>> - pm = pci_find_capability(dev, PCI_CAP_ID_PM);
>> - if (pm) {
>> - pci_read_config_word(dev, pm + PCI_PM_CTRL, &pmcsr);
>> + if (dev->pm_cap) {
>> + pci_read_config_word(dev, dev->pm_cap + PCI_PM_CTRL, &pmcsr);
>> if ((pmcsr & PCI_PM_CTRL_STATE_MASK) != PCI_D0)
>> return;
>> }
>>
> --
> I speak only for myself.
> Rafael J. Wysocki, Intel Open Source Technology Center.
> --
> To unsubscribe from this list: send the line "unsubscribe linux-pci" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2013-06-18 18:07 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-06-18 8:22 [PATCH 7/9] PCI: use pdev->pm_cap instead of pci_find_capability(..,PCI_CAP_ID_PM) Yijing Wang
2013-06-18 13:44 ` Rafael J. Wysocki
2013-06-18 18:07 ` Bjorn Helgaas
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).