diff mbox series

drivers: gpu: drm: virtio: fix dependency of DRM_VIRTIO_GPU on VIRTIO

Message ID 20201204131221.2827-1-info@metux.net (mailing list archive)
State New, archived
Headers show
Series drivers: gpu: drm: virtio: fix dependency of DRM_VIRTIO_GPU on VIRTIO | expand

Commit Message

Enrico Weigelt, metux IT consult Dec. 4, 2020, 1:12 p.m. UTC
VIRTIO itself has no dependencies and therefore can easily be just
select'ed, instead of depending on it. The current depends on causes
any others trying to select VIRTIO to fail like this:

   drivers/gpu/drm/Kconfig:74:error: recursive dependency detected!
   drivers/gpu/drm/Kconfig:74:	symbol DRM_KMS_HELPER is selected by DRM_VIRTIO_GPU
   drivers/gpu/drm/virtio/Kconfig:2:	symbol DRM_VIRTIO_GPU depends on VIRTIO
   drivers/virtio/Kconfig:2:	symbol VIRTIO is selected by GPIO_VIRTIO
   drivers/gpio/Kconfig:1618:	symbol GPIO_VIRTIO depends on GPIOLIB
   drivers/gpio/Kconfig:14:	symbol GPIOLIB is selected by I2C_MUX_LTC4306
   drivers/i2c/muxes/Kconfig:47:	symbol I2C_MUX_LTC4306 depends on I2C
   drivers/i2c/Kconfig:8:	symbol I2C is selected by FB_DDC
   drivers/video/fbdev/Kconfig:63:	symbol FB_DDC depends on FB
   drivers/video/fbdev/Kconfig:12:	symbol FB is selected by DRM_KMS_FB_HELPER
   drivers/gpu/drm/Kconfig:80:	symbol DRM_KMS_FB_HELPER depends on DRM_KMS_HELPER

It seems that having both 'depends on' as well as 'select' on the same symbol
sends us into big trouble, and Kconfig can't break up the circular dependency
(note that in the tested configuration, neither I2C, FB or DRM are enabled at
all). Perhaps we could consider this a bug in Kconfig, but the trouble can
easily be circumvented by changing 'depends on' into 'select'.

DRM_VIRTIO_GPU also depends on VIRTIO_MENU, so even after this change, that
option will only show up if the user already enabled virtio in the config.

This change didn't cause any changes in the .config after menuconfig run,
so we should be completely safe here.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
---
 drivers/gpu/drm/virtio/Kconfig | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Comments

Anthoine Bourgeois Dec. 7, 2020, 1:43 p.m. UTC | #1
On Fri, Dec 04, 2020 at 02:12:21PM +0100, Enrico Weigelt, metux IT consult wrote:
>VIRTIO itself has no dependencies and therefore can easily be just
>select'ed, instead of depending on it. The current depends on causes
>any others trying to select VIRTIO to fail like this:
>
>   drivers/gpu/drm/Kconfig:74:error: recursive dependency detected!
>   drivers/gpu/drm/Kconfig:74:	symbol DRM_KMS_HELPER is selected by DRM_VIRTIO_GPU
>   drivers/gpu/drm/virtio/Kconfig:2:	symbol DRM_VIRTIO_GPU depends on VIRTIO
>   drivers/virtio/Kconfig:2:	symbol VIRTIO is selected by GPIO_VIRTIO
>   drivers/gpio/Kconfig:1618:	symbol GPIO_VIRTIO depends on GPIOLIB
>   drivers/gpio/Kconfig:14:	symbol GPIOLIB is selected by I2C_MUX_LTC4306
>   drivers/i2c/muxes/Kconfig:47:	symbol I2C_MUX_LTC4306 depends on I2C
>   drivers/i2c/Kconfig:8:	symbol I2C is selected by FB_DDC
>   drivers/video/fbdev/Kconfig:63:	symbol FB_DDC depends on FB
>   drivers/video/fbdev/Kconfig:12:	symbol FB is selected by DRM_KMS_FB_HELPER
>   drivers/gpu/drm/Kconfig:80:	symbol DRM_KMS_FB_HELPER depends on DRM_KMS_HELPER
>
>It seems that having both 'depends on' as well as 'select' on the same symbol
>sends us into big trouble, and Kconfig can't break up the circular dependency
>(note that in the tested configuration, neither I2C, FB or DRM are enabled at
>all). Perhaps we could consider this a bug in Kconfig, but the trouble can
>easily be circumvented by changing 'depends on' into 'select'.
>
>DRM_VIRTIO_GPU also depends on VIRTIO_MENU, so even after this change, that
>option will only show up if the user already enabled virtio in the config.
>
>This change didn't cause any changes in the .config after menuconfig run,
>so we should be completely safe here.
>
>Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>

