All of lore.kernel.org
 help / color / mirror / Atom feed
* [rft/rfc/patch-2.6.32-omap1+ 0/6] more cbus fixes
@ 2009-12-15 23:44 Felipe Balbi
  2009-12-15 23:44 ` [rft/rfc/patch-2.6.32-omap1+ 1/6] cbus: convert u32 base to void __iomem *base Felipe Balbi
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: Felipe Balbi @ 2009-12-15 23:44 UTC (permalink / raw)
  To: Linux OMAP Mailing List; +Cc: Tony Lindgren, Felipe Balbi

Hi all,

We really need someoe with n770 and n8x0 available to test these
patches.

I'm dropping the cbus-specific gpio handling functions over
gpiolib, this has to be tested on n770 which is the only
affected board with this patch.

Also the cbus_host global variable isn't exported anymore,
we keep it global but static on cbus.c, the callers
of cbus_transfer() won't have to care about passing a pointer
to cbus_host and we refer to it directly.

Please comment, there's still a lot of work needed on cbus,
in order to get it in shape for mainline.

Both tahvo and retu need to support genirq. That'll take
some time for me to fix, if there's someone out there
with more experience on genirq who wants to help, patches
are very much welcome.

cbus is currently the missing link for getting linux-omap-2.6.git
in sync with mainline, below is the diffstat showing that:

 drivers/Makefile                     |    2 +-
 drivers/cbus/Kconfig                 |   89 ----
 drivers/cbus/Makefile                |   14 -
 drivers/cbus/cbus.c                  |  308 --------------
 drivers/cbus/cbus.h                  |   36 --
 drivers/cbus/retu-headset.c          |  355 ----------------
 drivers/cbus/retu-pwrbutton.c        |  118 -----
 drivers/cbus/retu-rtc.c              |  477 ---------------------
 drivers/cbus/retu-user.c             |  424 ------------------
 drivers/cbus/retu-wdt.c              |  387 -----------------
 drivers/cbus/retu.c                  |  468 --------------------
 drivers/cbus/retu.h                  |   77 ----
 drivers/cbus/tahvo-usb.c             |  777 ----------------------------------
 drivers/cbus/tahvo-user.c            |  406 ------------------
 drivers/cbus/tahvo.c                 |  443 -------------------
 drivers/cbus/tahvo.h                 |   61 ---
 drivers/cbus/user_retu_tahvo.h       |   75 ----
 drivers/usb/host/ehci-omap.c         |    2 +-
 drivers/usb/otg/isp1301_omap.c       |    4 +-
 drivers/video/omap/lcd_ldp.c         |    4 +-
 drivers/video/omap/lcd_omap2evm.c    |   10 +-
 drivers/video/omap/lcd_omap3beagle.c |    2 +-
 drivers/video/omap/lcd_omap3evm.c    |   10 +-
 drivers/video/omap/lcd_overo.c       |    2 +-
 24 files changed, 18 insertions(+), 4533 deletions(-)

again, if you have an n770 and/or n8x0 dusting around, give
these patches a spin and help cleaning up cbus for us to send
it to mainline.

Felipe Balbi (6):
  cbus: convert u32 base to void __iomem *base
  cbus: NULL global variable on exit
  cbus: checkpatch.pl fix on cbus.c
  cbus: don't export the global cbus_host variable
  cbus: rely on gpiolib
  cbus: no ternary on return

 drivers/cbus/cbus.c  |  133 +++++++++++---------------------------------------
 drivers/cbus/cbus.h  |   14 +++--
 drivers/cbus/retu.c  |    4 +-
 drivers/cbus/tahvo.c |    4 +-
 4 files changed, 40 insertions(+), 115 deletions(-)


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

* [rft/rfc/patch-2.6.32-omap1+ 1/6] cbus: convert u32 base to void __iomem *base
  2009-12-15 23:44 [rft/rfc/patch-2.6.32-omap1+ 0/6] more cbus fixes Felipe Balbi
@ 2009-12-15 23:44 ` Felipe Balbi
  2009-12-15 23:44 ` [rft/rfc/patch-2.6.32-omap1+ 2/6] cbus: NULL global variable on exit Felipe Balbi
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: Felipe Balbi @ 2009-12-15 23:44 UTC (permalink / raw)
  To: Linux OMAP Mailing List; +Cc: Tony Lindgren, Felipe Balbi

to avoid casting later, pass the parameter of the
correct type already.

Signed-off-by: Felipe Balbi <felipe.balbi@nokia.com>
---
 drivers/cbus/cbus.c |   16 +++++++++-------
 drivers/cbus/cbus.h |   10 ++++++++--
 2 files changed, 17 insertions(+), 9 deletions(-)

diff --git a/drivers/cbus/cbus.c b/drivers/cbus/cbus.c
index 00c3c32..c0b4248 100644
--- a/drivers/cbus/cbus.c
+++ b/drivers/cbus/cbus.c
@@ -45,7 +45,8 @@ EXPORT_SYMBOL(cbus_host);
 #ifdef CONFIG_ARCH_OMAP1
 /* We use our own MPUIO functions to get closer to 1MHz bus speed */
 
-static inline void cbus_set_gpio_direction(u32 base, int mpuio, int is_input)
+static inline void cbus_set_gpio_direction(void __iomem *base,
+		int mpuio, int is_input)
 {
 	u16 w;
 
@@ -59,7 +60,8 @@ static inline void cbus_set_gpio_direction(u32 base, int mpuio, int is_input)
 
 }
 
-static inline void cbus_set_gpio_dataout(u32 base, int mpuio, int enable)
+static inline void cbus_set_gpio_dataout(void __iomem *base,
+		int mpuio, int enable)
 {
 	u16 w;
 
@@ -72,14 +74,14 @@ static inline void cbus_set_gpio_dataout(u32 base, int mpuio, int enable)
 	__raw_writew(w, base + OMAP_MPUIO_OUTPUT);
 }
 
-static inline int cbus_get_gpio_datain(u32 base, int mpuio)
+static inline int cbus_get_gpio_datain(void __iomem *base, int mpuio)
 {
 	mpuio &= 0x0f;
 
 	return (__raw_readw(base + OMAP_MPUIO_INPUT_LATCH) & (1 << mpuio)) != 0;
 }
 
-static void cbus_send_bit(struct cbus_host *host, u32 base, int bit,
+static void cbus_send_bit(struct cbus_host *host, void __iomem *base, int bit,
 			  int set_to_input)
 {
 	cbus_set_gpio_dataout(base, host->dat_gpio, bit ? 1 : 0);
@@ -92,7 +94,7 @@ static void cbus_send_bit(struct cbus_host *host, u32 base, int bit,
 	cbus_set_gpio_dataout(base, host->clk_gpio, 0);
 }
 
-static u8 cbus_receive_bit(struct cbus_host *host, u32 base)
+static u8 cbus_receive_bit(struct cbus_host *host, void __iomem *base)
 {
 	u8 ret;
 
@@ -144,12 +146,12 @@ static int cbus_transfer(struct cbus_host *host, int dev, int reg, int data)
 	int i;
 	int is_read = 0;
 	unsigned long flags;
-	u32 base;
+	void __iomem *base;
 
 #ifdef CONFIG_ARCH_OMAP1
 	base = OMAP1_IO_ADDRESS(OMAP1_MPUIO_BASE);
 #else
-	base = 0;
+	base = NULL;
 #endif
 
 	if (data < 0)
diff --git a/drivers/cbus/cbus.h b/drivers/cbus/cbus.h
index 957224c..90c7617 100644
--- a/drivers/cbus/cbus.h
+++ b/drivers/cbus/cbus.h
@@ -24,8 +24,14 @@
 #define __DRIVERS_CBUS_CBUS_H
 
 struct cbus_host {
-	int clk_gpio, dat_gpio, sel_gpio;
-        spinlock_t lock;
+	/* host lock */
+	spinlock_t lock;
+
+	void __iomem *base;
+
+	int	clk_gpio;
+	int	dat_gpio;
+	int	sel_gpio;
 };
 
 extern struct cbus_host *cbus_host;
-- 
1.6.6.rc0


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

* [rft/rfc/patch-2.6.32-omap1+ 2/6] cbus: NULL global variable on exit
  2009-12-15 23:44 [rft/rfc/patch-2.6.32-omap1+ 0/6] more cbus fixes Felipe Balbi
  2009-12-15 23:44 ` [rft/rfc/patch-2.6.32-omap1+ 1/6] cbus: convert u32 base to void __iomem *base Felipe Balbi
