Message ID | 20200817184659.58419-2-andriy.shevchenko@linux.intel.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | [v2,1/8] byteorder: Introduce cpu_to_le16_array() and le16_to_cpu_array() | expand |
On 17/Aug/2020 21:46, Andy Shevchenko wrote: > Since we have a new helper, let's replace open coded variant by it. > > Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> > Cc: Anton Sviridenko <anton@corp.bluecherry.net> > Cc: Andrey Utkin <andrey.utkin@corp.bluecherry.net> > Cc: Ismael Luceno <ismael@iodev.co.uk> > Cc: Mauro Carvalho Chehab <mchehab@kernel.org> > --- > v2: new patch > drivers/media/pci/solo6x10/solo6x10-disp.c | 5 ++--- > 1 file changed, 2 insertions(+), 3 deletions(-) > > diff --git a/drivers/media/pci/solo6x10/solo6x10-disp.c b/drivers/media/pci/solo6x10/solo6x10-disp.c > index ad98ca7fb98b..09c0cf8a5fcb 100644 > --- a/drivers/media/pci/solo6x10/solo6x10-disp.c > +++ b/drivers/media/pci/solo6x10/solo6x10-disp.c > @@ -202,16 +202,15 @@ int solo_set_motion_block(struct solo_dev *solo_dev, u8 ch, > { > const unsigned size = sizeof(u16) * 64; > u32 off = SOLO_MOT_FLAG_AREA + ch * SOLO_MOT_THRESH_SIZE * 2; > + unsigned int y; > __le16 *buf; > - int x, y; > int ret = 0; > > buf = kzalloc(size, GFP_KERNEL); > if (buf == NULL) > return -ENOMEM; > for (y = 0; y < SOLO_MOTION_SZ; y++) { > - for (x = 0; x < SOLO_MOTION_SZ; x++) > - buf[x] = cpu_to_le16(thresholds[y * SOLO_MOTION_SZ + x]); > + cpu_to_le16_array(buf, &thresholds[y * SOLO_MOTION_SZ], SOLO_MOTION_SZ); > ret |= solo_p2m_dma(solo_dev, 1, buf, > SOLO_MOTION_EXT_ADDR(solo_dev) + off + y * size, > size, 0, 0); > -- > 2.28.0 > Signed-off-by: Ismael Luceno <ismael@iodev.co.uk>
diff --git a/drivers/media/pci/solo6x10/solo6x10-disp.c b/drivers/media/pci/solo6x10/solo6x10-disp.c index ad98ca7fb98b..09c0cf8a5fcb 100644 --- a/drivers/media/pci/solo6x10/solo6x10-disp.c +++ b/drivers/media/pci/solo6x10/solo6x10-disp.c @@ -202,16 +202,15 @@ int solo_set_motion_block(struct solo_dev *solo_dev, u8 ch, { const unsigned size = sizeof(u16) * 64; u32 off = SOLO_MOT_FLAG_AREA + ch * SOLO_MOT_THRESH_SIZE * 2; + unsigned int y; __le16 *buf; - int x, y; int ret = 0; buf = kzalloc(size, GFP_KERNEL); if (buf == NULL) return -ENOMEM; for (y = 0; y < SOLO_MOTION_SZ; y++) { - for (x = 0; x < SOLO_MOTION_SZ; x++) - buf[x] = cpu_to_le16(thresholds[y * SOLO_MOTION_SZ + x]); + cpu_to_le16_array(buf, &thresholds[y * SOLO_MOTION_SZ], SOLO_MOTION_SZ); ret |= solo_p2m_dma(solo_dev, 1, buf, SOLO_MOTION_EXT_ADDR(solo_dev) + off + y * size, size, 0, 0);
Since we have a new helper, let's replace open coded variant by it. Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Cc: Anton Sviridenko <anton@corp.bluecherry.net> Cc: Andrey Utkin <andrey.utkin@corp.bluecherry.net> Cc: Ismael Luceno <ismael@iodev.co.uk> Cc: Mauro Carvalho Chehab <mchehab@kernel.org> --- v2: new patch drivers/media/pci/solo6x10/solo6x10-disp.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)