[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <fae9811cf0404034b0da9d14fb088df1@huawei.com>
Date: Wed, 16 Jun 2021 06:17:18 +0000
From: liweihang <liweihang@...wei.com>
To: David Laight <David.Laight@...LAB.COM>,
"davem@...emloft.net" <davem@...emloft.net>,
"kuba@...nel.org" <kuba@...nel.org>,
"andrew@...n.ch" <andrew@...n.ch>,
"hkallweit1@...il.com" <hkallweit1@...il.com>
CC: "netdev@...r.kernel.org" <netdev@...r.kernel.org>,
Linuxarm <linuxarm@...wei.com>,
liangwenpeng <liangwenpeng@...wei.com>,
"quentin.schulz@...tlin.com" <quentin.schulz@...tlin.com>,
"antoine.tenart@...tlin.com" <antoine.tenart@...tlin.com>
Subject: Re: [PATCH net-next 8/8] net: phy: use '__packed' instead of
'__attribute__((__packed__))'
On 2021/6/14 22:28, David Laight wrote:
> From: Weihang Li
>> Sent: 11 June 2021 07:37
>>
>> Prefer __packed over __attribute__((__packed__)).
>>
>> Signed-off-by: Wenpeng Liang <liangwenpeng@...wei.com>
>> Signed-off-by: Weihang Li <liweihang@...wei.com>
>> ---
>> drivers/net/phy/mscc/mscc_ptp.h | 4 ++--
>> 1 file changed, 2 insertions(+), 2 deletions(-)
>>
>> diff --git a/drivers/net/phy/mscc/mscc_ptp.h b/drivers/net/phy/mscc/mscc_ptp.h
>> index da34653..01f78b4 100644
> ...
>> /* Represents an entry in the timestamping FIFO */
>> struct vsc85xx_ts_fifo {
>> u32 ns;
>> u64 secs:48;
>> u8 sig[16];
>> -} __attribute__((__packed__));
>> +} __packed;
>
> Hmmmm I'd take some convincing that 'u64 secs:48' is anything
> other than 'implementation defined'.
> So using it to map a hardware structure seems wrong.
>
> If this does map a hardware structure it ought to have
> 'endianness' annotations.
> If it doesn't then why the bitfield and why packed?
>
> David
>
> -
> Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK
> Registration No: 1397386 (Wales)
>
>
Hi David,
Thank you for your attention. You are right, I found the contents of structure
vsc85xx_ts_fifo is got from hardware. But I'm not sure if any issues or warnings
will be introduced into this driver after just changing 'u64 secs:48' to '__be64
secs:48'.
Let's keep this patch as it is. I cc the developers of the code, maybe they
didn't realize it or had some reasons to define it like that.
Thanks
Weihang
Powered by blists - more mailing lists