linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] fbcon: replace mono_col macro with static inline
@ 2008-02-25 18:13 Harvey Harrison
  2008-02-25 18:50 ` Andrew Morton
  2008-02-26  8:18 ` Geert Uytterhoeven
  0 siblings, 2 replies; 6+ messages in thread
From: Harvey Harrison @ 2008-02-25 18:13 UTC (permalink / raw)
  To: Antonino Daplas, Andrew Morton; +Cc: LKML

Use __u32 for max_len to match the declaration of length in the
struct fb_bitfield.

Suppresses sparse shadowed variable warnings from the nested max()
macros:
drivers/video/console/fbcon.h:130:8: warning: symbol '_x' shadows an earlier one
drivers/video/console/fbcon.h:130:8: originally declared here
drivers/video/console/fbcon.h:130:8: warning: symbol '_x' shadows an earlier one
drivers/video/console/fbcon.h:130:8: originally declared here
drivers/video/console/fbcon.h:130:8: warning: symbol '_y' shadows an earlier one
drivers/video/console/fbcon.h:130:8: originally declared here

Signed-off-by: Harvey Harrison <harvey.harrison@gmail.com>
---
 drivers/video/console/fbcon.h |   12 ++++++++----
 1 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/drivers/video/console/fbcon.h b/drivers/video/console/fbcon.h
