* [PATCH v4 2/2] staging: fbtft: convert a macro to a function.
@ 2019-03-06 11:15 Bhagyashri Dighole
2019-03-07 19:30 ` Greg Kroah-Hartman
0 siblings, 1 reply; 7+ messages in thread
From: Bhagyashri Dighole @ 2019-03-06 11:15 UTC (permalink / raw)
To: Greg Kroah-Hartman; +Cc: Outreachy
Convert a macro to an inline function to improve type safety and make
the code simpler.
Signed-off-by: Bhagyashri Dighole <digholebhagyashri@gmail.com>
---
Changes in v4:
-- Modify log messages.
Changes in v3:
-- Change the subject line according to log messages.
-- Remove extra spaces.
Changes in v2:
-- Make the converion from macro to inline function
drivers/staging/fbtft/fb_watterott.c | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
diff --git a/drivers/staging/fbtft/fb_watterott.c b/drivers/staging/fbtft/fb_watterott.c
index 502d67f..40e5427 100644
--- a/drivers/staging/fbtft/fb_watterott.c
+++ b/drivers/staging/fbtft/fb_watterott.c
@@ -90,9 +90,10 @@ static int write_vmem(struct fbtft_par *par, size_t offset, size_t len)
return 0;
}
-#define RGB565toRGB332(c) ((((c) & 0xE000) >> 8) |\
- (((c) & 000700) >> 6) |\
- (((c) & 0x0018) >> 3))
+inline int rgb565_to_rgb332(u16 c)
+{
+ return ((c & 0xE000) >> 8)| ((c & 000700) >> 6)| ((c & 0x0018) >> 3);
+}
static int write_vmem_8bit(struct fbtft_par *par, size_t offset, size_t len)
{
@@ -116,7 +117,7 @@ static int write_vmem_8bit(struct fbtft_par *par, size_t offset, size_t len)
for (i = start_line; i <= end_line; i++) {
pos[1] = cpu_to_be16(i);
for (j = 0; j < par->info->var.xres; j++) {
- buf8[j] = RGB565toRGB332(*vmem16);
+ buf8[j] = rgb565_to_rgb332(*vmem16);
vmem16++;
}
ret = par->fbtftops.write(par,
--
2.7.4
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH v4 2/2] staging: fbtft: convert a macro to a function.
2019-03-06 11:15 [PATCH v4 2/2] staging: fbtft: convert a macro to a function Bhagyashri Dighole
@ 2019-03-07 19:30 ` Greg Kroah-Hartman
2019-03-08 6:05 ` Bhagyashri Dighole
0 siblings, 1 reply; 7+ messages in thread
From: Greg Kroah-Hartman @ 2019-03-07 19:30 UTC (permalink / raw)
To: Bhagyashri Dighole; +Cc: Outreachy
On Wed, Mar 06, 2019 at 04:45:12PM +0530, Bhagyashri Dighole wrote:
> Convert a macro to an inline function to improve type safety and make
> the code simpler.
>
> Signed-off-by: Bhagyashri Dighole <digholebhagyashri@gmail.com>
> ---
> Changes in v4:
> -- Modify log messages.
>
> Changes in v3:
> -- Change the subject line according to log messages.
> -- Remove extra spaces.
>
> Changes in v2:
> -- Make the converion from macro to inline function
>
> drivers/staging/fbtft/fb_watterott.c | 9 +++++----
> 1 file changed, 5 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/staging/fbtft/fb_watterott.c b/drivers/staging/fbtft/fb_watterott.c
> index 502d67f..40e5427 100644
> --- a/drivers/staging/fbtft/fb_watterott.c
> +++ b/drivers/staging/fbtft/fb_watterott.c
> @@ -90,9 +90,10 @@ static int write_vmem(struct fbtft_par *par, size_t offset, size_t len)
> return 0;
> }
>
> -#define RGB565toRGB332(c) ((((c) & 0xE000) >> 8) |\
> - (((c) & 000700) >> 6) |\
> - (((c) & 0x0018) >> 3))
> +inline int rgb565_to_rgb332(u16 c)
> +{
> + return ((c & 0xE000) >> 8)| ((c & 000700) >> 6)| ((c & 0x0018) >> 3);
Odd placement of '|' right? checkpatch.pl didn't complain about this?
Please put a space on both sides of that operator.
thanks,
greg k-h
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH v4 2/2] staging: fbtft: convert a macro to a function.
2019-03-07 19:30 ` Greg Kroah-Hartman
@ 2019-03-08 6:05 ` Bhagyashri Dighole
2019-03-08 6:21 ` Greg Kroah-Hartman
2019-03-08 7:28 ` [Outreachy kernel] " Julia Lawall
0 siblings, 2 replies; 7+ messages in thread
From: Bhagyashri Dighole @ 2019-03-08 6:05 UTC (permalink / raw)
To: Greg Kroah-Hartman; +Cc: Outreachy
[-- Attachment #1: Type: text/plain, Size: 1640 bytes --]
On Fri, Mar 8, 2019 at 1:00 AM Greg Kroah-Hartman <
gregkh@linuxfoundation.org> wrote:
> On Wed, Mar 06, 2019 at 04:45:12PM +0530, Bhagyashri Dighole wrote:
> > Convert a macro to an inline function to improve type safety and make
> > the code simpler.
> >
> > Signed-off-by: Bhagyashri Dighole <digholebhagyashri@gmail.com>
> > ---
> > Changes in v4:
> > -- Modify log messages.
> >
> > Changes in v3:
> > -- Change the subject line according to log messages.
> > -- Remove extra spaces.
> >
> > Changes in v2:
> > -- Make the converion from macro to inline function
> >
> > drivers/staging/fbtft/fb_watterott.c | 9 +++++----
> > 1 file changed, 5 insertions(+), 4 deletions(-)
> >
> > diff --git a/drivers/staging/fbtft/fb_watterott.c
> b/drivers/staging/fbtft/fb_watterott.c
> > index 502d67f..40e5427 100644
> > --- a/drivers/staging/fbtft/fb_watterott.c
> > +++ b/drivers/staging/fbtft/fb_watterott.c
> > @@ -90,9 +90,10 @@ static int write_vmem(struct fbtft_par *par, size_t
> offset, size_t len)
> > return 0;
> > }
> >
> > -#define RGB565toRGB332(c) ((((c) & 0xE000) >> 8) |\
> > - (((c) & 000700) >> 6) |\
> > - (((c) & 0x0018) >> 3))
> > +inline int rgb565_to_rgb332(u16 c)
> > +{
> > + return ((c & 0xE000) >> 8)| ((c & 000700) >> 6)| ((c & 0x0018) >>
> 3);
>
> Odd placement of '|' right? checkpatch.pl didn't complain about this?
>
Yes, checkpatch.pl complain about it, but as per the suggestion i got,
I need to skip one space because line is about to reach 80 characters.
>
> Please put a space on both sides of that operator.
>
> thanks,
>
> greg k-h
>
[-- Attachment #2: Type: text/html, Size: 2634 bytes --]
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH v4 2/2] staging: fbtft: convert a macro to a function.
2019-03-08 6:05 ` Bhagyashri Dighole
@ 2019-03-08 6:21 ` Greg Kroah-Hartman
2019-03-08 6:29 ` Bhagyashri Dighole
2019-03-08 7:28 ` [Outreachy kernel] " Julia Lawall
1 sibling, 1 reply; 7+ messages in thread
From: Greg Kroah-Hartman @ 2019-03-08 6:21 UTC (permalink / raw)
To: Bhagyashri Dighole; +Cc: Outreachy
On Fri, Mar 08, 2019 at 11:35:02AM +0530, Bhagyashri Dighole wrote:
> On Fri, Mar 8, 2019 at 1:00 AM Greg Kroah-Hartman <
> gregkh@linuxfoundation.org> wrote:
>
> > On Wed, Mar 06, 2019 at 04:45:12PM +0530, Bhagyashri Dighole wrote:
> > > Convert a macro to an inline function to improve type safety and make
> > > the code simpler.
> > >
> > > Signed-off-by: Bhagyashri Dighole <digholebhagyashri@gmail.com>
> > > ---
> > > Changes in v4:
> > > -- Modify log messages.
> > >
> > > Changes in v3:
> > > -- Change the subject line according to log messages.
> > > -- Remove extra spaces.
> > >
> > > Changes in v2:
> > > -- Make the converion from macro to inline function
> > >
> > > drivers/staging/fbtft/fb_watterott.c | 9 +++++----
> > > 1 file changed, 5 insertions(+), 4 deletions(-)
> > >
> > > diff --git a/drivers/staging/fbtft/fb_watterott.c
> > b/drivers/staging/fbtft/fb_watterott.c
> > > index 502d67f..40e5427 100644
> > > --- a/drivers/staging/fbtft/fb_watterott.c
> > > +++ b/drivers/staging/fbtft/fb_watterott.c
> > > @@ -90,9 +90,10 @@ static int write_vmem(struct fbtft_par *par, size_t
> > offset, size_t len)
> > > return 0;
> > > }
> > >
> > > -#define RGB565toRGB332(c) ((((c) & 0xE000) >> 8) |\
> > > - (((c) & 000700) >> 6) |\
> > > - (((c) & 0x0018) >> 3))
> > > +inline int rgb565_to_rgb332(u16 c)
> > > +{
> > > + return ((c & 0xE000) >> 8)| ((c & 000700) >> 6)| ((c & 0x0018) >>
> > 3);
> >
> > Odd placement of '|' right? checkpatch.pl didn't complain about this?
> >
>
> Yes, checkpatch.pl complain about it, but as per the suggestion i got,
> I need to skip one space because line is about to reach 80 characters.
Don't make one coding style change just to have to send a follow-on
coding style change for that modification. The goal is to reduce the
number of warnings, not just constantly send new patches :)
thanks,
greg k-h
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH v4 2/2] staging: fbtft: convert a macro to a function.
2019-03-08 6:21 ` Greg Kroah-Hartman
@ 2019-03-08 6:29 ` Bhagyashri Dighole
0 siblings, 0 replies; 7+ messages in thread
From: Bhagyashri Dighole @ 2019-03-08 6:29 UTC (permalink / raw)
To: Greg Kroah-Hartman; +Cc: Outreachy
[-- Attachment #1: Type: text/plain, Size: 2149 bytes --]
On Fri, Mar 8, 2019 at 11:51 AM Greg Kroah-Hartman <
gregkh@linuxfoundation.org> wrote:
> On Fri, Mar 08, 2019 at 11:35:02AM +0530, Bhagyashri Dighole wrote:
> > On Fri, Mar 8, 2019 at 1:00 AM Greg Kroah-Hartman <
> > gregkh@linuxfoundation.org> wrote:
> >
> > > On Wed, Mar 06, 2019 at 04:45:12PM +0530, Bhagyashri Dighole wrote:
> > > > Convert a macro to an inline function to improve type safety and make
> > > > the code simpler.
> > > >
> > > > Signed-off-by: Bhagyashri Dighole <digholebhagyashri@gmail.com>
> > > > ---
> > > > Changes in v4:
> > > > -- Modify log messages.
> > > >
> > > > Changes in v3:
> > > > -- Change the subject line according to log messages.
> > > > -- Remove extra spaces.
> > > >
> > > > Changes in v2:
> > > > -- Make the converion from macro to inline function
> > > >
> > > > drivers/staging/fbtft/fb_watterott.c | 9 +++++----
> > > > 1 file changed, 5 insertions(+), 4 deletions(-)
> > > >
> > > > diff --git a/drivers/staging/fbtft/fb_watterott.c
> > > b/drivers/staging/fbtft/fb_watterott.c
> > > > index 502d67f..40e5427 100644
> > > > --- a/drivers/staging/fbtft/fb_watterott.c
> > > > +++ b/drivers/staging/fbtft/fb_watterott.c
> > > > @@ -90,9 +90,10 @@ static int write_vmem(struct fbtft_par *par,
> size_t
> > > offset, size_t len)
> > > > return 0;
> > > > }
> > > >
> > > > -#define RGB565toRGB332(c) ((((c) & 0xE000) >> 8) |\
> > > > - (((c) & 000700) >> 6) |\
> > > > - (((c) & 0x0018) >> 3))
> > > > +inline int rgb565_to_rgb332(u16 c)
> > > > +{
> > > > + return ((c & 0xE000) >> 8)| ((c & 000700) >> 6)| ((c & 0x0018)
> >>
> > > 3);
> > >
> > > Odd placement of '|' right? checkpatch.pl didn't complain about this?
> > >
> >
> > Yes, checkpatch.pl complain about it, but as per the suggestion i got,
> > I need to skip one space because line is about to reach 80 characters.
>
> Don't make one coding style change just to have to send a follow-on
> coding style change for that modification. The goal is to reduce the
> number of warnings, not just constantly send new patches :)
>
Okay.
Thanks.
>
> thanks,
>
> greg k-h
>
[-- Attachment #2: Type: text/html, Size: 3536 bytes --]
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [Outreachy kernel] Re: [PATCH v4 2/2] staging: fbtft: convert a macro to a function.
2019-03-08 6:05 ` Bhagyashri Dighole
2019-03-08 6:21 ` Greg Kroah-Hartman
@ 2019-03-08 7:28 ` Julia Lawall
1 sibling, 0 replies; 7+ messages in thread
From: Julia Lawall @ 2019-03-08 7:28 UTC (permalink / raw)
To: Bhagyashri Dighole; +Cc: Greg Kroah-Hartman, Outreachy
[-- Attachment #1: Type: text/plain, Size: 2609 bytes --]
On Fri, 8 Mar 2019, Bhagyashri Dighole wrote:
>
>
> On Fri, Mar 8, 2019 at 1:00 AM Greg Kroah-Hartman
> <gregkh@linuxfoundation.org> wrote:
> On Wed, Mar 06, 2019 at 04:45:12PM +0530, Bhagyashri Dighole
> wrote:
> > Convert a macro to an inline function to improve type safety
> and make
> > the code simpler.
> >
> > Signed-off-by: Bhagyashri Dighole
> <digholebhagyashri@gmail.com>
> > ---
> > Changes in v4:
> > -- Modify log messages.
> >
> > Changes in v3:
> > -- Change the subject line according to log messages.
> > -- Remove extra spaces.
> >
> > Changes in v2:
> > -- Make the converion from macro to inline function
> >
> > drivers/staging/fbtft/fb_watterott.c | 9 +++++----
> > 1 file changed, 5 insertions(+), 4 deletions(-)
> >
> > diff --git a/drivers/staging/fbtft/fb_watterott.c
> b/drivers/staging/fbtft/fb_watterott.c
> > index 502d67f..40e5427 100644
> > --- a/drivers/staging/fbtft/fb_watterott.c
> > +++ b/drivers/staging/fbtft/fb_watterott.c
> > @@ -90,9 +90,10 @@ static int write_vmem(struct fbtft_par
> *par, size_t offset, size_t len)
> > return 0;
> > }
> >
> > -#define RGB565toRGB332(c) ((((c) & 0xE000) >> 8) |\
> > - (((c) & 000700) >> 6) |\
> > - (((c) & 0x0018) >> 3))
> > +inline int rgb565_to_rgb332(u16 c)
> > +{
> > + return ((c & 0xE000) >> 8)| ((c & 000700) >> 6)| ((c &
> 0x0018) >> 3);
>
> Odd placement of '|' right? checkpatch.pl didn't complain about
> this?
>
>
> Yes, checkpatch.pl complain about it, but as per the suggestion i got,
> I need to skip one space because line is about to reach 80 characters.
A newline would be fine, if needed.
julia
>
> Please put a space on both sides of that operator.
>
> thanks,
>
> greg k-h
>
> --
> You received this message because you are subscribed to the Google Groups
> "outreachy-kernel" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to outreachy-kernel+unsubscribe@googlegroups.com.
> To post to this group, send email to outreachy-kernel@googlegroups.com.
> To view this discussion on the web visithttps://groups.google.com/d/msgid/outreachy-kernel/CAOMPgjgKXCwp80uTW2P7W0k
> bUYwRKpM6N3QKXnYERM_LxM5Bsw%40mail.gmail.com.
> For more options, visit https://groups.google.com/d/optout.
>
>
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH v4 2/2] staging: fbtft: convert a macro to a function.
@ 2019-03-08 15:31 Bhagyashri Dighole
0 siblings, 0 replies; 7+ messages in thread
From: Bhagyashri Dighole @ 2019-03-08 15:31 UTC (permalink / raw)
To: Greg Kroah-Hartman; +Cc: Outreachy
Convert a macro to an inline function to improve type safety and make
the code simpler.
Signed-off-by: Bhagyashri Dighole <digholebhagyashri@gmail.com>
---
Changes in v4:
-- Modify log messages.
-- Use one space around operators.
Changes in v3:
-- Change the subject line according to log messages.
-- Remove extra spaces.
Changes in v2:
-- Make the converion from macro to inline function
drivers/staging/fbtft/fb_watterott.c | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
diff --git a/drivers/staging/fbtft/fb_watterott.c b/drivers/staging/fbtft/fb_watterott.c
index 502d67f..27cc8ea 100644
--- a/drivers/staging/fbtft/fb_watterott.c
+++ b/drivers/staging/fbtft/fb_watterott.c
@@ -90,9 +90,10 @@ static int write_vmem(struct fbtft_par *par, size_t offset, size_t len)
return 0;
}
-#define RGB565toRGB332(c) ((((c) & 0xE000) >> 8) |\
- (((c) & 000700) >> 6) |\
- (((c) & 0x0018) >> 3))
+static inline int rgb565_to_rgb332(u16 c)
+{
+ return ((c & 0xE000) >> 8) | ((c & 000700) >> 6) | ((c & 0x0018) >> 3);
+}
static int write_vmem_8bit(struct fbtft_par *par, size_t offset, size_t len)
{
@@ -116,7 +117,7 @@ static int write_vmem_8bit(struct fbtft_par *par, size_t offset, size_t len)
for (i = start_line; i <= end_line; i++) {
pos[1] = cpu_to_be16(i);
for (j = 0; j < par->info->var.xres; j++) {
- buf8[j] = RGB565toRGB332(*vmem16);
+ buf8[j] = rgb565_to_rgb332(*vmem16);
vmem16++;
}
ret = par->fbtftops.write(par,
--
2.7.4
^ permalink raw reply related [flat|nested] 7+ messages in thread
end of thread, other threads:[~2019-03-08 15:31 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-03-06 11:15 [PATCH v4 2/2] staging: fbtft: convert a macro to a function Bhagyashri Dighole
2019-03-07 19:30 ` Greg Kroah-Hartman
2019-03-08 6:05 ` Bhagyashri Dighole
2019-03-08 6:21 ` Greg Kroah-Hartman
2019-03-08 6:29 ` Bhagyashri Dighole
2019-03-08 7:28 ` [Outreachy kernel] " Julia Lawall
2019-03-08 15:31 Bhagyashri Dighole
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.