Patchwork [3/3] drivers/net/smc911x.c: smc911x_drv_probe() cleanup

login
register
mail settings
Submitter Andrew Morton
Date Dec. 1, 2008, 10:24 p.m.
Message ID <200812012224.mB1MOl2J015252@imap1.linux-foundation.org>
Download mbox | patch
Permalink /patch/11669/
State Accepted
Delegated to: David Miller
Headers show

Comments

Andrew Morton - Dec. 1, 2008, 10:24 p.m.
From: Andrew Morton <akpm@linux-foundation.org>

Save an ugly ifdef.

Cc: "Dasgupta, Romit" <romit@ti.com>
Cc: Catalin Marinas <catalin.marinas@arm.com>
Cc: Jeff Garzik <jeff@garzik.org>
Cc: Romit Dasgupta <romit@ti.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
---

 drivers/net/smc911x.c |   14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

Patch

diff -puN drivers/net/smc911x.c~netdev-smc911x-fix-for-driver-resume-cleanup drivers/net/smc911x.c
--- a/drivers/net/smc911x.c~netdev-smc911x-fix-for-driver-resume-cleanup
+++ a/drivers/net/smc911x.c
@@ -2050,9 +2050,6 @@  err_out:
  */
 static int __devinit smc911x_drv_probe(struct platform_device *pdev)
 {
-#ifdef SMC_DYNAMIC_BUS_CONFIG
-	struct smc911x_platdata *pd = pdev->dev.platform_data;
-#endif
 	struct net_device *ndev;
 	struct resource *res;
 	struct smc911x_local *lp;
@@ -2087,11 +2084,14 @@  static int __devinit smc911x_drv_probe(s
 	lp = netdev_priv(ndev);
 	lp->netdev = ndev;
 #ifdef SMC_DYNAMIC_BUS_CONFIG
-	if (!pd) {
-		ret = -EINVAL;
-		goto release_both;
+	{
+		struct smc911x_platdata *pd = pdev->dev.platform_data;
+		if (!pd) {
+			ret = -EINVAL;
+			goto release_both;
+		}
+		memcpy(&lp->cfg, pd, sizeof(lp->cfg));
 	}
-	memcpy(&lp->cfg, pd, sizeof(lp->cfg));
 #endif
 
 	addr = ioremap(res->start, SMC911X_IO_EXTENT);