Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752467AbdGGOeH (ORCPT ); Fri, 7 Jul 2017 10:34:07 -0400 Received: from mx07-00178001.pphosted.com ([62.209.51.94]:57991 "EHLO mx07-00178001.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751809AbdGGOeG (ORCPT ); Fri, 7 Jul 2017 10:34:06 -0400 From: Hugues FRUCHET To: "Gustavo A. R. Silva" , Mauro Carvalho Chehab , Maxime Coquelin , "Alexandre TORGUE" CC: "linux-media@vger.kernel.org" , "linux-arm-kernel@lists.infradead.org" , "linux-kernel@vger.kernel.org" Subject: Re: [PATCH] stm32-dcmi: constify vb2_ops structure Thread-Topic: [PATCH] stm32-dcmi: constify vb2_ops structure Thread-Index: AQHS9pZnwqkTknTjJkG9ILdUrjs+0aJITUQA Date: Fri, 7 Jul 2017 14:33:22 +0000 Message-ID: References: <20170706200517.GA5886@embeddedgus> In-Reply-To: <20170706200517.GA5886@embeddedgus> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: user-agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.1.1 x-ms-exchange-messagesentrepresentingtype: 1 x-ms-exchange-transport-fromentityheader: Hosted x-originating-ip: [10.75.127.49] Content-Type: text/plain; charset="utf-8" Content-ID: <3DF6E8F82FC3E84481959768E1F3C035@st.com> MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:,, definitions=2017-07-07_06:,, signatures=0 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from base64 to 8bit by nfs id v67EYPcf029494 Content-Length: 1549 Lines: 55 Acked-by: Hugues Fruchet On 07/06/2017 10:05 PM, Gustavo A. R. Silva wrote: > Check for vb2_ops structures that are only stored in the ops field of a > vb2_queue structure. That field is declared const, so vb2_ops structures > that have this property can be declared as const also. > > This issue was detected using Coccinelle and the following semantic patch: > > @r disable optional_qualifier@ > identifier i; > position p; > @@ > static struct vb2_ops i@p = { ... }; > > @ok@ > identifier r.i; > struct vb2_queue e; > position p; > @@ > e.ops = &i@p; > > @bad@ > position p != {r.p,ok.p}; > identifier r.i; > struct vb2_ops e; > @@ > e@i@p > > @depends on !bad disable optional_qualifier@ > identifier r.i; > @@ > static > +const > struct vb2_ops i = { ... }; > > Signed-off-by: Gustavo A. R. Silva > --- > drivers/media/platform/stm32/stm32-dcmi.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/media/platform/stm32/stm32-dcmi.c b/drivers/media/platform/stm32/stm32-dcmi.c > index 83d32a5..24ef888 100644 > --- a/drivers/media/platform/stm32/stm32-dcmi.c > +++ b/drivers/media/platform/stm32/stm32-dcmi.c > @@ -662,7 +662,7 @@ static void dcmi_stop_streaming(struct vb2_queue *vq) > dcmi->errors_count, dcmi->buffers_count); > } > > -static struct vb2_ops dcmi_video_qops = { > +static const struct vb2_ops dcmi_video_qops = { > .queue_setup = dcmi_queue_setup, > .buf_init = dcmi_buf_init, > .buf_prepare = dcmi_buf_prepare, >