diff options
author | Geert Uytterhoeven <geert+renesas@glider.be> | 2014-08-20 09:26:35 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2014-09-24 02:32:50 -0400 |
commit | bef59c5024be687ef4f228915af9961307a779ab (patch) | |
tree | 9ca8c7108389038f9f2a8369673371d360b3b315 /drivers/base/devres.c | |
parent | 54270354b518952da934ee1c7e13ed1c9654fd22 (diff) |
devres: Improve devm_kasprintf()/kvasprintf() support
- Add devm_kasprintf()/kvasprintf(), introduced by commit
75f2a4ead5d5890ada9c2663a70fb58613c0d9f2 ("devres: Add
devm_kasprintf and devm_kvasprintf API"), to
Documentation/driver-model/devres.txt,
- Improve kernel doc: the string is not an existing formatted string,
but is formatted into the newly-allocated buffer,
- Add a __printf() annotation to devm_kasprintf(), so the compiler
will verify the format string argument types.
Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/base/devres.c')
-rw-r--r-- | drivers/base/devres.c | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/drivers/base/devres.c b/drivers/base/devres.c index 69d9b0c89a01..c8a53d1e019f 100644 --- a/drivers/base/devres.c +++ b/drivers/base/devres.c | |||
@@ -817,13 +817,13 @@ char *devm_kstrdup(struct device *dev, const char *s, gfp_t gfp) | |||
817 | EXPORT_SYMBOL_GPL(devm_kstrdup); | 817 | EXPORT_SYMBOL_GPL(devm_kstrdup); |
818 | 818 | ||
819 | /** | 819 | /** |
820 | * devm_kvasprintf - Allocate resource managed space | 820 | * devm_kvasprintf - Allocate resource managed space and format a string |
821 | * for the formatted string. | 821 | * into that. |
822 | * @dev: Device to allocate memory for | 822 | * @dev: Device to allocate memory for |
823 | * @gfp: the GFP mask used in the devm_kmalloc() call when | 823 | * @gfp: the GFP mask used in the devm_kmalloc() call when |
824 | * allocating memory | 824 | * allocating memory |
825 | * @fmt: the formatted string to duplicate | 825 | * @fmt: The printf()-style format string |
826 | * @ap: the list of tokens to be placed in the formatted string | 826 | * @ap: Arguments for the format string |
827 | * RETURNS: | 827 | * RETURNS: |
828 | * Pointer to allocated string on success, NULL on failure. | 828 | * Pointer to allocated string on success, NULL on failure. |
829 | */ | 829 | */ |
@@ -849,12 +849,13 @@ char *devm_kvasprintf(struct device *dev, gfp_t gfp, const char *fmt, | |||
849 | EXPORT_SYMBOL(devm_kvasprintf); | 849 | EXPORT_SYMBOL(devm_kvasprintf); |
850 | 850 | ||
851 | /** | 851 | /** |
852 | * devm_kasprintf - Allocate resource managed space | 852 | * devm_kasprintf - Allocate resource managed space and format a string |
853 | * and copy an existing formatted string into that | 853 | * into that. |
854 | * @dev: Device to allocate memory for | 854 | * @dev: Device to allocate memory for |
855 | * @gfp: the GFP mask used in the devm_kmalloc() call when | 855 | * @gfp: the GFP mask used in the devm_kmalloc() call when |
856 | * allocating memory | 856 | * allocating memory |
857 | * @fmt: the string to duplicate | 857 | * @fmt: The printf()-style format string |
858 | * @...: Arguments for the format string | ||
858 | * RETURNS: | 859 | * RETURNS: |
859 | * Pointer to allocated string on success, NULL on failure. | 860 | * Pointer to allocated string on success, NULL on failure. |
860 | */ | 861 | */ |