Re: [PATCH 2/5] thunderbolt: Obtain PCI slot number from DROM

From: Mika Westerberg
Date: Mon Sep 10 2018 - 05:52:16 EST


On Sun, Sep 09, 2018 at 11:42:01PM +0200, Lukas Wunner wrote:
> +struct tb_drom_entry_pci {
> + /* BYTES 0-1 */
> + struct tb_drom_entry_header header;
> + /* BYTE 2 */
> + u8 unknown:5;
> + u8 slot:3;
> + /* BYTES 3-10 are only present on PCIe upstream ports */
> +} __packed;

No need for __packed unless you absolutely are certain the compiler does
not do the right thing. When I submitted the network driver, David
Miller explained this to me and I ended up dropping those.

Also use of bitfields is something we should avoid when touching
hardware/firmware records because compiler here can do all sorts of
tricks.

I know the driver is currently using quite many of them but I think it
is good for the new code not to include them anymore.