From patchwork Thu Aug 2 12:53:52 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frieder Schrempf X-Patchwork-Id: 952723 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.infradead.org (client-ip=2607:7c80:54:e::133; helo=bombadil.infradead.org; envelope-from=linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=exceet.de Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="JIuU8fbw"; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=as-electronics.de header.i=@as-electronics.de header.b="Kty7zhf3"; dkim-atps=neutral Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:e::133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 41h9BM3LsMz9ryn for ; Thu, 2 Aug 2018 22:55:07 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=v0KSWjouw+8ENiOK7XsqCjYUTL+DqpfGf4Msa8veC0o=; b=JIuU8fbwtEy3nZE/65KWUIvHl6 ffMH8E9Wxuznf5VNmHukWXWvUxjpQBqVfOfon+jMYRWE7IXfhhUsYfAnkdOgBuMlQ86VcyiEl7BGs 5d5t3tHPC3ZsJO2Jdz/4QZSU9OBnqTufFXxgrBNc57vOTEspuefS6b3fk0Pw82R7LImY3tIgs1B3Y igHkB6RfQd4VPrL4NJmO8x5AhOuQIQLTOEr841XYivXk6ejJwRL5MojnNPizolk6DUmfhLNarWHJt wTV6MWOohtakqh4iy9eDNSRUNW0Mq4qEdnfADjIs0+02bFEj1GLfQ05suDVm5aUHHxUG+oeOURjPK QfBgE+tg==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1flD85-0006tm-TK; Thu, 02 Aug 2018 12:54:57 +0000 Received: from mo6-p05-ob.smtp.rzone.de ([2a01:238:20a:202:5305::4]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1flD80-0006nq-OM for linux-mtd@lists.infradead.org; Thu, 02 Aug 2018 12:54:55 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; t=1533214481; s=strato-dkim-0002; d=as-electronics.de; h=References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From: X-RZG-CLASS-ID:X-RZG-AUTH:From:Subject:Sender; bh=8q57JZNYbenQBiT361UPYFH2hWlsC7pLZ2/SJra925w=; b=Kty7zhf3ePS6axmW7OlB80t/CAA1rvm7wIUuxs9EOBlEiFj/F0Ah9JTf7OayZv2OWg UdwVGLH4Gsy2IlNRJvEyGxSgzSkrcBgthgDWjadp78g5vdOMFCY1QD1iY/2SALZNhgcS xQ0MbkIWtak0t+rLg/41ufw7skAVmYNOZ5gQWgWcywgd5pwl/NCIQiEWKC7Y0eG4afii EcqDu/SZZRS3O4l1IpN8PNCeALaZGBTGo2mH8vmRq4xDOnoL6FDzFEh1CK0MsJnoQnKq wq7qIDAmpsbPYjv2ckXC8qQPaU/HMZVG41wKWC80oqivUNTaxV2aBSrcm2YqS7XvkuP9 56vA== X-RZG-AUTH: ":LX8JdEmkW/4tAFwMkcNJIloh1hrA5u3owhPk7bdT5Fx22AatU+eLaHfutoZdl+X9BETxn4/4+IVqx+ReE5zXU1i255vGQvjM+ToVYx2MGL/3gV0P3t0=" X-RZG-CLASS-ID: mo05 Received: from fs-work.fritz.box by smtp.strato.de (RZmta 43.14 AUTH) with ESMTPSA id Z0998bu72CsR7Pb (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA (curve secp521r1 with 521 ECDH bits, eq. 15360 bits RSA)) (Client did not present a certificate); Thu, 2 Aug 2018 14:54:27 +0200 (CEST) From: Frieder Schrempf To: dwmw2@infradead.org, computersforpeace@gmail.com, boris.brezillon@bootlin.com, marek.vasut@gmail.com, richard@nod.at, broonie@kernel.org, linux-mtd@lists.infradead.org, linux-spi@vger.kernel.org Subject: [PATCH v3 1/3] spi: spi-mem: Fix a typo in the documentation of struct spi_mem Date: Thu, 2 Aug 2018 14:53:52 +0200 Message-Id: <1533214434-28761-2-git-send-email-frieder.schrempf@exceet.de> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1533214434-28761-1-git-send-email-frieder.schrempf@exceet.de> References: <1533214434-28761-1-git-send-email-frieder.schrempf@exceet.de> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180802_055453_003485_AE6446C5 X-CRM114-Status: UNSURE ( 9.57 ) X-CRM114-Notice: Please train this message. X-Spam-Score: -0.7 (/) X-Spam-Report: SpamAssassin version 3.4.1 on bombadil.infradead.org summary: Content analysis details: (-0.7 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at http://www.dnswl.org/, low trust [2a01:238:20a:202:5305:0:0:4 listed in] [list.dnswl.org] -0.0 SPF_HELO_PASS SPF: HELO matches SPF record 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature X-BeenThere: linux-mtd@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: Linux MTD discussion mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-kernel@vger.kernel.org, frieder.schrempf@exceet.de, pp@emlix.com, Zhiqiang.Hou@nxp.com, cyrille.pitchen@wedev4u.fr MIME-Version: 1.0 Sender: "linux-mtd" Errors-To: linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org Signed-off-by: Frieder Schrempf Acked-by: Boris Brezillon --- include/linux/spi/spi-mem.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/linux/spi/spi-mem.h b/include/linux/spi/spi-mem.h index 4fa34a2..72cc9bc 100644 --- a/include/linux/spi/spi-mem.h +++ b/include/linux/spi/spi-mem.h @@ -124,7 +124,7 @@ struct spi_mem_op { /** * struct spi_mem - describes a SPI memory device * @spi: the underlying SPI device - * @drvpriv: spi_mem_drviver private data + * @drvpriv: spi_mem_driver private data * * Extra information that describe the SPI memory device and may be needed by * the controller to properly handle this device should be placed here. From patchwork Thu Aug 2 12:53:53 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frieder Schrempf X-Patchwork-Id: 952725 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.infradead.org (client-ip=2607:7c80:54:e::133; helo=bombadil.infradead.org; envelope-from=linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=exceet.de Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="DDlQdI3p"; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=as-electronics.de header.i=@as-electronics.de header.b="m84ye5tx"; dkim-atps=neutral Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:e::133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 41h9Bk4SP5z9ryn for ; Thu, 2 Aug 2018 22:55:26 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=wthQhKcSPP2/kac1vqCT/S/1PrrCoCgnpzLpu9gWA+k=; b=DDlQdI3pJ7OKLAWuIqAA4UCKVF G5XN+VSnHxurkXoEbTS4f1owj7DKjLjrrYtcG7T5VxNDGzx3uRjLLVpN/nvjnVPK0r/lGc2rjYSVl ZOz4Ylj35+tAH1u36I+QCfLgusu/DxhRiTZbUzVW2UyL7rA4uwstKcCZfsWnhdIuTREQ7Qq7XktJ6 jjOH2cyhgWifTGR6MGRfB1NDRq9MWqXMUJz+C+ycUkx7dlZrk+YKFPlZXn/z6FUGqlhElahRcAo0e /HY1w/gr4fIaXrFbv+T13PIZy5D8b986CFvFvsPwt/oNjaTM+tptNpjgMVOhT6ivKGjr4I9IgjA7E A6zJo5PA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1flD8Q-0007Sl-7E; Thu, 02 Aug 2018 12:55:18 +0000 Received: from mo6-p05-ob.smtp.rzone.de ([2a01:238:20a:202:5305::12]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1flD81-0006oJ-QM for linux-mtd@lists.infradead.org; Thu, 02 Aug 2018 12:54:57 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; t=1533214481; s=strato-dkim-0002; d=as-electronics.de; h=References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From: X-RZG-CLASS-ID:X-RZG-AUTH:From:Subject:Sender; bh=1Nw4oy/M2+Hl0Qt84GNVPRKcClVDBIXjTslZX0Rwdsg=; b=m84ye5txgeih44pJPPLpnayhh21tYZDhay/+p9PkH1Yp0K0hbzRL+8EOeic8rZNpbi VyW3bEUe6EwaJ1PHkThn/BbQGYZKQBJPr6RQGsUb3saWdtQLsXPoFPsGxiT5SMGeX0TM /rxR0wfYSyhl6fRvfA2vcodI51haJs/1On3ApMmuzNp9majlROubfiB8EmSaXAw4d6aB WewM6jH8ldZm8WzdbG9XZXyBp5WtAD4v1215WWgHrLITA9gsBVJnaUSu5mmzk0KAWD3b 5lShF5IbrJEcWRLTlbQ8bujD+IGBW8XsPV0TBos0O888Cblc6h2vJ5ecKQ6AypDYpt17 +Iuw== X-RZG-AUTH: ":LX8JdEmkW/4tAFwMkcNJIloh1hrA5u3owhPk7bdT5Fx22AatU+eLaHfutoZdl+X9BETxn4/4+IVqx+ReE5zXU1i255vGQvjM+ToVYx2MGL/3gV0P3t0=" X-RZG-CLASS-ID: mo05 Received: from fs-work.fritz.box by smtp.strato.de (RZmta 43.14 AUTH) with ESMTPSA id Z0998bu72CsS7Pe (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA (curve secp521r1 with 521 ECDH bits, eq. 15360 bits RSA)) (Client did not present a certificate); Thu, 2 Aug 2018 14:54:28 +0200 (CEST) From: Frieder Schrempf To: dwmw2@infradead.org, computersforpeace@gmail.com, boris.brezillon@bootlin.com, marek.vasut@gmail.com, richard@nod.at, broonie@kernel.org, linux-mtd@lists.infradead.org, linux-spi@vger.kernel.org Subject: [PATCH v3 2/3] spi: spi-mem: Extend the SPI mem interface to set a custom memory name Date: Thu, 2 Aug 2018 14:53:53 +0200 Message-Id: <1533214434-28761-3-git-send-email-frieder.schrempf@exceet.de> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1533214434-28761-1-git-send-email-frieder.schrempf@exceet.de> References: <1533214434-28761-1-git-send-email-frieder.schrempf@exceet.de> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180802_055454_005932_D0475E90 X-CRM114-Status: GOOD ( 15.30 ) X-Spam-Score: -0.7 (/) X-Spam-Report: SpamAssassin version 3.4.1 on bombadil.infradead.org summary: Content analysis details: (-0.7 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at http://www.dnswl.org/, low trust [2a01:238:20a:202:5305:0:0:12 listed in] [list.dnswl.org] -0.0 SPF_HELO_PASS SPF: HELO matches SPF record 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature X-BeenThere: linux-mtd@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: Linux MTD discussion mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-kernel@vger.kernel.org, frieder.schrempf@exceet.de, pp@emlix.com, Zhiqiang.Hou@nxp.com, cyrille.pitchen@wedev4u.fr MIME-Version: 1.0 Sender: "linux-mtd" Errors-To: linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org When porting (Q)SPI controller drivers from the MTD layer to the SPI layer, the naming scheme for the memory devices changes. To be able to keep compatibility with the old drivers naming scheme, a name field is added to struct spi_mem and a hook is added to let controller drivers set a custom name for the memory device. Example for the FSL QSPI driver: Name with the old driver: 21e0000.qspi, or with multiple devices: 21e0000.qspi-0, 21e0000.qspi-1, ... Name with the new driver without spi_mem_get_name: spi4.0 Suggested-by: Boris Brezillon Signed-off-by: Frieder Schrempf Reviewed-by: Boris Brezillon --- drivers/spi/spi-mem.c | 28 ++++++++++++++++++++++++++++ include/linux/spi/spi-mem.h | 12 ++++++++++++ 2 files changed, 40 insertions(+) diff --git a/drivers/spi/spi-mem.c b/drivers/spi/spi-mem.c index 990770d..e43842c 100644 --- a/drivers/spi/spi-mem.c +++ b/drivers/spi/spi-mem.c @@ -311,6 +311,24 @@ int spi_mem_exec_op(struct spi_mem *mem, const struct spi_mem_op *op) EXPORT_SYMBOL_GPL(spi_mem_exec_op); /** + * spi_mem_get_name() - Return the SPI mem device name to be used by the + * upper layer if necessary + * @mem: the SPI memory + * + * This function allows SPI mem users to retrieve the SPI mem device name. + * It is useful if the upper layer needs to expose a custom name for + * compatibility reasons. + * + * Return: a string containing the name of the memory device to be used + * by the SPI mem user + */ +const char *spi_mem_get_name(struct spi_mem *mem) +{ + return mem->name; +} +EXPORT_SYMBOL_GPL(spi_mem_get_name); + +/** * spi_mem_adjust_op_size() - Adjust the data size of a SPI mem operation to * match controller limitations * @mem: the SPI memory @@ -344,6 +362,7 @@ static inline struct spi_mem_driver *to_spi_mem_drv(struct device_driver *drv) static int spi_mem_probe(struct spi_device *spi) { struct spi_mem_driver *memdrv = to_spi_mem_drv(spi->dev.driver); + struct spi_controller *ctlr = spi->controller; struct spi_mem *mem; mem = devm_kzalloc(&spi->dev, sizeof(*mem), GFP_KERNEL); @@ -351,6 +370,15 @@ static int spi_mem_probe(struct spi_device *spi) return -ENOMEM; mem->spi = spi; + + if (ctlr->mem_ops && ctlr->mem_ops->get_name) + mem->name = ctlr->mem_ops->get_name(mem); + else + mem->name = dev_name(&spi->dev); + + if (IS_ERR_OR_NULL(mem->name)) + return PTR_ERR(mem->name); + spi_set_drvdata(spi, mem); return memdrv->probe(mem); diff --git a/include/linux/spi/spi-mem.h b/include/linux/spi/spi-mem.h index 72cc9bc..0d41826 100644 --- a/include/linux/spi/spi-mem.h +++ b/include/linux/spi/spi-mem.h @@ -125,6 +125,7 @@ struct spi_mem_op { * struct spi_mem - describes a SPI memory device * @spi: the underlying SPI device * @drvpriv: spi_mem_driver private data + * @name: name of the SPI memory device * * Extra information that describe the SPI memory device and may be needed by * the controller to properly handle this device should be placed here. @@ -135,6 +136,7 @@ struct spi_mem_op { struct spi_mem { struct spi_device *spi; void *drvpriv; + char *name; }; /** @@ -167,6 +169,13 @@ static inline void *spi_mem_get_drvdata(struct spi_mem *mem) * limitations) * @supports_op: check if an operation is supported by the controller * @exec_op: execute a SPI memory operation + * @get_name: get a custom name for the SPI mem device from the controller. + * This might be needed if the controller driver has been ported + * to use the SPI mem layer and a custom name is used to keep + * mtdparts compatible. + * Note that if the implementation of this function allocates memory + * dynamically, then it should do so with devm_xxx(), as we don't + * have a ->free_name() function. * * This interface should be implemented by SPI controllers providing an * high-level interface to execute SPI memory operation, which is usually the @@ -178,6 +187,7 @@ struct spi_controller_mem_ops { const struct spi_mem_op *op); int (*exec_op)(struct spi_mem *mem, const struct spi_mem_op *op); + const char *(*get_name)(struct spi_mem *mem); }; /** @@ -236,6 +246,8 @@ bool spi_mem_supports_op(struct spi_mem *mem, int spi_mem_exec_op(struct spi_mem *mem, const struct spi_mem_op *op); +const char *spi_mem_get_name(struct spi_mem *mem); + int spi_mem_driver_register_with_owner(struct spi_mem_driver *drv, struct module *owner); From patchwork Thu Aug 2 12:53:54 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frieder Schrempf X-Patchwork-Id: 952724 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.infradead.org (client-ip=2607:7c80:54:e::133; helo=bombadil.infradead.org; envelope-from=linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=exceet.de Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="qYTvSq+l"; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=as-electronics.de header.i=@as-electronics.de header.b="BCgD/v/V"; dkim-atps=neutral Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:e::133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 41h9BV08cJz9ryn for ; Thu, 2 Aug 2018 22:55:14 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=nBGrBtVfca0wD1X/XJ4nyayQGrP4lC0Ti7lybWhVhZw=; b=qYTvSq+lFHWL1OwNceAgst8EoS hYOafzAIC32wM52Mupcn/HNAONByqbJMBNF9yWIqeqh7ssj3UT9giFjoWkgiIgiodxb6hjEDnrOp8 MaOadnEyre9hnAlU3igZSxJw9ywHeZxFZVDXSi3gKWENL/67QMCKriT9/qMKC1bzBySKIlT+nO9u9 lbcv4AtxSxlLm323XfJ9ogekutlNey1eXmQl59LDI1R7bJMp4UVs3nlHSCtIwjMY+PAE4cGSHqL7b UOXzG3aHMudPTYfZg+QHA8Sm6yzZvUbKXWFl0jHjsYTea/zCXPsaf/Hm0Wli9jzWUklJmOEagQLLG IOty2EGw==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1flD8E-00076q-Nx; Thu, 02 Aug 2018 12:55:06 +0000 Received: from mo6-p05-ob.smtp.rzone.de ([2a01:238:20a:202:5305::8]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1flD81-0006o2-C8 for linux-mtd@lists.infradead.org; Thu, 02 Aug 2018 12:54:55 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; t=1533214481; s=strato-dkim-0002; d=as-electronics.de; h=References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From: X-RZG-CLASS-ID:X-RZG-AUTH:From:Subject:Sender; bh=Z+3vqqSZo8xz681gBxM4nJCvZiYwbbDIV18OBHmuLzM=; b=BCgD/v/Vjp0idDzrMbxNCsJGMmincnAult7YsasQ5fD33vW8AlXwu0zKAzNCpUyFGm JzvqF3uBN4iLL/N9p8vbVdKcG3JQEEUdH6fFcLWkkphvgYIy8imCrcEhKV8GiEIWkVmZ eRVRudUyKOMEItKRzzqVZZn75HAov7MY7gxueMCke7Q2DyNwK1ztGpDn+31x/i4+Txdp 4bcrwimXCdW+wkoLP2wfelbfDejpnv+sCwmZTnRoBrm2O/PiswdQyLaRffthgg1CZTHv bcn1sMHCurAHDriFaMk5k07Wkq9v42Bt485/IUrgwdOBfvS6ONB2SLK74UKWLShpHzGe XBng== X-RZG-AUTH: ":LX8JdEmkW/4tAFwMkcNJIloh1hrA5u3owhPk7bdT5Fx22AatU+eLaHfutoZdl+X9BETxn4/4+IVqx+ReE5zXU1i255vGQvjM+ToVYx2MGL/3gV0P3t0=" X-RZG-CLASS-ID: mo05 Received: from fs-work.fritz.box by smtp.strato.de (RZmta 43.14 AUTH) with ESMTPSA id Z0998bu72CsU7Pf (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA (curve secp521r1 with 521 ECDH bits, eq. 15360 bits RSA)) (Client did not present a certificate); Thu, 2 Aug 2018 14:54:30 +0200 (CEST) From: Frieder Schrempf To: dwmw2@infradead.org, computersforpeace@gmail.com, boris.brezillon@bootlin.com, marek.vasut@gmail.com, richard@nod.at, broonie@kernel.org, linux-mtd@lists.infradead.org, linux-spi@vger.kernel.org Subject: [PATCH v3 3/3] mtd: m25p80: Call spi_mem_get_name() to let controller set a custom name Date: Thu, 2 Aug 2018 14:53:54 +0200 Message-Id: <1533214434-28761-4-git-send-email-frieder.schrempf@exceet.de> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1533214434-28761-1-git-send-email-frieder.schrempf@exceet.de> References: <1533214434-28761-1-git-send-email-frieder.schrempf@exceet.de> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180802_055453_623736_68BA54E1 X-CRM114-Status: GOOD ( 10.06 ) X-Spam-Score: -0.7 (/) X-Spam-Report: SpamAssassin version 3.4.1 on bombadil.infradead.org summary: Content analysis details: (-0.7 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at http://www.dnswl.org/, low trust [2a01:238:20a:202:5305:0:0:8 listed in] [list.dnswl.org] -0.0 SPF_HELO_PASS SPF: HELO matches SPF record 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature X-BeenThere: linux-mtd@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: Linux MTD discussion mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-kernel@vger.kernel.org, frieder.schrempf@exceet.de, pp@emlix.com, Zhiqiang.Hou@nxp.com, cyrille.pitchen@wedev4u.fr MIME-Version: 1.0 Sender: "linux-mtd" Errors-To: linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org By calling spi_mem_get_name(), the driver of the (Q)SPI controller can set a custom name for the memory device if necessary. This is useful to keep mtdparts compatible when controller drivers are ported from the MTD to the SPI layer. Suggested-by: Boris Brezillon Signed-off-by: Frieder Schrempf Acked-by: Boris Brezillon --- drivers/mtd/devices/m25p80.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/mtd/devices/m25p80.c b/drivers/mtd/devices/m25p80.c index e84563d..aac48800 100644 --- a/drivers/mtd/devices/m25p80.c +++ b/drivers/mtd/devices/m25p80.c @@ -202,6 +202,9 @@ static int m25p_probe(struct spi_mem *spimem) if (data && data->name) nor->mtd.name = data->name; + if (!nor->mtd.name) + nor->mtd.name = spi_mem_get_name(spimem); + /* For some (historical?) reason many platforms provide two different * names in flash_platform_data: "name" and "type". Quite often name is * set to "m25p80" and then "type" provides a real chip name.