Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1622491 > unrolled thread

Re: [PATCH V8 2/5] PCI/ASPM: split pci_aspm_init() into two

Started byRajat Jain <rajatja@google.com>
First post2017-04-12 21:20 +0200
Last post2017-04-14 21:20 +0200
Articles 3 — 3 participants

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: [PATCH V8 2/5] PCI/ASPM: split pci_aspm_init() into two Rajat Jain <rajatja@google.com> - 2017-04-12 21:20 +0200
    Re: [PATCH V8 2/5] PCI/ASPM: split pci_aspm_init() into two Bjorn Helgaas <bhelgaas@google.com> - 2017-04-13 20:30 +0200
      Re: [PATCH V8 2/5] PCI/ASPM: split pci_aspm_init() into two Sinan Kaya <okaya@codeaurora.org> - 2017-04-14 21:20 +0200

#1622491 — Re: [PATCH V8 2/5] PCI/ASPM: split pci_aspm_init() into two

FromRajat Jain <rajatja@google.com>
Date2017-04-12 21:20 +0200
SubjectRe: [PATCH V8 2/5] PCI/ASPM: split pci_aspm_init() into two
Message-ID<tvvY5-8tR-7@gated-at.bofh.it>
On Fri, Apr 7, 2017 at 9:55 PM, Sinan Kaya <okaya@codeaurora.org> wrote:
> Split pci_aspm_init() body into pci_aspm_init_upstream()
> and pci_aspm_init_downstream() for bridge and endpoint
> specific code behavior.
>
> Fixes: https://bugzilla.kernel.org/show_bug.cgi?id=194895
> Signed-off-by: Sinan Kaya <okaya@codeaurora.org>
> ---
>  drivers/pci/pcie/aspm.c | 15 ++++++++++++++-
>  1 file changed, 14 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/pci/pcie/aspm.c b/drivers/pci/pcie/aspm.c
> index dc36717..a80d64b 100644
> --- a/drivers/pci/pcie/aspm.c
> +++ b/drivers/pci/pcie/aspm.c
> @@ -826,6 +826,16 @@ static struct pcie_link_state *alloc_pcie_link_state(struct pci_dev *pdev)
>         return link;
>  }
>
> +static int pci_aspm_init_downstream(struct pci_dev *pdev)
> +{
> +       return 0;
> +}
> +
> +static int pci_aspm_init_upstream(struct pci_dev *pdev)
> +{
> +       return 0;
> +}
> +
>  /*
>   * pci_aspm_init: Initiate PCI express link state.
>   * It is called from device_add for every single pci device.
> @@ -833,7 +843,10 @@ static struct pcie_link_state *alloc_pcie_link_state(struct pci_dev *pdev)
>   */
>  int pci_aspm_init(struct pci_dev *pdev)
>  {
> -       return 0;
> +       if (!pdev->has_secondary_link)
> +               return pci_aspm_init_downstream(pdev);
> +
> +       return pci_aspm_init_upstream(pdev);
>  }

Nit:

if (x_flag())
   return x();
return y();

May be better than

if (!x_flag)
    return y();
return x();


>
>  /*
> --
> 1.9.1
>

[toc] | [next] | [standalone]


#1623248

FromBjorn Helgaas <bhelgaas@google.com>
Date2017-04-13 20:30 +0200
Message-ID<tvRFf-6Or-15@gated-at.bofh.it>
In reply to#1622491
On Wed, Apr 12, 2017 at 2:16 PM, Rajat Jain <rajatja@google.com> wrote:
> On Fri, Apr 7, 2017 at 9:55 PM, Sinan Kaya <okaya@codeaurora.org> wrote:
>> Split pci_aspm_init() body into pci_aspm_init_upstream()
>> and pci_aspm_init_downstream() for bridge and endpoint
>> specific code behavior.
>>
>> Fixes: https://bugzilla.kernel.org/show_bug.cgi?id=194895
>> Signed-off-by: Sinan Kaya <okaya@codeaurora.org>
>> ---
>>  drivers/pci/pcie/aspm.c | 15 ++++++++++++++-
>>  1 file changed, 14 insertions(+), 1 deletion(-)
>>
>> diff --git a/drivers/pci/pcie/aspm.c b/drivers/pci/pcie/aspm.c
>> index dc36717..a80d64b 100644
>> --- a/drivers/pci/pcie/aspm.c
>> +++ b/drivers/pci/pcie/aspm.c
>> @@ -826,6 +826,16 @@ static struct pcie_link_state *alloc_pcie_link_state(struct pci_dev *pdev)
>>         return link;
>>  }
>>
>> +static int pci_aspm_init_downstream(struct pci_dev *pdev)
>> +{
>> +       return 0;
>> +}
>> +
>> +static int pci_aspm_init_upstream(struct pci_dev *pdev)
>> +{
>> +       return 0;
>> +}
>> +
>>  /*
>>   * pci_aspm_init: Initiate PCI express link state.
>>   * It is called from device_add for every single pci device.
>> @@ -833,7 +843,10 @@ static struct pcie_link_state *alloc_pcie_link_state(struct pci_dev *pdev)
>>   */
>>  int pci_aspm_init(struct pci_dev *pdev)
>>  {
>> -       return 0;
>> +       if (!pdev->has_secondary_link)
>> +               return pci_aspm_init_downstream(pdev);
>> +
>> +       return pci_aspm_init_upstream(pdev);
>>  }
>
> Nit:
>
> if (x_flag())
>    return x();
> return y();
>
> May be better than
>
> if (!x_flag)
>     return y();
> return x();

I agree, and I made that change on my branch.  I also renamed these to
pci_aspm_init_downstream_port() (for Root Ports and Switch Downstream
Ports) and pci_aspm_init_upstream_port() (for Switch Upstream Ports
and Endpoints) to try to match the terminology in the spec.

FWIW, your email didn't seem to make it to the list, Rajat.  Maybe
some gmail weirdness?  I don't *see* anything wrong, but ...  I'm
responding via gmail, so my response probably won't make it to the
list either.

Bjorn

[toc] | [prev] | [next] | [standalone]


#1623870

FromSinan Kaya <okaya@codeaurora.org>
Date2017-04-14 21:20 +0200
Message-ID<tweVc-50g-9@gated-at.bofh.it>
In reply to#1623248
On 4/13/2017 2:25 PM, Bjorn Helgaas wrote:
> I agree, and I made that change on my branch.  I also renamed these to
> pci_aspm_init_downstream_port() (for Root Ports and Switch Downstream
> Ports) and pci_aspm_init_upstream_port() (for Switch Upstream Ports
> and Endpoints) to try to match the terminology in the spec.

OK. I reordered and renamed the functions according to your suggestions
on my local copy too.

-- 
Sinan Kaya
Qualcomm Datacenter Technologies, Inc. as an affiliate of Qualcomm Technologies, Inc.
Qualcomm Technologies, Inc. is a member of the Code Aurora Forum, a Linux Foundation Collaborative Project.

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web