From mboxrd@z Thu Jan 1 00:00:00 1970 From: Paul Mundt Subject: Re: [PATCH 08/29] Staging: yaffs2: yaffs_ecc: Add files Date: Tue, 2 Nov 2010 04:50:45 +0900 Message-ID: <20101101195044.GB3176@linux-sh.org> References: <1288636877-7964-1-git-send-email-tdent48227@gmail.com> <1288636877-7964-9-git-send-email-tdent48227@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: greg@kroah.com, manningc2@actrix.gen.nz, linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org To: Tracey Dent Return-path: Content-Disposition: inline In-Reply-To: <1288636877-7964-9-git-send-email-tdent48227@gmail.com> Sender: linux-kernel-owner@vger.kernel.org List-Id: linux-fsdevel.vger.kernel.org On Mon, Nov 01, 2010 at 02:40:56PM -0400, Tracey Dent wrote: > +/* > + * This code implements the ECC algorithm used in SmartMedia. > + * > + * The ECC comprises 22 bits of parity information and is stuffed into 3 bytes. > + * The two unused bit are set to 1. > + * The ECC can correct single bit errors in a 256-byte page of data. Thus, two such ECC > + * blocks are used on a 512-byte NAND page. > + * > + */ > + > +/* Table generated by gen-ecc.c > + * Using a table means we do not have to calculate p1..p4 and p1'..p4' > + * for each byte of data. These are instead provided in a table in bits7..2. > + * Bit 0 of each entry indicates whether the entry has an odd or even parity, and therefore > + * this bytes influence on the line parity. > + */ > + This all looks pretty generic. Have you considered just adding gen-ecc to lib/, tying it in to hostprogs, and generating the tables during build (see the crc32 code for reference)? The rest of this would probably also be better off living in lib/ and simply being selected by the YAFFS code as necessary. > +/* Calculate the ECC for a 256-byte block of data */ > +void yaffs_ecc_cacl(const unsigned char *data, unsigned char *ecc) > +void yaffs_ecc_calc_other(const unsigned char *data, unsigned n_bytes, > + yaffs_ecc_other *ecc_other) Is there some reason for this naming inconistency?