diff mbox series

[v4,02/12] vfio_pci: move vfio_pci_is_vga/vfio_vga_disabled to header file

Message ID 1578398509-26453-3-git-send-email-yi.l.liu@intel.com (mailing list archive)
State New, archived
Headers show
Series vfio_pci: wrap pci device as a mediated device | expand

Commit Message

Yi Liu Jan. 7, 2020, 12:01 p.m. UTC
This patch moves two inline functions to vfio_pci_private.h for further
sharing across source files. Also avoids below compiling error in further
code split.

"error: inlining failed in call to always_inline ‘vfio_pci_is_vga’:
function body not available".

Cc: Kevin Tian <kevin.tian@intel.com>
Cc: Lu Baolu <baolu.lu@linux.intel.com>
Signed-off-by: Liu Yi L <yi.l.liu@intel.com>
---
 drivers/vfio/pci/vfio_pci.c         | 14 --------------
 drivers/vfio/pci/vfio_pci_private.h | 14 ++++++++++++++
 2 files changed, 14 insertions(+), 14 deletions(-)

Comments

Cornelia Huck Jan. 15, 2020, 10:43 a.m. UTC | #1
On Tue,  7 Jan 2020 20:01:39 +0800
Liu Yi L <yi.l.liu@intel.com> wrote:

> This patch moves two inline functions to vfio_pci_private.h for further
> sharing across source files. Also avoids below compiling error in further
> code split.
> 
> "error: inlining failed in call to always_inline ‘vfio_pci_is_vga’:
> function body not available".

"We want to use these functions from other files, so move them to a
header" seems to be justification enough; why mention the compilation
error?

> 
> Cc: Kevin Tian <kevin.tian@intel.com>
> Cc: Lu Baolu <baolu.lu@linux.intel.com>
> Signed-off-by: Liu Yi L <yi.l.liu@intel.com>
> ---
>  drivers/vfio/pci/vfio_pci.c         | 14 --------------
>  drivers/vfio/pci/vfio_pci_private.h | 14 ++++++++++++++
>  2 files changed, 14 insertions(+), 14 deletions(-)
Yi Liu Jan. 16, 2020, 12:46 p.m. UTC | #2
> From: Cornelia Huck [mailto:cohuck@redhat.com]
> Sent: Wednesday, January 15, 2020 6:43 PM
> To: Liu, Yi L <yi.l.liu@intel.com>
> Subject: Re: [PATCH v4 02/12] vfio_pci: move vfio_pci_is_vga/vfio_vga_disabled to
> header file
> 
> On Tue,  7 Jan 2020 20:01:39 +0800
> Liu Yi L <yi.l.liu@intel.com> wrote:
> 
> > This patch moves two inline functions to vfio_pci_private.h for
> > further sharing across source files. Also avoids below compiling error
> > in further code split.
> >
> > "error: inlining failed in call to always_inline ‘vfio_pci_is_vga’:
> > function body not available".
> 
> "We want to use these functions from other files, so move them to a header" seems
> to be justification enough; why mention the compilation error?

Exactly. What a stupid commit message I made. Thanks very much. I
encountered such compilation error during one step in my development,
so added it in the commit message. I agree it is not necessary.

Thanks,
Yi Liu

> >
> > Cc: Kevin Tian <kevin.tian@intel.com>
> > Cc: Lu Baolu <baolu.lu@linux.intel.com>
> > Signed-off-by: Liu Yi L <yi.l.liu@intel.com>
> > ---
> >  drivers/vfio/pci/vfio_pci.c         | 14 --------------
> >  drivers/vfio/pci/vfio_pci_private.h | 14 ++++++++++++++
> >  2 files changed, 14 insertions(+), 14 deletions(-)
diff mbox series

Patch

diff --git a/drivers/vfio/pci/vfio_pci.c b/drivers/vfio/pci/vfio_pci.c
index af507c2..009d2df 100644
--- a/drivers/vfio/pci/vfio_pci.c
+++ b/drivers/vfio/pci/vfio_pci.c
@@ -54,15 +54,6 @@  module_param(disable_idle_d3, bool, S_IRUGO | S_IWUSR);
 MODULE_PARM_DESC(disable_idle_d3,
 		 "Disable using the PCI D3 low power state for idle, unused devices");
 
-static inline bool vfio_vga_disabled(struct vfio_pci_device *vdev)
-{
-#ifdef CONFIG_VFIO_PCI_VGA
-	return vdev->disable_vga;
-#else
-	return true;
-#endif
-}
-
 /*
  * Our VGA arbiter participation is limited since we don't know anything
  * about the device itself.  However, if the device is the only VGA device
@@ -103,11 +94,6 @@  static unsigned int vfio_pci_set_vga_decode(void *opaque, bool single_vga)
 	return decodes;
 }
 
-static inline bool vfio_pci_is_vga(struct pci_dev *pdev)
-{
-	return (pdev->class >> 8) == PCI_CLASS_DISPLAY_VGA;
-}
-
 static void vfio_pci_probe_mmaps(struct vfio_pci_device *vdev)
 {
 	struct resource *res;
diff --git a/drivers/vfio/pci/vfio_pci_private.h b/drivers/vfio/pci/vfio_pci_private.h
index 0398608..9263021 100644
--- a/drivers/vfio/pci/vfio_pci_private.h
+++ b/drivers/vfio/pci/vfio_pci_private.h
@@ -135,6 +135,20 @@  struct vfio_pci_device {
 #define is_irq_none(vdev) (!(is_intx(vdev) || is_msi(vdev) || is_msix(vdev)))
 #define irq_is(vdev, type) (vdev->irq_type == type)
 
+static inline bool vfio_pci_is_vga(struct pci_dev *pdev)
+{
+	return (pdev->class >> 8) == PCI_CLASS_DISPLAY_VGA;
+}
+
+static inline bool vfio_vga_disabled(struct vfio_pci_device *vdev)
+{
+#ifdef CONFIG_VFIO_PCI_VGA
+	return vdev->disable_vga;
+#else
+	return true;
+#endif
+}
+
 extern void vfio_pci_refresh_config(struct vfio_pci_device *vdev,
 				bool nointxmask, bool disable_idle_d3);