linux-pci.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Oliver Neukum <oneukum@suse.de>
To: Yijing Wang <wangyijing@huawei.com>
Cc: Bjorn Helgaas <bhelgaas@google.com>,
	linux-kernel@vger.kernel.org, linux-pci@vger.kernel.org,
	Hanjun Guo <guohanjun@huawei.com>,
	Paul Bolle <pebolle@tiscali.nl>,
	"RafaelJ.Wysocki" <rjw@rjwysocki.net>,
	Gu Zheng <guz.fnst@cn.fujitsu.com>
Subject: Re: [PATCH part1 v5 3/7] PCI: Add support for Device Serial Number capability
Date: Mon, 10 Feb 2014 11:21:58 +0100	[thread overview]
Message-ID: <1392027718.2082.11.camel@linux-fkkt.site> (raw)
In-Reply-To: <1392005051-54508-4-git-send-email-wangyijing@huawei.com>


On Mon, 2014-02-10 at 12:04 +0800, Yijing Wang wrote:
> +static u64 pci_device_serial_number(struct pci_bus *bus, int devfn)
> +{
> +       int pos;
> +       u32 lo, hi;
> +
> +       if (!pci_bus_find_capability(bus, devfn, PCI_CAP_ID_EXP))
> +               return 0;
> +
> +       pos = pci_bus_find_ext_capability(bus, devfn,
> PCI_EXT_CAP_ID_DSN);
> +       if (!pos)
> +               return 0;
> +
> +       pci_bus_read_config_dword(bus, devfn, pos + 4, &lo);
> +       pci_bus_read_config_dword(bus, devfn, pos + 8, &hi);

We have no macro for that?

> +       return ((u64)hi << 32) | lo;
> +}

	Regards
		Oliver




  reply	other threads:[~2014-02-10 10:22 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-02-10  4:04 [PATCH part1 v5 0/7] Introduce PCIe Device Serial Number capability support Yijing Wang
2014-02-10  4:04 ` [PATCH part1 v5 1/7] PCI: rework pci_find_next_ext_capability() Yijing Wang
2014-02-10  4:04 ` [PATCH part1 v5 2/7] PCI: introduce pci_bus_find_ext_capability() Yijing Wang
2014-02-10  4:04 ` [PATCH part1 v5 3/7] PCI: Add support for Device Serial Number capability Yijing Wang
2014-02-10 10:21   ` Oliver Neukum [this message]
2014-02-11  1:55     ` Yijing Wang
2014-02-10  4:04 ` [PATCH part1 v5 4/7] PCI: Introduce pci_serial_number_changed() Yijing Wang
2014-02-10  4:04 ` [PATCH part1 v5 5/7] PCI: Add pci_dummy_ops to isolate pci device temporarily Yijing Wang
2014-02-10  6:56   ` Oliver Neukum
2014-02-10  7:59     ` Yijing Wang
2014-02-10 10:07       ` Oliver Neukum
2014-02-11  1:49         ` Yijing Wang
2014-02-10  4:04 ` [PATCH part1 v5 6/7] PCI: Check pci device serial number when scan device Yijing Wang
2014-02-10  4:04 ` [PATCH part1 v5 7/7] PCI: pciehp: Don't enable/disable slot on resume unless status changed Yijing Wang

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=1392027718.2082.11.camel@linux-fkkt.site \
    --to=oneukum@suse.de \
    --cc=bhelgaas@google.com \
    --cc=guohanjun@huawei.com \
    --cc=guz.fnst@cn.fujitsu.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=pebolle@tiscali.nl \
    --cc=rjw@rjwysocki.net \
    --cc=wangyijing@huawei.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;
as well as URLs for NNTP newsgroup(s).