From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
To: outreachy-kernel@googlegroups.com
Cc: aybuke ozdemir <aybuke.147@gmail.com>
Subject: Re: [Outreachy kernel] [PATCH 2/2] Staging: fbtft: Fix struct backlight_ops should normally be const
Date: Thu, 19 Feb 2015 20:52:18 +0200 [thread overview]
Message-ID: <1673936.xFr6aDYKYJ@avalon> (raw)
In-Reply-To: <1424371364-7277-2-git-send-email-aybuke.147@gmail.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
next prev parent reply other threads:[~2015-02-19 18:51 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
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 ` Laurent Pinchart [this message]
2015-02-19 19:43 ` [Outreachy kernel] " aybüke özdemir
2015-02-19 20:13 ` Laurent Pinchart
2015-02-19 21:20 ` aybüke özdemir
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=1673936.xFr6aDYKYJ@avalon \
--to=laurent.pinchart@ideasonboard.com \
--cc=aybuke.147@gmail.com \
--cc=outreachy-kernel@googlegroups.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.