@ 2009-12-15 23:44 ` Felipe Balbi
  2009-12-15 23:44 ` [rft/rfc/patch-2.6.32-omap1+ 3/6] cbus: checkpatch.pl fix on cbus.c Felipe Balbi
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: Felipe Balbi @ 2009-12-15 23:44 UTC (permalink / raw)
  To: Linux OMAP Mailing List; +Cc: Tony Lindgren, Felipe Balbi

just to be sure, let's set it to NULL.

Signed-off-by: Felipe Balbi <felipe.balbi@nokia.com>
---
 drivers/cbus/cbus.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/drivers/cbus/cbus.c b/drivers/cbus/cbus.c
index c0b4248..f454e77 100644
--- a/drivers/cbus/cbus.c
+++ b/drivers/cbus/cbus.c
@@ -279,7 +279,9 @@ static void __exit cbus_bus_remove(struct platform_device *pdev)
 
 	gpio_free(chost->dat_gpio);
 	gpio_free(chost->clk_gpio);
+
 	kfree(chost);
+	cbus_host = NULL;
 }
 
 static struct platform_driver cbus_driver = {
-- 
1.6.6.rc0


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

* [rft/rfc/patch-2.6.32-omap1+ 3/6] cbus: checkpatch.pl fix on cbus.c
  2009-12-15 23:44 [rft/rfc/patch-2.6.32-omap1+ 0/6] more cbus fixes Felipe Balbi
  2009-12-15 23:44 ` [rft/rfc/patch-2.6.32-omap1+ 1/6] cbus: convert u32 base to void __iomem *base Felipe Balbi
  2009-12-15 23:44 ` [rft/rfc/patch-2.6.32-omap1+ 2/6] cbus: NULL global variable on exit Felipe Balbi
@ 2009-12-15 23:44 ` Felipe Balbi
  2009-12-15 23:44 ` [rft/rfc/patch-2.6.32-omap1+ 4/6] cbus: don't export the global cbus_host variable Felipe Balbi
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: Felipe Balbi @ 2009-12-15 23:44 UTC (permalink / raw)
  To: Linux OMAP Mailing List; +Cc: Tony Lindgren, Felipe Balbi

make checkpatch.pl (almost) happy.

Signed-off-by: Felipe Balbi <felipe.balbi@nokia.com>
---
 drivers/cbus/cbus.c |   13 ++++++++-----
 1 files changed, 8 insertions(+), 5 deletions(-)

diff --git a/drivers/cbus/cbus.c b/drivers/cbus/cbus.c
index f454e77..e1be8c7 100644
--- a/drivers/cbus/cbus.c
+++ b/drivers/cbus/cbus.c
@@ -136,7 +136,7 @@ static u8 _cbus_receive_bit(struct cbus_host *host)
 	return ret;
 }
 
