From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 45676C433EF for ; Fri, 15 Oct 2021 10:33:31 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 2CDAA61027 for ; Fri, 15 Oct 2021 10:33:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238213AbhJOKfg (ORCPT ); Fri, 15 Oct 2021 06:35:36 -0400 Received: from relay6-d.mail.gandi.net ([217.70.183.198]:34505 "EHLO relay6-d.mail.gandi.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235075AbhJOKfX (ORCPT ); Fri, 15 Oct 2021 06:35:23 -0400 Received: (Authenticated sender: miquel.raynal@bootlin.com) by relay6-d.mail.gandi.net (Postfix) with ESMTPSA id F2A7EC0012; Fri, 15 Oct 2021 10:33:13 +0000 (UTC) From: Miquel Raynal To: Miquel Raynal , Richard Weinberger , Vignesh Raghavendra , Tudor Ambarus Cc: linux-mtd@lists.infradead.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Vladimir Zapolskiy Subject: Re: [PATCH 2/8] mtd: rawnand: Let callers use the bare Hamming helpers Date: Fri, 15 Oct 2021 12:33:13 +0200 Message-Id: <20211015103313.950354-1-miquel.raynal@bootlin.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20210928221507.199198-3-miquel.raynal@bootlin.com> References: MIME-Version: 1.0 X-linux-mtd-patch-notification: thanks X-linux-mtd-patch-commit: b'd8467112d645ec56760c78928e1e5a3f6faa9b74' Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, 2021-09-28 at 22:15:01 UTC, Miquel Raynal wrote: > Before the introduction of the ECC framework infrastructure, many > drivers used the ->calculate/correct() Hamming helpers directly. The > point of this framework was to avoid this kind of hackish calls and use a > proper and generic API but it is true that in certain cases, drivers > still need to use these helpers in order to do ECC computations on > behalf of their limited hardware. > > Right after the introduction of the ECC engine core introduction, it was > spotted that it was not possible to use the shiny rawnand software ECC > helpers so easily because an ECC engine object should have been > allocated and initialized first. While this works well in most cases, > for these drivers just leveraging the power of a single helper in > conjunction with some pretty old and limited hardware, it did not fit. > > The idea back then was to declare intermediate helpers which would make > use of the exported software ECC engine bare functions while keeping the > rawnand layer compatibility. As there was already functions with the > rawnand_sw_hamming_ prefix it was decided to declare new local helpers > for this purpose in each driver needing one. > > Besides being far from optimal, this design choice was blamed by Linus > when he pulled the "fixes" pull request [1] so that is why now it is > time to clean this mess up. > > Enhancing the implementation of the rawnand_ecc_sw_* helpers to support > both cases, when the ECC object is instantiated and when it is not is a > quite elegant way to solve this situation. This way, we can still use > the existing and exported rawnand helpers while avoiding the need for > each driver to declare its own helper. > > Following this change, most of the fixes sent in [2] can now be safely > reverted. Only the fsmc fix will need to be kept because there is > actually something specific to the driver to do in its ->correct() > helper. > > [1] https://lore.kernel.org/lkml/CAHk-=wh_ZHF685Fni8V9is17mj=pFisUaZ_0=gq6nbK+ZcyQmg@mail.gmail.com/ > [2] https://lore.kernel.org/linux-mtd/20210413161840.345208-1-miquel.raynal@bootlin.com/ > > Signed-off-by: Miquel Raynal Applied to https://git.kernel.org/pub/scm/linux/kernel/git/mtd/linux.git nand/next. Miquel