Skip to contentSkip to conversation

drm/hisilicon: fix build error without fbdev emulation

PATCH Superseded Arnd Bergmann 2 participants 3 messages Jul 25, 2017

Subsystems (3)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drm/hisilicon: fix build error without fbdev emulation

We cannot reference priv->fbdev outside of the #ifdef:

drivers/net/virtio_net.c:1881:12: error: 'virtnet_restore_up' defined but not used [-Werror=unused-function]
static int virtnet_restore_up(struct virtio_device *vdev)
drivers/net/virtio_net.c:1859:13: error: 'virtnet_freeze_down' defined but not used [-Werror=unused-function]
static void virtnet_freeze_down(struct virtio_device *vdev)

Since the code is moved into the main probe function now, this adds another #ifdef.

Fixes b4dd9f1ffaba ("drm/hisilicon: Remove custom FB helper deferred setup")
---
 drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c +4 -1
index 1178341c3858..d48102d1a7a4 100644
@@ -121,6 +121,7 @@ static int kirin_drm_kms_init(struct drm_device *dev)
 	/* init kms poll for handling hpd */
 	drm_kms_helper_poll_init(dev);
 
+#ifdef CONFIG_DRM_FBDEV_EMULATION
 	priv->fbdev = drm_fbdev_cma_init(dev, 32,
 					 dev->mode_config.num_connector);
 	if (IS_ERR(priv->fbdev)) {
@@ -128,11 +129,13 @@ static int kirin_drm_kms_init(struct drm_device *dev)
 		ret = PTR_ERR(priv->fbdev);
 		goto err_cleanup_poll;
 	}
-
+#endif
 	return 0;
 
+#ifdef CONFIG_DRM_FBDEV_EMULATION
 err_cleanup_poll:
 	drm_kms_helper_poll_fini(dev);
+#endif
 err_unbind_all:
 	component_unbind_all(dev->dev, dev);
 err_dc_cleanup:
Signature · 6 lines
2.9.0

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
#1 lore raw
Quoted 7 lines · Arnd Bergmann

We cannot reference priv->fbdev outside of the #ifdef:

drivers/net/virtio_net.c:1881:12: error: 'virtnet_restore_up' defined but not used [-Werror=unused-function]
static int virtnet_restore_up(struct virtio_device *vdev)
drivers/net/virtio_net.c:1859:13: error: 'virtnet_freeze_down' defined but not used [-Werror=unused-function]
static void virtnet_freeze_down(struct virtio_device *vdev)

Quoted 5 lines

Since the code is moved into the main probe function now, this adds another #ifdef.

Fixes b4dd9f1ffaba ("drm/hisilicon: Remove custom FB helper deferred setup")

Thanks for catching this.

Quoted 17 lines
---
 drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c +1 -0
index 1178341c3858..d48102d1a7a4 100644
@@ -121,6 +121,7 @@ static int kirin_drm_kms_init(struct drm_device *dev)
 	/* init kms poll for handling hpd */
 	drm_kms_helper_poll_init(dev);
 
+#ifdef CONFIG_DRM_FBDEV_EMULATION
 	priv->fbdev = drm_fbdev_cma_init(dev, 32,
 					 dev->mode_config.num_connector);
 	if (IS_ERR(priv->fbdev)) {

drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c static int kirin_drm_kms_init(struct drm_device *dev) · line 132

Quoted 5 lines
drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c +1 -1
@@ -128,11 +129,13 @@ static int kirin_drm_kms_init(struct drm_device *dev)
 		ret = PTR_ERR(priv->fbdev);
 		goto err_cleanup_poll;
 	}
-
+#endif

Could we instead stop compling out priv->fbdev? There's nothing driver-specific here, so teh #ifdef are kinda annoying ... And saving that one pointer in a really huge structure is somewhat silly.

drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c static int kirin_drm_kms_init(struct drm_device *dev) · line 137

Quoted 5 lines
drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c +1 -0
 	return 0;
 
+#ifdef CONFIG_DRM_FBDEV_EMULATION
 err_cleanup_poll:
 	drm_kms_helper_poll_fini(dev);

poll helpers aren't fbdev specific. Why do we need this? Is this just to shut up gcc?

Thanks, Daniel

Quoted 11 lines
drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c +1 -0
+#endif
 err_unbind_all:
 	component_unbind_all(dev->dev, dev);
 err_dc_cleanup:
Signature · 6 lines
2.9.0

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Signature · 7 lines
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
#2 lore raw
Quoted 13 lines · Daniel Vetter
Quoted 11 lines · Arnd Bergmann
 drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c +0 -0
index 1178341c3858..d48102d1a7a4 100644
@@ -121,6 +121,7 @@ static int kirin_drm_kms_init(struct drm_device *dev)
      /* init kms poll for handling hpd */
      drm_kms_helper_poll_init(dev);
 
Quoted 13 lines

drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c static int kirin_drm_kms_init(struct drm_device *dev) · line 132

Quoted 10 lines
drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c +2 -1
+#ifdef CONFIG_DRM_FBDEV_EMULATION
      priv->fbdev = drm_fbdev_cma_init(dev, 32,
                                       dev->mode_config.num_connector);
      if (IS_ERR(priv->fbdev)) {
@@ -128,11 +129,13 @@ static int kirin_drm_kms_init(struct drm_device *dev)
              ret = PTR_ERR(priv->fbdev);
              goto err_cleanup_poll;
      }
-
+#endif

Could we instead stop compling out priv->fbdev? There's nothing driver-specific here, so teh #ifdef are kinda annoying ...

Yes, I guess that would be better, I just didn't want to do too much of a rework. If we remove the #ifdef here, we should replace all instances in that driver.

I'll send a patch to do that and let you pick which one you apply.

Quoted 1 line

And saving that one pointer in a really huge structure is somewhat silly.

It looks like it's the only member in that structure, but that doesn't make a big difference either, since there is only one instance in the system.

Quoted 6 lines

drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c static int kirin_drm_kms_init(struct drm_device *dev) · line 137

Quoted 3 lines
drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c +1 -0
+#ifdef CONFIG_DRM_FBDEV_EMULATION
 err_cleanup_poll:
      drm_kms_helper_poll_fini(dev);

poll helpers aren't fbdev specific. Why do we need this? Is this just to shut up gcc?

Yes, gcc warns about the unused label here otherwise.

Arnd