[4/4] drm/gma500: avoid Woverride-init warning

Message ID 20201026194110.3817470-4-arnd@kernel.org
State New
Headers show
Series
  • [1/4] drm/tilcdc: avoid 'make W=2' build failure
Related show

Commit Message

Arnd Bergmann Oct. 26, 2020, 7:41 p.m.
From: Arnd Bergmann <arnd@arndb.de>


gcc -Wextra notices that one of the fields in psbfb_roll_ops has two
initializers:

drivers/gpu/drm/gma500/framebuffer.c:185:20: warning: initialized field overwritten [-Woverride-init]

Open-code this instead, leaving out the extraneous initializers for
.fb_pan_display.

Fixes: 3da6c2f3b730 ("drm/gma500: use DRM_FB_HELPER_DEFAULT_OPS for fb_ops")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>

---
 drivers/gpu/drm/gma500/framebuffer.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

-- 
2.27.0

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

Comments

Daniel Vetter Oct. 27, 2020, 9:33 a.m. | #1
On Mon, Oct 26, 2020 at 08:41:04PM +0100, Arnd Bergmann wrote:
> From: Arnd Bergmann <arnd@arndb.de>

> 

> gcc -Wextra notices that one of the fields in psbfb_roll_ops has two

> initializers:

> 

> drivers/gpu/drm/gma500/framebuffer.c:185:20: warning: initialized field overwritten [-Woverride-init]

> 

> Open-code this instead, leaving out the extraneous initializers for

> .fb_pan_display.

> 

> Fixes: 3da6c2f3b730 ("drm/gma500: use DRM_FB_HELPER_DEFAULT_OPS for fb_ops")

> Signed-off-by: Arnd Bergmann <arnd@arndb.de>


Scrollback is dead, so I'm not sure it's even worth to keep all this. I'd
just garbage-collect this, maybe als the entire accelerator code and just
leave psbfb_unaccel_ops behind ...
-Daniel

> ---

>  drivers/gpu/drm/gma500/framebuffer.c | 9 ++++++++-

>  1 file changed, 8 insertions(+), 1 deletion(-)

> 

> diff --git a/drivers/gpu/drm/gma500/framebuffer.c b/drivers/gpu/drm/gma500/framebuffer.c

> index 54d9876b5305..a56a6b53fac6 100644

> --- a/drivers/gpu/drm/gma500/framebuffer.c

> +++ b/drivers/gpu/drm/gma500/framebuffer.c

