Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754190AbbL3Bx3 (ORCPT ); Tue, 29 Dec 2015 20:53:29 -0500 Received: from mailout3.w1.samsung.com ([210.118.77.13]:23279 "EHLO mailout3.w1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754040AbbL3BxY (ORCPT ); Tue, 29 Dec 2015 20:53:24 -0500 X-AuditID: cbfec7f5-f79b16d000005389-e1-568339114ca6 From: Krzysztof Kozlowski To: Sangbeom Kim , Krzysztof Kozlowski , Alessandro Zummo , Alexandre Belloni , Lee Jones , linux-kernel@vger.kernel.org, linux-samsung-soc@vger.kernel.org, rtc-linux@googlegroups.com Cc: Alim Akhtar Subject: [PATCH 2/3] rtc: s5m: Add separate field for storing auto-cleared mask in register config Date: Wed, 30 Dec 2015 10:53:04 +0900 Message-id: <1451440385-8654-2-git-send-email-k.kozlowski@samsung.com> X-Mailer: git-send-email 1.9.1 In-reply-to: <1451440385-8654-1-git-send-email-k.kozlowski@samsung.com> References: <1451440385-8654-1-git-send-email-k.kozlowski@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFlrILMWRmVeSWpSXmKPExsVy+t/xy7qCls1hBs3HtSyWXLzKbtFxbTGT xYN529gsXr8wtLj/9SijxeVdc9gsZpzfx2Sxv7OD0eLiii9MDpweTzZdZPTYM/Ekm8eda3vY PPq2rGL0mD7vJ5PH501yAWxRXDYpqTmZZalF+nYJXBntLb+ZC7byV7z/4tnAeI6ni5GTQ0LA ROLmg8esELaYxIV769m6GLk4hASWMkocmHuNEcL5zygx+dwKZpAqNgFjic3Ll4BViQgcZJJ4 92A6WIJZQFOivf0L2ChhgRSJ69eeABVxcLAIqEps+cYPEuYVcJO4MbGFBWKbnMTJY5PByjkF 3CWWPlkINkYIqGbllRNMExh5FzAyrGIUTS1NLihOSs810itOzC0uzUvXS87P3cQICbivOxiX HrM6xCjAwajEw3tCqDlMiDWxrLgy9xCjBAezkghvphZQiDclsbIqtSg/vqg0J7X4EKM0B4uS OO/MXe9DhATSE0tSs1NTC1KLYLJMHJxSDYzC85VOmu3ZcPyjWKug9rsrvyz0Qgtf7TXtqQu4 9nMu25S0KQoTks8H5+yYnSr3m9t3uyAnv3TDwhtxnfsULGUsDk9atMCgxWzlhdc2N+TDhF02 nd10zUL8il6xy4ppBnurFiTIvNh1w2LT1TcHm0rq30z+eOTcMm3lR/rWzYx2+ZONupz0NU2U WIozEg21mIuKEwG+5sCQNAIAAA== Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2164 Lines: 59 Some devices from S2M/S5M family use different register update masks for different operations (alarm and register update). Now the driver uses common register configuration and a lot of exceptions per device in code. Before eliminating the exceptions and using specific register configuration for given device, make the auto-cleared mask a separate field. This is merely a refactoring. Signed-off-by: Krzysztof Kozlowski --- drivers/rtc/rtc-s5m.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/drivers/rtc/rtc-s5m.c b/drivers/rtc/rtc-s5m.c index 85649861a6b0..559db8f72117 100644 --- a/drivers/rtc/rtc-s5m.c +++ b/drivers/rtc/rtc-s5m.c @@ -56,6 +56,8 @@ struct s5m_rtc_reg_config { * auto-cleared after successful update. */ unsigned int udr_update; + /* Auto-cleared mask in UDR field for writing time and alarm */ + unsigned int autoclear_udr_mask; /* Mask for UDR field in 'udr_update' register */ unsigned int udr_mask; }; @@ -68,6 +70,7 @@ static const struct s5m_rtc_reg_config s5m_rtc_regs = { .alarm0 = S5M_ALARM0_SEC, .alarm1 = S5M_ALARM1_SEC, .udr_update = S5M_RTC_UDR_CON, + .autoclear_udr_mask = S5M_RTC_UDR_MASK, .udr_mask = S5M_RTC_UDR_MASK, }; @@ -82,6 +85,7 @@ static const struct s5m_rtc_reg_config s2mps_rtc_regs = { .alarm0 = S2MPS_ALARM0_SEC, .alarm1 = S2MPS_ALARM1_SEC, .udr_update = S2MPS_RTC_UDR_CON, + .autoclear_udr_mask = S2MPS_RTC_WUDR_MASK, .udr_mask = S2MPS_RTC_WUDR_MASK, }; @@ -167,7 +171,7 @@ static inline int s5m8767_wait_for_udr_update(struct s5m_rtc_info *info) do { ret = regmap_read(info->regmap, info->regs->udr_update, &data); - } while (--retry && (data & info->regs->udr_mask) && !ret); + } while (--retry && (data & info->regs->autoclear_udr_mask) && !ret); if (!retry) dev_err(info->dev, "waiting for UDR update, reached max number of retries\n"); -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/