From patchwork Wed Apr 10 13:08:19 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom Rini X-Patchwork-Id: 235383 X-Patchwork-Delegate: marek.vasut@gmail.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from theia.denx.de (theia.denx.de [85.214.87.163]) by ozlabs.org (Postfix) with ESMTP id 553522C008D for ; Wed, 10 Apr 2013 23:08:28 +1000 (EST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 67C694A023; Wed, 10 Apr 2013 15:08:25 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at theia.denx.de Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id msKW3arWt5uk; Wed, 10 Apr 2013 15:08:25 +0200 (CEST) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id B8D174A025; Wed, 10 Apr 2013 15:08:23 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 71F054A025 for ; Wed, 10 Apr 2013 15:08:21 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at theia.denx.de Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id a7M5xHtbk89u for ; Wed, 10 Apr 2013 15:08:20 +0200 (CEST) X-policyd-weight: NOT_IN_SBL_XBL_SPAMHAUS=-1.5 NOT_IN_SPAMCOP=-1.5 NOT_IN_BL_NJABL=-1.5 (only DNSBL check requested) Received: from mail-ye0-f180.google.com (mail-ye0-f180.google.com [209.85.213.180]) by theia.denx.de (Postfix) with ESMTPS id 5C2474A023 for ; Wed, 10 Apr 2013 15:08:19 +0200 (CEST) Received: by mail-ye0-f180.google.com with SMTP id q11so35933yen.25 for ; Wed, 10 Apr 2013 06:08:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=x-received:sender:date:from:to:cc:subject:message-id:references :mime-version:content-type:content-disposition:in-reply-to :organization:user-agent; bh=oHbOfp7E3GgkN+YHBTAvoZow2Js6aH/4twL8yQ5OSaE=; b=bN/YW4we1fT7XDtYwFfaVo5cUWUdZ3bUWaanPuF4FAPOewf+6hkwyYQs/DCDZwnZUS 66Ip+l/awJgKMP1MsSlEydx1rlI956wm6BdSpjLeWlKeCHKwZy17BEwYgvRD1y3JsjMc xgEsoLE6Wf/fTKwb0B7CcUyL2DQT1NoRhopfOT2OGOHDmRlHknE0I2FTa/RNqw2L9K5J EdU91Tc5oS1Yi6QTCZ7Q7H1HW28s0PsqAJjuzJ2EPh02myrxB9icZ8daRLln47r83ox/ h5+7csrJeYKoIF2sJVeDZkxZCmIGUsp03Ixcx5KZbx338dxhTidMr1Sc5Fp55amdmByl HCSg== X-Received: by 10.236.176.41 with SMTP id a29mr1031216yhm.96.1365599296779; Wed, 10 Apr 2013 06:08:16 -0700 (PDT) Received: from bill-the-cat (cpe-065-184-250-089.ec.res.rr.com. [65.184.250.89]) by mx.google.com with ESMTPS id i47sm25673782yha.8.2013.04.10.06.08.13 (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Wed, 10 Apr 2013 06:08:14 -0700 (PDT) Date: Wed, 10 Apr 2013 09:08:19 -0400 From: Tom Rini To: u-boot@lists.denx.de, Marek Vasut , Nikita Kiryanov , Igor Grinberg Message-ID: <20130410130819.GR5729@bill-the-cat> References: <1363275175-8408-5-git-send-email-trini@ti.com> MIME-Version: 1.0 In-Reply-To: <1363275175-8408-5-git-send-email-trini@ti.com> Organization: Texas Instruments User-Agent: Mutt/1.5.21 (2010-09-15) Cc: Scott Wood , Pantelis Antoniou Subject: Re: [U-Boot] [U-Boot, v6, 4/9] nand: Extend nand_(read|write)_skip_bad with *actual and limit parameters X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.11 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: u-boot-bounces@lists.denx.de Errors-To: u-boot-bounces@lists.denx.de On Thu, Mar 14, 2013 at 05:32:50AM -0000, Tom Rini wrote: > We make these two functions take a size_t pointer to how much space > was used on NAND to read or write the buffer (when reads/writes happen) > so that bad blocks can be accounted for. We also make them take an > loff_t limit on how much data can be read or written. This means that > we can now catch the case of when writing to a partition would exceed > the partition size due to bad blocks. To do this we also need to make > check_skip_len count not just complete blocks used but partial ones as > well. All callers of nand_(read|write)_skip_bad are adjusted to call > these with the most sensible limits available. > > The changes were started by Pantelis and finished by Tom. > > Signed-off-by: Pantelis Antoniou > Signed-off-by: Tom Rini With current master, the following changes are needed to adapt cm_t35 to these call changes: Acked-by: Igor Grinberg diff --git a/board/cm_t35/cm_t35.c b/board/cm_t35/cm_t35.c index 629ce4a..84c36ba 100644 --- a/board/cm_t35/cm_t35.c +++ b/board/cm_t35/cm_t35.c @@ -91,6 +91,7 @@ static int splash_load_from_nand(u32 bmp_load_addr) res = nand_read_skip_bad(&nand_info[nand_curr_device], splash_screen_nand_offset, &bmp_header_size, + NULL, nand_info[nand_curr_device].size, (u_char *)bmp_load_addr); if (res < 0) return res; @@ -103,6 +104,7 @@ static int splash_load_from_nand(u32 bmp_load_addr) return nand_read_skip_bad(&nand_info[nand_curr_device], splash_screen_nand_offset, &bmp_size, + NULL, nand_info[nand_curr_device].size, (u_char *)bmp_load_addr); splash_address_too_high: