All of lore.kernel.org
 help / color / mirror / Atom feed
From: Joe Perches <joe@perches.com>
To: Jiri Slaby <jslaby@suse.cz>, tomi.valkeinen@ti.com
Cc: plagnioj@jcrosoft.com, linux-fbdev@vger.kernel.org,
	akpm@linux-foundation.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 3/3] mdacon: replace MDA_ADDR macro by inline function
Date: Mon, 25 Jul 2016 09:04:29 -0700	[thread overview]
Message-ID: <1469462669.1900.181.camel@perches.com> (raw)
In-Reply-To: <20160725152440.6734-3-jslaby@suse.cz>

On Mon, 2016-07-25 at 17:24 +0200, Jiri Slaby wrote:
> MDA_ADDR is one of those macros which could be an inline function. So
> convert MDA_ADDR to mda_addr.
> 
> Signed-off-by: Jiri Slaby <jslaby@suse.cz>
> ---
>  drivers/video/console/mdacon.c | 19 +++++++++++--------
>  1 file changed, 11 insertions(+), 8 deletions(-)
> 
> diff --git a/drivers/video/console/mdacon.c b/drivers/video/console/mdacon.c
> index 814606bd26d1..24fe55134eb5 100644
> --- a/drivers/video/console/mdacon.c
> +++ b/drivers/video/console/mdacon.c
> @@ -420,17 +420,20 @@ static void mdacon_invert_region(struct vc_data *c, u16 *p, int count)
>  	}
>  }
>  
> -#define MDA_ADDR(x, y)  (mda_vram_base + (y)*mda_num_columns + (x))
> +static inline u16 *mda_addr(unsigned int x, unsigned int y)

Are you sure about the unsigned?
All of the changed use are taking int

