diff mbox series

[RFC,03/13] mmc: sunxi: conditionally include MMC2 initialization code

Message ID 20210722063015.421923-4-icenowy@sipeed.com
State Accepted
Commit c846fe43f0561311eb7261b34023a04646cdbd0d
Delegated to: Andre Przywara
Headers show
Series Add support for Allwinner R329 | expand

Commit Message

Icenowy Zheng July 22, 2021, 6:30 a.m. UTC
Allwinner R329 has no MMC2.

Only include the code of MMC2 if the base address of it is defined.

Signed-off-by: Icenowy Zheng <icenowy@sipeed.com>
---
 drivers/mmc/sunxi_mmc.c | 2 ++
 1 file changed, 2 insertions(+)

Comments

Andre Przywara July 22, 2021, 1:48 p.m. UTC | #1
On Thu, 22 Jul 2021 14:30:05 +0800
Icenowy Zheng <icenowy@sipeed.com> wrote:

Hi Icenowy,

> Allwinner R329 has no MMC2.
> 
> Only include the code of MMC2 if the base address of it is defined.
> 
> Signed-off-by: Icenowy Zheng <icenowy@sipeed.com>

One day (TM) we will hopefully get somehow rid of those #ifdefs
somehow, but until then it looks OK.

Reviewed-by: Andre Przywara <andre.przywara@arm.com>

Thanks!
Andre

> ---
>  drivers/mmc/sunxi_mmc.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/drivers/mmc/sunxi_mmc.c b/drivers/mmc/sunxi_mmc.c
> index 178b8cf106..6b809c001f 100644
> --- a/drivers/mmc/sunxi_mmc.c
> +++ b/drivers/mmc/sunxi_mmc.c
> @@ -73,10 +73,12 @@ static int mmc_resource_init(int sdc_no)
>  		priv->reg = (struct sunxi_mmc *)SUNXI_MMC1_BASE;
>  		priv->mclkreg = &ccm->sd1_clk_cfg;
>  		break;
> +#ifdef SUNXI_MMC2_BASE
>  	case 2:
>  		priv->reg = (struct sunxi_mmc *)SUNXI_MMC2_BASE;
>  		priv->mclkreg = &ccm->sd2_clk_cfg;
>  		break;
> +#endif
>  #ifdef SUNXI_MMC3_BASE
>  	case 3:
>  		priv->reg = (struct sunxi_mmc *)SUNXI_MMC3_BASE;
diff mbox series

Patch

diff --git a/drivers/mmc/sunxi_mmc.c b/drivers/mmc/sunxi_mmc.c
index 178b8cf106..6b809c001f 100644
--- a/drivers/mmc/sunxi_mmc.c
+++ b/drivers/mmc/sunxi_mmc.c
@@ -73,10 +73,12 @@  static int mmc_resource_init(int sdc_no)
 		priv->reg = (struct sunxi_mmc *)SUNXI_MMC1_BASE;
 		priv->mclkreg = &ccm->sd1_clk_cfg;
 		break;
+#ifdef SUNXI_MMC2_BASE
 	case 2:
 		priv->reg = (struct sunxi_mmc *)SUNXI_MMC2_BASE;
 		priv->mclkreg = &ccm->sd2_clk_cfg;
 		break;
+#endif
 #ifdef SUNXI_MMC3_BASE
 	case 3:
 		priv->reg = (struct sunxi_mmc *)SUNXI_MMC3_BASE;