From patchwork Tue Jan 15 14:25:09 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Kieran Bingham X-Patchwork-Id: 10764601 X-Patchwork-Delegate: kieran@bingham.xyz Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 80787139A for ; Tue, 15 Jan 2019 14:25:16 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 718922C8CD for ; Tue, 15 Jan 2019 14:25:16 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5E8C72CA14; Tue, 15 Jan 2019 14:25:16 +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=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,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 4A0222CA0A for ; Tue, 15 Jan 2019 14:25:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730344AbfAOOZP (ORCPT ); Tue, 15 Jan 2019 09:25:15 -0500 Received: from perceval.ideasonboard.com ([213.167.242.64]:42042 "EHLO perceval.ideasonboard.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727574AbfAOOZO (ORCPT ); Tue, 15 Jan 2019 09:25:14 -0500 Received: from localhost.localdomain (cpc89242-aztw30-2-0-cust488.18-1.cable.virginm.net [86.31.129.233]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 9C7854F8; Tue, 15 Jan 2019 15:25:12 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1547562312; bh=nIZf0tWuPTdlxqa4jw93FwMmDk6xecS4QbGLEz3vaBQ=; h=From:To:Cc:Subject:Date:From; b=TRcJIzgJcLYvvw4vw8WGSL1sBncZ6rJzEj657Bci0IOp+KDTr4oDVShvcnA7vkVsU c1DlTTg/osClu5FSZCCkX+Dort9NDCQKBT3Dx9Ue3dlBmCxCJVUzBi6kaQW2qEOJVY P5h0KP5b+hVnn6OwD5jKXOojRBgYgG8Rf9QrlcaY= From: Kieran Bingham To: linux-media@vger.kernel.org, linux-renesas-soc@vger.kernel.org, Kieran Bingham Cc: Laurent Pinchart , =?utf-8?q?Niklas_S?= =?utf-8?q?=C3=B6derlund?= , Jacopo Mondi Subject: [PATCH v2] media: i2c: adv748x: Remove PAGE_WAIT Date: Tue, 15 Jan 2019 14:25:09 +0000 Message-Id: <20190115142509.26048-1-kieran.bingham+renesas@ideasonboard.com> X-Mailer: git-send-email 2.17.1 MIME-Version: 1.0 Sender: linux-renesas-soc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-renesas-soc@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP The ADV748X_PAGE_WAIT is a fake page to insert arbitrary delays in the register tables. Its only usage was removed, so we can remove the handling and simplify the code. Reviewed-by: Laurent Pinchart Reviewed-by: Niklas Söderlund Signed-off-by: Kieran Bingham --- v2: - Use for loop with regs incrementer drivers/media/i2c/adv748x/adv748x-core.c | 19 ++++++------------- drivers/media/i2c/adv748x/adv748x.h | 1 - 2 files changed, 6 insertions(+), 14 deletions(-) diff --git a/drivers/media/i2c/adv748x/adv748x-core.c b/drivers/media/i2c/adv748x/adv748x-core.c index 252bdb28b18b..f57cd77a32fa 100644 --- a/drivers/media/i2c/adv748x/adv748x-core.c +++ b/drivers/media/i2c/adv748x/adv748x-core.c @@ -218,20 +218,13 @@ static int adv748x_write_regs(struct adv748x_state *state, { int ret; - while (regs->page != ADV748X_PAGE_EOR) { - if (regs->page == ADV748X_PAGE_WAIT) { - msleep(regs->value); - } else { - ret = adv748x_write(state, regs->page, regs->reg, - regs->value); - if (ret < 0) { - adv_err(state, - "Error regs page: 0x%02x reg: 0x%02x\n", - regs->page, regs->reg); - return ret; - } + for (; regs->page != ADV748X_PAGE_EOR; regs++) { + ret = adv748x_write(state, regs->page, regs->reg, regs->value); + if (ret < 0) { + adv_err(state, "Error regs page: 0x%02x reg: 0x%02x\n", + regs->page, regs->reg); + return ret; } - regs++; } return 0; diff --git a/drivers/media/i2c/adv748x/adv748x.h b/drivers/media/i2c/adv748x/adv748x.h index 2f8d751cfbb0..5042f9e94aee 100644 --- a/drivers/media/i2c/adv748x/adv748x.h +++ b/drivers/media/i2c/adv748x/adv748x.h @@ -39,7 +39,6 @@ enum adv748x_page { ADV748X_PAGE_MAX, /* Fake pages for register sequences */ - ADV748X_PAGE_WAIT, /* Wait x msec */ ADV748X_PAGE_EOR, /* End Mark */ };