diff options
author | Ben Dooks <ben-linux@fluff.org> | 2010-01-20 23:31:38 -0500 |
---|---|---|
committer | Ben Dooks <ben-linux@fluff.org> | 2010-01-21 00:24:52 -0500 |
commit | 75497d96b2094d325594b46d5e5f12b2396c4d51 (patch) | |
tree | 37f8495872006edcb80dcd2b273c8e2c8cdb82e0 /arch/arm/plat-s3c64xx | |
parent | bd548e5ef21ac2ff18b262a905543d7a2340fb87 (diff) |
ARM: S3C64XX: Tidy up common code in s3c64xx_spi_set_info()
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>
Diffstat (limited to 'arch/arm/plat-s3c64xx')
-rw-r--r-- | 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 6b6d7af06624..ca10388d7ed1 100644 --- a/arch/arm/plat-s3c64xx/dev-spi.c +++ b/arch/arm/plat-s3c64xx/dev-spi.c | |||
@@ -18,6 +18,7 @@ | |||
18 | #include <mach/gpio.h> | 18 | #include <mach/gpio.h> |
19 | 19 | ||
20 | #include <plat/spi-clocks.h> | 20 | #include <plat/spi-clocks.h> |
21 | |||
21 | #include <plat/s3c64xx-spi.h> | 22 | #include <plat/s3c64xx-spi.h> |
22 | #include <plat/gpio-bank-c.h> | 23 | #include <plat/gpio-bank-c.h> |
23 | #include <plat/gpio-cfg.h> | 24 | #include <plat/gpio-cfg.h> |
@@ -154,6 +155,8 @@ EXPORT_SYMBOL(s3c64xx_device_spi1); | |||
154 | 155 | ||
155 | void __init s3c64xx_spi_set_info(int cntrlr, int src_clk_nr, int num_cs) | 156 | void __init s3c64xx_spi_set_info(int cntrlr, int src_clk_nr, int num_cs) |
156 | { | 157 | { |
158 | struct s3c64xx_spi_info *pd; | ||
159 | |||
157 | /* Reject invalid configuration */ | 160 | /* Reject invalid configuration */ |
158 | if (!num_cs || src_clk_nr < 0 | 161 | if (!num_cs || src_clk_nr < 0 |
159 | || src_clk_nr > S3C64XX_SPI_SRCCLK_48M) { | 162 | || 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) | |||
163 | 166 | ||
164 | switch (cntrlr) { | 167 | switch (cntrlr) { |
165 | case 0: | 168 | case 0: |
166 | s3c64xx_spi0_pdata.num_cs = num_cs; | 169 | pd = &s3c64xx_spi0_pdata; |
167 | s3c64xx_spi0_pdata.src_clk_nr = src_clk_nr; | ||
168 | s3c64xx_spi0_pdata.src_clk_name = spi_src_clks[src_clk_nr]; | ||
169 | break; | 170 | break; |
170 | case 1: | 171 | case 1: |
171 | s3c64xx_spi1_pdata.num_cs = num_cs; | 172 | pd = &s3c64xx_spi1_pdata; |
172 | s3c64xx_spi1_pdata.src_clk_nr = src_clk_nr; | ||
173 | s3c64xx_spi1_pdata.src_clk_name = spi_src_clks[src_clk_nr]; | ||
174 | break; | 173 | break; |
175 | default: | 174 | default: |
176 | printk(KERN_ERR "%s: Invalid SPI controller(%d)\n", | 175 | printk(KERN_ERR "%s: Invalid SPI controller(%d)\n", |
177 | __func__, cntrlr); | 176 | __func__, cntrlr); |
178 | return; | 177 | return; |
179 | } | 178 | } |
179 | |||
180 | pd->num_cs = num_cs; | ||
181 | pd->src_clk_nr = src_clk_nr; | ||
182 | pd->src_clk_name = spi_src_clks[src_clk_nr]; | ||
180 | } | 183 | } |