-#define cbus_send_bit(host, base, bit, set_to_input) _cbus_send_bit(host, bit, set_to_input)
+#define cbus_send_bit(h, b, bit, i) _cbus_send_bit(h, bit, i)
 #define cbus_receive_bit(host, base) _cbus_receive_bit(host)
 
 #endif
@@ -232,7 +232,7 @@ static int __init cbus_bus_probe(struct platform_device *pdev)
 	struct cbus_host_platform_data *pdata = pdev->dev.platform_data;
 	int ret;
 
-	chost = kzalloc(sizeof (*chost), GFP_KERNEL);
+	chost = kzalloc(sizeof(*chost), GFP_KERNEL);
 	if (chost == NULL)
 		return -ENOMEM;
 
@@ -242,13 +242,16 @@ static int __init cbus_bus_probe(struct platform_device *pdev)
 	chost->dat_gpio = pdata->dat_gpio;
 	chost->sel_gpio = pdata->sel_gpio;
 
-	if ((ret = gpio_request(chost->clk_gpio, "CBUS clk")) < 0)
+	ret = gpio_request(chost->clk_gpio, "CBUS clk");
+	if (ret < 0)
 		goto exit1;
 
-	if ((ret = gpio_request(chost->dat_gpio, "CBUS data")) < 0)
+	ret = gpio_request(chost->dat_gpio, "CBUS data");
+	if (ret < 0)
 		goto exit2;
 
-	if ((ret = gpio_request(chost->sel_gpio, "CBUS sel")) < 0)
+	ret = gpio_request(chost->sel_gpio, "CBUS sel");
+	if (ret < 0)
 		goto exit3;
 
 	gpio_direction_output(chost->clk_gpio, 0);
