From: Dan Carpenter <dan.carpenter@oracle.com>
To: Isaac Lleida <isakyllr@openmailbox.org>
Cc: willy@meta-x.org, devel@driverdev.osuosl.org,
isaky <illeida@openaliasbox.org>,
armand.bastien@laposte.net, gregkh@linuxfoundation.org,
linux-kernel@vger.kernel.org, marius.gorski@gmail.com,
domdevlin@free.fr, sudipm.mukherjee@gmail.com
Subject: Re: [PATCH] staging: panel: change struct bits to a bit array
Date: Mon, 16 Mar 2015 12:08:49 +0300 [thread overview]
Message-ID: <20150316090848.GH10964@mwanda> (raw)
In-Reply-To: <1426264923-12392-1-git-send-email-isakyllr@openmailbox.org>
On Fri, Mar 13, 2015 at 05:42:03PM +0100, Isaac Lleida wrote:
> From: isaky <illeida@openaliasbox.org>
Not your name. Leave this out unless you are passing on someone else's
patch.
>
> This path implements a bit array representing the LCD signal states instead of the old "struct bits", which used char to represent a single bit. This will reduce the memory usage.
>
Line wraps the changelog.
> Signed-off-by: Isaac Lleida <illeida@openaliasbox.org>
This should match the email address you used to send the patch.
> ---
> drivers/staging/panel/panel.c | 86 ++++++++++++++++++++++++-------------------
> 1 file changed, 49 insertions(+), 37 deletions(-)
>
> diff --git a/drivers/staging/panel/panel.c b/drivers/staging/panel/panel.c
> index 3339633..7deb092 100644
> --- a/drivers/staging/panel/panel.c
> +++ b/drivers/staging/panel/panel.c
> @@ -310,6 +310,25 @@ static int selected_lcd_type = NOT_SET;
> #define LCD_BITS 6
>
> /*
> + * LCD signal states
> + */
> +#define LCD_BIT_E_MASK 0x1 /* E (data latch on falling edge) */
> +#define LCD_BIT_RS_MASK 0x2 /* RS (0 = cmd, 1 = data) */
> +#define LCD_BIT_RW_MASK 0x4 /* R/W (0 = W, 1 = R) */
> +#define LCD_BIT_BL_MASK 0x8 /* backlight (0 = off, 1 = on) */
> +#define LCD_BIT_CL_MASK 0x10 /* clock (latch on rising edge) */
> +#define LCD_BIT_DA_MASK 0x20 /* data */
> +
> +/*
> + * Bit array operations
> + */
> +#define BIT_ON(b, m) (b |= m)
> +#define BIT_OFF(b, m) (b &= ~m)
> +#define BIT_CHK(b, m) (b & m)
> +#define BIT_MOD(b, m, v) \
> + ((v) ? BIT_ON(b, m) : BIT_OFF(b, m)) \
> +
Ugh. No. These are yuck macros. Just do it directly. Also the
BIT_MOD() has end in a '\' char.
> +/*
> * each bit can be either connected to a DATA or CTRL port
> */
> #define LCD_PORT_C 0
> @@ -653,15 +672,8 @@ static const char nexcom_keypad_profile[][4][9] = {
>
> static const char (*keypad_profile)[4][9] = old_keypad_profile;
>
> -/* FIXME: this should be converted to a bit array containing signals states */
> -static struct {
> - unsigned char e; /* parallel LCD E (data latch on falling edge) */
> - unsigned char rs; /* parallel LCD RS (0 = cmd, 1 = data) */
> - unsigned char rw; /* parallel LCD R/W (0 = W, 1 = R) */
> - unsigned char bl; /* parallel LCD backlight (0 = off, 1 = on) */
> - unsigned char cl; /* serial LCD clock (latch on rising edge) */
> - unsigned char da; /* serial LCD data */
> -} bits;
> +/* Bit array containing signals states */
> +static char bits;
I don't think this is what the comment means. I think it means that
we do something like:
static struct {
unsigned long e:1;
unsigned long rs:1;
...
} bits;
1) This space saving are very small. On 64 bit systems then we don't
save any space at all because everything is aligned at 8 bytes.
2) The name "e" is not self documenting. None of them are.
Christophe had a bunch more comments on this patch so I'm not going to
read any further.
regards,
dan carpenter
prev parent reply other threads:[~2015-03-16 9:09 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-03-13 16:42 [PATCH] staging: panel: change struct bits to a bit array Isaac Lleida
2015-03-16 9:08 ` Dan Carpenter [this message]
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=20150316090848.GH10964@mwanda \
--to=dan.carpenter@oracle.com \
--cc=armand.bastien@laposte.net \
--cc=devel@driverdev.osuosl.org \
--cc=domdevlin@free.fr \
--cc=gregkh@linuxfoundation.org \
--cc=illeida@openaliasbox.org \
--cc=isakyllr@openmailbox.org \
--cc=linux-kernel@vger.kernel.org \
--cc=marius.gorski@gmail.com \
--cc=sudipm.mukherjee@gmail.com \
--cc=willy@meta-x.org \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox