[PATCH] spi/s3c64xx: Convert to using core message queue

2012-02-15 Thread Mark Brown
Convert the s3c64xx driver to using the new message queue factored out of
the pl022 driver by Linus Walleij, saving us a nice block of code and
getting the benefits of improvements implemented in the core.

Signed-off-by: Mark Brown broo...@opensource.wolfsonmicro.com
---

Only lightly tested thus far.  Linus, it'd be really nice if you could
add this to your patch queue for this feature until it's merged by
Grant.

 drivers/spi/spi-s3c64xx.c |  125 -
 1 files changed, 22 insertions(+), 103 deletions(-)

diff --git a/drivers/spi/spi-s3c64xx.c b/drivers/spi/spi-s3c64xx.c
index b899af66..1174d80 100644
--- a/drivers/spi/spi-s3c64xx.c
+++ b/drivers/spi/spi-s3c64xx.c
@@ -128,8 +128,6 @@
 
 #define msecs_to_loops(t) (loops_per_jiffy / 1000 * HZ * t)
 
-#define SUSPND(10)
-#define SPIBUSY   (11)
 #define RXBUSY(12)
 #define TXBUSY(13)
 
@@ -144,10 +142,8 @@ struct s3c64xx_spi_dma_data {
  * @clk: Pointer to the spi clock.
  * @src_clk: Pointer to the clock used to generate SPI signals.
  * @master: Pointer to the SPI Protocol master.
- * @workqueue: Work queue for the SPI xfer requests.
  * @cntrlr_info: Platform specific data for the controller this driver manages.
  * @tgl_spi: Pointer to the last CS left untoggled by the cs_change hint.
- * @work: Work
  * @queue: To log SPI xfer requests.
  * @lock: Controller specific lock.
  * @state: Set of FLAGS to indicate status.
@@ -167,10 +163,8 @@ struct s3c64xx_spi_driver_data {
struct clk  *src_clk;
struct platform_device  *pdev;
struct spi_master   *master;
-   struct workqueue_struct *workqueue;
struct s3c64xx_spi_info  *cntrlr_info;
struct spi_device   *tgl_spi;
-   struct work_struct  work;
struct list_headqueue;
spinlock_t  lock;
unsigned long   sfr_start;
@@ -637,9 +631,10 @@ static void s3c64xx_spi_unmap_mssg(struct 
s3c64xx_spi_driver_data *sdd,
}
 }
 
-static void handle_msg(struct s3c64xx_spi_driver_data *sdd,
-   struct spi_message *msg)
+static int s3c64xx_spi_transfer_one_message(struct spi_master *master,
+   struct spi_message *msg)
 {
+   struct s3c64xx_spi_driver_data *sdd = spi_master_get_devdata(master);
struct s3c64xx_spi_info *sci = sdd-cntrlr_info;
struct spi_device *spi = msg-spi;
struct s3c64xx_spi_csinfo *cs = spi-controller_data;
@@ -771,13 +766,15 @@ out:
 
if (msg-complete)
msg-complete(msg-context);
+
+   spi_finalize_current_message(master);
+
+   return 0;
 }
 
-static void s3c64xx_spi_work(struct work_struct *work)
+static int s3c64xx_spi_prepare_transfer(struct spi_master *spi)
 {
-   struct s3c64xx_spi_driver_data *sdd = container_of(work,
-   struct s3c64xx_spi_driver_data, work);
-   unsigned long flags;
+   struct s3c64xx_spi_driver_data *sdd = spi_master_get_devdata(spi);
 
/* Acquire DMA channels */
while (!acquire_dma(sdd))
@@ -785,61 +782,18 @@ static void s3c64xx_spi_work(struct work_struct *work)
 
pm_runtime_get_sync(sdd-pdev-dev);
 
-   spin_lock_irqsave(sdd-lock, flags);
-
-   while (!list_empty(sdd-queue)
-!(sdd-state  SUSPND)) {
-
-   struct spi_message *msg;
-
-   msg = container_of(sdd-queue.next, struct spi_message, queue);
-
-   list_del_init(msg-queue);
-
-   /* Set Xfer busy flag */
-   sdd-state |= SPIBUSY;
-
-   spin_unlock_irqrestore(sdd-lock, flags);
-
-   handle_msg(sdd, msg);
-
-   spin_lock_irqsave(sdd-lock, flags);
-
-   sdd-state = ~SPIBUSY;
-   }
+   return 0;
+}
 
-   spin_unlock_irqrestore(sdd-lock, flags);
+static int s3c64xx_spi_unprepare_transfer(struct spi_master *spi)
+{
+   struct s3c64xx_spi_driver_data *sdd = spi_master_get_devdata(spi);
 
/* Free DMA channels */
sdd-ops-release(sdd-rx_dma.ch, s3c64xx_spi_dma_client);
sdd-ops-release(sdd-tx_dma.ch, s3c64xx_spi_dma_client);
 
pm_runtime_put(sdd-pdev-dev);
-}
-
-static int s3c64xx_spi_transfer(struct spi_device *spi,
-   struct spi_message *msg)
-{
-   struct s3c64xx_spi_driver_data *sdd;
-   unsigned long flags;
-
-   sdd = spi_master_get_devdata(spi-master);
-
-   spin_lock_irqsave(sdd-lock, flags);
-
-   if (sdd-state  SUSPND) {
-   spin_unlock_irqrestore(sdd-lock, flags);
-   return -ESHUTDOWN;
-   }
-
-   msg-status = -EINPROGRESS;
-   msg-actual_length = 0;
-
-   list_add_tail(msg-queue, sdd-queue);
-
-   queue_work(sdd-workqueue, sdd-work);
-
-   

Re: [PATCH] spi/s3c64xx: Convert to using core message queue

2012-02-15 Thread Linus Walleij
On Wed, Feb 15, 2012 at 11:48 PM, Mark Brown
broo...@opensource.wolfsonmicro.com wrote:

 Convert the s3c64xx driver to using the new message queue factored out of
 the pl022 driver by Linus Walleij, saving us a nice block of code and
 getting the benefits of improvements implemented in the core.

 Signed-off-by: Mark Brown broo...@opensource.wolfsonmicro.com

Acked-by: Linus Walleij linus.wall...@linaro.org

 Only lightly tested thus far.  Linus, it'd be really nice if you could
 add this to your patch queue for this feature until it's merged by
 Grant.

I just pinged Grant on the main (v2) patch, if there are issues to
be resolved I will carry this patch in the series, if Grant is happy
with v2 we can just push this on top I guess...

Thanks,
Linus Walleij

--
Virtualization  Cloud Management Using Capacity Planning
Cloud computing makes use of virtualization - but cloud computing 
also focuses on allowing computing to be delivered as a service.
http://www.accelacomm.com/jaw/sfnl/114/51521223/
___
spi-devel-general mailing list
spi-devel-general@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/spi-devel-general


Re: [PATCH v2] spi: create a message queueing infrastructure

2012-02-15 Thread Linus Walleij
On Fri, Feb 3, 2012 at 3:03 PM, Linus Walleij
linus.wall...@stericsson.com wrote:

 From: Linus Walleij linus.wall...@linaro.org

 This rips the message queue in the PL022 driver out and pushes
 it into (optional) common infrastructure. Drivers that want to
 use the message pumping thread will need to define the new
 per-messags transfer methods and leave the deprecated transfer()
 method as NULL.

Grant, are you happy with this patch?

Yours,
Linus Walleij

--
Virtualization  Cloud Management Using Capacity Planning
Cloud computing makes use of virtualization - but cloud computing 
also focuses on allowing computing to be delivered as a service.
http://www.accelacomm.com/jaw/sfnl/114/51521223/
___
spi-devel-general mailing list
spi-devel-general@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/spi-devel-general


Tous dehors pour les soldes

2012-02-15 Thread Be-Outdoor par Planduweb
Pour voir le message, veuillez utiliser un lecteur de mail compatible HTML

Lien miroir : 
http://m10-fr.com/mc10_m/YT0xMyZiPTYyNzImYz0xMDE5MjkzJmQ9MjAxMi0wMi0xNiAwMDozMDowMSZlPTEmaD02MjcxJmY9NjI3MiZnPTYyNzI=

Lien de désinscription : 
http://m10-fr.com/mc10_unsub/YT0xMyZiPTYyNzImYz0xMDE5MjkzJmQ9MjAxMi0wMi0xNiAwMDozMDowMSZlPTEmaD02MjcxJmY9NjI3MiZnPTYyNzI=


--
Virtualization  Cloud Management Using Capacity Planning
Cloud computing makes use of virtualization - but cloud computing 
also focuses on allowing computing to be delivered as a service.
http://www.accelacomm.com/jaw/sfnl/114/51521223/
___
spi-devel-general mailing list
spi-devel-general@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/spi-devel-general


Coffrets cadeaux parfum Disney à -30%

2012-02-15 Thread Corine de Farme par Duano
Pour voir le message, veuillez utiliser un lecteur de mail compatible HTML

Lien miroir : 
http://m10-fr.com/mc10_m/YT0xMyZiPTYzMDYmYz0xMDE5MjkzJmQ9MjAxMi0wMi0xNiAwNDo0MDowMSZlPTEmaD02MzA1JmY9NjMwNiZnPTYzMDY=

Lien de désinscription : 
http://m10-fr.com/mc10_unsub/YT0xMyZiPTYzMDYmYz0xMDE5MjkzJmQ9MjAxMi0wMi0xNiAwNDo0MDowMSZlPTEmaD02MzA1JmY9NjMwNiZnPTYzMDY=


--
Virtualization  Cloud Management Using Capacity Planning
Cloud computing makes use of virtualization - but cloud computing 
also focuses on allowing computing to be delivered as a service.
http://www.accelacomm.com/jaw/sfnl/114/51521223/
___
spi-devel-general mailing list
spi-devel-general@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/spi-devel-general


Conference

2012-02-15 Thread dan
Physicians, Therapists and Medical Professionals -

We invite you tojoin us in the International Conference on Integrative
Medicine.


The conference will take place in Jerusalem on May 13-15, 2012

And will focus on integrating conventional and alternative medicine in all
fields.


For further information enter the conference website at:

www.mediconvention.com

Pour des Informations en Français Cliquez Ici
Für Informationen in Deutscher Sprache Hier Klicken

 Unsubscribe me from this list
Click this link to unsubscribe:
http://brainconfernc.org/apps/unsubscribe.php?M=532120C=42be685b4eb4f862cb3ec7cf667eca7aL=35N=64
--
Virtualization  Cloud Management Using Capacity Planning
Cloud computing makes use of virtualization - but cloud computing 
also focuses on allowing computing to be delivered as a service.
http://www.accelacomm.com/jaw/sfnl/114/51521223/
___
spi-devel-general mailing list
spi-devel-general@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/spi-devel-general