Commit 151d9fad authored by edwin_rong's avatar edwin_rong Committed by Greg Kroah-Hartman

Realtek cr: clean up unnecessary whitespaces.

Signed-off-by: default avataredwin_rong <edwin_rong@realsil.com.cn>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent 5b826138
...@@ -70,14 +70,14 @@ struct rts51x_status { ...@@ -70,14 +70,14 @@ struct rts51x_status {
}; };
struct rts51x_chip { struct rts51x_chip {
u16 vendor_id; u16 vendor_id;
u16 product_id; u16 product_id;
char max_lun; char max_lun;
struct rts51x_status *status; struct rts51x_status *status;
int status_len; int status_len;
u32 flag; u32 flag;
}; };
/* flag definition */ /* flag definition */
...@@ -143,8 +143,9 @@ static int init_realtek_cr(struct us_data *us); ...@@ -143,8 +143,9 @@ static int init_realtek_cr(struct us_data *us);
static const struct usb_device_id realtek_cr_ids[] = { static const struct usb_device_id realtek_cr_ids[] = {
# include "unusual_realtek.h" # include "unusual_realtek.h"
{ } /* Terminating entry */ {} /* Terminating entry */
}; };
MODULE_DEVICE_TABLE(usb, realtek_cr_ids); MODULE_DEVICE_TABLE(usb, realtek_cr_ids);
#undef UNUSUAL_DEV #undef UNUSUAL_DEV
...@@ -165,7 +166,7 @@ MODULE_DEVICE_TABLE(usb, realtek_cr_ids); ...@@ -165,7 +166,7 @@ MODULE_DEVICE_TABLE(usb, realtek_cr_ids);
static struct us_unusual_dev realtek_cr_unusual_dev_list[] = { static struct us_unusual_dev realtek_cr_unusual_dev_list[] = {
# include "unusual_realtek.h" # include "unusual_realtek.h"
{ } /* Terminating entry */ {} /* Terminating entry */
}; };
#undef UNUSUAL_DEV #undef UNUSUAL_DEV
...@@ -174,8 +175,8 @@ static int rts51x_bulk_transport(struct us_data *us, u8 lun, ...@@ -174,8 +175,8 @@ static int rts51x_bulk_transport(struct us_data *us, u8 lun,
u8 *cmd, int cmd_len, u8 *buf, int buf_len, u8 *cmd, int cmd_len, u8 *buf, int buf_len,
enum dma_data_direction dir, int *act_len) enum dma_data_direction dir, int *act_len)
{ {
struct bulk_cb_wrap *bcb = (struct bulk_cb_wrap *) us->iobuf; struct bulk_cb_wrap *bcb = (struct bulk_cb_wrap *)us->iobuf;
struct bulk_cs_wrap *bcs = (struct bulk_cs_wrap *) us->iobuf; struct bulk_cs_wrap *bcs = (struct bulk_cs_wrap *)us->iobuf;
int result; int result;
unsigned int residue; unsigned int residue;
unsigned int cswlen; unsigned int cswlen;
...@@ -195,7 +196,7 @@ static int rts51x_bulk_transport(struct us_data *us, u8 lun, ...@@ -195,7 +196,7 @@ static int rts51x_bulk_transport(struct us_data *us, u8 lun,
/* send it to out endpoint */ /* send it to out endpoint */
result = usb_stor_bulk_transfer_buf(us, us->send_bulk_pipe, result = usb_stor_bulk_transfer_buf(us, us->send_bulk_pipe,
bcb, cbwlen, NULL); bcb, cbwlen, NULL);
if (result != USB_STOR_XFER_GOOD) if (result != USB_STOR_XFER_GOOD)
return USB_STOR_TRANSPORT_ERROR; return USB_STOR_TRANSPORT_ERROR;
...@@ -204,24 +205,23 @@ static int rts51x_bulk_transport(struct us_data *us, u8 lun, ...@@ -204,24 +205,23 @@ static int rts51x_bulk_transport(struct us_data *us, u8 lun,
if (buf && buf_len) { if (buf && buf_len) {
unsigned int pipe = (dir == DMA_FROM_DEVICE) ? unsigned int pipe = (dir == DMA_FROM_DEVICE) ?
us->recv_bulk_pipe : us->send_bulk_pipe; us->recv_bulk_pipe : us->send_bulk_pipe;
result = usb_stor_bulk_transfer_buf(us, pipe, result = usb_stor_bulk_transfer_buf(us, pipe,
buf, buf_len, NULL); buf, buf_len, NULL);
if (result == USB_STOR_XFER_ERROR) if (result == USB_STOR_XFER_ERROR)
return USB_STOR_TRANSPORT_ERROR; return USB_STOR_TRANSPORT_ERROR;
} }
/* get CSW for device status */ /* get CSW for device status */
result = usb_stor_bulk_transfer_buf(us, us->recv_bulk_pipe, result = usb_stor_bulk_transfer_buf(us, us->recv_bulk_pipe,
bcs, US_BULK_CS_WRAP_LEN, &cswlen); bcs, US_BULK_CS_WRAP_LEN, &cswlen);
if (result != USB_STOR_XFER_GOOD) if (result != USB_STOR_XFER_GOOD)
return USB_STOR_TRANSPORT_ERROR; return USB_STOR_TRANSPORT_ERROR;
/* check bulk status */ /* check bulk status */
if (bcs->Signature != cpu_to_le32(US_BULK_CS_SIGN)) { if (bcs->Signature != cpu_to_le32(US_BULK_CS_SIGN)) {
US_DEBUGP("Signature mismatch: got %08X, expecting %08X\n", US_DEBUGP("Signature mismatch: got %08X, expecting %08X\n",
le32_to_cpu(bcs->Signature), le32_to_cpu(bcs->Signature), US_BULK_CS_SIGN);
US_BULK_CS_SIGN);
return USB_STOR_TRANSPORT_ERROR; return USB_STOR_TRANSPORT_ERROR;
} }
...@@ -249,8 +249,8 @@ static int rts51x_bulk_transport(struct us_data *us, u8 lun, ...@@ -249,8 +249,8 @@ static int rts51x_bulk_transport(struct us_data *us, u8 lun,
case US_BULK_STAT_PHASE: case US_BULK_STAT_PHASE:
/* phase error -- note that a transport reset will be /* phase error -- note that a transport reset will be
* invoked by the invoke_transport() function * invoked by the invoke_transport() function
*/ */
return USB_STOR_TRANSPORT_ERROR; return USB_STOR_TRANSPORT_ERROR;
} }
...@@ -266,10 +266,10 @@ static int rts51x_get_max_lun(struct us_data *us) ...@@ -266,10 +266,10 @@ static int rts51x_get_max_lun(struct us_data *us)
/* issue the command */ /* issue the command */
us->iobuf[0] = 0; us->iobuf[0] = 0;
result = usb_stor_control_msg(us, us->recv_ctrl_pipe, result = usb_stor_control_msg(us, us->recv_ctrl_pipe,
US_BULK_GET_MAX_LUN, US_BULK_GET_MAX_LUN,
USB_DIR_IN | USB_TYPE_CLASS | USB_DIR_IN | USB_TYPE_CLASS |
USB_RECIP_INTERFACE, USB_RECIP_INTERFACE,
0, us->ifnum, us->iobuf, 1, 10*HZ); 0, us->ifnum, us->iobuf, 1, 10 * HZ);
US_DEBUGP("GetMaxLUN command result is %d, data is %d\n", US_DEBUGP("GetMaxLUN command result is %d, data is %d\n",
result, us->iobuf[0]); result, us->iobuf[0]);
...@@ -284,16 +284,16 @@ static int rts51x_get_max_lun(struct us_data *us) ...@@ -284,16 +284,16 @@ static int rts51x_get_max_lun(struct us_data *us)
static int rts51x_read_mem(struct us_data *us, u16 addr, u8 *data, u16 len) static int rts51x_read_mem(struct us_data *us, u16 addr, u8 *data, u16 len)
{ {
int retval; int retval;
u8 cmnd[12] = {0}; u8 cmnd[12] = { 0 };
US_DEBUGP("%s, addr = 0x%x, len = %d\n", __func__, addr, len); US_DEBUGP("%s, addr = 0x%x, len = %d\n", __func__, addr, len);
cmnd[0] = 0xF0; cmnd[0] = 0xF0;
cmnd[1] = 0x0D; cmnd[1] = 0x0D;
cmnd[2] = (u8)(addr >> 8); cmnd[2] = (u8) (addr >> 8);
cmnd[3] = (u8)addr; cmnd[3] = (u8) addr;
cmnd[4] = (u8)(len >> 8); cmnd[4] = (u8) (len >> 8);
cmnd[5] = (u8)len; cmnd[5] = (u8) len;
retval = rts51x_bulk_transport(us, 0, cmnd, 12, retval = rts51x_bulk_transport(us, 0, cmnd, 12,
data, len, DMA_FROM_DEVICE, NULL); data, len, DMA_FROM_DEVICE, NULL);
...@@ -306,16 +306,16 @@ static int rts51x_read_mem(struct us_data *us, u16 addr, u8 *data, u16 len) ...@@ -306,16 +306,16 @@ static int rts51x_read_mem(struct us_data *us, u16 addr, u8 *data, u16 len)
static int rts51x_write_mem(struct us_data *us, u16 addr, u8 *data, u16 len) static int rts51x_write_mem(struct us_data *us, u16 addr, u8 *data, u16 len)
{ {
int retval; int retval;
u8 cmnd[12] = {0}; u8 cmnd[12] = { 0 };
US_DEBUGP("%s, addr = 0x%x, len = %d\n", __func__, addr, len); US_DEBUGP("%s, addr = 0x%x, len = %d\n", __func__, addr, len);
cmnd[0] = 0xF0; cmnd[0] = 0xF0;
cmnd[1] = 0x0E; cmnd[1] = 0x0E;
cmnd[2] = (u8)(addr >> 8); cmnd[2] = (u8) (addr >> 8);
cmnd[3] = (u8)addr; cmnd[3] = (u8) addr;
cmnd[4] = (u8)(len >> 8); cmnd[4] = (u8) (len >> 8);
cmnd[5] = (u8)len; cmnd[5] = (u8) len;
retval = rts51x_bulk_transport(us, 0, cmnd, 12, retval = rts51x_bulk_transport(us, 0, cmnd, 12,
data, len, DMA_TO_DEVICE, NULL); data, len, DMA_TO_DEVICE, NULL);
...@@ -329,7 +329,7 @@ static int rts51x_read_status(struct us_data *us, ...@@ -329,7 +329,7 @@ static int rts51x_read_status(struct us_data *us,
u8 lun, u8 *status, int len, int *actlen) u8 lun, u8 *status, int len, int *actlen)
{ {
int retval; int retval;
u8 cmnd[12] = {0}; u8 cmnd[12] = { 0 };
US_DEBUGP("%s, lun = %d\n", __func__, lun); US_DEBUGP("%s, lun = %d\n", __func__, lun);
...@@ -356,12 +356,12 @@ static int rts51x_check_status(struct us_data *us, u8 lun) ...@@ -356,12 +356,12 @@ static int rts51x_check_status(struct us_data *us, u8 lun)
US_DEBUGP("chip->status_len = %d\n", chip->status_len); US_DEBUGP("chip->status_len = %d\n", chip->status_len);
chip->status[lun].vid = ((u16)buf[0] << 8) | buf[1]; chip->status[lun].vid = ((u16) buf[0] << 8) | buf[1];
chip->status[lun].pid = ((u16)buf[2] << 8) | buf[3]; chip->status[lun].pid = ((u16) buf[2] << 8) | buf[3];
chip->status[lun].cur_lun = buf[4]; chip->status[lun].cur_lun = buf[4];
chip->status[lun].card_type = buf[5]; chip->status[lun].card_type = buf[5];
chip->status[lun].total_lun = buf[6]; chip->status[lun].total_lun = buf[6];
chip->status[lun].fw_ver = ((u16)buf[7] << 8) | buf[8]; chip->status[lun].fw_ver = ((u16) buf[7] << 8) | buf[8];
chip->status[lun].phy_exist = buf[9]; chip->status[lun].phy_exist = buf[9];
chip->status[lun].multi_flag = buf[10]; chip->status[lun].multi_flag = buf[10];
chip->status[lun].multi_card = buf[11]; chip->status[lun].multi_card = buf[11];
...@@ -465,7 +465,7 @@ static int config_autodelink_after_power_on(struct us_data *us) ...@@ -465,7 +465,7 @@ static int config_autodelink_after_power_on(struct us_data *us)
CLR_BIT(value, 2); CLR_BIT(value, 2);
if (CHECK_ID(chip, 0x0159, 0x5889) || if (CHECK_ID(chip, 0x0159, 0x5889) ||
CHECK_ID(chip, 0x0138, 0x3880)) { CHECK_ID(chip, 0x0138, 0x3880)) {
CLR_BIT(value, 0); CLR_BIT(value, 0);
CLR_BIT(value, 7); CLR_BIT(value, 7);
} }
...@@ -528,14 +528,14 @@ static int config_autodelink_before_power_down(struct us_data *us) ...@@ -528,14 +528,14 @@ static int config_autodelink_before_power_down(struct us_data *us)
return -EIO; return -EIO;
} else { } else {
if (CHECK_ID(chip, 0x0159, 0x5889) || if (CHECK_ID(chip, 0x0159, 0x5889) ||
CHECK_ID(chip, 0x0138, 0x3880) || CHECK_ID(chip, 0x0138, 0x3880) ||
CHECK_ID(chip, 0x0138, 0x3882)) { CHECK_ID(chip, 0x0138, 0x3882)) {
retval = rts51x_read_mem(us, 0xFE47, &value, 1); retval = rts51x_read_mem(us, 0xFE47, &value, 1);
if (retval < 0) if (retval < 0)
return -EIO; return -EIO;
if (CHECK_ID(chip, 0x0159, 0x5889) || if (CHECK_ID(chip, 0x0159, 0x5889) ||
CHECK_ID(chip, 0x0138, 0x3880)) { CHECK_ID(chip, 0x0138, 0x3880)) {
SET_BIT(value, 0); SET_BIT(value, 0);
SET_BIT(value, 7); SET_BIT(value, 7);
} }
...@@ -602,13 +602,13 @@ static int init_realtek_cr(struct us_data *us) ...@@ -602,13 +602,13 @@ static int init_realtek_cr(struct us_data *us)
goto INIT_FAIL; goto INIT_FAIL;
for (i = 0; i <= (int)(chip->max_lun); i++) { for (i = 0; i <= (int)(chip->max_lun); i++) {
retval = rts51x_check_status(us, (u8)i); retval = rts51x_check_status(us, (u8) i);
if (retval < 0) if (retval < 0)
goto INIT_FAIL; goto INIT_FAIL;
} }
if (CHECK_FW_VER(chip, 0x5888) || CHECK_FW_VER(chip, 0x5889) || if (CHECK_FW_VER(chip, 0x5888) || CHECK_FW_VER(chip, 0x5889) ||
CHECK_FW_VER(chip, 0x5901)) CHECK_FW_VER(chip, 0x5901))
SET_AUTO_DELINK(chip); SET_AUTO_DELINK(chip);
if (STATUS_LEN(chip) == 16) { if (STATUS_LEN(chip) == 16) {
if (SUPPORT_AUTO_DELINK(chip)) if (SUPPORT_AUTO_DELINK(chip))
...@@ -632,7 +632,7 @@ static int init_realtek_cr(struct us_data *us) ...@@ -632,7 +632,7 @@ static int init_realtek_cr(struct us_data *us)
} }
static int realtek_cr_probe(struct usb_interface *intf, static int realtek_cr_probe(struct usb_interface *intf,
const struct usb_device_id *id) const struct usb_device_id *id)
{ {
struct us_data *us; struct us_data *us;
int result; int result;
...@@ -640,25 +640,27 @@ static int realtek_cr_probe(struct usb_interface *intf, ...@@ -640,25 +640,27 @@ static int realtek_cr_probe(struct usb_interface *intf,
US_DEBUGP("Probe Realtek Card Reader!\n"); US_DEBUGP("Probe Realtek Card Reader!\n");
result = usb_stor_probe1(&us, intf, id, result = usb_stor_probe1(&us, intf, id,
(id - realtek_cr_ids) + realtek_cr_unusual_dev_list); (id - realtek_cr_ids) +
realtek_cr_unusual_dev_list);
if (result) if (result)
return result; return result;
result = usb_stor_probe2(us); result = usb_stor_probe2(us);
return result; return result;
} }
static struct usb_driver realtek_cr_driver = { static struct usb_driver realtek_cr_driver = {
.name = "ums-realtek", .name = "ums-realtek",
.probe = realtek_cr_probe, .probe = realtek_cr_probe,
.disconnect = usb_stor_disconnect, .disconnect = usb_stor_disconnect,
.suspend = usb_stor_suspend, .suspend = usb_stor_suspend,
.resume = usb_stor_resume, .resume = usb_stor_resume,
.reset_resume = usb_stor_reset_resume, .reset_resume = usb_stor_reset_resume,
.pre_reset = usb_stor_pre_reset, .pre_reset = usb_stor_pre_reset,
.post_reset = usb_stor_post_reset, .post_reset = usb_stor_post_reset,
.id_table = realtek_cr_ids, .id_table = realtek_cr_ids,
.soft_unbind = 1, .soft_unbind = 1,
}; };
static int __init realtek_cr_init(void) static int __init realtek_cr_init(void)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment