X-GM-THRID: 6672221168538222592 Date: Mon, 25 Mar 2019 00:24:39 -0700 (PDT) From: sanjana99reddy99@gmail.com To: outreachy-kernel Message-Id: <89a0de65-9f08-46a2-b806-ba153b07ffec@googlegroups.com> In-Reply-To: References: <20190325070536.5463-1-sanjana99reddy99@gmail.com> Subject: Re: [Outreachy kernel] [PATCH] staging: sm750fb: ddk750_chip.c: Prefer using the BIT macro MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="----=_Part_1457_692574114.1553498679327" X-Google-Token: ELeE4uQFcQF88tU6sI40 X-Google-IP: 123.201.105.41 ------=_Part_1457_692574114.1553498679327 Content-Type: multipart/alternative; boundary="----=_Part_1458_1875913356.1553498679328" ------=_Part_1458_1875913356.1553498679328 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit On Monday, March 25, 2019 at 12:41:16 PM UTC+5:30, Julia Lawall wrote: > > > > On Mon, 25 Mar 2019, Sanjana Sanikommu wrote: > > > Challenge suggested by coccinelle. > > > > Replace bit shifting on 1 with the BIT(x) macro. > > Coccinelle script: > > > > @@ > > constant c; > > @@ > > > > -1 << c > > +BIT(c) > > > > Signed-off-by: Sanjana Sanikommu > > > --- > > drivers/staging/sm750fb/ddk750_chip.c | 2 +- > > 1 file changed, 1 insertion(+), 1 deletion(-) > > > > diff --git a/drivers/staging/sm750fb/ddk750_chip.c > b/drivers/staging/sm750fb/ddk750_chip.c > > index 4c1f00f551da..5690fb46e095 100644 > > --- a/drivers/staging/sm750fb/ddk750_chip.c > > +++ b/drivers/staging/sm750fb/ddk750_chip.c > > @@ -45,7 +45,7 @@ static unsigned int get_mxclk_freq(void) > > OD = (pll_reg & PLL_CTRL_OD_MASK) >> PLL_CTRL_OD_SHIFT; > > POD = (pll_reg & PLL_CTRL_POD_MASK) >> PLL_CTRL_POD_SHIFT; > > > > - return DEFAULT_INPUT_CLOCK * M / N / (1 << OD) / (1 << POD); > > + return DEFAULT_INPUT_CLOCK * M / N / (BIT(OD)) / (BIT(POD)); > > You don't need the parentheses around the call to BIT. BIT will take care > of it. > Sure I would change it :) Sanjana > > julia > > > } > > > > /* > > -- > > 2.17.1 > > > > -- > > You received this message because you are subscribed to the Google > Groups "outreachy-kernel" group. > > To unsubscribe from this group and stop receiving emails from it, send > an email to outreachy-kern...@googlegroups.com . > > To post to this group, send email to outreach...@googlegroups.com > . > > To view this discussion on the web visit > https://groups.google.com/d/msgid/outreachy-kernel/20190325070536.5463-1-sanjana99reddy99%40gmail.com. > > > For more options, visit https://groups.google.com/d/optout. > > > ------=_Part_1458_1875913356.1553498679328 Content-Type: text/html; charset=utf-8 Content-Transfer-Encoding: quoted-printable


On Monday, March 25, 2019 at 12:41:16 PM UTC+5:30,= Julia Lawall wrote:


On Mon, 25 Mar 2019, Sanjana Sanikommu wrote:

> Challenge suggested by coccinelle.
>
> Replace bit shifting on 1 with the BIT(x) macro.
> Coccinelle script:
>
> @@
> constant c;
> @@
>
> -1 << c
> +BIT(c)
>
> Signed-off-by: Sanjana Sanikommu <sanjana9...@gmail.com>
> ---
> =C2=A0drivers/staging/sm750fb/ddk750_chip.c | 2 +-
> =C2=A01 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/staging/sm750fb/ddk750_chip.c b/drivers/= staging/sm750fb/ddk750_chip.c
> index 4c1f00f551da..5690fb46e095 100644
> --- a/drivers/staging/sm750fb/ddk750_chip.c
> +++ b/drivers/staging/sm750fb/ddk750_chip.c
> @@ -45,7 +45,7 @@ static unsigned int get_mxclk_freq(void)
> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0OD =3D (pll_= reg & PLL_CTRL_OD_MASK) >> PLL_CTRL_OD_SHIFT;
> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0POD =3D (pll= _reg & PLL_CTRL_POD_MASK) >> PLL_CTRL_POD_SHIFT;
>
> -=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0return DEFAULT_IN= PUT_CLOCK * M / N / (1 << OD) / (1 << POD);
> +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0return DEFAULT_IN= PUT_CLOCK * M / N / (BIT(OD)) / (BIT(POD));

You don't need the parentheses around the call to BIT. =C2=A0BIT wi= ll take care
of it.
=C2=A0
=C2=A0 =C2=A0Sure I would change it = :)
=C2=A0 Sanjana=C2=A0

julia

> =C2=A0}
>
> =C2=A0/*
> --
> 2.17.1
>
> --
> You received this message because you are subscribed to the Google= Groups "outreachy-kernel" group.
> To unsubscribe from this group and stop receiving emails from it, = send an email to outreachy-kern...@googlegroups.com.
> To post to this group, send email to outreach...@googlegroups.com<= /a>.
> To view this discussion on the web visit
https://groups.google= .com/d/msgid/outreachy-kernel/20190325070536.5463-1-sanjana9= 9reddy99%40gmail.com.
> For more options, visit https://groups.go= ogle.com/d/optout.
>
------=_Part_1458_1875913356.1553498679328-- ------=_Part_1457_692574114.1553498679327--