mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Shaohua Li <shaohua.li@intel.com>
To: Matthew Wilcox <matthew@wil.cx>
Cc: linux-pci <linux-pci@atrey.karlin.mff.cuni.cz>,
	Greg KH <greg@kroah.com>,
	"Pallipadi, Venkatesh" <venkatesh.pallipadi@intel.com>,
	"Kok, Auke" <auke-jan.h.kok@intel.com>,
	lkml <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH]PCIE ASPM support - takes 2
Date: Tue, 15 Jan 2008 13:07:02 +0800	[thread overview]
Message-ID: <1200373622.20869.2.camel@sli10-desk.sh.intel.com> (raw)
In-Reply-To: <20080115041943.GS18741@parisc-linux.org>


On Mon, 2008-01-14 at 21:19 -0700, Matthew Wilcox wrote:
> On Tue, Jan 15, 2008 at 11:21:16AM +0800, Shaohua Li wrote:
> > +	int same_clock = 0;
> > +
> > +	/* Check downstream component if bit Slot Clock Configuration is 1 */
> > +	child_pos = pci_find_capability(child_dev, PCI_CAP_ID_EXP);
> > +	pci_read_config_word(child_dev, child_pos + PCI_EXP_LNKSTA, &reg16);
> > +	if (reg16 & PCI_EXP_LNKSTA_SLC)
> > +		same_clock = 1;
> > +
> > +	/* Check upstream component if bit Slot Clock Configuration is 1 */
> > +	pos = pci_find_capability(pdev, PCI_CAP_ID_EXP);
> > +	pci_read_config_word(pdev, pos + PCI_EXP_LNKSTA, &reg16);
> > +	if (reg16 & PCI_EXP_LNKSTA_SLC)
> > +		same_clock &= 1;
> > +	else
> > +		same_clock = 0;
> 
> This could be done a little neater ... the &= 1 idiom confused me on a
> quick scan.
> 
> How about:
> 
> 	int same_clock = 1;
> 
> 	child_pos = pci_find_capability(child_dev, PCI_CAP_ID_EXP);
> 	pci_read_config_word(child_dev, child_pos + PCI_EXP_LNKSTA, &reg16);
> 	if (!(reg16 & PCI_EXP_LNKSTA_SLC))
> 		same_clock = 0;
> 
> 	pos = pci_find_capability(pdev, PCI_CAP_ID_EXP);
> 	pci_read_config_word(pdev, pos + PCI_EXP_LNKSTA, &reg16);
> 	if (!(reg16 & PCI_EXP_LNKSTA_SLC))
> 		same_clock = 0;
Thanks, for your time. ok, this is better.
> > +#ifdef CONFIG_PCIEASPM
> > +extern int pcie_aspm_init(void);
> > +#else
> > +#define pcie_aspm_init() do {} while (0)
> > +#endif
> 
> If pcie_aspm_init() returns a value, then callers may want to check it
> ... which they can't do for this null definition.  How about simply:
> 
> #define pcie_aspm_init() 0
ok
> 
> > Index: linux/drivers/pci/pci-acpi.c
> > ===================================================================
> > --- linux.orig/drivers/pci/pci-acpi.c	2008-01-15 10:16:35.000000000 +0800
> > +++ linux/drivers/pci/pci-acpi.c	2008-01-15 10:16:54.000000000 +0800
> > @@ -15,6 +15,7 @@
> >  #include <acpi/acnamesp.h>
> >  #include <acpi/acresrc.h>
> >  #include <acpi/acpi_bus.h>
> > +#include <linux/aspm.h>
> >  
> >  #include <linux/pci-acpi.h>
> >  #include "pci.h"
> > @@ -349,3 +350,11 @@ static int __init acpi_pci_init(void)
> >  	return 0;
> >  }
> >  arch_initcall(acpi_pci_init);
> > +
> > +/* Called after ACPI is enabled */
> > +static int __init acpi_pcie_support_init(void)
> > +{
> > +	pcie_aspm_init();
> > +	return 0;
> > +}
> > +fs_initcall(acpi_pcie_support_init);
> 
> Is there any reason to put this in here instead of just making
> pcie_aspm_init an initcall?
yes, this will evaluate some ACPI methods, so must be called after ACPI
is initialized, which is a sub_system call

Thanks,
Shaohua


       reply	other threads:[~2008-01-15  5:06 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <1200367276.20538.1.camel@sli10-desk.sh.intel.com>
     [not found] ` <20080115041943.GS18741@parisc-linux.org>
2008-01-15  5:07   ` Shaohua Li [this message]
2008-01-15 12:22     ` Matthew Wilcox
2008-01-16  1:14       ` Shaohua Li
2008-01-15  5:02 Shaohua Li
2008-01-16  3:56 ` Valdis.Kletnieks
2008-01-16  5:26   ` Shaohua Li
2008-01-16  9:31     ` Valdis.Kletnieks

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=1200373622.20869.2.camel@sli10-desk.sh.intel.com \
    --to=shaohua.li@intel.com \
    --cc=auke-jan.h.kok@intel.com \
    --cc=greg@kroah.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pci@atrey.karlin.mff.cuni.cz \
    --cc=matthew@wil.cx \
    --cc=venkatesh.pallipadi@intel.com \
    /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®