All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Michael S. Tsirkin" <mst@redhat.com>
To: Isaku Yamahata <yamahata@valinux.co.jp>
Cc: qemu-devel@nongnu.org
Subject: [Qemu-devel] Re: [PATCH 1/3] pci: replace the magic, 256, for the maximum of devfn
Date: Wed, 26 Jan 2011 15:37:44 +0200	[thread overview]
Message-ID: <20110126133744.GB12805@redhat.com> (raw)
In-Reply-To: <76163938f7a687e924637b7118b4000d940d6465.1296034717.git.yamahata@valinux.co.jp>

On Wed, Jan 26, 2011 at 06:45:18PM +0900, Isaku Yamahata wrote:
> Introduce symbol PCI_DEVFN_MAX for the maximum of devfn
> and replace the magic, 256.
> 
> Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
> ---
>  hw/pci.h           |    2 ++
>  hw/pci_internals.h |    2 +-
>  2 files changed, 3 insertions(+), 1 deletions(-)
> 
> diff --git a/hw/pci.h b/hw/pci.h
> index 0d2753f..ffb04e8 100644
> --- a/hw/pci.h
> +++ b/hw/pci.h
> @@ -16,7 +16,9 @@
>  #define PCI_DEVFN(slot, func)   ((((slot) & 0x1f) << 3) | ((func) & 0x07))
>  #define PCI_SLOT(devfn)         (((devfn) >> 3) & 0x1f)
>  #define PCI_FUNC(devfn)         ((devfn) & 0x07)
> +#define PCI_SLOT_MAX            32
>  #define PCI_FUNC_MAX            8
> +#define PCI_DEVFN_MAX           (PCI_SLOT_MAX * PCI_FUNC_MAX)

SLOT_MAX makes sense. I'd prefer open-coding PCI_DEVFN_MAX
if there's only one user.

>  
>  /* Class, Vendor and Device IDs from Linux's pci_ids.h */
>  #include "pci_ids.h"
> diff --git a/hw/pci_internals.h b/hw/pci_internals.h
> index e3c93a3..f17e681 100644
> --- a/hw/pci_internals.h
> +++ b/hw/pci_internals.h
> @@ -22,7 +22,7 @@ struct PCIBus {
>      pci_hotplug_fn hotplug;
>      DeviceState *hotplug_qdev;
>      void *irq_opaque;
> -    PCIDevice *devices[256];
> +    PCIDevice *devices[PCI_DEVFN_MAX];
>      PCIDevice *parent_dev;
>      target_phys_addr_t mem_base;
>  
> -- 
> 1.7.1.1

  reply	other threads:[~2011-01-26 13:38 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-01-26  9:45 [Qemu-devel] [PATCH 0/3] pci/pcie: implement ARI enable bit correctly Isaku Yamahata
2011-01-26  9:45 ` [Qemu-devel] [PATCH 1/3] pci: replace the magic, 256, for the maximum of devfn Isaku Yamahata
2011-01-26 13:37   ` Michael S. Tsirkin [this message]
2011-01-26  9:45 ` [Qemu-devel] [PATCH 2/3] pci: use devfn for pci_find_device() instead of (slot, fn) pair Isaku Yamahata
2011-01-26 13:38   ` [Qemu-devel] " Michael S. Tsirkin
2011-01-26  9:45 ` [Qemu-devel] [PATCH 3/3] pci/pcie: make pci_find_device() ARI aware Isaku Yamahata
2011-01-26 13:40   ` [Qemu-devel] " Michael S. Tsirkin

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=20110126133744.GB12805@redhat.com \
    --to=mst@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=yamahata@valinux.co.jp \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.