Received: by 2002:ac0:a581:0:0:0:0:0 with SMTP id m1-v6csp3157335imm; Sun, 24 Jun 2018 13:01:01 -0700 (PDT) X-Google-Smtp-Source: ADUXVKLfovDsA8lCj29E37ttMUpE+8QkeOlcAeau5ExKEhtd+l2voMpe9VXdXPEM4DPXF6xmRDAm X-Received: by 2002:a17:902:8549:: with SMTP id d9-v6mr9752033plo.81.1529870461264; Sun, 24 Jun 2018 13:01:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1529870461; cv=none; d=google.com; s=arc-20160816; b=aP3xIR8WB7ueOZNYBousjpVbFwIKiqo+IYSI2jov6WpTp+FjT7GvTDCthS9HjzWsCT l7yhtzkMcb6zO/9jA5y1Q8FjpucSSPLGSaScmKrcrqh/JyAoFCfnUDuLW6217oGHFUP2 613RuL3BwNHVvFQYdxue8LgTwaGX1VA1Bv2O3RdSKVYJIoFTScecD0L3JxE+5LOkuelF oYbqVj7axx6j+Q2bTsnHdv0DpHPLdUwTpH7KzRDRpMhEc/fiLV6J5AUHHEEsTd9q49MW PBzVEv/d6ynYcQZAI5k/p/9r7aJRz6Mts8WkT1oWeMraC0EttJDUYlxzpR0HXJBl/yPn 61pw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:subject:cc:to:from:date :arc-authentication-results; bh=nsxIx3ChE5pkRbweLpVeHTz4LmOJfP70EH+Vi8Til+0=; b=ftSrPNP2mrDWlZEb7jRuyrWBDRAxEr0r5O7kpkRA5uNxtmNMmpdnY9KubBtkoYl5t6 ccjFJd0TEdm4jXtts01GV+mstUimAm33SgmYePWHjYr4APjIhQ51nSaFTHyCVR0A+Kpy Z72AKBGZm5+W8HFafWy2oL//J2O9EpeGIvozwH/I3J5FaLR/7HYXS1JVnq8Yo632597C gA/1Er83mLzNyDYRqKqkVMq8expKTFE+SfgxiQT3oFr0DXcgEbyuHZe7FXzCmxlchGsS OFH4M83AGs+FDPgPNoeqghhUEwY79APYo4dijpwAQH9kcPtYh2oR53HpcebLvzRjsN5k ehMg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id p10-v6si12120205plk.295.2018.06.24.13.00.46; Sun, 24 Jun 2018 13:01:01 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751610AbeFXUAG (ORCPT + 99 others); Sun, 24 Jun 2018 16:00:06 -0400 Received: from mail.bootlin.com ([62.4.15.54]:57898 "EHLO mail.bootlin.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751018AbeFXUAF (ORCPT ); Sun, 24 Jun 2018 16:00:05 -0400 Received: by mail.bootlin.com (Postfix, from userid 110) id D7CB020834; Sun, 24 Jun 2018 22:00:03 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on mail.bootlin.com X-Spam-Level: X-Spam-Status: No, score=-1.0 required=5.0 tests=ALL_TRUSTED,SHORTCIRCUIT shortcircuit=ham autolearn=disabled version=3.4.0 Received: from bbrezillon (unknown [91.160.177.164]) by mail.bootlin.com (Postfix) with ESMTPSA id 8770D206A0; Sun, 24 Jun 2018 22:00:03 +0200 (CEST) Date: Sun, 24 Jun 2018 22:00:03 +0200 From: Boris Brezillon To: Tudor Ambarus Cc: , , , , , linux-mtd@lists.infradead.org, linux-kernel@vger.kernel.org, Cristian.Birsan@microchip.com, nicolas.ferre@microchip.com Subject: Re: [PATCH] mtd: spi-nor: add support to non-uniform SFDP SPI NOR flash memories Message-ID: <20180624220003.5faaae8c@bbrezillon> In-Reply-To: <20180608134818.21387-2-tudor.ambarus@microchip.com> References: <20180608134818.21387-1-tudor.ambarus@microchip.com> <20180608134818.21387-2-tudor.ambarus@microchip.com> X-Mailer: Claws Mail 3.15.0-dirty (GTK+ 2.24.31; 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 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Tudor, Just one minor comment, I'll let Marek review the patch in more details. On Fri, 8 Jun 2018 16:48:18 +0300 Tudor Ambarus wrote: > /* > * Erase an address range on the nor chip. The address range may extend > * one or more erase sectors. Return an error is there is a problem erasing. > @@ -511,9 +721,11 @@ static int spi_nor_erase(struct mtd_info *mtd, struct erase_info *instr) > dev_dbg(nor->dev, "at 0x%llx, len %lld\n", (long long)instr->addr, > (long long)instr->len); > > - div_u64_rem(instr->len, mtd->erasesize, &rem); > - if (rem) > - return -EINVAL; > + if (likely(spi_nor_has_uniform_erase(nor))) { To be honest, I don't think the likely() makes any difference here, given the time it takes to actually erase the block. Can we just drop it? > + div_u64_rem(instr->len, mtd->erasesize, &rem); > + if (rem) > + return -EINVAL; > + } Regards, Boris