RE: [PATCH] ARM: SAMSUNG: Consolidate common function to set SDHCI plat data

2011-08-18 Thread Kukjin Kim
Banajit Goswami wrote:
> 
> Moves similar functions to set SDHCI platform data for all Samsung
> boards to a common location, thereby saves a few lines.
> 
> Signed-off-by: Banajit Goswami 
> ---
>  arch/arm/plat-samsung/dev-hsmmc.c  |   19 +--
>  arch/arm/plat-samsung/dev-hsmmc1.c |   19 +--
>  arch/arm/plat-samsung/dev-hsmmc2.c |   19 +--
>  arch/arm/plat-samsung/dev-hsmmc3.c |   19 +--
>  arch/arm/plat-samsung/include/plat/sdhci.h |7 +++
>  arch/arm/plat-samsung/platformdata.c   |   22
> ++
>  6 files changed, 33 insertions(+), 72 deletions(-)
> 
> diff --git a/arch/arm/plat-samsung/dev-hsmmc.c
b/arch/arm/plat-samsung/dev-
> hsmmc.c
> index db7a65c..06825c4 100644
> --- a/arch/arm/plat-samsung/dev-hsmmc.c
> +++ b/arch/arm/plat-samsung/dev-hsmmc.c
> @@ -58,22 +58,5 @@ struct platform_device s3c_device_hsmmc0 = {
> 
>  void s3c_sdhci0_set_platdata(struct s3c_sdhci_platdata *pd)
>  {
> - struct s3c_sdhci_platdata *set = &s3c_hsmmc0_def_platdata;
> -
> - set->cd_type = pd->cd_type;
> - set->ext_cd_init = pd->ext_cd_init;
> - set->ext_cd_cleanup = pd->ext_cd_cleanup;
> - set->ext_cd_gpio = pd->ext_cd_gpio;
> - set->ext_cd_gpio_invert = pd->ext_cd_gpio_invert;
> -
> - if (pd->max_width)
> - set->max_width = pd->max_width;
> - if (pd->cfg_gpio)
> - set->cfg_gpio = pd->cfg_gpio;
> - if (pd->cfg_card)
> - set->cfg_card = pd->cfg_card;
> - if (pd->host_caps)
> - set->host_caps |= pd->host_caps;
> - if (pd->clk_type)
> - set->clk_type = pd->clk_type;
> + s3c_sdhci_set_platdata(pd, &s3c_hsmmc0_def_platdata);
>  }
> diff --git a/arch/arm/plat-samsung/dev-hsmmc1.c
b/arch/arm/plat-samsung/dev-
> hsmmc1.c
> index 2497321..4524ef4 100644
> --- a/arch/arm/plat-samsung/dev-hsmmc1.c
> +++ b/arch/arm/plat-samsung/dev-hsmmc1.c
> @@ -58,22 +58,5 @@ struct platform_device s3c_device_hsmmc1 = {
> 
>  void s3c_sdhci1_set_platdata(struct s3c_sdhci_platdata *pd)
>  {
> - struct s3c_sdhci_platdata *set = &s3c_hsmmc1_def_platdata;
> -
> - set->cd_type = pd->cd_type;
> - set->ext_cd_init = pd->ext_cd_init;
> - set->ext_cd_cleanup = pd->ext_cd_cleanup;
> - set->ext_cd_gpio = pd->ext_cd_gpio;
> - set->ext_cd_gpio_invert = pd->ext_cd_gpio_invert;
> -
> - if (pd->max_width)
> - set->max_width = pd->max_width;
> - if (pd->cfg_gpio)
> - set->cfg_gpio = pd->cfg_gpio;
> - if (pd->cfg_card)
> - set->cfg_card = pd->cfg_card;
> - if (pd->host_caps)
> - set->host_caps |= pd->host_caps;
> - if (pd->clk_type)
> - set->clk_type = pd->clk_type;
> + s3c_sdhci_set_platdata(pd, &s3c_hsmmc1_def_platdata);
>  }
> diff --git a/arch/arm/plat-samsung/dev-hsmmc2.c
b/arch/arm/plat-samsung/dev-
> hsmmc2.c
> index f60aedb..9cede96 100644
> --- a/arch/arm/plat-samsung/dev-hsmmc2.c
> +++ b/arch/arm/plat-samsung/dev-hsmmc2.c
> @@ -59,22 +59,5 @@ struct platform_device s3c_device_hsmmc2 = {
> 
>  void s3c_sdhci2_set_platdata(struct s3c_sdhci_platdata *pd)
>  {
> - struct s3c_sdhci_platdata *set = &s3c_hsmmc2_def_platdata;
> -
> - set->cd_type = pd->cd_type;
> - set->ext_cd_init = pd->ext_cd_init;
> - set->ext_cd_cleanup = pd->ext_cd_cleanup;
> - set->ext_cd_gpio = pd->ext_cd_gpio;
> - set->ext_cd_gpio_invert = pd->ext_cd_gpio_invert;
> -
> - if (pd->max_width)
> - set->max_width = pd->max_width;
> - if (pd->cfg_gpio)
> - set->cfg_gpio = pd->cfg_gpio;
> - if (pd->cfg_card)
> - set->cfg_card = pd->cfg_card;
> - if (pd->host_caps)
> - set->host_caps |= pd->host_caps;
> - if (pd->clk_type)
> - set->clk_type = pd->clk_type;
> + s3c_sdhci_set_platdata(pd, &s3c_hsmmc2_def_platdata);
>  }
> diff --git a/arch/arm/plat-samsung/dev-hsmmc3.c
b/arch/arm/plat-samsung/dev-
> hsmmc3.c
> index ede776f..0358ef4 100644
> --- a/arch/arm/plat-samsung/dev-hsmmc3.c
> +++ b/arch/arm/plat-samsung/dev-hsmmc3.c
> @@ -62,22 +62,5 @@ struct platform_device s3c_device_hsmmc3 = {
> 
>  void s3c_sdhci3_set_platdata(struct s3c_sdhci_platdata *pd)
>  {
> - struct s3c_sdhci_platdata *set = &s3c_hsmmc3_def_platdata;
> -
> - set->cd_type = pd->cd_type;
> - set->ext_cd_init = pd->ext_cd_init;
> - set->ext_cd_cleanup = pd->ext_cd_cleanup;
> - set->ext_cd_gpio = pd->ext_cd_gpio;
> - set->ext_cd_gpio_invert = pd->ext_cd_gpio_invert;
> -
> - if (pd->max_width)
> - set->max_width = pd->max_width;
> - if (pd->cfg_gpio)
> - set->cfg_gpio = pd->cfg_gpio;
> - if (pd->cfg_card)
> - set->cfg_card = pd->cfg_card;
> - if (pd->host_caps)
> - set->host_caps |= pd->host_caps;
> - if (pd->clk_type)
> - set->clk_type = pd->clk_type;
> + s3c_sdhci_set_platdata(pd, &s3c_hs

[PATCH] ARM: SAMSUNG: Consolidate common function to set SDHCI plat data

2011-08-11 Thread Banajit Goswami
Moves similar functions to set SDHCI platform data for all Samsung
boards to a common location, thereby saves a few lines.

Signed-off-by: Banajit Goswami 
---
 arch/arm/plat-samsung/dev-hsmmc.c  |   19 +--
 arch/arm/plat-samsung/dev-hsmmc1.c |   19 +--
 arch/arm/plat-samsung/dev-hsmmc2.c |   19 +--
 arch/arm/plat-samsung/dev-hsmmc3.c |   19 +--
 arch/arm/plat-samsung/include/plat/sdhci.h |7 +++
 arch/arm/plat-samsung/platformdata.c   |   22 ++
 6 files changed, 33 insertions(+), 72 deletions(-)

diff --git a/arch/arm/plat-samsung/dev-hsmmc.c 
b/arch/arm/plat-samsung/dev-hsmmc.c
index db7a65c..06825c4 100644
--- a/arch/arm/plat-samsung/dev-hsmmc.c
+++ b/arch/arm/plat-samsung/dev-hsmmc.c
@@ -58,22 +58,5 @@ struct platform_device s3c_device_hsmmc0 = {
 
 void s3c_sdhci0_set_platdata(struct s3c_sdhci_platdata *pd)
 {
-   struct s3c_sdhci_platdata *set = &s3c_hsmmc0_def_platdata;
-
-   set->cd_type = pd->cd_type;
-   set->ext_cd_init = pd->ext_cd_init;
-   set->ext_cd_cleanup = pd->ext_cd_cleanup;
-   set->ext_cd_gpio = pd->ext_cd_gpio;
-   set->ext_cd_gpio_invert = pd->ext_cd_gpio_invert;
-
-   if (pd->max_width)
-   set->max_width = pd->max_width;
-   if (pd->cfg_gpio)
-   set->cfg_gpio = pd->cfg_gpio;
-   if (pd->cfg_card)
-   set->cfg_card = pd->cfg_card;
-   if (pd->host_caps)
-   set->host_caps |= pd->host_caps;
-   if (pd->clk_type)
-   set->clk_type = pd->clk_type;
+   s3c_sdhci_set_platdata(pd, &s3c_hsmmc0_def_platdata);
 }
diff --git a/arch/arm/plat-samsung/dev-hsmmc1.c 
b/arch/arm/plat-samsung/dev-hsmmc1.c
index 2497321..4524ef4 100644
--- a/arch/arm/plat-samsung/dev-hsmmc1.c
+++ b/arch/arm/plat-samsung/dev-hsmmc1.c
@@ -58,22 +58,5 @@ struct platform_device s3c_device_hsmmc1 = {
 
 void s3c_sdhci1_set_platdata(struct s3c_sdhci_platdata *pd)
 {
-   struct s3c_sdhci_platdata *set = &s3c_hsmmc1_def_platdata;
-
-   set->cd_type = pd->cd_type;
-   set->ext_cd_init = pd->ext_cd_init;
-   set->ext_cd_cleanup = pd->ext_cd_cleanup;
-   set->ext_cd_gpio = pd->ext_cd_gpio;
-   set->ext_cd_gpio_invert = pd->ext_cd_gpio_invert;
-
-   if (pd->max_width)
-   set->max_width = pd->max_width;
-   if (pd->cfg_gpio)
-   set->cfg_gpio = pd->cfg_gpio;
-   if (pd->cfg_card)
-   set->cfg_card = pd->cfg_card;
-   if (pd->host_caps)
-   set->host_caps |= pd->host_caps;
-   if (pd->clk_type)
-   set->clk_type = pd->clk_type;
+   s3c_sdhci_set_platdata(pd, &s3c_hsmmc1_def_platdata);
 }
diff --git a/arch/arm/plat-samsung/dev-hsmmc2.c 
b/arch/arm/plat-samsung/dev-hsmmc2.c
index f60aedb..9cede96 100644
--- a/arch/arm/plat-samsung/dev-hsmmc2.c
+++ b/arch/arm/plat-samsung/dev-hsmmc2.c
@@ -59,22 +59,5 @@ struct platform_device s3c_device_hsmmc2 = {
 
 void s3c_sdhci2_set_platdata(struct s3c_sdhci_platdata *pd)
 {
-   struct s3c_sdhci_platdata *set = &s3c_hsmmc2_def_platdata;
-
-   set->cd_type = pd->cd_type;
-   set->ext_cd_init = pd->ext_cd_init;
-   set->ext_cd_cleanup = pd->ext_cd_cleanup;
-   set->ext_cd_gpio = pd->ext_cd_gpio;
-   set->ext_cd_gpio_invert = pd->ext_cd_gpio_invert;
-
-   if (pd->max_width)
-   set->max_width = pd->max_width;
-   if (pd->cfg_gpio)
-   set->cfg_gpio = pd->cfg_gpio;
-   if (pd->cfg_card)
-   set->cfg_card = pd->cfg_card;
-   if (pd->host_caps)
-   set->host_caps |= pd->host_caps;
-   if (pd->clk_type)
-   set->clk_type = pd->clk_type;
+   s3c_sdhci_set_platdata(pd, &s3c_hsmmc2_def_platdata);
 }
diff --git a/arch/arm/plat-samsung/dev-hsmmc3.c 
b/arch/arm/plat-samsung/dev-hsmmc3.c
index ede776f..0358ef4 100644
--- a/arch/arm/plat-samsung/dev-hsmmc3.c
+++ b/arch/arm/plat-samsung/dev-hsmmc3.c
@@ -62,22 +62,5 @@ struct platform_device s3c_device_hsmmc3 = {
 
 void s3c_sdhci3_set_platdata(struct s3c_sdhci_platdata *pd)
 {
-   struct s3c_sdhci_platdata *set = &s3c_hsmmc3_def_platdata;
-
-   set->cd_type = pd->cd_type;
-   set->ext_cd_init = pd->ext_cd_init;
-   set->ext_cd_cleanup = pd->ext_cd_cleanup;
-   set->ext_cd_gpio = pd->ext_cd_gpio;
-   set->ext_cd_gpio_invert = pd->ext_cd_gpio_invert;
-
-   if (pd->max_width)
-   set->max_width = pd->max_width;
-   if (pd->cfg_gpio)
-   set->cfg_gpio = pd->cfg_gpio;
-   if (pd->cfg_card)
-   set->cfg_card = pd->cfg_card;
-   if (pd->host_caps)
-   set->host_caps |= pd->host_caps;
-   if (pd->clk_type)
-   set->clk_type = pd->clk_type;
+   s3c_sdhci_set_platdata(pd, &s3c_hsmmc3_def_platdata);
 }
diff --git a/arch/arm/plat-samsung/include/plat/sdhci.h 
b/arch/arm/plat-samsung/include/plat/sdhci.h
index 058e096..20dc