From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757059AbbIYPNx (ORCPT ); Fri, 25 Sep 2015 11:13:53 -0400 Received: from down.free-electrons.com ([37.187.137.238]:33705 "EHLO mail.free-electrons.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1756998AbbIYPNv (ORCPT ); Fri, 25 Sep 2015 11:13:51 -0400 From: Boris Brezillon To: David Woodhouse , Brian Norris , linux-mtd@lists.infradead.org, Artem Bityutskiy , Richard Weinberger Cc: Andrea Scian , =?UTF-8?q?Bean=20Huo=20=E9=9C=8D=E6=96=8C=E6=96=8C=20=28beanhuo=29?= , =?UTF-8?q?Karl=20Zhang=20=E5=BC=A0=E5=8F=8C=E9=94=A3=20=28karlzhang=29?= , Iwo Mergler , "Jeff Lauruhn (jlauruhn)" , Stefan Roese , linux-kernel@vger.kernel.org, Boris Brezillon Subject: [PATCH 4/5] mtd: nand: nandsim: implement ->get_status() Date: Fri, 25 Sep 2015 17:09:17 +0200 Message-Id: <1443193758-22071-5-git-send-email-boris.brezillon@free-electrons.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1443193758-22071-1-git-send-email-boris.brezillon@free-electrons.com> References: <1443193758-22071-1-git-send-email-boris.brezillon@free-electrons.com> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org We need to implement a specific ->get_status() function to support power-cut emulation. Signed-off-by: Boris Brezillon --- drivers/mtd/nand/nandsim.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/drivers/mtd/nand/nandsim.c b/drivers/mtd/nand/nandsim.c index b16d70a..efd8763 100644 --- a/drivers/mtd/nand/nandsim.c +++ b/drivers/mtd/nand/nandsim.c @@ -347,7 +347,7 @@ struct nandsim { /* NAND flash internal registers */ struct { unsigned command; /* the command register */ - u_char status; /* the status register */ + int status; /* the status register */ uint row; /* the page number */ uint column; /* the offset within page */ uint count; /* internal counter */ @@ -2221,6 +2221,13 @@ static void ns_nand_read_buf(struct mtd_info *mtd, u_char *buf, int len) return; } +static int ns_nand_get_status(struct mtd_info *mtd) +{ + struct nandsim *ns = ((struct nand_chip *)mtd->priv)->priv; + + return ns->regs.status; +} + /* * Module initialization function */ @@ -2256,6 +2263,7 @@ static int __init ns_init_module(void) chip->write_buf = ns_nand_write_buf; chip->read_buf = ns_nand_read_buf; chip->read_word = ns_nand_read_word; + chip->get_status = ns_nand_get_status; chip->ecc.mode = NAND_ECC_SOFT; /* The NAND_SKIP_BBTSCAN option is necessary for 'overridesize' */ /* and 'badblocks' parameters to work */ -- 1.9.1