mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Rostislav Lisovy <lisovy@gmail.com>
To: David Woodhouse <dwmw2@infradead.org>,
	Brian Norris <computersforpeace@gmail.com>,
	Tony Lindgren <tony@atomide.com>, Roger Quadros <rogerq@ti.com>,
	linux-mtd@lists.infradead.org, linux-kernel@vger.kernel.org
Cc: lisovy@gmail.com, michal.vokac@comap.cz, sojkam1@fel.cvut.cz,
	Rostislav Lisovy <lisovy@merica.cz>
Subject: [PATCH v2 1/2] mtd: nand: omap: Do not use global variables
Date: Thu,  2 Oct 2014 14:16:12 +0200	[thread overview]
Message-ID: <1412252173-20454-1-git-send-email-lisovy@merica.cz> (raw)

Since the commit 97a288ba2cfa ("ARM: omap2+: gpmc-nand: Use
dynamic platform_device_alloc()") gpmc-nand driver supports
multiple NAND flash devices connected to the single controller.
Remove global variable to make the code thread-safe.

Signed-off-by: Rostislav Lisovy <lisovy@merica.cz>
---
Changes since v1:
* Do not dynamically allocate the 'struct nand_ecclayout' but rather
  include it in the 'struct omap_nand_info' (Roger Quadros)


 drivers/mtd/nand/omap2.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/drivers/mtd/nand/omap2.c b/drivers/mtd/nand/omap2.c
index 3b357e9..f0dcdb6 100644
--- a/drivers/mtd/nand/omap2.c
+++ b/drivers/mtd/nand/omap2.c
@@ -144,9 +144,6 @@ static u_char bch8_vector[] = {0xf3, 0xdb, 0x14, 0x16, 0x8b, 0xd2, 0xbe, 0xcc,
 	0xac, 0x6b, 0xff, 0x99, 0x7b};
 static u_char bch4_vector[] = {0x00, 0x6b, 0x31, 0xdd, 0x41, 0xbc, 0x10};
 
-/* oob info generated runtime depending on ecc algorithm and layout selected */
-static struct nand_ecclayout omap_oobinfo;
-
 struct omap_nand_info {
 	struct nand_hw_control		controller;
 	struct omap_nand_platform_data	*pdata;
@@ -168,6 +165,8 @@ struct omap_nand_info {
 	u_char				*buf;
 	int					buf_len;
 	struct gpmc_nand_regs		reg;
+	/* generated on runtime depending on ecc algorithm and layout selected */
+	struct nand_ecclayout		oobinfo;
 	/* fields specific for BCHx_HW ECC scheme */
 	struct device			*elm_dev;
 	struct device_node		*of_node;
@@ -1840,7 +1839,7 @@ static int omap_nand_probe(struct platform_device *pdev)
 	}
 
 	/* populate MTD interface based on ECC scheme */
-	ecclayout		= &omap_oobinfo;
+	ecclayout		= &info->oobinfo;
 	switch (info->ecc_opt) {
 	case OMAP_ECC_HAM1_CODE_SW:
 		nand_chip->ecc.mode = NAND_ECC_SOFT;
-- 
1.9.1


             reply	other threads:[~2014-10-02 12:16 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-10-02 12:16 Rostislav Lisovy [this message]
2014-10-02 12:16 ` [PATCH v2 2/2] mtd: nand: omap: Synchronize access to the ECC engine Rostislav Lisovy
2014-10-02 12:51   ` Roger Quadros
2014-10-02 13:20     ` Rostislav Lisovy
2014-10-02 12:35 ` [PATCH v2 1/2] mtd: nand: omap: Do not use global variables Roger Quadros
2014-10-02 14:16   ` [PATCH v3 2/2] mtd: nand: omap: Synchronize the access to the ECC engine Rostislav Lisovy
2014-10-29  9:16     ` Rostislav Lisovy
2014-10-29  9:24     ` Frans Klaver
2014-10-29  9:37       ` Roger Quadros
2014-10-22  8:34 ` [PATCH v2 1/2] mtd: nand: omap: Do not use global variables Brian Norris

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1412252173-20454-1-git-send-email-lisovy@merica.cz \
    --to=lisovy@gmail.com \
    --cc=computersforpeace@gmail.com \
    --cc=dwmw2@infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mtd@lists.infradead.org \
    --cc=lisovy@merica.cz \
    --cc=michal.vokac@comap.cz \
    --cc=rogerq@ti.com \
    --cc=sojkam1@fel.cvut.cz \
    --cc=tony@atomide.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®