[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <35ba7e49-ac43-4d05-7258-3ac039d33e59@egil-hjelmeland.no>
Date: Thu, 19 Oct 2017 16:51:11 +0200
From: Egil Hjelmeland <privat@...l-hjelmeland.no>
To: Andrew Lunn <andrew@...n.ch>,
Vivien Didelot <vivien.didelot@...oirfairelinux.com>
Cc: f.fainelli@...il.com, netdev@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH v2 net-next 1/2] net: dsa: lan9303: Add port_fast_age and
port_fdb_dump methods
On 19. okt. 2017 16:15, Andrew Lunn wrote:
>>> +/* 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
>
Without cast
int port = *ctx;
... I can not compile. Neither arm-v5te-linux-gnueabi-gcc 4.7.2 or
native 64bit gcc 6.3.0.
So I feel it is safe to do as Vivien suggest.
Egil
Powered by blists - more mailing lists