From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753544AbdF0UWE (ORCPT ); Tue, 27 Jun 2017 16:22:04 -0400 Received: from 4.mo173.mail-out.ovh.net ([46.105.34.219]:39238 "EHLO 4.mo173.mail-out.ovh.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753501AbdF0UV6 (ORCPT ); Tue, 27 Jun 2017 16:21:58 -0400 X-Greylist: delayed 1120 seconds by postgrey-1.27 at vger.kernel.org; Tue, 27 Jun 2017 16:21:57 EDT Subject: Re: [PATCH] mtd: spi-nor: cqspi: remove duplicate const To: Marek Vasut , Arnd Bergmann , David Woodhouse , Brian Norris , Boris Brezillon , Richard Weinberger Cc: linux-mtd@lists.infradead.org, linux-kernel@vger.kernel.org References: <20170627153508.1329697-1-arnd@arndb.de> <77950900-a78b-b5b7-5baf-1df7075fc6d3@gmail.com> <8fec019c-0e8f-b9d6-3554-d88f6735460c@gmail.com> From: Cyrille Pitchen Message-ID: <6956fba6-ab14-fc53-1da2-c80df0adf85a@wedev4u.fr> Date: Tue, 27 Jun 2017 22:21:47 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.1.1 MIME-Version: 1.0 In-Reply-To: <8fec019c-0e8f-b9d6-3554-d88f6735460c@gmail.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit X-Ovh-Tracer-Id: 13719090367622174487 X-VR-SPAMSTATE: OK X-VR-SPAMSCORE: -100 X-VR-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrfeelkedrtddtgddufeefucetufdoteggodetrfdotffvucfrrhhofhhilhgvmecuqfggjfdpvefjgfevmfevgfenuceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddm Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Le 27/06/2017 à 21:51, Marek Vasut a écrit : > On 06/27/2017 09:48 PM, Cyrille Pitchen wrote: >> Le 27/06/2017 à 18:11, Marek Vasut a écrit : >>> On 06/27/2017 05:34 PM, Arnd Bergmann wrote: >>>> The variable was already marked 'const' before the previous >>>> patch, but the qualifier was in an unusual place, and now the >>>> extra 'const' causes a harmless warning: >>>> >>>> drivers/mtd/spi-nor/cadence-quadspi.c:1286:34: error: duplicate 'const' declaration specifier [-Werror=duplicate-decl-specifier] >>>> >>>> This removes the other 'const' instead. >>> >>> Isn't that const array const elements , thus two consts ? >>> IMO the original code is correct. >> >> Indeed the 2 'const' don't have the same meaning so the original code >> may be correct but with an array like cqspi_dt_ids[] we can't write >> "cqspi_dt_ids = (const struct of_device_id *);" anyway. > > Not sure I understand what you're trying to say here. > Just that once an array like cqspi_dt_ids[] has been defined, you can never assign it a new value later: cqspi_dt_ids = ; /* that doesn't work */ For this specific point, an array behaves like a constant pointer (but otherwise I agree that arrays and constant pointers are not the same things). So I guess the 2nd 'const' could be considered as implicit :) >> So I think the 2nd 'const' is useless here then if this patch removes a >> warning, let's apply it, right? >> >>> >>>> Fixes: f993c123b461 ("mtd: spi-nor: cqspi: make of_device_ids const") >>>> Signed-off-by: Arnd Bergmann >>>> --- >>>> drivers/mtd/spi-nor/cadence-quadspi.c | 2 +- >>>> 1 file changed, 1 insertion(+), 1 deletion(-) >>>> >>>> diff --git a/drivers/mtd/spi-nor/cadence-quadspi.c b/drivers/mtd/spi-nor/cadence-quadspi.c >>>> index d315c326e72f..53c7d8e0327a 100644 >>>> --- a/drivers/mtd/spi-nor/cadence-quadspi.c >>>> +++ b/drivers/mtd/spi-nor/cadence-quadspi.c >>>> @@ -1283,7 +1283,7 @@ static const struct dev_pm_ops cqspi__dev_pm_ops = { >>>> #define CQSPI_DEV_PM_OPS NULL >>>> #endif >>>> >>>> -static const struct of_device_id const cqspi_dt_ids[] = { >>>> +static const struct of_device_id cqspi_dt_ids[] = { >>>> {.compatible = "cdns,qspi-nor",}, >>>> { /* end of table */ } >>>> }; >>>> >>> >>> >> > >