Messages in this thread | | | Date | Wed, 7 Aug 2019 18:08:09 +0100 | From | Sudeep Holla <> | Subject | Re: [PATCH] firmware: arm_scmi: Use {get,put}_unaligned_le32 accessors |
| |
On Wed, Aug 07, 2019 at 03:18:59PM +0000, David Laight wrote: > From: Sudeep Holla > > Sent: 07 August 2019 14:01 > > > > Instead of type-casting the {tx,rx}.buf all over the place while > > accessing them to read/write __le32 from/to the firmware, let's use > > the nice existing {get,put}_unaligned_le32 accessors to hide all the > > type cast ugliness. > > Why the 'unaligned' accessors? >
Since the firmware run in LE, we do byte-swapping anyways.
> > - *(__le32 *)t->tx.buf = cpu_to_le32(id); > > + put_unaligned_le32(id, t->tx.buf); >
If you look at the generic definition for put_unaligned_le32, it's exactly the same as what I am replacing with the call. So nothing changes IIUC. In fact, I see that all the helper in unaligned/access_ok.h just do the byte-swapping.
> These will be expensive if the cpu doesn't support them.
The SCMI is currently used only on ARM platforms which have HAVE_EFFICIENT_UNALIGNED_ACCESS defined.
-- Regards, Sudeep
| |