From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from relay.hostedemail.com (relay025.a.hostedemail.com [64.99.140.25]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id ABD302CA1 for ; Sat, 29 Jan 2022 16:37:32 +0000 (UTC) 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 Precedence: bulk X-Mailing-List: linux-staging@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: 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 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.