diff options
Diffstat (limited to 'include/linux')
| -rw-r--r-- | include/linux/device.h | 5 | ||||
| -rw-r--r-- | include/linux/dynamic_debug.h | 76 | ||||
| -rw-r--r-- | include/linux/netdevice.h | 10 | ||||
| -rw-r--r-- | include/linux/platform_device.h | 48 | ||||
| -rw-r--r-- | include/linux/uio_driver.h | 7 |
5 files changed, 110 insertions, 36 deletions
diff --git a/include/linux/device.h b/include/linux/device.h index c20dfbfc49b4..4639419522da 100644 --- a/include/linux/device.h +++ b/include/linux/device.h | |||
| @@ -785,6 +785,8 @@ extern const char *dev_driver_string(const struct device *dev); | |||
| 785 | 785 | ||
| 786 | #ifdef CONFIG_PRINTK | 786 | #ifdef CONFIG_PRINTK |
| 787 | 787 | ||
| 788 | extern int __dev_printk(const char *level, const struct device *dev, | ||
| 789 | struct va_format *vaf); | ||
| 788 | extern int dev_printk(const char *level, const struct device *dev, | 790 | extern int dev_printk(const char *level, const struct device *dev, |
| 789 | const char *fmt, ...) | 791 | const char *fmt, ...) |
| 790 | __attribute__ ((format (printf, 3, 4))); | 792 | __attribute__ ((format (printf, 3, 4))); |
| @@ -805,6 +807,9 @@ extern int _dev_info(const struct device *dev, const char *fmt, ...) | |||
| 805 | 807 | ||
| 806 | #else | 808 | #else |
| 807 | 809 | ||
| 810 | static inline int __dev_printk(const char *level, const struct device *dev, | ||
| 811 | struct va_format *vaf) | ||
| 812 | { return 0; } | ||
| 808 | static inline int dev_printk(const char *level, const struct device *dev, | 813 | static inline int dev_printk(const char *level, const struct device *dev, |
| 809 | const char *fmt, ...) | 814 | const char *fmt, ...) |
| 810 | __attribute__ ((format (printf, 3, 4))); | 815 | __attribute__ ((format (printf, 3, 4))); |
diff --git a/include/linux/dynamic_debug.h b/include/linux/dynamic_debug.h index e747ecd48e1c..13aae8087b56 100644 --- a/include/linux/dynamic_debug.h +++ b/include/linux/dynamic_debug.h | |||
| @@ -1,13 +1,6 @@ | |||
| 1 | #ifndef _DYNAMIC_DEBUG_H | 1 | #ifndef _DYNAMIC_DEBUG_H |
| 2 | #define _DYNAMIC_DEBUG_H | 2 | #define _DYNAMIC_DEBUG_H |
| 3 | 3 | ||
| 4 | /* dynamic_printk_enabled, and dynamic_printk_enabled2 are bitmasks in which | ||
| 5 | * bit n is set to 1 if any modname hashes into the bucket n, 0 otherwise. They | ||
| 6 | * use independent hash functions, to reduce the chance of false positives. | ||
| 7 | */ | ||
| 8 | extern long long dynamic_debug_enabled; | ||
| 9 | extern long long dynamic_debug_enabled2; | ||
| 10 | |||
| 11 | /* | 4 | /* |
| 12 | * An instance of this structure is created in a special | 5 | * An instance of this structure is created in a special |
| 13 | * ELF section at every dynamic debug callsite. At runtime, | 6 | * ELF section at every dynamic debug callsite. At runtime, |
| @@ -47,26 +40,55 @@ extern int ddebug_remove_module(const char *mod_name); | |||
| 47 | extern int __dynamic_pr_debug(struct _ddebug *descriptor, const char *fmt, ...) | 40 | extern int __dynamic_pr_debug(struct _ddebug *descriptor, const char *fmt, ...) |
| 48 | __attribute__ ((format (printf, 2, 3))); | 41 | __attribute__ ((format (printf, 2, 3))); |
| 49 | 42 | ||
| 50 | #define dynamic_pr_debug(fmt, ...) do { \ | 43 | struct device; |
| 51 | static struct _ddebug descriptor \ | 44 | |
| 52 | __used \ | 45 | extern int __dynamic_dev_dbg(struct _ddebug *descriptor, |
| 53 | __attribute__((section("__verbose"), aligned(8))) = \ | 46 | const struct device *dev, |
| 54 | { KBUILD_MODNAME, __func__, __FILE__, fmt, __LINE__, \ | 47 | const char *fmt, ...) |
| 55 | _DPRINTK_FLAGS_DEFAULT }; \ | 48 | __attribute__ ((format (printf, 3, 4))); |
| 56 | if (unlikely(descriptor.enabled)) \ | 49 | |
| 57 | __dynamic_pr_debug(&descriptor, pr_fmt(fmt), ##__VA_ARGS__); \ | 50 | struct net_device; |
| 58 | } while (0) | 51 | |
| 59 | 52 | extern int __dynamic_netdev_dbg(struct _ddebug *descriptor, | |
| 60 | 53 | const struct net_device *dev, | |
| 61 | #define dynamic_dev_dbg(dev, fmt, ...) do { \ | 54 | const char *fmt, ...) |
| 62 | static struct _ddebug descriptor \ | 55 | __attribute__ ((format (printf, 3, 4))); |
| 63 | __used \ | 56 | |
| 64 | __attribute__((section("__verbose"), aligned(8))) = \ | 57 | #define DEFINE_DYNAMIC_DEBUG_METADATA(name, fmt) \ |
| 65 | { KBUILD_MODNAME, __func__, __FILE__, fmt, __LINE__, \ | 58 | static struct _ddebug __used __aligned(8) \ |
| 66 | _DPRINTK_FLAGS_DEFAULT }; \ | 59 | __attribute__((section("__verbose"))) name = { \ |
| 67 | if (unlikely(descriptor.enabled)) \ | 60 | .modname = KBUILD_MODNAME, \ |
| 68 | dev_printk(KERN_DEBUG, dev, fmt, ##__VA_ARGS__); \ | 61 | .function = __func__, \ |
| 69 | } while (0) | 62 | .filename = __FILE__, \ |
| 63 | .format = (fmt), \ | ||
| 64 | .lineno = __LINE__, \ | ||
| 65 | .flags = _DPRINTK_FLAGS_DEFAULT, \ | ||
| 66 | .enabled = false, \ | ||
| 67 | } | ||
| 68 | |||
| 69 | #define dynamic_pr_debug(fmt, ...) \ | ||
| 70 | do { \ | ||
| 71 | DEFINE_DYNAMIC_DEBUG_METADATA(descriptor, fmt); \ | ||
| 72 | if (unlikely(descriptor.enabled)) \ | ||
| 73 | __dynamic_pr_debug(&descriptor, pr_fmt(fmt), \ | ||
| 74 | ##__VA_ARGS__); \ | ||
| 75 | } while (0) | ||
| 76 | |||
| 77 | #define dynamic_dev_dbg(dev, fmt, ...) \ | ||
| 78 | do { \ | ||
| 79 | DEFINE_DYNAMIC_DEBUG_METADATA(descriptor, fmt); \ | ||
| 80 | if (unlikely(descriptor.enabled)) \ | ||
| 81 | __dynamic_dev_dbg(&descriptor, dev, fmt, \ | ||
| 82 | ##__VA_ARGS__); \ | ||
| 83 | } while (0) | ||
| 84 | |||
| 85 | #define dynamic_netdev_dbg(dev, fmt, ...) \ | ||
| 86 | do { \ | ||
| 87 | DEFINE_DYNAMIC_DEBUG_METADATA(descriptor, fmt); \ | ||
| 88 | if (unlikely(descriptor.enabled)) \ | ||
| 89 | __dynamic_netdev_dbg(&descriptor, dev, fmt, \ | ||
| 90 | ##__VA_ARGS__); \ | ||
| 91 | } while (0) | ||
| 70 | 92 | ||
| 71 | #else | 93 | #else |
| 72 | 94 | ||
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h index ddee79bb8f15..279726039f00 100644 --- a/include/linux/netdevice.h +++ b/include/linux/netdevice.h | |||
| @@ -2617,6 +2617,9 @@ static inline const char *netdev_name(const struct net_device *dev) | |||
| 2617 | return dev->name; | 2617 | return dev->name; |
| 2618 | } | 2618 | } |
| 2619 | 2619 | ||
| 2620 | extern int __netdev_printk(const char *level, const struct net_device *dev, | ||
| 2621 | struct va_format *vaf); | ||
| 2622 | |||
| 2620 | extern int netdev_printk(const char *level, const struct net_device *dev, | 2623 | extern int netdev_printk(const char *level, const struct net_device *dev, |
| 2621 | const char *format, ...) | 2624 | const char *format, ...) |
| 2622 | __attribute__ ((format (printf, 3, 4))); | 2625 | __attribute__ ((format (printf, 3, 4))); |
| @@ -2644,8 +2647,7 @@ extern int netdev_info(const struct net_device *dev, const char *format, ...) | |||
| 2644 | #elif defined(CONFIG_DYNAMIC_DEBUG) | 2647 | #elif defined(CONFIG_DYNAMIC_DEBUG) |
| 2645 | #define netdev_dbg(__dev, format, args...) \ | 2648 | #define netdev_dbg(__dev, format, args...) \ |
| 2646 | do { \ | 2649 | do { \ |
| 2647 | dynamic_dev_dbg((__dev)->dev.parent, "%s: " format, \ | 2650 | dynamic_netdev_dbg(__dev, format, ##args); \ |
| 2648 | netdev_name(__dev), ##args); \ | ||
| 2649 | } while (0) | 2651 | } while (0) |
| 2650 | #else | 2652 | #else |
| 2651 | #define netdev_dbg(__dev, format, args...) \ | 2653 | #define netdev_dbg(__dev, format, args...) \ |
| @@ -2712,9 +2714,7 @@ do { \ | |||
| 2712 | #define netif_dbg(priv, type, netdev, format, args...) \ | 2714 | #define netif_dbg(priv, type, netdev, format, args...) \ |
| 2713 | do { \ | 2715 | do { \ |
| 2714 | if (netif_msg_##type(priv)) \ | 2716 | if (netif_msg_##type(priv)) \ |
| 2715 | dynamic_dev_dbg((netdev)->dev.parent, \ | 2717 | dynamic_netdev_dbg(netdev, format, ##args); \ |
| 2716 | "%s: " format, \ | ||
| 2717 | netdev_name(netdev), ##args); \ | ||
| 2718 | } while (0) | 2718 | } while (0) |
| 2719 | #else | 2719 | #else |
| 2720 | #define netif_dbg(priv, type, dev, format, args...) \ | 2720 | #define netif_dbg(priv, type, dev, format, args...) \ |
diff --git a/include/linux/platform_device.h b/include/linux/platform_device.h index 27bb05aae70d..651a066686ac 100644 --- a/include/linux/platform_device.h +++ b/include/linux/platform_device.h | |||
| @@ -49,10 +49,54 @@ extern struct resource *platform_get_resource_byname(struct platform_device *, u | |||
| 49 | extern int platform_get_irq_byname(struct platform_device *, const char *); | 49 | extern int platform_get_irq_byname(struct platform_device *, const char *); |
| 50 | extern int platform_add_devices(struct platform_device **, int); | 50 | extern int platform_add_devices(struct platform_device **, int); |
| 51 | 51 | ||
| 52 | extern struct platform_device *platform_device_register_resndata( | 52 | struct platform_device_info { |
| 53 | struct device *parent; | ||
| 54 | |||
| 55 | const char *name; | ||
| 56 | int id; | ||
| 57 | |||
| 58 | const struct resource *res; | ||
| 59 | unsigned int num_res; | ||
| 60 | |||
| 61 | const void *data; | ||
| 62 | size_t size_data; | ||
| 63 | u64 dma_mask; | ||
| 64 | }; | ||
| 65 | extern struct platform_device *platform_device_register_full( | ||
| 66 | struct platform_device_info *pdevinfo); | ||
| 67 | |||
| 68 | /** | ||
| 69 | * platform_device_register_resndata - add a platform-level device with | ||
| 70 | * resources and platform-specific data | ||
| 71 | * | ||
| 72 | * @parent: parent device for the device we're adding | ||
| 73 | * @name: base name of the device we're adding | ||
| 74 | * @id: instance id | ||
| 75 | * @res: set of resources that needs to be allocated for the device | ||
| 76 | * @num: number of resources | ||
| 77 | * @data: platform specific data for this platform device | ||
| 78 | * @size: size of platform specific data | ||
| 79 | * | ||
| 80 | * Returns &struct platform_device pointer on success, or ERR_PTR() on error. | ||
| 81 | */ | ||
| 82 | static inline struct platform_device *platform_device_register_resndata( | ||
| 53 | struct device *parent, const char *name, int id, | 83 | struct device *parent, const char *name, int id, |
| 54 | const struct resource *res, unsigned int num, | 84 | const struct resource *res, unsigned int num, |
| 55 | const void *data, size_t size); | 85 | const void *data, size_t size) { |
| 86 | |||
| 87 | struct platform_device_info pdevinfo = { | ||
| 88 | .parent = parent, | ||
| 89 | .name = name, | ||
| 90 | .id = id, | ||
| 91 | .res = res, | ||
| 92 | .num_res = num, | ||
| 93 | .data = data, | ||
| 94 | .size_data = size, | ||
| 95 | .dma_mask = 0, | ||
| 96 | }; | ||
| 97 | |||
| 98 | return platform_device_register_full(&pdevinfo); | ||
| 99 | } | ||
| 56 | 100 | ||
| 57 | /** | 101 | /** |
| 58 | * platform_device_register_simple - add a platform-level device and its resources | 102 | * platform_device_register_simple - add a platform-level device and its resources |
diff --git a/include/linux/uio_driver.h b/include/linux/uio_driver.h index 665517c05eaf..fd99ff9298c6 100644 --- a/include/linux/uio_driver.h +++ b/include/linux/uio_driver.h | |||
| @@ -23,7 +23,10 @@ struct uio_map; | |||
| 23 | /** | 23 | /** |
| 24 | * struct uio_mem - description of a UIO memory region | 24 | * struct uio_mem - description of a UIO memory region |
| 25 | * @name: name of the memory region for identification | 25 | * @name: name of the memory region for identification |
| 26 | * @addr: address of the device's memory | 26 | * @addr: address of the device's memory (phys_addr is used since |
| 27 | * addr can be logical, virtual, or physical & phys_addr_t | ||
| 28 | * should always be large enough to handle any of the | ||
| 29 | * address types) | ||
| 27 | * @size: size of IO | 30 | * @size: size of IO |
| 28 | * @memtype: type of memory addr points to | 31 | * @memtype: type of memory addr points to |
| 29 | * @internal_addr: ioremap-ped version of addr, for driver internal use | 32 | * @internal_addr: ioremap-ped version of addr, for driver internal use |
| @@ -31,7 +34,7 @@ struct uio_map; | |||
| 31 | */ | 34 | */ |
| 32 | struct uio_mem { | 35 | struct uio_mem { |
| 33 | const char *name; | 36 | const char *name; |
| 34 | unsigned long addr; | 37 | phys_addr_t addr; |
| 35 | unsigned long size; | 38 | unsigned long size; |
| 36 | int memtype; | 39 | int memtype; |
| 37 | void __iomem *internal_addr; | 40 | void __iomem *internal_addr; |