> +{
> +	return mda_vram_base + y * mda_num_columns + x;
> +}
>  
>  static void mdacon_putc(struct vc_data *c, int ch, int y, int x)
>  {
> -	scr_writew(mda_convert_attr(ch), MDA_ADDR(x, y));
> +	scr_writew(mda_convert_attr(ch), mda_addr(x, y));
>  }
>  
>  static void mdacon_putcs(struct vc_data *c, const unsigned short *s,
>  		         int count, int y, int x)
>  {
> -	u16 *dest = MDA_ADDR(x, y);
> +	u16 *dest = mda_addr(x, y);
>  
>  	for (; count > 0; count--) {
>  		scr_writew(mda_convert_attr(scr_readw(s++)), dest++);
> @@ -440,7 +443,7 @@ static void mdacon_putcs(struct vc_data *c, const unsigned short *s,
>  static void mdacon_clear(struct vc_data *c, int y, int x, 
>  			  int height, int width)
>  {
> -	u16 *dest = MDA_ADDR(x, y);
> +	u16 *dest = mda_addr(x, y);
>  	u16 eattr = mda_convert_attr(c->vc_video_erase_char);
>  
>  	if (width <= 0 || height <= 0)
> @@ -511,16 +514,16 @@ static int mdacon_scroll(struct vc_data *c, int t, int b, int dir, int lines)
>  	switch (dir) {
>  
>  	case SM_UP:
> -		scr_memmovew(MDA_ADDR(0,t), MDA_ADDR(0,t+lines),
> +		scr_memmovew(mda_addr(0, t), mda_addr(0, t + lines),
>  				(b-t-lines)*mda_num_columns*2);
> -		scr_memsetw(MDA_ADDR(0,b-lines), eattr,
> +		scr_memsetw(mda_addr(0, b - lines), eattr,
>  				lines*mda_num_columns*2);
>  		break;
>  
>  	case SM_DOWN:
> -		scr_memmovew(MDA_ADDR(0,t+lines), MDA_ADDR(0,t),
> +		scr_memmovew(mda_addr(0, t + lines), mda_addr(0, t),
>  				(b-t-lines)*mda_num_columns*2);
> -		scr_memsetw(MDA_ADDR(0,t), eattr, lines*mda_num_columns*2);
> +		scr_memsetw(mda_addr(0, t), eattr, lines*mda_num_columns*2);
>  		break;
>  	}
>  

WARNING: multiple messages have this Message-ID (diff)
From: Joe Perches <joe@perches.com>
To: Jiri Slaby <jslaby@suse.cz>, tomi.valkeinen@ti.com
Cc: plagnioj@jcrosoft.com, linux-fbdev@vger.kernel.org,
	akpm@linux-foundation.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 3/3] mdacon: replace MDA_ADDR macro by inline function
Date: Mon, 25 Jul 2016 16:04:29 +0000	[thread overview]
Message-ID: <1469462669.1900.181.camel@perches.com> (raw)
In-Reply-To: <20160725152440.6734-3-jslaby@suse.cz>

On Mon, 2016-07-25 at 17:24 +0200, Jiri Slaby wrote:
> MDA_ADDR is one of those macros which could be an inline function. So
> convert MDA_ADDR to mda_addr.
> 
> Signed-off-by: Jiri Slaby <jslaby@suse.cz>
> ---
>  drivers/video/console/mdacon.c | 19 +++++++++++--------
>  1 file changed, 11 insertions(+), 8 deletions(-)
> 
> diff --git a/drivers/video/console/mdacon.c b/drivers/video/console/mdacon.c
> index 814606bd26d1..24fe55134eb5 100644
> --- a/drivers/video/console/mdacon.c
> +++ b/drivers/video/console/mdacon.c
> @@ -420,17 +420,20 @@ static void mdacon_invert_region(struct vc_data *c, u16 *p, int count)
>  	}
>  }
>  
> -#define MDA_ADDR(x, y)  (mda_vram_base + (y)*mda_num_columns + (x))
> +static inline u16 *mda_addr(unsigned int x, unsigned int y)

Are you sure about the unsigned?
All of the changed use are taking int

> +{
> +	return mda_vram_base + y * mda_num_columns + x;
> +}
>  
>  static void mdacon_putc(struct vc_data *c, int ch, int y, int x)
>  {
> -	scr_writew(mda_convert_attr(ch), MDA_ADDR(x, y));
> +	scr_writew(mda_convert_attr(ch), mda_addr(x, y));
>  }
>  
>  static void mdacon_putcs(struct vc_data *c, const unsigned short *s,
>  		         int count, int y, int x)
>  {
> -	u16 *dest = MDA_ADDR(x, y);
> +	u16 *dest = mda_addr(x, y);
>  
>  	for (; count > 0; count--) {
>  		scr_writew(mda_convert_attr(scr_readw(s++)), dest++);
> @@ -440,7 +443,7 @@ static void mdacon_putcs(struct vc_data *c, const unsigned short *s,
>  static void mdacon_clear(struct vc_data *c, int y, int x, 
>  			  int height, int width)
>  {
> -	u16 *dest = MDA_ADDR(x, y);
> +	u16 *dest = mda_addr(x, y);
>  	u16 eattr = mda_convert_attr(c->vc_video_erase_char);
>  
>  	if (width <= 0 || height <= 0)
> @@ -511,16 +514,16 @@ static int mdacon_scroll(struct vc_data *c, int t, int b, int dir, int lines)
>  	switch (dir) {
>  
>  	case SM_UP:
> -		scr_memmovew(MDA_ADDR(0,t), MDA_ADDR(0,t+lines),
> +		scr_memmovew(mda_addr(0, t), mda_addr(0, t + lines),
>  				(b-t-lines)*mda_num_columns*2);
> -		scr_memsetw(MDA_ADDR(0,b-lines), eattr,
> +		scr_memsetw(mda_addr(0, b - lines), eattr,
>  				lines*mda_num_columns*2);
>  		break;
>  
>  	case SM_DOWN:
> -		scr_memmovew(MDA_ADDR(0,t+lines), MDA_ADDR(0,t),
> +		scr_memmovew(mda_addr(0, t + lines), mda_addr(0, t),
>  				(b-t-lines)*mda_num_columns*2);
> -		scr_memsetw(MDA_ADDR(0,t), eattr, lines*mda_num_columns*2);
> +		scr_memsetw(mda_addr(0, t), eattr, lines*mda_num_columns*2);
>  		break;
>  	}
>  

  reply	other threads:[~2016-07-25 16:04 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-07-25 15:24 [PATCH 1/3] mdacon: align code in mda_detect properly Jiri Slaby
2016-07-25 15:24 ` Jiri Slaby
2016-07-25 15:24 ` [PATCH 2/3] mdacon: make mda_vram_base u16 * Jiri Slaby
2016-07-25 15:24   ` Jiri Slaby
2016-07-25 15:24 ` [PATCH 3/3] mdacon: replace MDA_ADDR macro by inline function Jiri Slaby
2016-07-25 15:24   ` Jiri Slaby
2016-07-25 16:04   ` Joe Perches [this message]
2016-07-25 16:04     ` Joe Perches
2016-07-29 10:53     ` Jiri Slaby
2016-07-29 10:53       ` Jiri Slaby
2017-05-12  8:08 [PATCH 1/3] mdacon: align code in mda_detect properly Jiri Slaby
2017-05-12  8:08 ` [PATCH 3/3] mdacon: replace MDA_ADDR macro by inline function Jiri Slaby
2017-05-12  8:08   ` Jiri Slaby
2017-05-12  8:08   ` Jiri Slaby
     [not found]   ` <CGME20170614132927epcas1p311aa2291f0d36ce0691955287c9af3a2@epcas1p3.samsung.com>
2017-06-14 13:29     ` Bartlomiej Zolnierkiewicz
2017-06-14 13:29       ` Bartlomiej Zolnierkiewicz

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1469462669.1900.181.camel@perches.com \
    --to=joe@perches.com \
    --cc=akpm@linux-foundation.org \
    --cc=jslaby@suse.cz \
    --cc=linux-fbdev@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=plagnioj@jcrosoft.com \
    --cc=tomi.valkeinen@ti.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.