linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* Tidy for S3C64XX SPI device code
@ 2010-01-21  5:21 Ben Dooks
  2010-01-21  5:21 ` [PATCH] ARM: S3C64XX: Tidy up common code in s3c64xx_spi_set_info() Ben Dooks
  0 siblings, 1 reply; 3+ messages in thread
From: Ben Dooks @ 2010-01-21  5:21 UTC (permalink / raw)
  To: linux-arm-kernel

small tidyup for s3c64xx spi device code

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

* [PATCH] ARM: S3C64XX: Tidy up common code in s3c64xx_spi_set_info()
  2010-01-21  5:21 Tidy for S3C64XX SPI device code Ben Dooks
@ 2010-01-21  5:21 ` Ben Dooks
  2010-01-21  6:11   ` jassi brar
  0 siblings, 1 reply; 3+ messages in thread
From: Ben Dooks @ 2010-01-21  5:21 UTC (permalink / raw)
  To: linux-arm-kernel

The s3c64xx_spi_set_info() sets one of two platform data structures depending
on which controller is being specified. Change to taking a pointer to the
relevant platform data structure and then having one set of code to place
the data into the area being pointed to.

Cc: Jassi Brar <jassi.brar@samsung.com>
Signed-off-by: Ben Dooks <ben-linux@fluff.org>
---
 arch/arm/plat-s3c64xx/dev-spi.c |   15 +++++++++------
 1 files changed, 9 insertions(+), 6 deletions(-)

diff --git a/arch/arm/plat-s3c64xx/dev-spi.c b/arch/arm/plat-s3c64xx/dev-spi.c
index 6b6d7af..ca10388 100644
--- a/arch/arm/plat-s3c64xx/dev-spi.c
+++ b/arch/arm/plat-s3c64xx/dev-spi.c
@@ -18,6 +18,7 @@
 #include <mach/gpio.h>
 
 #include <plat/spi-clocks.h>
+
 #include <plat/s3c64xx-spi.h>
 #include <plat/gpio-bank-c.h>
 #include <plat/gpio-cfg.h>
@@ -154,6 +155,8 @@ EXPORT_SYMBOL(s3c64xx_device_spi1);
 
 void __init s3c64xx_spi_set_info(int cntrlr, int src_clk_nr, int num_cs)
 {
+	struct s3c64xx_spi_info *pd;
+
 	/* Reject invalid configuration */
 	if (!num_cs || src_clk_nr < 0
 			|| src_clk_nr > S3C64XX_SPI_SRCCLK_48M) {
@@ -163,18 +166,18 @@ void __init s3c64xx_spi_set_info(int cntrlr, int src_clk_nr, int num_cs)
 
 	switch (cntrlr) {
 	case 0:
-		s3c64xx_spi0_pdata.num_cs = num_cs;
-		s3c64xx_spi0_pdata.src_clk_nr = src_clk_nr;
-		s3c64xx_spi0_pdata.src_clk_name = spi_src_clks[src_clk_nr];
+		pd = &s3c64xx_spi0_pdata;
 		break;
 	case 1:
-		s3c64xx_spi1_pdata.num_cs = num_cs;
-		s3c64xx_spi1_pdata.src_clk_nr = src_clk_nr;
-		s3c64xx_spi1_pdata.src_clk_name = spi_src_clks[src_clk_nr];
+		pd = &s3c64xx_spi1_pdata;
 		break;
 	default:
 		printk(KERN_ERR "%s: Invalid SPI controller(%d)\n",
 							__func__, cntrlr);
 		return;
 	}
+
+	pd->num_cs = num_cs;
+	pd->src_clk_nr = src_clk_nr;
+	pd->src_clk_name = spi_src_clks[src_clk_nr];
 }
-- 
1.6.0.4

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

* [PATCH] ARM: S3C64XX: Tidy up common code in s3c64xx_spi_set_info()
  2010-01-21  5:21 ` [PATCH] ARM: S3C64XX: Tidy up common code in s3c64xx_spi_set_info() Ben Dooks
