Skip to content
Permalink
Browse files
usb: early: xhci-dbc: Make use of cpu_to_le16_array()
Since we have a new helper, let's replace open coded variant by it.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
  • Loading branch information
andy-shev authored and intel-lab-lkp committed Aug 17, 2020
1 parent ba621ea commit 05f0c7b5a2ca395d58f1ba7a8f84f4be3d504b56
Showing 1 changed file with 4 additions and 11 deletions.
@@ -9,6 +9,7 @@

#define pr_fmt(fmt) KBUILD_MODNAME ":%s: " fmt, __func__

#include <linux/byteorder/generic.h>
#include <linux/console.h>
#include <linux/pci_regs.h>
#include <linux/pci_ids.h>
@@ -200,14 +201,6 @@ static void xdbc_reset_ring(struct xdbc_ring *ring)
}
}

static inline void xdbc_put_utf16(u16 *s, const char *c, size_t size)
{
int i;

for (i = 0; i < size; i++)
s[i] = cpu_to_le16(c[i]);
}

static void xdbc_mem_init(void)
{
struct xdbc_ep_context *ep_in, *ep_out;
@@ -263,7 +256,7 @@ static void xdbc_mem_init(void)
s_desc->bLength = (strlen(XDBC_STRING_SERIAL) + 1) * 2;
s_desc->bDescriptorType = USB_DT_STRING;

xdbc_put_utf16(s_desc->wData, XDBC_STRING_SERIAL, strlen(XDBC_STRING_SERIAL));
cpu_to_le16_array(s_desc->wData, XDBC_STRING_SERIAL, strlen(XDBC_STRING_SERIAL));
string_length = s_desc->bLength;
string_length <<= 8;

@@ -272,7 +265,7 @@ static void xdbc_mem_init(void)
s_desc->bLength = (strlen(XDBC_STRING_PRODUCT) + 1) * 2;
s_desc->bDescriptorType = USB_DT_STRING;

xdbc_put_utf16(s_desc->wData, XDBC_STRING_PRODUCT, strlen(XDBC_STRING_PRODUCT));
cpu_to_le16_array(s_desc->wData, XDBC_STRING_PRODUCT, strlen(XDBC_STRING_PRODUCT));
string_length += s_desc->bLength;
string_length <<= 8;

@@ -281,7 +274,7 @@ static void xdbc_mem_init(void)
s_desc->bLength = (strlen(XDBC_STRING_MANUFACTURER) + 1) * 2;
s_desc->bDescriptorType = USB_DT_STRING;

xdbc_put_utf16(s_desc->wData, XDBC_STRING_MANUFACTURER, strlen(XDBC_STRING_MANUFACTURER));
cpu_to_le16_array(s_desc->wData, XDBC_STRING_MANUFACTURER, strlen(XDBC_STRING_MANUFACTURER));
string_length += s_desc->bLength;
string_length <<= 8;

0 comments on commit 05f0c7b

Please sign in to comment.