Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1184232

Re: [PATCH 4/5] staging: sm7xxfb: define new macros

From Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Newsgroups linux.kernel
Subject Re: [PATCH 4/5] staging: sm7xxfb: define new macros
Date 2015-07-15 05:10 +0200
Message-ID <pMlf4-3in-25@gated-at.bofh.it> (permalink)
References <pJwgF-36B-1@gated-at.bofh.it> <pJwgG-36B-21@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On Tue, Jul 07, 2015 at 01:44:36PM +0530, Sudip Mukherjee wrote:
> Define and use some new macros to work with different situations
> based on little-endian and big-endian.
> 
> Signed-off-by: Sudip Mukherjee <sudip@vectorindia.org>
> ---
>  drivers/staging/sm7xxfb/sm7xx.h   | 19 ++++++++++++++++
>  drivers/staging/sm7xxfb/sm7xxfb.c | 48 ++++++++-------------------------------
>  2 files changed, 29 insertions(+), 38 deletions(-)
> 
> diff --git a/drivers/staging/sm7xxfb/sm7xx.h b/drivers/staging/sm7xxfb/sm7xx.h
> index 31a21bd..6905177 100644
> --- a/drivers/staging/sm7xxfb/sm7xx.h
> +++ b/drivers/staging/sm7xxfb/sm7xx.h
> @@ -95,3 +95,22 @@ struct modeinit {
>  	unsigned char init_cr30_cr4d[SIZE_CR30_CR4D];
>  	unsigned char init_cr90_cra7[SIZE_CR90_CRA7];
>  };
> +
> +#ifdef __BIG_ENDIAN
> +#define pal_rgb(r, g, b, val)	(((r & 0xf800) >> 8) | \
> +				((g & 0xe000) >> 13) | \
> +				((g & 0x1c00) << 3) | \
> +				((b & 0xf800) >> 3))
> +#define big_addr		0x800000
> +#define mmio_addr		0x00800000
> +#define seqw17			smtc_seqw(0x17, 0x30)
> +#define big_pixel_depth(p, d)	{if (p == 24) {p = 32; d = 32; } }
> +#define big_swap(p)		((p & 0xff00ff00 >> 8) | (p & 0x00ff00ff << 8))
> +#else
> +#define pal_rgb(r, g, b, val)	val
> +#define big_addr		0
> +#define mmio_addr		0x00c00000
> +#define seqw17

Odd, empty macros are not good, because:

> -#ifdef __BIG_ENDIAN
>  		if (sfb->fb->var.bits_per_pixel == 32)
> -			smtc_seqw(0x17, 0x30);
> -#endif
> +			seqw17;

That just looks wrong :(

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Back to linux.kernel | Previous | Next | Find similar | Unroll thread


Thread

Re: [PATCH 4/5] staging: sm7xxfb: define new macros Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2015-07-15 05:10 +0200

csiph-web