-- 
1.6.6.rc0


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

* [rft/rfc/patch-2.6.32-omap1+ 4/6] cbus: don't export the global cbus_host variable
  2009-12-15 23:44 [rft/rfc/patch-2.6.32-omap1+ 0/6] more cbus fixes Felipe Balbi
                   ` (2 preceding siblings ...)
  2009-12-15 23:44 ` [rft/rfc/patch-2.6.32-omap1+ 3/6] cbus: checkpatch.pl fix on cbus.c Felipe Balbi
@ 2009-12-15 23:44 ` Felipe Balbi
  2009-12-15 23:44 ` [rft/rfc/patch-2.6.32-omap1+ 5/6] cbus: rely on gpiolib Felipe Balbi
  2009-12-15 23:44 ` [rft/rfc/patch-2.6.32-omap1+ 6/6] cbus: no ternary on return Felipe Balbi
  5 siblings, 0 replies; 7+ messages in thread
From: Felipe Balbi @ 2009-12-15 23:44 UTC (permalink / raw)
  To: Linux OMAP Mailing List; +Cc: Tony Lindgren, Felipe Balbi

we can keep it static to cbus.c and refer to it when
calling cbus_transfer().

Signed-off-by: Felipe Balbi <felipe.balbi@nokia.com>
---
 drivers/cbus/cbus.c  |   11 +++++------
 drivers/cbus/cbus.h  |    6 ++----
 drivers/cbus/retu.c  |    4 ++--
 drivers/cbus/tahvo.c |    4 ++--
 4 files changed, 11 insertions(+), 14 deletions(-)

diff --git a/drivers/cbus/cbus.c b/drivers/cbus/cbus.c
index e1be8c7..c976f49 100644
--- a/drivers/cbus/cbus.c
+++ b/drivers/cbus/cbus.c
@@ -39,8 +39,7 @@
 
 #include "cbus.h"
 
-struct cbus_host *cbus_host = NULL;
-EXPORT_SYMBOL(cbus_host);
+static struct cbus_host *cbus_host;
 
 #ifdef CONFIG_ARCH_OMAP1
 /* We use our own MPUIO functions to get closer to 1MHz bus speed */
@@ -211,18 +210,18 @@ static int cbus_transfer(struct cbus_host *host, int dev, int reg, int data)
 /*
  * Read a given register from the device
  */
-int cbus_read_reg(struct cbus_host *host, int dev, int reg)
+int cbus_read_reg(int dev, int reg)
 {
-	return cbus_host ? cbus_transfer(host, dev, reg, -1) : -ENODEV;
+	return cbus_transfer(cbus_host, dev, reg, -1);
 }
 EXPORT_SYMBOL(cbus_read_reg);
 
 /*
  * Write to a given register of the device
  */
-int cbus_write_reg(struct cbus_host *host, int dev, int reg, u16 val)
+int cbus_write_reg(int dev, int reg, int val)
 {
-	return cbus_host ? cbus_transfer(host, dev, reg, (int)val) : -ENODEV;
+	return cbus_transfer(cbus_host, dev, reg, val);
 }
 EXPORT_SYMBOL(cbus_write_reg);
 
diff --git a/drivers/cbus/cbus.h b/drivers/cbus/cbus.h
index 90c7617..4cd68fd 100644
--- a/drivers/cbus/cbus.h
+++ b/drivers/cbus/cbus.h
@@ -34,9 +34,7 @@ struct cbus_host {
 	int	sel_gpio;
 };
 
-extern struct cbus_host *cbus_host;
-
-extern int cbus_read_reg(struct cbus_host *host, int dev, int reg);
-extern int cbus_write_reg(struct cbus_host *host, int dev, int reg, u16 val);
+extern int cbus_read_reg(int dev, int reg);
+extern int cbus_write_reg(int dev, int reg, int val);
 
 #endif /* __DRIVERS_CBUS_CBUS_H */
diff --git a/drivers/cbus/retu.c b/drivers/cbus/retu.c
index 39493fb..e0c9715 100644
--- a/drivers/cbus/retu.c
+++ b/drivers/cbus/retu.c
@@ -75,7 +75,7 @@ static struct retu_irq_handler_desc retu_irq_handlers[MAX_RETU_IRQ_HANDLERS];
 int retu_read_reg(int reg)
 {
 	BUG_ON(!retu_initialized);
-	return cbus_read_reg(cbus_host, RETU_ID, reg);
+	return cbus_read_reg(RETU_ID, reg);
 }
 
 /**
@@ -88,7 +88,7 @@ int retu_read_reg(int reg)
 void retu_write_reg(int reg, u16 val)
 {
 	BUG_ON(!retu_initialized);
-	cbus_write_reg(cbus_host, RETU_ID, reg, val);
+	cbus_write_reg(RETU_ID, reg, val);
 }
 
 void retu_set_clear_reg_bits(int reg, u16 set, u16 clear)
diff --git a/drivers/cbus/tahvo.c b/drivers/cbus/tahvo.c
index 51d8128..2761843 100644
--- a/drivers/cbus/tahvo.c
+++ b/drivers/cbus/tahvo.c
@@ -75,7 +75,7 @@ static struct tahvo_irq_handler_desc tahvo_irq_handlers[MAX_TAHVO_IRQ_HANDLERS];
 int tahvo_read_reg(int reg)
 {
 	BUG_ON(!tahvo_initialized);
-	return cbus_read_reg(cbus_host, TAHVO_ID, reg);
+	return cbus_read_reg(TAHVO_ID, reg);
 }
 
 /**
@@ -88,7 +88,7 @@ int tahvo_read_reg(int reg)
 void tahvo_write_reg(int reg, u16 val)
 {
 	BUG_ON(!tahvo_initialized);
-	cbus_write_reg(cbus_host, TAHVO_ID, reg, val);
+	cbus_write_reg(TAHVO_ID, reg, val);
 }
 
 /**
-- 
1.6.6.rc0


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

* [rft/rfc/patch-2.6.32-omap1+ 5/6] cbus: rely on gpiolib
  2009-12-15 23:44 [rft/rfc/patch-2.6.32-omap1+ 0/6] more cbus fixes Felipe Balbi
                   ` (3 preceding siblings ...)
  2009-12-15 23:44 ` [rft/rfc/patch-2.6.32-omap1+ 4/6] cbus: don't export the global cbus_host variable Felipe Balbi
@ 2009-12-15 23:44 ` Felipe Balbi
  2009-12-15 23:44 ` [rft/rfc/patch-2.6.32-omap1+ 6/6] cbus: no ternary on return Felipe Balbi
  5 siblings, 0 replies; 7+ messages in thread
From: Felipe Balbi @ 2009-12-15 23:44 UTC (permalink / raw)
  To: Linux OMAP Mailing List; +Cc: Tony Lindgren, Felipe Balbi

don't define our own concurrent accesses to gpio banks
if we already have gpiolib to handle that.

Signed-off-by: Felipe Balbi <felipe.balbi@nokia.com>
---
 drivers/cbus/cbus.c |  109 ++++++--------------------------------------------
 drivers/cbus/cbus.h |    2 -
 2 files changed, 13 insertions(+), 98 deletions(-)

diff --git a/drivers/cbus/cbus.c b/drivers/cbus/cbus.c
index c976f49..615f447 100644
--- a/drivers/cbus/cbus.c
+++ b/drivers/cbus/cbus.c
@@ -41,78 +41,7 @@
 
 static struct cbus_host *cbus_host;
 
-#ifdef CONFIG_ARCH_OMAP1
-/* We use our own MPUIO functions to get closer to 1MHz bus speed */
-
-static inline void cbus_set_gpio_direction(void __iomem *base,
-		int mpuio, int is_input)
-{
-	u16 w;
-
-	mpuio &= 0x0f;
-	w = __raw_readw(base + OMAP_MPUIO_IO_CNTL);
-	if (is_input)
-		w |= 1 << mpuio;
-	else
-		w &= ~(1 << mpuio);
-	__raw_writew(w, base + OMAP_MPUIO_IO_CNTL);
-
-}
-
-static inline void cbus_set_gpio_dataout(void __iomem *base,
-		int mpuio, int enable)
-{
-	u16 w;
-
-	mpuio &= 0x0f;
-	w = __raw_readw(base + OMAP_MPUIO_OUTPUT);
-	if (enable)
-		w |= 1 << mpuio;
-	else
-		w &= ~(1 << mpuio);
-	__raw_writew(w, base + OMAP_MPUIO_OUTPUT);
-}
-
-static inline int cbus_get_gpio_datain(void __iomem *base, int mpuio)
-{
-	mpuio &= 0x0f;
-
-	return (__raw_readw(base + OMAP_MPUIO_INPUT_LATCH) & (1 << mpuio)) != 0;
-}
-
-static void cbus_send_bit(struct cbus_host *host, void __iomem *base, int bit,
-			  int set_to_input)
-{
-	cbus_set_gpio_dataout(base, host->dat_gpio, bit ? 1 : 0);
-	cbus_set_gpio_dataout(base, host->clk_gpio, 1);
-
-	/* The data bit is read on the rising edge of CLK */
-	if (set_to_input)
-		cbus_set_gpio_direction(base, host->dat_gpio, 1);
-
-	cbus_set_gpio_dataout(base, host->clk_gpio, 0);
-}
-
-static u8 cbus_receive_bit(struct cbus_host *host, void __iomem *base)
-{
-	u8 ret;
-
-	cbus_set_gpio_dataout(base, host->clk_gpio, 1);
-	ret = cbus_get_gpio_datain(base, host->dat_gpio);
-	cbus_set_gpio_dataout(base, host->clk_gpio, 0);
-
-	return ret;
-}
-
-#define cbus_output(base, gpio, val)	cbus_set_gpio_direction(base, gpio, 0)
-
-#else
-
-#define cbus_output(base, gpio, val)	gpio_direction_output(gpio, val)
-#define cbus_set_gpio_dataout(base, gpio, enable) gpio_set_value(gpio, enable)
-#define cbus_get_gpio_datain(base, int, gpio) gpio_get_value(gpio)
-
-static void _cbus_send_bit(struct cbus_host *host, int bit, int set_to_input)
+static void cbus_send_bit(struct cbus_host *host, int bit, int set_to_input)
 {
 	gpio_set_value(host->dat_gpio, bit ? 1 : 0);
 	gpio_set_value(host->clk_gpio, 1);
@@ -124,7 +53,7 @@ static void _cbus_send_bit(struct cbus_host *host, int bit, int set_to_input)
 	gpio_set_value(host->clk_gpio, 0);
 }
 
-static u8 _cbus_receive_bit(struct cbus_host *host)
+static u8 cbus_receive_bit(struct cbus_host *host)
 {
 	u8 ret;
 
@@ -135,23 +64,11 @@ static u8 _cbus_receive_bit(struct cbus_host *host)
 	return ret;
 }
 
-#define cbus_send_bit(h, b, bit, i) _cbus_send_bit(h, bit, i)
-#define cbus_receive_bit(host, base) _cbus_receive_bit(host)
-
-#endif
-
 static int cbus_transfer(struct cbus_host *host, int dev, int reg, int data)
 {
 	int i;
 	int is_read = 0;
 	unsigned long flags;
-	void __iomem *base;
-
-#ifdef CONFIG_ARCH_OMAP1
-	base = OMAP1_IO_ADDRESS(OMAP1_MPUIO_BASE);
-#else
-	base = NULL;
-#endif
 
 	if (data < 0)
 		is_read = 1;
@@ -160,17 +77,17 @@ static int cbus_transfer(struct cbus_host *host, int dev, int reg, int data)
 	spin_lock_irqsave(&host->lock, flags);
 
 	/* Reset state and start of transfer, SEL stays down during transfer */
-	cbus_set_gpio_dataout(base, host->sel_gpio, 0);
+	gpio_set_value(host->sel_gpio, 0);
 
 	/* Set the DAT pin to output */
-	cbus_output(base, host->dat_gpio, 1);
+	gpio_direction_output(host->dat_gpio, 1);
 
 	/* Send the device address */
 	for (i = 3; i > 0; i--)
-		cbus_send_bit(host, base, dev & (1 << (i - 1)), 0);
+		cbus_send_bit(host, dev & (1 << (i - 1)), 0);
 
 	/* Send the rw flag */
-	cbus_send_bit(host, base, is_read, 0);
+	cbus_send_bit(host, is_read, 0);
 
 	/* Send the register address */
 	for (i = 5; i > 0; i--) {
@@ -179,18 +96,18 @@ static int cbus_transfer(struct cbus_host *host, int dev, int reg, int data)
 		if (is_read && i == 1)
 			set_to_input = 1;
 
-		cbus_send_bit(host, base, reg & (1 << (i - 1)), set_to_input);
+		cbus_send_bit(host, reg & (1 << (i - 1)), set_to_input);
 	}
 
 	if (!is_read) {
 		for (i = 16; i > 0; i--)
-			cbus_send_bit(host, base, data & (1 << (i - 1)), 0);
+			cbus_send_bit(host, data & (1 << (i - 1)), 0);
 	} else {
-		cbus_set_gpio_dataout(base, host->clk_gpio, 1);
+		gpio_set_value(host->clk_gpio, 1);
 		data = 0;
 
 		for (i = 16; i > 0; i--) {
-			u8 bit = cbus_receive_bit(host, base);
+			u8 bit = cbus_receive_bit(host);
 
 			if (bit)
 				data |= 1 << (i - 1);
@@ -198,9 +115,9 @@ static int cbus_transfer(struct cbus_host *host, int dev, int reg, int data)
 	}
 
 	/* Indicate end of transfer, SEL goes up until next transfer */
-	cbus_set_gpio_dataout(base, host->sel_gpio, 1);
-	cbus_set_gpio_dataout(base, host->clk_gpio, 1);
-	cbus_set_gpio_dataout(base, host->clk_gpio, 0);
+	gpio_set_value(host->sel_gpio, 1);
+	gpio_set_value(host->clk_gpio, 1);
+	gpio_set_value(host->clk_gpio, 0);
 
 	spin_unlock_irqrestore(&host->lock, flags);
 
diff --git a/drivers/cbus/cbus.h b/drivers/cbus/cbus.h
index 4cd68fd..fbaca09 100644
--- a/drivers/cbus/cbus.h
+++ b/drivers/cbus/cbus.h
@@ -27,8 +27,6 @@ struct cbus_host {
 	/* host lock */
 	spinlock_t lock;
 
-	void __iomem *base;
-
 	int	clk_gpio;
 	int	dat_gpio;
 	int	sel_gpio;
-- 
1.6.6.rc0


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

* [rft/rfc/patch-2.6.32-omap1+ 6/6] cbus: no ternary on return
  2009-12-15 23:44 [rft/rfc/patch-2.6.32-omap1+ 0/6] more cbus fixes Felipe Balbi
                   ` (4 preceding siblings ...)
  2009-12-15 23:44 ` [rft/rfc/patch-2.6.32-omap1+ 5/6] cbus: rely on gpiolib Felipe Balbi
@ 2009-12-15 23:44 ` Felipe Balbi
  5 siblings, 0 replies; 7+ messages in thread
