Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751280AbdGQEGo (ORCPT ); Mon, 17 Jul 2017 00:06:44 -0400 Received: from gateway32.websitewelcome.com ([192.185.145.102]:48392 "EHLO gateway32.websitewelcome.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751248AbdGQEGn (ORCPT ); Mon, 17 Jul 2017 00:06:43 -0400 Subject: Re: [PATCH] video: xilinxfb: constify fb_fix_screeninfo and fb_var_screeninfo structures To: Michal Simek , Bartlomiej Zolnierkiewicz , =?UTF-8?Q?S=c3=b6ren_Brinkmann?= References: <20170708012416.GA1843@embeddedgus> Cc: linux-fbdev@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org From: "Gustavo A. R. Silva" Message-ID: Date: Sun, 16 Jul 2017 23:06:42 -0500 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.2.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - gator4166.hostgator.com X-AntiAbuse: Original Domain - vger.kernel.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - embeddedor.com X-BWhitelist: no X-Source-IP: 189.152.152.176 X-Exim-ID: 1dWxIx-002m9V-5C X-Source: X-Source-Args: X-Source-Dir: X-Source-Sender: ([192.168.1.69]) [189.152.152.176]:38818 X-Source-Auth: garsilva@embeddedor.com X-Email-Count: 23 X-Source-Cap: Z3V6aWRpbmU7Z3V6aWRpbmU7Z2F0b3I0MTY2Lmhvc3RnYXRvci5jb20= Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1883 Lines: 71 On 07/10/2017 02:29 AM, Michal Simek wrote: > On 8.7.2017 03:24, Gustavo A. R. Silva wrote: >> These structures are only used to copy into other structures, >> so declare them as const. >> >> This issue was detected using Coccinelle and the following semantic patch: >> >> @r disable optional_qualifier@ >> identifier i; >> position p; >> @@ >> static struct fb_fix_screeninfo i@p = { ... }; >> >> @ok@ >> identifier r.i; >> expression e; >> position p; >> @@ >> e = i@p >> >> @bad@ >> position p != {r.p,ok.p}; >> identifier r.i; >> struct fb_fix_screeninfo e; >> @@ >> e@i@p >> >> @depends on !bad disable optional_qualifier@ >> identifier r.i; >> @@ >> static >> +const >> struct fb_fix_screeninfo i = { ... }; >> >> The semantic patch for fb_var_screeninfo is analogous. >> >> Signed-off-by: Gustavo A. R. Silva >> --- >> drivers/video/fbdev/xilinxfb.c | 4 ++-- >> 1 file changed, 2 insertions(+), 2 deletions(-) >> >> diff --git a/drivers/video/fbdev/xilinxfb.c b/drivers/video/fbdev/xilinxfb.c >> index 17dc119..0bda18e 100644 >> --- a/drivers/video/fbdev/xilinxfb.c >> +++ b/drivers/video/fbdev/xilinxfb.c >> @@ -110,14 +110,14 @@ static struct xilinxfb_platform_data xilinx_fb_default_pdata = { >> /* >> * Here are the default fb_fix_screeninfo and fb_var_screeninfo structures >> */ >> -static struct fb_fix_screeninfo xilinx_fb_fix = { >> +static const struct fb_fix_screeninfo xilinx_fb_fix = { >> .id = "Xilinx", >> .type = FB_TYPE_PACKED_PIXELS, >> .visual = FB_VISUAL_TRUECOLOR, >> .accel = FB_ACCEL_NONE >> }; >> >> -static struct fb_var_screeninfo xilinx_fb_var = { >> +static const struct fb_var_screeninfo xilinx_fb_var = { >> .bits_per_pixel = BITS_PER_PIXEL, >> >> .red = { RED_SHIFT, 8, 0 }, >> > Acked-by: Michal Simek Thank you, Michal. -- Gustavo A. R. Silva