diff options
author | Joe Perches <joe@perches.com> | 2011-10-31 20:11:33 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2011-10-31 20:30:54 -0400 |
commit | b9075fa968a0a4347aef35e235e2995c0e57dddd (patch) | |
tree | cf9f9716784e790d8a43339653256d9cf9178ff3 /include/linux/device.h | |
parent | ae29bc92da01a2e9d278a9a58c3b307d41cc0254 (diff) |
treewide: use __printf not __attribute__((format(printf,...)))
Standardize the style for compiler based printf format verification.
Standardized the location of __printf too.
Done via script and a little typing.
$ grep -rPl --include=*.[ch] -w "__attribute__" * | \
grep -vP "^(tools|scripts|include/linux/compiler-gcc.h)" | \
xargs perl -n -i -e 'local $/; while (<>) { s/\b__attribute__\s*\(\s*\(\s*format\s*\(\s*printf\s*,\s*(.+)\s*,\s*(.+)\s*\)\s*\)\s*\)/__printf($1, $2)/g ; print; }'
[akpm@linux-foundation.org: revert arch bits]
Signed-off-by: Joe Perches <joe@perches.com>
Cc: "Kirill A. Shutemov" <kirill@shutemov.name>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'include/linux/device.h')
-rw-r--r-- | include/linux/device.h | 110 |
1 files changed, 51 insertions, 59 deletions
diff --git a/include/linux/device.h b/include/linux/device.h index 85e78fc7d7fd..e88abeecfadf 100644 --- a/include/linux/device.h +++ b/include/linux/device.h | |||
@@ -622,8 +622,8 @@ static inline const char *dev_name(const struct device *dev) | |||
622 | return kobject_name(&dev->kobj); | 622 | return kobject_name(&dev->kobj); |
623 | } | 623 | } |
624 | 624 | ||
625 | extern int dev_set_name(struct device *dev, const char *name, ...) | 625 | extern __printf(2, 3) |
626 | __attribute__((format(printf, 2, 3))); | 626 | int dev_set_name(struct device *dev, const char *name, ...); |
627 | 627 | ||
628 | #ifdef CONFIG_NUMA | 628 | #ifdef CONFIG_NUMA |
629 | static inline int dev_to_node(struct device *dev) | 629 | static inline int dev_to_node(struct device *dev) |
@@ -753,10 +753,10 @@ extern struct device *device_create_vargs(struct class *cls, | |||
753 | void *drvdata, | 753 | void *drvdata, |
754 | const char *fmt, | 754 | const char *fmt, |
755 | va_list vargs); | 755 | va_list vargs); |
756 | extern struct device *device_create(struct class *cls, struct device *parent, | 756 | extern __printf(5, 6) |
757 | dev_t devt, void *drvdata, | 757 | struct device *device_create(struct class *cls, struct device *parent, |
758 | const char *fmt, ...) | 758 | dev_t devt, void *drvdata, |
759 | __attribute__((format(printf, 5, 6))); | 759 | const char *fmt, ...); |
760 | extern void device_destroy(struct class *cls, dev_t devt); | 760 | extern void device_destroy(struct class *cls, dev_t devt); |
761 | 761 | ||
762 | /* | 762 | /* |
@@ -800,64 +800,56 @@ extern const char *dev_driver_string(const struct device *dev); | |||
800 | 800 | ||
801 | extern int __dev_printk(const char *level, const struct device *dev, | 801 | extern int __dev_printk(const char *level, const struct device *dev, |
802 | struct va_format *vaf); | 802 | struct va_format *vaf); |
803 | extern int dev_printk(const char *level, const struct device *dev, | 803 | extern __printf(3, 4) |
804 | const char *fmt, ...) | 804 | int dev_printk(const char *level, const struct device *dev, |
805 | __attribute__ ((format (printf, 3, 4))); | 805 | const char *fmt, ...) |
806 | extern int dev_emerg(const struct device *dev, const char *fmt, ...) | 806 | ; |
807 | __attribute__ ((format (printf, 2, 3))); | 807 | extern __printf(2, 3) |
808 | extern int dev_alert(const struct device *dev, const char *fmt, ...) | 808 | int dev_emerg(const struct device *dev, const char *fmt, ...); |
809 | __attribute__ ((format (printf, 2, 3))); | 809 | extern __printf(2, 3) |
810 | extern int dev_crit(const struct device *dev, const char *fmt, ...) | 810 | int dev_alert(const struct device *dev, const char *fmt, ...); |
811 | __attribute__ ((format (printf, 2, 3))); | 811 | extern __printf(2, 3) |
812 | extern int dev_err(const struct device *dev, const char *fmt, ...) | 812 | int dev_crit(const struct device *dev, const char *fmt, ...); |
813 | __attribute__ ((format (printf, 2, 3))); | 813 | extern __printf(2, 3) |
814 | extern int dev_warn(const struct device *dev, const char *fmt, ...) | 814 | int dev_err(const struct device *dev, const char *fmt, ...); |
815 | __attribute__ ((format (printf, 2, 3))); | 815 | extern __printf(2, 3) |
816 | extern int dev_notice(const struct device *dev, const char *fmt, ...) | 816 | int dev_warn(const struct device *dev, const char *fmt, ...); |
817 | __attribute__ ((format (printf, 2, 3))); | 817 | extern __printf(2, 3) |
818 | extern int _dev_info(const struct device *dev, const char *fmt, ...) | 818 | int dev_notice(const struct device *dev, const char *fmt, ...); |
819 | __attribute__ ((format (printf, 2, 3))); | 819 | extern __printf(2, 3) |
820 | int _dev_info(const struct device *dev, const char *fmt, ...); | ||
820 | 821 | ||
821 | #else | 822 | #else |
822 | 823 | ||
823 | static inline int __dev_printk(const char *level, const struct device *dev, | 824 | static inline int __dev_printk(const char *level, const struct device *dev, |
824 | struct va_format *vaf) | 825 | struct va_format *vaf) |
825 | { return 0; } | 826 | { return 0; } |
826 | static inline int dev_printk(const char *level, const struct device *dev, | 827 | static inline __printf(3, 4) |
827 | const char *fmt, ...) | 828 | int dev_printk(const char *level, const struct device *dev, |
828 | __attribute__ ((format (printf, 3, 4))); | 829 | const char *fmt, ...) |
829 | static inline int dev_printk(const char *level, const struct device *dev, | 830 | { return 0; } |
830 | const char *fmt, ...) | 831 | |
831 | { return 0; } | 832 | static inline __printf(2, 3) |
832 | 833 | int dev_emerg(const struct device *dev, const char *fmt, ...) | |
833 | static inline int dev_emerg(const struct device *dev, const char *fmt, ...) | 834 | { return 0; } |
834 | __attribute__ ((format (printf, 2, 3))); | 835 | static inline __printf(2, 3) |
835 | static inline int dev_emerg(const struct device *dev, const char *fmt, ...) | 836 | int dev_crit(const struct device *dev, const char *fmt, ...) |
836 | { return 0; } | 837 | { return 0; } |
837 | static inline int dev_crit(const struct device *dev, const char *fmt, ...) | 838 | static inline __printf(2, 3) |
838 | __attribute__ ((format (printf, 2, 3))); | 839 | int dev_alert(const struct device *dev, const char *fmt, ...) |
839 | static inline int dev_crit(const struct device *dev, const char *fmt, ...) | 840 | { return 0; } |
840 | { return 0; } | 841 | static inline __printf(2, 3) |
841 | static inline int dev_alert(const struct device *dev, const char *fmt, ...) | 842 | int dev_err(const struct device *dev, const char *fmt, ...) |
842 | __attribute__ ((format (printf, 2, 3))); | 843 | { return 0; } |
843 | static inline int dev_alert(const struct device *dev, const char *fmt, ...) | 844 | static inline __printf(2, 3) |
844 | { return 0; } | 845 | int dev_warn(const struct device *dev, const char *fmt, ...) |
845 | static inline int dev_err(const struct device *dev, const char *fmt, ...) | 846 | { return 0; } |
846 | __attribute__ ((format (printf, 2, 3))); | 847 | static inline __printf(2, 3) |
847 | static inline int dev_err(const struct device *dev, const char *fmt, ...) | 848 | int dev_notice(const struct device *dev, const char *fmt, ...) |
848 | { return 0; } | 849 | { return 0; } |
849 | static inline int dev_warn(const struct device *dev, const char *fmt, ...) | 850 | static inline __printf(2, 3) |
850 | __attribute__ ((format (printf, 2, 3))); | 851 | int _dev_info(const struct device *dev, const char *fmt, ...) |
851 | static inline int dev_warn(const struct device *dev, const char *fmt, ...) | 852 | { return 0; } |
852 | { return 0; } | ||
853 | static inline int dev_notice(const struct device *dev, const char *fmt, ...) | ||
854 | __attribute__ ((format (printf, 2, 3))); | ||
855 | static inline int dev_notice(const struct device *dev, const char *fmt, ...) | ||
856 | { return 0; } | ||
857 | static inline int _dev_info(const struct device *dev, const char *fmt, ...) | ||
858 | __attribute__ ((format (printf, 2, 3))); | ||
859 | static inline int _dev_info(const struct device *dev, const char *fmt, ...) | ||
860 | { return 0; } | ||
861 | 853 | ||
862 | #endif | 854 | #endif |
863 | 855 | ||