index 3706307..51a6bf4 100644
--- a/drivers/video/console/fbcon.h
+++ b/drivers/video/console/fbcon.h
@@ -104,10 +104,14 @@ struct fbcon_ops {
 #define attr_blink(s) \
 	((s) & 0x8000)
 	
-#define mono_col(info)							\
-	(~(0xfff << (max((info)->var.green.length,			\
-			 max((info)->var.red.length,			\
-			     (info)->var.blue.length)))) & 0xff)
+
+static inline int mono_col(struct fb_info *info)
+{
+	__u32 max_len;
+	max_len = max(info->var.green.length, info->var.red.length);
+	max_len = max(info->var.blue.length, max_len);
+	return ~(0xfff << (max_len & 0xff));
+}
 
 static inline int attr_col_ec(int shift, struct vc_data *vc,
 			      struct fb_info *info, int is_fg)
-- 
1.5.4.3.328.gcaed




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

* Re: [PATCH] fbcon: replace mono_col macro with static inline
  2008-02-25 18:13 [PATCH] fbcon: replace mono_col macro with static inline Harvey Harrison
@ 2008-02-25 18:50 ` Andrew Morton
  2008-02-26  8:18 ` Geert Uytterhoeven
  1 sibling, 0 replies; 6+ messages in thread
From: Andrew Morton @ 2008-02-25 18:50 UTC (permalink / raw)
  To: Harvey Harrison; +Cc: Antonino Daplas, LKML, linux-fbdev-devel

On Mon, 25 Feb 2008 10:13:57 -0800 Harvey Harrison <harvey.harrison@gmail.com> wrote:

> Use __u32 for max_len to match the declaration of length in the
> struct fb_bitfield.
> 
> Suppresses sparse shadowed variable warnings from the nested max()
> macros:
> drivers/video/console/fbcon.h:130:8: warning: symbol '_x' shadows an earlier one
> drivers/video/console/fbcon.h:130:8: originally declared here
> drivers/video/console/fbcon.h:130:8: warning: symbol '_x' shadows an earlier one
> drivers/video/console/fbcon.h:130:8: originally declared here
> drivers/video/console/fbcon.h:130:8: warning: symbol '_y' shadows an earlier one
> drivers/video/console/fbcon.h:130:8: originally declared here
> 
> Signed-off-by: Harvey Harrison <harvey.harrison@gmail.com>
> ---
>  drivers/video/console/fbcon.h |   12 ++++++++----
>  1 files changed, 8 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/video/console/fbcon.h b/drivers/video/console/fbcon.h
> index 3706307..51a6bf4 100644
> --- a/drivers/video/console/fbcon.h
> +++ b/drivers/video/console/fbcon.h
> @@ -104,10 +104,14 @@ struct fbcon_ops {
>  #define attr_blink(s) \
>  	((s) & 0x8000)
>  	
> -#define mono_col(info)							\
> -	(~(0xfff << (max((info)->var.green.length,			\
> -			 max((info)->var.red.length,			\
> -			     (info)->var.blue.length)))) & 0xff)
> +
> +static inline int mono_col(struct fb_info *info)
> +{
> +	__u32 max_len;
> +	max_len = max(info->var.green.length, info->var.red.length);
> +	max_len = max(info->var.blue.length, max_len);
> +	return ~(0xfff << (max_len & 0xff));
> +}
>  
>  static inline int attr_col_ec(int shift, struct vc_data *vc,
>  			      struct fb_info *info, int is_fg)

Thanks, but please do try to copy a suitable mailing list on the patches. 
Particularly fbdev - Tony has been out of contact for a while, but there
are other fbdev developers who can help us to review code, as long as we
tell them about it.


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

* Re: [PATCH] fbcon: replace mono_col macro with static inline
  2008-02-25 18:13 [PATCH] fbcon: replace mono_col macro with static inline Harvey Harrison
  2008-02-25 18:50 ` Andrew Morton
@ 2008-02-26  8:18 ` Geert Uytterhoeven
  2008-02-26 20:51   ` Harvey Harrison
  1 sibling, 1 reply; 6+ messages in thread
From: Geert Uytterhoeven @ 2008-02-26  8:18 UTC (permalink / raw)
  To: Harvey Harrison
  Cc: Antonino Daplas, Andrew Morton, LKML,
	Linux Frame Buffer Device Development

On Mon, 25 Feb 2008, Harvey Harrison wrote:
> Use __u32 for max_len to match the declaration of length in the
> struct fb_bitfield.
> 
> Suppresses sparse shadowed variable warnings from the nested max()
> macros:
> drivers/video/console/fbcon.h:130:8: warning: symbol '_x' shadows an earlier one
> drivers/video/console/fbcon.h:130:8: originally declared here
> drivers/video/console/fbcon.h:130:8: warning: symbol '_x' shadows an earlier one
> drivers/video/console/fbcon.h:130:8: originally declared here
> drivers/video/console/fbcon.h:130:8: warning: symbol '_y' shadows an earlier one
> drivers/video/console/fbcon.h:130:8: originally declared here
> 
> Signed-off-by: Harvey Harrison <harvey.harrison@gmail.com>
> ---
>  drivers/video/console/fbcon.h |   12 ++++++++----
>  1 files changed, 8 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/video/console/fbcon.h b/drivers/video/console/fbcon.h
> index 3706307..51a6bf4 100644
> --- a/drivers/video/console/fbcon.h
> +++ b/drivers/video/console/fbcon.h
> @@ -104,10 +104,14 @@ struct fbcon_ops {
>  #define attr_blink(s) \
>  	((s) & 0x8000)
>  	
> -#define mono_col(info)							\
> -	(~(0xfff << (max((info)->var.green.length,			\
> -			 max((info)->var.red.length,			\
> -			     (info)->var.blue.length)))) & 0xff)
> +
> +static inline int mono_col(struct fb_info *info)
                              ^^^^^^^^^^^^^^^^^^^^
const struct fb_info *info?

> +{
> +	__u32 max_len;
> +	max_len = max(info->var.green.length, info->var.red.length);
> +	max_len = max(info->var.blue.length, max_len);
> +	return ~(0xfff << (max_len & 0xff));
> +}
>  
>  static inline int attr_col_ec(int shift, struct vc_data *vc,
>  			      struct fb_info *info, int is_fg)

Gr{oetje,eeting}s,

						Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
							    -- Linus Torvalds

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

* Re: [PATCH] fbcon: replace mono_col macro with static inline
  2008-02-26  8:18 ` Geert Uytterhoeven
@ 2008-02-26 20:51   ` Harvey Harrison
  2008-02-26 21:36     ` [Linux-fbdev-devel] " Geert Uytterhoeven
  0 siblings, 1 reply; 6+ messages in thread
From: Harvey Harrison @ 2008-02-26 20:51 UTC (permalink / raw)
  To: Geert Uytterhoeven
  Cc: Antonino Daplas, Andrew Morton, LKML,
	Linux Frame Buffer Device Development

On Tue, 2008-02-26 at 09:18 +0100, Geert Uytterhoeven wrote:
> On Mon, 25 Feb 2008, Harvey Harrison wrote:
> > +static inline int mono_col(struct fb_info *info)
>                               ^^^^^^^^^^^^^^^^^^^^
> const struct fb_info *info?
> 

I suppose, but seeing as it's an inline, does it really matter?

Harvey


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

* Re: [Linux-fbdev-devel] [PATCH] fbcon: replace mono_col macro with static inline
  2008-02-26 20:51   ` Harvey Harrison
@ 2008-02-26 21:36     ` Geert Uytterhoeven
  2008-02-26 21:50       ` Harvey Harrison
  0 siblings, 1 reply; 6+ messages in thread
From: Geert Uytterhoeven @ 2008-02-26 21:36 UTC (permalink / raw)
  To: Linux Frame Buffer Device Development
  Cc: Andrew Morton, LKML, Antonino Daplas

On Tue, 26 Feb 2008, Harvey Harrison wrote:
> On Tue, 2008-02-26 at 09:18 +0100, Geert Uytterhoeven wrote:
> > On Mon, 25 Feb 2008, Harvey Harrison wrote:
> > > +static inline int mono_col(struct fb_info *info)
> >                               ^^^^^^^^^^^^^^^^^^^^
> > const struct fb_info *info?
> 
> I suppose, but seeing as it's an inline, does it really matter?

Sure, if one day a new routine calls mono_col() passing a const struct fb_info
pointer, it won't compile.

Gr{oetje,eeting}s,

						Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
							    -- Linus Torvalds

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

* Re: [Linux-fbdev-devel] [PATCH] fbcon: replace mono_col macro with static inline
  2008-02-26 21:36     ` [Linux-fbdev-devel] " Geert Uytterhoeven
@ 2008-02-26 21:50       ` Harvey Harrison
  0 siblings, 0 replies; 6+ messages in thread
From: Harvey Harrison @ 2008-02-26 21:50 UTC (permalink / raw)
  To: Geert Uytterhoeven
  Cc: Linux Frame Buffer Device Development, Andrew Morton, LKML,
	Antonino Daplas

On Tue, 2008-02-26 at 22:36 +0100, Geert Uytterhoeven wrote:
> On Tue, 26 Feb 2008, Harvey Harrison wrote:
> > On Tue, 2008-02-26 at 09:18 +0100, Geert Uytterhoeven wrote:
> > > On Mon, 25 Feb 2008, Harvey Harrison wrote:
> > > > +static inline int mono_col(struct fb_info *info)
> > >                               ^^^^^^^^^^^^^^^^^^^^
> > > const struct fb_info *info?
> > 
> > I suppose, but seeing as it's an inline, does it really matter?
> 
> Sure, if one day a new routine calls mono_col() passing a const struct fb_info
> pointer, it won't compile.

Fair enough, want an updated patch, or will Andrew just make the small
addition?

Harvey


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

end of thread, other threads:[~2008-02-26 21:50 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-02-25 18:13 [PATCH] fbcon: replace mono_col macro with static inline Harvey Harrison
2008-02-25 18:50 ` Andrew Morton
2008-02-26  8:18 ` Geert Uytterhoeven
2008-02-26 20:51   ` Harvey Harrison
2008-02-26 21:36     ` [Linux-fbdev-devel] " Geert Uytterhoeven
2008-02-26 21:50       ` Harvey Harrison

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).