From patchwork Fri Feb 24 11:16:02 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrzej Hajda X-Patchwork-Id: 9589927 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 9826160578 for ; Fri, 24 Feb 2017 11:16:43 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9F48A28589 for ; Fri, 24 Feb 2017 11:16:43 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 940D728670; Fri, 24 Feb 2017 11:16:43 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 37B5428613 for ; Fri, 24 Feb 2017 11:16:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751115AbdBXLQm (ORCPT ); Fri, 24 Feb 2017 06:16:42 -0500 Received: from mailout2.w1.samsung.com ([210.118.77.12]:13738 "EHLO mailout2.w1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751190AbdBXLQk (ORCPT ); Fri, 24 Feb 2017 06:16:40 -0500 Received: from eucas1p2.samsung.com (unknown [182.198.249.207]) by mailout2.w1.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTP id <0OLV00KG1LZOY280@mailout2.w1.samsung.com>; Fri, 24 Feb 2017 11:16:36 +0000 (GMT) Received: from eusmges2.samsung.com (unknown [203.254.199.241]) by eucas1p1.samsung.com (KnoxPortal) with ESMTP id 20170224111635eucas1p14e70d4c8365c118c75b82d8730fdd592~mNP7B8QzR2113921139eucas1p1D; Fri, 24 Feb 2017 11:16:35 +0000 (GMT) Received: from eucas1p1.samsung.com ( [182.198.249.206]) by eusmges2.samsung.com (EUCPMTA) with SMTP id 7D.DD.30614.31610B85; Fri, 24 Feb 2017 11:16:35 +0000 (GMT) Received: from eusmgms1.samsung.com (unknown [182.198.249.179]) by eucas1p2.samsung.com (KnoxPortal) with ESMTP id 20170224111634eucas1p28938c94c566c0aadf6dc7766b4eb96d9~mNP6MhW1I0140201402eucas1p2U; Fri, 24 Feb 2017 11:16:34 +0000 (GMT) X-AuditID: cbfec7f1-f793f6d000007796-58-58b0161347a8 Received: from eusync3.samsung.com ( [203.254.199.213]) by eusmgms1.samsung.com (EUCPMTA) with SMTP id 6D.BC.06687.96610B85; Fri, 24 Feb 2017 11:18:01 +0000 (GMT) Received: from AMDC2768.DIGITAL.local ([106.120.43.17]) by eusync3.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTPA id <0OLV00G04LZL7Z80@eusync3.samsung.com>; Fri, 24 Feb 2017 11:16:34 +0000 (GMT) From: Andrzej Hajda To: Wolfram Sang , Krzysztof Kozlowski , Javier Martinez Canillas , linux-i2c@vger.kernel.org, linux-samsung-soc@vger.kernel.org Cc: Andrzej Hajda , Bartlomiej Zolnierkiewicz , Marek Szyprowski Subject: [PATCH 2/2] i2c: exynos5: de-duplicate error logs on clock setup Date: Fri, 24 Feb 2017 12:16:02 +0100 Message-id: <1487934962-8703-2-git-send-email-a.hajda@samsung.com> X-Mailer: git-send-email 2.7.4 In-reply-to: <1487934962-8703-1-git-send-email-a.hajda@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFrrAIsWRmVeSWpSXmKPExsWy7djPc7rCYhsiDBZvkLS4te4cq8XGGetZ Ld68XcNkcf78BnaLjr9fGC1mnN/HZLH2yF12i5UnZjE7c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xQdhiEhfurWfrYuTi EBJYwiix8dpOVpCEkEAjk8TnNkYQm01AU+Lv5ptgRSICBxgltp39xw7iMAv0MUo0/l3FBlIl LOApsf7bazCbRUBV4vOxg2DdvAJOEn8ffWSDWCcncfNcJzOIzSngLHF063UWiG1OEkdXLGeb wMi7gJFhFaNIamlxbnpusaFecWJucWleul5yfu4mRmBYbzv2c/MOxksbgw8xCnAwKvHwGjxb FyHEmlhWXJl7iFGCg1lJhLecfUOEEG9KYmVValF+fFFpTmrxIUZToKMmMkuJJucDYy6vJN7Q xNDc0tDI2MLC3MhISZy35MOVcCGB9MSS1OzU1ILUIpg+Jg5OqQZGxvfHAktDVPOy+9s/vPfd yOGm/vrhwYlqm0838T5Uvt9k3VHsnBCnqOwTHS1pxqEcnr33GjNH9o97HhN7P1dllM47njhp 36O7y37q/1VZdGW6oq4w+3XZqR9bfwlzKyk+V9VKmSUxM8SoTUnSnq3+DPfs4oXGnEvVIqKL eYpWZe5om5D530iJpTgj0VCLuag4EQBgs/2hgQIAAA== X-MTR: 20000000000000000@CPGS X-CMS-MailID: 20170224111634eucas1p28938c94c566c0aadf6dc7766b4eb96d9 X-Msg-Generator: CA X-Sender-IP: 182.198.249.179 X-Local-Sender: =?UTF-8?B?QW5kcnplaiBIYWpkYRtTUlBPTC1LZXJuZWwgKFRQKRvsgrw=?= =?UTF-8?B?7ISx7KCE7J6QG1NlbmlvciBTb2Z0d2FyZSBFbmdpbmVlcg==?= X-Global-Sender: =?UTF-8?B?QW5kcnplaiBIYWpkYRtTUlBPTC1LZXJuZWwgKFRQKRtTYW1z?= =?UTF-8?B?dW5nIEVsZWN0cm9uaWNzG1NlbmlvciBTb2Z0d2FyZSBFbmdpbmVlcg==?= X-Sender-Code: =?UTF-8?B?QzEwG0VIURtDMTBDRDAyQ0QwMjczOTI=?= CMS-TYPE: 201P X-HopCount: 7 X-CMS-RootMailID: 20170224111634eucas1p28938c94c566c0aadf6dc7766b4eb96d9 X-RootMTR: 20170224111634eucas1p28938c94c566c0aadf6dc7766b4eb96d9 References: <1487934962-8703-1-git-send-email-a.hajda@samsung.com> Sender: linux-samsung-soc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-samsung-soc@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP In case of clock setup error it is enough to log it once. Moreover patch simplifies clock setup routines. Signed-off-by: Andrzej Hajda Reviewed-by: Javier Martinez Canillas Tested-by: Javier Martinez Canillas --- drivers/i2c/busses/i2c-exynos5.c | 24 +++++++----------------- 1 file changed, 7 insertions(+), 17 deletions(-) diff --git a/drivers/i2c/busses/i2c-exynos5.c b/drivers/i2c/busses/i2c-exynos5.c index 54df9e6..bc2b5db 100644 --- a/drivers/i2c/busses/i2c-exynos5.c +++ b/drivers/i2c/busses/i2c-exynos5.c @@ -309,7 +309,8 @@ static int exynos5_i2c_set_timing(struct exynos5_i2c *i2c, bool hs_timings) div = temp / 512; clk_cycle = temp / (div + 1) - 2; if (temp < 4 || div >= 256 || clk_cycle < 2) { - dev_warn(i2c->dev, "Failed to calculate divisor"); + dev_err(i2c->dev, "%s clock set-up failed\n", + hs_timings ? "HS" : "FS"); return -EINVAL; } @@ -351,24 +352,13 @@ static int exynos5_i2c_set_timing(struct exynos5_i2c *i2c, bool hs_timings) static int exynos5_hsi2c_clock_setup(struct exynos5_i2c *i2c) { - /* - * Configure the Fast speed timing values - * Even the High Speed mode initially starts with Fast mode - */ - if (exynos5_i2c_set_timing(i2c, false)) { - dev_err(i2c->dev, "HSI2C FS Clock set up failed\n"); - return -EINVAL; - } + /* always set Fast Speed timings */ + int ret = exynos5_i2c_set_timing(i2c, false); - /* configure the High speed timing values */ - if (i2c->op_clock >= HSI2C_HS_TX_CLOCK) { - if (exynos5_i2c_set_timing(i2c, true)) { - dev_err(i2c->dev, "HSI2C HS Clock set up failed\n"); - return -EINVAL; - } - } + if (ret < 0 || i2c->op_clock < HSI2C_HS_TX_CLOCK) + return ret; - return 0; + return exynos5_i2c_set_timing(i2c, true); } /*