drm: shmobile: remove unused MERAM support
[sfrench/cifs-2.6.git] / lib / vsprintf.c
index d7a708f82559ca38e768cb93fc0febb999711e4c..30c0cb8cc9bce78089cb6ad48bcb6b3d5d02e6b2 100644 (file)
@@ -336,7 +336,7 @@ char *put_dec(char *buf, unsigned long long n)
  *
  * If speed is not important, use snprintf(). It's easy to read the code.
  */
-int num_to_str(char *buf, int size, unsigned long long num)
+int num_to_str(char *buf, int size, unsigned long long num, unsigned int width)
 {
        /* put_dec requires 2-byte alignment of the buffer. */
        char tmp[sizeof(num) * 3] __aligned(2);
@@ -350,11 +350,21 @@ int num_to_str(char *buf, int size, unsigned long long num)
                len = put_dec(tmp, num) - tmp;
        }
 
-       if (len > size)
+       if (len > size || width > size)
                return 0;
+
+       if (width > len) {
+               width = width - len;
+               for (idx = 0; idx < width; idx++)
+                       buf[idx] = ' ';
+       } else {
+               width = 0;
+       }
+
        for (idx = 0; idx < len; ++idx)
-               buf[idx] = tmp[len - idx - 1];
-       return len;
+               buf[idx + width] = tmp[len - idx - 1];
+
+       return len + width;
 }
 
 #define SIGN   1               /* unsigned/signed, must be 1 */
@@ -2591,6 +2601,8 @@ int vbin_printf(u32 *bin_buf, size_t size, const char *fmt, va_list args)
                        case 's':
                        case 'F':
                        case 'f':
+                       case 'x':
+                       case 'K':
                                save_arg(void *);
                                break;
                        default:
@@ -2765,6 +2777,8 @@ int bstr_printf(char *buf, size_t size, const char *fmt, const u32 *bin_buf)
                        case 's':
                        case 'F':
                        case 'f':
+                       case 'x':
+                       case 'K':
                                process = true;
                                break;
                        default: