Messages in this thread | | | Date | Tue, 30 Aug 2022 10:49:34 +0200 | From | Greg Kroah-Hartman <> | Subject | Re: [PATCH v2 4/4] serial: Add kserial_rs485 to avoid wasted space due to .padding |
| |
On Tue, Aug 30, 2022 at 10:29:56AM +0300, Ilpo Järvinen wrote: > The struct serial_rs485 has a .padding field to make uapi updates > easier. It wastes space, however. Create struct kserial_rs485 which is > a kerner counterpart w/o padding.
"kernel"?
And what is the size difference now?
> +/** > + * struct kserial_rs485 - kernel-side struct for controlling RS485 settings. > + * @flags: RS485 feature flags > + * @delay_rts_before_send: Delay before send (milliseconds) > + * @delay_rts_after_send: Delay after send (milliseconds) > + * @addr_recv: Receive filter for RS485 addressing mode > + * (used only when %SER_RS485_ADDR_RECV is set). > + * @addr_dest: Destination address for RS485 addressing mode > + * (used only when %SER_RS485_ADDR_DEST is set). > + * > + * Must match with struct serial_rs485 in include/uapi/linux/serial.h excluding > + * the padding.
Why must this match? And how is that going to be enforced?
> + */ > +struct kserial_rs485 { > + __u32 flags; > + __u32 delay_rts_before_send; > + __u32 delay_rts_after_send; > + struct { > + __u8 addr_recv; > + __u8 addr_dest; > + };
As this is an in-kernel structure, this should be "u32" and "u8" now.
thanks,
greg k-h
| |