[Xen-devel,RFC,11/11] Add to_pci_dev macro

Message ID 20180102092809.1841-12-manish.jaggi@linaro.org
State New
Headers show
Series
  • acpi: arm: IORT Support for Xen
Related show

Commit Message

Manish Jaggi Jan. 2, 2018, 9:28 a.m.
From: Manish Jaggi <manish.jaggi@linaro.org>

This patch adds to_pci_dev macro

Signed-off-by: Manish Jaggi <manish.jaggi@linaro.org>
---
 xen/include/xen/pci.h | 3 +++
 1 file changed, 3 insertions(+)

Comments

Julien Grall Jan. 18, 2018, 7:15 p.m. | #1
Hi Manish,

Again please use scripts/get_maintainers.pl.

On 02/01/18 09:28, manish.jaggi@linaro.org wrote:
> From: Manish Jaggi <manish.jaggi@linaro.org>
> 
> This patch adds to_pci_dev macro

Why? Who is going to use it? If it is a patch in your series, then 
likely this patch should be before you use it.

Any in case, a commit message a bit more develop will be help.

> 
> Signed-off-by: Manish Jaggi <manish.jaggi@linaro.org>
> ---
>   xen/include/xen/pci.h | 3 +++
>   1 file changed, 3 insertions(+)
> 
> diff --git a/xen/include/xen/pci.h b/xen/include/xen/pci.h
> index 43f21251a5..4c7ff4dd10 100644
> --- a/xen/include/xen/pci.h
> +++ b/xen/include/xen/pci.h
> @@ -92,8 +92,11 @@ struct pci_dev {
>   #define PT_FAULT_THRESHOLD 10
>       } fault;
>       u64 vf_rlen[6];
> +    struct device dev;

That's common code. Please look at adding this in arch_pci_dev. But I 
would need a bit more context why you need that.

>   };
>   
> +#define to_pci_dev(p) container_of(p, struct pci_dev, dev)
> +#define pci_domain_nr(dev) dev->seg
>   #define for_each_pdev(domain, pdev) \
>       list_for_each_entry(pdev, &(domain->arch.pdev_list), domain_list)
>   
> 

Cheers,

Patch

diff --git a/xen/include/xen/pci.h b/xen/include/xen/pci.h
index 43f21251a5..4c7ff4dd10 100644
--- a/xen/include/xen/pci.h
+++ b/xen/include/xen/pci.h
@@ -92,8 +92,11 @@  struct pci_dev {
 #define PT_FAULT_THRESHOLD 10
     } fault;
     u64 vf_rlen[6];
+    struct device dev;
 };
 
+#define to_pci_dev(p) container_of(p, struct pci_dev, dev)
+#define pci_domain_nr(dev) dev->seg
 #define for_each_pdev(domain, pdev) \
     list_for_each_entry(pdev, &(domain->arch.pdev_list), domain_list)