diff options
| author | mattis fjallstrom <mattis@acm.org> | 2015-08-31 12:39:14 -0700 | 
|---|---|---|
| committer | mattis fjallstrom <mattis@acm.org> | 2015-08-31 12:39:14 -0700 | 
| commit | 3c3e312f0eb93dada915935c318d965978faabb2 (patch) | |
| tree | 3a3b6c9075497623abc280ddfdaf020b7e1392ec | |
| parent | 774f16c06ecdb9237b31205799d718f49f97b5ad (diff) | |
| download | olio-linux-3.10-3c3e312f0eb93dada915935c318d965978faabb2.tar.xz olio-linux-3.10-3c3e312f0eb93dada915935c318d965978faabb2.zip | |
Fixing bug in the rtc driver that stopped the rtc device from getting registered properly and thereby blocked time and alarm from working properly.
Change-Id: I7dc873b8c6f4965435f7f28bd405e0a600968a42
| -rw-r--r-- | drivers/rtc/rtc-tps65910.c | 31 | 
1 files changed, 20 insertions, 11 deletions
| diff --git a/drivers/rtc/rtc-tps65910.c b/drivers/rtc/rtc-tps65910.c index cdbf1a2b251..2e4894b4732 100644 --- a/drivers/rtc/rtc-tps65910.c +++ b/drivers/rtc/rtc-tps65910.c @@ -238,17 +238,20 @@ static int tps65910_rtc_probe(struct platform_device *pdev)  	tps_rtc = devm_kzalloc(&pdev->dev, sizeof(struct tps65910_rtc),  			GFP_KERNEL); -	if (!tps_rtc) -		return -ENOMEM; + +    if (!tps_rtc) { +        ret = -ENOMEM; +        goto fail_end; +    }  	/* Clear pending interrupts */  	ret = regmap_read(tps65910->regmap, TPS65910_RTC_STATUS, &rtc_reg);  	if (ret < 0) -		return ret; +      goto fail_end;  	ret = regmap_write(tps65910->regmap, TPS65910_RTC_STATUS, rtc_reg);  	if (ret < 0) -		return ret; +        goto fail_end;  	dev_dbg(&pdev->dev, "Enabling rtc-tps65910.\n"); @@ -256,18 +259,19 @@ static int tps65910_rtc_probe(struct platform_device *pdev)  	ret = regmap_update_bits(tps65910->regmap, TPS65910_DEVCTRL,  		DEVCTRL_RTC_PWDN_MASK, 0 << DEVCTRL_RTC_PWDN_SHIFT);  	if (ret < 0) -		return ret; +        goto fail_end;  	rtc_reg = TPS65910_RTC_CTRL_STOP_RTC;  	ret = regmap_write(tps65910->regmap, TPS65910_RTC_CTRL, rtc_reg);  	if (ret < 0) -		return ret; +        goto fail_end;  	irq  = platform_get_irq(pdev, 0);  	if (irq <= 0) {  		dev_warn(&pdev->dev, "Wake up is not possible as irq = %d\n", -			irq); -		return -ENXIO; +                 irq); +        ret = -ENXIO; +        goto fail_end;  	}  	ret = devm_request_threaded_irq(&pdev->dev, irq, NULL, @@ -275,23 +279,28 @@ static int tps65910_rtc_probe(struct platform_device *pdev)  		dev_name(&pdev->dev), &pdev->dev);  	if (ret < 0) {  		dev_err(&pdev->dev, "IRQ is not free.\n"); -		return ret; +        goto fail_end;  	}  	tps_rtc->irq = irq; -	device_set_wakeup_capable(&pdev->dev, 1); + +    device_init_wakeup(&pdev->dev, 1);  	tps_rtc->rtc = devm_rtc_device_register(&pdev->dev, pdev->name,  		&tps65910_rtc_ops, THIS_MODULE);  	if (IS_ERR(tps_rtc->rtc)) {  		ret = PTR_ERR(tps_rtc->rtc);  		dev_err(&pdev->dev, "RTC device register: err %d\n", ret); -		return ret; +        goto fail_end;  	}  	platform_set_drvdata(pdev, tps_rtc); +  	wake_lock_init(&rtc_wake_lock, WAKE_LOCK_SUSPEND, "rtc_wake_lock");  	return 0; + +fail_end: +    return ret;  }  /* |