mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-09-12 13:55:32 +00:00
staging: most: consolidate code
The function drci_rd_reg() always delivers little endian representation of the 16-bit DCI register. The value returned by this function must always be carefully converted from __le16 to u16 type. This patch moves all those conversions to the function itself. Signed-off-by: Andrey Shvetsov <andrey.shvetsov@k2l.de> Signed-off-by: Christian Gromm <christian.gromm@microchip.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
2637022887
commit
c81c9c3e0f
1 changed files with 2 additions and 6 deletions
|
@ -159,7 +159,7 @@ static inline int drci_rd_reg(struct usb_device *dev, u16 reg, u16 *buf)
|
||||||
DRCI_READ_REQ, req_type,
|
DRCI_READ_REQ, req_type,
|
||||||
0x0000,
|
0x0000,
|
||||||
reg, dma_buf, sizeof(u16), 5 * HZ);
|
reg, dma_buf, sizeof(u16), 5 * HZ);
|
||||||
*buf = *dma_buf;
|
*buf = le16_to_cpu(*dma_buf);
|
||||||
kfree(dma_buf);
|
kfree(dma_buf);
|
||||||
|
|
||||||
return retval;
|
return retval;
|
||||||
|
@ -804,19 +804,16 @@ static int hdm_update_netinfo(struct most_dev *mdev)
|
||||||
dev_err(dev, "Vendor request \"hw_addr_hi\" failed\n");
|
dev_err(dev, "Vendor request \"hw_addr_hi\" failed\n");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
le16_to_cpus(&hi);
|
|
||||||
|
|
||||||
if (drci_rd_reg(usb_device, DRCI_REG_HW_ADDR_MI, &mi) < 0) {
|
if (drci_rd_reg(usb_device, DRCI_REG_HW_ADDR_MI, &mi) < 0) {
|
||||||
dev_err(dev, "Vendor request \"hw_addr_mid\" failed\n");
|
dev_err(dev, "Vendor request \"hw_addr_mid\" failed\n");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
le16_to_cpus(&mi);
|
|
||||||
|
|
||||||
if (drci_rd_reg(usb_device, DRCI_REG_HW_ADDR_LO, &lo) < 0) {
|
if (drci_rd_reg(usb_device, DRCI_REG_HW_ADDR_LO, &lo) < 0) {
|
||||||
dev_err(dev, "Vendor request \"hw_addr_low\" failed\n");
|
dev_err(dev, "Vendor request \"hw_addr_low\" failed\n");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
le16_to_cpus(&lo);
|
|
||||||
|
|
||||||
mutex_lock(&mdev->io_mutex);
|
mutex_lock(&mdev->io_mutex);
|
||||||
mdev->hw_addr[0] = hi >> 8;
|
mdev->hw_addr[0] = hi >> 8;
|
||||||
|
@ -832,7 +829,6 @@ static int hdm_update_netinfo(struct most_dev *mdev)
|
||||||
dev_err(dev, "Vendor request \"link status\" failed\n");
|
dev_err(dev, "Vendor request \"link status\" failed\n");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
le16_to_cpus(&link);
|
|
||||||
|
|
||||||
mutex_lock(&mdev->io_mutex);
|
mutex_lock(&mdev->io_mutex);
|
||||||
mdev->link_stat = link;
|
mdev->link_stat = link;
|
||||||
|
@ -1083,7 +1079,7 @@ static ssize_t show_value(struct most_dci_obj *dci_obj,
|
||||||
if (err < 0)
|
if (err < 0)
|
||||||
return err;
|
return err;
|
||||||
|
|
||||||
return snprintf(buf, PAGE_SIZE, "%04x\n", le16_to_cpu(tmp_val));
|
return snprintf(buf, PAGE_SIZE, "%04x\n", tmp_val);
|
||||||
}
|
}
|
||||||
|
|
||||||
static ssize_t store_value(struct most_dci_obj *dci_obj,
|
static ssize_t store_value(struct most_dci_obj *dci_obj,
|
||||||
|
|
Loading…
Reference in a new issue