Ok for me. Thank you.

Reviewed-by: Anthoine Bourgeois <anthoine.bourgeois@gmail.com>
>---
> drivers/gpu/drm/virtio/Kconfig | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
>diff --git a/drivers/gpu/drm/virtio/Kconfig b/drivers/gpu/drm/virtio/Kconfig
>index b925b8b1da16..51ec7c3240c9 100644
>--- a/drivers/gpu/drm/virtio/Kconfig
>+++ b/drivers/gpu/drm/virtio/Kconfig
>@@ -1,7 +1,8 @@
> # SPDX-License-Identifier: GPL-2.0-only
> config DRM_VIRTIO_GPU
> 	tristate "Virtio GPU driver"
>-	depends on DRM && VIRTIO && VIRTIO_MENU && MMU
>+	depends on DRM && VIRTIO_MENU && MMU
>+	select VIRTIO
> 	select DRM_KMS_HELPER
> 	select DRM_GEM_SHMEM_HELPER
> 	select VIRTIO_DMA_SHARED_BUFFER
>-- 
>2.11.0
>
>_______________________________________________
>dri-devel mailing list
>dri-devel@lists.freedesktop.org
>https://lists.freedesktop.org/mailman/listinfo/dri-devel
Gerd Hoffmann Dec. 22, 2020, 3:26 p.m. UTC | #2
On Fri, Dec 04, 2020 at 02:12:21PM +0100, Enrico Weigelt, metux IT consult wrote:
> VIRTIO itself has no dependencies and therefore can easily be just
> select'ed, instead of depending on it. The current depends on causes
> any others trying to select VIRTIO to fail like this:
> 
>    drivers/gpu/drm/Kconfig:74:error: recursive dependency detected!
>    drivers/gpu/drm/Kconfig:74:	symbol DRM_KMS_HELPER is selected by DRM_VIRTIO_GPU
>    drivers/gpu/drm/virtio/Kconfig:2:	symbol DRM_VIRTIO_GPU depends on VIRTIO
>    drivers/virtio/Kconfig:2:	symbol VIRTIO is selected by GPIO_VIRTIO
>    drivers/gpio/Kconfig:1618:	symbol GPIO_VIRTIO depends on GPIOLIB
>    drivers/gpio/Kconfig:14:	symbol GPIOLIB is selected by I2C_MUX_LTC4306
>    drivers/i2c/muxes/Kconfig:47:	symbol I2C_MUX_LTC4306 depends on I2C
>    drivers/i2c/Kconfig:8:	symbol I2C is selected by FB_DDC
>    drivers/video/fbdev/Kconfig:63:	symbol FB_DDC depends on FB
>    drivers/video/fbdev/Kconfig:12:	symbol FB is selected by DRM_KMS_FB_HELPER
>    drivers/gpu/drm/Kconfig:80:	symbol DRM_KMS_FB_HELPER depends on DRM_KMS_HELPER
> 
> It seems that having both 'depends on' as well as 'select' on the same symbol
> sends us into big trouble, and Kconfig can't break up the circular dependency
> (note that in the tested configuration, neither I2C, FB or DRM are enabled at
> all). Perhaps we could consider this a bug in Kconfig, but the trouble can
> easily be circumvented by changing 'depends on' into 'select'.
> 
> DRM_VIRTIO_GPU also depends on VIRTIO_MENU, so even after this change, that
> option will only show up if the user already enabled virtio in the config.
> 
> This change didn't cause any changes in the .config after menuconfig run,
> so we should be completely safe here.
> 
> Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>

Pushed to drm-misc-next.

thanks,
  Gerd
diff mbox series

Patch

diff --git a/drivers/gpu/drm/virtio/Kconfig b/drivers/gpu/drm/virtio/Kconfig
index b925b8b1da16..51ec7c3240c9 100644
--- a/drivers/gpu/drm/virtio/Kconfig
+++ b/drivers/gpu/drm/virtio/Kconfig
@@ -1,7 +1,8 @@ 
 # SPDX-License-Identifier: GPL-2.0-only
 config DRM_VIRTIO_GPU
 	tristate "Virtio GPU driver"
-	depends on DRM && VIRTIO && VIRTIO_MENU && MMU
+	depends on DRM && VIRTIO_MENU && MMU
+	select VIRTIO
 	select DRM_KMS_HELPER
 	select DRM_GEM_SHMEM_HELPER
 	select VIRTIO_DMA_SHARED_BUFFER