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

hypfs: swich hypfs_create_u64() to returning int

same story as for hypfs_create_str()

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

Al Viro 723c2ba8 63f76f51

+21 -26
+1 -2
arch/s390/hypfs/hypfs.h
··· 22 22 23 23 extern struct dentry *hypfs_mkdir(struct dentry *parent, const char *name); 24 24 25 - extern struct dentry *hypfs_create_u64(struct dentry *dir, const char *name, 26 - __u64 value); 25 + extern int hypfs_create_u64(struct dentry *dir, const char *name, __u64 value); 27 26 28 27 extern int hypfs_create_str(struct dentry *dir, const char *name, char *string); 29 28
+10 -10
arch/s390/hypfs/hypfs_diag_fs.c
··· 204 204 { 205 205 struct dentry *cpu_dir; 206 206 char buffer[TMP_SIZE]; 207 - void *rc; 207 + int rc; 208 208 209 209 snprintf(buffer, TMP_SIZE, "%d", cpu_info__cpu_addr(diag204_get_info_type(), 210 210 cpu_info)); ··· 214 214 rc = hypfs_create_u64(cpu_dir, "mgmtime", 215 215 cpu_info__acc_time(diag204_get_info_type(), cpu_info) - 216 216 cpu_info__lp_time(diag204_get_info_type(), cpu_info)); 217 - if (IS_ERR(rc)) 218 - return PTR_ERR(rc); 217 + if (rc) 218 + return rc; 219 219 rc = hypfs_create_u64(cpu_dir, "cputime", 220 220 cpu_info__lp_time(diag204_get_info_type(), cpu_info)); 221 - if (IS_ERR(rc)) 222 - return PTR_ERR(rc); 221 + if (rc) 222 + return rc; 223 223 if (diag204_get_info_type() == DIAG204_INFO_EXT) { 224 224 rc = hypfs_create_u64(cpu_dir, "onlinetime", 225 225 cpu_info__online_time(diag204_get_info_type(), 226 226 cpu_info)); 227 - if (IS_ERR(rc)) 228 - return PTR_ERR(rc); 227 + if (rc) 228 + return rc; 229 229 } 230 230 diag224_idx2name(cpu_info__ctidx(diag204_get_info_type(), cpu_info), buffer); 231 231 return hypfs_create_str(cpu_dir, "type", buffer); ··· 263 263 { 264 264 struct dentry *cpu_dir; 265 265 char buffer[TMP_SIZE]; 266 - void *rc; 266 + int rc; 267 267 268 268 snprintf(buffer, TMP_SIZE, "%i", phys_cpu__cpu_addr(diag204_get_info_type(), 269 269 cpu_info)); ··· 272 272 return PTR_ERR(cpu_dir); 273 273 rc = hypfs_create_u64(cpu_dir, "mgmtime", 274 274 phys_cpu__mgm_time(diag204_get_info_type(), cpu_info)); 275 - if (IS_ERR(rc)) 276 - return PTR_ERR(rc); 275 + if (rc) 276 + return rc; 277 277 diag224_idx2name(phys_cpu__ctidx(diag204_get_info_type(), cpu_info), buffer); 278 278 return hypfs_create_str(cpu_dir, "type", buffer); 279 279 }
+6 -9
arch/s390/hypfs/hypfs_vm_fs.c
··· 19 19 20 20 #define ATTRIBUTE(dir, name, member) \ 21 21 do { \ 22 - void *rc; \ 23 - rc = hypfs_create_u64(dir, name, member); \ 24 - if (IS_ERR(rc)) \ 25 - return PTR_ERR(rc); \ 22 + int rc = hypfs_create_u64(dir, name, member); \ 23 + if (rc) \ 24 + return rc; \ 26 25 } while (0) 27 26 28 27 static int hypfs_vm_create_guest(struct dentry *systems_dir, ··· 84 85 85 86 int hypfs_vm_create_files(struct dentry *root) 86 87 { 87 - struct dentry *dir, *file; 88 + struct dentry *dir; 88 89 struct diag2fc_data *data; 89 90 unsigned int count = 0; 90 91 int rc, i; ··· 109 110 rc = PTR_ERR(dir); 110 111 goto failed; 111 112 } 112 - file = hypfs_create_u64(dir, "count", data->lcpus); 113 - if (IS_ERR(file)) { 114 - rc = PTR_ERR(file); 113 + rc = hypfs_create_u64(dir, "count", data->lcpus); 114 + if (rc) 115 115 goto failed; 116 - } 117 116 118 117 /* guests */ 119 118 dir = hypfs_mkdir(root, "systems");
+4 -5
arch/s390/hypfs/inode.c
··· 377 377 return dentry; 378 378 } 379 379 380 - struct dentry *hypfs_create_u64(struct dentry *dir, 381 - const char *name, __u64 value) 380 + int hypfs_create_u64(struct dentry *dir, const char *name, __u64 value) 382 381 { 383 382 char *buffer; 384 383 char tmp[TMP_SIZE]; ··· 386 387 snprintf(tmp, TMP_SIZE, "%llu\n", (unsigned long long int)value); 387 388 buffer = kstrdup(tmp, GFP_KERNEL); 388 389 if (!buffer) 389 - return ERR_PTR(-ENOMEM); 390 + return -ENOMEM; 390 391 dentry = 391 392 hypfs_create_file(dir, name, buffer, S_IFREG | REG_FILE_MODE); 392 393 if (IS_ERR(dentry)) { 393 394 kfree(buffer); 394 - return ERR_PTR(-ENOMEM); 395 + return -ENOMEM; 395 396 } 396 397 hypfs_add_dentry(dentry); 397 - return dentry; 398 + return 0; 398 399 } 399 400 400 401 int hypfs_create_str(struct dentry *dir, const char *name, char *string)