linux-mtd.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [patch 2.6.22-rc3] MTD: m25p80 converted to mutex
@ 2007-05-26  3:40 David Brownell
  0 siblings, 0 replies; 8+ messages in thread
From: David Brownell @ 2007-05-26  3:40 UTC (permalink / raw)
  To: linux-mtd

Convert semaphore usage in m25p80 driver to mutex; mention another kind of
SPI flash chip that should be able to use this driver (given minor tweaks).

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
---
 drivers/mtd/devices/m25p80.c |   33 +++++++++++++++++----------------
 1 file changed, 17 insertions(+), 16 deletions(-)

--- g26.orig/drivers/mtd/devices/m25p80.c	2007-05-24 02:02:35.000000000 -0700
+++ g26/drivers/mtd/devices/m25p80.c	2007-05-24 02:11:48.000000000 -0700
@@ -19,16 +19,17 @@
 #include <linux/module.h>
 #include <linux/device.h>
 #include <linux/interrupt.h>
-#include <linux/interrupt.h>
+#include <linux/mutex.h>
+
 #include <linux/mtd/mtd.h>
 #include <linux/mtd/partitions.h>
+
 #include <linux/spi/spi.h>
 #include <linux/spi/flash.h>
 
-#include <asm/semaphore.h>
-
 
 /* NOTE: AT 25F and SST 25LF series are very similar,
+ * as are other newer Atmel dataflash chips (AT26),
  * but commands for sector erase and chip id differ...
  */
 
