diff mbox series

[3/3] ARM: amba: Allow some ARM_AMBA users to compile with COMPILE_TEST

Message ID 3-v1-df057e0f92c3+91-vfio_arm_compile_test_jgg@nvidia.com (mailing list archive)
State New, archived
Headers show
Series Tidy some parts of the VFIO kconfig world | expand

Commit Message

Jason Gunthorpe Feb. 23, 2021, 7:17 p.m. UTC
CONFIG_VFIO_AMBA has a light use of AMBA, adding some inline fallbacks
when AMBA is disabled will allow it to be compiled under COMPILE_TEST and
make VFIO easier to maintain.

Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
---
 drivers/vfio/platform/Kconfig |  2 +-
 include/linux/amba/bus.h      | 11 +++++++++++
 2 files changed, 12 insertions(+), 1 deletion(-)

Comments

Auger Eric Feb. 24, 2021, 9:49 a.m. UTC | #1
Hi Jason,

On 2/23/21 8:17 PM, Jason Gunthorpe wrote:
> CONFIG_VFIO_AMBA has a light use of AMBA, adding some inline fallbacks
> when AMBA is disabled will allow it to be compiled under COMPILE_TEST and
> make VFIO easier to maintain.
> 
> Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
Reviewed-by: Eric Auger <eric.auger@redhat.com>

Thanks

Eric

> ---
>  drivers/vfio/platform/Kconfig |  2 +-
>  include/linux/amba/bus.h      | 11 +++++++++++
>  2 files changed, 12 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/vfio/platform/Kconfig b/drivers/vfio/platform/Kconfig
> index 233efde219cc10..ab341108a0be94 100644
> --- a/drivers/vfio/platform/Kconfig
> +++ b/drivers/vfio/platform/Kconfig
> @@ -12,7 +12,7 @@ config VFIO_PLATFORM
>  
>  config VFIO_AMBA
>  	tristate "VFIO support for AMBA devices"
> -	depends on VFIO_PLATFORM && ARM_AMBA
> +	depends on VFIO_PLATFORM && (ARM_AMBA || COMPILE_TEST)
>  	help
>  	  Support for ARM AMBA devices with VFIO. This is required to make
>  	  use of ARM AMBA devices present on the system using the VFIO
> diff --git a/include/linux/amba/bus.h b/include/linux/amba/bus.h
> index 0bbfd647f5c6de..977edd6e541ddd 100644
> --- a/include/linux/amba/bus.h
> +++ b/include/linux/amba/bus.h
> @@ -105,8 +105,19 @@ extern struct bus_type amba_bustype;
>  #define amba_get_drvdata(d)	dev_get_drvdata(&d->dev)
>  #define amba_set_drvdata(d,p)	dev_set_drvdata(&d->dev, p)
>  
> +#ifdef CONFIG_ARM_AMBA
>  int amba_driver_register(struct amba_driver *);
>  void amba_driver_unregister(struct amba_driver *);
> +#else
> +static inline int amba_driver_register(struct amba_driver *drv)
> +{
> +	return -EINVAL;
> +}
> +static inline void amba_driver_unregister(struct amba_driver *drv)
> +{
> +}
> +#endif
> +
>  struct amba_device *amba_device_alloc(const char *, resource_size_t, size_t);
>  void amba_device_put(struct amba_device *);
>  int amba_device_add(struct amba_device *, struct resource *);
>
diff mbox series

Patch

diff --git a/drivers/vfio/platform/Kconfig b/drivers/vfio/platform/Kconfig
index 233efde219cc10..ab341108a0be94 100644
--- a/drivers/vfio/platform/Kconfig
+++ b/drivers/vfio/platform/Kconfig
@@ -12,7 +12,7 @@  config VFIO_PLATFORM
 
 config VFIO_AMBA
 	tristate "VFIO support for AMBA devices"
-	depends on VFIO_PLATFORM && ARM_AMBA
+	depends on VFIO_PLATFORM && (ARM_AMBA || COMPILE_TEST)
 	help
 	  Support for ARM AMBA devices with VFIO. This is required to make
 	  use of ARM AMBA devices present on the system using the VFIO
diff --git a/include/linux/amba/bus.h b/include/linux/amba/bus.h
index 0bbfd647f5c6de..977edd6e541ddd 100644
--- a/include/linux/amba/bus.h
+++ b/include/linux/amba/bus.h
@@ -105,8 +105,19 @@  extern struct bus_type amba_bustype;
 #define amba_get_drvdata(d)	dev_get_drvdata(&d->dev)
 #define amba_set_drvdata(d,p)	dev_set_drvdata(&d->dev, p)
 
+#ifdef CONFIG_ARM_AMBA
 int amba_driver_register(struct amba_driver *);
 void amba_driver_unregister(struct amba_driver *);
+#else
+static inline int amba_driver_register(struct amba_driver *drv)
+{
+	return -EINVAL;
+}
+static inline void amba_driver_unregister(struct amba_driver *drv)
+{
+}
+#endif
+
 struct amba_device *amba_device_alloc(const char *, resource_size_t, size_t);
 void amba_device_put(struct amba_device *);
 int amba_device_add(struct amba_device *, struct resource *);