> @@ -177,7 +177,14 @@ static const struct fb_ops psbfb_ops = {

>  

>  static const struct fb_ops psbfb_roll_ops = {

>  	.owner = THIS_MODULE,

> -	DRM_FB_HELPER_DEFAULT_OPS,

> +	.fb_check_var = drm_fb_helper_check_var,

> +	.fb_set_par = drm_fb_helper_set_par,

> +	.fb_setcmap = drm_fb_helper_setcmap,

> +	.fb_blank = drm_fb_helper_blank,

> +	.fb_debug_enter = drm_fb_helper_debug_enter,

> +	.fb_debug_leave = drm_fb_helper_debug_leave,

> +	.fb_ioctl = drm_fb_helper_ioctl,

> +

>  	.fb_setcolreg = psbfb_setcolreg,

>  	.fb_fillrect = drm_fb_helper_cfb_fillrect,

>  	.fb_copyarea = drm_fb_helper_cfb_copyarea,

> -- 

> 2.27.0

> 


-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Patrik Jakobsson Oct. 27, 2020, 9:54 a.m. | #2
On Tue, Oct 27, 2020 at 10:33 AM Daniel Vetter <daniel@ffwll.ch> wrote:
>

> On Mon, Oct 26, 2020 at 08:41:04PM +0100, Arnd Bergmann wrote:

> > From: Arnd Bergmann <arnd@arndb.de>

> >

> > gcc -Wextra notices that one of the fields in psbfb_roll_ops has two

> > initializers:

> >

> > drivers/gpu/drm/gma500/framebuffer.c:185:20: warning: initialized field overwritten [-Woverride-init]

> >

> > Open-code this instead, leaving out the extraneous initializers for

> > .fb_pan_display.

> >

> > Fixes: 3da6c2f3b730 ("drm/gma500: use DRM_FB_HELPER_DEFAULT_OPS for fb_ops")

> > Signed-off-by: Arnd Bergmann <arnd@arndb.de>

>

> Scrollback is dead, so I'm not sure it's even worth to keep all this. I'd

> just garbage-collect this, maybe als the entire accelerator code and just

> leave psbfb_unaccel_ops behind ...

> -Daniel


That's been my idea for quite some time. The gtt roll code is also
broken in multi display setups.

Arnd, I can take care of this unless you feel an urge to do it yourself.

-Patrik
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Arnd Bergmann Oct. 27, 2020, 4:49 p.m. | #3
On Tue, Oct 27, 2020 at 10:54 AM Patrik Jakobsson
<patrik.r.jakobsson@gmail.com> wrote:
> On Tue, Oct 27, 2020 at 10:33 AM Daniel Vetter <daniel@ffwll.ch> wrote:

> > On Mon, Oct 26, 2020 at 08:41:04PM +0100, Arnd Bergmann wrote:

> > > From: Arnd Bergmann <arnd@arndb.de>

> > >

> > > gcc -Wextra notices that one of the fields in psbfb_roll_ops has two

> > > initializers:

> > >

> > > drivers/gpu/drm/gma500/framebuffer.c:185:20: warning: initialized field overwritten [-Woverride-init]

> > >

> > > Open-code this instead, leaving out the extraneous initializers for

> > > .fb_pan_display.

> > >

> > > Fixes: 3da6c2f3b730 ("drm/gma500: use DRM_FB_HELPER_DEFAULT_OPS for fb_ops")

> > > Signed-off-by: Arnd Bergmann <arnd@arndb.de>

> >

> > Scrollback is dead, so I'm not sure it's even worth to keep all this. I'd

> > just garbage-collect this, maybe als the entire accelerator code and just

> > leave psbfb_unaccel_ops behind ...

> > -Daniel

>

> That's been my idea for quite some time. The gtt roll code is also

> broken in multi display setups.

>

> Arnd, I can take care of this unless you feel an urge to do it yourself.


That would be good, thanks

I have no specific interest in the drm drivers, this is just part of a
larger work to enable more of the W=1 options across the kernel
by default, after all the existing warnings are addressed.

       Arnd
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Patrik Jakobsson Oct. 28, 2020, 2:41 p.m. | #4
On Tue, Oct 27, 2020 at 5:50 PM Arnd Bergmann <arnd@kernel.org> wrote:
>

> On Tue, Oct 27, 2020 at 10:54 AM Patrik Jakobsson

> <patrik.r.jakobsson@gmail.com> wrote:

> > On Tue, Oct 27, 2020 at 10:33 AM Daniel Vetter <daniel@ffwll.ch> wrote:

> > > On Mon, Oct 26, 2020 at 08:41:04PM +0100, Arnd Bergmann wrote:

> > > > From: Arnd Bergmann <arnd@arndb.de>

> > > >

> > > > gcc -Wextra notices that one of the fields in psbfb_roll_ops has two

> > > > initializers:

> > > >

> > > > drivers/gpu/drm/gma500/framebuffer.c:185:20: warning: initialized field overwritten [-Woverride-init]

> > > >

> > > > Open-code this instead, leaving out the extraneous initializers for

> > > > .fb_pan_display.

> > > >

> > > > Fixes: 3da6c2f3b730 ("drm/gma500: use DRM_FB_HELPER_DEFAULT_OPS for fb_ops")

> > > > Signed-off-by: Arnd Bergmann <arnd@arndb.de>

> > >

> > > Scrollback is dead, so I'm not sure it's even worth to keep all this. I'd

> > > just garbage-collect this, maybe als the entire accelerator code and just

> > > leave psbfb_unaccel_ops behind ...

> > > -Daniel

> >

> > That's been my idea for quite some time. The gtt roll code is also

> > broken in multi display setups.

> >

> > Arnd, I can take care of this unless you feel an urge to do it yourself.

>

> That would be good, thanks


Should be fixed with:
https://patchwork.freedesktop.org/patch/397482/?series=83153&rev=1

>

> I have no specific interest in the drm drivers, this is just part of a

> larger work to enable more of the W=1 options across the kernel

> by default, after all the existing warnings are addressed.

>

>        Arnd

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

Patch

diff --git a/drivers/gpu/drm/gma500/framebuffer.c b/drivers/gpu/drm/gma500/framebuffer.c
index 54d9876b5305..a56a6b53fac6 100644
--- a/drivers/gpu/drm/gma500/framebuffer.c
+++ b/drivers/gpu/drm/gma500/framebuffer.c
@@ -177,7 +177,14 @@  static const struct fb_ops psbfb_ops = {
 
 static const struct fb_ops psbfb_roll_ops = {
 	.owner = THIS_MODULE,
-	DRM_FB_HELPER_DEFAULT_OPS,
+	.fb_check_var = drm_fb_helper_check_var,
+	.fb_set_par = drm_fb_helper_set_par,
+	.fb_setcmap = drm_fb_helper_setcmap,
+	.fb_blank = drm_fb_helper_blank,
+	.fb_debug_enter = drm_fb_helper_debug_enter,
+	.fb_debug_leave = drm_fb_helper_debug_leave,
+	.fb_ioctl = drm_fb_helper_ioctl,
+
 	.fb_setcolreg = psbfb_setcolreg,
 	.fb_fillrect = drm_fb_helper_cfb_fillrect,
 	.fb_copyarea = drm_fb_helper_cfb_copyarea,