lkml.org 
[lkml]   [2017]   [Oct]   [19]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH v2 net-next 1/2] net: dsa: lan9303: Add port_fast_age and port_fdb_dump methods
> > +/* Clear learned (non-static) entry on given port */
> > +static void alr_loop_cb_del_port_learned(struct lan9303 *chip, u32 dat0,
> > + u32 dat1, int portmap, void *ctx)
> > +{
> > + int *port = ctx;
>
> You can get the value directly to make the line below more readable:
>
> int port = *(int *)ctx;

You have to be a bit careful with this. You often see people
submitting patches taking away casts for void * pointers.
If they do that here, it should at least not compile...

So maybe do it in two steps?

int * pport = ctx;
int port = *pport;

???
Andrew

\
 
 \ /
  Last update: 2017-10-22 17:25    [W:0.104 / U:0.360 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site