mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] drm/hisilicon: fix build error without fbdev emulation
@ 2017-07-25 15:33 Arnd Bergmann
  2017-07-25 15:53 ` Daniel Vetter
  0 siblings, 1 reply; 3+ messages in thread
From: Arnd Bergmann @ 2017-07-25 15:33 UTC (permalink / raw)
  To: Xinliang Liu, Rongrong Zou, David Airlie
  Cc: Arnd Bergmann, Xinwei Kong, Chen Feng, Daniel Vetter, Sean Paul,
	Jyri Sarha, Gabriel Krisman Bertazi, Russell King, Rob Herring,
	Thierry Reding, Tom Gundersen, dri-devel, linux-kernel

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")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c
index 1178341c3858..d48102d1a7a4 100644
--- a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c
+++ b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c
@@ -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:
-- 
2.9.0

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] drm/hisilicon: fix build error without fbdev emulation
  2017-07-25 15:33 [PATCH] drm/hisilicon: fix build error without fbdev emulation Arnd Bergmann
@ 2017-07-25 15:53 ` Daniel Vetter
  2017-07-25 18:04   ` Arnd Bergmann
  0 siblings, 1 reply; 3+ messages in thread
From: Daniel Vetter @ 2017-07-25 15:53 UTC (permalink / raw)
  To: Arnd Bergmann
  Cc: Xinliang Liu, Rongrong Zou, David Airlie, Chen Feng,
	Russell King, Jyri Sarha, linux-kernel, Xinwei Kong, dri-devel,
	Daniel Vetter, Thierry Reding, Gabriel Krisman Bertazi

On Tue, Jul 25, 2017 at 05:33:25PM +0200, Arnd Bergmann wrote:
> 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")
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>

Thanks for catching this.

> ---
>  drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c
> index 1178341c3858..d48102d1a7a4 100644
> --- a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c
> +++ b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c
> @@ -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

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.

>  	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

> +#endif
>  err_unbind_all:
>  	component_unbind_all(dev->dev, dev);
>  err_dc_cleanup:
> -- 
> 2.9.0
> 
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel

-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] drm/hisilicon: fix build error without fbdev emulation
  2017-07-25 15:53 ` Daniel Vetter
@ 2017-07-25 18:04   ` Arnd Bergmann
  0 siblings, 0 replies; 3+ messages in thread
From: Arnd Bergmann @ 2017-07-25 18:04 UTC (permalink / raw)
  To: Arnd Bergmann, Xinliang Liu, Rongrong Zou, David Airlie,
	Chen Feng, Russell King, Jyri Sarha, Linux Kernel Mailing List,
	Xinwei Kong, dri-devel, Thierry Reding, Gabriel Krisman Bertazi
  Cc: Daniel Vetter

On Tue, Jul 25, 2017 at 5:53 PM, Daniel Vetter <daniel@ffwll.ch> wrote:
> On Tue, Jul 25, 2017 at 05:33:25PM +0200, Arnd Bergmann wrote:

>>  drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c | 5 ++++-
>>  1 file changed, 4 insertions(+), 1 deletion(-)
>>
>> diff --git a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c
>> index 1178341c3858..d48102d1a7a4 100644
>> --- a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c
>> +++ b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c
>> @@ -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
>
> 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.

> 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.

>> +#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

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2017-07-25 18:04 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-07-25 15:33 [PATCH] drm/hisilicon: fix build error without fbdev emulation Arnd Bergmann
2017-07-25 15:53 ` Daniel Vetter
2017-07-25 18:04   ` Arnd Bergmann

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®