aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoredwin_rong <edwin_rong@realsil.com.cn>2011-06-17 07:35:09 -0400
committerGreg Kroah-Hartman <gregkh@suse.de>2011-07-01 17:53:41 -0400
commit151d9fad6e8459b4fc891a3c8543dbea11049387 (patch)
treef9cb75035134c6e067f4519e025d206be0d5e284
parent5b8261385c5c3e5cf70a95c36cce71939b844a16 (diff)
Realtek cr: clean up unnecessary whitespaces.
Signed-off-by: edwin_rong <edwin_rong@realsil.com.cn> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
-rw-r--r--drivers/usb/storage/realtek_cr.c110
1 files changed, 56 insertions, 54 deletions
diff --git a/drivers/usb/storage/realtek_cr.c b/drivers/usb/storage/realtek_cr.c
index d509a4a7d74f..0b6e30b22ab2 100644
--- a/drivers/usb/storage/realtek_cr.c
+++ b/drivers/usb/storage/realtek_cr.c
@@ -70,14 +70,14 @@ struct rts51x_status {
70}; 70};
71 71
72struct rts51x_chip { 72struct rts51x_chip {
73 u16 vendor_id; 73 u16 vendor_id;
74 u16 product_id; 74 u16 product_id;
75 char max_lun; 75 char max_lun;
76 76
77 struct rts51x_status *status; 77 struct rts51x_status *status;
78 int status_len; 78 int status_len;
79 79
80 u32 flag; 80 u32 flag;
81}; 81};
82 82
83/* flag definition */ 83/* flag definition */
@@ -143,8 +143,9 @@ static int init_realtek_cr(struct us_data *us);
143 143
144static const struct usb_device_id realtek_cr_ids[] = { 144static const struct usb_device_id realtek_cr_ids[] = {
145# include "unusual_realtek.h" 145# include "unusual_realtek.h"
146 { } /* Terminating entry */ 146 {} /* Terminating entry */
147}; 147};
148
148MODULE_DEVICE_TABLE(usb, realtek_cr_ids); 149MODULE_DEVICE_TABLE(usb, realtek_cr_ids);
149 150
150#undef UNUSUAL_DEV 151#undef UNUSUAL_DEV
@@ -165,7 +166,7 @@ MODULE_DEVICE_TABLE(usb, realtek_cr_ids);
165 166
166static struct us_unusual_dev realtek_cr_unusual_dev_list[] = { 167static struct us_unusual_dev realtek_cr_unusual_dev_list[] = {
167# include "unusual_realtek.h" 168# include "unusual_realtek.h"
168 { } /* Terminating entry */ 169 {} /* Terminating entry */
169}; 170};
170 171
171#undef UNUSUAL_DEV 172#undef UNUSUAL_DEV
@@ -174,8 +175,8 @@ static int rts51x_bulk_transport(struct us_data *us, u8 lun,
174 u8 *cmd, int cmd_len, u8 *buf, int buf_len, 175 u8 *cmd, int cmd_len, u8 *buf, int buf_len,
175 enum dma_data_direction dir, int *act_len) 176 enum dma_data_direction dir, int *act_len)
176{ 177{
177 struct bulk_cb_wrap *bcb = (struct bulk_cb_wrap *) us->iobuf; 178 struct bulk_cb_wrap *bcb = (struct bulk_cb_wrap *)us->iobuf;
178 struct bulk_cs_wrap *bcs = (struct bulk_cs_wrap *) us->iobuf; 179 struct bulk_cs_wrap *bcs = (struct bulk_cs_wrap *)us->iobuf;
179 int result; 180 int result;
180 unsigned int residue; 181 unsigned int residue;
181 unsigned int cswlen; 182 unsigned int cswlen;
@@ -195,7 +196,7 @@ static int rts51x_bulk_transport(struct us_data *us, u8 lun,
195 196
196 /* send it to out endpoint */ 197 /* send it to out endpoint */
197 result = usb_stor_bulk_transfer_buf(us, us->send_bulk_pipe, 198 result = usb_stor_bulk_transfer_buf(us, us->send_bulk_pipe,
198 bcb, cbwlen, NULL); 199 bcb, cbwlen, NULL);
199 if (result != USB_STOR_XFER_GOOD) 200 if (result != USB_STOR_XFER_GOOD)
200 return USB_STOR_TRANSPORT_ERROR; 201 return USB_STOR_TRANSPORT_ERROR;
201 202
@@ -204,24 +205,23 @@ static int rts51x_bulk_transport(struct us_data *us, u8 lun,
204 205
205 if (buf && buf_len) { 206 if (buf && buf_len) {
206 unsigned int pipe = (dir == DMA_FROM_DEVICE) ? 207 unsigned int pipe = (dir == DMA_FROM_DEVICE) ?
207 us->recv_bulk_pipe : us->send_bulk_pipe; 208 us->recv_bulk_pipe : us->send_bulk_pipe;
208 result = usb_stor_bulk_transfer_buf(us, pipe, 209 result = usb_stor_bulk_transfer_buf(us, pipe,
209 buf, buf_len, NULL); 210 buf, buf_len, NULL);
210 if (result == USB_STOR_XFER_ERROR) 211 if (result == USB_STOR_XFER_ERROR)
211 return USB_STOR_TRANSPORT_ERROR; 212 return USB_STOR_TRANSPORT_ERROR;
212 } 213 }
213 214
214 /* get CSW for device status */ 215 /* get CSW for device status */
215 result = usb_stor_bulk_transfer_buf(us, us->recv_bulk_pipe, 216 result = usb_stor_bulk_transfer_buf(us, us->recv_bulk_pipe,
216 bcs, US_BULK_CS_WRAP_LEN, &cswlen); 217 bcs, US_BULK_CS_WRAP_LEN, &cswlen);
217 if (result != USB_STOR_XFER_GOOD) 218 if (result != USB_STOR_XFER_GOOD)
218 return USB_STOR_TRANSPORT_ERROR; 219 return USB_STOR_TRANSPORT_ERROR;
219 220
220 /* check bulk status */ 221 /* check bulk status */
221 if (bcs->Signature != cpu_to_le32(US_BULK_CS_SIGN)) { 222 if (bcs->Signature != cpu_to_le32(US_BULK_CS_SIGN)) {
222 US_DEBUGP("Signature mismatch: got %08X, expecting %08X\n", 223 US_DEBUGP("Signature mismatch: got %08X, expecting %08X\n",
223 le32_to_cpu(bcs->Signature), 224 le32_to_cpu(bcs->Signature), US_BULK_CS_SIGN);
224 US_BULK_CS_SIGN);
225 return USB_STOR_TRANSPORT_ERROR; 225 return USB_STOR_TRANSPORT_ERROR;
226 } 226 }
227 227
@@ -249,8 +249,8 @@ static int rts51x_bulk_transport(struct us_data *us, u8 lun,
249 249
250 case US_BULK_STAT_PHASE: 250 case US_BULK_STAT_PHASE:
251 /* phase error -- note that a transport reset will be 251 /* phase error -- note that a transport reset will be
252 * invoked by the invoke_transport() function 252 * invoked by the invoke_transport() function
253 */ 253 */
254 return USB_STOR_TRANSPORT_ERROR; 254 return USB_STOR_TRANSPORT_ERROR;
255 } 255 }
256 256
@@ -266,10 +266,10 @@ static int rts51x_get_max_lun(struct us_data *us)
266 /* issue the command */ 266 /* issue the command */
267 us->iobuf[0] = 0; 267 us->iobuf[0] = 0;
268 result = usb_stor_control_msg(us, us->recv_ctrl_pipe, 268 result = usb_stor_control_msg(us, us->recv_ctrl_pipe,
269 US_BULK_GET_MAX_LUN, 269 US_BULK_GET_MAX_LUN,
270 USB_DIR_IN | USB_TYPE_CLASS | 270 USB_DIR_IN | USB_TYPE_CLASS |
271 USB_RECIP_INTERFACE, 271 USB_RECIP_INTERFACE,
272 0, us->ifnum, us->iobuf, 1, 10*HZ); 272 0, us->ifnum, us->iobuf, 1, 10 * HZ);
273 273
274 US_DEBUGP("GetMaxLUN command result is %d, data is %d\n", 274 US_DEBUGP("GetMaxLUN command result is %d, data is %d\n",
275 result, us->iobuf[0]); 275 result, us->iobuf[0]);
@@ -284,16 +284,16 @@ static int rts51x_get_max_lun(struct us_data *us)
284static int rts51x_read_mem(struct us_data *us, u16 addr, u8 *data, u16 len) 284static int rts51x_read_mem(struct us_data *us, u16 addr, u8 *data, u16 len)
285{ 285{
286 int retval; 286 int retval;
287 u8 cmnd[12] = {0}; 287 u8 cmnd[12] = { 0 };
288 288
289 US_DEBUGP("%s, addr = 0x%x, len = %d\n", __func__, addr, len); 289 US_DEBUGP("%s, addr = 0x%x, len = %d\n", __func__, addr, len);
290 290
291 cmnd[0] = 0xF0; 291 cmnd[0] = 0xF0;
292 cmnd[1] = 0x0D; 292 cmnd[1] = 0x0D;
293 cmnd[2] = (u8)(addr >> 8); 293 cmnd[2] = (u8) (addr >> 8);
294 cmnd[3] = (u8)addr; 294 cmnd[3] = (u8) addr;
295 cmnd[4] = (u8)(len >> 8); 295 cmnd[4] = (u8) (len >> 8);
296 cmnd[5] = (u8)len; 296 cmnd[5] = (u8) len;
297 297
298 retval = rts51x_bulk_transport(us, 0, cmnd, 12, 298 retval = rts51x_bulk_transport(us, 0, cmnd, 12,
299 data, len, DMA_FROM_DEVICE, NULL); 299 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)
306static int rts51x_write_mem(struct us_data *us, u16 addr, u8 *data, u16 len) 306static int rts51x_write_mem(struct us_data *us, u16 addr, u8 *data, u16 len)
307{ 307{
308 int retval; 308 int retval;
309 u8 cmnd[12] = {0}; 309 u8 cmnd[12] = { 0 };
310 310
311 US_DEBUGP("%s, addr = 0x%x, len = %d\n", __func__, addr, len); 311 US_DEBUGP("%s, addr = 0x%x, len = %d\n", __func__, addr, len);
312 312
313 cmnd[0] = 0xF0; 313 cmnd[0] = 0xF0;
314 cmnd[1] = 0x0E; 314 cmnd[1] = 0x0E;
315 cmnd[2] = (u8)(addr >> 8); 315 cmnd[2] = (u8) (addr >> 8);
316 cmnd[3] = (u8)addr; 316 cmnd[3] = (u8) addr;
317 cmnd[4] = (u8)(len >> 8); 317 cmnd[4] = (u8) (len >> 8);
318 cmnd[5] = (u8)len; 318 cmnd[5] = (u8) len;
319 319
320 retval = rts51x_bulk_transport(us, 0, cmnd, 12, 320 retval = rts51x_bulk_transport(us, 0, cmnd, 12,
321 data, len, DMA_TO_DEVICE, NULL); 321 data, len, DMA_TO_DEVICE, NULL);
@@ -329,7 +329,7 @@ static int rts51x_read_status(struct us_data *us,
329 u8 lun, u8 *status, int len, int *actlen) 329 u8 lun, u8 *status, int len, int *actlen)
330{ 330{
331 int retval; 331 int retval;
332 u8 cmnd[12] = {0}; 332 u8 cmnd[12] = { 0 };
333 333
334 US_DEBUGP("%s, lun = %d\n", __func__, lun); 334 US_DEBUGP("%s, lun = %d\n", __func__, lun);
335 335
@@ -356,12 +356,12 @@ static int rts51x_check_status(struct us_data *us, u8 lun)
356 356
357 US_DEBUGP("chip->status_len = %d\n", chip->status_len); 357 US_DEBUGP("chip->status_len = %d\n", chip->status_len);
358 358
359 chip->status[lun].vid = ((u16)buf[0] << 8) | buf[1]; 359 chip->status[lun].vid = ((u16) buf[0] << 8) | buf[1];
360 chip->status[lun].pid = ((u16)buf[2] << 8) | buf[3]; 360 chip->status[lun].pid = ((u16) buf[2] << 8) | buf[3];
361 chip->status[lun].cur_lun = buf[4]; 361 chip->status[lun].cur_lun = buf[4];
362 chip->status[lun].card_type = buf[5]; 362 chip->status[lun].card_type = buf[5];
363 chip->status[lun].total_lun = buf[6]; 363 chip->status[lun].total_lun = buf[6];
364 chip->status[lun].fw_ver = ((u16)buf[7] << 8) | buf[8]; 364 chip->status[lun].fw_ver = ((u16) buf[7] << 8) | buf[8];
365 chip->status[lun].phy_exist = buf[9]; 365 chip->status[lun].phy_exist = buf[9];
366 chip->status[lun].multi_flag = buf[10]; 366 chip->status[lun].multi_flag = buf[10];
367 chip->status[lun].multi_card = buf[11]; 367 chip->status[lun].multi_card = buf[11];
@@ -465,7 +465,7 @@ static int config_autodelink_after_power_on(struct us_data *us)
465 CLR_BIT(value, 2); 465 CLR_BIT(value, 2);
466 466
467 if (CHECK_ID(chip, 0x0159, 0x5889) || 467 if (CHECK_ID(chip, 0x0159, 0x5889) ||
468 CHECK_ID(chip, 0x0138, 0x3880)) { 468 CHECK_ID(chip, 0x0138, 0x3880)) {
469 CLR_BIT(value, 0); 469 CLR_BIT(value, 0);
470 CLR_BIT(value, 7); 470 CLR_BIT(value, 7);
471 } 471 }
@@ -528,14 +528,14 @@ static int config_autodelink_before_power_down(struct us_data *us)
528 return -EIO; 528 return -EIO;
529 } else { 529 } else {
530 if (CHECK_ID(chip, 0x0159, 0x5889) || 530 if (CHECK_ID(chip, 0x0159, 0x5889) ||
531 CHECK_ID(chip, 0x0138, 0x3880) || 531 CHECK_ID(chip, 0x0138, 0x3880) ||
532 CHECK_ID(chip, 0x0138, 0x3882)) { 532 CHECK_ID(chip, 0x0138, 0x3882)) {
533 retval = rts51x_read_mem(us, 0xFE47, &value, 1); 533 retval = rts51x_read_mem(us, 0xFE47, &value, 1);
534 if (retval < 0) 534 if (retval < 0)
535 return -EIO; 535 return -EIO;
536 536
537 if (CHECK_ID(chip, 0x0159, 0x5889) || 537 if (CHECK_ID(chip, 0x0159, 0x5889) ||
538 CHECK_ID(chip, 0x0138, 0x3880)) { 538 CHECK_ID(chip, 0x0138, 0x3880)) {
539 SET_BIT(value, 0); 539 SET_BIT(value, 0);
540 SET_BIT(value, 7); 540 SET_BIT(value, 7);
541 } 541 }
@@ -602,13 +602,13 @@ static int init_realtek_cr(struct us_data *us)
602 goto INIT_FAIL; 602 goto INIT_FAIL;
603 603
604 for (i = 0; i <= (int)(chip->max_lun); i++) { 604 for (i = 0; i <= (int)(chip->max_lun); i++) {
605 retval = rts51x_check_status(us, (u8)i); 605 retval = rts51x_check_status(us, (u8) i);
606 if (retval < 0) 606 if (retval < 0)
607 goto INIT_FAIL; 607 goto INIT_FAIL;
608 } 608 }
609 609
610 if (CHECK_FW_VER(chip, 0x5888) || CHECK_FW_VER(chip, 0x5889) || 610 if (CHECK_FW_VER(chip, 0x5888) || CHECK_FW_VER(chip, 0x5889) ||
611 CHECK_FW_VER(chip, 0x5901)) 611 CHECK_FW_VER(chip, 0x5901))
612 SET_AUTO_DELINK(chip); 612 SET_AUTO_DELINK(chip);
613 if (STATUS_LEN(chip) == 16) { 613 if (STATUS_LEN(chip) == 16) {
614 if (SUPPORT_AUTO_DELINK(chip)) 614 if (SUPPORT_AUTO_DELINK(chip))
@@ -632,7 +632,7 @@ INIT_FAIL:
632} 632}
633 633
634static int realtek_cr_probe(struct usb_interface *intf, 634static int realtek_cr_probe(struct usb_interface *intf,
635 const struct usb_device_id *id) 635 const struct usb_device_id *id)
636{ 636{
637 struct us_data *us; 637 struct us_data *us;
638 int result; 638 int result;
@@ -640,25 +640,27 @@ static int realtek_cr_probe(struct usb_interface *intf,
640 US_DEBUGP("Probe Realtek Card Reader!\n"); 640 US_DEBUGP("Probe Realtek Card Reader!\n");
641 641
642 result = usb_stor_probe1(&us, intf, id, 642 result = usb_stor_probe1(&us, intf, id,
643 (id - realtek_cr_ids) + realtek_cr_unusual_dev_list); 643 (id - realtek_cr_ids) +
644 realtek_cr_unusual_dev_list);
644 if (result) 645 if (result)
645 return result; 646 return result;
646 647
647 result = usb_stor_probe2(us); 648 result = usb_stor_probe2(us);
649
648 return result; 650 return result;
649} 651}
650 652
651static struct usb_driver realtek_cr_driver = { 653static struct usb_driver realtek_cr_driver = {
652 .name = "ums-realtek", 654 .name = "ums-realtek",
653 .probe = realtek_cr_probe, 655 .probe = realtek_cr_probe,
654 .disconnect = usb_stor_disconnect, 656 .disconnect = usb_stor_disconnect,
655 .suspend = usb_stor_suspend, 657 .suspend = usb_stor_suspend,
656 .resume = usb_stor_resume, 658 .resume = usb_stor_resume,
657 .reset_resume = usb_stor_reset_resume, 659 .reset_resume = usb_stor_reset_resume,
658 .pre_reset = usb_stor_pre_reset, 660 .pre_reset = usb_stor_pre_reset,
659 .post_reset = usb_stor_post_reset, 661 .post_reset = usb_stor_post_reset,
660 .id_table = realtek_cr_ids, 662 .id_table = realtek_cr_ids,
661 .soft_unbind = 1, 663 .soft_unbind = 1,
662}; 664};
663 665
664static int __init realtek_cr_init(void) 666static int __init realtek_cr_init(void)