Received: by 2002:a05:6a10:1a4d:0:0:0:0 with SMTP id nk13csp189534pxb; Mon, 31 Jan 2022 19:11:23 -0800 (PST) X-Google-Smtp-Source: ABdhPJxCY2OusJQOrUewYPEf9LxD4JL2s4oyfXhqeLLVa9ak4ujN79GlcbIWmYJLYiJFprbbnBsw X-Received: by 2002:a17:906:4789:: with SMTP id cw9mr19348631ejc.250.1643685083225; Mon, 31 Jan 2022 19:11:23 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643685083; cv=none; d=google.com; s=arc-20160816; b=VVId/KvbuRwWwg9L9uxLfLR4IzDSZTsMTmrtuY8KeusNP028bDf21994KBsN7zWrHt sDlkwXup4qknecockrhCe/Vkyd3zi6MQ6oi250UCxBBknXhLc7zYyyYcmJrUd9NABARy yioQiSzRt+84myAKO9/j9IDzPBmdluFJujhwQoB/a8lrzBND7jzNdJcgGzuvH/uMw+yy O4TGxMYZLYvyQrugH8iZ8eKcv/HAB5A59eNPO4OjJWpaYvJvo08U8dmrfXWUySseaNgg 9c1KoMi6ZJm0qBqaIKqjFWCYkmE2H5wQzdMP99UTzQXJfpkGWL92ZJ2I1O9jxsKJRs/0 +b5A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:date:cc:to:from:subject :message-id; bh=OG+bdnBtyCR8D1ptwgQoKdnu0fvZ216VITIdLn1a/eg=; b=YXVCMh1pHAhbyObNhEfqCTeB1Lt0M+7B39qtRyXy9FO+Sw28pfYl7Y5x4rKN/daeNh x2qDLFJGicDhPcZJrU5Z2ODL0Al62WZM1a+GeaylqeTmOZ3FPgFGqdyhhogvzXGIfK6/ HdpuCFKEi7ueKNIFkhLPL3ZQojTkFizHW2a20tSL+jz27TQlPUcXNSDL10uBXOiZeOrO jQdla9wZlkb672Er1hFjWXxB9ZKPS4BcsEuDkLVyzCvOkLzh6TJUy+XAhULJPSFkDoQw Obe86ujRtK0h4x69iwGd9TqHwd8OPhYHFo1ZQtbyyL1WYAqx8zMuiDr8/K/a5afyhro8 E72g== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id j13si8884970edw.594.2022.01.31.19.10.58; Mon, 31 Jan 2022 19:11:23 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1352744AbiA2Qh1 (ORCPT + 99 others); Sat, 29 Jan 2022 11:37:27 -0500 Received: from relay036.a.hostedemail.com ([64.99.140.36]:34737 "EHLO relay.hostedemail.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1352705AbiA2QhZ (ORCPT ); Sat, 29 Jan 2022 11:37:25 -0500 Received: from omf10.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay13.hostedemail.com (Postfix) with ESMTP id 0E75360C6F; Sat, 29 Jan 2022 16:37:12 +0000 (UTC) Received: from [HIDDEN] (Authenticated sender: joe@perches.com) by omf10.hostedemail.com (Postfix) with ESMTPA id A7ADA3C; Sat, 29 Jan 2022 16:37:00 +0000 (UTC) Message-ID: <17bc03b62ebb71ca8d80f0e7ad0c6a7a7ea96d0c.camel@perches.com> Subject: Re: [PATCH] staging: media: atomisp: Use BIT macro instead of left shifting From: Joe Perches To: Moses Christopher Bollavarapu , linux-media@vger.kernel.org, linux-staging@lists.linux.dev, linux-kernel@vger.kernel.org Cc: Mauro Carvalho Chehab , Sakari Ailus , Greg Kroah-Hartman , Hans Verkuil , Yizhuo , Laurent Pinchart , Tomi Valkeinen , Colin Ian King , Kaixu Xia , Baokun Li , Andy Shevchenko , Aditya Srivastava , Aline Santana Cordeiro , Tsuchiya Yuto , Yang Yingliang , Alan , Souptick Joarder , Dan Carpenter , Masahiro Yamada , Alexey Dobriyan , Ard Biesheuvel , "Rafael J. Wysocki" Date: Sat, 29 Jan 2022 08:36:59 -0800 In-Reply-To: <20220129113821.324180-1-mosescb.dev@gmail.com> References: <20220129113821.324180-1-mosescb.dev@gmail.com> Content-Type: text/plain; charset="ISO-8859-1" User-Agent: Evolution 3.40.4-1ubuntu2 MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Stat-Signature: f7hho91x7ghyxojz4sfacmj81jcsayi1 X-Rspamd-Server: rspamout04 X-Rspamd-Queue-Id: A7ADA3C X-Spam-Status: No, score=-3.39 X-Session-Marker: 6A6F6540706572636865732E636F6D X-Session-ID: U2FsdGVkX1/iKUfIN/lCXEcN3DWYYXRCadUaTK5AfDE= X-HE-Tag: 1643474220-22022 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sat, 2022-01-29 at 12:38 +0100, Moses Christopher Bollavarapu wrote: > There is a BIT(nr) macro available in Linux Kernel, > which does the same thing. > > Example: BIT(7) = (1UL << 7) [] > diff --git a/drivers/staging/media/atomisp/i2c/ov5693/atomisp-ov5693.c b/drivers/staging/media/atomisp/i2c/ov5693/atomisp-ov5693.c [] > @@ -548,7 +548,7 @@ static long __ov5693_set_exposure(struct v4l2_subdev *sd, int coarse_itg, > * The way is to write coarse_itg/2 to the reg, meanwhile write 2*hts > * to the reg. > */ > - if (coarse_itg > (1 << 15)) { > + if (coarse_itg > BIT(15)) { Not all uses of 1 left shift should be converted to BIT Especially when used with a non-bit value comparison test. This is a size and not a bit position so this is likely not appropriate. It'd probably be better as if (coarse_itg > 0x8000) or if (coarse_itg > 32768) or if (coarse_itg > SOME_CONSTANT_DEFINE) > diff --git a/drivers/staging/media/atomisp/pci/atomisp_compat_css20.c b/drivers/staging/media/atomisp/pci/atomisp_compat_css20.c [] > @@ -1913,11 +1913,11 @@ void atomisp_css_input_set_mode(struct atomisp_sub_device *asd, > &asd->stream_env[ATOMISP_INPUT_STREAM_GENERAL].stream_config; > s_config->mode = IA_CSS_INPUT_MODE_TPG; > s_config->source.tpg.mode = IA_CSS_TPG_MODE_CHECKERBOARD; > - s_config->source.tpg.x_mask = (1 << 4) - 1; > + s_config->source.tpg.x_mask = BIT(4) - 1; These should probably use GENMASK > diff --git a/drivers/staging/media/atomisp/pci/atomisp_v4l2.c b/drivers/staging/media/atomisp/pci/atomisp_v4l2.c [] > @@ -626,11 +626,11 @@ static int atomisp_mrfld_pre_power_down(struct atomisp_device *isp) > * IRQ, if so, waiting for it to be served > */ > pci_read_config_dword(pdev, PCI_INTERRUPT_CTRL, &irq); > - irq = irq & 1 << INTR_IIR; > + irq = irq & BIT(INTR_IIR); The rest seems sensible.