mmc: sdhi: do not install dummy callbacks
authorGuennadi Liakhovetski <g.liakhovetski@gmx.de>
Wed, 20 Jun 2012 17:10:34 +0000 (19:10 +0200)
committerChris Ball <cjb@laptop.org>
Sat, 21 Jul 2012 04:02:11 +0000 (00:02 -0400)
Currently the SDHI glue for the TMIO MMC driver installs dummy .get_cd() and
.set_pwr() callbacks even if the platform didn't supply them. This is not
necessary, since the TMIO MMC driver itself checks for NULL callbacks. This
is also dubious if the platform provides a regulator for SD-card power
switching. It is better to only install those callbacks, if they are really
provided by the platform.

Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
Signed-off-by: Chris Ball <cjb@laptop.org>
drivers/mmc/host/sh_mobile_sdhi.c

index d8b167c8493a6fc68a00fd5f3aa7b915e4d1aa2c..42f07fa6e043c0acb145c79a9df50d27e1ec4084 100644 (file)
@@ -64,18 +64,14 @@ static void sh_mobile_sdhi_set_pwr(struct platform_device *pdev, int state)
 {
        struct sh_mobile_sdhi_info *p = pdev->dev.platform_data;
 
-       if (p && p->set_pwr)
-               p->set_pwr(pdev, state);
+       p->set_pwr(pdev, state);
 }
 
 static int sh_mobile_sdhi_get_cd(struct platform_device *pdev)
 {
        struct sh_mobile_sdhi_info *p = pdev->dev.platform_data;
 
-       if (p && p->get_cd)
-               return p->get_cd(pdev);
-       else
-               return -ENOSYS;
+       return p->get_cd(pdev);
 }
 
 static int sh_mobile_sdhi_wait_idle(struct tmio_mmc_host *host)
@@ -153,8 +149,10 @@ static int __devinit sh_mobile_sdhi_probe(struct platform_device *pdev)
                goto eclkget;
        }
 
-       mmc_data->set_pwr = sh_mobile_sdhi_set_pwr;
-       mmc_data->get_cd = sh_mobile_sdhi_get_cd;
+       if (p->set_pwr)
+               mmc_data->set_pwr = sh_mobile_sdhi_set_pwr;
+       if (p->get_cd)
+               mmc_data->get_cd = sh_mobile_sdhi_get_cd;
        mmc_data->clk_enable = sh_mobile_sdhi_clk_enable;
        mmc_data->clk_disable = sh_mobile_sdhi_clk_disable;
        mmc_data->capabilities = MMC_CAP_MMC_HIGHSPEED;