aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/device.h
diff options
context:
space:
mode:
authorJoe Perches <joe@perches.com>2011-10-31 20:11:33 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2011-10-31 20:30:54 -0400
commitb9075fa968a0a4347aef35e235e2995c0e57dddd (patch)
treecf9f9716784e790d8a43339653256d9cf9178ff3 /include/linux/device.h
parentae29bc92da01a2e9d278a9a58c3b307d41cc0254 (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.h110
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
625extern int dev_set_name(struct device *dev, const char *name, ...) 625extern __printf(2, 3)
626 __attribute__((format(printf, 2, 3))); 626int dev_set_name(struct device *dev, const char *name, ...);
627 627
628#ifdef CONFIG_NUMA 628#ifdef CONFIG_NUMA
629static inline int dev_to_node(struct device *dev) 629static 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);
756extern struct device *device_create(struct class *cls, struct device *parent, 756extern __printf(5, 6)
757 dev_t devt, void *drvdata, 757struct 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, ...);
760extern void device_destroy(struct class *cls, dev_t devt); 760extern 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
801extern int __dev_printk(const char *level, const struct device *dev, 801extern int __dev_printk(const char *level, const struct device *dev,
802 struct va_format *vaf); 802 struct va_format *vaf);
803extern int dev_printk(const char *level, const struct device *dev, 803extern __printf(3, 4)
804 const char *fmt, ...) 804int dev_printk(const char *level, const struct device *dev,
805 __attribute__ ((format (printf, 3, 4))); 805 const char *fmt, ...)
806extern int dev_emerg(const struct device *dev, const char *fmt, ...) 806 ;
807 __attribute__ ((format (printf, 2, 3))); 807extern __printf(2, 3)
808extern int dev_alert(const struct device *dev, const char *fmt, ...) 808int dev_emerg(const struct device *dev, const char *fmt, ...);
809 __attribute__ ((format (printf, 2, 3))); 809extern __printf(2, 3)
810extern int dev_crit(const struct device *dev, const char *fmt, ...) 810int dev_alert(const struct device *dev, const char *fmt, ...);
811 __attribute__ ((format (printf, 2, 3))); 811extern __printf(2, 3)
812extern int dev_err(const struct device *dev, const char *fmt, ...) 812int dev_crit(const struct device *dev, const char *fmt, ...);
813 __attribute__ ((format (printf, 2, 3))); 813extern __printf(2, 3)
814extern int dev_warn(const struct device *dev, const char *fmt, ...) 814int dev_err(const struct device *dev, const char *fmt, ...);
815 __attribute__ ((format (printf, 2, 3))); 815extern __printf(2, 3)
816extern int dev_notice(const struct device *dev, const char *fmt, ...) 816int dev_warn(const struct device *dev, const char *fmt, ...);
817 __attribute__ ((format (printf, 2, 3))); 817extern __printf(2, 3)
818extern int _dev_info(const struct device *dev, const char *fmt, ...) 818int dev_notice(const struct device *dev, const char *fmt, ...);
819 __attribute__ ((format (printf, 2, 3))); 819extern __printf(2, 3)
820int _dev_info(const struct device *dev, const char *fmt, ...);
820 821
821#else 822#else
822 823
823static inline int __dev_printk(const char *level, const struct device *dev, 824static 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; }
826static inline int dev_printk(const char *level, const struct device *dev, 827static inline __printf(3, 4)
827 const char *fmt, ...) 828int dev_printk(const char *level, const struct device *dev,
828 __attribute__ ((format (printf, 3, 4))); 829 const char *fmt, ...)
829static inline int dev_printk(const char *level, const struct device *dev, 830{ return 0; }
830 const char *fmt, ...) 831
831 { return 0; } 832static inline __printf(2, 3)
832 833int dev_emerg(const struct device *dev, const char *fmt, ...)
833static inline int dev_emerg(const struct device *dev, const char *fmt, ...) 834{ return 0; }
834 __attribute__ ((format (printf, 2, 3))); 835static inline __printf(2, 3)
835static inline int dev_emerg(const struct device *dev, const char *fmt, ...) 836int dev_crit(const struct device *dev, const char *fmt, ...)
836 { return 0; } 837{ return 0; }
837static inline int dev_crit(const struct device *dev, const char *fmt, ...) 838static inline __printf(2, 3)
838 __attribute__ ((format (printf, 2, 3))); 839int dev_alert(const struct device *dev, const char *fmt, ...)
839static inline int dev_crit(const struct device *dev, const char *fmt, ...) 840{ return 0; }
840 { return 0; } 841static inline __printf(2, 3)
841static inline int dev_alert(const struct device *dev, const char *fmt, ...) 842int dev_err(const struct device *dev, const char *fmt, ...)
842 __attribute__ ((format (printf, 2, 3))); 843{ return 0; }
843static inline int dev_alert(const struct device *dev, const char *fmt, ...) 844static inline __printf(2, 3)
844 { return 0; } 845int dev_warn(const struct device *dev, const char *fmt, ...)
845static inline int dev_err(const struct device *dev, const char *fmt, ...) 846{ return 0; }
846 __attribute__ ((format (printf, 2, 3))); 847static inline __printf(2, 3)
847static inline int dev_err(const struct device *dev, const char *fmt, ...) 848int dev_notice(const struct device *dev, const char *fmt, ...)
848 { return 0; } 849{ return 0; }
849static inline int dev_warn(const struct device *dev, const char *fmt, ...) 850static inline __printf(2, 3)
850 __attribute__ ((format (printf, 2, 3))); 851int _dev_info(const struct device *dev, const char *fmt, ...)
851static inline int dev_warn(const struct device *dev, const char *fmt, ...) 852{ return 0; }
852 { return 0; }
853static inline int dev_notice(const struct device *dev, const char *fmt, ...)
854 __attribute__ ((format (printf, 2, 3)));
855static inline int dev_notice(const struct device *dev, const char *fmt, ...)
856 { return 0; }
857static inline int _dev_info(const struct device *dev, const char *fmt, ...)
858 __attribute__ ((format (printf, 2, 3)));
859static inline int _dev_info(const struct device *dev, const char *fmt, ...)
860 { return 0; }
861 853
862#endif 854#endif
863 855