@ 2010-01-21  6:11   ` jassi brar
  0 siblings, 0 replies; 3+ messages in thread
From: jassi brar @ 2010-01-21  6:11 UTC (permalink / raw)
  To: linux-arm-kernel

On Thu, Jan 21, 2010 at 2:21 PM, Ben Dooks <ben-linux@fluff.org> wrote:
> The s3c64xx_spi_set_info() sets one of two platform data structures depending
> on which controller is being specified. Change to taking a pointer to the
> relevant platform data structure and then having one set of code to place
> the data into the area being pointed to.
>
> Cc: Jassi Brar <jassi.brar@samsung.com>
> Signed-off-by: Ben Dooks <ben-linux@fluff.org>
> ---
> ?arch/arm/plat-s3c64xx/dev-spi.c | ? 15 +++++++++------
> ?1 files changed, 9 insertions(+), 6 deletions(-)
>
> diff --git a/arch/arm/plat-s3c64xx/dev-spi.c b/arch/arm/plat-s3c64xx/dev-spi.c
> index 6b6d7af..ca10388 100644
> --- a/arch/arm/plat-s3c64xx/dev-spi.c
> +++ b/arch/arm/plat-s3c64xx/dev-spi.c
> @@ -18,6 +18,7 @@
> ?#include <mach/gpio.h>
>
> ?#include <plat/spi-clocks.h>
> +
> ?#include <plat/s3c64xx-spi.h>
> ?#include <plat/gpio-bank-c.h>
> ?#include <plat/gpio-cfg.h>
> @@ -154,6 +155,8 @@ EXPORT_SYMBOL(s3c64xx_device_spi1);
>
> ?void __init s3c64xx_spi_set_info(int cntrlr, int src_clk_nr, int num_cs)
> ?{
> + ? ? ? struct s3c64xx_spi_info *pd;
> +
> ? ? ? ?/* Reject invalid configuration */
> ? ? ? ?if (!num_cs || src_clk_nr < 0
> ? ? ? ? ? ? ? ? ? ? ? ?|| src_clk_nr > S3C64XX_SPI_SRCCLK_48M) {
> @@ -163,18 +166,18 @@ void __init s3c64xx_spi_set_info(int cntrlr, int src_clk_nr, int num_cs)
>
> ? ? ? ?switch (cntrlr) {
> ? ? ? ?case 0:
> - ? ? ? ? ? ? ? s3c64xx_spi0_pdata.num_cs = num_cs;
> - ? ? ? ? ? ? ? s3c64xx_spi0_pdata.src_clk_nr = src_clk_nr;
> - ? ? ? ? ? ? ? s3c64xx_spi0_pdata.src_clk_name = spi_src_clks[src_clk_nr];
> + ? ? ? ? ? ? ? pd = &s3c64xx_spi0_pdata;
> ? ? ? ? ? ? ? ?break;
> ? ? ? ?case 1:
> - ? ? ? ? ? ? ? s3c64xx_spi1_pdata.num_cs = num_cs;
> - ? ? ? ? ? ? ? s3c64xx_spi1_pdata.src_clk_nr = src_clk_nr;
> - ? ? ? ? ? ? ? s3c64xx_spi1_pdata.src_clk_name = spi_src_clks[src_clk_nr];
> + ? ? ? ? ? ? ? pd = &s3c64xx_spi1_pdata;
> ? ? ? ? ? ? ? ?break;
> ? ? ? ?default:
> ? ? ? ? ? ? ? ?printk(KERN_ERR "%s: Invalid SPI controller(%d)\n",
> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?__func__, cntrlr);
> ? ? ? ? ? ? ? ?return;
> ? ? ? ?}
> +
> + ? ? ? pd->num_cs = num_cs;
> + ? ? ? pd->src_clk_nr = src_clk_nr;
> + ? ? ? pd->src_clk_name = spi_src_clks[src_clk_nr];
> ?}
acked-by: Jassi Brar <jassi.brar@samsung.com>

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

end of thread, other threads:[~2010-01-21  6:11 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-01-21  5:21 Tidy for S3C64XX SPI device code Ben Dooks
2010-01-21  5:21 ` [PATCH] ARM: S3C64XX: Tidy up common code in s3c64xx_spi_set_info() Ben Dooks
2010-01-21  6:11   ` jassi brar

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).