Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp3927878imu; Mon, 12 Nov 2018 02:58:59 -0800 (PST) X-Google-Smtp-Source: AJdET5f1L2FTmTyNUv0hQOBP2h6wqakP/q12NNk+0sgSakrRReWRssDxuGH2bU6pXQqu67psR11s X-Received: by 2002:a62:f94b:: with SMTP id g11-v6mr431880pfm.244.1542020339875; Mon, 12 Nov 2018 02:58:59 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1542020339; cv=none; d=google.com; s=arc-20160816; b=hojpOibLd+OspObJGCxfvrUKeBPeb6NLugtAqnFCgr1zZlPOO9ArX6E8wbU2icAkt4 frw2AiD4x0Upqw/wlQxh5Zfq7ALBEOK65XngjsWNncqKSzHL+tG+wfEtGZoQIZSlzD05 MA+qoNu5x7SAzLYgxCBL0ZYsfvVX4Bk3Oqebkk2llTY+pa0aXhsDVwc5FdFuSxnLXF1E +jZ+0ib04bj1vjXy2BfCxxNP1R/D315+u5d6oBIfJFMssLMHMlJhWxNeWqWvyy6EQYSO KSXfeW3u1NLLbIeAEoF4VohdIVhJWKRYxXQ24uumSDJlBtIRve67g1LbgRPwBdmYRiO4 m0+Q== 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; bh=fRVV0nUaNsitT5H0CTy6cQ2f0lz4FoNP132s3nilC/0=; b=ImA7lhuRQz4OvGNUasPFLD99wJ4tyMzviAOtNZVIZGnzmqtc+Pds7SYU73dTxHj3QF NBz8J0aD/IAJOfN8qwXia7YMjE9LzSKjNrLHu1lw7dvCiYCOHjNjvE6XLLL+/k8YSO5B 3XMdmpDdMQqz936GEDPvrdfcnQr+2uR8mJJDdumA7tHcctX+DlOqWVsxWatAEJckAPwV 2zAxcvaRPzJmtcsfi8vbFntKNH7iuOYA45GQ5wx3eC80N3x1Xk3gbu+IMBg3dRSDzgWo HCipWAMz32DPFbtesdroI72+L0kUw5rPggwWdq2A2cU9xWRQQeY6yH5zruBU3+TbzwHC TDUQ== 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 x187si16456940pgx.241.2018.11.12.02.58.44; Mon, 12 Nov 2018 02:58:59 -0800 (PST) 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 S1729171AbeKLUvH (ORCPT + 99 others); Mon, 12 Nov 2018 15:51:07 -0500 Received: from mail.bootlin.com ([62.4.15.54]:43064 "EHLO mail.bootlin.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728350AbeKLUvH (ORCPT ); Mon, 12 Nov 2018 15:51:07 -0500 Received: by mail.bootlin.com (Postfix, from userid 110) id 19455207BD; Mon, 12 Nov 2018 11:58:21 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on mail.bootlin.com X-Spam-Level: X-Spam-Status: No, score=-1.0 required=5.0 tests=ALL_TRUSTED,SHORTCIRCUIT, URIBL_BLOCKED shortcircuit=ham autolearn=disabled version=3.4.2 Received: from bbrezillon (91-160-177-164.subs.proxad.net [91.160.177.164]) by mail.bootlin.com (Postfix) with ESMTPSA id A8550206D8; Mon, 12 Nov 2018 11:58:10 +0100 (CET) Date: Mon, 12 Nov 2018 11:58:10 +0100 From: Boris Brezillon To: Martin Lund Cc: naga.sureshkumar.relli@xilinx.com, miquel.raynal@bootlin.com, richard@nod.at, dwmw2@infradead.org, computersforpeace@gmail.com, marek.vasut@gmail.com, michals@xilinx.com, nagasuresh12@gmail.com, linux-mtd@lists.infradead.org, linux-kernel@vger.kernel.org, robh@kernel.org Subject: Re: [LINUX PATCH v12 3/3] mtd: rawnand: arasan: Add support for Arasan NAND Flash Controller Message-ID: <20181112115810.6f931cfb@bbrezillon> In-Reply-To: References: <1541739641-17789-1-git-send-email-naga.sureshkumar.relli@xilinx.com> <1541739641-17789-4-git-send-email-naga.sureshkumar.relli@xilinx.com> X-Mailer: Claws Mail 3.16.0 (GTK+ 2.24.32; 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 On Mon, 12 Nov 2018 11:55:36 +0100 Martin Lund wrote: > Hi Naga, > > Just a few review comments for the v12 version. > > On Fri, Nov 9, 2018 at 6:00 AM Naga Sureshkumar Relli > wrote: > > +#define PKT_OFST 0x00 > > +#define PKT_CNT_SHIFT 12 > > + > > +#define MEM_ADDR1_OFST 0x04 > > +#define MEM_ADDR2_OFST 0x08 > > For the sake of readability I think *_OFFSET is preferred, especially > since the driver already includes short macro names. I think this is > similar to the EVNT vs EVENT point. > The majority of drivers in the Linux kernel do not shorten OFFSET -> OFST. > > > > +static void anfc_rw_pio_op(struct mtd_info *mtd, u8 *buf, int len, > > + bool do_read, int prog, int pktcount, int pktsize) > > +{ > > + struct nand_chip *chip = mtd_to_nand(mtd); > > + struct anfc_nand_controller *nfc = to_anfc(chip->controller); > > + struct anfc_nand_chip *achip = to_anfc_nand(chip); > > + u32 *bufptr = (u32 *)buf; > > + u32 cnt = 0, intr = 0; > > + > > + anfc_config_dma(nfc, 0); > > + > > + if (pktsize == 0) > > + pktsize = len; > > + > > + anfc_setpktszcnt(nfc, pktsize, pktcount); > > + > > + if (!achip->strength) > > + intr = MBIT_ERROR; > > + > > + if (do_read) > > + intr |= READ_READY; > > + else > > + intr |= WRITE_READY; > > + anfc_enable_intrs(nfc, intr); > > + writel(prog, nfc->base + PROG_OFST); > > + while (cnt < pktcount) { > > + anfc_wait_for_event(nfc); > > + cnt++; > > + if (cnt == pktcount) > > + anfc_enable_intrs(nfc, XFER_COMPLETE); > > + if (do_read) > > + ioread32_rep(nfc->base + DATA_PORT_OFST, bufptr, > > + pktsize / 4); > > + else > > + iowrite32_rep(nfc->base + DATA_PORT_OFST, bufptr, > > + pktsize / 4); > > + bufptr += (pktsize / 4); > > + if (cnt < pktcount) > > + anfc_enable_intrs(nfc, intr); > > + } > > + anfc_wait_for_event(nfc); > > +} > > Throughout the driver all calls to anfc_wait_for_event() ignores the > timeout return value. It would be nice to see some error handling in > case it times out - at minimum consider printing out an error message > since timeout on NAND operations are fairly critical and should > generally not occur. Perhaps even an argument can be made for > returning -ETIMEDOUT in case of timeout. Yes please, check anfc_wait_for_event() return code and propagate the error to the upper layer.