All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] Staging: fbtft: Added blank line after declaration
@ 2015-02-19 18:42 aybuke ozdemir
  2015-02-19 18:42 ` [PATCH 2/2] Staging: fbtft: Fix struct backlight_ops should normally be const aybuke ozdemir
  0 siblings, 1 reply; 6+ messages in thread
From: aybuke ozdemir @ 2015-02-19 18:42 UTC (permalink / raw)
  To: outreachy-kernel; +Cc: aybuke ozdemir

WARNING: Missing a blank line after declaration
chackpatch.pl warning in fb_ssd1351.c

Signed-off-by: aybuke ozdemir <aybuke.147@gmail.com>
---
 drivers/staging/fbtft/fb_ssd1351.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/staging/fbtft/fb_ssd1351.c b/drivers/staging/fbtft/fb_ssd1351.c
index 062d986..b59120c 100644
--- a/drivers/staging/fbtft/fb_ssd1351.c
+++ b/drivers/staging/fbtft/fb_ssd1351.c
@@ -72,6 +72,7 @@ static void set_addr_win(struct fbtft_par *par, int xs, int ys, int xe, int ye)
 static int set_var(struct fbtft_par *par)
 {
 	unsigned remap;
+
 	fbtft_par_dbg(DEBUG_INIT_DISPLAY, par, "%s()\n", __func__);
 
 	if (par->fbtftops.init_display != init_display) {
-- 
1.9.1



^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH 2/2] Staging: fbtft: Fix struct backlight_ops should normally be const
  2015-02-19 18:42 [PATCH 1/2] Staging: fbtft: Added blank line after declaration aybuke ozdemir
@ 2015-02-19 18:42 ` aybuke ozdemir
  2015-02-19 18:52   ` [Outreachy kernel] " Laurent Pinchart
  0 siblings, 1 reply; 6+ messages in thread
From: aybuke ozdemir @ 2015-02-19 18:42 UTC (permalink / raw)
  To: outreachy-kernel; +Cc: aybuke ozdemir

This patch fixes following checkpatch.pl warningi in fb_ssd1351.c:
WARNING: struct backlight_ops should normally be const

Signed-off-by: aybuke ozdemir <aybuke.147@gmail.com>
---
 drivers/staging/fbtft/fb_ssd1351.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/fbtft/fb_ssd1351.c b/drivers/staging/fbtft/fb_ssd1351.c
index b59120c..bc4d188 100644
--- a/drivers/staging/fbtft/fb_ssd1351.c
+++ b/drivers/staging/fbtft/fb_ssd1351.c
@@ -212,11 +212,11 @@ static void register_onboard_backlight(struct fbtft_par *par)
 {
 	struct backlight_device *bd;
 	struct backlight_properties bl_props = { 0, };
-	struct backlight_ops *bl_ops;
+	const struct backlight_ops *bl_ops;
 
 	fbtft_par_dbg(DEBUG_BACKLIGHT, par, "%s()\n", __func__);
 
-	bl_ops = devm_kzalloc(par->info->device, sizeof(struct backlight_ops),
+	bl_ops = devm_kzalloc(par->info->device, sizeof(const struct backlight_ops),
 				GFP_KERNEL);
 	if (!bl_ops) {
 		dev_err(par->info->device,
-- 
1.9.1



^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [Outreachy kernel] [PATCH 2/2] Staging: fbtft: Fix struct backlight_ops should normally be const
  2015-02-19 18:42 ` [PATCH 2/2] Staging: fbtft: Fix struct backlight_ops should normally be const aybuke ozdemir
@ 2015-02-19 18:52   ` Laurent Pinchart
  2015-02-19 19:43     ` aybüke özdemir
  0 siblings, 1 reply; 6+ messages in thread
From: Laurent Pinchart @ 2015-02-19 18:52 UTC (permalink / raw)
  To: outreachy-kernel; +Cc: aybuke ozdemir

Hi Aybuke,

Thank you for the patch.

On Thursday 19 February 2015 20:42:44 aybuke ozdemir wrote:
> This patch fixes following checkpatch.pl warningi in fb_ssd1351.c:
> WARNING: struct backlight_ops should normally be const

A good commit message is split in two parts:

- The subject line should summarize what the commit does. In this case, you 
could say "staging: fbtft: Make struct backlight_ops const".

