[PATCH V2] staging: fieldbus: anybus-s: force endiannes annotation

Sven Van Asbroeck thesven73 at gmail.com
Tue Apr 30 13:32:20 UTC 2019


On Tue, Apr 30, 2019 at 12:19 AM Al Viro <viro at zeniv.linux.org.uk> wrote:
>
> ... not that there's much sense keeping ->fieldbus_type in host-endian,
> while we are at it.

Interesting! Suppose we make device->fieldbus_type bus-endian.
Then the endinan-ness conversion either needs to happen in
bus_match() (and we'd have to convert endianness each time
this function is called).
Or, we make driver->fieldbus_type bus-endian also, then there
is no need for conversion... but the driver writer has to remember
to specify this in bus endianness:

static struct anybuss_client_driver profinet_driver = {
        .probe = ...,
        .fieldbus_type = endian convert?? (0x0089),
};

Which pushes bus implementation details onto the
client driver writer? Also, how to convert a constant
to a specific endianness in a static initializer?

You never make a remark without good reason, so what
am I overlooking?


More information about the devel mailing list