lkml.org 
[lkml]   [2022]   [Nov]   [30]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [resend, PATCH net-next v1 2/2] net: thunderbolt: Use separate header data type for the Rx
On Wed, Nov 30, 2022 at 12:51:06PM +0200, Andy Shevchenko wrote:
> On Wed, Nov 30, 2022 at 09:46:16AM +0200, Mika Westerberg wrote:
> > On Tue, Nov 29, 2022 at 06:13:59PM +0200, Andy Shevchenko wrote:
> > > The same data type structure is used for bitwise operations and
> > > regular ones. It makes sparse unhappy, for example:
> > >
> > > .../thunderbolt.c:718:23: warning: cast to restricted __le32
> > >
> > > .../thunderbolt.c:953:23: warning: incorrect type in initializer (different base types)
> > > .../thunderbolt.c:953:23: expected restricted __wsum [usertype] wsum
> > > .../thunderbolt.c:953:23: got restricted __be32 [usertype]
> > >
> > > Split the header to bitwise one and specific for Rx to make sparse
> > > happy. Assure the layout by involving static_assert() against size
> > > and offsets of the member of the structures.
>
> > I would much rather keep the humans reading this happy than add 20+
> > lines just to silence a tool. Unless this of course is some kind of a
> > real bug.
>
> Actually, changing types to bitwise ones reduces the sparse noise
> (I will double check this) without reducing readability.
> Would it be accepted?

Sure if it makes it more readable and does not add too many lines :)

\
 
 \ /
  Last update: 2022-11-30 12:11    [W:0.072 / U:0.188 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site