[PATCH 1/9]HDQ driver: Remove global pointer

2008-09-24 Thread Madhusudhan Chikkature
From: Madhusudhan Chikkature[EMAIL PROTECTED]

This patch provides the necessary modifications to the driver to remove the
global ptr hdq_data.

Signed-off-by: Madhusudhan Chikkature[EMAIL PROTECTED]
---
 drivers/w1/masters/omap_hdq.c |  137 ++
 1 files changed, 72 insertions(+), 65 deletions(-)

Index: linux-omap-2.6/drivers/w1/masters/omap_hdq.c
===
--- linux-omap-2.6.orig/drivers/w1/masters/omap_hdq.c   2008-08-18
14:48:26.0 +0530
+++ linux-omap-2.6/drivers/w1/masters/omap_hdq.c2008-09-23 
12:39:19.0
+0530
@@ -62,11 +62,9 @@ struct hdq_data {
spinlock_t  hdq_spinlock;
 };

-static struct hdq_data *hdq_data;
-
-static int omap_hdq_get(void);
-static int omap_hdq_put(void);
-static int omap_hdq_break(void);
+static int omap_hdq_get(struct hdq_data *hdq_data);
+static int omap_hdq_put(struct hdq_data *hdq_data);
+static int omap_hdq_break(struct hdq_data *hdq_data);

 static int __init omap_hdq_probe(struct platform_device *pdev);
 static int omap_hdq_remove(struct platform_device *pdev);
@@ -81,12 +79,13 @@ static struct platform_driver omap_hdq_d
},
 };

-static u8 omap_w1_read_byte(void *data);
-static void omap_w1_write_byte(void *data, u8 byte);
-static u8 omap_w1_reset_bus(void *data);
-static void omap_w1_search_bus(void *data, u8 search_type,
+static u8 omap_w1_read_byte(void *_hdq);
+static void omap_w1_write_byte(void *_hdq, u8 byte);
+static u8 omap_w1_reset_bus(void *_hdq);
+static void omap_w1_search_bus(void *_hdq, u8 search_type,
w1_slave_found_callback slave_found);

+
 static struct w1_bus_master omap_w1_master = {
.read_byte  = omap_w1_read_byte,
.write_byte = omap_w1_write_byte,
@@ -97,25 +96,25 @@ static struct w1_bus_master omap_w1_mast
 /*
  * HDQ register I/O routines
  */
-static inline u8
-hdq_reg_in(u32 offset)
+static inline u8 hdq_reg_in(struct hdq_data *hdq_data, u32 offset)
 {
return omap_readb(hdq_data-hdq_base + offset);
 }

-static inline u8
-hdq_reg_out(u32 offset, u8 val)
+static inline u8 hdq_reg_out(struct hdq_data *hdq_data, u32 offset, u8 val)
 {
omap_writeb(val, hdq_data-hdq_base + offset);
+
return val;
 }

-static inline u8
-hdq_reg_merge(u32 offset, u8 val, u8 mask)
+static inline u8 hdq_reg_merge(struct hdq_data *hdq_data, u32 offset,
+   u8 val, u8 mask)
 {
u8 new_val = (omap_readb(hdq_data-hdq_base + offset)  ~mask)
| (val  mask);
omap_writeb(new_val, hdq_data-hdq_base + offset);
+
return new_val;
 }

@@ -125,15 +124,15 @@ hdq_reg_merge(u32 offset, u8 val, u8 mas
  * HDQ_FLAG_CLEAR: wait until all bits in the flag are cleared.
  * return 0 on success and -ETIMEDOUT in the case of timeout.
  */
-static int
-hdq_wait_for_flag(u32 offset, u8 flag, u8 flag_set, u8 *status)
+static int hdq_wait_for_flag(struct hdq_data *hdq_data, u32 offset,
+   u8 flag, u8 flag_set, u8 *status)
 {
int ret = 0;
unsigned long timeout = jiffies + OMAP_HDQ_TIMEOUT;

if (flag_set == OMAP_HDQ_FLAG_CLEAR) {
/* wait for the flag clear */
-   while (((*status = hdq_reg_in(offset))  flag)
+   while (((*status = hdq_reg_in(hdq_data, offset))  flag)
 time_before(jiffies, timeout)) {
set_current_state(TASK_UNINTERRUPTIBLE);
schedule_timeout(1);
@@ -142,7 +141,7 @@ hdq_wait_for_flag(u32 offset, u8 flag, u
ret = -ETIMEDOUT;
} else if (flag_set == OMAP_HDQ_FLAG_SET) {
/* wait for the flag set */
-   while (!((*status = hdq_reg_in(offset))  flag)
+   while (!((*status = hdq_reg_in(hdq_data, offset))  flag)
 time_before(jiffies, timeout)) {
set_current_state(TASK_UNINTERRUPTIBLE);
schedule_timeout(1);
@@ -159,7 +158,7 @@ hdq_wait_for_flag(u32 offset, u8 flag, u
  * write out a byte and fill *status with HDQ_INT_STATUS
  */
 static int
-hdq_write_byte(u8 val, u8 *status)
+hdq_write_byte(struct hdq_data *hdq_data, u8 val, u8 *status)
 {
int ret;
u8 tmp_status;
@@ -169,15 +168,15 @@ hdq_write_byte(u8 val, u8 *status)

spin_lock_irqsave(hdq_data-hdq_spinlock, irqflags);
/* clear interrupt flags via a dummy read */
-   hdq_reg_in(OMAP_HDQ_INT_STATUS);
+   hdq_reg_in(hdq_data, OMAP_HDQ_INT_STATUS);
/* ISR loads it with new INT_STATUS */
hdq_data-hdq_irqstatus = 0;
spin_unlock_irqrestore(hdq_data-hdq_spinlock, irqflags);

-   hdq_reg_out(OMAP_HDQ_TX_DATA, val);
+   hdq_reg_out(hdq_data, OMAP_HDQ_TX_DATA, val);

/* set the GO bit */
-   hdq_reg_merge(OMAP_HDQ_CTRL_STATUS, OMAP_HDQ_CTRL_STATUS_GO,
+   hdq_reg_merge(hdq_data, OMAP_HDQ_CTRL_STATUS, 

Re: [PATCH 1/9]HDQ driver: Remove global pointer

2008-09-24 Thread Felipe Balbi
On Wed, Sep 24, 2008 at 04:49:40PM +0530, ext Madhusudhan Chikkature wrote:
 From: Madhusudhan Chikkature[EMAIL PROTECTED]
 
 This patch provides the necessary modifications to the driver to remove the
 global ptr hdq_data.
 
 Signed-off-by: Madhusudhan Chikkature[EMAIL PROTECTED]
 ---
  drivers/w1/masters/omap_hdq.c |  137 
 ++
  1 files changed, 72 insertions(+), 65 deletions(-)
 
 Index: linux-omap-2.6/drivers/w1/masters/omap_hdq.c
 ===
 --- linux-omap-2.6.orig/drivers/w1/masters/omap_hdq.c 2008-08-18
 14:48:26.0 +0530
 +++ linux-omap-2.6/drivers/w1/masters/omap_hdq.c  2008-09-23 
 12:39:19.0
 +0530

Please, fix your mailer, it's wrapping the header lines preventing
git-am from working.

-- 
balbi
--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html