From patchwork Mon Feb 26 14:28:08 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mauro Carvalho Chehab X-Patchwork-Id: 10242457 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 41F16602A0 for ; Mon, 26 Feb 2018 14:28:17 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 330852A030 for ; Mon, 26 Feb 2018 14:28:17 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 27C542A042; Mon, 26 Feb 2018 14:28:17 +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 B61CF2A030 for ; Mon, 26 Feb 2018 14:28:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753346AbeBZO2P (ORCPT ); Mon, 26 Feb 2018 09:28:15 -0500 Received: from osg.samsung.com ([64.30.133.232]:44286 "EHLO osg.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753298AbeBZO2N (ORCPT ); Mon, 26 Feb 2018 09:28:13 -0500 Received: from localhost (localhost [127.0.0.1]) by osg.samsung.com (Postfix) with ESMTP id 861A62425B; Mon, 26 Feb 2018 06:28:13 -0800 (PST) X-Virus-Scanned: Debian amavisd-new at dev.s-opensource.com X-Amavis-Alert: BAD HEADER SECTION, Duplicate header field: "References" Received: from osg.samsung.com ([127.0.0.1]) by localhost (localhost [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id FZCBVEapPvXq; Mon, 26 Feb 2018 06:28:11 -0800 (PST) Received: from smtp.s-opensource.com (177.41.102.20.dynamic.adsl.gvt.net.br [177.41.102.20]) by osg.samsung.com (Postfix) with ESMTPSA id 0C11224242; Mon, 26 Feb 2018 06:28:11 -0800 (PST) Received: from mchehab by smtp.s-opensource.com with local (Exim 4.89) (envelope-from ) id 1eqJlA-0005Yr-MX; Mon, 26 Feb 2018 09:28:08 -0500 From: Mauro Carvalho Chehab Cc: Mauro Carvalho Chehab , Linux Media Mailing List , Mauro Carvalho Chehab , Jacopo Mondi , Laurent Pinchart , Hans Verkuil , Guennadi Liakhovetski , Bhumika Goyal Subject: [PATCH 2/2] media: tw9910: solve coding style issues Date: Mon, 26 Feb 2018 09:28:08 -0500 Message-Id: <876e32e5dd6e08320288862440e3e8a9542b5d9b.1519655282.git.mchehab@s-opensource.com> X-Mailer: git-send-email 2.14.3 In-Reply-To: <054d8830ac07d865c2973971af29b7caad593914.1519655282.git.mchehab@s-opensource.com> References: <054d8830ac07d865c2973971af29b7caad593914.1519655282.git.mchehab@s-opensource.com> In-Reply-To: <054d8830ac07d865c2973971af29b7caad593914.1519655282.git.mchehab@s-opensource.com> References: <054d8830ac07d865c2973971af29b7caad593914.1519655282.git.mchehab@s-opensource.com> To: unlisted-recipients:; (no To-header on input) 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 As we're adding this as a new driver, make checkpatch happier by solving several style issues, using --fix-inplace at strict mode. Some issues required manual work. Signed-off-by: Mauro Carvalho Chehab --- drivers/media/i2c/tw9910.c | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/drivers/media/i2c/tw9910.c b/drivers/media/i2c/tw9910.c index 96792df45fb0..cc5d383fc6b8 100644 --- a/drivers/media/i2c/tw9910.c +++ b/drivers/media/i2c/tw9910.c @@ -339,6 +339,7 @@ static int tw9910_mask_set(struct i2c_client *client, u8 command, u8 mask, u8 set) { s32 val = i2c_smbus_read_byte_data(client, command); + if (val < 0) return val; @@ -389,7 +390,7 @@ static int tw9910_set_hsync(struct i2c_client *client) /* So far only revisions 0 and 1 have been seen */ /* bit 2 - 0 */ - if (1 == priv->revision) + if (priv->revision == 1) ret = tw9910_mask_set(client, HSLOWCTL, 0x77, (HSYNC_START & 0x0007) << 4 | (HSYNC_END & 0x0007)); @@ -511,10 +512,10 @@ static int tw9910_s_std(struct v4l2_subdev *sd, v4l2_std_id norm) { struct i2c_client *client = v4l2_get_subdevdata(sd); struct tw9910_priv *priv = to_tw9910(client); - const unsigned hact = 720; - const unsigned hdelay = 15; - unsigned vact; - unsigned vdelay; + const unsigned int hact = 720; + const unsigned int hdelay = 15; + unsigned int vact; + unsigned int vdelay; int ret; if (!(norm & (V4L2_STD_NTSC | V4L2_STD_PAL))) @@ -532,16 +533,16 @@ static int tw9910_s_std(struct v4l2_subdev *sd, v4l2_std_id norm) } if (!ret) ret = i2c_smbus_write_byte_data(client, CROP_HI, - ((vdelay >> 2) & 0xc0) | + ((vdelay >> 2) & 0xc0) | ((vact >> 4) & 0x30) | ((hdelay >> 6) & 0x0c) | ((hact >> 8) & 0x03)); if (!ret) ret = i2c_smbus_write_byte_data(client, VDELAY_LO, - vdelay & 0xff); + vdelay & 0xff); if (!ret) ret = i2c_smbus_write_byte_data(client, VACTIVE_LO, - vact & 0xff); + vact & 0xff); return ret; } @@ -731,7 +732,7 @@ static int tw9910_set_frame(struct v4l2_subdev *sd, u32 *width, u32 *height) } static int tw9910_get_selection(struct v4l2_subdev *sd, - struct v4l2_subdev_pad_config *cfg, + struct v4l2_subdev_pad_config *cfg, struct v4l2_subdev_selection *sel) { struct i2c_client *client = v4l2_get_subdevdata(sd); @@ -756,7 +757,7 @@ static int tw9910_get_selection(struct v4l2_subdev *sd, } static int tw9910_get_fmt(struct v4l2_subdev *sd, - struct v4l2_subdev_pad_config *cfg, + struct v4l2_subdev_pad_config *cfg, struct v4l2_subdev_format *format) { struct v4l2_mbus_framefmt *mf = &format->format; @@ -807,7 +808,7 @@ static int tw9910_s_fmt(struct v4l2_subdev *sd, } static int tw9910_set_fmt(struct v4l2_subdev *sd, - struct v4l2_subdev_pad_config *cfg, + struct v4l2_subdev_pad_config *cfg, struct v4l2_subdev_format *format) { struct v4l2_mbus_framefmt *mf = &format->format; @@ -818,9 +819,9 @@ static int tw9910_set_fmt(struct v4l2_subdev *sd, if (format->pad) return -EINVAL; - if (V4L2_FIELD_ANY == mf->field) { + if (mf->field == V4L2_FIELD_ANY) { mf->field = V4L2_FIELD_INTERLACED_BT; - } else if (V4L2_FIELD_INTERLACED_BT != mf->field) { + } else if (mf->field != V4L2_FIELD_INTERLACED_BT) { dev_err(&client->dev, "Field type %d invalid.\n", mf->field); return -EINVAL; } @@ -870,8 +871,7 @@ static int tw9910_video_probe(struct i2c_client *client) priv->revision = GET_REV(id); id = GET_ID(id); - if (0x0B != id || - 0x01 < priv->revision) { + if (id != 0x0b || priv->revision > 0x01) { dev_err(&client->dev, "Product ID error %x:%x\n", id, priv->revision); @@ -899,7 +899,7 @@ static const struct v4l2_subdev_core_ops tw9910_subdev_core_ops = { }; static int tw9910_enum_mbus_code(struct v4l2_subdev *sd, - struct v4l2_subdev_pad_config *cfg, + struct v4l2_subdev_pad_config *cfg, struct v4l2_subdev_mbus_code_enum *code) { if (code->pad || code->index)