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

aix7xxx_old: switch to ->show_info()

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

Al Viro f0002e95 3f025677

+60 -163
+1 -1
drivers/scsi/aic7xxx_old.c
··· 11108 11108 11109 11109 11110 11110 static struct scsi_host_template driver_template = { 11111 - .proc_info = aic7xxx_proc_info, 11111 + .show_info = aic7xxx_show_info, 11112 11112 .detect = aic7xxx_detect, 11113 11113 .release = aic7xxx_release, 11114 11114 .info = aic7xxx_info,
+59 -162
drivers/scsi/aic7xxx_old/aic7xxx_proc.c
··· 30 30 *-M*************************************************************************/ 31 31 32 32 33 - #define BLS (&aic7xxx_buffer[size]) 34 33 #define HDRB \ 35 34 " 0 - 4K 4 - 16K 16 - 64K 64 - 256K 256K - 1M 1M+" 36 35 37 - #ifdef PROC_DEBUG 38 - extern int vsprintf(char *, const char *, va_list); 39 - 40 - static void 41 - proc_debug(const char *fmt, ...) 42 - { 43 - va_list ap; 44 - char buf[256]; 45 - 46 - va_start(ap, fmt); 47 - vsprintf(buf, fmt, ap); 48 - printk(buf); 49 - va_end(ap); 50 - } 51 - #else /* PROC_DEBUG */ 52 - # define proc_debug(fmt, args...) 53 - #endif /* PROC_DEBUG */ 54 - 55 - static int aic7xxx_buffer_size = 0; 56 - static char *aic7xxx_buffer = NULL; 57 - 58 36 59 37 /*+F************************************************************************* 60 38 * Function: 61 - * aic7xxx_set_info 62 - * 63 - * Description: 64 - * Set parameters for the driver from the /proc filesystem. 65 - *-F*************************************************************************/ 66 - static int 67 - aic7xxx_set_info(char *buffer, int length, struct Scsi_Host *HBAptr) 68 - { 69 - proc_debug("aic7xxx_set_info(): %s\n", buffer); 70 - return (-ENOSYS); /* Currently this is a no-op */ 71 - } 72 - 73 - 74 - /*+F************************************************************************* 75 - * Function: 76 - * aic7xxx_proc_info 39 + * aic7xxx_show_info 77 40 * 78 41 * Description: 79 42 * Return information to handle /proc support for the driver. 80 43 *-F*************************************************************************/ 81 44 int 82 - aic7xxx_proc_info ( struct Scsi_Host *HBAptr, char *buffer, char **start, off_t offset, int length, 83 - int inout) 45 + aic7xxx_show_info(struct seq_file *m, struct Scsi_Host *HBAptr) 84 46 { 85 47 struct aic7xxx_host *p; 86 48 struct aic_dev_data *aic_dev; 87 49 struct scsi_device *sdptr; 88 - int size = 0; 89 50 unsigned char i; 90 51 unsigned char tindex; 91 52 ··· 55 94 56 95 if (!p) 57 96 { 58 - size += sprintf(buffer, "Can't find adapter for host number %d\n", HBAptr->host_no); 59 - if (size > length) 60 - { 61 - return (size); 62 - } 63 - else 64 - { 65 - return (length); 66 - } 67 - } 68 - 69 - if (inout == TRUE) /* Has data been written to the file? */ 70 - { 71 - return (aic7xxx_set_info(buffer, length, HBAptr)); 97 + seq_printf(m, "Can't find adapter for host number %d\n", HBAptr->host_no); 98 + return 0; 72 99 } 73 100 74 101 p = (struct aic7xxx_host *) HBAptr->hostdata; 75 102 76 - /* 77 - * It takes roughly 1K of space to hold all relevant card info, not 78 - * counting any proc stats, so we start out with a 1.5k buffer size and 79 - * if proc_stats is defined, then we sweep the stats structure to see 80 - * how many drives we will be printing out for and add 384 bytes per 81 - * device with active stats. 82 - * 83 - * Hmmmm...that 1.5k seems to keep growing as items get added so they 84 - * can be easily viewed for debugging purposes. So, we bumped that 85 - * 1.5k to 4k so we can quit having to bump it all the time. 86 - */ 87 - 88 - size = 4096; 89 - list_for_each_entry(aic_dev, &p->aic_devs, list) 90 - size += 512; 91 - if (aic7xxx_buffer_size != size) 92 - { 93 - if (aic7xxx_buffer != NULL) 94 - { 95 - kfree(aic7xxx_buffer); 96 - aic7xxx_buffer_size = 0; 97 - } 98 - aic7xxx_buffer = kmalloc(size, GFP_KERNEL); 99 - } 100 - if (aic7xxx_buffer == NULL) 101 - { 102 - size = sprintf(buffer, "AIC7xxx - kmalloc error at line %d\n", 103 - __LINE__); 104 - return size; 105 - } 106 - aic7xxx_buffer_size = size; 107 - 108 - size = 0; 109 - size += sprintf(BLS, "Adaptec AIC7xxx driver version: "); 110 - size += sprintf(BLS, "%s/", AIC7XXX_C_VERSION); 111 - size += sprintf(BLS, "%s", AIC7XXX_H_VERSION); 112 - size += sprintf(BLS, "\n"); 113 - size += sprintf(BLS, "Adapter Configuration:\n"); 114 - size += sprintf(BLS, " SCSI Adapter: %s\n", 103 + seq_printf(m, "Adaptec AIC7xxx driver version: "); 104 + seq_printf(m, "%s/", AIC7XXX_C_VERSION); 105 + seq_printf(m, "%s", AIC7XXX_H_VERSION); 106 + seq_printf(m, "\n"); 107 + seq_printf(m, "Adapter Configuration:\n"); 108 + seq_printf(m, " SCSI Adapter: %s\n", 115 109 board_names[p->board_name_index]); 116 110 if (p->flags & AHC_TWIN) 117 - size += sprintf(BLS, " Twin Channel Controller "); 111 + seq_printf(m, " Twin Channel Controller "); 118 112 else 119 113 { 120 114 char *channel = ""; ··· 100 184 ultra = "Ultra-2 LVD/SE "; 101 185 else if (p->features & AHC_ULTRA) 102 186 ultra = "Ultra "; 103 - size += sprintf(BLS, " %s%sController%s ", 187 + seq_printf(m, " %s%sController%s ", 104 188 ultra, wide, channel); 105 189 } 106 190 switch(p->chip & ~AHC_CHIPID_MASK) 107 191 { 108 192 case AHC_VL: 109 - size += sprintf(BLS, "at VLB slot %d\n", p->pci_device_fn); 193 + seq_printf(m, "at VLB slot %d\n", p->pci_device_fn); 110 194 break; 111 195 case AHC_EISA: 112 - size += sprintf(BLS, "at EISA slot %d\n", p->pci_device_fn); 196 + seq_printf(m, "at EISA slot %d\n", p->pci_device_fn); 113 197 break; 114 198 default: 115 - size += sprintf(BLS, "at PCI %d/%d/%d\n", p->pci_bus, 199 + seq_printf(m, "at PCI %d/%d/%d\n", p->pci_bus, 116 200 PCI_SLOT(p->pci_device_fn), PCI_FUNC(p->pci_device_fn)); 117 201 break; 118 202 } 119 203 if( !(p->maddr) ) 120 204 { 121 - size += sprintf(BLS, " Programmed I/O Base: %lx\n", p->base); 205 + seq_printf(m, " Programmed I/O Base: %lx\n", p->base); 122 206 } 123 207 else 124 208 { 125 - size += sprintf(BLS, " PCI MMAPed I/O Base: 0x%lx\n", p->mbase); 209 + seq_printf(m, " PCI MMAPed I/O Base: 0x%lx\n", p->mbase); 126 210 } 127 211 if( (p->chip & (AHC_VL | AHC_EISA)) ) 128 212 { 129 - size += sprintf(BLS, " BIOS Memory Address: 0x%08x\n", p->bios_address); 213 + seq_printf(m, " BIOS Memory Address: 0x%08x\n", p->bios_address); 130 214 } 131 - size += sprintf(BLS, " Adapter SEEPROM Config: %s\n", 215 + seq_printf(m, " Adapter SEEPROM Config: %s\n", 132 216 (p->flags & AHC_SEEPROM_FOUND) ? "SEEPROM found and used." : 133 217 ((p->flags & AHC_USEDEFAULTS) ? "SEEPROM not found, using defaults." : 134 218 "SEEPROM not found, using leftover BIOS values.") ); 135 - size += sprintf(BLS, " Adaptec SCSI BIOS: %s\n", 219 + seq_printf(m, " Adaptec SCSI BIOS: %s\n", 136 220 (p->flags & AHC_BIOS_ENABLED) ? "Enabled" : "Disabled"); 137 - size += sprintf(BLS, " IRQ: %d\n", HBAptr->irq); 138 - size += sprintf(BLS, " SCBs: Active %d, Max Active %d,\n", 221 + seq_printf(m, " IRQ: %d\n", HBAptr->irq); 222 + seq_printf(m, " SCBs: Active %d, Max Active %d,\n", 139 223 p->activescbs, p->max_activescbs); 140 - size += sprintf(BLS, " Allocated %d, HW %d, " 224 + seq_printf(m, " Allocated %d, HW %d, " 141 225 "Page %d\n", p->scb_data->numscbs, p->scb_data->maxhscbs, 142 226 p->scb_data->maxscbs); 143 227 if (p->flags & AHC_EXTERNAL_SRAM) 144 - size += sprintf(BLS, " Using External SCB SRAM\n"); 145 - size += sprintf(BLS, " Interrupts: %ld", p->isr_count); 228 + seq_printf(m, " Using External SCB SRAM\n"); 229 + seq_printf(m, " Interrupts: %ld", p->isr_count); 146 230 if (p->chip & AHC_EISA) 147 231 { 148 - size += sprintf(BLS, " %s\n", 232 + seq_printf(m, " %s\n", 149 233 (p->pause & IRQMS) ? "(Level Sensitive)" : "(Edge Triggered)"); 150 234 } 151 235 else 152 236 { 153 - size += sprintf(BLS, "\n"); 237 + seq_printf(m, "\n"); 154 238 } 155 - size += sprintf(BLS, " BIOS Control Word: 0x%04x\n", 239 + seq_printf(m, " BIOS Control Word: 0x%04x\n", 156 240 p->bios_control); 157 - size += sprintf(BLS, " Adapter Control Word: 0x%04x\n", 241 + seq_printf(m, " Adapter Control Word: 0x%04x\n", 158 242 p->adapter_control); 159 - size += sprintf(BLS, " Extended Translation: %sabled\n", 243 + seq_printf(m, " Extended Translation: %sabled\n", 160 244 (p->flags & AHC_EXTEND_TRANS_A) ? "En" : "Dis"); 161 - size += sprintf(BLS, "Disconnect Enable Flags: 0x%04x\n", p->discenable); 245 + seq_printf(m, "Disconnect Enable Flags: 0x%04x\n", p->discenable); 162 246 if (p->features & (AHC_ULTRA | AHC_ULTRA2)) 163 247 { 164 - size += sprintf(BLS, " Ultra Enable Flags: 0x%04x\n", p->ultraenb); 248 + seq_printf(m, " Ultra Enable Flags: 0x%04x\n", p->ultraenb); 165 249 } 166 - size += sprintf(BLS, "Default Tag Queue Depth: %d\n", aic7xxx_default_queue_depth); 167 - size += sprintf(BLS, " Tagged Queue By Device array for aic7xxx host " 250 + seq_printf(m, "Default Tag Queue Depth: %d\n", aic7xxx_default_queue_depth); 251 + seq_printf(m, " Tagged Queue By Device array for aic7xxx host " 168 252 "instance %d:\n", p->instance); 169 - size += sprintf(BLS, " {"); 253 + seq_printf(m, " {"); 170 254 for(i=0; i < (MAX_TARGETS - 1); i++) 171 - size += sprintf(BLS, "%d,",aic7xxx_tag_info[p->instance].tag_commands[i]); 172 - size += sprintf(BLS, "%d}\n",aic7xxx_tag_info[p->instance].tag_commands[i]); 255 + seq_printf(m, "%d,",aic7xxx_tag_info[p->instance].tag_commands[i]); 256 + seq_printf(m, "%d}\n",aic7xxx_tag_info[p->instance].tag_commands[i]); 173 257 174 - size += sprintf(BLS, "\n"); 175 - size += sprintf(BLS, "Statistics:\n\n"); 258 + seq_printf(m, "\n"); 259 + seq_printf(m, "Statistics:\n\n"); 176 260 list_for_each_entry(aic_dev, &p->aic_devs, list) 177 261 { 178 262 sdptr = aic_dev->SDptr; 179 263 tindex = sdptr->channel << 3 | sdptr->id; 180 - size += sprintf(BLS, "(scsi%d:%d:%d:%d)\n", 264 + seq_printf(m, "(scsi%d:%d:%d:%d)\n", 181 265 p->host_no, sdptr->channel, sdptr->id, sdptr->lun); 182 - size += sprintf(BLS, " Device using %s/%s", 266 + seq_printf(m, " Device using %s/%s", 183 267 (aic_dev->cur.width == MSG_EXT_WDTR_BUS_16_BIT) ? 184 268 "Wide" : "Narrow", 185 269 (aic_dev->cur.offset != 0) ? ··· 195 279 sync_rate = aic7xxx_find_syncrate(p, &period, 0, &options); 196 280 if (sync_rate != NULL) 197 281 { 198 - size += sprintf(BLS, "%s MByte/sec, offset %d\n", 282 + seq_printf(m, "%s MByte/sec, offset %d\n", 199 283 sync_rate->rate[rate], 200 284 aic_dev->cur.offset ); 201 285 } 202 286 else 203 287 { 204 - size += sprintf(BLS, "3.3 MByte/sec, offset %d\n", 288 + seq_printf(m, "3.3 MByte/sec, offset %d\n", 205 289 aic_dev->cur.offset ); 206 290 } 207 291 } 208 - size += sprintf(BLS, " Transinfo settings: "); 209 - size += sprintf(BLS, "current(%d/%d/%d/%d), ", 292 + seq_printf(m, " Transinfo settings: "); 293 + seq_printf(m, "current(%d/%d/%d/%d), ", 210 294 aic_dev->cur.period, 211 295 aic_dev->cur.offset, 212 296 aic_dev->cur.width, 213 297 aic_dev->cur.options); 214 - size += sprintf(BLS, "goal(%d/%d/%d/%d), ", 298 + seq_printf(m, "goal(%d/%d/%d/%d), ", 215 299 aic_dev->goal.period, 216 300 aic_dev->goal.offset, 217 301 aic_dev->goal.width, 218 302 aic_dev->goal.options); 219 - size += sprintf(BLS, "user(%d/%d/%d/%d)\n", 303 + seq_printf(m, "user(%d/%d/%d/%d)\n", 220 304 p->user[tindex].period, 221 305 p->user[tindex].offset, 222 306 p->user[tindex].width, 223 307 p->user[tindex].options); 224 308 if(sdptr->simple_tags) 225 309 { 226 - size += sprintf(BLS, " Tagged Command Queueing Enabled, Ordered Tags %s, Depth %d/%d\n", sdptr->ordered_tags ? "Enabled" : "Disabled", sdptr->queue_depth, aic_dev->max_q_depth); 310 + seq_printf(m, " Tagged Command Queueing Enabled, Ordered Tags %s, Depth %d/%d\n", sdptr->ordered_tags ? "Enabled" : "Disabled", sdptr->queue_depth, aic_dev->max_q_depth); 227 311 } 228 312 if(aic_dev->barrier_total) 229 - size += sprintf(BLS, " Total transfers %ld:\n (%ld/%ld/%ld/%ld reads/writes/REQ_BARRIER/Ordered Tags)\n", 313 + seq_printf(m, " Total transfers %ld:\n (%ld/%ld/%ld/%ld reads/writes/REQ_BARRIER/Ordered Tags)\n", 230 314 aic_dev->r_total+aic_dev->w_total, aic_dev->r_total, aic_dev->w_total, 231 315 aic_dev->barrier_total, aic_dev->ordered_total); 232 316 else 233 - size += sprintf(BLS, " Total transfers %ld:\n (%ld/%ld reads/writes)\n", 317 + seq_printf(m, " Total transfers %ld:\n (%ld/%ld reads/writes)\n", 234 318 aic_dev->r_total+aic_dev->w_total, aic_dev->r_total, aic_dev->w_total); 235 - size += sprintf(BLS, "%s\n", HDRB); 236 - size += sprintf(BLS, " Reads:"); 319 + seq_printf(m, "%s\n", HDRB); 320 + seq_printf(m, " Reads:"); 237 321 for (i = 0; i < ARRAY_SIZE(aic_dev->r_bins); i++) 238 322 { 239 - size += sprintf(BLS, " %10ld", aic_dev->r_bins[i]); 323 + seq_printf(m, " %10ld", aic_dev->r_bins[i]); 240 324 } 241 - size += sprintf(BLS, "\n"); 242 - size += sprintf(BLS, " Writes:"); 325 + seq_printf(m, "\n"); 326 + seq_printf(m, " Writes:"); 243 327 for (i = 0; i < ARRAY_SIZE(aic_dev->w_bins); i++) 244 328 { 245 - size += sprintf(BLS, " %10ld", aic_dev->w_bins[i]); 329 + seq_printf(m, " %10ld", aic_dev->w_bins[i]); 246 330 } 247 - size += sprintf(BLS, "\n"); 248 - size += sprintf(BLS, "\n\n"); 331 + seq_printf(m, "\n"); 332 + seq_printf(m, "\n\n"); 249 333 } 250 - if (size >= aic7xxx_buffer_size) 251 - { 252 - printk(KERN_WARNING "aic7xxx: Overflow in aic7xxx_proc.c\n"); 253 - } 254 - 255 - if (offset > size - 1) 256 - { 257 - kfree(aic7xxx_buffer); 258 - aic7xxx_buffer = NULL; 259 - aic7xxx_buffer_size = length = 0; 260 - *start = NULL; 261 - } 262 - else 263 - { 264 - *start = buffer; 265 - length = min_t(int, length, size - offset); 266 - memcpy(buffer, &aic7xxx_buffer[offset], length); 267 - } 268 - 269 - return (length); 334 + return 0; 270 335 } 271 336 272 337 /*