Commit 09dae7fc57a010288875ef46a44e30d16cedd232

Authored by Al Viro
1 parent dd7ab71bb3

usb-storage: switch to ->show_info()

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>

Showing 1 changed file with 14 additions and 28 deletions Side-by-side Diff

drivers/usb/storage/scsiglue.c
... ... @@ -438,22 +438,21 @@
438 438 * /proc/scsi/ functions
439 439 ***********************************************************************/
440 440  
  441 +static int write_info(struct Scsi_Host *host, char *buffer, int length)
  442 +{
  443 + /* if someone is sending us data, just throw it away */
  444 + return length;
  445 +}
  446 +
441 447 /* we use this macro to help us write into the buffer */
442 448 #undef SPRINTF
443   -#define SPRINTF(args...) \
444   - do { if (pos < buffer+length) pos += sprintf(pos, ## args); } while (0)
  449 +#define SPRINTF(args...) seq_printf(m, ## args)
445 450  
446   -static int proc_info (struct Scsi_Host *host, char *buffer,
447   - char **start, off_t offset, int length, int inout)
  451 +static int show_info (struct seq_file *m, struct Scsi_Host *host)
448 452 {
449 453 struct us_data *us = host_to_us(host);
450   - char *pos = buffer;
451 454 const char *string;
452 455  
453   - /* if someone is sending us data, just throw it away */
454   - if (inout)
455   - return length;
456   -
457 456 /* print the controller name */
458 457 SPRINTF(" Host scsi%d: usb-storage\n", host->host_no);
459 458  
460 459  
461 460  
... ... @@ -483,28 +482,14 @@
483 482 SPRINTF(" Transport: %s\n", us->transport_name);
484 483  
485 484 /* show the device flags */
486   - if (pos < buffer + length) {
487   - pos += sprintf(pos, " Quirks:");
  485 + SPRINTF(" Quirks:");
488 486  
489 487 #define US_FLAG(name, value) \
490   - if (us->fflags & value) pos += sprintf(pos, " " #name);
  488 + if (us->fflags & value) seq_printf(m, " " #name);
491 489 US_DO_ALL_FLAGS
492 490 #undef US_FLAG
493   -
494   - *(pos++) = '\n';
495   - }
496   -
497   - /*
498   - * Calculate start of next buffer, and return value.
499   - */
500   - *start = buffer + offset;
501   -
502   - if ((pos - buffer) < offset)
503   - return (0);
504   - else if ((pos - buffer - offset) < length)
505   - return (pos - buffer - offset);
506   - else
507   - return (length);
  491 + seq_putc(m, '\n');
  492 + return 0;
508 493 }
509 494  
510 495 /***********************************************************************
... ... @@ -549,7 +534,8 @@
549 534 /* basic userland interface stuff */
550 535 .name = "usb-storage",
551 536 .proc_name = "usb-storage",
552   - .proc_info = proc_info,
  537 + .show_info = show_info,
  538 + .write_info = write_info,
553 539 .info = host_info,
554 540  
555 541 /* command interface -- queued only */