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

aic7xxx: switch to ->show_info()

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

Al Viro 6b3a8bbf f6f83a6c

+48 -126
+2 -7
drivers/scsi/aic7xxx/aic7xxx_osm.c
··· 803 803 .module = THIS_MODULE, 804 804 .name = "aic7xxx", 805 805 .proc_name = "aic7xxx", 806 - .proc_info = ahc_linux_proc_info, 806 + .show_info = ahc_linux_show_info, 807 + .write_info = ahc_proc_write_seeprom, 807 808 .info = ahc_linux_info, 808 809 .queuecommand = ahc_linux_queue, 809 810 .eh_abort_handler = ahc_linux_abort, ··· 1632 1631 switch (code) { 1633 1632 case AC_TRANSFER_NEG: 1634 1633 { 1635 - char buf[80]; 1636 1634 struct scsi_target *starget; 1637 1635 struct ahc_linux_target *targ; 1638 - struct info_str info; 1639 1636 struct ahc_initiator_tinfo *tinfo; 1640 1637 struct ahc_tmode_tstate *tstate; 1641 1638 int target_offset; ··· 1641 1642 1642 1643 BUG_ON(target == CAM_TARGET_WILDCARD); 1643 1644 1644 - info.buffer = buf; 1645 - info.length = sizeof(buf); 1646 - info.offset = 0; 1647 - info.pos = 0; 1648 1645 tinfo = ahc_fetch_transinfo(ahc, channel, 1649 1646 channel == 'A' ? ahc->our_id 1650 1647 : ahc->our_id_b,
+2 -10
drivers/scsi/aic7xxx/aic7xxx_osm.h
··· 383 383 int ahc_linux_register_host(struct ahc_softc *, 384 384 struct scsi_host_template *); 385 385 386 - /*************************** Pretty Printing **********************************/ 387 - struct info_str { 388 - char *buffer; 389 - int length; 390 - off_t offset; 391 - int pos; 392 - }; 393 - 394 386 /******************************** Locking *************************************/ 395 387 /* Lock protecting internal data structures */ 396 388 ··· 515 523 } 516 524 517 525 /**************************** Proc FS Support *********************************/ 518 - int ahc_linux_proc_info(struct Scsi_Host *, char *, char **, 519 - off_t, int, int); 526 + int ahc_proc_write_seeprom(struct Scsi_Host *, char *, int); 527 + int ahc_linux_show_info(struct seq_file *, struct Scsi_Host *); 520 528 521 529 /*************************** Domain Validation ********************************/ 522 530 /*********************** Transaction Access Wrappers *************************/
+44 -109
drivers/scsi/aic7xxx/aic7xxx_proc.c
··· 43 43 #include "aic7xxx_inline.h" 44 44 #include "aic7xxx_93cx6.h" 45 45 46 - static void copy_mem_info(struct info_str *info, char *data, int len); 47 - static int copy_info(struct info_str *info, char *fmt, ...); 48 46 static void ahc_dump_target_state(struct ahc_softc *ahc, 49 - struct info_str *info, 47 + struct seq_file *m, 50 48 u_int our_id, char channel, 51 49 u_int target_id, u_int target_offset); 52 - static void ahc_dump_device_state(struct info_str *info, 50 + static void ahc_dump_device_state(struct seq_file *m, 53 51 struct scsi_device *dev); 54 - static int ahc_proc_write_seeprom(struct ahc_softc *ahc, 55 - char *buffer, int length); 56 52 57 53 /* 58 54 * Table of syncrates that don't follow the "divisible by 4" ··· 90 94 return (10000000 / (period_factor * 4 * 10)); 91 95 } 92 96 93 - 94 97 static void 95 - copy_mem_info(struct info_str *info, char *data, int len) 96 - { 97 - if (info->pos + len > info->offset + info->length) 98 - len = info->offset + info->length - info->pos; 99 - 100 - if (info->pos + len < info->offset) { 101 - info->pos += len; 102 - return; 103 - } 104 - 105 - if (info->pos < info->offset) { 106 - off_t partial; 107 - 108 - partial = info->offset - info->pos; 109 - data += partial; 110 - info->pos += partial; 111 - len -= partial; 112 - } 113 - 114 - if (len > 0) { 115 - memcpy(info->buffer, data, len); 116 - info->pos += len; 117 - info->buffer += len; 118 - } 119 - } 120 - 121 - static int 122 - copy_info(struct info_str *info, char *fmt, ...) 123 - { 124 - va_list args; 125 - char buf[256]; 126 - int len; 127 - 128 - va_start(args, fmt); 129 - len = vsprintf(buf, fmt, args); 130 - va_end(args); 131 - 132 - copy_mem_info(info, buf, len); 133 - return (len); 134 - } 135 - 136 - static void 137 - ahc_format_transinfo(struct info_str *info, struct ahc_transinfo *tinfo) 98 + ahc_format_transinfo(struct seq_file *m, struct ahc_transinfo *tinfo) 138 99 { 139 100 u_int speed; 140 101 u_int freq; ··· 106 153 speed *= (0x01 << tinfo->width); 107 154 mb = speed / 1000; 108 155 if (mb > 0) 109 - copy_info(info, "%d.%03dMB/s transfers", mb, speed % 1000); 156 + seq_printf(m, "%d.%03dMB/s transfers", mb, speed % 1000); 110 157 else 111 - copy_info(info, "%dKB/s transfers", speed); 158 + seq_printf(m, "%dKB/s transfers", speed); 112 159 113 160 if (freq != 0) { 114 - copy_info(info, " (%d.%03dMHz%s, offset %d", 161 + seq_printf(m, " (%d.%03dMHz%s, offset %d", 115 162 freq / 1000, freq % 1000, 116 163 (tinfo->ppr_options & MSG_EXT_PPR_DT_REQ) != 0 117 164 ? " DT" : "", tinfo->offset); ··· 119 166 120 167 if (tinfo->width > 0) { 121 168 if (freq != 0) { 122 - copy_info(info, ", "); 169 + seq_printf(m, ", "); 123 170 } else { 124 - copy_info(info, " ("); 171 + seq_printf(m, " ("); 125 172 } 126 - copy_info(info, "%dbit)", 8 * (0x01 << tinfo->width)); 173 + seq_printf(m, "%dbit)", 8 * (0x01 << tinfo->width)); 127 174 } else if (freq != 0) { 128 - copy_info(info, ")"); 175 + seq_printf(m, ")"); 129 176 } 130 - copy_info(info, "\n"); 177 + seq_printf(m, "\n"); 131 178 } 132 179 133 180 static void 134 - ahc_dump_target_state(struct ahc_softc *ahc, struct info_str *info, 181 + ahc_dump_target_state(struct ahc_softc *ahc, struct seq_file *m, 135 182 u_int our_id, char channel, u_int target_id, 136 183 u_int target_offset) 137 184 { ··· 143 190 tinfo = ahc_fetch_transinfo(ahc, channel, our_id, 144 191 target_id, &tstate); 145 192 if ((ahc->features & AHC_TWIN) != 0) 146 - copy_info(info, "Channel %c ", channel); 147 - copy_info(info, "Target %d Negotiation Settings\n", target_id); 148 - copy_info(info, "\tUser: "); 149 - ahc_format_transinfo(info, &tinfo->user); 193 + seq_printf(m, "Channel %c ", channel); 194 + seq_printf(m, "Target %d Negotiation Settings\n", target_id); 195 + seq_printf(m, "\tUser: "); 196 + ahc_format_transinfo(m, &tinfo->user); 150 197 starget = ahc->platform_data->starget[target_offset]; 151 198 if (!starget) 152 199 return; 153 200 154 - copy_info(info, "\tGoal: "); 155 - ahc_format_transinfo(info, &tinfo->goal); 156 - copy_info(info, "\tCurr: "); 157 - ahc_format_transinfo(info, &tinfo->curr); 201 + seq_printf(m, "\tGoal: "); 202 + ahc_format_transinfo(m, &tinfo->goal); 203 + seq_printf(m, "\tCurr: "); 204 + ahc_format_transinfo(m, &tinfo->curr); 158 205 159 206 for (lun = 0; lun < AHC_NUM_LUNS; lun++) { 160 207 struct scsi_device *sdev; ··· 164 211 if (sdev == NULL) 165 212 continue; 166 213 167 - ahc_dump_device_state(info, sdev); 214 + ahc_dump_device_state(m, sdev); 168 215 } 169 216 } 170 217 171 218 static void 172 - ahc_dump_device_state(struct info_str *info, struct scsi_device *sdev) 219 + ahc_dump_device_state(struct seq_file *m, struct scsi_device *sdev) 173 220 { 174 221 struct ahc_linux_device *dev = scsi_transport_device_data(sdev); 175 222 176 - copy_info(info, "\tChannel %c Target %d Lun %d Settings\n", 223 + seq_printf(m, "\tChannel %c Target %d Lun %d Settings\n", 177 224 sdev->sdev_target->channel + 'A', 178 225 sdev->sdev_target->id, sdev->lun); 179 226 180 - copy_info(info, "\t\tCommands Queued %ld\n", dev->commands_issued); 181 - copy_info(info, "\t\tCommands Active %d\n", dev->active); 182 - copy_info(info, "\t\tCommand Openings %d\n", dev->openings); 183 - copy_info(info, "\t\tMax Tagged Openings %d\n", dev->maxtags); 184 - copy_info(info, "\t\tDevice Queue Frozen Count %d\n", dev->qfrozen); 227 + seq_printf(m, "\t\tCommands Queued %ld\n", dev->commands_issued); 228 + seq_printf(m, "\t\tCommands Active %d\n", dev->active); 229 + seq_printf(m, "\t\tCommand Openings %d\n", dev->openings); 230 + seq_printf(m, "\t\tMax Tagged Openings %d\n", dev->maxtags); 231 + seq_printf(m, "\t\tDevice Queue Frozen Count %d\n", dev->qfrozen); 185 232 } 186 233 187 - static int 188 - ahc_proc_write_seeprom(struct ahc_softc *ahc, char *buffer, int length) 234 + int 235 + ahc_proc_write_seeprom(struct Scsi_Host *shost, char *buffer, int length) 189 236 { 237 + struct ahc_softc *ahc = *(struct ahc_softc **)shost->hostdata; 190 238 struct seeprom_descriptor sd; 191 239 int have_seeprom; 192 240 u_long s; ··· 286 332 * Return information to handle /proc support for the driver. 287 333 */ 288 334 int 289 - ahc_linux_proc_info(struct Scsi_Host *shost, char *buffer, char **start, 290 - off_t offset, int length, int inout) 335 + ahc_linux_show_info(struct seq_file *m, struct Scsi_Host *shost) 291 336 { 292 337 struct ahc_softc *ahc = *(struct ahc_softc **)shost->hostdata; 293 - struct info_str info; 294 338 char ahc_info[256]; 295 339 u_int max_targ; 296 340 u_int i; 297 - int retval; 298 341 299 - /* Has data been written to the file? */ 300 - if (inout == TRUE) { 301 - retval = ahc_proc_write_seeprom(ahc, buffer, length); 302 - goto done; 303 - } 304 - 305 - if (start) 306 - *start = buffer; 307 - 308 - info.buffer = buffer; 309 - info.length = length; 310 - info.offset = offset; 311 - info.pos = 0; 312 - 313 - copy_info(&info, "Adaptec AIC7xxx driver version: %s\n", 342 + seq_printf(m, "Adaptec AIC7xxx driver version: %s\n", 314 343 AIC7XXX_DRIVER_VERSION); 315 - copy_info(&info, "%s\n", ahc->description); 344 + seq_printf(m, "%s\n", ahc->description); 316 345 ahc_controller_info(ahc, ahc_info); 317 - copy_info(&info, "%s\n", ahc_info); 318 - copy_info(&info, "Allocated SCBs: %d, SG List Length: %d\n\n", 346 + seq_printf(m, "%s\n", ahc_info); 347 + seq_printf(m, "Allocated SCBs: %d, SG List Length: %d\n\n", 319 348 ahc->scb_data->numscbs, AHC_NSEG); 320 349 321 350 322 351 if (ahc->seep_config == NULL) 323 - copy_info(&info, "No Serial EEPROM\n"); 352 + seq_printf(m, "No Serial EEPROM\n"); 324 353 else { 325 - copy_info(&info, "Serial EEPROM:\n"); 354 + seq_printf(m, "Serial EEPROM:\n"); 326 355 for (i = 0; i < sizeof(*ahc->seep_config)/2; i++) { 327 356 if (((i % 8) == 0) && (i != 0)) { 328 - copy_info(&info, "\n"); 357 + seq_printf(m, "\n"); 329 358 } 330 - copy_info(&info, "0x%.4x ", 359 + seq_printf(m, "0x%.4x ", 331 360 ((uint16_t*)ahc->seep_config)[i]); 332 361 } 333 - copy_info(&info, "\n"); 362 + seq_printf(m, "\n"); 334 363 } 335 - copy_info(&info, "\n"); 364 + seq_printf(m, "\n"); 336 365 337 366 max_targ = 16; 338 367 if ((ahc->features & (AHC_WIDE|AHC_TWIN)) == 0) ··· 335 398 target_id = i % 8; 336 399 } 337 400 338 - ahc_dump_target_state(ahc, &info, our_id, 401 + ahc_dump_target_state(ahc, m, our_id, 339 402 channel, target_id, i); 340 403 } 341 - retval = info.pos > info.offset ? info.pos - info.offset : 0; 342 - done: 343 - return (retval); 404 + return 0; 344 405 }