Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756361AbcK3GUj (ORCPT ); Wed, 30 Nov 2016 01:20:39 -0500 Received: from conssluserg-03.nifty.com ([210.131.2.82]:35910 "EHLO conssluserg-03.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751529AbcK3GUb (ORCPT ); Wed, 30 Nov 2016 01:20:31 -0500 DKIM-Filter: OpenDKIM Filter v2.10.3 conssluserg-03.nifty.com uAU6KBjH032717 X-Nifty-SrcIP: [209.85.213.181] MIME-Version: 1.0 In-Reply-To: <20161127170907.002e6ab4@bbrezillon> References: <1480183585-592-1-git-send-email-yamada.masahiro@socionext.com> <1480183585-592-18-git-send-email-yamada.masahiro@socionext.com> <20161127170907.002e6ab4@bbrezillon> From: Masahiro Yamada Date: Wed, 30 Nov 2016 15:20:10 +0900 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH 17/39] mtd: nand: denali: support HW_ECC_FIXUP capability To: Boris Brezillon Cc: linux-mtd@lists.infradead.org, Linux Kernel Mailing List , Marek Vasut , Brian Norris , Richard Weinberger , David Woodhouse , Cyrille Pitchen Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1161 Lines: 44 Hi Boris, 2016-11-28 1:09 GMT+09:00 Boris Brezillon : &max_bitflips); > > Okay, so you currently have two ways of handling ECC errors. What if a > new revision introduces yet another way to do it? > > How about making denali_caps a structure where you have one (or several) > function pointers to implement operations differently depending on the > IP revision? > > struct denali_caps { > u32 feature_flags; /* If needed. */ > bool (*handle_ecc)(...); > ... > }; > I think a problem is the difference of function arguments: static bool denali_hw_ecc_fixup(struct denali_nand_info *denali, unsigned int *max_bitflips) vs static bool denali_sw_ecc_fixup(struct denali_nand_info *denali, u8 *buf, u32 irq_status, unsigned int *max_bitflips) I do not want to pass redundant arguments, which are used for one, but not used for the other. We do not need to think about the situation that may not happen. If happens, we can refactor the code any time. -- Best Regards Masahiro Yamada