Re: [PATCH v3 3/3] PCI/NPEM: Add _DSM PCIe SSD status LED management

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, Jul 05, 2024 at 04:07:59PM +0200, Lukas Wunner wrote:
> On Fri, Jul 05, 2024 at 06:04:39AM -0700, Christoph Hellwig wrote:
> > > +struct dsm_output {
> > > +	u16 status;
> > > +	u8 function_specific_err;
> > > +	u8 vendor_specific_err;
> > > +	u32 state;
> > > +} __packed;
> > 
> > This structure is naturally aligned, so no need for the __packed.
> 
> Isn't the compiler free to insert padding wherever it sees fit?

In terms of the standard: yes.  It could even reorder members.  In
terms of not breaking the Linux kernel (or other low-level software)
left, right and center: no.

> structs passed to ACPI firmware would no longer comply with the
> spec-prescribed layout then and declaring them __packed seems to be
> the only way to ensure that doesn't happen.

Take a look at just about any driver, file system or network protocol.





[Index of Archives]     [DMA Engine]     [Linux Coverity]     [Linux USB]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Greybus]

  Powered by Linux