Skip to contentSkip to conversation

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

PATCH New Axel Lin 1 participant 1 message Nov 2, 2010 Real time clock (RTC)

lore
Share & tools
lore

Axel Lin

author
#0 lore raw

PATCH 1/1 rtc: rtc-max6902 - set driver data in max6902_probe()

Current implementation does not set driver data in max6902_probe(), thus calling platform_get_drvdata(spi) in max6902_remove() returns NULL.

Since this is a spi driver, use spi_set_drvdata/spi_get_drvdata to set/get driver data.

---
 drivers/rtc/rtc-max6902.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)
drivers/rtc/rtc-max6902.c +3 -1
index 657403e..23faecb 100644
@@ -138,15 +138,17 @@ static int __devinit max6902_probe(struct spi_device *spi)
 				&spi->dev, &max6902_rtc_ops, THIS_MODULE);
 	if (IS_ERR(rtc))
 		return PTR_ERR(rtc);
+	spi_set_drvdata(spi, rtc);
 
 	return 0;
 }
 
 static int __devexit max6902_remove(struct spi_device *spi)
 {
-	struct rtc_device *rtc = platform_get_drvdata(spi);
+	struct rtc_device *rtc = spi_get_drvdata(spi);
 
 	rtc_device_unregister(rtc);
+	spi_set_drvdata(spi, NULL);
 	return 0;
 }
 
Signature · 1 line
1.7.2