Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

staging/keucr: fix keucr scsiglue coding style

fix keucr scsiglue.c coding style

Signed-off-by: Cho, Yu-Chen <acho@novell.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>

authored by

Cho, Yu-Chen and committed by
Greg Kroah-Hartman
8a25a2cf 70d83707

+93 -64
+93 -64
drivers/staging/keucr/scsiglue.c
··· 15 15 #include "transport.h" 16 16 17 17 /* Host functions */ 18 - //----- host_info() --------------------- 19 - static const char* host_info(struct Scsi_Host *host) 18 + /* 19 + * host_info() 20 + */ 21 + static const char *host_info(struct Scsi_Host *host) 20 22 { 21 23 /* pr_info("scsiglue --- host_info\n"); */ 22 24 return "SCSI emulation for USB Mass Storage devices"; 23 25 } 24 26 25 - //----- slave_alloc() --------------------- 27 + /* 28 + * slave_alloc() 29 + */ 26 30 static int slave_alloc(struct scsi_device *sdev) 27 31 { 28 32 struct us_data *us = host_to_us(sdev->host); ··· 42 38 return 0; 43 39 } 44 40 45 - //----- slave_configure() --------------------- 41 + /* 42 + * slave_configure() 43 + */ 46 44 static int slave_configure(struct scsi_device *sdev) 47 45 { 48 46 struct us_data *us = host_to_us(sdev->host); 49 47 50 48 /* pr_info("scsiglue --- slave_configure\n"); */ 51 - if (us->fflags & (US_FL_MAX_SECTORS_64 | US_FL_MAX_SECTORS_MIN)) 52 - { 49 + if (us->fflags & (US_FL_MAX_SECTORS_64 | US_FL_MAX_SECTORS_MIN)) { 53 50 unsigned int max_sectors = 64; 54 51 55 52 if (us->fflags & US_FL_MAX_SECTORS_MIN) ··· 60 55 max_sectors); 61 56 } 62 57 63 - if (sdev->type == TYPE_DISK) 64 - { 65 - if (us->subclass != USB_SC_SCSI && us->subclass != USB_SC_CYP_ATACB) 58 + if (sdev->type == TYPE_DISK) { 59 + if (us->subclass != USB_SC_SCSI && 60 + us->subclass != USB_SC_CYP_ATACB) 66 61 sdev->use_10_for_ms = 1; 67 62 sdev->use_192_bytes_for_3f = 1; 68 63 if (us->fflags & US_FL_NO_WP_DETECT) ··· 77 72 sdev->retry_hwerror = 1; 78 73 sdev->allow_restart = 1; 79 74 sdev->last_sector_bug = 1; 80 - } 81 - else 82 - { 75 + } else { 83 76 sdev->use_10_for_ms = 1; 84 77 } 85 78 86 - if ((us->protocol == USB_PR_CB || us->protocol == USB_PR_CBI) && sdev->scsi_level == SCSI_UNKNOWN) 79 + if ((us->protocol == USB_PR_CB || us->protocol == USB_PR_CBI) && 80 + sdev->scsi_level == SCSI_UNKNOWN) 87 81 us->max_lun = 0; 88 82 89 83 if (us->fflags & US_FL_NOT_LOCKABLE) ··· 92 88 } 93 89 94 90 /* This is always called with scsi_lock(host) held */ 95 - //----- queuecommand() --------------------- 96 - static int queuecommand_lck(struct scsi_cmnd *srb, void (*done)(struct scsi_cmnd *)) 91 + /* 92 + * queuecommand() 93 + */ 94 + static int queuecommand_lck(struct scsi_cmnd *srb, 95 + void (*done)(struct scsi_cmnd *)) 97 96 { 98 97 struct us_data *us = host_to_us(srb->device->host); 99 98 100 99 /* pr_info("scsiglue --- queuecommand\n"); */ 101 100 102 101 /* check for state-transition errors */ 103 - if (us->srb != NULL) 104 - { 102 + if (us->srb != NULL) { 105 103 /* pr_info("Error in %s: us->srb = %p\n" 106 104 __FUNCTION__, us->srb); */ 107 105 return SCSI_MLQUEUE_HOST_BUSY; 108 106 } 109 107 110 108 /* fail the command if we are disconnecting */ 111 - if (test_bit(US_FLIDX_DISCONNECTING, &us->dflags)) 112 - { 109 + if (test_bit(US_FLIDX_DISCONNECTING, &us->dflags)) { 113 110 pr_info("Fail command during disconnect\n"); 114 111 srb->result = DID_NO_CONNECT << 16; 115 112 done(srb); ··· 132 127 ***********************************************************************/ 133 128 134 129 /* Command timeout and abort */ 135 - //----- command_abort() --------------------- 130 + /* 131 + * command_abort() 132 + */ 136 133 static int command_abort(struct scsi_cmnd *srb) 137 134 { 138 135 struct us_data *us = host_to_us(srb->device->host); ··· 142 135 /* pr_info("scsiglue --- command_abort\n"); */ 143 136 144 137 scsi_lock(us_to_host(us)); 145 - if (us->srb != srb) 146 - { 138 + if (us->srb != srb) { 147 139 scsi_unlock(us_to_host(us)); 148 140 printk ("-- nothing to abort\n"); 149 141 return FAILED; 150 142 } 151 143 152 144 set_bit(US_FLIDX_TIMED_OUT, &us->dflags); 153 - if (!test_bit(US_FLIDX_RESETTING, &us->dflags)) 154 - { 145 + if (!test_bit(US_FLIDX_RESETTING, &us->dflags)) { 155 146 set_bit(US_FLIDX_ABORTING, &us->dflags); 156 147 usb_stor_stop_transport(us); 157 148 } ··· 160 155 return SUCCESS; 161 156 } 162 157 163 - /* This invokes the transport reset mechanism to reset the state of the device */ 164 - //----- device_reset() --------------------- 158 + /* This invokes the transport reset mechanism to reset the state of the 159 + * device. 160 + */ 161 + /* 162 + * device_reset() 163 + */ 165 164 static int device_reset(struct scsi_cmnd *srb) 166 165 { 167 166 struct us_data *us = host_to_us(srb->device->host); ··· 181 172 return result < 0 ? FAILED : SUCCESS; 182 173 } 183 174 184 - //----- bus_reset() --------------------- 175 + /* 176 + * bus_reset() 177 + */ 185 178 static int bus_reset(struct scsi_cmnd *srb) 186 179 { 187 180 struct us_data *us = host_to_us(srb->device->host); ··· 194 183 return result < 0 ? FAILED : SUCCESS; 195 184 } 196 185 197 - //----- usb_stor_report_device_reset() --------------------- 186 + /* 187 + * usb_stor_report_device_reset() 188 + */ 198 189 void usb_stor_report_device_reset(struct us_data *us) 199 190 { 200 191 int i; ··· 204 191 205 192 /* pr_info("scsiglue --- usb_stor_report_device_reset\n"); */ 206 193 scsi_report_device_reset(host, 0, 0); 207 - if (us->fflags & US_FL_SCM_MULT_TARG) 208 - { 194 + if (us->fflags & US_FL_SCM_MULT_TARG) { 209 195 for (i = 1; i < host->max_id; ++i) 210 196 scsi_report_device_reset(host, 0, i); 211 197 } 212 198 } 213 199 214 - //----- usb_stor_report_bus_reset() --------------------- 200 + /* 201 + * usb_stor_report_bus_reset() 202 + */ 215 203 void usb_stor_report_bus_reset(struct us_data *us) 216 204 { 217 205 struct Scsi_Host *host = us_to_host(us); ··· 232 218 #define SPRINTF(args...) \ 233 219 do { if (pos < buffer+length) pos += sprintf(pos, ## args); } while (0) 234 220 235 - //----- proc_info() --------------------- 236 - static int proc_info (struct Scsi_Host *host, char *buffer, char **start, off_t offset, int length, int inout) 221 + /* 222 + * proc_info() 223 + */ 224 + static int proc_info(struct Scsi_Host *host, char *buffer, char **start, 225 + off_t offset, int length, int inout) 237 226 { 238 227 struct us_data *us = host_to_us(host); 239 228 char *pos = buffer; ··· 275 258 SPRINTF(" Transport: %s\n", us->transport_name); 276 259 277 260 /* show the device flags */ 278 - if (pos < buffer + length) 279 - { 261 + if (pos < buffer + length) { 280 262 pos += sprintf(pos, " Quirks:"); 281 263 282 264 #define US_FLAG(name, value) \ ··· 290 274 *start = buffer + offset; 291 275 292 276 if ((pos - buffer) < offset) 293 - return (0); 277 + return 0; 294 278 else if ((pos - buffer - offset) < length) 295 - return (pos - buffer - offset); 279 + return pos - buffer - offset; 296 280 else 297 - return (length); 281 + return length; 298 282 } 299 283 300 284 /*********************************************************************** ··· 302 286 ***********************************************************************/ 303 287 304 288 /* Output routine for the sysfs max_sectors file */ 305 - //----- show_max_sectors() --------------------- 306 - static ssize_t show_max_sectors(struct device *dev, struct device_attribute *attr, char *buf) 289 + /* 290 + * show_max_sectors() 291 + */ 292 + static ssize_t show_max_sectors(struct device *dev, 293 + struct device_attribute *attr, char *buf) 307 294 { 308 295 struct scsi_device *sdev = to_scsi_device(dev); 309 296 ··· 315 296 } 316 297 317 298 /* Input routine for the sysfs max_sectors file */ 318 - //----- store_max_sectors() --------------------- 319 - static ssize_t store_max_sectors(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) 299 + /* 300 + * store_max_sectors() 301 + */ 302 + static ssize_t store_max_sectors(struct device *dev, 303 + struct device_attribute *attr, 304 + const char *buf, size_t count) 320 305 { 321 306 struct scsi_device *sdev = to_scsi_device(dev); 322 307 unsigned short ms; 323 308 324 309 /* pr_info("scsiglue --- ssize_t store_max_sectors\n"); */ 325 - if (sscanf(buf, "%hu", &ms) > 0 && ms <= SCSI_DEFAULT_MAX_SECTORS) 326 - { 310 + if (sscanf(buf, "%hu", &ms) > 0 && ms <= SCSI_DEFAULT_MAX_SECTORS) { 327 311 blk_queue_max_hw_sectors(sdev->request_queue, ms); 328 312 return strlen(buf); 329 313 } 330 - return -EINVAL; 314 + return -EINVAL; 331 315 } 332 316 333 317 static DEVICE_ATTR(max_sectors, S_IRUGO | S_IWUSR, show_max_sectors, store_max_sectors); ··· 338 316 339 317 /* this defines our host template, with which we'll allocate hosts */ 340 318 341 - //----- usb_stor_host_template() --------------------- 319 + /* 320 + * usb_stor_host_template() 321 + */ 342 322 struct scsi_host_template usb_stor_host_template = { 343 323 /* basic userland interface stuff */ 344 324 .name = "eucr-storage", ··· 403 379 * Scatter-gather transfer buffer access routines 404 380 ***********************************************************************/ 405 381 406 - //----- usb_stor_access_xfer_buf() --------------------- 382 + /* 383 + * usb_stor_access_xfer_buf() 384 + */ 407 385 unsigned int usb_stor_access_xfer_buf(struct us_data *us, unsigned char *buffer, 408 386 unsigned int buflen, struct scsi_cmnd *srb, struct scatterlist **sgptr, 409 387 unsigned int *offset, enum xfer_buf_dir dir) ··· 419 393 sg = scsi_sglist(srb); 420 394 421 395 cnt = 0; 422 - while (cnt < buflen && sg) 423 - { 424 - struct page *page = sg_page(sg) + ((sg->offset + *offset) >> PAGE_SHIFT); 396 + while (cnt < buflen && sg) { 397 + struct page *page = sg_page(sg) + 398 + ((sg->offset + *offset) >> PAGE_SHIFT); 425 399 unsigned int poff = (sg->offset + *offset) & (PAGE_SIZE-1); 426 400 unsigned int sglen = sg->length - *offset; 427 401 428 - if (sglen > buflen - cnt) 429 - { 402 + if (sglen > buflen - cnt) { 430 403 /* Transfer ends within this s-g entry */ 431 404 sglen = buflen - cnt; 432 405 *offset += sglen; 433 - } 434 - else 435 - { 406 + } else { 436 407 /* Transfer continues to next s-g entry */ 437 408 *offset = 0; 438 409 sg = sg_next(sg); 439 410 } 440 411 441 - while (sglen > 0) 442 - { 443 - unsigned int plen = min(sglen, (unsigned int)PAGE_SIZE - poff); 412 + while (sglen > 0) { 413 + unsigned int plen = min(sglen, 414 + (unsigned int)PAGE_SIZE - poff); 444 415 unsigned char *ptr = kmap(page); 445 416 446 417 if (dir == TO_XFER_BUF) ··· 459 436 return cnt; 460 437 } 461 438 462 - /* Store the contents of buffer into srb's transfer buffer and set the SCSI residue. */ 463 - //----- usb_stor_set_xfer_buf() --------------------- 464 - void usb_stor_set_xfer_buf(struct us_data *us, unsigned char *buffer, unsigned int buflen, struct scsi_cmnd *srb, 465 - unsigned int dir) 439 + /* 440 + * Store the contents of buffer into srb's transfer 441 + * buffer and set the SCSI residue. 442 + */ 443 + /* 444 + * usb_stor_set_xfer_buf() 445 + */ 446 + void usb_stor_set_xfer_buf(struct us_data *us, unsigned char *buffer, 447 + unsigned int buflen, struct scsi_cmnd *srb, unsigned int dir) 466 448 { 467 449 unsigned int offset = 0; 468 450 struct scatterlist *sg = NULL; 469 451 470 452 /* pr_info("transport --- usb_stor_set_xfer_buf\n"); */ 471 - // TO_XFER_BUF = 0, FROM_XFER_BUF = 1 453 + /* TO_XFER_BUF = 0, FROM_XFER_BUF = 1 */ 472 454 buflen = min(buflen, scsi_bufflen(srb)); 473 - buflen = usb_stor_access_xfer_buf(us, buffer, buflen, srb, &sg, &offset, dir); 455 + buflen = usb_stor_access_xfer_buf(us, buffer, buflen, srb, 456 + &sg, &offset, dir); 474 457 if (buflen < scsi_bufflen(srb)) 475 458 scsi_set_resid(srb, scsi_bufflen(srb) - buflen); 476 459 }