@@ -65,7 +66,7 @@
 
 struct m25p {
 	struct spi_device	*spi;
-	struct semaphore	lock;
+	struct mutex		lock;
 	struct mtd_info		mtd;
 	unsigned		partitioned;
 	u8			command[4];
@@ -201,13 +202,13 @@ static int m25p80_erase(struct mtd_info 
 	addr = instr->addr;
 	len = instr->len;
 
-  	down(&flash->lock);
+	mutex_lock(&flash->lock);
 
 	/* now erase those sectors */
 	while (len) {
 		if (erase_sector(flash, addr)) {
 			instr->state = MTD_ERASE_FAILED;
-			up(&flash->lock);
+			mutex_unlock(&flash->lock);
 			return -EIO;
 		}
 
@@ -215,7 +216,7 @@ static int m25p80_erase(struct mtd_info 
 		len -= mtd->erasesize;
 	}
 
-  	up(&flash->lock);
+	mutex_unlock(&flash->lock);
 
 	instr->state = MTD_ERASE_DONE;
 	mtd_erase_callback(instr);
@@ -260,12 +261,12 @@ static int m25p80_read(struct mtd_info *
 	if (retlen)
 		*retlen = 0;
 
-	down(&flash->lock);
+	mutex_lock(&flash->lock);
 
 	/* Wait till previous write/erase is done. */
 	if (wait_till_ready(flash)) {
 		/* REVISIT status return?? */
-		up(&flash->lock);
+		mutex_unlock(&flash->lock);
 		return 1;
 	}
 
@@ -281,7 +282,7 @@ static int m25p80_read(struct mtd_info *
 
 	*retlen = m.actual_length - sizeof(flash->command);
 
-  	up(&flash->lock);
+	mutex_unlock(&flash->lock);
 
 	return 0;
 }
@@ -323,7 +324,7 @@ static int m25p80_write(struct mtd_info 
 	t[1].tx_buf = buf;
 	spi_message_add_tail(&t[1], &m);
 
-  	down(&flash->lock);
+	mutex_lock(&flash->lock);
 
 	/* Wait until finished previous write command. */
 	if (wait_till_ready(flash))
@@ -381,10 +382,10 @@ static int m25p80_write(struct mtd_info 
 			if (retlen)
 				*retlen += m.actual_length
 					- sizeof(flash->command);
-	        }
- 	}
+		}
+	}
 
-	up(&flash->lock);
+	mutex_unlock(&flash->lock);
 
 	return 0;
 }
@@ -405,7 +406,7 @@ struct flash_info {
 };
 
 static struct flash_info __devinitdata m25p_data [] = {
-	/* REVISIT: fill in JEDEC ids, for parts that have them */
+	/* JEDEC id zero means "has no ID" */
 	{ "m25p05", 0x05, 0x2010, 32 * 1024, 2 },
 	{ "m25p10", 0x10, 0x2011, 32 * 1024, 4 },
 	{ "m25p20", 0x11, 0x2012, 64 * 1024, 4 },
@@ -456,7 +457,7 @@ static int __devinit m25p_probe(struct s
 		return -ENOMEM;
 
 	flash->spi = spi;
-	init_MUTEX(&flash->lock);
+	mutex_init(&flash->lock);
 	dev_set_drvdata(&spi->dev, flash);
 
 	if (data->name)

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [patch 2.6.22-rc3] MTD: m25p80 converted to mutex
@ 2007-06-24 22:09 David Brownell
  2007-06-28 19:11 ` David Woodhouse
  0 siblings, 1 reply; 8+ messages in thread
From: David Brownell @ 2007-06-24 22:09 UTC (permalink / raw)
  To: linux-mtd

Convert semaphore usage in m25p80 driver to mutex; mention another kind of
SPI flash chip that should be able to use this driver (given minor tweaks).

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
---
[RESEND -- original was on 25-May, was neither merged nor acked ]

 drivers/mtd/devices/m25p80.c |   33 +++++++++++++++++----------------
 1 file changed, 17 insertions(+), 16 deletions(-)

--- g26.orig/drivers/mtd/devices/m25p80.c	2007-05-24 02:02:35.000000000 -0700
+++ g26/drivers/mtd/devices/m25p80.c	2007-05-24 02:11:48.000000000 -0700
@@ -19,16 +19,17 @@
 #include <linux/module.h>
 #include <linux/device.h>
 #include <linux/interrupt.h>
-#include <linux/interrupt.h>
+#include <linux/mutex.h>
+
 #include <linux/mtd/mtd.h>
 #include <linux/mtd/partitions.h>
+
 #include <linux/spi/spi.h>
 #include <linux/spi/flash.h>
 
-#include <asm/semaphore.h>
-
 
 /* NOTE: AT 25F and SST 25LF series are very similar,
+ * as are other newer Atmel dataflash chips (AT26),
  * but commands for sector erase and chip id differ...
  */
 
@@ -65,7 +66,7 @@
 
 struct m25p {
 	struct spi_device	*spi;
-	struct semaphore	lock;
+	struct mutex		lock;
 	struct mtd_info		mtd;
 	unsigned		partitioned;
 	u8			command[4];
@@ -201,13 +202,13 @@ static int m25p80_erase(struct mtd_info 
 	addr = instr->addr;
 	len = instr->len;
 
-  	down(&flash->lock);
+	mutex_lock(&flash->lock);
 
 	/* now erase those sectors */
 	while (len) {
 		if (erase_sector(flash, addr)) {
 			instr->state = MTD_ERASE_FAILED;
-			up(&flash->lock);
+			mutex_unlock(&flash->lock);
 			return -EIO;
 		}
 
@@ -215,7 +216,7 @@ static int m25p80_erase(struct mtd_info 
 		len -= mtd->erasesize;
 	}
 
-  	up(&flash->lock);
+	mutex_unlock(&flash->lock);
 
 	instr->state = MTD_ERASE_DONE;
 	mtd_erase_callback(instr);
@@ -260,12 +261,12 @@ static int m25p80_read(struct mtd_info *
 	if (retlen)
 		*retlen = 0;
 
-	down(&flash->lock);
+	mutex_lock(&flash->lock);
 
 	/* Wait till previous write/erase is done. */
 	if (wait_till_ready(flash)) {
 		/* REVISIT status return?? */
-		up(&flash->lock);
+		mutex_unlock(&flash->lock);
 		return 1;
 	}
 
@@ -281,7 +282,7 @@ static int m25p80_read(struct mtd_info *
 
 	*retlen = m.actual_length - sizeof(flash->command);
 
-  	up(&flash->lock);
+	mutex_unlock(&flash->lock);
 
 	return 0;
 }
@@ -323,7 +324,7 @@ static int m25p80_write(struct mtd_info 
 	t[1].tx_buf = buf;
 	spi_message_add_tail(&t[1], &m);
 
-  	down(&flash->lock);
+	mutex_lock(&flash->lock);
 
 	/* Wait until finished previous write command. */
 	if (wait_till_ready(flash))
@@ -381,10 +382,10 @@ static int m25p80_write(struct mtd_info 
 			if (retlen)
 				*retlen += m.actual_length
 					- sizeof(flash->command);
-	        }
- 	}
+		}
+	}
 
-	up(&flash->lock);
+	mutex_unlock(&flash->lock);
 
 	return 0;
 }
@@ -405,7 +406,7 @@ struct flash_info {
 };
 
 static struct flash_info __devinitdata m25p_data [] = {
-	/* REVISIT: fill in JEDEC ids, for parts that have them */
+	/* JEDEC id zero means "has no ID" */
 	{ "m25p05", 0x05, 0x2010, 32 * 1024, 2 },
 	{ "m25p10", 0x10, 0x2011, 32 * 1024, 4 },
 	{ "m25p20", 0x11, 0x2012, 64 * 1024, 4 },
@@ -456,7 +457,7 @@ static int __devinit m25p_probe(struct s
 		return -ENOMEM;
 
 	flash->spi = spi;
-	init_MUTEX(&flash->lock);
+	mutex_init(&flash->lock);
 	dev_set_drvdata(&spi->dev, flash);
 
 	if (data->name)

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [patch 2.6.22-rc3] MTD: m25p80 converted to mutex
  2007-06-24 22:09 David Brownell
@ 2007-06-28 19:11 ` David Woodhouse
  2007-06-28 20:08   ` David Brownell
  0 siblings, 1 reply; 8+ messages in thread
From: David Woodhouse @ 2007-06-28 19:11 UTC (permalink / raw)
  To: David Brownell; +Cc: linux-mtd

On Sun, 2007-06-24 at 15:09 -0700, David Brownell wrote:
> Convert semaphore usage in m25p80 driver to mutex; mention another kind of
> SPI flash chip that should be able to use this driver (given minor tweaks).
> 
> Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
> ---
> [RESEND -- original was on 25-May, was neither merged nor acked ]

Sorry, been very busy. Your patches both fail to apply though.

-- 
dwmw2

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [patch 2.6.22-rc3] MTD: m25p80 converted to mutex
  2007-06-28 19:11 ` David Woodhouse
@ 2007-06-28 20:08   ` David Brownell
  2007-06-28 21:39     ` David Woodhouse
  0 siblings, 1 reply; 8+ messages in thread
From: David Brownell @ 2007-06-28 20:08 UTC (permalink / raw)
  To: David Woodhouse; +Cc: linux-mtd

On Thursday 28 June 2007, David Woodhouse wrote:
> On Sun, 2007-06-24 at 15:09 -0700, David Brownell wrote:
> > Convert semaphore usage in m25p80 driver to mutex; mention another kind of
> > SPI flash chip that should be able to use this driver (given minor tweaks).
> > 
> > Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
> > ---
> > [RESEND -- original was on 25-May, was neither merged nor acked ]
> 
> Sorry, been very busy. Your patches both fail to apply though.

They applied just fine against 2.6.22-rc6 ... did you apply them
in the correct order?

- Dave

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [patch 2.6.22-rc3] MTD: m25p80 converted to mutex
  2007-06-28 20:08   ` David Brownell
@ 2007-06-28 21:39     ` David Woodhouse
  2007-06-28 22:45       ` David Brownell
  0 siblings, 1 reply; 8+ messages in thread
From: David Woodhouse @ 2007-06-28 21:39 UTC (permalink / raw)
  To: David Brownell; +Cc: linux-mtd

On Thu, 2007-06-28 at 13:08 -0700, David Brownell wrote:
> They applied just fine against 2.6.22-rc6 ... did you apply them
> in the correct order? 

No, sorry. I did now though, with a small cleanup patch to follow.

-- 
dwmw2

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [patch 2.6.22-rc3] MTD: m25p80 converted to mutex
  2007-06-28 21:39     ` David Woodhouse
@ 2007-06-28 22:45       ` David Brownell
  2007-07-17 18:47         ` David Brownell
  0 siblings, 1 reply; 8+ messages in thread
From: David Brownell @ 2007-06-28 22:45 UTC (permalink / raw)
  To: David Woodhouse; +Cc: linux-mtd

On Thursday 28 June 2007, David Woodhouse wrote:
> On Thu, 2007-06-28 at 13:08 -0700, David Brownell wrote:
> > They applied just fine against 2.6.22-rc6 ... did you apply them
> > in the correct order? 
> 
> No, sorry. I did now though, with a small cleanup patch to follow.

Whew!  Thanks for the update.  I was hoping there wasn't another
patchset around that I had somehow missed.  ;)

- Dave

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [patch 2.6.22-rc3] MTD: m25p80 converted to mutex
  2007-06-28 22:45       ` David Brownell
@ 2007-07-17 18:47         ` David Brownell
  2007-07-17 20:07           ` Hans-Jürgen Koch
  0 siblings, 1 reply; 8+ messages in thread
From: David Brownell @ 2007-07-17 18:47 UTC (permalink / raw)
  To: David Woodhouse; +Cc: hjk, linux-mtd

On Thursday 28 June 2007, David Brownell wrote:
> On Thursday 28 June 2007, David Woodhouse wrote:
> > On Thu, 2007-06-28 at 13:08 -0700, David Brownell wrote:
> > > They applied just fine against 2.6.22-rc6 ... did you apply them
> > > in the correct order? 
> > 
> > No, sorry. I did now though, with a small cleanup patch to follow.
> 
> Whew!  Thanks for the update.  I was hoping there wasn't another
> patchset around that I had somehow missed.  ;)

Oh, and by the way:  don't forget to revert

  340ea370c2ce89d1c15fbf785460f2f74314ce58

It's not needed given the other m25p80 patch (which now handles
at26 "dataflash" as well as most other standard SPI flash chips),
and requires a controller driver that won't be merged upstream
(supplanted by drivers/spi/atmel_spi.c) ... the submitter of
that at91_dataflash26.c driver concurred.

- Dave

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [patch 2.6.22-rc3] MTD: m25p80 converted to mutex
  2007-07-17 18:47         ` David Brownell
@ 2007-07-17 20:07           ` Hans-Jürgen Koch
  0 siblings, 0 replies; 8+ messages in thread
From: Hans-Jürgen Koch @ 2007-07-17 20:07 UTC (permalink / raw)
  To: David Brownell; +Cc: linux-mtd, David Woodhouse

Am Dienstag 17 Juli 2007 20:47 schrieb David Brownell:

> 
> Oh, and by the way:  don't forget to revert
> 
>   340ea370c2ce89d1c15fbf785460f2f74314ce58
> 
> It's not needed given the other m25p80 patch (which now handles
> at26 "dataflash" as well as most other standard SPI flash chips),
> and requires a controller driver that won't be merged upstream
> (supplanted by drivers/spi/atmel_spi.c) ... the submitter of
> that at91_dataflash26.c driver concurred.

That's right.

Thanks,
Hans

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2007-07-17 20:08 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-05-26  3:40 [patch 2.6.22-rc3] MTD: m25p80 converted to mutex David Brownell
  -- strict thread matches above, loose matches on Subject: below --
2007-06-24 22:09 David Brownell
2007-06-28 19:11 ` David Woodhouse
2007-06-28 20:08   ` David Brownell
2007-06-28 21:39     ` David Woodhouse
2007-06-28 22:45       ` David Brownell
2007-07-17 18:47         ` David Brownell
2007-07-17 20:07           ` Hans-Jürgen Koch

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).