From patchwork Mon Jul 9 15:41:14 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Akinobu Mita X-Patchwork-Id: 10514957 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 254F1600CA for ; Mon, 9 Jul 2018 15:41:41 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1499928DF7 for ; Mon, 9 Jul 2018 15:41:41 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 086C228E05; Mon, 9 Jul 2018 15:41:41 +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, FREEMAIL_FROM, 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 9E9B128DF7 for ; Mon, 9 Jul 2018 15:41:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933605AbeGIPlj (ORCPT ); Mon, 9 Jul 2018 11:41:39 -0400 Received: from mail-pl0-f68.google.com ([209.85.160.68]:45274 "EHLO mail-pl0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932699AbeGIPlh (ORCPT ); Mon, 9 Jul 2018 11:41:37 -0400 Received: by mail-pl0-f68.google.com with SMTP id a17-v6so376647plm.12; Mon, 09 Jul 2018 08:41:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=mp3GMjUseJ058wwbdMUmYWhvx5kCyfuBtPZxYzBdlkQ=; b=cb5+9HqPEpf6K2k8In9X9OB+JBnSU33VyDCUEt1Q4Jnmo1NhpZlgnowAn6J6oWas4p nmNHfNCfZ3Z8wmazizEmLFj5F72XQuMzWq/cWBK5cDZbnkmWOnUX1RFkwE7M7XDneDQP SdHGOdp24XzwOqNO28u6T0d+HFCgxr03uAzTHyW32mkbAMvRk933s5kvLlUrG/05Qe9y 2IgWzsge6HiU+tMGAiUGjjhGWawyvXv2pMElSUcD44DEVTuIAPJT73p4PH8CN+KzCsMh KrkclojJ1h6/o7aRiRO2hj8GaZufNcrjMeeTdP8NFITXJCib4Y3AYy83NJBDK+PfxwH1 G0sQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=mp3GMjUseJ058wwbdMUmYWhvx5kCyfuBtPZxYzBdlkQ=; b=jszYim3o6jlOSy8+qm2IaFLcNty/+VJ2+2mU9aHW8qliwwGj+O7ODFJLwTUzjnFQZl tGuSy2zOsS06yFQJXPo4ieX68xsS6L3JQ2t8pQi5cnxRtw1yMUF3Xd5lNi2CFZoEQ55T Z0z1rtiUOPyiM4rxBnaQLpG3bXHWMTPP3qxuUsqwYi3010HSoIwSxDvmp38C2Fj2+Fj0 Ss9E6dn/qhYcGEXrJr/sJV3Bx2osXjPDhzUVqCJ/5okJXSDuPPHsTG8z0O5yjI0OvZhD 8C23xyiBhND7za1ovTfHk0gQ8Tki3vEgt9zyPL7YhmMsGA9qDsJus+oG51vUsa4hVDqA KUOQ== X-Gm-Message-State: APt69E02LaKvD02J6QUILwX6L9TaEfIRhYPjA/ljK6gwt8JUnQHVC+5z /5fTmg+pcTW0fiCT5uKKgugA6w== X-Google-Smtp-Source: AAOMgpcsep9W5f85mfjteDUj4+dRhOmNADPuq7+6jRXahfYC2urUthEFTNlrO+NDYQt/rFyOc/i7CA== X-Received: by 2002:a17:902:1081:: with SMTP id c1-v6mr21031634pla.153.1531150896958; Mon, 09 Jul 2018 08:41:36 -0700 (PDT) Received: from localhost.localdomain ([240f:34:212d:1:3963:3c46:f9cd:fcc]) by smtp.gmail.com with ESMTPSA id g124-v6sm24980981pfb.5.2018.07.09.08.41.33 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 09 Jul 2018 08:41:36 -0700 (PDT) From: Akinobu Mita To: linux-media@vger.kernel.org, linux-i2c@vger.kernel.org Cc: Akinobu Mita , Peter Rosin , Sebastian Reichel , Wolfram Sang , Jacopo Mondi , Laurent Pinchart , Hans Verkuil , Sakari Ailus , Mauro Carvalho Chehab Subject: [PATCH -next v3 2/2] media: ov772x: use SCCB helpers Date: Tue, 10 Jul 2018 00:41:14 +0900 Message-Id: <1531150874-4595-3-git-send-email-akinobu.mita@gmail.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1531150874-4595-1-git-send-email-akinobu.mita@gmail.com> References: <1531150874-4595-1-git-send-email-akinobu.mita@gmail.com> Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Convert ov772x register access to use SCCB helpers. Cc: Peter Rosin Cc: Sebastian Reichel Cc: Wolfram Sang Cc: Jacopo Mondi Cc: Laurent Pinchart Cc: Hans Verkuil Cc: Sakari Ailus Cc: Mauro Carvalho Chehab Signed-off-by: Akinobu Mita Reviewed-by: Sebastian Reichel --- drivers/media/i2c/ov772x.c | 20 +++++--------------- 1 file changed, 5 insertions(+), 15 deletions(-) diff --git a/drivers/media/i2c/ov772x.c b/drivers/media/i2c/ov772x.c index 7158c31..8a9a9ca 100644 --- a/drivers/media/i2c/ov772x.c +++ b/drivers/media/i2c/ov772x.c @@ -17,7 +17,7 @@ #include #include #include -#include +#include #include #include #include @@ -551,22 +551,12 @@ static struct ov772x_priv *to_ov772x(struct v4l2_subdev *sd) static int ov772x_read(struct i2c_client *client, u8 addr) { - int ret; - u8 val; - - ret = i2c_master_send(client, &addr, 1); - if (ret < 0) - return ret; - ret = i2c_master_recv(client, &val, 1); - if (ret < 0) - return ret; - - return val; + return sccb_read_byte(client, addr); } static inline int ov772x_write(struct i2c_client *client, u8 addr, u8 value) { - return i2c_smbus_write_byte_data(client, addr, value); + return sccb_write_byte(client, addr, value); } static int ov772x_mask_set(struct i2c_client *client, u8 command, u8 mask, @@ -1395,9 +1385,9 @@ static int ov772x_probe(struct i2c_client *client, return -EINVAL; } - if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_BYTE_DATA)) { + if (!sccb_is_available(adapter)) { dev_err(&adapter->dev, - "I2C-Adapter doesn't support SMBUS_BYTE_DATA\n"); + "I2C-Adapter doesn't support SCCB\n"); return -EIO; }