aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/Kconfig4
-rw-r--r--lib/iommu-helper.c9
-rw-r--r--lib/vsprintf.c12
3 files changed, 23 insertions, 2 deletions
diff --git a/lib/Kconfig b/lib/Kconfig
index c7ad7a5b3535..85cf7ea978aa 100644
--- a/lib/Kconfig
+++ b/lib/Kconfig
@@ -8,10 +8,10 @@ config BITREVERSE
8 tristate 8 tristate
9 9
10config GENERIC_FIND_FIRST_BIT 10config GENERIC_FIND_FIRST_BIT
11 def_bool n 11 bool
12 12
13config GENERIC_FIND_NEXT_BIT 13config GENERIC_FIND_NEXT_BIT
14 def_bool n 14 bool
15 15
16config CRC_CCITT 16config CRC_CCITT
17 tristate "CRC-CCITT functions" 17 tristate "CRC-CCITT functions"
diff --git a/lib/iommu-helper.c b/lib/iommu-helper.c
index 5d90074dca75..75dbda03f4fb 100644
--- a/lib/iommu-helper.c
+++ b/lib/iommu-helper.c
@@ -79,3 +79,12 @@ void iommu_area_free(unsigned long *map, unsigned long start, unsigned int nr)
79 } 79 }
80} 80}
81EXPORT_SYMBOL(iommu_area_free); 81EXPORT_SYMBOL(iommu_area_free);
82
83unsigned long iommu_num_pages(unsigned long addr, unsigned long len,
84 unsigned long io_page_size)
85{
86 unsigned long size = (addr & (io_page_size - 1)) + len;
87
88 return DIV_ROUND_UP(size, io_page_size);
89}
90EXPORT_SYMBOL(iommu_num_pages);
diff --git a/lib/vsprintf.c b/lib/vsprintf.c
index c399bc1093cb..4c6674a41ed9 100644
--- a/lib/vsprintf.c
+++ b/lib/vsprintf.c
@@ -565,6 +565,10 @@ static char *pointer(const char *fmt, char *buf, char *end, void *ptr, int field
565 * @fmt: The format string to use 565 * @fmt: The format string to use
566 * @args: Arguments for the format string 566 * @args: Arguments for the format string
567 * 567 *
568 * This function follows C99 vsnprintf, but has some extensions:
569 * %pS output the name of a text symbol
570 * %pF output the name of a function pointer
571 *
568 * The return value is the number of characters which would 572 * The return value is the number of characters which would
569 * be generated for the given input, excluding the trailing 573 * be generated for the given input, excluding the trailing
570 * '\0', as per ISO C99. If you want to have the exact 574 * '\0', as per ISO C99. If you want to have the exact
@@ -806,6 +810,8 @@ EXPORT_SYMBOL(vsnprintf);
806 * 810 *
807 * Call this function if you are already dealing with a va_list. 811 * Call this function if you are already dealing with a va_list.
808 * You probably want scnprintf() instead. 812 * You probably want scnprintf() instead.
813 *
814 * See the vsnprintf() documentation for format string extensions over C99.
809 */ 815 */
810int vscnprintf(char *buf, size_t size, const char *fmt, va_list args) 816int vscnprintf(char *buf, size_t size, const char *fmt, va_list args)
811{ 817{
@@ -828,6 +834,8 @@ EXPORT_SYMBOL(vscnprintf);
828 * generated for the given input, excluding the trailing null, 834 * generated for the given input, excluding the trailing null,
829 * as per ISO C99. If the return is greater than or equal to 835 * as per ISO C99. If the return is greater than or equal to
830 * @size, the resulting string is truncated. 836 * @size, the resulting string is truncated.
837 *
838 * See the vsnprintf() documentation for format string extensions over C99.
831 */ 839 */
832int snprintf(char * buf, size_t size, const char *fmt, ...) 840int snprintf(char * buf, size_t size, const char *fmt, ...)
833{ 841{
@@ -877,6 +885,8 @@ EXPORT_SYMBOL(scnprintf);
877 * 885 *
878 * Call this function if you are already dealing with a va_list. 886 * Call this function if you are already dealing with a va_list.
879 * You probably want sprintf() instead. 887 * You probably want sprintf() instead.
888 *
889 * See the vsnprintf() documentation for format string extensions over C99.
880 */ 890 */
881int vsprintf(char *buf, const char *fmt, va_list args) 891int vsprintf(char *buf, const char *fmt, va_list args)
882{ 892{
@@ -894,6 +904,8 @@ EXPORT_SYMBOL(vsprintf);
894 * The function returns the number of characters written 904 * The function returns the number of characters written
895 * into @buf. Use snprintf() or scnprintf() in order to avoid 905 * into @buf. Use snprintf() or scnprintf() in order to avoid
896 * buffer overflows. 906 * buffer overflows.
907 *
908 * See the vsnprintf() documentation for format string extensions over C99.
897 */ 909 */
898int sprintf(char * buf, const char *fmt, ...) 910int sprintf(char * buf, const char *fmt, ...)
899{ 911{