[PATCH 07/10] drm/tinydrm: Move tinydrm_machine_little_endian()

Noralf Trønnes noralf at tronnes.org
Thu Jul 18 12:20:46 UTC 2019



Den 17.07.2019 22.09, skrev David Lechner:
> On 7/17/19 6:58 AM, Noralf Trønnes wrote:
>> The tinydrm helper is going away so move it into the only user mipi-dbi.
>>
>> Signed-off-by: Noralf Trønnes <noralf at tronnes.org>
>> ---
>>   drivers/gpu/drm/tinydrm/mipi-dbi.c    | 15 ++++++++++++---
>>   include/drm/tinydrm/tinydrm-helpers.h | 15 ---------------
>>   2 files changed, 12 insertions(+), 18 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/tinydrm/mipi-dbi.c
>> b/drivers/gpu/drm/tinydrm/mipi-dbi.c
>> index 6a8f2d66377f..73db287e5c52 100644
>> --- a/drivers/gpu/drm/tinydrm/mipi-dbi.c
>> +++ b/drivers/gpu/drm/tinydrm/mipi-dbi.c
>> @@ -628,6 +628,15 @@ u32 mipi_dbi_spi_cmd_max_speed(struct spi_device
>> *spi, size_t len)
>>   }
>>   EXPORT_SYMBOL(mipi_dbi_spi_cmd_max_speed);
>>   +static bool mipi_dbi_machine_little_endian(void)
>> +{
>> +#if defined(__LITTLE_ENDIAN)
>> +    return true;
>> +#else
>> +    return false;
>> +#endif
>> +}
>> +
> 
> I'm kind of surprised that there isn't something like this elsewhere
> in the kernel already. The way this function is being used it kind of
> seems like it should be static __always_inline (or a macro) so that
> the compiler can do a better job optimizing the code (although it is
> a very minor improvement).

Ideally this should be in the core somewhere, but I don't want to spend
more time on refactoring. I have a usb driver that I want to write and
I've waited nearly 2 years now. I got sucked into a giant refactoring
hole :-)

Doing a quick scan I found virtio_legacy_is_little_endian() which does
the same, but it's clearly virtio related and I don't want to drag in that.

Noralf.


More information about the dri-devel mailing list