Commit 0cc96a745059e8daf1d7d6a26672f0ad9056e989

Authored by Andy Shevchenko
Committed by Chris Metcalf
1 parent f862eefec0

arch: tile: re-use kbasename() helper

kbasename() returns the filename part of a pathname.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>

Showing 1 changed file with 5 additions and 7 deletions Side-by-side Diff

arch/tile/kernel/stack.c
... ... @@ -23,6 +23,7 @@
23 23 #include <linux/mmzone.h>
24 24 #include <linux/dcache.h>
25 25 #include <linux/fs.h>
  26 +#include <linux/string.h>
26 27 #include <asm/backtrace.h>
27 28 #include <asm/page.h>
28 29 #include <asm/ucontext.h>
29 30  
30 31  
31 32  
32 33  
... ... @@ -332,21 +333,18 @@
332 333 }
333 334  
334 335 if (vma->vm_file) {
335   - char *s;
336 336 p = d_path(&vma->vm_file->f_path, buf, bufsize);
337 337 if (IS_ERR(p))
338 338 p = "?";
339   - s = strrchr(p, '/');
340   - if (s)
341   - p = s+1;
  339 + name = kbasename(p);
342 340 } else {
343   - p = "anon";
  341 + name = "anon";
344 342 }
345 343  
346 344 /* Generate a string description of the vma info. */
347   - namelen = strlen(p);
  345 + namelen = strlen(name);
348 346 remaining = (bufsize - 1) - namelen;
349   - memmove(buf, p, namelen);
  347 + memmove(buf, name, namelen);
350 348 snprintf(buf + namelen, remaining, "[%lx+%lx] ",
351 349 vma->vm_start, vma->vm_end - vma->vm_start);
352 350 }