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

sym53c8xx_2: switch to ->show_info()

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

Al Viro ee127fec 0ffddfbb

+21 -94
+21 -94
drivers/scsi/sym53c8xx_2/sym_glue.c
··· 1171 1171 #endif /* SYM_LINUX_USER_COMMAND_SUPPORT */ 1172 1172 1173 1173 1174 - #ifdef SYM_LINUX_USER_INFO_SUPPORT 1175 - /* 1176 - * Informations through the proc file system. 1177 - */ 1178 - struct info_str { 1179 - char *buffer; 1180 - int length; 1181 - int offset; 1182 - int pos; 1183 - }; 1184 - 1185 - static void copy_mem_info(struct info_str *info, char *data, int len) 1186 - { 1187 - if (info->pos + len > info->length) 1188 - len = info->length - info->pos; 1189 - 1190 - if (info->pos + len < info->offset) { 1191 - info->pos += len; 1192 - return; 1193 - } 1194 - if (info->pos < info->offset) { 1195 - data += (info->offset - info->pos); 1196 - len -= (info->offset - info->pos); 1197 - } 1198 - 1199 - if (len > 0) { 1200 - memcpy(info->buffer + info->pos, data, len); 1201 - info->pos += len; 1202 - } 1203 - } 1204 - 1205 - static int copy_info(struct info_str *info, char *fmt, ...) 1206 - { 1207 - va_list args; 1208 - char buf[81]; 1209 - int len; 1210 - 1211 - va_start(args, fmt); 1212 - len = vsprintf(buf, fmt, args); 1213 - va_end(args); 1214 - 1215 - copy_mem_info(info, buf, len); 1216 - return len; 1217 - } 1218 - 1219 1174 /* 1220 1175 * Copy formatted information into the input buffer. 1221 1176 */ 1222 - static int sym_host_info(struct Scsi_Host *shost, char *ptr, off_t offset, int len) 1177 + static int sym_show_info(struct seq_file *m, struct Scsi_Host *shost) 1223 1178 { 1179 + #ifdef SYM_LINUX_USER_INFO_SUPPORT 1224 1180 struct sym_data *sym_data = shost_priv(shost); 1225 1181 struct pci_dev *pdev = sym_data->pdev; 1226 1182 struct sym_hcb *np = sym_data->ncb; 1227 - struct info_str info; 1228 1183 1229 - info.buffer = ptr; 1230 - info.length = len; 1231 - info.offset = offset; 1232 - info.pos = 0; 1233 - 1234 - copy_info(&info, "Chip " NAME53C "%s, device id 0x%x, " 1235 - "revision id 0x%x\n", np->s.chip_name, 1236 - pdev->device, pdev->revision); 1237 - copy_info(&info, "At PCI address %s, IRQ %u\n", 1184 + seq_printf(m, "Chip " NAME53C "%s, device id 0x%x, " 1185 + "revision id 0x%x\n", np->s.chip_name, 1186 + pdev->device, pdev->revision); 1187 + seq_printf(m, "At PCI address %s, IRQ %u\n", 1238 1188 pci_name(pdev), pdev->irq); 1239 - copy_info(&info, "Min. period factor %d, %s SCSI BUS%s\n", 1240 - (int) (np->minsync_dt ? np->minsync_dt : np->minsync), 1241 - np->maxwide ? "Wide" : "Narrow", 1242 - np->minsync_dt ? ", DT capable" : ""); 1189 + seq_printf(m, "Min. period factor %d, %s SCSI BUS%s\n", 1190 + (int) (np->minsync_dt ? np->minsync_dt : np->minsync), 1191 + np->maxwide ? "Wide" : "Narrow", 1192 + np->minsync_dt ? ", DT capable" : ""); 1243 1193 1244 - copy_info(&info, "Max. started commands %d, " 1245 - "max. commands per LUN %d\n", 1246 - SYM_CONF_MAX_START, SYM_CONF_MAX_TAG); 1194 + seq_printf(m, "Max. started commands %d, " 1195 + "max. commands per LUN %d\n", 1196 + SYM_CONF_MAX_START, SYM_CONF_MAX_TAG); 1247 1197 1248 - return info.pos > info.offset? info.pos - info.offset : 0; 1249 - } 1198 + return 0; 1199 + #else 1200 + return -EINVAL; 1250 1201 #endif /* SYM_LINUX_USER_INFO_SUPPORT */ 1251 - 1252 - /* 1253 - * Entry point of the scsi proc fs of the driver. 1254 - * - func = 0 means read (returns adapter infos) 1255 - * - func = 1 means write (not yet merget from sym53c8xx) 1256 - */ 1257 - static int sym53c8xx_proc_info(struct Scsi_Host *shost, char *buffer, 1258 - char **start, off_t offset, int length, int func) 1259 - { 1260 - int retv; 1261 - 1262 - if (func) { 1263 - #ifdef SYM_LINUX_USER_COMMAND_SUPPORT 1264 - retv = sym_user_command(shost, buffer, length); 1265 - #else 1266 - retv = -EINVAL; 1267 - #endif 1268 - } else { 1269 - if (start) 1270 - *start = buffer; 1271 - #ifdef SYM_LINUX_USER_INFO_SUPPORT 1272 - retv = sym_host_info(shost, buffer, offset, length); 1273 - #else 1274 - retv = -EINVAL; 1275 - #endif 1276 - } 1277 - 1278 - return retv; 1279 1202 } 1203 + 1280 1204 #endif /* SYM_LINUX_PROC_INFO_SUPPORT */ 1281 1205 1282 1206 /* ··· 1666 1742 .use_clustering = ENABLE_CLUSTERING, 1667 1743 .max_sectors = 0xFFFF, 1668 1744 #ifdef SYM_LINUX_PROC_INFO_SUPPORT 1669 - .proc_info = sym53c8xx_proc_info, 1745 + .show_info = sym_show_info, 1746 + #ifdef SYM_LINUX_USER_COMMAND_SUPPORT 1747 + .write_info = sym_user_command, 1748 + #endif 1670 1749 .proc_name = NAME53C8XX, 1671 1750 #endif 1672 1751 };