From mboxrd@z Thu Jan 1 00:00:00 1970 From: Geert Uytterhoeven Date: Tue, 23 Sep 2014 14:02:14 +0000 Subject: Re: [PATCH 1/6] V4L2: Add Renesas R-Car JPEG codec driver. Message-Id: List-Id: References: <1408452653-14067-1-git-send-email-mikhail.ulyanov@cogentembedded.com> <1408452653-14067-2-git-send-email-mikhail.ulyanov@cogentembedded.com> In-Reply-To: <1408452653-14067-2-git-send-email-mikhail.ulyanov@cogentembedded.com> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: Mikhail Ulyanov Cc: Mauro Carvalho Chehab , Simon Horman , Magnus Damm , Rob Herring , Pawel Moll , Mark Rutland , Laurent Pinchart , Linux-sh list , Linux Media Mailing List , "devicetree@vger.kernel.org" On Tue, Aug 19, 2014 at 2:50 PM, Mikhail Ulyanov wrote: > +static void put_short_be(unsigned long *p, u16 v) > +{ > + u16 *addr = (u16 *)*p; > + > + *addr = cpu_to_be16(v); > + *p += 2; > +} > + > +static void put_word_be(unsigned long *p, u32 v) > +{ > + u32 *addr = (u32 *)*p; > + > + *addr = cpu_to_be32(v); > + *p += 4; > +} Is the address in *p guaranteed to be aligned to 2 resp. 4 bytes? If not, you can use put_unaligned*(). Gr{oetje,eeting}s, Geert -- Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that. -- Linus Torvalds From mboxrd@z Thu Jan 1 00:00:00 1970 From: Geert Uytterhoeven Subject: Re: [PATCH 1/6] V4L2: Add Renesas R-Car JPEG codec driver. Date: Tue, 23 Sep 2014 16:02:14 +0200 Message-ID: References: <1408452653-14067-1-git-send-email-mikhail.ulyanov@cogentembedded.com> <1408452653-14067-2-git-send-email-mikhail.ulyanov@cogentembedded.com> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Return-path: In-Reply-To: <1408452653-14067-2-git-send-email-mikhail.ulyanov@cogentembedded.com> Sender: linux-sh-owner@vger.kernel.org To: Mikhail Ulyanov Cc: Mauro Carvalho Chehab , Simon Horman , Magnus Damm , Rob Herring , Pawel Moll , Mark Rutland , Laurent Pinchart , Linux-sh list , Linux Media Mailing List , "devicetree@vger.kernel.org" List-Id: devicetree@vger.kernel.org On Tue, Aug 19, 2014 at 2:50 PM, Mikhail Ulyanov wrote: > +static void put_short_be(unsigned long *p, u16 v) > +{ > + u16 *addr = (u16 *)*p; > + > + *addr = cpu_to_be16(v); > + *p += 2; > +} > + > +static void put_word_be(unsigned long *p, u32 v) > +{ > + u32 *addr = (u32 *)*p; > + > + *addr = cpu_to_be32(v); > + *p += 4; > +} Is the address in *p guaranteed to be aligned to 2 resp. 4 bytes? If not, you can use put_unaligned*(). Gr{oetje,eeting}s, Geert -- Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that. -- Linus Torvalds