From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753254AbbCFJwn (ORCPT ); Fri, 6 Mar 2015 04:52:43 -0500 Received: from gloria.sntech.de ([95.129.55.99]:51439 "EHLO gloria.sntech.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751158AbbCFJwj (ORCPT ); Fri, 6 Mar 2015 04:52:39 -0500 From: Heiko Stuebner To: akpm@linux-foundation.org, Alessandro Zummo Cc: rtc-linux@googlegroups.com, linux-kernel@vger.kernel.org Subject: [PATCH] rtc: hym8563: return clock rate even when clock is disabled Date: Fri, 06 Mar 2015 10:52:39 +0100 Message-ID: <2117188.iNXM1T8hb3@phil> User-Agent: KMail/4.14.1 (Linux/3.19.0+; KDE/4.14.2; x86_64; ; ) MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org When the clock is disabled, do not return a rate of 0 but instead return the rate the clock will be running at after it gets enabled. This prevents problems when the core clock code is trying to determine a suitable rate, while the clock is still off. Signed-off-by: Heiko Stuebner --- drivers/rtc/rtc-hym8563.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/rtc/rtc-hym8563.c b/drivers/rtc/rtc-hym8563.c index b936bb4..d4a6561 100644 --- a/drivers/rtc/rtc-hym8563.c +++ b/drivers/rtc/rtc-hym8563.c @@ -309,7 +309,7 @@ static unsigned long hym8563_clkout_recalc_rate(struct clk_hw *hw, struct i2c_client *client = hym8563->client; int ret = i2c_smbus_read_byte_data(client, HYM8563_CLKOUT); - if (ret < 0 || ret & HYM8563_CLKOUT_DISABLE) + if (ret < 0) return 0; ret &= HYM8563_CLKOUT_MASK; -- 2.1.4