Patchwork rtc: rtc-max6902 - set driver data in max6902_probe()

login
register
mail settings
Submitter Axel Lin
Date Jan. 12, 2011, 7:36 a.m.
Message ID <1294817794.6904.3.camel@mola>
Download mbox | patch
Permalink /patch/78520/
State New
Headers show

Comments

Axel Lin - Jan. 12, 2011, 7:36 a.m.
Current implementation does not set driver data in max6902_probe(),
thus calling platform_get_drvdata(spi) in max6902_remove() returns NULL.

Signed-off-by: Axel Lin <axel.lin@gmail.com>
Cc: Alessandro Zummo <a.zummo@towertech.it>
---
 drivers/rtc/rtc-max6902.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

Patch

diff --git a/drivers/rtc/rtc-max6902.c b/drivers/rtc/rtc-max6902.c
index 657403e..0ec3f58 100644
--- a/drivers/rtc/rtc-max6902.c
+++ b/drivers/rtc/rtc-max6902.c
@@ -139,12 +139,13 @@  static int __devinit max6902_probe(struct spi_device *spi)
 	if (IS_ERR(rtc))
 		return PTR_ERR(rtc);
 
+	dev_set_drvdata(&spi->dev, rtc);
 	return 0;
 }
 
 static int __devexit max6902_remove(struct spi_device *spi)
 {
-	struct rtc_device *rtc = platform_get_drvdata(spi);
+	struct rtc_device *rtc = dev_get_drvdata(&spi->dev);
 
 	rtc_device_unregister(rtc);
 	return 0;