From patchwork Fri Oct 18 14:14:32 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Sylwester Nawrocki/Kernel \\(PLT\\) /SRPOL/Staff Engineer/Samsung Electronics" X-Patchwork-Id: 3067771 Return-Path: X-Original-To: patchwork-linux-media@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 9EFDF9F372 for ; Fri, 18 Oct 2013 14:15:31 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id CD2662039F for ; Fri, 18 Oct 2013 14:15:26 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id CF7AB20397 for ; Fri, 18 Oct 2013 14:15:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754780Ab3JROPT (ORCPT ); Fri, 18 Oct 2013 10:15:19 -0400 Received: from mailout3.samsung.com ([203.254.224.33]:28138 "EHLO mailout3.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753739Ab3JROPS (ORCPT ); Fri, 18 Oct 2013 10:15:18 -0400 Received: from epcpsbgm2.samsung.com (epcpsbgm2 [203.254.230.27]) by mailout3.samsung.com (Oracle Communications Messaging Server 7u4-24.01(7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTP id <0MUV00MSXBKHXQO0@mailout3.samsung.com>; Fri, 18 Oct 2013 23:14:47 +0900 (KST) X-AuditID: cbfee61b-b7f776d0000016c8-b3-526142573a7f Received: from epmmp1.local.host ( [203.254.227.16]) by epcpsbgm2.samsung.com (EPCPMTA) with SMTP id 30.AF.05832.75241625; Fri, 18 Oct 2013 23:14:47 +0900 (KST) Received: from amdc1344.digital.local ([106.116.147.32]) by mmp1.samsung.com (Oracle Communications Messaging Server 7u4-24.01 (7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTPA id <0MUV00B75BKDB920@mmp1.samsung.com>; Fri, 18 Oct 2013 23:14:47 +0900 (KST) From: Sylwester Nawrocki To: linux-media@vger.kernel.org Cc: kyungmin.park@samsung.com, linux-samsung-soc@vger.kernel.org, Sylwester Nawrocki Subject: [PATCH] exynos4-is: Simplify fimc-is hardware polling helpers Date: Fri, 18 Oct 2013 16:14:32 +0200 Message-id: <1382105672-22032-1-git-send-email-s.nawrocki@samsung.com> X-Mailer: git-send-email 1.7.9.5 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFrrLJMWRmVeSWpSXmKPExsVy+t9jAd1wp8Qgg7Y1yhZnm96wW/Rs2Mpq MeP8PiaLw2/aWR1YPPq2rGL0+LxJLoApissmJTUnsyy1SN8ugSujaelCxoKPIhUnTjYxNTDu Fexi5OSQEDCR2HT2HxOELSZx4d56ti5GLg4hgUWMEnO39jJCOB1MEqsa77KDVLEJGEr0Hu1j BLFFBOQlnvTeYAOxmQXyJc4d28oMYgsLuEn82dPGCmKzCKhKXDz7BKyXFyj+9Ew/UJwDaJuC xJxJNhMYuRcwMqxiFE0tSC4oTkrPNdIrTswtLs1L10vOz93ECPb0M+kdjKsaLA4xCnAwKvHw dtgkBgmxJpYVV+YeYpTgYFYS4d2nDRTiTUmsrEotyo8vKs1JLT7EKM3BoiTOe7DVOlBIID2x JDU7NbUgtQgmy8TBKdXAqH9BT1mjdt7aYy4S33OFOmaYl9pe7Ord+3lD4Fqhj7Mn7pP3m+/o YtXJdXr2R+VemZwfRnzVXQJKW88b28xSazs7/7Wpse/zR8ki+UylQWdDPzD7eWyLfxbwm0+x +OINbybnqN9cehYvMj6K/+Q+p3RaMflN4kznjucuzXvdZesOHV359f05JZbijERDLeai4kQA EgNxzfABAAA= Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-Spam-Status: No, score=-7.3 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP The fimc_is_hw_wait_intsr0_intsd0() function is currently unused and can be safely removed. The other polling function simplified and ETIME error code is replaced with more commonly used ETIMEDOUT. Signed-off-by: Sylwester Nawrocki Signed-off-by: Kyungmin Park --- drivers/media/platform/exynos4-is/fimc-is-regs.c | 36 ++++------------------ drivers/media/platform/exynos4-is/fimc-is-regs.h | 1 - 2 files changed, 6 insertions(+), 31 deletions(-) diff --git a/drivers/media/platform/exynos4-is/fimc-is-regs.c b/drivers/media/platform/exynos4-is/fimc-is-regs.c index 63f8b5e..cfe4406 100644 --- a/drivers/media/platform/exynos4-is/fimc-is-regs.c +++ b/drivers/media/platform/exynos4-is/fimc-is-regs.c @@ -33,47 +33,23 @@ void fimc_is_hw_set_intgr0_gd0(struct fimc_is *is) mcuctl_write(INTGR0_INTGD(0), is, MCUCTL_REG_INTGR0); } -int fimc_is_hw_wait_intsr0_intsd0(struct fimc_is *is) -{ - unsigned int timeout = 2000; - u32 cfg, status; - - cfg = mcuctl_read(is, MCUCTL_REG_INTSR0); - status = INTSR0_GET_INTSD(0, cfg); - - while (status) { - cfg = mcuctl_read(is, MCUCTL_REG_INTSR0); - status = INTSR0_GET_INTSD(0, cfg); - if (timeout == 0) { - dev_warn(&is->pdev->dev, "%s timeout\n", - __func__); - return -ETIME; - } - timeout--; - udelay(1); - } - return 0; -} - int fimc_is_hw_wait_intmsr0_intmsd0(struct fimc_is *is) { unsigned int timeout = 2000; u32 cfg, status; - cfg = mcuctl_read(is, MCUCTL_REG_INTMSR0); - status = INTMSR0_GET_INTMSD(0, cfg); - - while (status) { + do { cfg = mcuctl_read(is, MCUCTL_REG_INTMSR0); status = INTMSR0_GET_INTMSD(0, cfg); - if (timeout == 0) { + + if (--timeout == 0) { dev_warn(&is->pdev->dev, "%s timeout\n", __func__); - return -ETIME; + return -ETIMEDOUT; } - timeout--; udelay(1); - } + } while (status != 0); + return 0; } diff --git a/drivers/media/platform/exynos4-is/fimc-is-regs.h b/drivers/media/platform/exynos4-is/fimc-is-regs.h index ab73957..141e5dd 100644 --- a/drivers/media/platform/exynos4-is/fimc-is-regs.h +++ b/drivers/media/platform/exynos4-is/fimc-is-regs.h @@ -145,7 +145,6 @@ void fimc_is_fw_clear_irq2(struct fimc_is *is); int fimc_is_hw_get_params(struct fimc_is *is, unsigned int num); void fimc_is_hw_set_intgr0_gd0(struct fimc_is *is); -int fimc_is_hw_wait_intsr0_intsd0(struct fimc_is *is); int fimc_is_hw_wait_intmsr0_intmsd0(struct fimc_is *is); void fimc_is_hw_set_sensor_num(struct fimc_is *is); void fimc_is_hw_set_isp_buf_mask(struct fimc_is *is, unsigned int mask);