From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751725AbdFGHCy (ORCPT ); Wed, 7 Jun 2017 03:02:54 -0400 Received: from mail.free-electrons.com ([62.4.15.54]:34451 "EHLO mail.free-electrons.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751203AbdFGHCw (ORCPT ); Wed, 7 Jun 2017 03:02:52 -0400 Date: Wed, 7 Jun 2017 09:02:50 +0200 From: Boris Brezillon To: Masahiro Yamada Cc: linux-mtd@lists.infradead.org, Enrico Jorns , Artem Bityutskiy , Dinh Nguyen , Marek Vasut , Graham Moore , David Woodhouse , Masami Hiramatsu , Chuanxiao Dong , Jassi Brar , Cyrille Pitchen , devicetree@vger.kernel.org, Linux Kernel Mailing List , Brian Norris , Richard Weinberger , Rob Herring , Mark Rutland Subject: Re: [PATCH v4 04/23] mtd: nand: denali: avoid hard-coding ECC step, strength, bytes Message-ID: <20170607090250.729625c9@bbrezillon> In-Reply-To: References: <1496704922-12261-1-git-send-email-yamada.masahiro@socionext.com> <1496704922-12261-5-git-send-email-yamada.masahiro@socionext.com> <20170607000133.69fbf82b@bbrezillon> X-Mailer: Claws Mail 3.13.2 (GTK+ 2.24.30; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, 7 Jun 2017 12:09:31 +0900 Masahiro Yamada wrote: > >> + > >> +static int denali_ecc_setup(struct mtd_info *mtd, struct nand_chip *chip, > >> + struct denali_nand_info *denali) > >> +{ > >> + struct nand_ecc_caps caps; > >> + int ret; > >> + > >> + caps.stepinfos = denali->stepinfo; > >> + caps.nstepinfos = 1; > >> + caps.calc_ecc_bytes = denali_calc_ecc_bytes; > >> + caps.oob_reserve_bytes = denali->bbtskipbytes; > > > > If you get rid of this oob_reserve_bytes field, you can define caps as > > a static const and even directly store ecc_caps in denali_nand_info. > > To make caps static const, denali_calc_ecc_bytes must be exported > to be referenced from denali_dt/denali_pci. > I am reluctant to do it. You already duplicate other information in denali_dt.c and denali_pci.c, so what prevents you from duplicating this one-line function? Also, denali core already exports 2 functions, I don't see the problem in exporting the common nand_ecc_caps object. Why are you reluctant to that?