- The commit message body should explain why the change is needed. There's a 
reason behind checkpatch warnings, they indicate issues with the code. You 
should try to understand why a non-const struct backlight_ops is an issue, and 
explain it. In this case the reason why struct backlight_ops is usually const 
would lead to a totally different fix than the one below.

> Signed-off-by: aybuke ozdemir <aybuke.147@gmail.com>
> ---
>  drivers/staging/fbtft/fb_ssd1351.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/staging/fbtft/fb_ssd1351.c
> b/drivers/staging/fbtft/fb_ssd1351.c index b59120c..bc4d188 100644
> --- a/drivers/staging/fbtft/fb_ssd1351.c
> +++ b/drivers/staging/fbtft/fb_ssd1351.c
> @@ -212,11 +212,11 @@ static void register_onboard_backlight(struct
> fbtft_par *par) {
>  	struct backlight_device *bd;
>  	struct backlight_properties bl_props = { 0, };
> -	struct backlight_ops *bl_ops;
> +	const struct backlight_ops *bl_ops;

This introduces a compilation error as the code later assigns bl_ops-
>update_status. Please make sure you always at least compile the code before 
submitting a patch.

>  	fbtft_par_dbg(DEBUG_BACKLIGHT, par, "%s()\n", __func__);
> 
> -	bl_ops = devm_kzalloc(par->info->device, sizeof(struct backlight_ops),
> +	bl_ops = devm_kzalloc(par->info->device, sizeof(const struct
> backlight_ops),

The kernel coding style tends to favour sizeof(var) instead of sizeof(type). 
In this case this would become sizeof(*bl_ops). This ensures that the size 
stays correct if the type of the variable is changed.

> GFP_KERNEL);
>  	if (!bl_ops) {
>  		dev_err(par->info->device,

-- 
Regards,

Laurent Pinchart



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [Outreachy kernel] [PATCH 2/2] Staging: fbtft: Fix struct backlight_ops should normally be const
  2015-02-19 18:52   ` [Outreachy kernel] " Laurent Pinchart
@ 2015-02-19 19:43     ` aybüke özdemir
  2015-02-19 20:13       ` Laurent Pinchart
  0 siblings, 1 reply; 6+ messages in thread
From: aybüke özdemir @ 2015-02-19 19:43 UTC (permalink / raw)
  To: Laurent Pinchart; +Cc: outreachy-kernel

[-- Attachment #1: Type: text/plain, Size: 2715 bytes --]

Hi Laurent,

I will pay much more attention to the commit messages and subject line. I use
this command while compiling this file: make M=drivers/staging/fbtft
I didn't encounter a problem. I guess, I'm using the wrong the "make"
command.
Thanks :)


2015-02-19 20:52 GMT+02:00 Laurent Pinchart <
laurent.pinchart@ideasonboard.com>:

> Hi Aybuke,
>
> Thank you for the patch.
>
> On Thursday 19 February 2015 20:42:44 aybuke ozdemir wrote:
> > This patch fixes following checkpatch.pl warningi in fb_ssd1351.c:
> > WARNING: struct backlight_ops should normally be const
>
> A good commit message is split in two parts:
>
> - The subject line should summarize what the commit does. In this case, you
> could say "staging: fbtft: Make struct backlight_ops const".
>
> - The commit message body should explain why the change is needed. There's
> a
> reason behind checkpatch warnings, they indicate issues with the code. You
> should try to understand why a non-const struct backlight_ops is an issue,
> and
> explain it. In this case the reason why struct backlight_ops is usually
> const
> would lead to a totally different fix than the one below.
>
> > Signed-off-by: aybuke ozdemir <aybuke.147@gmail.com>
> > ---
> >  drivers/staging/fbtft/fb_ssd1351.c | 4 ++--
> >  1 file changed, 2 insertions(+), 2 deletions(-)
> >
> > diff --git a/drivers/staging/fbtft/fb_ssd1351.c
> > b/drivers/staging/fbtft/fb_ssd1351.c index b59120c..bc4d188 100644
> > --- a/drivers/staging/fbtft/fb_ssd1351.c
> > +++ b/drivers/staging/fbtft/fb_ssd1351.c
> > @@ -212,11 +212,11 @@ static void register_onboard_backlight(struct
> > fbtft_par *par) {
> >       struct backlight_device *bd;
> >       struct backlight_properties bl_props = { 0, };
> > -     struct backlight_ops *bl_ops;
> > +     const struct backlight_ops *bl_ops;
>
> This introduces a compilation error as the code later assigns bl_ops-
> >update_status. Please make sure you always at least compile the code
> before
> submitting a patch.
>
> >       fbtft_par_dbg(DEBUG_BACKLIGHT, par, "%s()\n", __func__);
> >
> > -     bl_ops = devm_kzalloc(par->info->device, sizeof(struct
> backlight_ops),
> > +     bl_ops = devm_kzalloc(par->info->device, sizeof(const struct
> > backlight_ops),
>
> The kernel coding style tends to favour sizeof(var) instead of
> sizeof(type).
> In this case this would become sizeof(*bl_ops). This ensures that the size
> stays correct if the type of the variable is changed.
>
> > GFP_KERNEL);
> >       if (!bl_ops) {
> >               dev_err(par->info->device,
>
> --
> Regards,
>
> Laurent Pinchart
>
>


-- 
Aybüke Özdemir
http://www.aybukeozdemir.com

[-- Attachment #2: Type: text/html, Size: 4229 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [Outreachy kernel] [PATCH 2/2] Staging: fbtft: Fix struct backlight_ops should normally be const
  2015-02-19 19:43     ` aybüke özdemir
@ 2015-02-19 20:13       ` Laurent Pinchart
  2015-02-19 21:20         ` aybüke özdemir
  0 siblings, 1 reply; 6+ messages in thread
From: Laurent Pinchart @ 2015-02-19 20:13 UTC (permalink / raw)
  To: outreachy-kernel; +Cc: aybüke özdemir

Hi Aybüke,

On Thursday 19 February 2015 21:43:22 aybüke özdemir wrote:
> Hi Laurent,
> 
> I will pay much more attention to the commit messages and subject line. I
> use this command while compiling this file: make M=drivers/staging/fbtft I
> didn't encounter a problem. I guess, I'm using the wrong the "make"
> command.

The command is correct, but you also need to make sure that the driver is 
selected in the kernel configuration, otherwise it won't get compiled.

A good way to find out whether a .c source file has been compiled is to check 
that a .o file with the same base name has been created in the same directory. 
The kernel build system should also print

  CC      drivers/staging/fbtft/fb_ssd1351.o

during compilation.

-- 
Regards,

Laurent Pinchart



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [Outreachy kernel] [PATCH 2/2] Staging: fbtft: Fix struct backlight_ops should normally be const
  2015-02-19 20:13       ` Laurent Pinchart
@ 2015-02-19 21:20         ` aybüke özdemir
  0 siblings, 0 replies; 6+ messages in thread
From: aybüke özdemir @ 2015-02-19 21:20 UTC (permalink / raw)
  To: Laurent Pinchart; +Cc: outreachy-kernel

[-- Attachment #1: Type: text/plain, Size: 1080 bytes --]

Many thanks for clarifying, When I compile , I will consider your
description :)

2015-02-19 22:13 GMT+02:00 Laurent Pinchart <
laurent.pinchart@ideasonboard.com>:

> Hi Aybüke,
>
> On Thursday 19 February 2015 21:43:22 aybüke özdemir wrote:
> > Hi Laurent,
> >
> > I will pay much more attention to the commit messages and subject line. I
> > use this command while compiling this file: make M=drivers/staging/fbtft
> I
> > didn't encounter a problem. I guess, I'm using the wrong the "make"
> > command.
>
> The command is correct, but you also need to make sure that the driver is
> selected in the kernel configuration, otherwise it won't get compiled.
>
> A good way to find out whether a .c source file has been compiled is to
> check
> that a .o file with the same base name has been created in the same
> directory.
> The kernel build system should also print
>
>   CC      drivers/staging/fbtft/fb_ssd1351.o
>
> during compilation.
>
> --
> Regards,
>
> Laurent Pinchart
>
>


-- 
Aybüke Özdemir
http://www.aybukeozdemir.com

[-- Attachment #2: Type: text/html, Size: 2076 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2015-02-19 21:20 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-02-19 18:42 [PATCH 1/2] Staging: fbtft: Added blank line after declaration aybuke ozdemir
2015-02-19 18:42 ` [PATCH 2/2] Staging: fbtft: Fix struct backlight_ops should normally be const aybuke ozdemir
2015-02-19 18:52   ` [Outreachy kernel] " Laurent Pinchart
2015-02-19 19:43     ` aybüke özdemir
2015-02-19 20:13       ` Laurent Pinchart
2015-02-19 21:20         ` aybüke özdemir

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.