Received: by 2002:a25:e74b:0:0:0:0:0 with SMTP id e72csp1322966ybh; Thu, 23 Jul 2020 06:13:23 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw6GNlU/JygoMrseHpQG3vbk37rfumZ9sJS9bttPu8WjCwceyFyRdl1gIUXNYzZZRMI5wa2 X-Received: by 2002:a50:cd95:: with SMTP id p21mr4027779edi.12.1595510002799; Thu, 23 Jul 2020 06:13:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1595510002; cv=none; d=google.com; s=arc-20160816; b=C/JQoBiygOWtoN7if0orKzQk4J4h01dgNxsBOv7xYoNuHIF0Bp1ztWyNGwGe5A7Cwv XGY7dr66akJ0evMfRLNdi1yQLEP5mke9UJC7IZprNftW/sdkShr/3KponcKI14CnV9mr hMxXb6YwOSnmzdn62hrjitdlVXSlhSC4O0XnwnT/fTGF094lii+B54gHfcnzmePchMk6 PZ80jS8sshgF/8gba/tq95tSjjXyDU7Bn6Foe8lAnOTLqDhIx1u6nJf9TvEfFS9L30hI bzrREvi/3HkGEkqDUZYm9jfPRIQyPY6StsyAev/Cx+OuyMOpAw4PRnuEecJjBPkuIJ9O 0q4g== 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:date:subject:cc:to:from; bh=NGrBEyhXYw0j/4IGIjgsET7LOUXyDVkRkZPIQeYVjWM=; b=pIBvKqFyqaQ7kJmiCtgNurNAo7B7WRNU1DElwcc/yizWOpp3JPJGFscm1nbYSeBBFR bHFurJExUNs1ewsSN+XPWQ6PnFoitqAhUiqy8qI+wFCK2rECUf3xwSUWdpg1Iu4PdFsg 0ESjVhMjbX4IdgaJ3aiTAWiiEYh7oZShBurH4xWkQSX2BxK5NAcWQwJN58gohwgr/5jB 9CTVoxII1LH4brL9lE9mezKsVNrqrFKUygvbiYfT+VChsYUt9MjNruvEt2ijoAYCmWfU Qs7nBUp4QBjukdqqF+gZM2SfV7e/2+rTt/PFH9meEnqC79LDdX1BqQXfeX3HI2NWhzVC lwsA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id g19si1627336edv.174.2020.07.23.06.12.59; Thu, 23 Jul 2020 06:13:22 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729031AbgGWNMi (ORCPT + 99 others); Thu, 23 Jul 2020 09:12:38 -0400 Received: from relay5-d.mail.gandi.net ([217.70.183.197]:39287 "EHLO relay5-d.mail.gandi.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726521AbgGWNMf (ORCPT ); Thu, 23 Jul 2020 09:12:35 -0400 X-Originating-IP: 42.109.196.68 Received: from localhost.localdomain (unknown [42.109.196.68]) (Authenticated sender: me@yadavpratyush.com) by relay5-d.mail.gandi.net (Postfix) with ESMTPSA id DA5A41C0002; Thu, 23 Jul 2020 13:12:30 +0000 (UTC) From: Pratyush Yadav To: Tudor Ambarus , Miquel Raynal , Richard Weinberger , Vignesh Raghavendra , linux-mtd@lists.infradead.org, linux-kernel@vger.kernel.org Cc: Sekhar Nori , Boris Brezillon , Pratyush Yadav , Pratyush Yadav Subject: [PATCH v11 02/14] mtd: spi-nor: core: add spi_nor_controller_ops_erase helper Date: Thu, 23 Jul 2020 18:41:51 +0530 Message-Id: <20200723131203.40916-3-me@yadavpratyush.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20200723131203.40916-1-me@yadavpratyush.com> References: <20200723131203.40916-1-me@yadavpratyush.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Pratyush Yadav It is a thin wrapper around nor->controller_ops->erase(). In a future commit DTR support will be added. These ops can not be supported by the erase() hook and this helper will make it easier to reject those calls. Signed-off-by: Pratyush Yadav --- drivers/mtd/spi-nor/core.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/drivers/mtd/spi-nor/core.c b/drivers/mtd/spi-nor/core.c index 2ccf2c154779..4a7443e00602 100644 --- a/drivers/mtd/spi-nor/core.c +++ b/drivers/mtd/spi-nor/core.c @@ -94,6 +94,11 @@ static int spi_nor_write_reg(struct spi_nor *nor, u8 opcode, const u8 *buf, return nor->controller_ops->write_reg(nor, opcode, buf, len); } +static int spi_nor_controller_ops_erase(struct spi_nor *nor, loff_t offs) +{ + return nor->controller_ops->erase(nor, offs); +} + /** * spi_nor_spimem_read_data() - read data from flash's memory region via * spi-mem @@ -1130,7 +1135,7 @@ static int spi_nor_erase_sector(struct spi_nor *nor, u32 addr) return spi_mem_exec_op(nor->spimem, &op); } else if (nor->controller_ops->erase) { - return nor->controller_ops->erase(nor, addr); + return spi_nor_controller_ops_erase(nor, addr); } /* -- 2.27.0