From patchwork Sat Jan 21 09:29:44 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bhumika Goyal X-Patchwork-Id: 9530195 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 805B4601AE for ; Sat, 21 Jan 2017 09:31:37 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 76B8A28620 for ; Sat, 21 Jan 2017 09:31:37 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 6B07928638; Sat, 21 Jan 2017 09:31:37 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-1.8 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED,FREEMAIL_FROM,T_DKIM_INVALID autolearn=no version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id EEAE528620 for ; Sat, 21 Jan 2017 09:31:36 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1cUs1H-0003Ov-Qo; Sat, 21 Jan 2017 09:31:35 +0000 Received: from mail-pg0-f68.google.com ([74.125.83.68]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1cUs14-0002z2-54; Sat, 21 Jan 2017 09:31:23 +0000 Received: by mail-pg0-f68.google.com with SMTP id 75so8920262pgf.3; Sat, 21 Jan 2017 01:31:01 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=HA602LCie5thPhiq3v0XUQQ3KA8F2jMIGmcrvFQAiag=; b=pbrFLyuysFYBgNlK2LFYBvS0U04zD1ZZ+XN0kpyYp++dI9dgX6WGHbTSi7prCZV/Eg rxRvq1YKecAzPEeOvDkSVxx5jFDXilNcaUrkKXMxLiq+/OkaQvuuLXo2JoWfK5Tp24NS ge/MDHetFRk6FtKCFDH0uHXCPnkBrXs72X9cnnCYYDzYWHql59deUOokbQIjfwayQlKO eoQMjAkwdBMpcVf3JnyQ+MCMfOB5ttk0nnQd+tlKQOzSxTH04T1wQ4FvSghftzLvJ1Wq D9BsifJWji6CTNUTjuFjLj9q+chrdsbQwm+R3CYprbbwi0Vf8YsO8nWd5Q8nEm9o/SHL 2odw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=HA602LCie5thPhiq3v0XUQQ3KA8F2jMIGmcrvFQAiag=; b=FfZ7cHETWI96PjtqES5MTeGCvmxrhgX184GL2fbXYhuhiYQ4Ua3NQuEsSwfYi6z05Z xyOND4Ss5U5gMRusvMWgbFW5+gatZAOxyolxURlofRp3iblSdwuOcl5PO08XmK9HmarV DeHm9mwW02GP6HcWu/CGWISYYpT+A7A6BEDnotDSrUqg93WDld7W+1QtQ7+nXX6ABOgb 2PP5wJp94Z9z1Rl/4Mg/rGzf49eJnznHkscib/sT0yALIIME0Kp6xDrWLY4Mj5HYRMEq T+Zb9usxNI9mhXATWwSIpZ2RV5S08tyb+4rArlq+lz0bu9kWaoUj3IUyBWGvbQgGeiTY NnOA== X-Gm-Message-State: AIkVDXJXQNgioi5352PE2Zg8nEDrvu2tgTsWWAfV5/C+z+cwfIDy3eKhGgIF9jSnHZfroA== X-Received: by 10.98.33.66 with SMTP id h63mr21406238pfh.142.1484991001099; Sat, 21 Jan 2017 01:30:01 -0800 (PST) Received: from gmail.com ([2405:204:5003:fc89:8da0:9234:d099:4cc7]) by smtp.gmail.com with ESMTPSA id g28sm22776029pgn.3.2017.01.21.01.29.54 (version=TLS1 cipher=AES128-SHA bits=128/128); Sat, 21 Jan 2017 01:30:00 -0800 (PST) Received: by gmail.com (sSMTP sendmail emulation); Sat, 21 Jan 2017 14:59:50 +0530 From: Bhumika Goyal To: julia.lawall@lip6.fr, prabhakar.csengg@gmail.com, mchehab@kernel.org, minghsiu.tsai@mediatek.com, houlong.wei@mediatek.com, andrew-ct.chen@mediatek.com, matthias.bgg@gmail.com, linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org Subject: [PATCH] media: platform: constify vb2_ops structures Date: Sat, 21 Jan 2017 14:59:44 +0530 Message-Id: <1484990984-16136-1-git-send-email-bhumirks@gmail.com> X-Mailer: git-send-email 1.9.1 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170121_013122_253760_F101799C X-CRM114-Status: GOOD ( 10.37 ) X-BeenThere: linux-mediatek@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Bhumika Goyal MIME-Version: 1.0 Sender: "Linux-mediatek" Errors-To: linux-mediatek-bounces+patchwork-linux-mediatek=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP Declare vb2_ops structures as const as they are only stored in the ops field of a vb2_queue structure. This field is of type const, so vb2_ops structures having same properties can be made const too. Done using Coccinelle: @r1 disable optional_qualifier@ identifier i; position p; @@ static struct vb2_ops i@p={...}; @ok1@ identifier r1.i; position p; struct sta2x11_vip vip; struct vb2_queue q; @@ ( vip.vb_vidq.ops=&i@p | q.ops=&i@p ) @bad@ position p!={r1.p,ok1.p}; identifier r1.i; @@ i@p @depends on !bad disable optional_qualifier@ identifier r1.i; @@ +const struct vb2_ops i; Cross compiled the media/platform/blackfin/bfin_capture.o file for blackfin architecture. File size before: text data bss dec hex filename 6776 176 0 6952 1b28 platform/blackfin/bfin_capture.o File size after: text data bss dec hex filename 6816 136 0 6952 1b28 platform/blackfin/bfin_capture.o File size before: text data bss dec hex filename 12852 456 272 13580 350c platform/davinci/vpif_capture.o File size after: text data bss dec hex filename 12932 360 272 13564 34fc platform/davinci/vpif_capture.o File size before: text data bss dec hex filename 12285 360 276 12921 3279 platform/davinci/vpif_display.o File size after: text data bss dec hex filename 12365 296 276 12937 3289 platform/davinci/vpif_display.o File size details before and after applying the patch remains the same for drivers/media/platform/pxa_camera.o Signed-off-by: Bhumika Goyal --- drivers/media/platform/davinci/vpif_capture.c | 2 +- drivers/media/platform/davinci/vpif_display.c | 2 +- drivers/media/platform/mtk-mdp/mtk_mdp_m2m.c | 2 +- drivers/media/platform/pxa_camera.c | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/media/platform/davinci/vpif_capture.c b/drivers/media/platform/davinci/vpif_capture.c index f791f5c..54c54d9 100644 --- a/drivers/media/platform/davinci/vpif_capture.c +++ b/drivers/media/platform/davinci/vpif_capture.c @@ -309,7 +309,7 @@ static void vpif_stop_streaming(struct vb2_queue *vq) spin_unlock_irqrestore(&common->irqlock, flags); } -static struct vb2_ops video_qops = { +static const struct vb2_ops video_qops = { .queue_setup = vpif_buffer_queue_setup, .buf_prepare = vpif_buffer_prepare, .start_streaming = vpif_start_streaming, diff --git a/drivers/media/platform/davinci/vpif_display.c b/drivers/media/platform/davinci/vpif_display.c index e5f1844..9604afd 100644 --- a/drivers/media/platform/davinci/vpif_display.c +++ b/drivers/media/platform/davinci/vpif_display.c @@ -289,7 +289,7 @@ static void vpif_stop_streaming(struct vb2_queue *vq) spin_unlock_irqrestore(&common->irqlock, flags); } -static struct vb2_ops video_qops = { +static const struct vb2_ops video_qops = { .queue_setup = vpif_buffer_queue_setup, .wait_prepare = vb2_ops_wait_prepare, .wait_finish = vb2_ops_wait_finish, diff --git a/drivers/media/platform/mtk-mdp/mtk_mdp_m2m.c b/drivers/media/platform/mtk-mdp/mtk_mdp_m2m.c index 13afe48..3038d62 100644 --- a/drivers/media/platform/mtk-mdp/mtk_mdp_m2m.c +++ b/drivers/media/platform/mtk-mdp/mtk_mdp_m2m.c @@ -621,7 +621,7 @@ static void mtk_mdp_m2m_buf_queue(struct vb2_buffer *vb) v4l2_m2m_buf_queue(ctx->m2m_ctx, to_vb2_v4l2_buffer(vb)); } -static struct vb2_ops mtk_mdp_m2m_qops = { +static const struct vb2_ops mtk_mdp_m2m_qops = { .queue_setup = mtk_mdp_m2m_queue_setup, .buf_prepare = mtk_mdp_m2m_buf_prepare, .buf_queue = mtk_mdp_m2m_buf_queue, diff --git a/drivers/media/platform/pxa_camera.c b/drivers/media/platform/pxa_camera.c index 929006f..17167d1 100644 --- a/drivers/media/platform/pxa_camera.c +++ b/drivers/media/platform/pxa_camera.c @@ -1530,7 +1530,7 @@ static void pxac_vb2_stop_streaming(struct vb2_queue *vq) pxa_camera_wakeup(pcdev, buf, VB2_BUF_STATE_ERROR); } -static struct vb2_ops pxac_vb2_ops = { +static const struct vb2_ops pxac_vb2_ops = { .queue_setup = pxac_vb2_queue_setup, .buf_init = pxac_vb2_init, .buf_prepare = pxac_vb2_prepare,