[PATCH v2 2/2] drm/bridge/synopsys: dsi: handle endianness correctly in dw_mipi_dsi_write()

Brian Norris briannorris at chromium.org
Tue Jan 16 10:57:37 PST 2018


On Tue, Jan 16, 2018 at 12:22:52PM +0530, Archit Taneja wrote:
> On 01/10/2018 08:03 PM, Andrzej Hajda wrote:
> >On 09.01.2018 21:32, Brian Norris wrote:
> >>@@ -386,9 +386,9 @@ static int dw_mipi_dsi_write(struct dw_mipi_dsi *dsi,
> >>  		}
> >>  	}
> >>-	remainder = 0;
> >>-	memcpy(&remainder, packet->header, sizeof(packet->header));
> >>-	return dw_mipi_dsi_gen_pkt_hdr_write(dsi, remainder);
> >>+	word = 0;
> >>+	memcpy(&word, packet->header, sizeof(packet->header));
> >>+	return dw_mipi_dsi_gen_pkt_hdr_write(dsi, le32_to_cpu(word));
> >
> >You could create and use appropriate helper, lets say:
> >
> >u32 le_to_cpup(const u8 *p, int count)
> >{
> >     __le32 r = 0;
> >
> >     memcpy(&r, p, count);
> >     return le32_to_cpu(r);
> >}

I suppose that could be a small improvement, for future consideration,
if this gets too out of hand.

> >With or without this change:
> >Reviewed-by: Andrzej Hajda <a.hajda at samsung.com>

Thanks!

> Queued to drm-misc-next as is.

Thanks!

Brian



More information about the Linux-rockchip mailing list