From: Felipe Balbi @ 2009-12-15 23:44 UTC (permalink / raw)
  To: Linux OMAP Mailing List; +Cc: Tony Lindgren, Felipe Balbi

data is reset to 0 if is_read is true. No need
to use ternary operator before returning.

Signed-off-by: Felipe Balbi <felipe.balbi@nokia.com>
---
 drivers/cbus/cbus.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/cbus/cbus.c b/drivers/cbus/cbus.c
index 615f447..35f7c71 100644
--- a/drivers/cbus/cbus.c
+++ b/drivers/cbus/cbus.c
@@ -121,7 +121,7 @@ static int cbus_transfer(struct cbus_host *host, int dev, int reg, int data)
 
 	spin_unlock_irqrestore(&host->lock, flags);
 
-	return is_read ? data : 0;
+	return data;
 }
 
 /*
-- 
1.6.6.rc0


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

end of thread, other threads:[~2009-12-15 23:46 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-12-15 23:44 [rft/rfc/patch-2.6.32-omap1+ 0/6] more cbus fixes Felipe Balbi
2009-12-15 23:44 ` [rft/rfc/patch-2.6.32-omap1+ 1/6] cbus: convert u32 base to void __iomem *base Felipe Balbi
2009-12-15 23:44 ` [rft/rfc/patch-2.6.32-omap1+ 2/6] cbus: NULL global variable on exit Felipe Balbi
2009-12-15 23:44 ` [rft/rfc/patch-2.6.32-omap1+ 3/6] cbus: checkpatch.pl fix on cbus.c Felipe Balbi
2009-12-15 23:44 ` [rft/rfc/patch-2.6.32-omap1+ 4/6] cbus: don't export the global cbus_host variable Felipe Balbi
2009-12-15 23:44 ` [rft/rfc/patch-2.6.32-omap1+ 5/6] cbus: rely on gpiolib Felipe Balbi
2009-12-15 23:44 ` [rft/rfc/patch-2.6.32-omap1+ 6/6] cbus: no ternary on return Felipe Balbi

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.