mmc: mmc_spi: use spi_get_drvdata() and spi_set_drvdata()
Subsystems (2)
PATCH 1/2 mmc: mmc_spi: use spi_get_drvdata() and spi_set_drvdata()
Use the wrapper functions for getting and setting the driver data using spi_device instead of using dev_{get|set}_drvdata with &spi->dev, so we can directly pass a struct spi_device.
--- drivers/mmc/host/mmc_spi.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/mmc/host/mmc_spi.c +4 -4
@@ -1386,7 +1386,7 @@ static int mmc_spi_probe(struct spi_device *spi) host->powerup_msecs =250 ; } -dev_set_drvdata (&spi->dev, mmc); +spi_set_drvdata (spi, mmc);/* preallocate dma buffers */ host->data =kmalloc (sizeof (*host->data),GFP_KERNEL );
@@ -1472,7 +1472,7 @@ fail_glue_init: fail_nobuf1:mmc_free_host (mmc);mmc_spi_put_pdata (spi); -dev_set_drvdata (&spi->dev,NULL ); +spi_set_drvdata (spi,NULL ); nomem:kfree (ones);
@@ -1482,7 +1482,7 @@ nomem:static int mmc_spi_remove (struct spi_device *spi) { -struct mmc_host *mmc =dev_get_drvdata (&spi->dev); +struct mmc_host *mmc =spi_get_drvdata (spi);struct mmc_spi_host *host;if (mmc) {
@@ -1507,7 +1507,7 @@ static int mmc_spi_remove(struct spi_device *spi) spi->max_speed_hz = mmc->f_max;mmc_free_host (mmc);mmc_spi_put_pdata (spi); -dev_set_drvdata (&spi->dev,NULL ); +spi_set_drvdata (spi,NULL ); }return 0 ; }
Signature · 1 line
1.7.10.4
PATCH 2/2 mmc: mmc_spi: remove unnecessary spi_set_drvdata()
The driver core clears the driver data to NULL after device_release or on probe failure. Thus, it is not needed to manually clear the device driver data to NULL.
--- drivers/mmc/host/mmc_spi.c | 2 -- 1 file changed, 2 deletions(-)
drivers/mmc/host/mmc_spi.c +0 -2
@@ -1472,7 +1472,6 @@ fail_glue_init: fail_nobuf1:mmc_free_host (mmc);mmc_spi_put_pdata (spi); -spi_set_drvdata (spi,NULL ); nomem:kfree (ones);
@@ -1507,7 +1506,6 @@ static int mmc_spi_remove(struct spi_device *spi) spi->max_speed_hz = mmc->f_max;mmc_free_host (mmc);mmc_spi_put_pdata (spi); -spi_set_drvdata (spi,NULL ); }return 0 ; }
Signature · 1 line
1.7.10.4
RE: [PATCH 2/2] mmc: mmc_spi: remove unnecessary spi_set_drvdata()
Quoted 39 lines
-----Original Message-----
From: Jingoo Han [mailto:[email protected]]
Sent: Wednesday, October 02, 2013 4:36 PM
To: 'Chris Ball'
Cc: [email protected]; Zhang, Sonic; 'Jingoo Han'
Subject: [PATCH 2/2] mmc:mmc_spi: remove unnecessaryspi_set_drvdata()The driver core clears the driver data to NULL after
device_releaseor on probe failure. Thus, it is not needed to manually clear the device driver data to NULL.Signed-off-by Jingoo Han <[email protected]>---
drivers/mmc/host/mmc_spi.c| 2 --1 file changed, 2 deletions(-)drivers/mmc/host/mmc_spi.c index renamed from drivers/mmc/host/mmc_spi.c +0
-040770a5..4c5e279 100644
drivers/mmc/host/mmc_spi.c +0
-0@@ -1472,7 +1472,6 @@ fail_glue_init:
fail_nobuf1:mmc_free_host(mmc); mmc_spi_put_pdata(spi);-
spi_set_drvdata(spi, NULL);nomem:
kfree(ones);drivers/mmc/host/mmc_spi.c +0
-2@@ -1507,7 +1506,6 @@ static int mmc_spi_remove(struct spi_device *spi) spi->max_speed_hz = mmc->f_max;mmc_free_host (mmc);mmc_spi_put_pdata (spi); -spi_set_drvdata (spi,NULL ); }return 0 ; } --1.7.10.4