lkml.org 
[lkml]   [2020]   [Sep]   [16]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH v2 1/3] soundwire: qcom: clear BIT FIELDs before value set.
On 16-09-20, 09:36, Pierre-Louis Bossart wrote:
>
>
> On 9/16/20 9:29 AM, Vinod Koul wrote:
> > On 16-09-20, 08:18, Pierre-Louis Bossart wrote:
> > >
> > > > > According to usage (bitfields.h) of REG_FIELDS,
> > > > > Modify is:
> > > > > reg &= ~REG_FIELD_C;
> > > > > reg |= FIELD_PREP(REG_FIELD_C, c);
> > >
> > >
> > > if this is indeed the case, all the code in cadence_master.c is also broken,
> > > e.g:
> > >
> > > dpn_config = cdns_readl(cdns, dpn_config_off);
> > >
> > > dpn_config |= FIELD_PREP(CDNS_DPN_CONFIG_WL, (p_params->bps - 1));
> > > dpn_config |= FIELD_PREP(CDNS_DPN_CONFIG_PORT_FLOW, p_params->flow_mode);
> > > dpn_config |= FIELD_PREP(CDNS_DPN_CONFIG_PORT_DAT, p_params->data_mode);
> >
> > This should be replaced with u32_replace_bits(), i am sending the fix
>
> wondering if we should replace all uses of FIELD_PREP with either
> u32_insert_bits() or u32_encode_bits() then?

That might be overkill as in the rest of the cases we have

foo = FIELD_PREP();
foo |= FIELD_PREP();

so the first one would set the bitfield and clear the rest

Thanks
--
~Vinod

\
 
 \ /
  Last update: 2020-09-16 21:06    [W:1.864 / U:0.592 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site