From patchwork Fri Jan 11 15:43:44 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kieran Bingham X-Patchwork-Id: 10758313 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 8643717D2 for ; Fri, 11 Jan 2019 15:44:35 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7334729748 for ; Fri, 11 Jan 2019 15:44:35 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 677EC29D58; Fri, 11 Jan 2019 15:44:35 +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 5F0A429748 for ; Fri, 11 Jan 2019 15:44:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731856AbfAKPod (ORCPT ); Fri, 11 Jan 2019 10:44:33 -0500 Received: from perceval.ideasonboard.com ([213.167.242.64]:59984 "EHLO perceval.ideasonboard.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730291AbfAKPod (ORCPT ); Fri, 11 Jan 2019 10:44:33 -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 832C553E; Fri, 11 Jan 2019 16:44:31 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1547221471; bh=4s+Ws+SAkl0QGeTpZNiLBCVce3enPIAmdzkV3LkC86Q=; h=From:To:Cc:Subject:Date:From; b=HOie09frxRd5hCkaUTd3XXsl0l7V08wd6ev7Wf5pnMCEIQBQ724ex5kvA/Ov4KR8h W2xppSoTqWnd7eJsAAJOjoPfcoy8UiK9i+1lGHew/JeKiOd+xKJJh6Yzf8BRMIzeY5 8EKP62BxMfpfZPRoGC+0Fr1cP8XsrJb1j5MTTeBg= From: Kieran Bingham To: linux-media@vger.kernel.org, linux-renesas-soc@vger.kernel.org, Kieran Bingham Cc: Koji Matsuoka , Steve Longerbeam Subject: [PATCH 1/2] media: i2c: adv7482: Fix wait procedure usleep_range from msleep Date: Fri, 11 Jan 2019 15:43:44 +0000 Message-Id: <20190111154345.29145-1-kieran.bingham+renesas@ideasonboard.com> X-Mailer: git-send-email 2.17.1 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 From: Koji Matsuoka By Documentation/timers/timers-howto.txt, when waiting 20ms from 10us, it is correct to use usleep_range. this patch corrects it. Signed-off-by: Koji Matsuoka (cherry picked from horms/renesas-bsp commit af0cdba377bc8a784cdae6a77fb7a822cebc7083) Signed-off-by: Steve Longerbeam --- drivers/media/i2c/adv748x/adv748x-core.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/media/i2c/adv748x/adv748x-core.c b/drivers/media/i2c/adv748x/adv748x-core.c index 64eb1bfda581..097e5c3a8e7e 100644 --- a/drivers/media/i2c/adv748x/adv748x-core.c +++ b/drivers/media/i2c/adv748x/adv748x-core.c @@ -273,7 +273,8 @@ static int adv748x_write_regs(struct adv748x_state *state, while (regs->page != ADV748X_PAGE_EOR) { if (regs->page == ADV748X_PAGE_WAIT) { - msleep(regs->value); + usleep_range(regs->value * 1000, + (regs->value * 1000) + 1000); } else { ret = adv748x_write(state, regs->page, regs->reg, regs->value); From patchwork Fri Jan 11 15:43:45 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kieran Bingham X-Patchwork-Id: 10758315 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 BA0CE1869 for ; Fri, 11 Jan 2019 15:44:35 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id AA3F629829 for ; Fri, 11 Jan 2019 15:44:35 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9E55929D58; Fri, 11 Jan 2019 15:44:35 +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 0167A29829 for ; Fri, 11 Jan 2019 15:44:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730291AbfAKPoe (ORCPT ); Fri, 11 Jan 2019 10:44:34 -0500 Received: from perceval.ideasonboard.com ([213.167.242.64]:59998 "EHLO perceval.ideasonboard.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730891AbfAKPoe (ORCPT ); Fri, 11 Jan 2019 10:44:34 -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 EAFC3547; Fri, 11 Jan 2019 16:44:31 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1547221472; bh=VdSpkWvBGePH7GodXkaYOKi1FH9cMGsH7ZJ1VvznOV0=; h=From:To:Cc:Subject:Date:From; b=whyKA9WukzjNULT7oDAkwF8jubUGDMHNPxg0RjLyaBoDuoo3WW9StWai8rkEuW+PR Kk4GtN/wfAtzen0SoT53aPG9Mqei0h/p7bpQ05jgO4GYHLIJlnl6GzWvL2lxwt81M7 RdBoONRQAdxPkV4fE9cBqGILUamPlqsC4luQHTig= From: Kieran Bingham To: linux-media@vger.kernel.org, linux-renesas-soc@vger.kernel.org, Kieran Bingham Cc: Steve Longerbeam Subject: [PATCH 2/2] media: i2c: adv748x: Use devm to allocate the device struct Date: Fri, 11 Jan 2019 15:43:45 +0000 Message-Id: <20190111154345.29145-2-kieran.bingham+renesas@ideasonboard.com> X-Mailer: git-send-email 2.17.1 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 From: Steve Longerbeam Switch to devm_kzalloc() when allocating the adv748x device struct. Signed-off-by: Steve Longerbeam --- drivers/media/i2c/adv748x/adv748x-core.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/media/i2c/adv748x/adv748x-core.c b/drivers/media/i2c/adv748x/adv748x-core.c index 097e5c3a8e7e..4af2ae8fcc0a 100644 --- a/drivers/media/i2c/adv748x/adv748x-core.c +++ b/drivers/media/i2c/adv748x/adv748x-core.c @@ -774,7 +774,8 @@ static int adv748x_probe(struct i2c_client *client, if (!i2c_check_functionality(client->adapter, I2C_FUNC_SMBUS_BYTE_DATA)) return -EIO; - state = kzalloc(sizeof(struct adv748x_state), GFP_KERNEL); + state = devm_kzalloc(&client->dev, sizeof(struct adv748x_state), + GFP_KERNEL); if (!state) return -ENOMEM; @@ -861,7 +862,6 @@ static int adv748x_probe(struct i2c_client *client, adv748x_dt_cleanup(state); err_free_mutex: mutex_destroy(&state->mutex); - kfree(state); return ret; } @@ -880,8 +880,6 @@ static int adv748x_remove(struct i2c_client *client) adv748x_dt_cleanup(state); mutex_destroy(&state->mutex); - kfree(state); - return 0; }