From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: Sudip Mukherjee <sudipm.mukherjee@gmail.com>
Cc: devel@driverdev.osuosl.org, linux-fbdev@vger.kernel.org,
linux-kernel@vger.kernel.org,
Dan Carpenter <dan.carpenter@oracle.com>
Subject: Re: [PATCH 4/5] staging: sm7xxfb: define new macros
Date: Wed, 15 Jul 2015 03:05:08 +0000 [thread overview]
Message-ID: <20150715030508.GA20352@kroah.com> (raw)
In-Reply-To: <1436256877-10754-5-git-send-email-sudipm.mukherjee@gmail.com>
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 :(
WARNING: multiple messages have this Message-ID (diff)
From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: Sudip Mukherjee <sudipm.mukherjee@gmail.com>
Cc: devel@driverdev.osuosl.org, linux-fbdev@vger.kernel.org,
linux-kernel@vger.kernel.org,
Dan Carpenter <dan.carpenter@oracle.com>
Subject: Re: [PATCH 4/5] staging: sm7xxfb: define new macros
Date: Tue, 14 Jul 2015 20:05:08 -0700 [thread overview]
Message-ID: <20150715030508.GA20352@kroah.com> (raw)
In-Reply-To: <1436256877-10754-5-git-send-email-sudipm.mukherjee@gmail.com>
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 :(
next prev parent reply other threads:[~2015-07-15 3:05 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-07-07 8:14 [PATCH 0/5] staging: sm7xxfb: few changes Sudip Mukherjee
2015-07-07 8:26 ` Sudip Mukherjee
2015-07-07 8:14 ` [PATCH 1/5] staging: sm7xxfb: remove unused macros Sudip Mukherjee
2015-07-07 8:26 ` Sudip Mukherjee
2015-07-07 8:14 ` [PATCH 2/5] staging: sm7xxfb: fix error handling Sudip Mukherjee
2015-07-07 8:26 ` Sudip Mukherjee
2015-07-07 8:14 ` [PATCH 3/5] staging: sm7xxfb: use kernel commandline Sudip Mukherjee
2015-07-07 8:26 ` Sudip Mukherjee
2015-07-15 3:06 ` Greg Kroah-Hartman
2015-07-15 3:06 ` Greg Kroah-Hartman
2015-07-07 8:14 ` [PATCH 4/5] staging: sm7xxfb: define new macros Sudip Mukherjee
2015-07-07 8:26 ` Sudip Mukherjee
2015-07-15 3:05 ` Greg Kroah-Hartman [this message]
2015-07-15 3:05 ` Greg Kroah-Hartman
2015-07-15 4:46 ` Sudip Mukherjee
2015-07-15 4:58 ` Sudip Mukherjee
2015-07-07 8:14 ` [PATCH 5/5] staging: sm7xxfb: usr fb_read and fb_write Sudip Mukherjee
2015-07-07 8:26 ` Sudip Mukherjee
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=20150715030508.GA20352@kroah.com \
--to=gregkh@linuxfoundation.org \
--cc=dan.carpenter@oracle.com \
--cc=devel@driverdev.osuosl.org \
--cc=linux-fbdev@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=sudipm.mukherjee@gmail.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.