Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1683496
| Path | csiph.com!aioe.org!bofh.it!news.nic.it!robomod |
|---|---|
| From | "Gustavo A. R. Silva" <garsilva@embeddedor.com> |
| Newsgroups | linux.kernel |
| Subject | [PATCH] auxdisplay: cfag12864bfb: constify fb_fix_screeninfo and fb_var_screeninfo structures |
| Date | Sat, 08 Jul 2017 03:10:02 +0200 |
| Message-ID | <u0MpY-3OG-3@gated-at.bofh.it> (permalink) |
| MIME-Version | 1.0 |
| Content-Type | text/plain; charset=us-ascii |
| Content-Disposition | inline |
| User-Agent | Mutt/1.5.23 (2014-03-12) |
| 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 | 1dTe8h-0011cj-6v |
| X-Source-Sender | (embeddedgus) [189.152.152.176]:37212 |
| X-Source-Auth | garsilva@embeddedor.com |
| X-Email-Count | 2 |
| X-Source-Cap | Z3V6aWRpbmU7Z3V6aWRpbmU7Z2F0b3I0MTY2Lmhvc3RnYXRvci5jb20= |
| Sender | robomod@news.nic.it |
| List-ID | <linux-kernel.vger.kernel.org> |
| X-Mailing-List | linux-kernel@vger.kernel.org |
| Approved | robomod@news.nic.it |
| Lines | 63 |
| Organization | linux.* mail to news gateway |
| X-Original-Cc | linux-kernel@vger.kernel.org, "Gustavo A. R. Silva" <garsilva@embeddedor.com> |
| X-Original-Date | Fri, 7 Jul 2017 20:02:26 -0500 |
| X-Original-Message-ID | <20170708010226.GA19247@embeddedgus> |
| X-Original-Sender | linux-kernel-owner@vger.kernel.org |
| Xref | csiph.com linux.kernel:1683496 |
Show key headers only | View raw
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 <garsilva@embeddedor.com>
---
drivers/auxdisplay/cfag12864bfb.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/auxdisplay/cfag12864bfb.c b/drivers/auxdisplay/cfag12864bfb.c
index a387403..dcbee7e 100644
--- a/drivers/auxdisplay/cfag12864bfb.c
+++ b/drivers/auxdisplay/cfag12864bfb.c
@@ -37,7 +37,7 @@
#define CFAG12864BFB_NAME "cfag12864bfb"
-static struct fb_fix_screeninfo cfag12864bfb_fix = {
+static const struct fb_fix_screeninfo cfag12864bfb_fix = {
.id = "cfag12864b",
.type = FB_TYPE_PACKED_PIXELS,
.visual = FB_VISUAL_MONO10,
@@ -48,7 +48,7 @@ static struct fb_fix_screeninfo cfag12864bfb_fix = {
.accel = FB_ACCEL_NONE,
};
-static struct fb_var_screeninfo cfag12864bfb_var = {
+static const struct fb_var_screeninfo cfag12864bfb_var = {
.xres = CFAG12864B_WIDTH,
.yres = CFAG12864B_HEIGHT,
.xres_virtual = CFAG12864B_WIDTH,
--
2.5.0
Back to linux.kernel | Previous | Next | Find similar | Unroll thread
[PATCH] auxdisplay: cfag12864bfb: constify fb_fix_screeninfo and fb_var_screeninfo structures "Gustavo A. R. Silva" <garsilva@embeddedor.com> - 2017-07-08 03:10 +0200
csiph-web