diff options
Diffstat (limited to 'include/linux')
321 files changed, 5281 insertions, 5119 deletions
diff --git a/include/linux/Kbuild b/include/linux/Kbuild index c94e71781b79..a25555381097 100644 --- a/include/linux/Kbuild +++ b/include/linux/Kbuild | |||
| @@ -238,6 +238,7 @@ header-y += magic.h | |||
| 238 | header-y += major.h | 238 | header-y += major.h |
| 239 | header-y += map_to_7segment.h | 239 | header-y += map_to_7segment.h |
| 240 | header-y += matroxfb.h | 240 | header-y += matroxfb.h |
| 241 | header-y += mdio.h | ||
| 241 | header-y += media.h | 242 | header-y += media.h |
| 242 | header-y += mempolicy.h | 243 | header-y += mempolicy.h |
| 243 | header-y += meye.h | 244 | header-y += meye.h |
| @@ -304,6 +305,7 @@ header-y += poll.h | |||
| 304 | header-y += posix_types.h | 305 | header-y += posix_types.h |
| 305 | header-y += ppdev.h | 306 | header-y += ppdev.h |
| 306 | header-y += ppp-comp.h | 307 | header-y += ppp-comp.h |
| 308 | header-y += ppp-ioctl.h | ||
| 307 | header-y += ppp_defs.h | 309 | header-y += ppp_defs.h |
| 308 | header-y += pps.h | 310 | header-y += pps.h |
| 309 | header-y += prctl.h | 311 | header-y += prctl.h |
diff --git a/include/linux/altera_uart.h b/include/linux/altera_uart.h index a10a90791976..c022c82db7ca 100644 --- a/include/linux/altera_uart.h +++ b/include/linux/altera_uart.h | |||
| @@ -5,8 +5,6 @@ | |||
| 5 | #ifndef __ALTUART_H | 5 | #ifndef __ALTUART_H |
| 6 | #define __ALTUART_H | 6 | #define __ALTUART_H |
| 7 | 7 | ||
| 8 | #include <linux/init.h> | ||
| 9 | |||
| 10 | struct altera_uart_platform_uart { | 8 | struct altera_uart_platform_uart { |
| 11 | unsigned long mapbase; /* Physical address base */ | 9 | unsigned long mapbase; /* Physical address base */ |
| 12 | unsigned int irq; /* Interrupt vector */ | 10 | unsigned int irq; /* Interrupt vector */ |
| @@ -14,6 +12,4 @@ struct altera_uart_platform_uart { | |||
| 14 | unsigned int bus_shift; /* Bus shift (address stride) */ | 12 | unsigned int bus_shift; /* Bus shift (address stride) */ |
| 15 | }; | 13 | }; |
| 16 | 14 | ||
| 17 | int __init early_altera_uart_setup(struct altera_uart_platform_uart *platp); | ||
| 18 | |||
| 19 | #endif /* __ALTUART_H */ | 15 | #endif /* __ALTUART_H */ |
diff --git a/include/linux/amba/bus.h b/include/linux/amba/bus.h index 724c69c40bb8..7847e197730a 100644 --- a/include/linux/amba/bus.h +++ b/include/linux/amba/bus.h | |||
| @@ -60,6 +60,9 @@ extern struct bus_type amba_bustype; | |||
| 60 | 60 | ||
| 61 | int amba_driver_register(struct amba_driver *); | 61 | int amba_driver_register(struct amba_driver *); |
| 62 | void amba_driver_unregister(struct amba_driver *); | 62 | void amba_driver_unregister(struct amba_driver *); |
| 63 | struct amba_device *amba_device_alloc(const char *, resource_size_t, size_t); | ||
| 64 | void amba_device_put(struct amba_device *); | ||
| 65 | int amba_device_add(struct amba_device *, struct resource *); | ||
| 63 | int amba_device_register(struct amba_device *, struct resource *); | 66 | int amba_device_register(struct amba_device *, struct resource *); |
| 64 | void amba_device_unregister(struct amba_device *); | 67 | void amba_device_unregister(struct amba_device *); |
| 65 | struct amba_device *amba_find_device(const char *, struct device *, unsigned int, unsigned int); | 68 | struct amba_device *amba_find_device(const char *, struct device *, unsigned int, unsigned int); |
| @@ -89,4 +92,46 @@ void amba_release_regions(struct amba_device *); | |||
| 89 | #define amba_manf(d) AMBA_MANF_BITS((d)->periphid) | 92 | #define amba_manf(d) AMBA_MANF_BITS((d)->periphid) |
| 90 | #define amba_part(d) AMBA_PART_BITS((d)->periphid) | 93 | #define amba_part(d) AMBA_PART_BITS((d)->periphid) |
| 91 | 94 | ||
| 95 | #define __AMBA_DEV(busid, data, mask) \ | ||
| 96 | { \ | ||
| 97 | .coherent_dma_mask = mask, \ | ||
| 98 | .init_name = busid, \ | ||
| 99 | .platform_data = data, \ | ||
| 100 | } | ||
| 101 | |||
| 102 | /* | ||
| 103 | * APB devices do not themselves have the ability to address memory, | ||
| 104 | * so DMA masks should be zero (much like USB peripheral devices.) | ||
| 105 | * The DMA controller DMA masks should be used instead (much like | ||
| 106 | * USB host controllers in conventional PCs.) | ||
| 107 | */ | ||
| 108 | #define AMBA_APB_DEVICE(name, busid, id, base, irqs, data) \ | ||
| 109 | struct amba_device name##_device = { \ | ||
| 110 | .dev = __AMBA_DEV(busid, data, 0), \ | ||
| 111 | .res = DEFINE_RES_MEM(base, SZ_4K), \ | ||
| 112 | .irq = irqs, \ | ||
| 113 | .periphid = id, \ | ||
| 114 | } | ||
| 115 | |||
| 116 | /* | ||
| 117 | * AHB devices are DMA capable, so set their DMA masks | ||
| 118 | */ | ||
| 119 | #define AMBA_AHB_DEVICE(name, busid, id, base, irqs, data) \ | ||
| 120 | struct amba_device name##_device = { \ | ||
| 121 | .dev = __AMBA_DEV(busid, data, ~0ULL), \ | ||
| 122 | .res = DEFINE_RES_MEM(base, SZ_4K), \ | ||
| 123 | .dma_mask = ~0ULL, \ | ||
| 124 | .irq = irqs, \ | ||
| 125 | .periphid = id, \ | ||
| 126 | } | ||
| 127 | |||
| 128 | /* | ||
| 129 | * module_amba_driver() - Helper macro for drivers that don't do anything | ||
| 130 | * special in module init/exit. This eliminates a lot of boilerplate. Each | ||
| 131 | * module may only use this macro once, and calling it replaces module_init() | ||
| 132 | * and module_exit() | ||
| 133 | */ | ||
| 134 | #define module_amba_driver(__amba_drv) \ | ||
| 135 | module_driver(__amba_drv, amba_driver_register, amba_driver_unregister) | ||
| 136 | |||
| 92 | #endif | 137 | #endif |
diff --git a/include/linux/amba/mmci.h b/include/linux/amba/mmci.h index 0101e9c17fa1..32a89cf5ec45 100644 --- a/include/linux/amba/mmci.h +++ b/include/linux/amba/mmci.h | |||
| @@ -6,6 +6,19 @@ | |||
| 6 | 6 | ||
| 7 | #include <linux/mmc/host.h> | 7 | #include <linux/mmc/host.h> |
| 8 | 8 | ||
| 9 | |||
| 10 | /* | ||
| 11 | * These defines is places here due to access is needed from machine | ||
| 12 | * configuration files. The ST Micro version does not have ROD and | ||
| 13 | * reuse the voltage registers for direction settings. | ||
| 14 | */ | ||
| 15 | #define MCI_ST_DATA2DIREN (1 << 2) | ||
| 16 | #define MCI_ST_CMDDIREN (1 << 3) | ||
| 17 | #define MCI_ST_DATA0DIREN (1 << 4) | ||
| 18 | #define MCI_ST_DATA31DIREN (1 << 5) | ||
| 19 | #define MCI_ST_FBCLKEN (1 << 7) | ||
| 20 | #define MCI_ST_DATA74DIREN (1 << 8) | ||
| 21 | |||
| 9 | /* Just some dummy forwarding */ | 22 | /* Just some dummy forwarding */ |
| 10 | struct dma_chan; | 23 | struct dma_chan; |
| 11 | 24 | ||
| @@ -18,7 +31,8 @@ struct dma_chan; | |||
| 18 | * @ocr_mask: available voltages on the 4 pins from the block, this | 31 | * @ocr_mask: available voltages on the 4 pins from the block, this |
| 19 | * is ignored if a regulator is used, see the MMC_VDD_* masks in | 32 | * is ignored if a regulator is used, see the MMC_VDD_* masks in |
| 20 | * mmc/host.h | 33 | * mmc/host.h |
| 21 | * @vdd_handler: a callback function to translate a MMC_VDD_* | 34 | * @ios_handler: a callback function to act on specfic ios changes, |
| 35 | * used for example to control a levelshifter | ||
| 22 | * mask into a value to be binary (or set some other custom bits | 36 | * mask into a value to be binary (or set some other custom bits |
| 23 | * in MMCIPWR) or:ed and written into the MMCIPWR register of the | 37 | * in MMCIPWR) or:ed and written into the MMCIPWR register of the |
| 24 | * block. May also control external power based on the power_mode. | 38 | * block. May also control external power based on the power_mode. |
| @@ -31,6 +45,8 @@ struct dma_chan; | |||
| 31 | * @capabilities: the capabilities of the block as implemented in | 45 | * @capabilities: the capabilities of the block as implemented in |
| 32 | * this platform, signify anything MMC_CAP_* from mmc/host.h | 46 | * this platform, signify anything MMC_CAP_* from mmc/host.h |
| 33 | * @capabilities2: more capabilities, MMC_CAP2_* from mmc/host.h | 47 | * @capabilities2: more capabilities, MMC_CAP2_* from mmc/host.h |
| 48 | * @sigdir: a bit field indicating for what bits in the MMC bus the host | ||
| 49 | * should enable signal direction indication. | ||
| 34 | * @dma_filter: function used to select an appropriate RX and TX | 50 | * @dma_filter: function used to select an appropriate RX and TX |
| 35 | * DMA channel to be used for DMA, if and only if you're deploying the | 51 | * DMA channel to be used for DMA, if and only if you're deploying the |
| 36 | * generic DMA engine | 52 | * generic DMA engine |
| @@ -46,14 +62,14 @@ struct dma_chan; | |||
| 46 | struct mmci_platform_data { | 62 | struct mmci_platform_data { |
| 47 | unsigned int f_max; | 63 | unsigned int f_max; |
| 48 | unsigned int ocr_mask; | 64 | unsigned int ocr_mask; |
| 49 | u32 (*vdd_handler)(struct device *, unsigned int vdd, | 65 | int (*ios_handler)(struct device *, struct mmc_ios *); |
| 50 | unsigned char power_mode); | ||
| 51 | unsigned int (*status)(struct device *); | 66 | unsigned int (*status)(struct device *); |
| 52 | int gpio_wp; | 67 | int gpio_wp; |
| 53 | int gpio_cd; | 68 | int gpio_cd; |
| 54 | bool cd_invert; | 69 | bool cd_invert; |
| 55 | unsigned long capabilities; | 70 | unsigned long capabilities; |
| 56 | unsigned long capabilities2; | 71 | unsigned long capabilities2; |
| 72 | u32 sigdir; | ||
| 57 | bool (*dma_filter)(struct dma_chan *chan, void *filter_param); | 73 | bool (*dma_filter)(struct dma_chan *chan, void *filter_param); |
| 58 | void *dma_rx_param; | 74 | void *dma_rx_param; |
| 59 | void *dma_tx_param; | 75 | void *dma_tx_param; |
diff --git a/include/linux/amba/pl022.h b/include/linux/amba/pl022.h index 572f637299c9..b8c51124ed19 100644 --- a/include/linux/amba/pl022.h +++ b/include/linux/amba/pl022.h | |||
| @@ -25,8 +25,6 @@ | |||
| 25 | #ifndef _SSP_PL022_H | 25 | #ifndef _SSP_PL022_H |
| 26 | #define _SSP_PL022_H | 26 | #define _SSP_PL022_H |
| 27 | 27 | ||
| 28 | #include <linux/device.h> | ||
| 29 | |||
| 30 | /** | 28 | /** |
| 31 | * whether SSP is in loopback mode or not | 29 | * whether SSP is in loopback mode or not |
| 32 | */ | 30 | */ |
| @@ -241,6 +239,8 @@ struct dma_chan; | |||
| 241 | * @autosuspend_delay: delay in ms following transfer completion before the | 239 | * @autosuspend_delay: delay in ms following transfer completion before the |
| 242 | * runtime power management system suspends the device. A setting of 0 | 240 | * runtime power management system suspends the device. A setting of 0 |
| 243 | * indicates no delay and the device will be suspended immediately. | 241 | * indicates no delay and the device will be suspended immediately. |
| 242 | * @rt: indicates the controller should run the message pump with realtime | ||
| 243 | * priority to minimise the transfer latency on the bus. | ||
| 244 | */ | 244 | */ |
| 245 | struct pl022_ssp_controller { | 245 | struct pl022_ssp_controller { |
| 246 | u16 bus_id; | 246 | u16 bus_id; |
| @@ -250,6 +250,7 @@ struct pl022_ssp_controller { | |||
| 250 | void *dma_rx_param; | 250 | void *dma_rx_param; |
| 251 | void *dma_tx_param; | 251 | void *dma_tx_param; |
| 252 | int autosuspend_delay; | 252 | int autosuspend_delay; |
| 253 | bool rt; | ||
| 253 | }; | 254 | }; |
| 254 | 255 | ||
| 255 | /** | 256 | /** |
diff --git a/include/linux/amd-iommu.h b/include/linux/amd-iommu.h index ef00610837d4..15f6b9edd0b1 100644 --- a/include/linux/amd-iommu.h +++ b/include/linux/amd-iommu.h | |||
| @@ -28,7 +28,7 @@ struct task_struct; | |||
| 28 | struct pci_dev; | 28 | struct pci_dev; |
| 29 | 29 | ||
| 30 | extern int amd_iommu_detect(void); | 30 | extern int amd_iommu_detect(void); |
| 31 | 31 | extern int amd_iommu_init_hardware(void); | |
| 32 | 32 | ||
| 33 | /** | 33 | /** |
| 34 | * amd_iommu_enable_device_erratum() - Enable erratum workaround for device | 34 | * amd_iommu_enable_device_erratum() - Enable erratum workaround for device |
diff --git a/include/linux/atmdev.h b/include/linux/atmdev.h index f4ff882cb2da..06fd4bbc58f6 100644 --- a/include/linux/atmdev.h +++ b/include/linux/atmdev.h | |||
| @@ -213,10 +213,10 @@ struct atm_cirange { | |||
| 213 | 213 | ||
| 214 | #ifdef __KERNEL__ | 214 | #ifdef __KERNEL__ |
| 215 | 215 | ||
| 216 | #include <linux/device.h> | ||
| 217 | #include <linux/wait.h> /* wait_queue_head_t */ | 216 | #include <linux/wait.h> /* wait_queue_head_t */ |
| 218 | #include <linux/time.h> /* struct timeval */ | 217 | #include <linux/time.h> /* struct timeval */ |
| 219 | #include <linux/net.h> | 218 | #include <linux/net.h> |
| 219 | #include <linux/bug.h> | ||
| 220 | #include <linux/skbuff.h> /* struct sk_buff */ | 220 | #include <linux/skbuff.h> /* struct sk_buff */ |
| 221 | #include <linux/uio.h> | 221 | #include <linux/uio.h> |
| 222 | #include <net/sock.h> | 222 | #include <net/sock.h> |
| @@ -249,6 +249,7 @@ struct k_atm_dev_stats { | |||
| 249 | struct k_atm_aal_stats aal5; | 249 | struct k_atm_aal_stats aal5; |
| 250 | }; | 250 | }; |
| 251 | 251 | ||
| 252 | struct device; | ||
| 252 | 253 | ||
| 253 | enum { | 254 | enum { |
| 254 | ATM_VF_ADDR, /* Address is in use. Set by anybody, cleared | 255 | ATM_VF_ADDR, /* Address is in use. Set by anybody, cleared |
diff --git a/include/linux/atomic.h b/include/linux/atomic.h index 42b77b5446d2..70cfcb2d63c4 100644 --- a/include/linux/atomic.h +++ b/include/linux/atomic.h | |||
| @@ -24,7 +24,9 @@ static inline int atomic_add_unless(atomic_t *v, int a, int u) | |||
| 24 | * Atomically increments @v by 1, so long as @v is non-zero. | 24 | * Atomically increments @v by 1, so long as @v is non-zero. |
| 25 | * Returns non-zero if @v was non-zero, and zero otherwise. | 25 | * Returns non-zero if @v was non-zero, and zero otherwise. |
| 26 | */ | 26 | */ |
| 27 | #ifndef atomic_inc_not_zero | ||
| 27 | #define atomic_inc_not_zero(v) atomic_add_unless((v), 1, 0) | 28 | #define atomic_inc_not_zero(v) atomic_add_unless((v), 1, 0) |
| 29 | #endif | ||
| 28 | 30 | ||
| 29 | /** | 31 | /** |
| 30 | * atomic_inc_not_zero_hint - increment if not null | 32 | * atomic_inc_not_zero_hint - increment if not null |
diff --git a/include/linux/attribute_container.h b/include/linux/attribute_container.h index c3ab81428c66..896c6892f327 100644 --- a/include/linux/attribute_container.h +++ b/include/linux/attribute_container.h | |||
| @@ -9,10 +9,11 @@ | |||
| 9 | #ifndef _ATTRIBUTE_CONTAINER_H_ | 9 | #ifndef _ATTRIBUTE_CONTAINER_H_ |
| 10 | #define _ATTRIBUTE_CONTAINER_H_ | 10 | #define _ATTRIBUTE_CONTAINER_H_ |
| 11 | 11 | ||
| 12 | #include <linux/device.h> | ||
| 13 | #include <linux/list.h> | 12 | #include <linux/list.h> |
| 14 | #include <linux/klist.h> | 13 | #include <linux/klist.h> |
| 15 | 14 | ||
| 15 | struct device; | ||
| 16 | |||
| 16 | struct attribute_container { | 17 | struct attribute_container { |
| 17 | struct list_head node; | 18 | struct list_head node; |
| 18 | struct klist containers; | 19 | struct klist containers; |
diff --git a/include/linux/audit.h b/include/linux/audit.h index 9ff7a2c48b50..ed3ef1972496 100644 --- a/include/linux/audit.h +++ b/include/linux/audit.h | |||
| @@ -684,7 +684,7 @@ extern void audit_log_untrustedstring(struct audit_buffer *ab, | |||
| 684 | const char *string); | 684 | const char *string); |
| 685 | extern void audit_log_d_path(struct audit_buffer *ab, | 685 | extern void audit_log_d_path(struct audit_buffer *ab, |
| 686 | const char *prefix, | 686 | const char *prefix, |
| 687 | struct path *path); | 687 | const struct path *path); |
| 688 | extern void audit_log_key(struct audit_buffer *ab, | 688 | extern void audit_log_key(struct audit_buffer *ab, |
| 689 | char *key); | 689 | char *key); |
| 690 | extern void audit_log_lost(const char *message); | 690 | extern void audit_log_lost(const char *message); |
diff --git a/include/linux/bcma/bcma.h b/include/linux/bcma/bcma.h index 83c209f39493..5af9a075498f 100644 --- a/include/linux/bcma/bcma.h +++ b/include/linux/bcma/bcma.h | |||
| @@ -136,6 +136,7 @@ struct bcma_device { | |||
| 136 | bool dev_registered; | 136 | bool dev_registered; |
| 137 | 137 | ||
| 138 | u8 core_index; | 138 | u8 core_index; |
| 139 | u8 core_unit; | ||
| 139 | 140 | ||
| 140 | u32 addr; | 141 | u32 addr; |
| 141 | u32 wrap; | 142 | u32 wrap; |
| @@ -175,6 +176,12 @@ int __bcma_driver_register(struct bcma_driver *drv, struct module *owner); | |||
| 175 | 176 | ||
| 176 | extern void bcma_driver_unregister(struct bcma_driver *drv); | 177 | extern void bcma_driver_unregister(struct bcma_driver *drv); |
| 177 | 178 | ||
| 179 | /* Set a fallback SPROM. | ||
| 180 | * See kdoc at the function definition for complete documentation. */ | ||
| 181 | extern int bcma_arch_register_fallback_sprom( | ||
| 182 | int (*sprom_callback)(struct bcma_bus *bus, | ||
| 183 | struct ssb_sprom *out)); | ||
| 184 | |||
| 178 | struct bcma_bus { | 185 | struct bcma_bus { |
| 179 | /* The MMIO area. */ | 186 | /* The MMIO area. */ |
| 180 | void __iomem *mmio; | 187 | void __iomem *mmio; |
| @@ -195,6 +202,7 @@ struct bcma_bus { | |||
| 195 | struct list_head cores; | 202 | struct list_head cores; |
| 196 | u8 nr_cores; | 203 | u8 nr_cores; |
| 197 | u8 init_done:1; | 204 | u8 init_done:1; |
| 205 | u8 num; | ||
| 198 | 206 | ||
| 199 | struct bcma_drv_cc drv_cc; | 207 | struct bcma_drv_cc drv_cc; |
| 200 | struct bcma_drv_pci drv_pci; | 208 | struct bcma_drv_pci drv_pci; |
| @@ -282,6 +290,7 @@ static inline void bcma_maskset16(struct bcma_device *cc, | |||
| 282 | bcma_write16(cc, offset, (bcma_read16(cc, offset) & mask) | set); | 290 | bcma_write16(cc, offset, (bcma_read16(cc, offset) & mask) | set); |
| 283 | } | 291 | } |
| 284 | 292 | ||
| 293 | extern struct bcma_device *bcma_find_core(struct bcma_bus *bus, u16 coreid); | ||
| 285 | extern bool bcma_core_is_enabled(struct bcma_device *core); | 294 | extern bool bcma_core_is_enabled(struct bcma_device *core); |
| 286 | extern void bcma_core_disable(struct bcma_device *core, u32 flags); | 295 | extern void bcma_core_disable(struct bcma_device *core, u32 flags); |
| 287 | extern int bcma_core_enable(struct bcma_device *core, u32 flags); | 296 | extern int bcma_core_enable(struct bcma_device *core, u32 flags); |
diff --git a/include/linux/bcma/bcma_driver_chipcommon.h b/include/linux/bcma/bcma_driver_chipcommon.h index a33086a7530b..8bbfe31fbac8 100644 --- a/include/linux/bcma/bcma_driver_chipcommon.h +++ b/include/linux/bcma/bcma_driver_chipcommon.h | |||
| @@ -56,6 +56,9 @@ | |||
| 56 | #define BCMA_CC_OTPS_HW_PROTECT 0x00000001 | 56 | #define BCMA_CC_OTPS_HW_PROTECT 0x00000001 |
| 57 | #define BCMA_CC_OTPS_SW_PROTECT 0x00000002 | 57 | #define BCMA_CC_OTPS_SW_PROTECT 0x00000002 |
| 58 | #define BCMA_CC_OTPS_CID_PROTECT 0x00000004 | 58 | #define BCMA_CC_OTPS_CID_PROTECT 0x00000004 |
| 59 | #define BCMA_CC_OTPS_GU_PROG_IND 0x00000F00 /* General Use programmed indication */ | ||
| 60 | #define BCMA_CC_OTPS_GU_PROG_IND_SHIFT 8 | ||
| 61 | #define BCMA_CC_OTPS_GU_PROG_HW 0x00000100 /* HW region programmed */ | ||
| 59 | #define BCMA_CC_OTPC 0x0014 /* OTP control */ | 62 | #define BCMA_CC_OTPC 0x0014 /* OTP control */ |
| 60 | #define BCMA_CC_OTPC_RECWAIT 0xFF000000 | 63 | #define BCMA_CC_OTPC_RECWAIT 0xFF000000 |
| 61 | #define BCMA_CC_OTPC_PROGWAIT 0x00FFFF00 | 64 | #define BCMA_CC_OTPC_PROGWAIT 0x00FFFF00 |
| @@ -72,6 +75,8 @@ | |||
| 72 | #define BCMA_CC_OTPP_READ 0x40000000 | 75 | #define BCMA_CC_OTPP_READ 0x40000000 |
| 73 | #define BCMA_CC_OTPP_START 0x80000000 | 76 | #define BCMA_CC_OTPP_START 0x80000000 |
| 74 | #define BCMA_CC_OTPP_BUSY 0x80000000 | 77 | #define BCMA_CC_OTPP_BUSY 0x80000000 |
| 78 | #define BCMA_CC_OTPL 0x001C /* OTP layout */ | ||
| 79 | #define BCMA_CC_OTPL_GURGN_OFFSET 0x00000FFF /* offset of general use region */ | ||
| 75 | #define BCMA_CC_IRQSTAT 0x0020 | 80 | #define BCMA_CC_IRQSTAT 0x0020 |
| 76 | #define BCMA_CC_IRQMASK 0x0024 | 81 | #define BCMA_CC_IRQMASK 0x0024 |
| 77 | #define BCMA_CC_IRQ_GPIO 0x00000001 /* gpio intr */ | 82 | #define BCMA_CC_IRQ_GPIO 0x00000001 /* gpio intr */ |
| @@ -79,6 +84,10 @@ | |||
| 79 | #define BCMA_CC_IRQ_WDRESET 0x80000000 /* watchdog reset occurred */ | 84 | #define BCMA_CC_IRQ_WDRESET 0x80000000 /* watchdog reset occurred */ |
| 80 | #define BCMA_CC_CHIPCTL 0x0028 /* Rev >= 11 only */ | 85 | #define BCMA_CC_CHIPCTL 0x0028 /* Rev >= 11 only */ |
| 81 | #define BCMA_CC_CHIPSTAT 0x002C /* Rev >= 11 only */ | 86 | #define BCMA_CC_CHIPSTAT 0x002C /* Rev >= 11 only */ |
| 87 | #define BCMA_CC_CHIPST_4313_SPROM_PRESENT 1 | ||
| 88 | #define BCMA_CC_CHIPST_4313_OTP_PRESENT 2 | ||
| 89 | #define BCMA_CC_CHIPST_4331_SPROM_PRESENT 2 | ||
| 90 | #define BCMA_CC_CHIPST_4331_OTP_PRESENT 4 | ||
| 82 | #define BCMA_CC_JCMD 0x0030 /* Rev >= 10 only */ | 91 | #define BCMA_CC_JCMD 0x0030 /* Rev >= 10 only */ |
| 83 | #define BCMA_CC_JCMD_START 0x80000000 | 92 | #define BCMA_CC_JCMD_START 0x80000000 |
| 84 | #define BCMA_CC_JCMD_BUSY 0x80000000 | 93 | #define BCMA_CC_JCMD_BUSY 0x80000000 |
| @@ -181,6 +190,22 @@ | |||
| 181 | #define BCMA_CC_FLASH_CFG 0x0128 | 190 | #define BCMA_CC_FLASH_CFG 0x0128 |
| 182 | #define BCMA_CC_FLASH_CFG_DS 0x0010 /* Data size, 0=8bit, 1=16bit */ | 191 | #define BCMA_CC_FLASH_CFG_DS 0x0010 /* Data size, 0=8bit, 1=16bit */ |
| 183 | #define BCMA_CC_FLASH_WAITCNT 0x012C | 192 | #define BCMA_CC_FLASH_WAITCNT 0x012C |
| 193 | #define BCMA_CC_SROM_CONTROL 0x0190 | ||
| 194 | #define BCMA_CC_SROM_CONTROL_START 0x80000000 | ||
| 195 | #define BCMA_CC_SROM_CONTROL_BUSY 0x80000000 | ||
| 196 | #define BCMA_CC_SROM_CONTROL_OPCODE 0x60000000 | ||
| 197 | #define BCMA_CC_SROM_CONTROL_OP_READ 0x00000000 | ||
| 198 | #define BCMA_CC_SROM_CONTROL_OP_WRITE 0x20000000 | ||
| 199 | #define BCMA_CC_SROM_CONTROL_OP_WRDIS 0x40000000 | ||
| 200 | #define BCMA_CC_SROM_CONTROL_OP_WREN 0x60000000 | ||
| 201 | #define BCMA_CC_SROM_CONTROL_OTPSEL 0x00000010 | ||
| 202 | #define BCMA_CC_SROM_CONTROL_LOCK 0x00000008 | ||
| 203 | #define BCMA_CC_SROM_CONTROL_SIZE_MASK 0x00000006 | ||
| 204 | #define BCMA_CC_SROM_CONTROL_SIZE_1K 0x00000000 | ||
| 205 | #define BCMA_CC_SROM_CONTROL_SIZE_4K 0x00000002 | ||
| 206 | #define BCMA_CC_SROM_CONTROL_SIZE_16K 0x00000004 | ||
| 207 | #define BCMA_CC_SROM_CONTROL_SIZE_SHIFT 1 | ||
| 208 | #define BCMA_CC_SROM_CONTROL_PRESENT 0x00000001 | ||
| 184 | /* 0x1E0 is defined as shared BCMA_CLKCTLST */ | 209 | /* 0x1E0 is defined as shared BCMA_CLKCTLST */ |
| 185 | #define BCMA_CC_HW_WORKAROUND 0x01E4 /* Hardware workaround (rev >= 20) */ | 210 | #define BCMA_CC_HW_WORKAROUND 0x01E4 /* Hardware workaround (rev >= 20) */ |
| 186 | #define BCMA_CC_UART0_DATA 0x0300 | 211 | #define BCMA_CC_UART0_DATA 0x0300 |
| @@ -240,7 +265,6 @@ | |||
| 240 | #define BCMA_CC_PLLCTL_ADDR 0x0660 | 265 | #define BCMA_CC_PLLCTL_ADDR 0x0660 |
| 241 | #define BCMA_CC_PLLCTL_DATA 0x0664 | 266 | #define BCMA_CC_PLLCTL_DATA 0x0664 |
| 242 | #define BCMA_CC_SPROM 0x0800 /* SPROM beginning */ | 267 | #define BCMA_CC_SPROM 0x0800 /* SPROM beginning */ |
| 243 | #define BCMA_CC_SPROM_PCIE6 0x0830 /* SPROM beginning on PCIe rev >= 6 */ | ||
| 244 | 268 | ||
| 245 | /* Divider allocation in 4716/47162/5356 */ | 269 | /* Divider allocation in 4716/47162/5356 */ |
| 246 | #define BCMA_CC_PMU5_MAINPLL_CPU 1 | 270 | #define BCMA_CC_PMU5_MAINPLL_CPU 1 |
diff --git a/include/linux/bcma/bcma_driver_pci.h b/include/linux/bcma/bcma_driver_pci.h index 3871b668caf9..46c71e27d31f 100644 --- a/include/linux/bcma/bcma_driver_pci.h +++ b/include/linux/bcma/bcma_driver_pci.h | |||
| @@ -53,6 +53,35 @@ struct pci_dev; | |||
| 53 | #define BCMA_CORE_PCI_SBTOPCI1_MASK 0xFC000000 | 53 | #define BCMA_CORE_PCI_SBTOPCI1_MASK 0xFC000000 |
| 54 | #define BCMA_CORE_PCI_SBTOPCI2 0x0108 /* Backplane to PCI translation 2 (sbtopci2) */ | 54 | #define BCMA_CORE_PCI_SBTOPCI2 0x0108 /* Backplane to PCI translation 2 (sbtopci2) */ |
| 55 | #define BCMA_CORE_PCI_SBTOPCI2_MASK 0xC0000000 | 55 | #define BCMA_CORE_PCI_SBTOPCI2_MASK 0xC0000000 |
| 56 | #define BCMA_CORE_PCI_CONFIG_ADDR 0x0120 /* pcie config space access */ | ||
| 57 | #define BCMA_CORE_PCI_CONFIG_DATA 0x0124 /* pcie config space access */ | ||
| 58 | #define BCMA_CORE_PCI_MDIO_CONTROL 0x0128 /* controls the mdio access */ | ||
| 59 | #define BCMA_CORE_PCI_MDIOCTL_DIVISOR_MASK 0x7f /* clock to be used on MDIO */ | ||
| 60 | #define BCMA_CORE_PCI_MDIOCTL_DIVISOR_VAL 0x2 | ||
| 61 | #define BCMA_CORE_PCI_MDIOCTL_PREAM_EN 0x80 /* Enable preamble sequnce */ | ||
| 62 | #define BCMA_CORE_PCI_MDIOCTL_ACCESS_DONE 0x100 /* Tranaction complete */ | ||
| 63 | #define BCMA_CORE_PCI_MDIO_DATA 0x012c /* Data to the mdio access */ | ||
| 64 | #define BCMA_CORE_PCI_MDIODATA_MASK 0x0000ffff /* data 2 bytes */ | ||
| 65 | #define BCMA_CORE_PCI_MDIODATA_TA 0x00020000 /* Turnaround */ | ||
| 66 | #define BCMA_CORE_PCI_MDIODATA_REGADDR_SHF_OLD 18 /* Regaddr shift (rev < 10) */ | ||
| 67 | #define BCMA_CORE_PCI_MDIODATA_REGADDR_MASK_OLD 0x003c0000 /* Regaddr Mask (rev < 10) */ | ||
| 68 | #define BCMA_CORE_PCI_MDIODATA_DEVADDR_SHF_OLD 22 /* Physmedia devaddr shift (rev < 10) */ | ||
| 69 | #define BCMA_CORE_PCI_MDIODATA_DEVADDR_MASK_OLD 0x0fc00000 /* Physmedia devaddr Mask (rev < 10) */ | ||
| 70 | #define BCMA_CORE_PCI_MDIODATA_REGADDR_SHF 18 /* Regaddr shift */ | ||
| 71 | #define BCMA_CORE_PCI_MDIODATA_REGADDR_MASK 0x007c0000 /* Regaddr Mask */ | ||
| 72 | #define BCMA_CORE_PCI_MDIODATA_DEVADDR_SHF 23 /* Physmedia devaddr shift */ | ||
| 73 | #define BCMA_CORE_PCI_MDIODATA_DEVADDR_MASK 0x0f800000 /* Physmedia devaddr Mask */ | ||
| 74 | #define BCMA_CORE_PCI_MDIODATA_WRITE 0x10000000 /* write Transaction */ | ||
| 75 | #define BCMA_CORE_PCI_MDIODATA_READ 0x20000000 /* Read Transaction */ | ||
| 76 | #define BCMA_CORE_PCI_MDIODATA_START 0x40000000 /* start of Transaction */ | ||
| 77 | #define BCMA_CORE_PCI_MDIODATA_DEV_ADDR 0x0 /* dev address for serdes */ | ||
| 78 | #define BCMA_CORE_PCI_MDIODATA_BLK_ADDR 0x1F /* blk address for serdes */ | ||
| 79 | #define BCMA_CORE_PCI_MDIODATA_DEV_PLL 0x1d /* SERDES PLL Dev */ | ||
| 80 | #define BCMA_CORE_PCI_MDIODATA_DEV_TX 0x1e /* SERDES TX Dev */ | ||
| 81 | #define BCMA_CORE_PCI_MDIODATA_DEV_RX 0x1f /* SERDES RX Dev */ | ||
| 82 | #define BCMA_CORE_PCI_PCIEIND_ADDR 0x0130 /* indirect access to the internal register */ | ||
| 83 | #define BCMA_CORE_PCI_PCIEIND_DATA 0x0134 /* Data to/from the internal regsiter */ | ||
| 84 | #define BCMA_CORE_PCI_CLKREQENCTRL 0x0138 /* >= rev 6, Clkreq rdma control */ | ||
| 56 | #define BCMA_CORE_PCI_PCICFG0 0x0400 /* PCI config space 0 (rev >= 8) */ | 85 | #define BCMA_CORE_PCI_PCICFG0 0x0400 /* PCI config space 0 (rev >= 8) */ |
| 57 | #define BCMA_CORE_PCI_PCICFG1 0x0500 /* PCI config space 1 (rev >= 8) */ | 86 | #define BCMA_CORE_PCI_PCICFG1 0x0500 /* PCI config space 1 (rev >= 8) */ |
| 58 | #define BCMA_CORE_PCI_PCICFG2 0x0600 /* PCI config space 2 (rev >= 8) */ | 87 | #define BCMA_CORE_PCI_PCICFG2 0x0600 /* PCI config space 2 (rev >= 8) */ |
| @@ -72,20 +101,114 @@ struct pci_dev; | |||
| 72 | #define BCMA_CORE_PCI_SBTOPCI_RC_READL 0x00000010 /* Memory read line */ | 101 | #define BCMA_CORE_PCI_SBTOPCI_RC_READL 0x00000010 /* Memory read line */ |
| 73 | #define BCMA_CORE_PCI_SBTOPCI_RC_READM 0x00000020 /* Memory read multiple */ | 102 | #define BCMA_CORE_PCI_SBTOPCI_RC_READM 0x00000020 /* Memory read multiple */ |
| 74 | 103 | ||
| 104 | /* PCIE protocol PHY diagnostic registers */ | ||
| 105 | #define BCMA_CORE_PCI_PLP_MODEREG 0x200 /* Mode */ | ||
| 106 | #define BCMA_CORE_PCI_PLP_STATUSREG 0x204 /* Status */ | ||
| 107 | #define BCMA_CORE_PCI_PLP_POLARITYINV_STAT 0x10 /* Status reg PCIE_PLP_STATUSREG */ | ||
| 108 | #define BCMA_CORE_PCI_PLP_LTSSMCTRLREG 0x208 /* LTSSM control */ | ||
| 109 | #define BCMA_CORE_PCI_PLP_LTLINKNUMREG 0x20c /* Link Training Link number */ | ||
| 110 | #define BCMA_CORE_PCI_PLP_LTLANENUMREG 0x210 /* Link Training Lane number */ | ||
| 111 | #define BCMA_CORE_PCI_PLP_LTNFTSREG 0x214 /* Link Training N_FTS */ | ||
| 112 | #define BCMA_CORE_PCI_PLP_ATTNREG 0x218 /* Attention */ | ||
| 113 | #define BCMA_CORE_PCI_PLP_ATTNMASKREG 0x21C /* Attention Mask */ | ||
| 114 | #define BCMA_CORE_PCI_PLP_RXERRCTR 0x220 /* Rx Error */ | ||
| 115 | #define BCMA_CORE_PCI_PLP_RXFRMERRCTR 0x224 /* Rx Framing Error */ | ||
| 116 | #define BCMA_CORE_PCI_PLP_RXERRTHRESHREG 0x228 /* Rx Error threshold */ | ||
| 117 | #define BCMA_CORE_PCI_PLP_TESTCTRLREG 0x22C /* Test Control reg */ | ||
| 118 | #define BCMA_CORE_PCI_PLP_SERDESCTRLOVRDREG 0x230 /* SERDES Control Override */ | ||
| 119 | #define BCMA_CORE_PCI_PLP_TIMINGOVRDREG 0x234 /* Timing param override */ | ||
| 120 | #define BCMA_CORE_PCI_PLP_RXTXSMDIAGREG 0x238 /* RXTX State Machine Diag */ | ||
| 121 | #define BCMA_CORE_PCI_PLP_LTSSMDIAGREG 0x23C /* LTSSM State Machine Diag */ | ||
| 122 | |||
| 123 | /* PCIE protocol DLLP diagnostic registers */ | ||
| 124 | #define BCMA_CORE_PCI_DLLP_LCREG 0x100 /* Link Control */ | ||
| 125 | #define BCMA_CORE_PCI_DLLP_LSREG 0x104 /* Link Status */ | ||
| 126 | #define BCMA_CORE_PCI_DLLP_LAREG 0x108 /* Link Attention */ | ||
| 127 | #define BCMA_CORE_PCI_DLLP_LSREG_LINKUP (1 << 16) | ||
| 128 | #define BCMA_CORE_PCI_DLLP_LAMASKREG 0x10C /* Link Attention Mask */ | ||
| 129 | #define BCMA_CORE_PCI_DLLP_NEXTTXSEQNUMREG 0x110 /* Next Tx Seq Num */ | ||
| 130 | #define BCMA_CORE_PCI_DLLP_ACKEDTXSEQNUMREG 0x114 /* Acked Tx Seq Num */ | ||
| 131 | #define BCMA_CORE_PCI_DLLP_PURGEDTXSEQNUMREG 0x118 /* Purged Tx Seq Num */ | ||
| 132 | #define BCMA_CORE_PCI_DLLP_RXSEQNUMREG 0x11C /* Rx Sequence Number */ | ||
| 133 | #define BCMA_CORE_PCI_DLLP_LRREG 0x120 /* Link Replay */ | ||
| 134 | #define BCMA_CORE_PCI_DLLP_LACKTOREG 0x124 /* Link Ack Timeout */ | ||
| 135 | #define BCMA_CORE_PCI_DLLP_PMTHRESHREG 0x128 /* Power Management Threshold */ | ||
| 136 | #define BCMA_CORE_PCI_DLLP_RTRYWPREG 0x12C /* Retry buffer write ptr */ | ||
| 137 | #define BCMA_CORE_PCI_DLLP_RTRYRPREG 0x130 /* Retry buffer Read ptr */ | ||
| 138 | #define BCMA_CORE_PCI_DLLP_RTRYPPREG 0x134 /* Retry buffer Purged ptr */ | ||
| 139 | #define BCMA_CORE_PCI_DLLP_RTRRWREG 0x138 /* Retry buffer Read/Write */ | ||
| 140 | #define BCMA_CORE_PCI_DLLP_ECTHRESHREG 0x13C /* Error Count Threshold */ | ||
| 141 | #define BCMA_CORE_PCI_DLLP_TLPERRCTRREG 0x140 /* TLP Error Counter */ | ||
| 142 | #define BCMA_CORE_PCI_DLLP_ERRCTRREG 0x144 /* Error Counter */ | ||
| 143 | #define BCMA_CORE_PCI_DLLP_NAKRXCTRREG 0x148 /* NAK Received Counter */ | ||
| 144 | #define BCMA_CORE_PCI_DLLP_TESTREG 0x14C /* Test */ | ||
| 145 | #define BCMA_CORE_PCI_DLLP_PKTBIST 0x150 /* Packet BIST */ | ||
| 146 | #define BCMA_CORE_PCI_DLLP_PCIE11 0x154 /* DLLP PCIE 1.1 reg */ | ||
| 147 | |||
| 148 | /* SERDES RX registers */ | ||
| 149 | #define BCMA_CORE_PCI_SERDES_RX_CTRL 1 /* Rx cntrl */ | ||
| 150 | #define BCMA_CORE_PCI_SERDES_RX_CTRL_FORCE 0x80 /* rxpolarity_force */ | ||
| 151 | #define BCMA_CORE_PCI_SERDES_RX_CTRL_POLARITY 0x40 /* rxpolarity_value */ | ||
| 152 | #define BCMA_CORE_PCI_SERDES_RX_TIMER1 2 /* Rx Timer1 */ | ||
| 153 | #define BCMA_CORE_PCI_SERDES_RX_CDR 6 /* CDR */ | ||
| 154 | #define BCMA_CORE_PCI_SERDES_RX_CDRBW 7 /* CDR BW */ | ||
| 155 | |||
| 156 | /* SERDES PLL registers */ | ||
| 157 | #define BCMA_CORE_PCI_SERDES_PLL_CTRL 1 /* PLL control reg */ | ||
| 158 | #define BCMA_CORE_PCI_PLL_CTRL_FREQDET_EN 0x4000 /* bit 14 is FREQDET on */ | ||
| 159 | |||
| 75 | /* PCIcore specific boardflags */ | 160 | /* PCIcore specific boardflags */ |
| 76 | #define BCMA_CORE_PCI_BFL_NOPCI 0x00000400 /* Board leaves PCI floating */ | 161 | #define BCMA_CORE_PCI_BFL_NOPCI 0x00000400 /* Board leaves PCI floating */ |
| 77 | 162 | ||
| 163 | /* PCIE Config space accessing MACROS */ | ||
| 164 | #define BCMA_CORE_PCI_CFG_BUS_SHIFT 24 /* Bus shift */ | ||
| 165 | #define BCMA_CORE_PCI_CFG_SLOT_SHIFT 19 /* Slot/Device shift */ | ||
| 166 | #define BCMA_CORE_PCI_CFG_FUN_SHIFT 16 /* Function shift */ | ||
| 167 | #define BCMA_CORE_PCI_CFG_OFF_SHIFT 0 /* Register shift */ | ||
| 168 | |||
| 169 | #define BCMA_CORE_PCI_CFG_BUS_MASK 0xff /* Bus mask */ | ||
| 170 | #define BCMA_CORE_PCI_CFG_SLOT_MASK 0x1f /* Slot/Device mask */ | ||
| 171 | #define BCMA_CORE_PCI_CFG_FUN_MASK 7 /* Function mask */ | ||
| 172 | #define BCMA_CORE_PCI_CFG_OFF_MASK 0xfff /* Register mask */ | ||
| 173 | |||
| 174 | /* PCIE Root Capability Register bits (Host mode only) */ | ||
| 175 | #define BCMA_CORE_PCI_RC_CRS_VISIBILITY 0x0001 | ||
| 176 | |||
| 177 | struct bcma_drv_pci; | ||
| 178 | |||
| 179 | #ifdef CONFIG_BCMA_DRIVER_PCI_HOSTMODE | ||
| 180 | struct bcma_drv_pci_host { | ||
| 181 | struct bcma_drv_pci *pdev; | ||
| 182 | |||
| 183 | u32 host_cfg_addr; | ||
| 184 | spinlock_t cfgspace_lock; | ||
| 185 | |||
| 186 | struct pci_controller pci_controller; | ||
| 187 | struct pci_ops pci_ops; | ||
| 188 | struct resource mem_resource; | ||
| 189 | struct resource io_resource; | ||
| 190 | }; | ||
| 191 | #endif | ||
| 192 | |||
| 78 | struct bcma_drv_pci { | 193 | struct bcma_drv_pci { |
| 79 | struct bcma_device *core; | 194 | struct bcma_device *core; |
| 80 | u8 setup_done:1; | 195 | u8 setup_done:1; |
| 196 | u8 hostmode:1; | ||
| 197 | |||
| 198 | #ifdef CONFIG_BCMA_DRIVER_PCI_HOSTMODE | ||
| 199 | struct bcma_drv_pci_host *host_controller; | ||
| 200 | #endif | ||
| 81 | }; | 201 | }; |
| 82 | 202 | ||
| 83 | /* Register access */ | 203 | /* Register access */ |
| 84 | #define pcicore_read32(pc, offset) bcma_read32((pc)->core, offset) | 204 | #define pcicore_read32(pc, offset) bcma_read32((pc)->core, offset) |
| 85 | #define pcicore_write32(pc, offset, val) bcma_write32((pc)->core, offset, val) | 205 | #define pcicore_write32(pc, offset, val) bcma_write32((pc)->core, offset, val) |
| 86 | 206 | ||
| 87 | extern void bcma_core_pci_init(struct bcma_drv_pci *pc); | 207 | extern void __devinit bcma_core_pci_init(struct bcma_drv_pci *pc); |
| 88 | extern int bcma_core_pci_irq_ctl(struct bcma_drv_pci *pc, | 208 | extern int bcma_core_pci_irq_ctl(struct bcma_drv_pci *pc, |
| 89 | struct bcma_device *core, bool enable); | 209 | struct bcma_device *core, bool enable); |
| 90 | 210 | ||
| 211 | extern int bcma_core_pci_pcibios_map_irq(const struct pci_dev *dev); | ||
| 212 | extern int bcma_core_pci_plat_dev_init(struct pci_dev *dev); | ||
| 213 | |||
| 91 | #endif /* LINUX_BCMA_DRIVER_PCI_H_ */ | 214 | #endif /* LINUX_BCMA_DRIVER_PCI_H_ */ |
diff --git a/include/linux/bcma/bcma_regs.h b/include/linux/bcma/bcma_regs.h index 9faae2ae02e8..5a71d5719640 100644 --- a/include/linux/bcma/bcma_regs.h +++ b/include/linux/bcma/bcma_regs.h | |||
| @@ -56,4 +56,31 @@ | |||
| 56 | #define BCMA_PCI_GPIO_XTAL 0x40 /* PCI config space GPIO 14 for Xtal powerup */ | 56 | #define BCMA_PCI_GPIO_XTAL 0x40 /* PCI config space GPIO 14 for Xtal powerup */ |
| 57 | #define BCMA_PCI_GPIO_PLL 0x80 /* PCI config space GPIO 15 for PLL powerdown */ | 57 | #define BCMA_PCI_GPIO_PLL 0x80 /* PCI config space GPIO 15 for PLL powerdown */ |
| 58 | 58 | ||
| 59 | /* SiliconBackplane Address Map. | ||
| 60 | * All regions may not exist on all chips. | ||
| 61 | */ | ||
| 62 | #define BCMA_SOC_SDRAM_BASE 0x00000000U /* Physical SDRAM */ | ||
| 63 | #define BCMA_SOC_PCI_MEM 0x08000000U /* Host Mode sb2pcitranslation0 (64 MB) */ | ||
| 64 | #define BCMA_SOC_PCI_MEM_SZ (64 * 1024 * 1024) | ||
| 65 | #define BCMA_SOC_PCI_CFG 0x0c000000U /* Host Mode sb2pcitranslation1 (64 MB) */ | ||
| 66 | #define BCMA_SOC_SDRAM_SWAPPED 0x10000000U /* Byteswapped Physical SDRAM */ | ||
| 67 | #define BCMA_SOC_SDRAM_R2 0x80000000U /* Region 2 for sdram (512 MB) */ | ||
| 68 | |||
| 69 | |||
| 70 | #define BCMA_SOC_PCI_DMA 0x40000000U /* Client Mode sb2pcitranslation2 (1 GB) */ | ||
| 71 | #define BCMA_SOC_PCI_DMA2 0x80000000U /* Client Mode sb2pcitranslation2 (1 GB) */ | ||
| 72 | #define BCMA_SOC_PCI_DMA_SZ 0x40000000U /* Client Mode sb2pcitranslation2 size in bytes */ | ||
| 73 | #define BCMA_SOC_PCIE_DMA_L32 0x00000000U /* PCIE Client Mode sb2pcitranslation2 | ||
| 74 | * (2 ZettaBytes), low 32 bits | ||
| 75 | */ | ||
| 76 | #define BCMA_SOC_PCIE_DMA_H32 0x80000000U /* PCIE Client Mode sb2pcitranslation2 | ||
| 77 | * (2 ZettaBytes), high 32 bits | ||
| 78 | */ | ||
| 79 | |||
| 80 | #define BCMA_SOC_PCI1_MEM 0x40000000U /* Host Mode sb2pcitranslation0 (64 MB) */ | ||
| 81 | #define BCMA_SOC_PCI1_CFG 0x44000000U /* Host Mode sb2pcitranslation1 (64 MB) */ | ||
| 82 | #define BCMA_SOC_PCIE1_DMA_H32 0xc0000000U /* PCIE Client Mode sb2pcitranslation2 | ||
| 83 | * (2 ZettaBytes), high 32 bits | ||
| 84 | */ | ||
| 85 | |||
| 59 | #endif /* LINUX_BCMA_REGS_H_ */ | 86 | #endif /* LINUX_BCMA_REGS_H_ */ |
diff --git a/include/linux/binfmts.h b/include/linux/binfmts.h index 0092102db2de..366422bc1633 100644 --- a/include/linux/binfmts.h +++ b/include/linux/binfmts.h | |||
| @@ -92,17 +92,17 @@ struct linux_binfmt { | |||
| 92 | unsigned long min_coredump; /* minimal dump size */ | 92 | unsigned long min_coredump; /* minimal dump size */ |
| 93 | }; | 93 | }; |
| 94 | 94 | ||
| 95 | extern int __register_binfmt(struct linux_binfmt *fmt, int insert); | 95 | extern void __register_binfmt(struct linux_binfmt *fmt, int insert); |
| 96 | 96 | ||
| 97 | /* Registration of default binfmt handlers */ | 97 | /* Registration of default binfmt handlers */ |
| 98 | static inline int register_binfmt(struct linux_binfmt *fmt) | 98 | static inline void register_binfmt(struct linux_binfmt *fmt) |
| 99 | { | 99 | { |
| 100 | return __register_binfmt(fmt, 0); | 100 | __register_binfmt(fmt, 0); |
| 101 | } | 101 | } |
| 102 | /* Same as above, but adds a new binfmt at the top of the list */ | 102 | /* Same as above, but adds a new binfmt at the top of the list */ |
| 103 | static inline int insert_binfmt(struct linux_binfmt *fmt) | 103 | static inline void insert_binfmt(struct linux_binfmt *fmt) |
| 104 | { | 104 | { |
| 105 | return __register_binfmt(fmt, 1); | 105 | __register_binfmt(fmt, 1); |
| 106 | } | 106 | } |
| 107 | 107 | ||
| 108 | extern void unregister_binfmt(struct linux_binfmt *); | 108 | extern void unregister_binfmt(struct linux_binfmt *); |
diff --git a/include/linux/bio.h b/include/linux/bio.h index 129a9c097958..4d94eb8bcbcc 100644 --- a/include/linux/bio.h +++ b/include/linux/bio.h | |||
| @@ -23,6 +23,7 @@ | |||
| 23 | #include <linux/highmem.h> | 23 | #include <linux/highmem.h> |
| 24 | #include <linux/mempool.h> | 24 | #include <linux/mempool.h> |
| 25 | #include <linux/ioprio.h> | 25 | #include <linux/ioprio.h> |
| 26 | #include <linux/bug.h> | ||
| 26 | 27 | ||
| 27 | #ifdef CONFIG_BLOCK | 28 | #ifdef CONFIG_BLOCK |
| 28 | 29 | ||
| @@ -101,10 +102,10 @@ static inline int bio_has_allocated_vec(struct bio *bio) | |||
| 101 | * I/O completely on that queue (see ide-dma for example) | 102 | * I/O completely on that queue (see ide-dma for example) |
| 102 | */ | 103 | */ |
| 103 | #define __bio_kmap_atomic(bio, idx, kmtype) \ | 104 | #define __bio_kmap_atomic(bio, idx, kmtype) \ |
| 104 | (kmap_atomic(bio_iovec_idx((bio), (idx))->bv_page, kmtype) + \ | 105 | (kmap_atomic(bio_iovec_idx((bio), (idx))->bv_page) + \ |
| 105 | bio_iovec_idx((bio), (idx))->bv_offset) | 106 | bio_iovec_idx((bio), (idx))->bv_offset) |
| 106 | 107 | ||
| 107 | #define __bio_kunmap_atomic(addr, kmtype) kunmap_atomic(addr, kmtype) | 108 | #define __bio_kunmap_atomic(addr, kmtype) kunmap_atomic(addr) |
| 108 | 109 | ||
| 109 | /* | 110 | /* |
| 110 | * merge helpers etc | 111 | * merge helpers etc |
| @@ -317,7 +318,7 @@ static inline char *bvec_kmap_irq(struct bio_vec *bvec, unsigned long *flags) | |||
| 317 | * balancing is a lot nicer this way | 318 | * balancing is a lot nicer this way |
| 318 | */ | 319 | */ |
| 319 | local_irq_save(*flags); | 320 | local_irq_save(*flags); |
| 320 | addr = (unsigned long) kmap_atomic(bvec->bv_page, KM_BIO_SRC_IRQ); | 321 | addr = (unsigned long) kmap_atomic(bvec->bv_page); |
| 321 | 322 | ||
| 322 | BUG_ON(addr & ~PAGE_MASK); | 323 | BUG_ON(addr & ~PAGE_MASK); |
| 323 | 324 | ||
| @@ -328,7 +329,7 @@ static inline void bvec_kunmap_irq(char *buffer, unsigned long *flags) | |||
| 328 | { | 329 | { |
| 329 | unsigned long ptr = (unsigned long) buffer & PAGE_MASK; | 330 | unsigned long ptr = (unsigned long) buffer & PAGE_MASK; |
| 330 | 331 | ||
| 331 | kunmap_atomic((void *) ptr, KM_BIO_SRC_IRQ); | 332 | kunmap_atomic((void *) ptr); |
| 332 | local_irq_restore(*flags); | 333 | local_irq_restore(*flags); |
| 333 | } | 334 | } |
| 334 | 335 | ||
diff --git a/include/linux/bit_spinlock.h b/include/linux/bit_spinlock.h index ac4d9f8b52e9..3b5bafce4337 100644 --- a/include/linux/bit_spinlock.h +++ b/include/linux/bit_spinlock.h | |||
| @@ -4,6 +4,7 @@ | |||
| 4 | #include <linux/kernel.h> | 4 | #include <linux/kernel.h> |
| 5 | #include <linux/preempt.h> | 5 | #include <linux/preempt.h> |
| 6 | #include <linux/atomic.h> | 6 | #include <linux/atomic.h> |
| 7 | #include <linux/bug.h> | ||
| 7 | 8 | ||
| 8 | /* | 9 | /* |
| 9 | * bit-based spin_lock() | 10 | * bit-based spin_lock() |
diff --git a/include/linux/bitops.h b/include/linux/bitops.h index 94300fe46cce..a3b6b82108b9 100644 --- a/include/linux/bitops.h +++ b/include/linux/bitops.h | |||
| @@ -27,11 +27,22 @@ extern unsigned long __sw_hweight64(__u64 w); | |||
| 27 | (bit) = find_next_bit((addr), (size), (bit) + 1)) | 27 | (bit) = find_next_bit((addr), (size), (bit) + 1)) |
| 28 | 28 | ||
| 29 | /* same as for_each_set_bit() but use bit as value to start with */ | 29 | /* same as for_each_set_bit() but use bit as value to start with */ |
| 30 | #define for_each_set_bit_cont(bit, addr, size) \ | 30 | #define for_each_set_bit_from(bit, addr, size) \ |
| 31 | for ((bit) = find_next_bit((addr), (size), (bit)); \ | 31 | for ((bit) = find_next_bit((addr), (size), (bit)); \ |
| 32 | (bit) < (size); \ | 32 | (bit) < (size); \ |
| 33 | (bit) = find_next_bit((addr), (size), (bit) + 1)) | 33 | (bit) = find_next_bit((addr), (size), (bit) + 1)) |
| 34 | 34 | ||
| 35 | #define for_each_clear_bit(bit, addr, size) \ | ||
| 36 | for ((bit) = find_first_zero_bit((addr), (size)); \ | ||
| 37 | (bit) < (size); \ | ||
| 38 | (bit) = find_next_zero_bit((addr), (size), (bit) + 1)) | ||
| 39 | |||
| 40 | /* same as for_each_clear_bit() but use bit as value to start with */ | ||
| 41 | #define for_each_clear_bit_from(bit, addr, size) \ | ||
| 42 | for ((bit) = find_next_zero_bit((addr), (size), (bit)); \ | ||
| 43 | (bit) < (size); \ | ||
| 44 | (bit) = find_next_zero_bit((addr), (size), (bit) + 1)) | ||
| 45 | |||
| 35 | static __inline__ int get_bitmask_order(unsigned int count) | 46 | static __inline__ int get_bitmask_order(unsigned int count) |
| 36 | { | 47 | { |
| 37 | int order; | 48 | int order; |
diff --git a/include/linux/bug.h b/include/linux/bug.h index d276b5510c83..72961c39576a 100644 --- a/include/linux/bug.h +++ b/include/linux/bug.h | |||
| @@ -11,6 +11,67 @@ enum bug_trap_type { | |||
| 11 | 11 | ||
| 12 | struct pt_regs; | 12 | struct pt_regs; |
| 13 | 13 | ||
| 14 | #ifdef __CHECKER__ | ||
| 15 | #define BUILD_BUG_ON_NOT_POWER_OF_2(n) | ||
| 16 | #define BUILD_BUG_ON_ZERO(e) (0) | ||
| 17 | #define BUILD_BUG_ON_NULL(e) ((void*)0) | ||
| 18 | #define BUILD_BUG_ON(condition) | ||
| 19 | #define BUILD_BUG() (0) | ||
| 20 | #else /* __CHECKER__ */ | ||
| 21 | |||
| 22 | /* Force a compilation error if a constant expression is not a power of 2 */ | ||
| 23 | #define BUILD_BUG_ON_NOT_POWER_OF_2(n) \ | ||
| 24 | BUILD_BUG_ON((n) == 0 || (((n) & ((n) - 1)) != 0)) | ||
| 25 | |||
| 26 | /* Force a compilation error if condition is true, but also produce a | ||
| 27 | result (of value 0 and type size_t), so the expression can be used | ||
| 28 | e.g. in a structure initializer (or where-ever else comma expressions | ||
| 29 | aren't permitted). */ | ||
| 30 | #define BUILD_BUG_ON_ZERO(e) (sizeof(struct { int:-!!(e); })) | ||
| 31 | #define BUILD_BUG_ON_NULL(e) ((void *)sizeof(struct { int:-!!(e); })) | ||
| 32 | |||
| 33 | /** | ||
| 34 | * BUILD_BUG_ON - break compile if a condition is true. | ||
| 35 | * @condition: the condition which the compiler should know is false. | ||
| 36 | * | ||
| 37 | * If you have some code which relies on certain constants being equal, or | ||
| 38 | * other compile-time-evaluated condition, you should use BUILD_BUG_ON to | ||
| 39 | * detect if someone changes it. | ||
| 40 | * | ||
| 41 | * The implementation uses gcc's reluctance to create a negative array, but | ||
| 42 | * gcc (as of 4.4) only emits that error for obvious cases (eg. not arguments | ||
| 43 | * to inline functions). So as a fallback we use the optimizer; if it can't | ||
| 44 | * prove the condition is false, it will cause a link error on the undefined | ||
| 45 | * "__build_bug_on_failed". This error message can be harder to track down | ||
| 46 | * though, hence the two different methods. | ||
| 47 | */ | ||
| 48 | #ifndef __OPTIMIZE__ | ||
| 49 | #define BUILD_BUG_ON(condition) ((void)sizeof(char[1 - 2*!!(condition)])) | ||
| 50 | #else | ||
| 51 | extern int __build_bug_on_failed; | ||
| 52 | #define BUILD_BUG_ON(condition) \ | ||
| 53 | do { \ | ||
| 54 | ((void)sizeof(char[1 - 2*!!(condition)])); \ | ||
| 55 | if (condition) __build_bug_on_failed = 1; \ | ||
| 56 | } while(0) | ||
| 57 | #endif | ||
| 58 | |||
| 59 | /** | ||
| 60 | * BUILD_BUG - break compile if used. | ||
| 61 | * | ||
| 62 | * If you have some code that you expect the compiler to eliminate at | ||
| 63 | * build time, you should use BUILD_BUG to detect if it is | ||
| 64 | * unexpectedly used. | ||
| 65 | */ | ||
| 66 | #define BUILD_BUG() \ | ||
| 67 | do { \ | ||
| 68 | extern void __build_bug_failed(void) \ | ||
| 69 | __linktime_error("BUILD_BUG failed"); \ | ||
| 70 | __build_bug_failed(); \ | ||
| 71 | } while (0) | ||
| 72 | |||
| 73 | #endif /* __CHECKER__ */ | ||
| 74 | |||
| 14 | #ifdef CONFIG_GENERIC_BUG | 75 | #ifdef CONFIG_GENERIC_BUG |
| 15 | #include <asm-generic/bug.h> | 76 | #include <asm-generic/bug.h> |
| 16 | 77 | ||
diff --git a/include/linux/c2port.h b/include/linux/c2port.h index a2f7d7413f30..4efabcb51347 100644 --- a/include/linux/c2port.h +++ b/include/linux/c2port.h | |||
| @@ -9,11 +9,12 @@ | |||
| 9 | * the Free Software Foundation | 9 | * the Free Software Foundation |
| 10 | */ | 10 | */ |
| 11 | 11 | ||
| 12 | #include <linux/device.h> | ||
| 13 | #include <linux/kmemcheck.h> | 12 | #include <linux/kmemcheck.h> |
| 14 | 13 | ||
| 15 | #define C2PORT_NAME_LEN 32 | 14 | #define C2PORT_NAME_LEN 32 |
| 16 | 15 | ||
| 16 | struct device; | ||
| 17 | |||
| 17 | /* | 18 | /* |
| 18 | * C2 port basic structs | 19 | * C2 port basic structs |
| 19 | */ | 20 | */ |
diff --git a/include/linux/can/dev.h b/include/linux/can/dev.h index a0969fcb72b9..5d2efe7e3f1b 100644 --- a/include/linux/can/dev.h +++ b/include/linux/can/dev.h | |||
| @@ -92,7 +92,7 @@ void can_bus_off(struct net_device *dev); | |||
| 92 | 92 | ||
| 93 | void can_put_echo_skb(struct sk_buff *skb, struct net_device *dev, | 93 | void can_put_echo_skb(struct sk_buff *skb, struct net_device *dev, |
| 94 | unsigned int idx); | 94 | unsigned int idx); |
| 95 | void can_get_echo_skb(struct net_device *dev, unsigned int idx); | 95 | unsigned int can_get_echo_skb(struct net_device *dev, unsigned int idx); |
| 96 | void can_free_echo_skb(struct net_device *dev, unsigned int idx); | 96 | void can_free_echo_skb(struct net_device *dev, unsigned int idx); |
| 97 | 97 | ||
| 98 | struct sk_buff *alloc_can_skb(struct net_device *dev, struct can_frame **cf); | 98 | struct sk_buff *alloc_can_skb(struct net_device *dev, struct can_frame **cf); |
diff --git a/include/linux/cdrom.h b/include/linux/cdrom.h index 7c48029dffe6..dfd7f187c351 100644 --- a/include/linux/cdrom.h +++ b/include/linux/cdrom.h | |||
| @@ -910,7 +910,6 @@ struct mode_page_header { | |||
| 910 | 910 | ||
| 911 | #ifdef __KERNEL__ | 911 | #ifdef __KERNEL__ |
| 912 | #include <linux/fs.h> /* not really needed, later.. */ | 912 | #include <linux/fs.h> /* not really needed, later.. */ |
| 913 | #include <linux/device.h> | ||
| 914 | #include <linux/list.h> | 913 | #include <linux/list.h> |
| 915 | 914 | ||
| 916 | struct packet_command | 915 | struct packet_command |
diff --git a/include/linux/ceph/decode.h b/include/linux/ceph/decode.h index c5b6939fb32a..220ae21e819b 100644 --- a/include/linux/ceph/decode.h +++ b/include/linux/ceph/decode.h | |||
| @@ -1,8 +1,9 @@ | |||
| 1 | #ifndef __CEPH_DECODE_H | 1 | #ifndef __CEPH_DECODE_H |
| 2 | #define __CEPH_DECODE_H | 2 | #define __CEPH_DECODE_H |
| 3 | 3 | ||
| 4 | #include <asm/unaligned.h> | 4 | #include <linux/bug.h> |
| 5 | #include <linux/time.h> | 5 | #include <linux/time.h> |
| 6 | #include <asm/unaligned.h> | ||
| 6 | 7 | ||
| 7 | #include "types.h" | 8 | #include "types.h" |
| 8 | 9 | ||
diff --git a/include/linux/ceph/libceph.h b/include/linux/ceph/libceph.h index 95bd8502e715..e8cf0ccd1a8d 100644 --- a/include/linux/ceph/libceph.h +++ b/include/linux/ceph/libceph.h | |||
| @@ -7,6 +7,7 @@ | |||
| 7 | #include <linux/backing-dev.h> | 7 | #include <linux/backing-dev.h> |
| 8 | #include <linux/completion.h> | 8 | #include <linux/completion.h> |
| 9 | #include <linux/exportfs.h> | 9 | #include <linux/exportfs.h> |
| 10 | #include <linux/bug.h> | ||
| 10 | #include <linux/fs.h> | 11 | #include <linux/fs.h> |
| 11 | #include <linux/mempool.h> | 12 | #include <linux/mempool.h> |
| 12 | #include <linux/pagemap.h> | 13 | #include <linux/pagemap.h> |
diff --git a/include/linux/ceph/mdsmap.h b/include/linux/ceph/mdsmap.h index 4c5cb0880bba..9935fac8c107 100644 --- a/include/linux/ceph/mdsmap.h +++ b/include/linux/ceph/mdsmap.h | |||
| @@ -1,6 +1,7 @@ | |||
| 1 | #ifndef _FS_CEPH_MDSMAP_H | 1 | #ifndef _FS_CEPH_MDSMAP_H |
| 2 | #define _FS_CEPH_MDSMAP_H | 2 | #define _FS_CEPH_MDSMAP_H |
| 3 | 3 | ||
| 4 | #include <linux/bug.h> | ||
| 4 | #include "types.h" | 5 | #include "types.h" |
| 5 | 6 | ||
| 6 | /* | 7 | /* |
diff --git a/include/linux/cgroup.h b/include/linux/cgroup.h index e9b602151caf..5a85b3415c1b 100644 --- a/include/linux/cgroup.h +++ b/include/linux/cgroup.h | |||
| @@ -160,38 +160,6 @@ enum { | |||
| 160 | CGRP_CLONE_CHILDREN, | 160 | CGRP_CLONE_CHILDREN, |
| 161 | }; | 161 | }; |
| 162 | 162 | ||
| 163 | /* which pidlist file are we talking about? */ | ||
| 164 | enum cgroup_filetype { | ||
| 165 | CGROUP_FILE_PROCS, | ||
| 166 | CGROUP_FILE_TASKS, | ||
| 167 | }; | ||
| 168 | |||
| 169 | /* | ||
| 170 | * A pidlist is a list of pids that virtually represents the contents of one | ||
| 171 | * of the cgroup files ("procs" or "tasks"). We keep a list of such pidlists, | ||
| 172 | * a pair (one each for procs, tasks) for each pid namespace that's relevant | ||
| 173 | * to the cgroup. | ||
| 174 | */ | ||
| 175 | struct cgroup_pidlist { | ||
| 176 | /* | ||
| 177 | * used to find which pidlist is wanted. doesn't change as long as | ||
| 178 | * this particular list stays in the list. | ||
| 179 | */ | ||
| 180 | struct { enum cgroup_filetype type; struct pid_namespace *ns; } key; | ||
| 181 | /* array of xids */ | ||
| 182 | pid_t *list; | ||
| 183 | /* how many elements the above list has */ | ||
| 184 | int length; | ||
| 185 | /* how many files are using the current array */ | ||
| 186 | int use_count; | ||
| 187 | /* each of these stored in a list by its cgroup */ | ||
| 188 | struct list_head links; | ||
| 189 | /* pointer to the cgroup we belong to, for list removal purposes */ | ||
| 190 | struct cgroup *owner; | ||
| 191 | /* protects the other fields */ | ||
| 192 | struct rw_semaphore mutex; | ||
| 193 | }; | ||
| 194 | |||
| 195 | struct cgroup { | 163 | struct cgroup { |
| 196 | unsigned long flags; /* "unsigned long" so bitops work */ | 164 | unsigned long flags; /* "unsigned long" so bitops work */ |
| 197 | 165 | ||
| @@ -484,23 +452,18 @@ int cgroup_taskset_size(struct cgroup_taskset *tset); | |||
| 484 | */ | 452 | */ |
| 485 | 453 | ||
| 486 | struct cgroup_subsys { | 454 | struct cgroup_subsys { |
| 487 | struct cgroup_subsys_state *(*create)(struct cgroup_subsys *ss, | 455 | struct cgroup_subsys_state *(*create)(struct cgroup *cgrp); |
| 488 | struct cgroup *cgrp); | 456 | int (*pre_destroy)(struct cgroup *cgrp); |
| 489 | int (*pre_destroy)(struct cgroup_subsys *ss, struct cgroup *cgrp); | 457 | void (*destroy)(struct cgroup *cgrp); |
| 490 | void (*destroy)(struct cgroup_subsys *ss, struct cgroup *cgrp); | 458 | int (*can_attach)(struct cgroup *cgrp, struct cgroup_taskset *tset); |
| 491 | int (*can_attach)(struct cgroup_subsys *ss, struct cgroup *cgrp, | 459 | void (*cancel_attach)(struct cgroup *cgrp, struct cgroup_taskset *tset); |
| 492 | struct cgroup_taskset *tset); | 460 | void (*attach)(struct cgroup *cgrp, struct cgroup_taskset *tset); |
| 493 | void (*cancel_attach)(struct cgroup_subsys *ss, struct cgroup *cgrp, | 461 | void (*fork)(struct task_struct *task); |
| 494 | struct cgroup_taskset *tset); | 462 | void (*exit)(struct cgroup *cgrp, struct cgroup *old_cgrp, |
| 495 | void (*attach)(struct cgroup_subsys *ss, struct cgroup *cgrp, | 463 | struct task_struct *task); |
| 496 | struct cgroup_taskset *tset); | 464 | int (*populate)(struct cgroup_subsys *ss, struct cgroup *cgrp); |
| 497 | void (*fork)(struct cgroup_subsys *ss, struct task_struct *task); | 465 | void (*post_clone)(struct cgroup *cgrp); |
| 498 | void (*exit)(struct cgroup_subsys *ss, struct cgroup *cgrp, | 466 | void (*bind)(struct cgroup *root); |
| 499 | struct cgroup *old_cgrp, struct task_struct *task); | ||
| 500 | int (*populate)(struct cgroup_subsys *ss, | ||
| 501 | struct cgroup *cgrp); | ||
| 502 | void (*post_clone)(struct cgroup_subsys *ss, struct cgroup *cgrp); | ||
| 503 | void (*bind)(struct cgroup_subsys *ss, struct cgroup *root); | ||
| 504 | 467 | ||
| 505 | int subsys_id; | 468 | int subsys_id; |
| 506 | int active; | 469 | int active; |
| @@ -535,7 +498,7 @@ struct cgroup_subsys { | |||
| 535 | struct list_head sibling; | 498 | struct list_head sibling; |
| 536 | /* used when use_id == true */ | 499 | /* used when use_id == true */ |
| 537 | struct idr idr; | 500 | struct idr idr; |
| 538 | rwlock_t id_lock; | 501 | spinlock_t id_lock; |
| 539 | 502 | ||
| 540 | /* should be defined only by modular subsystems */ | 503 | /* should be defined only by modular subsystems */ |
| 541 | struct module *module; | 504 | struct module *module; |
| @@ -602,11 +565,6 @@ int cgroup_scan_tasks(struct cgroup_scanner *scan); | |||
| 602 | int cgroup_attach_task(struct cgroup *, struct task_struct *); | 565 | int cgroup_attach_task(struct cgroup *, struct task_struct *); |
| 603 | int cgroup_attach_task_all(struct task_struct *from, struct task_struct *); | 566 | int cgroup_attach_task_all(struct task_struct *from, struct task_struct *); |
| 604 | 567 | ||
| 605 | static inline int cgroup_attach_task_current_cg(struct task_struct *tsk) | ||
| 606 | { | ||
| 607 | return cgroup_attach_task_all(current, tsk); | ||
| 608 | } | ||
| 609 | |||
| 610 | /* | 568 | /* |
| 611 | * CSS ID is ID for cgroup_subsys_state structs under subsys. This only works | 569 | * CSS ID is ID for cgroup_subsys_state structs under subsys. This only works |
| 612 | * if cgroup_subsys.use_id == true. It can be used for looking up and scanning. | 570 | * if cgroup_subsys.use_id == true. It can be used for looking up and scanning. |
| @@ -669,10 +627,6 @@ static inline int cgroup_attach_task_all(struct task_struct *from, | |||
| 669 | { | 627 | { |
| 670 | return 0; | 628 | return 0; |
| 671 | } | 629 | } |
| 672 | static inline int cgroup_attach_task_current_cg(struct task_struct *t) | ||
| 673 | { | ||
| 674 | return 0; | ||
| 675 | } | ||
| 676 | 630 | ||
| 677 | #endif /* !CONFIG_CGROUPS */ | 631 | #endif /* !CONFIG_CGROUPS */ |
| 678 | 632 | ||
diff --git a/include/linux/cleancache.h b/include/linux/cleancache.h index 04ffb2e6c9d0..42e55deee757 100644 --- a/include/linux/cleancache.h +++ b/include/linux/cleancache.h | |||
| @@ -28,9 +28,9 @@ struct cleancache_ops { | |||
| 28 | pgoff_t, struct page *); | 28 | pgoff_t, struct page *); |
| 29 | void (*put_page)(int, struct cleancache_filekey, | 29 | void (*put_page)(int, struct cleancache_filekey, |
| 30 | pgoff_t, struct page *); | 30 | pgoff_t, struct page *); |
| 31 | void (*flush_page)(int, struct cleancache_filekey, pgoff_t); | 31 | void (*invalidate_page)(int, struct cleancache_filekey, pgoff_t); |
| 32 | void (*flush_inode)(int, struct cleancache_filekey); | 32 | void (*invalidate_inode)(int, struct cleancache_filekey); |
| 33 | void (*flush_fs)(int); | 33 | void (*invalidate_fs)(int); |
| 34 | }; | 34 | }; |
| 35 | 35 | ||
| 36 | extern struct cleancache_ops | 36 | extern struct cleancache_ops |
| @@ -39,9 +39,9 @@ extern void __cleancache_init_fs(struct super_block *); | |||
| 39 | extern void __cleancache_init_shared_fs(char *, struct super_block *); | 39 | extern void __cleancache_init_shared_fs(char *, struct super_block *); |
| 40 | extern int __cleancache_get_page(struct page *); | 40 | extern int __cleancache_get_page(struct page *); |
| 41 | extern void __cleancache_put_page(struct page *); | 41 | extern void __cleancache_put_page(struct page *); |
| 42 | extern void __cleancache_flush_page(struct address_space *, struct page *); | 42 | extern void __cleancache_invalidate_page(struct address_space *, struct page *); |
| 43 | extern void __cleancache_flush_inode(struct address_space *); | 43 | extern void __cleancache_invalidate_inode(struct address_space *); |
| 44 | extern void __cleancache_flush_fs(struct super_block *); | 44 | extern void __cleancache_invalidate_fs(struct super_block *); |
| 45 | extern int cleancache_enabled; | 45 | extern int cleancache_enabled; |
| 46 | 46 | ||
| 47 | #ifdef CONFIG_CLEANCACHE | 47 | #ifdef CONFIG_CLEANCACHE |
| @@ -99,24 +99,24 @@ static inline void cleancache_put_page(struct page *page) | |||
| 99 | __cleancache_put_page(page); | 99 | __cleancache_put_page(page); |
| 100 | } | 100 | } |
| 101 | 101 | ||
| 102 | static inline void cleancache_flush_page(struct address_space *mapping, | 102 | static inline void cleancache_invalidate_page(struct address_space *mapping, |
| 103 | struct page *page) | 103 | struct page *page) |
| 104 | { | 104 | { |
| 105 | /* careful... page->mapping is NULL sometimes when this is called */ | 105 | /* careful... page->mapping is NULL sometimes when this is called */ |
| 106 | if (cleancache_enabled && cleancache_fs_enabled_mapping(mapping)) | 106 | if (cleancache_enabled && cleancache_fs_enabled_mapping(mapping)) |
| 107 | __cleancache_flush_page(mapping, page); | 107 | __cleancache_invalidate_page(mapping, page); |
| 108 | } | 108 | } |
| 109 | 109 | ||
| 110 | static inline void cleancache_flush_inode(struct address_space *mapping) | 110 | static inline void cleancache_invalidate_inode(struct address_space *mapping) |
| 111 | { | 111 | { |
| 112 | if (cleancache_enabled && cleancache_fs_enabled_mapping(mapping)) | 112 | if (cleancache_enabled && cleancache_fs_enabled_mapping(mapping)) |
| 113 | __cleancache_flush_inode(mapping); | 113 | __cleancache_invalidate_inode(mapping); |
| 114 | } | 114 | } |
| 115 | 115 | ||
| 116 | static inline void cleancache_flush_fs(struct super_block *sb) | 116 | static inline void cleancache_invalidate_fs(struct super_block *sb) |
| 117 | { | 117 | { |
| 118 | if (cleancache_enabled) | 118 | if (cleancache_enabled) |
| 119 | __cleancache_flush_fs(sb); | 119 | __cleancache_invalidate_fs(sb); |
| 120 | } | 120 | } |
| 121 | 121 | ||
| 122 | #endif /* _LINUX_CLEANCACHE_H */ | 122 | #endif /* _LINUX_CLEANCACHE_H */ |
diff --git a/include/linux/clocksource.h b/include/linux/clocksource.h index 081147da0564..fbe89e17124e 100644 --- a/include/linux/clocksource.h +++ b/include/linux/clocksource.h | |||
| @@ -319,13 +319,6 @@ static inline void __clocksource_updatefreq_khz(struct clocksource *cs, u32 khz) | |||
| 319 | __clocksource_updatefreq_scale(cs, 1000, khz); | 319 | __clocksource_updatefreq_scale(cs, 1000, khz); |
| 320 | } | 320 | } |
| 321 | 321 | ||
| 322 | static inline void | ||
| 323 | clocksource_calc_mult_shift(struct clocksource *cs, u32 freq, u32 minsec) | ||
| 324 | { | ||
| 325 | return clocks_calc_mult_shift(&cs->mult, &cs->shift, freq, | ||
| 326 | NSEC_PER_SEC, minsec); | ||
| 327 | } | ||
| 328 | |||
| 329 | #ifdef CONFIG_GENERIC_TIME_VSYSCALL | 322 | #ifdef CONFIG_GENERIC_TIME_VSYSCALL |
| 330 | extern void | 323 | extern void |
| 331 | update_vsyscall(struct timespec *ts, struct timespec *wtm, | 324 | update_vsyscall(struct timespec *ts, struct timespec *wtm, |
diff --git a/include/linux/compaction.h b/include/linux/compaction.h index bb2bbdbe5464..51a90b7f2d60 100644 --- a/include/linux/compaction.h +++ b/include/linux/compaction.h | |||
| @@ -23,6 +23,7 @@ extern int fragmentation_index(struct zone *zone, unsigned int order); | |||
| 23 | extern unsigned long try_to_compact_pages(struct zonelist *zonelist, | 23 | extern unsigned long try_to_compact_pages(struct zonelist *zonelist, |
| 24 | int order, gfp_t gfp_mask, nodemask_t *mask, | 24 | int order, gfp_t gfp_mask, nodemask_t *mask, |
| 25 | bool sync); | 25 | bool sync); |
| 26 | extern int compact_pgdat(pg_data_t *pgdat, int order); | ||
| 26 | extern unsigned long compaction_suitable(struct zone *zone, int order); | 27 | extern unsigned long compaction_suitable(struct zone *zone, int order); |
| 27 | 28 | ||
| 28 | /* Do not skip compaction more than 64 times */ | 29 | /* Do not skip compaction more than 64 times */ |
| @@ -33,20 +34,26 @@ extern unsigned long compaction_suitable(struct zone *zone, int order); | |||
| 33 | * allocation success. 1 << compact_defer_limit compactions are skipped up | 34 | * allocation success. 1 << compact_defer_limit compactions are skipped up |
| 34 | * to a limit of 1 << COMPACT_MAX_DEFER_SHIFT | 35 | * to a limit of 1 << COMPACT_MAX_DEFER_SHIFT |
| 35 | */ | 36 | */ |
| 36 | static inline void defer_compaction(struct zone *zone) | 37 | static inline void defer_compaction(struct zone *zone, int order) |
| 37 | { | 38 | { |
| 38 | zone->compact_considered = 0; | 39 | zone->compact_considered = 0; |
| 39 | zone->compact_defer_shift++; | 40 | zone->compact_defer_shift++; |
| 40 | 41 | ||
| 42 | if (order < zone->compact_order_failed) | ||
| 43 | zone->compact_order_failed = order; | ||
| 44 | |||
| 41 | if (zone->compact_defer_shift > COMPACT_MAX_DEFER_SHIFT) | 45 | if (zone->compact_defer_shift > COMPACT_MAX_DEFER_SHIFT) |
| 42 | zone->compact_defer_shift = COMPACT_MAX_DEFER_SHIFT; | 46 | zone->compact_defer_shift = COMPACT_MAX_DEFER_SHIFT; |
| 43 | } | 47 | } |
| 44 | 48 | ||
| 45 | /* Returns true if compaction should be skipped this time */ | 49 | /* Returns true if compaction should be skipped this time */ |
| 46 | static inline bool compaction_deferred(struct zone *zone) | 50 | static inline bool compaction_deferred(struct zone *zone, int order) |
| 47 | { | 51 | { |
| 48 | unsigned long defer_limit = 1UL << zone->compact_defer_shift; | 52 | unsigned long defer_limit = 1UL << zone->compact_defer_shift; |
| 49 | 53 | ||
| 54 | if (order < zone->compact_order_failed) | ||
| 55 | return false; | ||
| 56 | |||
| 50 | /* Avoid possible overflow */ | 57 | /* Avoid possible overflow */ |
| 51 | if (++zone->compact_considered > defer_limit) | 58 | if (++zone->compact_considered > defer_limit) |
| 52 | zone->compact_considered = defer_limit; | 59 | zone->compact_considered = defer_limit; |
| @@ -62,16 +69,21 @@ static inline unsigned long try_to_compact_pages(struct zonelist *zonelist, | |||
| 62 | return COMPACT_CONTINUE; | 69 | return COMPACT_CONTINUE; |
| 63 | } | 70 | } |
| 64 | 71 | ||
| 72 | static inline int compact_pgdat(pg_data_t *pgdat, int order) | ||
| 73 | { | ||
| 74 | return COMPACT_CONTINUE; | ||
| 75 | } | ||
| 76 | |||
| 65 | static inline unsigned long compaction_suitable(struct zone *zone, int order) | 77 | static inline unsigned long compaction_suitable(struct zone *zone, int order) |
| 66 | { | 78 | { |
| 67 | return COMPACT_SKIPPED; | 79 | return COMPACT_SKIPPED; |
| 68 | } | 80 | } |
| 69 | 81 | ||
| 70 | static inline void defer_compaction(struct zone *zone) | 82 | static inline void defer_compaction(struct zone *zone, int order) |
| 71 | { | 83 | { |
| 72 | } | 84 | } |
| 73 | 85 | ||
| 74 | static inline bool compaction_deferred(struct zone *zone) | 86 | static inline bool compaction_deferred(struct zone *zone, int order) |
| 75 | { | 87 | { |
| 76 | return 1; | 88 | return 1; |
| 77 | } | 89 | } |
diff --git a/include/linux/compiler-gcc.h b/include/linux/compiler-gcc.h index 3fd17c249221..e5834aa24b9e 100644 --- a/include/linux/compiler-gcc.h +++ b/include/linux/compiler-gcc.h | |||
| @@ -87,7 +87,8 @@ | |||
| 87 | */ | 87 | */ |
| 88 | #define __pure __attribute__((pure)) | 88 | #define __pure __attribute__((pure)) |
| 89 | #define __aligned(x) __attribute__((aligned(x))) | 89 | #define __aligned(x) __attribute__((aligned(x))) |
| 90 | #define __printf(a,b) __attribute__((format(printf,a,b))) | 90 | #define __printf(a, b) __attribute__((format(printf, a, b))) |
| 91 | #define __scanf(a, b) __attribute__((format(scanf, a, b))) | ||
| 91 | #define noinline __attribute__((noinline)) | 92 | #define noinline __attribute__((noinline)) |
| 92 | #define __attribute_const__ __attribute__((__const__)) | 93 | #define __attribute_const__ __attribute__((__const__)) |
| 93 | #define __maybe_unused __attribute__((unused)) | 94 | #define __maybe_unused __attribute__((unused)) |
diff --git a/include/linux/compiler.h b/include/linux/compiler.h index 4a243546d142..923d093c9cea 100644 --- a/include/linux/compiler.h +++ b/include/linux/compiler.h | |||
| @@ -236,7 +236,7 @@ void ftrace_likely_update(struct ftrace_branch_data *f, int val, int expect); | |||
| 236 | 236 | ||
| 237 | /* | 237 | /* |
| 238 | * Rather then using noinline to prevent stack consumption, use | 238 | * Rather then using noinline to prevent stack consumption, use |
| 239 | * noinline_for_stack instead. For documentaiton reasons. | 239 | * noinline_for_stack instead. For documentation reasons. |
| 240 | */ | 240 | */ |
| 241 | #define noinline_for_stack noinline | 241 | #define noinline_for_stack noinline |
| 242 | 242 | ||
diff --git a/include/linux/connector.h b/include/linux/connector.h index 3c9c54fd5690..76384074262d 100644 --- a/include/linux/connector.h +++ b/include/linux/connector.h | |||
| @@ -43,6 +43,7 @@ | |||
| 43 | #define CN_IDX_DRBD 0x8 | 43 | #define CN_IDX_DRBD 0x8 |
| 44 | #define CN_VAL_DRBD 0x1 | 44 | #define CN_VAL_DRBD 0x1 |
| 45 | #define CN_KVP_IDX 0x9 /* HyperV KVP */ | 45 | #define CN_KVP_IDX 0x9 /* HyperV KVP */ |
| 46 | #define CN_KVP_VAL 0x1 /* queries from the kernel */ | ||
| 46 | 47 | ||
| 47 | #define CN_NETLINK_USERS 10 /* Highest index + 1 */ | 48 | #define CN_NETLINK_USERS 10 /* Highest index + 1 */ |
| 48 | 49 | ||
diff --git a/include/linux/cpu.h b/include/linux/cpu.h index 1f6587590a1a..ee28844ae68e 100644 --- a/include/linux/cpu.h +++ b/include/linux/cpu.h | |||
| @@ -14,11 +14,12 @@ | |||
| 14 | #ifndef _LINUX_CPU_H_ | 14 | #ifndef _LINUX_CPU_H_ |
| 15 | #define _LINUX_CPU_H_ | 15 | #define _LINUX_CPU_H_ |
| 16 | 16 | ||
| 17 | #include <linux/device.h> | ||
| 18 | #include <linux/node.h> | 17 | #include <linux/node.h> |
| 19 | #include <linux/compiler.h> | 18 | #include <linux/compiler.h> |
| 20 | #include <linux/cpumask.h> | 19 | #include <linux/cpumask.h> |
| 21 | 20 | ||
| 21 | struct device; | ||
| 22 | |||
| 22 | struct cpu { | 23 | struct cpu { |
| 23 | int node_id; /* The node which contains the CPU */ | 24 | int node_id; /* The node which contains the CPU */ |
| 24 | int hotpluggable; /* creates sysfs control file if hotpluggable */ | 25 | int hotpluggable; /* creates sysfs control file if hotpluggable */ |
| @@ -44,6 +45,13 @@ extern ssize_t arch_cpu_release(const char *, size_t); | |||
| 44 | #endif | 45 | #endif |
| 45 | struct notifier_block; | 46 | struct notifier_block; |
| 46 | 47 | ||
| 48 | #ifdef CONFIG_ARCH_HAS_CPU_AUTOPROBE | ||
| 49 | extern int arch_cpu_uevent(struct device *dev, struct kobj_uevent_env *env); | ||
| 50 | extern ssize_t arch_print_cpu_modalias(struct device *dev, | ||
| 51 | struct device_attribute *attr, | ||
| 52 | char *bufptr); | ||
| 53 | #endif | ||
| 54 | |||
| 47 | /* | 55 | /* |
| 48 | * CPU notifier priorities. | 56 | * CPU notifier priorities. |
| 49 | */ | 57 | */ |
diff --git a/include/linux/cpufreq.h b/include/linux/cpufreq.h index 6216115c7789..b60f6ba01d0c 100644 --- a/include/linux/cpufreq.h +++ b/include/linux/cpufreq.h | |||
| @@ -14,7 +14,6 @@ | |||
| 14 | #include <linux/mutex.h> | 14 | #include <linux/mutex.h> |
| 15 | #include <linux/notifier.h> | 15 | #include <linux/notifier.h> |
| 16 | #include <linux/threads.h> | 16 | #include <linux/threads.h> |
| 17 | #include <linux/device.h> | ||
| 18 | #include <linux/kobject.h> | 17 | #include <linux/kobject.h> |
| 19 | #include <linux/sysfs.h> | 18 | #include <linux/sysfs.h> |
| 20 | #include <linux/completion.h> | 19 | #include <linux/completion.h> |
| @@ -35,6 +34,7 @@ | |||
| 35 | #ifdef CONFIG_CPU_FREQ | 34 | #ifdef CONFIG_CPU_FREQ |
| 36 | int cpufreq_register_notifier(struct notifier_block *nb, unsigned int list); | 35 | int cpufreq_register_notifier(struct notifier_block *nb, unsigned int list); |
| 37 | int cpufreq_unregister_notifier(struct notifier_block *nb, unsigned int list); | 36 | int cpufreq_unregister_notifier(struct notifier_block *nb, unsigned int list); |
| 37 | extern void disable_cpufreq(void); | ||
| 38 | #else /* CONFIG_CPU_FREQ */ | 38 | #else /* CONFIG_CPU_FREQ */ |
| 39 | static inline int cpufreq_register_notifier(struct notifier_block *nb, | 39 | static inline int cpufreq_register_notifier(struct notifier_block *nb, |
| 40 | unsigned int list) | 40 | unsigned int list) |
| @@ -46,6 +46,7 @@ static inline int cpufreq_unregister_notifier(struct notifier_block *nb, | |||
| 46 | { | 46 | { |
| 47 | return 0; | 47 | return 0; |
| 48 | } | 48 | } |
| 49 | static inline void disable_cpufreq(void) { } | ||
| 49 | #endif /* CONFIG_CPU_FREQ */ | 50 | #endif /* CONFIG_CPU_FREQ */ |
| 50 | 51 | ||
| 51 | /* if (cpufreq_driver->target) exists, the ->governor decides what frequency | 52 | /* if (cpufreq_driver->target) exists, the ->governor decides what frequency |
diff --git a/include/linux/cpumask.h b/include/linux/cpumask.h index 4f7a63237471..7b9b75a529be 100644 --- a/include/linux/cpumask.h +++ b/include/linux/cpumask.h | |||
| @@ -9,6 +9,7 @@ | |||
| 9 | #include <linux/kernel.h> | 9 | #include <linux/kernel.h> |
| 10 | #include <linux/threads.h> | 10 | #include <linux/threads.h> |
| 11 | #include <linux/bitmap.h> | 11 | #include <linux/bitmap.h> |
| 12 | #include <linux/bug.h> | ||
| 12 | 13 | ||
| 13 | typedef struct cpumask { DECLARE_BITMAP(bits, NR_CPUS); } cpumask_t; | 14 | typedef struct cpumask { DECLARE_BITMAP(bits, NR_CPUS); } cpumask_t; |
| 14 | 15 | ||
diff --git a/include/linux/cpuset.h b/include/linux/cpuset.h index e9eaec522655..7a7e5fd2a277 100644 --- a/include/linux/cpuset.h +++ b/include/linux/cpuset.h | |||
| @@ -89,42 +89,33 @@ extern void rebuild_sched_domains(void); | |||
| 89 | extern void cpuset_print_task_mems_allowed(struct task_struct *p); | 89 | extern void cpuset_print_task_mems_allowed(struct task_struct *p); |
| 90 | 90 | ||
| 91 | /* | 91 | /* |
| 92 | * reading current mems_allowed and mempolicy in the fastpath must protected | 92 | * get_mems_allowed is required when making decisions involving mems_allowed |
| 93 | * by get_mems_allowed() | 93 | * such as during page allocation. mems_allowed can be updated in parallel |
| 94 | * and depending on the new value an operation can fail potentially causing | ||
| 95 | * process failure. A retry loop with get_mems_allowed and put_mems_allowed | ||
| 96 | * prevents these artificial failures. | ||
| 94 | */ | 97 | */ |
| 95 | static inline void get_mems_allowed(void) | 98 | static inline unsigned int get_mems_allowed(void) |
| 96 | { | 99 | { |
| 97 | current->mems_allowed_change_disable++; | 100 | return read_seqcount_begin(¤t->mems_allowed_seq); |
| 98 | |||
| 99 | /* | ||
| 100 | * ensure that reading mems_allowed and mempolicy happens after the | ||
| 101 | * update of ->mems_allowed_change_disable. | ||
| 102 | * | ||
| 103 | * the write-side task finds ->mems_allowed_change_disable is not 0, | ||
| 104 | * and knows the read-side task is reading mems_allowed or mempolicy, | ||
| 105 | * so it will clear old bits lazily. | ||
| 106 | */ | ||
| 107 | smp_mb(); | ||
| 108 | } | 101 | } |
| 109 | 102 | ||
| 110 | static inline void put_mems_allowed(void) | 103 | /* |
| 104 | * If this returns false, the operation that took place after get_mems_allowed | ||
| 105 | * may have failed. It is up to the caller to retry the operation if | ||
| 106 | * appropriate. | ||
| 107 | */ | ||
| 108 | static inline bool put_mems_allowed(unsigned int seq) | ||
| 111 | { | 109 | { |
| 112 | /* | 110 | return !read_seqcount_retry(¤t->mems_allowed_seq, seq); |
| 113 | * ensure that reading mems_allowed and mempolicy before reducing | ||
| 114 | * mems_allowed_change_disable. | ||
| 115 | * | ||
| 116 | * the write-side task will know that the read-side task is still | ||
| 117 | * reading mems_allowed or mempolicy, don't clears old bits in the | ||
| 118 | * nodemask. | ||
| 119 | */ | ||
| 120 | smp_mb(); | ||
| 121 | --ACCESS_ONCE(current->mems_allowed_change_disable); | ||
| 122 | } | 111 | } |
| 123 | 112 | ||
| 124 | static inline void set_mems_allowed(nodemask_t nodemask) | 113 | static inline void set_mems_allowed(nodemask_t nodemask) |
| 125 | { | 114 | { |
| 126 | task_lock(current); | 115 | task_lock(current); |
| 116 | write_seqcount_begin(¤t->mems_allowed_seq); | ||
| 127 | current->mems_allowed = nodemask; | 117 | current->mems_allowed = nodemask; |
| 118 | write_seqcount_end(¤t->mems_allowed_seq); | ||
| 128 | task_unlock(current); | 119 | task_unlock(current); |
| 129 | } | 120 | } |
| 130 | 121 | ||
| @@ -234,12 +225,14 @@ static inline void set_mems_allowed(nodemask_t nodemask) | |||
| 234 | { | 225 | { |
| 235 | } | 226 | } |
| 236 | 227 | ||
| 237 | static inline void get_mems_allowed(void) | 228 | static inline unsigned int get_mems_allowed(void) |
| 238 | { | 229 | { |
| 230 | return 0; | ||
| 239 | } | 231 | } |
| 240 | 232 | ||
| 241 | static inline void put_mems_allowed(void) | 233 | static inline bool put_mems_allowed(unsigned int seq) |
| 242 | { | 234 | { |
| 235 | return true; | ||
| 243 | } | 236 | } |
| 244 | 237 | ||
| 245 | #endif /* !CONFIG_CPUSETS */ | 238 | #endif /* !CONFIG_CPUSETS */ |
diff --git a/include/linux/crash_dump.h b/include/linux/crash_dump.h index b936763f2236..37e4f8da7cdf 100644 --- a/include/linux/crash_dump.h +++ b/include/linux/crash_dump.h | |||
| @@ -3,7 +3,6 @@ | |||
| 3 | 3 | ||
| 4 | #ifdef CONFIG_CRASH_DUMP | 4 | #ifdef CONFIG_CRASH_DUMP |
| 5 | #include <linux/kexec.h> | 5 | #include <linux/kexec.h> |
| 6 | #include <linux/device.h> | ||
| 7 | #include <linux/proc_fs.h> | 6 | #include <linux/proc_fs.h> |
| 8 | #include <linux/elf.h> | 7 | #include <linux/elf.h> |
| 9 | 8 | ||
diff --git a/include/linux/crc32.h b/include/linux/crc32.h index 391a259b2cc9..68267b64bb98 100644 --- a/include/linux/crc32.h +++ b/include/linux/crc32.h | |||
| @@ -11,6 +11,8 @@ | |||
| 11 | extern u32 crc32_le(u32 crc, unsigned char const *p, size_t len); | 11 | extern u32 crc32_le(u32 crc, unsigned char const *p, size_t len); |
| 12 | extern u32 crc32_be(u32 crc, unsigned char const *p, size_t len); | 12 | extern u32 crc32_be(u32 crc, unsigned char const *p, size_t len); |
| 13 | 13 | ||
| 14 | extern u32 __crc32c_le(u32 crc, unsigned char const *p, size_t len); | ||
| 15 | |||
| 14 | #define crc32(seed, data, length) crc32_le(seed, (unsigned char const *)(data), length) | 16 | #define crc32(seed, data, length) crc32_le(seed, (unsigned char const *)(data), length) |
| 15 | 17 | ||
| 16 | /* | 18 | /* |
diff --git a/include/linux/crypto.h b/include/linux/crypto.h index 8a94217b298e..b92eadf92d72 100644 --- a/include/linux/crypto.h +++ b/include/linux/crypto.h | |||
| @@ -20,6 +20,7 @@ | |||
| 20 | #include <linux/atomic.h> | 20 | #include <linux/atomic.h> |
| 21 | #include <linux/kernel.h> | 21 | #include <linux/kernel.h> |
| 22 | #include <linux/list.h> | 22 | #include <linux/list.h> |
| 23 | #include <linux/bug.h> | ||
| 23 | #include <linux/slab.h> | 24 | #include <linux/slab.h> |
| 24 | #include <linux/string.h> | 25 | #include <linux/string.h> |
| 25 | #include <linux/uaccess.h> | 26 | #include <linux/uaccess.h> |
| @@ -75,6 +76,11 @@ | |||
| 75 | */ | 76 | */ |
| 76 | #define CRYPTO_ALG_INSTANCE 0x00000800 | 77 | #define CRYPTO_ALG_INSTANCE 0x00000800 |
| 77 | 78 | ||
| 79 | /* Set this bit if the algorithm provided is hardware accelerated but | ||
| 80 | * not available to userspace via instruction set or so. | ||
| 81 | */ | ||
| 82 | #define CRYPTO_ALG_KERN_DRIVER_ONLY 0x00001000 | ||
| 83 | |||
| 78 | /* | 84 | /* |
| 79 | * Transform masks and values (for crt_flags). | 85 | * Transform masks and values (for crt_flags). |
| 80 | */ | 86 | */ |
| @@ -309,6 +315,8 @@ struct crypto_alg { | |||
| 309 | */ | 315 | */ |
| 310 | int crypto_register_alg(struct crypto_alg *alg); | 316 | int crypto_register_alg(struct crypto_alg *alg); |
| 311 | int crypto_unregister_alg(struct crypto_alg *alg); | 317 | int crypto_unregister_alg(struct crypto_alg *alg); |
| 318 | int crypto_register_algs(struct crypto_alg *algs, int count); | ||
| 319 | int crypto_unregister_algs(struct crypto_alg *algs, int count); | ||
| 312 | 320 | ||
| 313 | /* | 321 | /* |
| 314 | * Algorithm query interface. | 322 | * Algorithm query interface. |
diff --git a/include/linux/dcache.h b/include/linux/dcache.h index ff5f5256d175..7e11f1418203 100644 --- a/include/linux/dcache.h +++ b/include/linux/dcache.h | |||
| @@ -222,7 +222,6 @@ extern void shrink_dcache_for_umount(struct super_block *); | |||
| 222 | extern int d_invalidate(struct dentry *); | 222 | extern int d_invalidate(struct dentry *); |
| 223 | 223 | ||
| 224 | /* only used at mount-time */ | 224 | /* only used at mount-time */ |
| 225 | extern struct dentry * d_alloc_root(struct inode *); | ||
| 226 | extern struct dentry * d_make_root(struct inode *); | 225 | extern struct dentry * d_make_root(struct inode *); |
| 227 | 226 | ||
| 228 | /* <clickety>-<click> the ramfs-type tree */ | 227 | /* <clickety>-<click> the ramfs-type tree */ |
diff --git a/include/linux/dccp.h b/include/linux/dccp.h index 710c04302a15..eaf95a023af4 100644 --- a/include/linux/dccp.h +++ b/include/linux/dccp.h | |||
| @@ -376,8 +376,10 @@ static inline unsigned int dccp_hdr_len(const struct sk_buff *skb) | |||
| 376 | /** | 376 | /** |
| 377 | * struct dccp_request_sock - represent DCCP-specific connection request | 377 | * struct dccp_request_sock - represent DCCP-specific connection request |
| 378 | * @dreq_inet_rsk: structure inherited from | 378 | * @dreq_inet_rsk: structure inherited from |
| 379 | * @dreq_iss: initial sequence number sent on the Response (RFC 4340, 7.1) | 379 | * @dreq_iss: initial sequence number, sent on the first Response (RFC 4340, 7.1) |
| 380 | * @dreq_isr: initial sequence number received on the Request | 380 | * @dreq_gss: greatest sequence number sent (for retransmitted Responses) |
| 381 | * @dreq_isr: initial sequence number received in the first Request | ||
| 382 | * @dreq_gsr: greatest sequence number received (for retransmitted Request(s)) | ||
| 381 | * @dreq_service: service code present on the Request (there is just one) | 383 | * @dreq_service: service code present on the Request (there is just one) |
| 382 | * @dreq_featneg: feature negotiation options for this connection | 384 | * @dreq_featneg: feature negotiation options for this connection |
| 383 | * The following two fields are analogous to the ones in dccp_sock: | 385 | * The following two fields are analogous to the ones in dccp_sock: |
| @@ -387,7 +389,9 @@ static inline unsigned int dccp_hdr_len(const struct sk_buff *skb) | |||
| 387 | struct dccp_request_sock { | 389 | struct dccp_request_sock { |
| 388 | struct inet_request_sock dreq_inet_rsk; | 390 | struct inet_request_sock dreq_inet_rsk; |
| 389 | __u64 dreq_iss; | 391 | __u64 dreq_iss; |
| 392 | __u64 dreq_gss; | ||
| 390 | __u64 dreq_isr; | 393 | __u64 dreq_isr; |
| 394 | __u64 dreq_gsr; | ||
| 391 | __be32 dreq_service; | 395 | __be32 dreq_service; |
| 392 | struct list_head dreq_featneg; | 396 | struct list_head dreq_featneg; |
| 393 | __u32 dreq_timestamp_echo; | 397 | __u32 dreq_timestamp_echo; |
diff --git a/include/linux/debug_locks.h b/include/linux/debug_locks.h index 5033fb88c107..94f20c1488a1 100644 --- a/include/linux/debug_locks.h +++ b/include/linux/debug_locks.h | |||
| @@ -3,6 +3,7 @@ | |||
| 3 | 3 | ||
| 4 | #include <linux/kernel.h> | 4 | #include <linux/kernel.h> |
| 5 | #include <linux/atomic.h> | 5 | #include <linux/atomic.h> |
| 6 | #include <linux/bug.h> | ||
| 6 | #include <asm/system.h> | 7 | #include <asm/system.h> |
| 7 | 8 | ||
| 8 | struct task_struct; | 9 | struct task_struct; |
diff --git a/include/linux/debugfs.h b/include/linux/debugfs.h index 6169c26fd8c8..ae36b72c22f3 100644 --- a/include/linux/debugfs.h +++ b/include/linux/debugfs.h | |||
| @@ -86,7 +86,7 @@ struct dentry *debugfs_create_blob(const char *name, umode_t mode, | |||
| 86 | struct dentry *parent, | 86 | struct dentry *parent, |
| 87 | struct debugfs_blob_wrapper *blob); | 87 | struct debugfs_blob_wrapper *blob); |
| 88 | 88 | ||
| 89 | struct dentry *debugfs_create_regset32(const char *name, mode_t mode, | 89 | struct dentry *debugfs_create_regset32(const char *name, umode_t mode, |
| 90 | struct dentry *parent, | 90 | struct dentry *parent, |
| 91 | struct debugfs_regset32 *regset); | 91 | struct debugfs_regset32 *regset); |
| 92 | 92 | ||
| @@ -208,7 +208,7 @@ static inline struct dentry *debugfs_create_blob(const char *name, umode_t mode, | |||
| 208 | } | 208 | } |
| 209 | 209 | ||
| 210 | static inline struct dentry *debugfs_create_regset32(const char *name, | 210 | static inline struct dentry *debugfs_create_regset32(const char *name, |
| 211 | mode_t mode, struct dentry *parent, | 211 | umode_t mode, struct dentry *parent, |
| 212 | struct debugfs_regset32 *regset) | 212 | struct debugfs_regset32 *regset) |
| 213 | { | 213 | { |
| 214 | return ERR_PTR(-ENODEV); | 214 | return ERR_PTR(-ENODEV); |
diff --git a/include/linux/devfreq.h b/include/linux/devfreq.h index 98ce8124b1cc..281c72a3b9d5 100644 --- a/include/linux/devfreq.h +++ b/include/linux/devfreq.h | |||
| @@ -44,6 +44,14 @@ struct devfreq_dev_status { | |||
| 44 | void *private_data; | 44 | void *private_data; |
| 45 | }; | 45 | }; |
| 46 | 46 | ||
| 47 | /* | ||
| 48 | * The resulting frequency should be at most this. (this bound is the | ||
| 49 | * least upper bound; thus, the resulting freq should be lower or same) | ||
| 50 | * If the flag is not set, the resulting frequency should be at most the | ||
| 51 | * bound (greatest lower bound) | ||
| 52 | */ | ||
| 53 | #define DEVFREQ_FLAG_LEAST_UPPER_BOUND 0x1 | ||
| 54 | |||
| 47 | /** | 55 | /** |
| 48 | * struct devfreq_dev_profile - Devfreq's user device profile | 56 | * struct devfreq_dev_profile - Devfreq's user device profile |
| 49 | * @initial_freq The operating frequency when devfreq_add_device() is | 57 | * @initial_freq The operating frequency when devfreq_add_device() is |
| @@ -54,6 +62,8 @@ struct devfreq_dev_status { | |||
| 54 | * higher than any operable frequency, set maximum. | 62 | * higher than any operable frequency, set maximum. |
| 55 | * Before returning, target function should set | 63 | * Before returning, target function should set |
| 56 | * freq at the current frequency. | 64 | * freq at the current frequency. |
| 65 | * The "flags" parameter's possible values are | ||
| 66 | * explained above with "DEVFREQ_FLAG_*" macros. | ||
| 57 | * @get_dev_status The device should provide the current performance | 67 | * @get_dev_status The device should provide the current performance |
| 58 | * status to devfreq, which is used by governors. | 68 | * status to devfreq, which is used by governors. |
| 59 | * @exit An optional callback that is called when devfreq | 69 | * @exit An optional callback that is called when devfreq |
| @@ -66,7 +76,7 @@ struct devfreq_dev_profile { | |||
| 66 | unsigned long initial_freq; | 76 | unsigned long initial_freq; |
| 67 | unsigned int polling_ms; | 77 | unsigned int polling_ms; |
| 68 | 78 | ||
| 69 | int (*target)(struct device *dev, unsigned long *freq); | 79 | int (*target)(struct device *dev, unsigned long *freq, u32 flags); |
| 70 | int (*get_dev_status)(struct device *dev, | 80 | int (*get_dev_status)(struct device *dev, |
| 71 | struct devfreq_dev_status *stat); | 81 | struct devfreq_dev_status *stat); |
| 72 | void (*exit)(struct device *dev); | 82 | void (*exit)(struct device *dev); |
| @@ -124,6 +134,8 @@ struct devfreq_governor { | |||
| 124 | * touch this. | 134 | * touch this. |
| 125 | * @being_removed a flag to mark that this object is being removed in | 135 | * @being_removed a flag to mark that this object is being removed in |
| 126 | * order to prevent trying to remove the object multiple times. | 136 | * order to prevent trying to remove the object multiple times. |
| 137 | * @min_freq Limit minimum frequency requested by user (0: none) | ||
| 138 | * @max_freq Limit maximum frequency requested by user (0: none) | ||
| 127 | * | 139 | * |
| 128 | * This structure stores the devfreq information for a give device. | 140 | * This structure stores the devfreq information for a give device. |
| 129 | * | 141 | * |
| @@ -149,6 +161,9 @@ struct devfreq { | |||
| 149 | void *data; /* private data for governors */ | 161 | void *data; /* private data for governors */ |
| 150 | 162 | ||
| 151 | bool being_removed; | 163 | bool being_removed; |
| 164 | |||
| 165 | unsigned long min_freq; | ||
| 166 | unsigned long max_freq; | ||
| 152 | }; | 167 | }; |
| 153 | 168 | ||
| 154 | #if defined(CONFIG_PM_DEVFREQ) | 169 | #if defined(CONFIG_PM_DEVFREQ) |
| @@ -160,7 +175,7 @@ extern int devfreq_remove_device(struct devfreq *devfreq); | |||
| 160 | 175 | ||
| 161 | /* Helper functions for devfreq user device driver with OPP. */ | 176 | /* Helper functions for devfreq user device driver with OPP. */ |
| 162 | extern struct opp *devfreq_recommended_opp(struct device *dev, | 177 | extern struct opp *devfreq_recommended_opp(struct device *dev, |
| 163 | unsigned long *freq); | 178 | unsigned long *freq, u32 flags); |
| 164 | extern int devfreq_register_opp_notifier(struct device *dev, | 179 | extern int devfreq_register_opp_notifier(struct device *dev, |
| 165 | struct devfreq *devfreq); | 180 | struct devfreq *devfreq); |
| 166 | extern int devfreq_unregister_opp_notifier(struct device *dev, | 181 | extern int devfreq_unregister_opp_notifier(struct device *dev, |
| @@ -200,18 +215,18 @@ struct devfreq_simple_ondemand_data { | |||
| 200 | static struct devfreq *devfreq_add_device(struct device *dev, | 215 | static struct devfreq *devfreq_add_device(struct device *dev, |
| 201 | struct devfreq_dev_profile *profile, | 216 | struct devfreq_dev_profile *profile, |
| 202 | struct devfreq_governor *governor, | 217 | struct devfreq_governor *governor, |
| 203 | void *data); | 218 | void *data) |
| 204 | { | 219 | { |
| 205 | return NULL; | 220 | return NULL; |
| 206 | } | 221 | } |
| 207 | 222 | ||
| 208 | static int devfreq_remove_device(struct devfreq *devfreq); | 223 | static int devfreq_remove_device(struct devfreq *devfreq) |
| 209 | { | 224 | { |
| 210 | return 0; | 225 | return 0; |
| 211 | } | 226 | } |
| 212 | 227 | ||
| 213 | static struct opp *devfreq_recommended_opp(struct device *dev, | 228 | static struct opp *devfreq_recommended_opp(struct device *dev, |
| 214 | unsigned long *freq) | 229 | unsigned long *freq, u32 flags) |
| 215 | { | 230 | { |
| 216 | return -EINVAL; | 231 | return -EINVAL; |
| 217 | } | 232 | } |
diff --git a/include/linux/device.h b/include/linux/device.h index b63fb393aa58..5ad17cccdd71 100644 --- a/include/linux/device.h +++ b/include/linux/device.h | |||
| @@ -238,8 +238,6 @@ struct device_driver { | |||
| 238 | extern int __must_check driver_register(struct device_driver *drv); | 238 | extern int __must_check driver_register(struct device_driver *drv); |
| 239 | extern void driver_unregister(struct device_driver *drv); | 239 | extern void driver_unregister(struct device_driver *drv); |
| 240 | 240 | ||
| 241 | extern struct device_driver *get_driver(struct device_driver *drv); | ||
| 242 | extern void put_driver(struct device_driver *drv); | ||
| 243 | extern struct device_driver *driver_find(const char *name, | 241 | extern struct device_driver *driver_find(const char *name, |
| 244 | struct bus_type *bus); | 242 | struct bus_type *bus); |
| 245 | extern int driver_probe_done(void); | 243 | extern int driver_probe_done(void); |
| @@ -264,10 +262,6 @@ extern int __must_check driver_create_file(struct device_driver *driver, | |||
| 264 | extern void driver_remove_file(struct device_driver *driver, | 262 | extern void driver_remove_file(struct device_driver *driver, |
| 265 | const struct driver_attribute *attr); | 263 | const struct driver_attribute *attr); |
| 266 | 264 | ||
| 267 | extern int __must_check driver_add_kobj(struct device_driver *drv, | ||
| 268 | struct kobject *kobj, | ||
| 269 | const char *fmt, ...); | ||
| 270 | |||
| 271 | extern int __must_check driver_for_each_device(struct device_driver *drv, | 265 | extern int __must_check driver_for_each_device(struct device_driver *drv, |
| 272 | struct device *start, | 266 | struct device *start, |
| 273 | void *data, | 267 | void *data, |
| @@ -946,14 +940,14 @@ int _dev_info(const struct device *dev, const char *fmt, ...) | |||
| 946 | 940 | ||
| 947 | #define dev_info(dev, fmt, arg...) _dev_info(dev, fmt, ##arg) | 941 | #define dev_info(dev, fmt, arg...) _dev_info(dev, fmt, ##arg) |
| 948 | 942 | ||
| 949 | #if defined(DEBUG) | 943 | #if defined(CONFIG_DYNAMIC_DEBUG) |
| 950 | #define dev_dbg(dev, format, arg...) \ | ||
| 951 | dev_printk(KERN_DEBUG, dev, format, ##arg) | ||
| 952 | #elif defined(CONFIG_DYNAMIC_DEBUG) | ||
| 953 | #define dev_dbg(dev, format, ...) \ | 944 | #define dev_dbg(dev, format, ...) \ |
| 954 | do { \ | 945 | do { \ |
| 955 | dynamic_dev_dbg(dev, format, ##__VA_ARGS__); \ | 946 | dynamic_dev_dbg(dev, format, ##__VA_ARGS__); \ |
| 956 | } while (0) | 947 | } while (0) |
| 948 | #elif defined(DEBUG) | ||
| 949 | #define dev_dbg(dev, format, arg...) \ | ||
| 950 | dev_printk(KERN_DEBUG, dev, format, ##arg) | ||
| 957 | #else | 951 | #else |
| 958 | #define dev_dbg(dev, format, arg...) \ | 952 | #define dev_dbg(dev, format, arg...) \ |
| 959 | ({ \ | 953 | ({ \ |
| @@ -1007,19 +1001,20 @@ extern long sysfs_deprecated; | |||
| 1007 | * @__driver: driver name | 1001 | * @__driver: driver name |
| 1008 | * @__register: register function for this driver type | 1002 | * @__register: register function for this driver type |
| 1009 | * @__unregister: unregister function for this driver type | 1003 | * @__unregister: unregister function for this driver type |
| 1004 | * @...: Additional arguments to be passed to __register and __unregister. | ||
| 1010 | * | 1005 | * |
| 1011 | * Use this macro to construct bus specific macros for registering | 1006 | * Use this macro to construct bus specific macros for registering |
| 1012 | * drivers, and do not use it on its own. | 1007 | * drivers, and do not use it on its own. |
| 1013 | */ | 1008 | */ |
| 1014 | #define module_driver(__driver, __register, __unregister) \ | 1009 | #define module_driver(__driver, __register, __unregister, ...) \ |
| 1015 | static int __init __driver##_init(void) \ | 1010 | static int __init __driver##_init(void) \ |
| 1016 | { \ | 1011 | { \ |
| 1017 | return __register(&(__driver)); \ | 1012 | return __register(&(__driver) , ##__VA_ARGS__); \ |
| 1018 | } \ | 1013 | } \ |
| 1019 | module_init(__driver##_init); \ | 1014 | module_init(__driver##_init); \ |
| 1020 | static void __exit __driver##_exit(void) \ | 1015 | static void __exit __driver##_exit(void) \ |
| 1021 | { \ | 1016 | { \ |
| 1022 | __unregister(&(__driver)); \ | 1017 | __unregister(&(__driver) , ##__VA_ARGS__); \ |
| 1023 | } \ | 1018 | } \ |
| 1024 | module_exit(__driver##_exit); | 1019 | module_exit(__driver##_exit); |
| 1025 | 1020 | ||
diff --git a/include/linux/dma-buf.h b/include/linux/dma-buf.h index f8ac076afa52..887dcd487062 100644 --- a/include/linux/dma-buf.h +++ b/include/linux/dma-buf.h | |||
| @@ -26,11 +26,11 @@ | |||
| 26 | 26 | ||
| 27 | #include <linux/file.h> | 27 | #include <linux/file.h> |
| 28 | #include <linux/err.h> | 28 | #include <linux/err.h> |
| 29 | #include <linux/device.h> | ||
| 30 | #include <linux/scatterlist.h> | 29 | #include <linux/scatterlist.h> |
| 31 | #include <linux/list.h> | 30 | #include <linux/list.h> |
| 32 | #include <linux/dma-mapping.h> | 31 | #include <linux/dma-mapping.h> |
| 33 | 32 | ||
| 33 | struct device; | ||
| 34 | struct dma_buf; | 34 | struct dma_buf; |
| 35 | struct dma_buf_attachment; | 35 | struct dma_buf_attachment; |
| 36 | 36 | ||
diff --git a/include/linux/dmaengine.h b/include/linux/dmaengine.h index 679b349d9b66..a5966f691ef8 100644 --- a/include/linux/dmaengine.h +++ b/include/linux/dmaengine.h | |||
| @@ -23,6 +23,7 @@ | |||
| 23 | 23 | ||
| 24 | #include <linux/device.h> | 24 | #include <linux/device.h> |
| 25 | #include <linux/uio.h> | 25 | #include <linux/uio.h> |
| 26 | #include <linux/bug.h> | ||
| 26 | #include <linux/scatterlist.h> | 27 | #include <linux/scatterlist.h> |
| 27 | #include <linux/bitmap.h> | 28 | #include <linux/bitmap.h> |
| 28 | #include <asm/page.h> | 29 | #include <asm/page.h> |
diff --git a/include/linux/dynamic_debug.h b/include/linux/dynamic_debug.h index 0564e3c39882..7e3c53a900d8 100644 --- a/include/linux/dynamic_debug.h +++ b/include/linux/dynamic_debug.h | |||
| @@ -15,20 +15,24 @@ struct _ddebug { | |||
| 15 | const char *function; | 15 | const char *function; |
| 16 | const char *filename; | 16 | const char *filename; |
| 17 | const char *format; | 17 | const char *format; |
| 18 | unsigned int lineno:24; | 18 | unsigned int lineno:18; |
| 19 | /* | 19 | /* |
| 20 | * The flags field controls the behaviour at the callsite. | 20 | * The flags field controls the behaviour at the callsite. |
| 21 | * The bits here are changed dynamically when the user | 21 | * The bits here are changed dynamically when the user |
| 22 | * writes commands to <debugfs>/dynamic_debug/control | 22 | * writes commands to <debugfs>/dynamic_debug/control |
| 23 | */ | 23 | */ |
| 24 | #define _DPRINTK_FLAGS_PRINT (1<<0) /* printk() a message using the format */ | 24 | #define _DPRINTK_FLAGS_NONE 0 |
| 25 | #define _DPRINTK_FLAGS_PRINT (1<<0) /* printk() a message using the format */ | ||
| 25 | #define _DPRINTK_FLAGS_INCL_MODNAME (1<<1) | 26 | #define _DPRINTK_FLAGS_INCL_MODNAME (1<<1) |
| 26 | #define _DPRINTK_FLAGS_INCL_FUNCNAME (1<<2) | 27 | #define _DPRINTK_FLAGS_INCL_FUNCNAME (1<<2) |
| 27 | #define _DPRINTK_FLAGS_INCL_LINENO (1<<3) | 28 | #define _DPRINTK_FLAGS_INCL_LINENO (1<<3) |
| 28 | #define _DPRINTK_FLAGS_INCL_TID (1<<4) | 29 | #define _DPRINTK_FLAGS_INCL_TID (1<<4) |
| 30 | #if defined DEBUG | ||
| 31 | #define _DPRINTK_FLAGS_DEFAULT _DPRINTK_FLAGS_PRINT | ||
| 32 | #else | ||
| 29 | #define _DPRINTK_FLAGS_DEFAULT 0 | 33 | #define _DPRINTK_FLAGS_DEFAULT 0 |
| 34 | #endif | ||
| 30 | unsigned int flags:8; | 35 | unsigned int flags:8; |
| 31 | char enabled; | ||
| 32 | } __attribute__((aligned(8))); | 36 | } __attribute__((aligned(8))); |
| 33 | 37 | ||
| 34 | 38 | ||
| @@ -62,21 +66,20 @@ int __dynamic_netdev_dbg(struct _ddebug *descriptor, | |||
| 62 | .format = (fmt), \ | 66 | .format = (fmt), \ |
| 63 | .lineno = __LINE__, \ | 67 | .lineno = __LINE__, \ |
| 64 | .flags = _DPRINTK_FLAGS_DEFAULT, \ | 68 | .flags = _DPRINTK_FLAGS_DEFAULT, \ |
| 65 | .enabled = false, \ | ||
| 66 | } | 69 | } |
| 67 | 70 | ||
| 68 | #define dynamic_pr_debug(fmt, ...) \ | 71 | #define dynamic_pr_debug(fmt, ...) \ |
| 69 | do { \ | 72 | do { \ |
| 70 | DEFINE_DYNAMIC_DEBUG_METADATA(descriptor, fmt); \ | 73 | DEFINE_DYNAMIC_DEBUG_METADATA(descriptor, fmt); \ |
| 71 | if (unlikely(descriptor.enabled)) \ | 74 | if (unlikely(descriptor.flags & _DPRINTK_FLAGS_PRINT)) \ |
| 72 | __dynamic_pr_debug(&descriptor, pr_fmt(fmt), \ | 75 | __dynamic_pr_debug(&descriptor, pr_fmt(fmt), \ |
| 73 | ##__VA_ARGS__); \ | 76 | ##__VA_ARGS__); \ |
| 74 | } while (0) | 77 | } while (0) |
| 75 | 78 | ||
| 76 | #define dynamic_dev_dbg(dev, fmt, ...) \ | 79 | #define dynamic_dev_dbg(dev, fmt, ...) \ |
| 77 | do { \ | 80 | do { \ |
| 78 | DEFINE_DYNAMIC_DEBUG_METADATA(descriptor, fmt); \ | 81 | DEFINE_DYNAMIC_DEBUG_METADATA(descriptor, fmt); \ |
| 79 | if (unlikely(descriptor.enabled)) \ | 82 | if (unlikely(descriptor.flags & _DPRINTK_FLAGS_PRINT)) \ |
| 80 | __dynamic_dev_dbg(&descriptor, dev, fmt, \ | 83 | __dynamic_dev_dbg(&descriptor, dev, fmt, \ |
| 81 | ##__VA_ARGS__); \ | 84 | ##__VA_ARGS__); \ |
| 82 | } while (0) | 85 | } while (0) |
| @@ -84,7 +87,7 @@ do { \ | |||
| 84 | #define dynamic_netdev_dbg(dev, fmt, ...) \ | 87 | #define dynamic_netdev_dbg(dev, fmt, ...) \ |
| 85 | do { \ | 88 | do { \ |
| 86 | DEFINE_DYNAMIC_DEBUG_METADATA(descriptor, fmt); \ | 89 | DEFINE_DYNAMIC_DEBUG_METADATA(descriptor, fmt); \ |
| 87 | if (unlikely(descriptor.enabled)) \ | 90 | if (unlikely(descriptor.flags & _DPRINTK_FLAGS_PRINT)) \ |
| 88 | __dynamic_netdev_dbg(&descriptor, dev, fmt, \ | 91 | __dynamic_netdev_dbg(&descriptor, dev, fmt, \ |
| 89 | ##__VA_ARGS__); \ | 92 | ##__VA_ARGS__); \ |
| 90 | } while (0) | 93 | } while (0) |
diff --git a/include/linux/edac.h b/include/linux/edac.h index 1cd3947987e5..ba317e2930a1 100644 --- a/include/linux/edac.h +++ b/include/linux/edac.h | |||
| @@ -13,7 +13,11 @@ | |||
| 13 | #define _LINUX_EDAC_H_ | 13 | #define _LINUX_EDAC_H_ |
| 14 | 14 | ||
| 15 | #include <linux/atomic.h> | 15 | #include <linux/atomic.h> |
| 16 | #include <linux/device.h> | 16 | #include <linux/kobject.h> |
| 17 | #include <linux/completion.h> | ||
| 18 | #include <linux/workqueue.h> | ||
| 19 | |||
| 20 | struct device; | ||
| 17 | 21 | ||
| 18 | #define EDAC_OPSTATE_INVAL -1 | 22 | #define EDAC_OPSTATE_INVAL -1 |
| 19 | #define EDAC_OPSTATE_POLL 0 | 23 | #define EDAC_OPSTATE_POLL 0 |
diff --git a/include/linux/efi.h b/include/linux/efi.h index 37c300712e02..47fbf6b3dc77 100644 --- a/include/linux/efi.h +++ b/include/linux/efi.h | |||
| @@ -315,6 +315,16 @@ typedef efi_status_t efi_query_capsule_caps_t(efi_capsule_header_t **capsules, | |||
| 315 | 315 | ||
| 316 | typedef struct { | 316 | typedef struct { |
| 317 | efi_guid_t guid; | 317 | efi_guid_t guid; |
| 318 | u64 table; | ||
| 319 | } efi_config_table_64_t; | ||
| 320 | |||
| 321 | typedef struct { | ||
| 322 | efi_guid_t guid; | ||
| 323 | u32 table; | ||
| 324 | } efi_config_table_32_t; | ||
| 325 | |||
| 326 | typedef struct { | ||
| 327 | efi_guid_t guid; | ||
| 318 | unsigned long table; | 328 | unsigned long table; |
| 319 | } efi_config_table_t; | 329 | } efi_config_table_t; |
| 320 | 330 | ||
| @@ -329,6 +339,40 @@ typedef struct { | |||
| 329 | 339 | ||
| 330 | typedef struct { | 340 | typedef struct { |
| 331 | efi_table_hdr_t hdr; | 341 | efi_table_hdr_t hdr; |
| 342 | u64 fw_vendor; /* physical addr of CHAR16 vendor string */ | ||
| 343 | u32 fw_revision; | ||
| 344 | u32 __pad1; | ||
| 345 | u64 con_in_handle; | ||
| 346 | u64 con_in; | ||
| 347 | u64 con_out_handle; | ||
| 348 | u64 con_out; | ||
| 349 | u64 stderr_handle; | ||
| 350 | u64 stderr; | ||
| 351 | u64 runtime; | ||
| 352 | u64 boottime; | ||
| 353 | u32 nr_tables; | ||
| 354 | u32 __pad2; | ||
| 355 | u64 tables; | ||
| 356 | } efi_system_table_64_t; | ||
| 357 | |||
| 358 | typedef struct { | ||
| 359 | efi_table_hdr_t hdr; | ||
| 360 | u32 fw_vendor; /* physical addr of CHAR16 vendor string */ | ||
| 361 | u32 fw_revision; | ||
| 362 | u32 con_in_handle; | ||
| 363 | u32 con_in; | ||
| 364 | u32 con_out_handle; | ||
| 365 | u32 con_out; | ||
| 366 | u32 stderr_handle; | ||
| 367 | u32 stderr; | ||
| 368 | u32 runtime; | ||
| 369 | u32 boottime; | ||
| 370 | u32 nr_tables; | ||
| 371 | u32 tables; | ||
| 372 | } efi_system_table_32_t; | ||
| 373 | |||
| 374 | typedef struct { | ||
| 375 | efi_table_hdr_t hdr; | ||
| 332 | unsigned long fw_vendor; /* physical addr of CHAR16 vendor string */ | 376 | unsigned long fw_vendor; /* physical addr of CHAR16 vendor string */ |
| 333 | u32 fw_revision; | 377 | u32 fw_revision; |
| 334 | unsigned long con_in_handle; | 378 | unsigned long con_in_handle; |
| @@ -497,6 +541,7 @@ extern int __init efi_setup_pcdp_console(char *); | |||
| 497 | #ifdef CONFIG_EFI | 541 | #ifdef CONFIG_EFI |
| 498 | # ifdef CONFIG_X86 | 542 | # ifdef CONFIG_X86 |
| 499 | extern int efi_enabled; | 543 | extern int efi_enabled; |
| 544 | extern bool efi_64bit; | ||
| 500 | # else | 545 | # else |
| 501 | # define efi_enabled 1 | 546 | # define efi_enabled 1 |
| 502 | # endif | 547 | # endif |
diff --git a/include/linux/elfcore.h b/include/linux/elfcore.h index 394a3e0e4a6b..0698c79fbcb2 100644 --- a/include/linux/elfcore.h +++ b/include/linux/elfcore.h | |||
| @@ -6,6 +6,7 @@ | |||
| 6 | #include <linux/time.h> | 6 | #include <linux/time.h> |
| 7 | #ifdef __KERNEL__ | 7 | #ifdef __KERNEL__ |
| 8 | #include <linux/user.h> | 8 | #include <linux/user.h> |
| 9 | #include <linux/bug.h> | ||
| 9 | #endif | 10 | #endif |
| 10 | #include <linux/ptrace.h> | 11 | #include <linux/ptrace.h> |
| 11 | #include <linux/elf.h> | 12 | #include <linux/elf.h> |
diff --git a/include/linux/errno.h b/include/linux/errno.h index 46685832ed99..2d09bfa5c262 100644 --- a/include/linux/errno.h +++ b/include/linux/errno.h | |||
| @@ -16,6 +16,7 @@ | |||
| 16 | #define ERESTARTNOHAND 514 /* restart if no handler.. */ | 16 | #define ERESTARTNOHAND 514 /* restart if no handler.. */ |
| 17 | #define ENOIOCTLCMD 515 /* No ioctl command */ | 17 | #define ENOIOCTLCMD 515 /* No ioctl command */ |
| 18 | #define ERESTART_RESTARTBLOCK 516 /* restart by calling sys_restart_syscall */ | 18 | #define ERESTART_RESTARTBLOCK 516 /* restart by calling sys_restart_syscall */ |
| 19 | #define EPROBE_DEFER 517 /* Driver requests probe retry */ | ||
| 19 | 20 | ||
| 20 | /* Defined for the NFSv3 protocol */ | 21 | /* Defined for the NFSv3 protocol */ |
| 21 | #define EBADHANDLE 521 /* Illegal NFS file handle */ | 22 | #define EBADHANDLE 521 /* Illegal NFS file handle */ |
diff --git a/include/linux/etherdevice.h b/include/linux/etherdevice.h index 05955cf09937..8a1835855faa 100644 --- a/include/linux/etherdevice.h +++ b/include/linux/etherdevice.h | |||
| @@ -140,17 +140,18 @@ static inline void random_ether_addr(u8 *addr) | |||
| 140 | } | 140 | } |
| 141 | 141 | ||
| 142 | /** | 142 | /** |
| 143 | * dev_hw_addr_random - Create random MAC and set device flag | 143 | * eth_hw_addr_random - Generate software assigned random Ethernet and |
| 144 | * set device flag | ||
| 144 | * @dev: pointer to net_device structure | 145 | * @dev: pointer to net_device structure |
| 145 | * @hwaddr: Pointer to a six-byte array containing the Ethernet address | ||
| 146 | * | 146 | * |
| 147 | * Generate random MAC to be used by a device and set addr_assign_type | 147 | * Generate a random Ethernet address (MAC) to be used by a net device |
| 148 | * so the state can be read by sysfs and be used by udev. | 148 | * and set addr_assign_type so the state can be read by sysfs and be |
| 149 | * used by userspace. | ||
| 149 | */ | 150 | */ |
| 150 | static inline void dev_hw_addr_random(struct net_device *dev, u8 *hwaddr) | 151 | static inline void eth_hw_addr_random(struct net_device *dev) |
| 151 | { | 152 | { |
| 152 | dev->addr_assign_type |= NET_ADDR_RANDOM; | 153 | dev->addr_assign_type |= NET_ADDR_RANDOM; |
| 153 | random_ether_addr(hwaddr); | 154 | random_ether_addr(dev->dev_addr); |
| 154 | } | 155 | } |
| 155 | 156 | ||
| 156 | /** | 157 | /** |
diff --git a/include/linux/ethtool.h b/include/linux/ethtool.h index da5b2de99ae4..e1d9e0ede309 100644 --- a/include/linux/ethtool.h +++ b/include/linux/ethtool.h | |||
| @@ -30,10 +30,15 @@ struct ethtool_cmd { | |||
| 30 | * access it */ | 30 | * access it */ |
| 31 | __u8 duplex; /* Duplex, half or full */ | 31 | __u8 duplex; /* Duplex, half or full */ |
| 32 | __u8 port; /* Which connector port */ | 32 | __u8 port; /* Which connector port */ |
| 33 | __u8 phy_address; | 33 | __u8 phy_address; /* MDIO PHY address (PRTAD for clause 45). |
| 34 | * May be read-only or read-write | ||
| 35 | * depending on the driver. | ||
| 36 | */ | ||
| 34 | __u8 transceiver; /* Which transceiver to use */ | 37 | __u8 transceiver; /* Which transceiver to use */ |
| 35 | __u8 autoneg; /* Enable or disable autonegotiation */ | 38 | __u8 autoneg; /* Enable or disable autonegotiation */ |
| 36 | __u8 mdio_support; | 39 | __u8 mdio_support; /* MDIO protocols supported. Read-only. |
| 40 | * Not set by all drivers. | ||
| 41 | */ | ||
| 37 | __u32 maxtxpkt; /* Tx pkts before generating tx int */ | 42 | __u32 maxtxpkt; /* Tx pkts before generating tx int */ |
| 38 | __u32 maxrxpkt; /* Rx pkts before generating rx int */ | 43 | __u32 maxrxpkt; /* Rx pkts before generating rx int */ |
| 39 | __u16 speed_hi; /* The forced speed (upper | 44 | __u16 speed_hi; /* The forced speed (upper |
| @@ -59,6 +64,20 @@ static inline __u32 ethtool_cmd_speed(const struct ethtool_cmd *ep) | |||
| 59 | return (ep->speed_hi << 16) | ep->speed; | 64 | return (ep->speed_hi << 16) | ep->speed; |
| 60 | } | 65 | } |
| 61 | 66 | ||
| 67 | /* Device supports clause 22 register access to PHY or peripherals | ||
| 68 | * using the interface defined in <linux/mii.h>. This should not be | ||
| 69 | * set if there are known to be no such peripherals present or if | ||
| 70 | * the driver only emulates clause 22 registers for compatibility. | ||
| 71 | */ | ||
| 72 | #define ETH_MDIO_SUPPORTS_C22 1 | ||
| 73 | |||
| 74 | /* Device supports clause 45 register access to PHY or peripherals | ||
| 75 | * using the interface defined in <linux/mii.h> and <linux/mdio.h>. | ||
| 76 | * This should not be set if there are known to be no such peripherals | ||
| 77 | * present. | ||
| 78 | */ | ||
| 79 | #define ETH_MDIO_SUPPORTS_C45 2 | ||
| 80 | |||
| 62 | #define ETHTOOL_FWVERS_LEN 32 | 81 | #define ETHTOOL_FWVERS_LEN 32 |
| 63 | #define ETHTOOL_BUSINFO_LEN 32 | 82 | #define ETHTOOL_BUSINFO_LEN 32 |
| 64 | /* these strings are set to whatever the driver author decides... */ | 83 | /* these strings are set to whatever the driver author decides... */ |
diff --git a/include/linux/ext3_fs.h b/include/linux/ext3_fs.h index f957085d40ed..f5a84eef6ed2 100644 --- a/include/linux/ext3_fs.h +++ b/include/linux/ext3_fs.h | |||
| @@ -18,6 +18,7 @@ | |||
| 18 | 18 | ||
| 19 | #include <linux/types.h> | 19 | #include <linux/types.h> |
| 20 | #include <linux/magic.h> | 20 | #include <linux/magic.h> |
| 21 | #include <linux/bug.h> | ||
| 21 | 22 | ||
| 22 | /* | 23 | /* |
| 23 | * The second extended filesystem constants/structures | 24 | * The second extended filesystem constants/structures |
diff --git a/include/linux/fb.h b/include/linux/fb.h index c18122f40543..d31cb682e173 100644 --- a/include/linux/fb.h +++ b/include/linux/fb.h | |||
| @@ -407,7 +407,6 @@ struct fb_cursor { | |||
| 407 | 407 | ||
| 408 | #include <linux/fs.h> | 408 | #include <linux/fs.h> |
| 409 | #include <linux/init.h> | 409 | #include <linux/init.h> |
| 410 | #include <linux/device.h> | ||
| 411 | #include <linux/workqueue.h> | 410 | #include <linux/workqueue.h> |
| 412 | #include <linux/notifier.h> | 411 | #include <linux/notifier.h> |
| 413 | #include <linux/list.h> | 412 | #include <linux/list.h> |
| @@ -1003,6 +1002,7 @@ extern ssize_t fb_sys_write(struct fb_info *info, const char __user *buf, | |||
| 1003 | /* drivers/video/fbmem.c */ | 1002 | /* drivers/video/fbmem.c */ |
| 1004 | extern int register_framebuffer(struct fb_info *fb_info); | 1003 | extern int register_framebuffer(struct fb_info *fb_info); |
| 1005 | extern int unregister_framebuffer(struct fb_info *fb_info); | 1004 | extern int unregister_framebuffer(struct fb_info *fb_info); |
| 1005 | extern int unlink_framebuffer(struct fb_info *fb_info); | ||
| 1006 | extern void remove_conflicting_framebuffers(struct apertures_struct *a, | 1006 | extern void remove_conflicting_framebuffers(struct apertures_struct *a, |
| 1007 | const char *name, bool primary); | 1007 | const char *name, bool primary); |
| 1008 | extern int fb_prepare_logo(struct fb_info *fb_info, int rotate); | 1008 | extern int fb_prepare_logo(struct fb_info *fb_info, int rotate); |
diff --git a/include/linux/file.h b/include/linux/file.h index 21a79958541c..58bf158c53d9 100644 --- a/include/linux/file.h +++ b/include/linux/file.h | |||
| @@ -12,7 +12,6 @@ | |||
| 12 | struct file; | 12 | struct file; |
| 13 | 13 | ||
| 14 | extern void fput(struct file *); | 14 | extern void fput(struct file *); |
| 15 | extern void drop_file_write_access(struct file *file); | ||
| 16 | 15 | ||
| 17 | struct file_operations; | 16 | struct file_operations; |
| 18 | struct vfsmount; | 17 | struct vfsmount; |
diff --git a/include/linux/firewire-cdev.h b/include/linux/firewire-cdev.h index 357dbfc2829e..d50036953497 100644 --- a/include/linux/firewire-cdev.h +++ b/include/linux/firewire-cdev.h | |||
| @@ -207,12 +207,16 @@ struct fw_cdev_event_request2 { | |||
| 207 | * @closure: See &fw_cdev_event_common; | 207 | * @closure: See &fw_cdev_event_common; |
| 208 | * set by %FW_CDEV_CREATE_ISO_CONTEXT ioctl | 208 | * set by %FW_CDEV_CREATE_ISO_CONTEXT ioctl |
| 209 | * @type: See &fw_cdev_event_common; always %FW_CDEV_EVENT_ISO_INTERRUPT | 209 | * @type: See &fw_cdev_event_common; always %FW_CDEV_EVENT_ISO_INTERRUPT |
| 210 | * @cycle: Cycle counter of the interrupt packet | 210 | * @cycle: Cycle counter of the last completed packet |
| 211 | * @header_length: Total length of following headers, in bytes | 211 | * @header_length: Total length of following headers, in bytes |
| 212 | * @header: Stripped headers, if any | 212 | * @header: Stripped headers, if any |
| 213 | * | 213 | * |
| 214 | * This event is sent when the controller has completed an &fw_cdev_iso_packet | 214 | * This event is sent when the controller has completed an &fw_cdev_iso_packet |
| 215 | * with the %FW_CDEV_ISO_INTERRUPT bit set. | 215 | * with the %FW_CDEV_ISO_INTERRUPT bit set, when explicitly requested with |
| 216 | * %FW_CDEV_IOC_FLUSH_ISO, or when there have been so many completed packets | ||
| 217 | * without the interrupt bit set that the kernel's internal buffer for @header | ||
| 218 | * is about to overflow. (In the last case, kernels with ABI version < 5 drop | ||
| 219 | * header data up to the next interrupt packet.) | ||
| 216 | * | 220 | * |
| 217 | * Isochronous transmit events (context type %FW_CDEV_ISO_CONTEXT_TRANSMIT): | 221 | * Isochronous transmit events (context type %FW_CDEV_ISO_CONTEXT_TRANSMIT): |
| 218 | * | 222 | * |
| @@ -267,9 +271,9 @@ struct fw_cdev_event_iso_interrupt { | |||
| 267 | * | 271 | * |
| 268 | * This event is sent in multichannel contexts (context type | 272 | * This event is sent in multichannel contexts (context type |
| 269 | * %FW_CDEV_ISO_CONTEXT_RECEIVE_MULTICHANNEL) for &fw_cdev_iso_packet buffer | 273 | * %FW_CDEV_ISO_CONTEXT_RECEIVE_MULTICHANNEL) for &fw_cdev_iso_packet buffer |
| 270 | * chunks that have the %FW_CDEV_ISO_INTERRUPT bit set. Whether this happens | 274 | * chunks that have been completely filled and that have the |
| 271 | * when a packet is completed and/or when a buffer chunk is completed depends | 275 | * %FW_CDEV_ISO_INTERRUPT bit set, or when explicitly requested with |
| 272 | * on the hardware implementation. | 276 | * %FW_CDEV_IOC_FLUSH_ISO. |
| 273 | * | 277 | * |
| 274 | * The buffer is continuously filled with the following data, per packet: | 278 | * The buffer is continuously filled with the following data, per packet: |
| 275 | * - the 1394 iso packet header as described at &fw_cdev_event_iso_interrupt, | 279 | * - the 1394 iso packet header as described at &fw_cdev_event_iso_interrupt, |
| @@ -419,6 +423,9 @@ union fw_cdev_event { | |||
| 419 | #define FW_CDEV_IOC_RECEIVE_PHY_PACKETS _IOW('#', 0x16, struct fw_cdev_receive_phy_packets) | 423 | #define FW_CDEV_IOC_RECEIVE_PHY_PACKETS _IOW('#', 0x16, struct fw_cdev_receive_phy_packets) |
| 420 | #define FW_CDEV_IOC_SET_ISO_CHANNELS _IOW('#', 0x17, struct fw_cdev_set_iso_channels) | 424 | #define FW_CDEV_IOC_SET_ISO_CHANNELS _IOW('#', 0x17, struct fw_cdev_set_iso_channels) |
| 421 | 425 | ||
| 426 | /* available since kernel version 3.4 */ | ||
| 427 | #define FW_CDEV_IOC_FLUSH_ISO _IOW('#', 0x18, struct fw_cdev_flush_iso) | ||
| 428 | |||
| 422 | /* | 429 | /* |
| 423 | * ABI version history | 430 | * ABI version history |
| 424 | * 1 (2.6.22) - initial version | 431 | * 1 (2.6.22) - initial version |
| @@ -441,6 +448,9 @@ union fw_cdev_event { | |||
| 441 | * - added %FW_CDEV_EVENT_ISO_INTERRUPT_MULTICHANNEL, | 448 | * - added %FW_CDEV_EVENT_ISO_INTERRUPT_MULTICHANNEL, |
| 442 | * %FW_CDEV_ISO_CONTEXT_RECEIVE_MULTICHANNEL, and | 449 | * %FW_CDEV_ISO_CONTEXT_RECEIVE_MULTICHANNEL, and |
| 443 | * %FW_CDEV_IOC_SET_ISO_CHANNELS | 450 | * %FW_CDEV_IOC_SET_ISO_CHANNELS |
| 451 | * 5 (3.4) - send %FW_CDEV_EVENT_ISO_INTERRUPT events when needed to | ||
| 452 | * avoid dropping data | ||
| 453 | * - added %FW_CDEV_IOC_FLUSH_ISO | ||
| 444 | */ | 454 | */ |
| 445 | 455 | ||
| 446 | /** | 456 | /** |
| @@ -851,6 +861,25 @@ struct fw_cdev_stop_iso { | |||
| 851 | }; | 861 | }; |
| 852 | 862 | ||
| 853 | /** | 863 | /** |
| 864 | * struct fw_cdev_flush_iso - flush completed iso packets | ||
| 865 | * @handle: handle of isochronous context to flush | ||
| 866 | * | ||
| 867 | * For %FW_CDEV_ISO_CONTEXT_TRANSMIT or %FW_CDEV_ISO_CONTEXT_RECEIVE contexts, | ||
| 868 | * report any completed packets. | ||
| 869 | * | ||
| 870 | * For %FW_CDEV_ISO_CONTEXT_RECEIVE_MULTICHANNEL contexts, report the current | ||
| 871 | * offset in the receive buffer, if it has changed; this is typically in the | ||
| 872 | * middle of some buffer chunk. | ||
| 873 | * | ||
| 874 | * Any %FW_CDEV_EVENT_ISO_INTERRUPT or %FW_CDEV_EVENT_ISO_INTERRUPT_MULTICHANNEL | ||
| 875 | * events generated by this ioctl are sent synchronously, i.e., are available | ||
| 876 | * for reading from the file descriptor when this ioctl returns. | ||
| 877 | */ | ||
| 878 | struct fw_cdev_flush_iso { | ||
| 879 | __u32 handle; | ||
| 880 | }; | ||
| 881 | |||
| 882 | /** | ||
| 854 | * struct fw_cdev_get_cycle_timer - read cycle timer register | 883 | * struct fw_cdev_get_cycle_timer - read cycle timer register |
| 855 | * @local_time: system time, in microseconds since the Epoch | 884 | * @local_time: system time, in microseconds since the Epoch |
| 856 | * @cycle_timer: Cycle Time register contents | 885 | * @cycle_timer: Cycle Time register contents |
diff --git a/include/linux/firewire.h b/include/linux/firewire.h index 84ccf8e04fa6..4db7b68f0582 100644 --- a/include/linux/firewire.h +++ b/include/linux/firewire.h | |||
| @@ -2,7 +2,6 @@ | |||
| 2 | #define _LINUX_FIREWIRE_H | 2 | #define _LINUX_FIREWIRE_H |
| 3 | 3 | ||
| 4 | #include <linux/completion.h> | 4 | #include <linux/completion.h> |
| 5 | #include <linux/device.h> | ||
| 6 | #include <linux/dma-mapping.h> | 5 | #include <linux/dma-mapping.h> |
| 7 | #include <linux/kernel.h> | 6 | #include <linux/kernel.h> |
| 8 | #include <linux/kref.h> | 7 | #include <linux/kref.h> |
| @@ -17,9 +16,6 @@ | |||
| 17 | #include <linux/atomic.h> | 16 | #include <linux/atomic.h> |
| 18 | #include <asm/byteorder.h> | 17 | #include <asm/byteorder.h> |
| 19 | 18 | ||
| 20 | #define fw_notify(s, args...) printk(KERN_NOTICE KBUILD_MODNAME ": " s, ## args) | ||
| 21 | #define fw_error(s, args...) printk(KERN_ERR KBUILD_MODNAME ": " s, ## args) | ||
| 22 | |||
| 23 | #define CSR_REGISTER_BASE 0xfffff0000000ULL | 19 | #define CSR_REGISTER_BASE 0xfffff0000000ULL |
| 24 | 20 | ||
| 25 | /* register offsets are relative to CSR_REGISTER_BASE */ | 21 | /* register offsets are relative to CSR_REGISTER_BASE */ |
| @@ -68,6 +64,8 @@ | |||
| 68 | #define CSR_MODEL 0x17 | 64 | #define CSR_MODEL 0x17 |
| 69 | #define CSR_DIRECTORY_ID 0x20 | 65 | #define CSR_DIRECTORY_ID 0x20 |
| 70 | 66 | ||
| 67 | struct device; | ||
| 68 | |||
| 71 | struct fw_csr_iterator { | 69 | struct fw_csr_iterator { |
| 72 | const u32 *p; | 70 | const u32 *p; |
| 73 | const u32 *end; | 71 | const u32 *end; |
| @@ -203,18 +201,6 @@ static inline int fw_device_is_shutdown(struct fw_device *device) | |||
| 203 | return atomic_read(&device->state) == FW_DEVICE_SHUTDOWN; | 201 | return atomic_read(&device->state) == FW_DEVICE_SHUTDOWN; |
| 204 | } | 202 | } |
| 205 | 203 | ||
| 206 | static inline struct fw_device *fw_device_get(struct fw_device *device) | ||
| 207 | { | ||
| 208 | get_device(&device->device); | ||
| 209 | |||
| 210 | return device; | ||
| 211 | } | ||
| 212 | |||
| 213 | static inline void fw_device_put(struct fw_device *device) | ||
| 214 | { | ||
| 215 | put_device(&device->device); | ||
| 216 | } | ||
| 217 | |||
| 218 | int fw_device_enable_phys_dma(struct fw_device *device); | 204 | int fw_device_enable_phys_dma(struct fw_device *device); |
| 219 | 205 | ||
| 220 | /* | 206 | /* |
| @@ -441,6 +427,7 @@ int fw_iso_context_queue(struct fw_iso_context *ctx, | |||
| 441 | struct fw_iso_buffer *buffer, | 427 | struct fw_iso_buffer *buffer, |
| 442 | unsigned long payload); | 428 | unsigned long payload); |
| 443 | void fw_iso_context_queue_flush(struct fw_iso_context *ctx); | 429 | void fw_iso_context_queue_flush(struct fw_iso_context *ctx); |
| 430 | int fw_iso_context_flush_completions(struct fw_iso_context *ctx); | ||
| 444 | int fw_iso_context_start(struct fw_iso_context *ctx, | 431 | int fw_iso_context_start(struct fw_iso_context *ctx, |
| 445 | int cycle, int sync, int tags); | 432 | int cycle, int sync, int tags); |
| 446 | int fw_iso_context_stop(struct fw_iso_context *ctx); | 433 | int fw_iso_context_stop(struct fw_iso_context *ctx); |
diff --git a/include/linux/fs.h b/include/linux/fs.h index 69cd5bb640f5..fa63f1b46103 100644 --- a/include/linux/fs.h +++ b/include/linux/fs.h | |||
| @@ -389,6 +389,7 @@ struct inodes_stat_t { | |||
| 389 | #include <linux/prio_tree.h> | 389 | #include <linux/prio_tree.h> |
| 390 | #include <linux/init.h> | 390 | #include <linux/init.h> |
| 391 | #include <linux/pid.h> | 391 | #include <linux/pid.h> |
| 392 | #include <linux/bug.h> | ||
| 392 | #include <linux/mutex.h> | 393 | #include <linux/mutex.h> |
| 393 | #include <linux/capability.h> | 394 | #include <linux/capability.h> |
| 394 | #include <linux/semaphore.h> | 395 | #include <linux/semaphore.h> |
| @@ -1459,6 +1460,7 @@ struct super_block { | |||
| 1459 | u8 s_uuid[16]; /* UUID */ | 1460 | u8 s_uuid[16]; /* UUID */ |
| 1460 | 1461 | ||
| 1461 | void *s_fs_info; /* Filesystem private info */ | 1462 | void *s_fs_info; /* Filesystem private info */ |
| 1463 | unsigned int s_max_links; | ||
| 1462 | fmode_t s_mode; | 1464 | fmode_t s_mode; |
| 1463 | 1465 | ||
| 1464 | /* Granularity of c/m/atime in ns. | 1466 | /* Granularity of c/m/atime in ns. |
| @@ -1811,11 +1813,11 @@ static inline void inode_inc_iversion(struct inode *inode) | |||
| 1811 | spin_unlock(&inode->i_lock); | 1813 | spin_unlock(&inode->i_lock); |
| 1812 | } | 1814 | } |
| 1813 | 1815 | ||
| 1814 | extern void touch_atime(struct vfsmount *mnt, struct dentry *dentry); | 1816 | extern void touch_atime(struct path *); |
| 1815 | static inline void file_accessed(struct file *file) | 1817 | static inline void file_accessed(struct file *file) |
| 1816 | { | 1818 | { |
| 1817 | if (!(file->f_flags & O_NOATIME)) | 1819 | if (!(file->f_flags & O_NOATIME)) |
| 1818 | touch_atime(file->f_path.mnt, file->f_path.dentry); | 1820 | touch_atime(&file->f_path); |
| 1819 | } | 1821 | } |
| 1820 | 1822 | ||
| 1821 | int sync_inode(struct inode *inode, struct writeback_control *wbc); | 1823 | int sync_inode(struct inode *inode, struct writeback_control *wbc); |
| @@ -2304,7 +2306,10 @@ extern struct inode * igrab(struct inode *); | |||
| 2304 | extern ino_t iunique(struct super_block *, ino_t); | 2306 | extern ino_t iunique(struct super_block *, ino_t); |
| 2305 | extern int inode_needs_sync(struct inode *inode); | 2307 | extern int inode_needs_sync(struct inode *inode); |
| 2306 | extern int generic_delete_inode(struct inode *inode); | 2308 | extern int generic_delete_inode(struct inode *inode); |
| 2307 | extern int generic_drop_inode(struct inode *inode); | 2309 | static inline int generic_drop_inode(struct inode *inode) |
| 2310 | { | ||
| 2311 | return !inode->i_nlink || inode_unhashed(inode); | ||
| 2312 | } | ||
| 2308 | 2313 | ||
| 2309 | extern struct inode *ilookup5_nowait(struct super_block *sb, | 2314 | extern struct inode *ilookup5_nowait(struct super_block *sb, |
| 2310 | unsigned long hashval, int (*test)(struct inode *, void *), | 2315 | unsigned long hashval, int (*test)(struct inode *, void *), |
diff --git a/include/linux/fsnotify.h b/include/linux/fsnotify.h index 2a53f10712b3..a6dfe6944564 100644 --- a/include/linux/fsnotify.h +++ b/include/linux/fsnotify.h | |||
| @@ -14,6 +14,7 @@ | |||
| 14 | #include <linux/fsnotify_backend.h> | 14 | #include <linux/fsnotify_backend.h> |
| 15 | #include <linux/audit.h> | 15 | #include <linux/audit.h> |
| 16 | #include <linux/slab.h> | 16 | #include <linux/slab.h> |
| 17 | #include <linux/bug.h> | ||
| 17 | 18 | ||
| 18 | /* | 19 | /* |
| 19 | * fsnotify_d_instantiate - instantiate a dentry for inode | 20 | * fsnotify_d_instantiate - instantiate a dentry for inode |
diff --git a/include/linux/ftrace_event.h b/include/linux/ftrace_event.h index dd478fc8f9f5..5f3f3be5af09 100644 --- a/include/linux/ftrace_event.h +++ b/include/linux/ftrace_event.h | |||
| @@ -144,12 +144,14 @@ struct event_filter; | |||
| 144 | enum trace_reg { | 144 | enum trace_reg { |
| 145 | TRACE_REG_REGISTER, | 145 | TRACE_REG_REGISTER, |
| 146 | TRACE_REG_UNREGISTER, | 146 | TRACE_REG_UNREGISTER, |
| 147 | #ifdef CONFIG_PERF_EVENTS | ||
| 147 | TRACE_REG_PERF_REGISTER, | 148 | TRACE_REG_PERF_REGISTER, |
| 148 | TRACE_REG_PERF_UNREGISTER, | 149 | TRACE_REG_PERF_UNREGISTER, |
| 149 | TRACE_REG_PERF_OPEN, | 150 | TRACE_REG_PERF_OPEN, |
| 150 | TRACE_REG_PERF_CLOSE, | 151 | TRACE_REG_PERF_CLOSE, |
| 151 | TRACE_REG_PERF_ADD, | 152 | TRACE_REG_PERF_ADD, |
| 152 | TRACE_REG_PERF_DEL, | 153 | TRACE_REG_PERF_DEL, |
| 154 | #endif | ||
| 153 | }; | 155 | }; |
| 154 | 156 | ||
| 155 | struct ftrace_event_call; | 157 | struct ftrace_event_call; |
diff --git a/include/linux/genhd.h b/include/linux/genhd.h index fe23ee768589..e61d3192448e 100644 --- a/include/linux/genhd.h +++ b/include/linux/genhd.h | |||
| @@ -596,6 +596,7 @@ extern char *disk_name (struct gendisk *hd, int partno, char *buf); | |||
| 596 | 596 | ||
| 597 | extern int disk_expand_part_tbl(struct gendisk *disk, int target); | 597 | extern int disk_expand_part_tbl(struct gendisk *disk, int target); |
| 598 | extern int rescan_partitions(struct gendisk *disk, struct block_device *bdev); | 598 | extern int rescan_partitions(struct gendisk *disk, struct block_device *bdev); |
| 599 | extern int invalidate_partitions(struct gendisk *disk, struct block_device *bdev); | ||
| 599 | extern struct hd_struct * __must_check add_partition(struct gendisk *disk, | 600 | extern struct hd_struct * __must_check add_partition(struct gendisk *disk, |
| 600 | int partno, sector_t start, | 601 | int partno, sector_t start, |
| 601 | sector_t len, int flags, | 602 | sector_t len, int flags, |
diff --git a/include/linux/gfs2_ondisk.h b/include/linux/gfs2_ondisk.h index b148087f49a6..fa98bdb073b9 100644 --- a/include/linux/gfs2_ondisk.h +++ b/include/linux/gfs2_ondisk.h | |||
| @@ -168,6 +168,7 @@ struct gfs2_rindex { | |||
| 168 | #define GFS2_RGF_METAONLY 0x00000002 | 168 | #define GFS2_RGF_METAONLY 0x00000002 |
| 169 | #define GFS2_RGF_DATAONLY 0x00000004 | 169 | #define GFS2_RGF_DATAONLY 0x00000004 |
| 170 | #define GFS2_RGF_NOALLOC 0x00000008 | 170 | #define GFS2_RGF_NOALLOC 0x00000008 |
| 171 | #define GFS2_RGF_TRIMMED 0x00000010 | ||
| 171 | 172 | ||
| 172 | struct gfs2_rgrp { | 173 | struct gfs2_rgrp { |
| 173 | struct gfs2_meta_header rg_header; | 174 | struct gfs2_meta_header rg_header; |
diff --git a/include/linux/gpio.h b/include/linux/gpio.h index 38ac48b7d3a8..ed5a46707ad0 100644 --- a/include/linux/gpio.h +++ b/include/linux/gpio.h | |||
| @@ -34,6 +34,7 @@ struct gpio { | |||
| 34 | #include <linux/kernel.h> | 34 | #include <linux/kernel.h> |
| 35 | #include <linux/types.h> | 35 | #include <linux/types.h> |
| 36 | #include <linux/errno.h> | 36 | #include <linux/errno.h> |
| 37 | #include <linux/bug.h> | ||
| 37 | 38 | ||
| 38 | struct device; | 39 | struct device; |
| 39 | struct gpio_chip; | 40 | struct gpio_chip; |
diff --git a/include/linux/highmem.h b/include/linux/highmem.h index 3a93f73a8acc..d3999b4e26cc 100644 --- a/include/linux/highmem.h +++ b/include/linux/highmem.h | |||
| @@ -3,6 +3,7 @@ | |||
| 3 | 3 | ||
| 4 | #include <linux/fs.h> | 4 | #include <linux/fs.h> |
| 5 | #include <linux/kernel.h> | 5 | #include <linux/kernel.h> |
| 6 | #include <linux/bug.h> | ||
| 6 | #include <linux/mm.h> | 7 | #include <linux/mm.h> |
| 7 | #include <linux/uaccess.h> | 8 | #include <linux/uaccess.h> |
| 8 | #include <linux/hardirq.h> | 9 | #include <linux/hardirq.h> |
| @@ -55,12 +56,12 @@ static inline void kunmap(struct page *page) | |||
| 55 | { | 56 | { |
| 56 | } | 57 | } |
| 57 | 58 | ||
| 58 | static inline void *__kmap_atomic(struct page *page) | 59 | static inline void *kmap_atomic(struct page *page) |
| 59 | { | 60 | { |
| 60 | pagefault_disable(); | 61 | pagefault_disable(); |
| 61 | return page_address(page); | 62 | return page_address(page); |
| 62 | } | 63 | } |
| 63 | #define kmap_atomic_prot(page, prot) __kmap_atomic(page) | 64 | #define kmap_atomic_prot(page, prot) kmap_atomic(page) |
| 64 | 65 | ||
| 65 | static inline void __kunmap_atomic(void *addr) | 66 | static inline void __kunmap_atomic(void *addr) |
| 66 | { | 67 | { |
| @@ -109,27 +110,62 @@ static inline void kmap_atomic_idx_pop(void) | |||
| 109 | #endif | 110 | #endif |
| 110 | 111 | ||
| 111 | /* | 112 | /* |
| 112 | * Make both: kmap_atomic(page, idx) and kmap_atomic(page) work. | 113 | * NOTE: |
| 114 | * kmap_atomic() and kunmap_atomic() with two arguments are deprecated. | ||
| 115 | * We only keep them for backward compatibility, any usage of them | ||
| 116 | * are now warned. | ||
| 113 | */ | 117 | */ |
| 114 | #define kmap_atomic(page, args...) __kmap_atomic(page) | 118 | |
| 119 | #define PASTE(a, b) a ## b | ||
| 120 | #define PASTE2(a, b) PASTE(a, b) | ||
| 121 | |||
| 122 | #define NARG_(_2, _1, n, ...) n | ||
| 123 | #define NARG(...) NARG_(__VA_ARGS__, 2, 1, :) | ||
| 124 | |||
| 125 | static inline void __deprecated *kmap_atomic_deprecated(struct page *page, | ||
| 126 | enum km_type km) | ||
| 127 | { | ||
| 128 | return kmap_atomic(page); | ||
| 129 | } | ||
| 130 | |||
| 131 | #define kmap_atomic1(...) kmap_atomic(__VA_ARGS__) | ||
| 132 | #define kmap_atomic2(...) kmap_atomic_deprecated(__VA_ARGS__) | ||
| 133 | #define kmap_atomic(...) PASTE2(kmap_atomic, NARG(__VA_ARGS__)(__VA_ARGS__)) | ||
| 134 | |||
| 135 | static inline void __deprecated __kunmap_atomic_deprecated(void *addr, | ||
| 136 | enum km_type km) | ||
| 137 | { | ||
| 138 | __kunmap_atomic(addr); | ||
| 139 | } | ||
| 115 | 140 | ||
| 116 | /* | 141 | /* |
| 117 | * Prevent people trying to call kunmap_atomic() as if it were kunmap() | 142 | * Prevent people trying to call kunmap_atomic() as if it were kunmap() |
| 118 | * kunmap_atomic() should get the return value of kmap_atomic, not the page. | 143 | * kunmap_atomic() should get the return value of kmap_atomic, not the page. |
| 119 | */ | 144 | */ |
| 120 | #define kunmap_atomic(addr, args...) \ | 145 | #define kunmap_atomic_deprecated(addr, km) \ |
| 121 | do { \ | 146 | do { \ |
| 122 | BUILD_BUG_ON(__same_type((addr), struct page *)); \ | 147 | BUILD_BUG_ON(__same_type((addr), struct page *)); \ |
| 123 | __kunmap_atomic(addr); \ | 148 | __kunmap_atomic_deprecated(addr, km); \ |
| 124 | } while (0) | 149 | } while (0) |
| 125 | 150 | ||
| 151 | #define kunmap_atomic_withcheck(addr) \ | ||
| 152 | do { \ | ||
| 153 | BUILD_BUG_ON(__same_type((addr), struct page *)); \ | ||
| 154 | __kunmap_atomic(addr); \ | ||
| 155 | } while (0) | ||
| 156 | |||
| 157 | #define kunmap_atomic1(...) kunmap_atomic_withcheck(__VA_ARGS__) | ||
| 158 | #define kunmap_atomic2(...) kunmap_atomic_deprecated(__VA_ARGS__) | ||
| 159 | #define kunmap_atomic(...) PASTE2(kunmap_atomic, NARG(__VA_ARGS__)(__VA_ARGS__)) | ||
| 160 | /**** End of C pre-processor tricks for deprecated macros ****/ | ||
| 161 | |||
| 126 | /* when CONFIG_HIGHMEM is not set these will be plain clear/copy_page */ | 162 | /* when CONFIG_HIGHMEM is not set these will be plain clear/copy_page */ |
| 127 | #ifndef clear_user_highpage | 163 | #ifndef clear_user_highpage |
| 128 | static inline void clear_user_highpage(struct page *page, unsigned long vaddr) | 164 | static inline void clear_user_highpage(struct page *page, unsigned long vaddr) |
| 129 | { | 165 | { |
| 130 | void *addr = kmap_atomic(page, KM_USER0); | 166 | void *addr = kmap_atomic(page); |
| 131 | clear_user_page(addr, vaddr, page); | 167 | clear_user_page(addr, vaddr, page); |
| 132 | kunmap_atomic(addr, KM_USER0); | 168 | kunmap_atomic(addr); |
| 133 | } | 169 | } |
| 134 | #endif | 170 | #endif |
| 135 | 171 | ||
| @@ -180,16 +216,16 @@ alloc_zeroed_user_highpage_movable(struct vm_area_struct *vma, | |||
| 180 | 216 | ||
| 181 | static inline void clear_highpage(struct page *page) | 217 | static inline void clear_highpage(struct page *page) |
| 182 | { | 218 | { |
| 183 | void *kaddr = kmap_atomic(page, KM_USER0); | 219 | void *kaddr = kmap_atomic(page); |
| 184 | clear_page(kaddr); | 220 | clear_page(kaddr); |
| 185 | kunmap_atomic(kaddr, KM_USER0); | 221 | kunmap_atomic(kaddr); |
| 186 | } | 222 | } |
| 187 | 223 | ||
| 188 | static inline void zero_user_segments(struct page *page, | 224 | static inline void zero_user_segments(struct page *page, |
| 189 | unsigned start1, unsigned end1, | 225 | unsigned start1, unsigned end1, |
| 190 | unsigned start2, unsigned end2) | 226 | unsigned start2, unsigned end2) |
| 191 | { | 227 | { |
| 192 | void *kaddr = kmap_atomic(page, KM_USER0); | 228 | void *kaddr = kmap_atomic(page); |
| 193 | 229 | ||
| 194 | BUG_ON(end1 > PAGE_SIZE || end2 > PAGE_SIZE); | 230 | BUG_ON(end1 > PAGE_SIZE || end2 > PAGE_SIZE); |
| 195 | 231 | ||
| @@ -199,7 +235,7 @@ static inline void zero_user_segments(struct page *page, | |||
| 199 | if (end2 > start2) | 235 | if (end2 > start2) |
| 200 | memset(kaddr + start2, 0, end2 - start2); | 236 | memset(kaddr + start2, 0, end2 - start2); |
| 201 | 237 | ||
| 202 | kunmap_atomic(kaddr, KM_USER0); | 238 | kunmap_atomic(kaddr); |
| 203 | flush_dcache_page(page); | 239 | flush_dcache_page(page); |
| 204 | } | 240 | } |
| 205 | 241 | ||
| @@ -228,11 +264,11 @@ static inline void copy_user_highpage(struct page *to, struct page *from, | |||
| 228 | { | 264 | { |
| 229 | char *vfrom, *vto; | 265 | char *vfrom, *vto; |
| 230 | 266 | ||
| 231 | vfrom = kmap_atomic(from, KM_USER0); | 267 | vfrom = kmap_atomic(from); |
| 232 | vto = kmap_atomic(to, KM_USER1); | 268 | vto = kmap_atomic(to); |
| 233 | copy_user_page(vto, vfrom, vaddr, to); | 269 | copy_user_page(vto, vfrom, vaddr, to); |
| 234 | kunmap_atomic(vto, KM_USER1); | 270 | kunmap_atomic(vto); |
| 235 | kunmap_atomic(vfrom, KM_USER0); | 271 | kunmap_atomic(vfrom); |
| 236 | } | 272 | } |
| 237 | 273 | ||
| 238 | #endif | 274 | #endif |
| @@ -241,11 +277,11 @@ static inline void copy_highpage(struct page *to, struct page *from) | |||
| 241 | { | 277 | { |
| 242 | char *vfrom, *vto; | 278 | char *vfrom, *vto; |
| 243 | 279 | ||
| 244 | vfrom = kmap_atomic(from, KM_USER0); | 280 | vfrom = kmap_atomic(from); |
| 245 | vto = kmap_atomic(to, KM_USER1); | 281 | vto = kmap_atomic(to); |
| 246 | copy_page(vto, vfrom); | 282 | copy_page(vto, vfrom); |
| 247 | kunmap_atomic(vto, KM_USER1); | 283 | kunmap_atomic(vto); |
| 248 | kunmap_atomic(vfrom, KM_USER0); | 284 | kunmap_atomic(vfrom); |
| 249 | } | 285 | } |
| 250 | 286 | ||
| 251 | #endif /* _LINUX_HIGHMEM_H */ | 287 | #endif /* _LINUX_HIGHMEM_H */ |
diff --git a/include/linux/huge_mm.h b/include/linux/huge_mm.h index 1b921299abc4..c8af7a2efb52 100644 --- a/include/linux/huge_mm.h +++ b/include/linux/huge_mm.h | |||
| @@ -51,6 +51,9 @@ extern pmd_t *page_check_address_pmd(struct page *page, | |||
| 51 | unsigned long address, | 51 | unsigned long address, |
| 52 | enum page_check_address_pmd_flag flag); | 52 | enum page_check_address_pmd_flag flag); |
| 53 | 53 | ||
| 54 | #define HPAGE_PMD_ORDER (HPAGE_PMD_SHIFT-PAGE_SHIFT) | ||
| 55 | #define HPAGE_PMD_NR (1<<HPAGE_PMD_ORDER) | ||
| 56 | |||
| 54 | #ifdef CONFIG_TRANSPARENT_HUGEPAGE | 57 | #ifdef CONFIG_TRANSPARENT_HUGEPAGE |
| 55 | #define HPAGE_PMD_SHIFT HPAGE_SHIFT | 58 | #define HPAGE_PMD_SHIFT HPAGE_SHIFT |
| 56 | #define HPAGE_PMD_MASK HPAGE_MASK | 59 | #define HPAGE_PMD_MASK HPAGE_MASK |
| @@ -102,8 +105,6 @@ extern void __split_huge_page_pmd(struct mm_struct *mm, pmd_t *pmd); | |||
| 102 | BUG_ON(pmd_trans_splitting(*____pmd) || \ | 105 | BUG_ON(pmd_trans_splitting(*____pmd) || \ |
| 103 | pmd_trans_huge(*____pmd)); \ | 106 | pmd_trans_huge(*____pmd)); \ |
| 104 | } while (0) | 107 | } while (0) |
| 105 | #define HPAGE_PMD_ORDER (HPAGE_PMD_SHIFT-PAGE_SHIFT) | ||
| 106 | #define HPAGE_PMD_NR (1<<HPAGE_PMD_ORDER) | ||
| 107 | #if HPAGE_PMD_ORDER > MAX_ORDER | 108 | #if HPAGE_PMD_ORDER > MAX_ORDER |
| 108 | #error "hugepages can't be allocated by the buddy allocator" | 109 | #error "hugepages can't be allocated by the buddy allocator" |
| 109 | #endif | 110 | #endif |
| @@ -113,6 +114,18 @@ extern void __vma_adjust_trans_huge(struct vm_area_struct *vma, | |||
| 113 | unsigned long start, | 114 | unsigned long start, |
| 114 | unsigned long end, | 115 | unsigned long end, |
| 115 | long adjust_next); | 116 | long adjust_next); |
| 117 | extern int __pmd_trans_huge_lock(pmd_t *pmd, | ||
| 118 | struct vm_area_struct *vma); | ||
| 119 | /* mmap_sem must be held on entry */ | ||
| 120 | static inline int pmd_trans_huge_lock(pmd_t *pmd, | ||
| 121 | struct vm_area_struct *vma) | ||
| 122 | { | ||
| 123 | VM_BUG_ON(!rwsem_is_locked(&vma->vm_mm->mmap_sem)); | ||
| 124 | if (pmd_trans_huge(*pmd)) | ||
| 125 | return __pmd_trans_huge_lock(pmd, vma); | ||
| 126 | else | ||
| 127 | return 0; | ||
| 128 | } | ||
| 116 | static inline void vma_adjust_trans_huge(struct vm_area_struct *vma, | 129 | static inline void vma_adjust_trans_huge(struct vm_area_struct *vma, |
| 117 | unsigned long start, | 130 | unsigned long start, |
| 118 | unsigned long end, | 131 | unsigned long end, |
| @@ -146,9 +159,9 @@ static inline struct page *compound_trans_head(struct page *page) | |||
| 146 | return page; | 159 | return page; |
| 147 | } | 160 | } |
| 148 | #else /* CONFIG_TRANSPARENT_HUGEPAGE */ | 161 | #else /* CONFIG_TRANSPARENT_HUGEPAGE */ |
| 149 | #define HPAGE_PMD_SHIFT ({ BUG(); 0; }) | 162 | #define HPAGE_PMD_SHIFT ({ BUILD_BUG(); 0; }) |
| 150 | #define HPAGE_PMD_MASK ({ BUG(); 0; }) | 163 | #define HPAGE_PMD_MASK ({ BUILD_BUG(); 0; }) |
| 151 | #define HPAGE_PMD_SIZE ({ BUG(); 0; }) | 164 | #define HPAGE_PMD_SIZE ({ BUILD_BUG(); 0; }) |
| 152 | 165 | ||
| 153 | #define hpage_nr_pages(x) 1 | 166 | #define hpage_nr_pages(x) 1 |
| 154 | 167 | ||
| @@ -176,6 +189,11 @@ static inline void vma_adjust_trans_huge(struct vm_area_struct *vma, | |||
| 176 | long adjust_next) | 189 | long adjust_next) |
| 177 | { | 190 | { |
| 178 | } | 191 | } |
| 192 | static inline int pmd_trans_huge_lock(pmd_t *pmd, | ||
| 193 | struct vm_area_struct *vma) | ||
| 194 | { | ||
| 195 | return 0; | ||
| 196 | } | ||
| 179 | #endif /* CONFIG_TRANSPARENT_HUGEPAGE */ | 197 | #endif /* CONFIG_TRANSPARENT_HUGEPAGE */ |
| 180 | 198 | ||
| 181 | #endif /* _LINUX_HUGE_MM_H */ | 199 | #endif /* _LINUX_HUGE_MM_H */ |
diff --git a/include/linux/hugetlb.h b/include/linux/hugetlb.h index d9d6c868b86b..000837e126e6 100644 --- a/include/linux/hugetlb.h +++ b/include/linux/hugetlb.h | |||
| @@ -14,6 +14,15 @@ struct user_struct; | |||
| 14 | #include <linux/shm.h> | 14 | #include <linux/shm.h> |
| 15 | #include <asm/tlbflush.h> | 15 | #include <asm/tlbflush.h> |
| 16 | 16 | ||
| 17 | struct hugepage_subpool { | ||
| 18 | spinlock_t lock; | ||
| 19 | long count; | ||
| 20 | long max_hpages, used_hpages; | ||
| 21 | }; | ||
| 22 | |||
| 23 | struct hugepage_subpool *hugepage_new_subpool(long nr_blocks); | ||
| 24 | void hugepage_put_subpool(struct hugepage_subpool *spool); | ||
| 25 | |||
| 17 | int PageHuge(struct page *page); | 26 | int PageHuge(struct page *page); |
| 18 | 27 | ||
| 19 | void reset_vma_resv_huge_pages(struct vm_area_struct *vma); | 28 | void reset_vma_resv_huge_pages(struct vm_area_struct *vma); |
| @@ -128,35 +137,14 @@ enum { | |||
| 128 | }; | 137 | }; |
| 129 | 138 | ||
| 130 | #ifdef CONFIG_HUGETLBFS | 139 | #ifdef CONFIG_HUGETLBFS |
| 131 | struct hugetlbfs_config { | ||
| 132 | uid_t uid; | ||
| 133 | gid_t gid; | ||
| 134 | umode_t mode; | ||
| 135 | long nr_blocks; | ||
| 136 | long nr_inodes; | ||
| 137 | struct hstate *hstate; | ||
| 138 | }; | ||
| 139 | |||
| 140 | struct hugetlbfs_sb_info { | 140 | struct hugetlbfs_sb_info { |
| 141 | long max_blocks; /* blocks allowed */ | ||
| 142 | long free_blocks; /* blocks free */ | ||
| 143 | long max_inodes; /* inodes allowed */ | 141 | long max_inodes; /* inodes allowed */ |
| 144 | long free_inodes; /* inodes free */ | 142 | long free_inodes; /* inodes free */ |
| 145 | spinlock_t stat_lock; | 143 | spinlock_t stat_lock; |
| 146 | struct hstate *hstate; | 144 | struct hstate *hstate; |
| 145 | struct hugepage_subpool *spool; | ||
| 147 | }; | 146 | }; |
| 148 | 147 | ||
| 149 | |||
| 150 | struct hugetlbfs_inode_info { | ||
| 151 | struct shared_policy policy; | ||
| 152 | struct inode vfs_inode; | ||
| 153 | }; | ||
| 154 | |||
| 155 | static inline struct hugetlbfs_inode_info *HUGETLBFS_I(struct inode *inode) | ||
| 156 | { | ||
| 157 | return container_of(inode, struct hugetlbfs_inode_info, vfs_inode); | ||
| 158 | } | ||
| 159 | |||
| 160 | static inline struct hugetlbfs_sb_info *HUGETLBFS_SB(struct super_block *sb) | 148 | static inline struct hugetlbfs_sb_info *HUGETLBFS_SB(struct super_block *sb) |
| 161 | { | 149 | { |
| 162 | return sb->s_fs_info; | 150 | return sb->s_fs_info; |
| @@ -164,10 +152,9 @@ static inline struct hugetlbfs_sb_info *HUGETLBFS_SB(struct super_block *sb) | |||
| 164 | 152 | ||
| 165 | extern const struct file_operations hugetlbfs_file_operations; | 153 | extern const struct file_operations hugetlbfs_file_operations; |
| 166 | extern const struct vm_operations_struct hugetlb_vm_ops; | 154 | extern const struct vm_operations_struct hugetlb_vm_ops; |
| 167 | struct file *hugetlb_file_setup(const char *name, size_t size, vm_flags_t acct, | 155 | struct file *hugetlb_file_setup(const char *name, unsigned long addr, |
| 156 | size_t size, vm_flags_t acct, | ||
| 168 | struct user_struct **user, int creat_flags); | 157 | struct user_struct **user, int creat_flags); |
| 169 | int hugetlb_get_quota(struct address_space *mapping, long delta); | ||
| 170 | void hugetlb_put_quota(struct address_space *mapping, long delta); | ||
| 171 | 158 | ||
| 172 | static inline int is_file_hugepages(struct file *file) | 159 | static inline int is_file_hugepages(struct file *file) |
| 173 | { | 160 | { |
| @@ -179,15 +166,11 @@ static inline int is_file_hugepages(struct file *file) | |||
| 179 | return 0; | 166 | return 0; |
| 180 | } | 167 | } |
| 181 | 168 | ||
| 182 | static inline void set_file_hugepages(struct file *file) | ||
| 183 | { | ||
| 184 | file->f_op = &hugetlbfs_file_operations; | ||
| 185 | } | ||
| 186 | #else /* !CONFIG_HUGETLBFS */ | 169 | #else /* !CONFIG_HUGETLBFS */ |
| 187 | 170 | ||
| 188 | #define is_file_hugepages(file) 0 | 171 | #define is_file_hugepages(file) 0 |
| 189 | #define set_file_hugepages(file) BUG() | 172 | static inline struct file * |
| 190 | static inline struct file *hugetlb_file_setup(const char *name, size_t size, | 173 | hugetlb_file_setup(const char *name, unsigned long addr, size_t size, |
| 191 | vm_flags_t acctflag, struct user_struct **user, int creat_flags) | 174 | vm_flags_t acctflag, struct user_struct **user, int creat_flags) |
| 192 | { | 175 | { |
| 193 | return ERR_PTR(-ENOSYS); | 176 | return ERR_PTR(-ENOSYS); |
diff --git a/include/linux/hwmon-sysfs.h b/include/linux/hwmon-sysfs.h index a90c09d331c1..1c7b89ae6bdc 100644 --- a/include/linux/hwmon-sysfs.h +++ b/include/linux/hwmon-sysfs.h | |||
| @@ -20,6 +20,8 @@ | |||
| 20 | #ifndef _LINUX_HWMON_SYSFS_H | 20 | #ifndef _LINUX_HWMON_SYSFS_H |
| 21 | #define _LINUX_HWMON_SYSFS_H | 21 | #define _LINUX_HWMON_SYSFS_H |
| 22 | 22 | ||
| 23 | #include <linux/device.h> | ||
| 24 | |||
| 23 | struct sensor_device_attribute{ | 25 | struct sensor_device_attribute{ |
| 24 | struct device_attribute dev_attr; | 26 | struct device_attribute dev_attr; |
| 25 | int index; | 27 | int index; |
diff --git a/include/linux/hwmon.h b/include/linux/hwmon.h index 6b6ee702b007..82b29ae6ebb0 100644 --- a/include/linux/hwmon.h +++ b/include/linux/hwmon.h | |||
| @@ -14,7 +14,7 @@ | |||
| 14 | #ifndef _HWMON_H_ | 14 | #ifndef _HWMON_H_ |
| 15 | #define _HWMON_H_ | 15 | #define _HWMON_H_ |
| 16 | 16 | ||
| 17 | #include <linux/device.h> | 17 | struct device; |
| 18 | 18 | ||
| 19 | struct device *hwmon_device_register(struct device *dev); | 19 | struct device *hwmon_device_register(struct device *dev); |
| 20 | 20 | ||
diff --git a/include/linux/hwspinlock.h b/include/linux/hwspinlock.h index aad6bd4b3efd..3343298e40e8 100644 --- a/include/linux/hwspinlock.h +++ b/include/linux/hwspinlock.h | |||
| @@ -20,12 +20,12 @@ | |||
| 20 | 20 | ||
| 21 | #include <linux/err.h> | 21 | #include <linux/err.h> |
| 22 | #include <linux/sched.h> | 22 | #include <linux/sched.h> |
| 23 | #include <linux/device.h> | ||
| 24 | 23 | ||
| 25 | /* hwspinlock mode argument */ | 24 | /* hwspinlock mode argument */ |
| 26 | #define HWLOCK_IRQSTATE 0x01 /* Disable interrupts, save state */ | 25 | #define HWLOCK_IRQSTATE 0x01 /* Disable interrupts, save state */ |
| 27 | #define HWLOCK_IRQ 0x02 /* Disable interrupts, don't save state */ | 26 | #define HWLOCK_IRQ 0x02 /* Disable interrupts, don't save state */ |
| 28 | 27 | ||
| 28 | struct device; | ||
| 29 | struct hwspinlock; | 29 | struct hwspinlock; |
| 30 | struct hwspinlock_device; | 30 | struct hwspinlock_device; |
| 31 | struct hwspinlock_ops; | 31 | struct hwspinlock_ops; |
diff --git a/include/linux/hyperv.h b/include/linux/hyperv.h index 0ae065a5fcb2..5852545e6bba 100644 --- a/include/linux/hyperv.h +++ b/include/linux/hyperv.h | |||
| @@ -25,6 +25,173 @@ | |||
| 25 | #ifndef _HYPERV_H | 25 | #ifndef _HYPERV_H |
| 26 | #define _HYPERV_H | 26 | #define _HYPERV_H |
| 27 | 27 | ||
| 28 | #include <linux/types.h> | ||
| 29 | |||
| 30 | /* | ||
| 31 | * An implementation of HyperV key value pair (KVP) functionality for Linux. | ||
| 32 | * | ||
| 33 | * | ||
| 34 | * Copyright (C) 2010, Novell, Inc. | ||
| 35 | * Author : K. Y. Srinivasan <ksrinivasan@novell.com> | ||
| 36 | * | ||
| 37 | */ | ||
| 38 | |||
| 39 | /* | ||
| 40 | * Maximum value size - used for both key names and value data, and includes | ||
| 41 | * any applicable NULL terminators. | ||
| 42 | * | ||
| 43 | * Note: This limit is somewhat arbitrary, but falls easily within what is | ||
| 44 | * supported for all native guests (back to Win 2000) and what is reasonable | ||
| 45 | * for the IC KVP exchange functionality. Note that Windows Me/98/95 are | ||
| 46 | * limited to 255 character key names. | ||
| 47 | * | ||
| 48 | * MSDN recommends not storing data values larger than 2048 bytes in the | ||
| 49 | * registry. | ||
| 50 | * | ||
| 51 | * Note: This value is used in defining the KVP exchange message - this value | ||
| 52 | * cannot be modified without affecting the message size and compatibility. | ||
| 53 | */ | ||
| 54 | |||
| 55 | /* | ||
| 56 | * bytes, including any null terminators | ||
| 57 | */ | ||
| 58 | #define HV_KVP_EXCHANGE_MAX_VALUE_SIZE (2048) | ||
| 59 | |||
| 60 | |||
| 61 | /* | ||
| 62 | * Maximum key size - the registry limit for the length of an entry name | ||
| 63 | * is 256 characters, including the null terminator | ||
| 64 | */ | ||
| 65 | |||
| 66 | #define HV_KVP_EXCHANGE_MAX_KEY_SIZE (512) | ||
| 67 | |||
| 68 | /* | ||
| 69 | * In Linux, we implement the KVP functionality in two components: | ||
| 70 | * 1) The kernel component which is packaged as part of the hv_utils driver | ||
| 71 | * is responsible for communicating with the host and responsible for | ||
| 72 | * implementing the host/guest protocol. 2) A user level daemon that is | ||
| 73 | * responsible for data gathering. | ||
| 74 | * | ||
| 75 | * Host/Guest Protocol: The host iterates over an index and expects the guest | ||
| 76 | * to assign a key name to the index and also return the value corresponding to | ||
| 77 | * the key. The host will have atmost one KVP transaction outstanding at any | ||
| 78 | * given point in time. The host side iteration stops when the guest returns | ||
| 79 | * an error. Microsoft has specified the following mapping of key names to | ||
| 80 | * host specified index: | ||
| 81 | * | ||
| 82 | * Index Key Name | ||
| 83 | * 0 FullyQualifiedDomainName | ||
| 84 | * 1 IntegrationServicesVersion | ||
| 85 | * 2 NetworkAddressIPv4 | ||
| 86 | * 3 NetworkAddressIPv6 | ||
| 87 | * 4 OSBuildNumber | ||
| 88 | * 5 OSName | ||
| 89 | * 6 OSMajorVersion | ||
| 90 | * 7 OSMinorVersion | ||
| 91 | * 8 OSVersion | ||
| 92 | * 9 ProcessorArchitecture | ||
| 93 | * | ||
| 94 | * The Windows host expects the Key Name and Key Value to be encoded in utf16. | ||
| 95 | * | ||
| 96 | * Guest Kernel/KVP Daemon Protocol: As noted earlier, we implement all of the | ||
| 97 | * data gathering functionality in a user mode daemon. The user level daemon | ||
| 98 | * is also responsible for binding the key name to the index as well. The | ||
| 99 | * kernel and user-level daemon communicate using a connector channel. | ||
| 100 | * | ||
| 101 | * The user mode component first registers with the | ||
| 102 | * the kernel component. Subsequently, the kernel component requests, data | ||
| 103 | * for the specified keys. In response to this message the user mode component | ||
| 104 | * fills in the value corresponding to the specified key. We overload the | ||
| 105 | * sequence field in the cn_msg header to define our KVP message types. | ||
| 106 | * | ||
| 107 | * | ||
| 108 | * The kernel component simply acts as a conduit for communication between the | ||
| 109 | * Windows host and the user-level daemon. The kernel component passes up the | ||
| 110 | * index received from the Host to the user-level daemon. If the index is | ||
| 111 | * valid (supported), the corresponding key as well as its | ||
| 112 | * value (both are strings) is returned. If the index is invalid | ||
| 113 | * (not supported), a NULL key string is returned. | ||
| 114 | */ | ||
| 115 | |||
| 116 | |||
| 117 | /* | ||
| 118 | * Registry value types. | ||
| 119 | */ | ||
| 120 | |||
| 121 | #define REG_SZ 1 | ||
| 122 | #define REG_U32 4 | ||
| 123 | #define REG_U64 8 | ||
| 124 | |||
| 125 | enum hv_kvp_exchg_op { | ||
| 126 | KVP_OP_GET = 0, | ||
| 127 | KVP_OP_SET, | ||
| 128 | KVP_OP_DELETE, | ||
| 129 | KVP_OP_ENUMERATE, | ||
| 130 | KVP_OP_REGISTER, | ||
| 131 | KVP_OP_COUNT /* Number of operations, must be last. */ | ||
| 132 | }; | ||
| 133 | |||
| 134 | enum hv_kvp_exchg_pool { | ||
| 135 | KVP_POOL_EXTERNAL = 0, | ||
| 136 | KVP_POOL_GUEST, | ||
| 137 | KVP_POOL_AUTO, | ||
| 138 | KVP_POOL_AUTO_EXTERNAL, | ||
| 139 | KVP_POOL_AUTO_INTERNAL, | ||
| 140 | KVP_POOL_COUNT /* Number of pools, must be last. */ | ||
| 141 | }; | ||
| 142 | |||
| 143 | struct hv_kvp_hdr { | ||
| 144 | __u8 operation; | ||
| 145 | __u8 pool; | ||
| 146 | __u16 pad; | ||
| 147 | } __attribute__((packed)); | ||
| 148 | |||
| 149 | struct hv_kvp_exchg_msg_value { | ||
| 150 | __u32 value_type; | ||
| 151 | __u32 key_size; | ||
| 152 | __u32 value_size; | ||
| 153 | __u8 key[HV_KVP_EXCHANGE_MAX_KEY_SIZE]; | ||
| 154 | union { | ||
| 155 | __u8 value[HV_KVP_EXCHANGE_MAX_VALUE_SIZE]; | ||
| 156 | __u32 value_u32; | ||
| 157 | __u64 value_u64; | ||
| 158 | }; | ||
| 159 | } __attribute__((packed)); | ||
| 160 | |||
| 161 | struct hv_kvp_msg_enumerate { | ||
| 162 | __u32 index; | ||
| 163 | struct hv_kvp_exchg_msg_value data; | ||
| 164 | } __attribute__((packed)); | ||
| 165 | |||
| 166 | struct hv_kvp_msg_get { | ||
| 167 | struct hv_kvp_exchg_msg_value data; | ||
| 168 | }; | ||
| 169 | |||
| 170 | struct hv_kvp_msg_set { | ||
| 171 | struct hv_kvp_exchg_msg_value data; | ||
| 172 | }; | ||
| 173 | |||
| 174 | struct hv_kvp_msg_delete { | ||
| 175 | __u32 key_size; | ||
| 176 | __u8 key[HV_KVP_EXCHANGE_MAX_KEY_SIZE]; | ||
| 177 | }; | ||
| 178 | |||
| 179 | struct hv_kvp_register { | ||
| 180 | __u8 version[HV_KVP_EXCHANGE_MAX_KEY_SIZE]; | ||
| 181 | }; | ||
| 182 | |||
| 183 | struct hv_kvp_msg { | ||
| 184 | struct hv_kvp_hdr kvp_hdr; | ||
| 185 | union { | ||
| 186 | struct hv_kvp_msg_get kvp_get; | ||
| 187 | struct hv_kvp_msg_set kvp_set; | ||
| 188 | struct hv_kvp_msg_delete kvp_delete; | ||
| 189 | struct hv_kvp_msg_enumerate kvp_enum_data; | ||
| 190 | struct hv_kvp_register kvp_register; | ||
| 191 | } body; | ||
| 192 | } __attribute__((packed)); | ||
| 193 | |||
| 194 | #ifdef __KERNEL__ | ||
| 28 | #include <linux/scatterlist.h> | 195 | #include <linux/scatterlist.h> |
| 29 | #include <linux/list.h> | 196 | #include <linux/list.h> |
| 30 | #include <linux/uuid.h> | 197 | #include <linux/uuid.h> |
| @@ -785,6 +952,7 @@ void vmbus_driver_unregister(struct hv_driver *hv_driver); | |||
| 785 | 952 | ||
| 786 | #define HV_S_OK 0x00000000 | 953 | #define HV_S_OK 0x00000000 |
| 787 | #define HV_E_FAIL 0x80004005 | 954 | #define HV_E_FAIL 0x80004005 |
| 955 | #define HV_S_CONT 0x80070103 | ||
| 788 | #define HV_ERROR_NOT_SUPPORTED 0x80070032 | 956 | #define HV_ERROR_NOT_SUPPORTED 0x80070032 |
| 789 | #define HV_ERROR_MACHINE_LOCKED 0x800704F7 | 957 | #define HV_ERROR_MACHINE_LOCKED 0x800704F7 |
| 790 | 958 | ||
| @@ -870,4 +1038,9 @@ struct hyperv_service_callback { | |||
| 870 | extern void vmbus_prep_negotiate_resp(struct icmsg_hdr *, | 1038 | extern void vmbus_prep_negotiate_resp(struct icmsg_hdr *, |
| 871 | struct icmsg_negotiate *, u8 *); | 1039 | struct icmsg_negotiate *, u8 *); |
| 872 | 1040 | ||
| 1041 | int hv_kvp_init(struct hv_util_service *); | ||
| 1042 | void hv_kvp_deinit(void); | ||
| 1043 | void hv_kvp_onchannelcallback(void *); | ||
| 1044 | |||
| 1045 | #endif /* __KERNEL__ */ | ||
| 873 | #endif /* _HYPERV_H */ | 1046 | #endif /* _HYPERV_H */ |
diff --git a/include/linux/i2c-algo-bit.h b/include/linux/i2c-algo-bit.h index 4f98148c11c3..584ffa0f3282 100644 --- a/include/linux/i2c-algo-bit.h +++ b/include/linux/i2c-algo-bit.h | |||
| @@ -49,5 +49,6 @@ struct i2c_algo_bit_data { | |||
| 49 | 49 | ||
| 50 | int i2c_bit_add_bus(struct i2c_adapter *); | 50 | int i2c_bit_add_bus(struct i2c_adapter *); |
| 51 | int i2c_bit_add_numbered_bus(struct i2c_adapter *); | 51 | int i2c_bit_add_numbered_bus(struct i2c_adapter *); |
| 52 | extern const struct i2c_algorithm i2c_bit_algo; | ||
| 52 | 53 | ||
| 53 | #endif /* _LINUX_I2C_ALGO_BIT_H */ | 54 | #endif /* _LINUX_I2C_ALGO_BIT_H */ |
diff --git a/include/linux/i2c/at24.h b/include/linux/i2c/at24.h index 8ace93024d60..285025a9cdc9 100644 --- a/include/linux/i2c/at24.h +++ b/include/linux/i2c/at24.h | |||
| @@ -1,19 +1,42 @@ | |||
| 1 | /* | ||
| 2 | * at24.h - platform_data for the at24 (generic eeprom) driver | ||
| 3 | * (C) Copyright 2008 by Pengutronix | ||
| 4 | * (C) Copyright 2012 by Wolfram Sang | ||
| 5 | * same license as the driver | ||
| 6 | */ | ||
| 7 | |||
| 1 | #ifndef _LINUX_AT24_H | 8 | #ifndef _LINUX_AT24_H |
| 2 | #define _LINUX_AT24_H | 9 | #define _LINUX_AT24_H |
| 3 | 10 | ||
| 4 | #include <linux/types.h> | 11 | #include <linux/types.h> |
| 5 | #include <linux/memory.h> | 12 | #include <linux/memory.h> |
| 6 | 13 | ||
| 7 | /* | 14 | /** |
| 8 | * As seen through Linux I2C, differences between the most common types of I2C | 15 | * struct at24_platform_data - data to set up at24 (generic eeprom) driver |
| 9 | * memory include: | 16 | * @byte_len: size of eeprom in byte |
| 10 | * - How much memory is available (usually specified in bit)? | 17 | * @page_size: number of byte which can be written in one go |
| 11 | * - What write page size does it support? | 18 | * @flags: tunable options, check AT24_FLAG_* defines |
| 12 | * - Special flags (16 bit addresses, read_only, world readable...)? | 19 | * @setup: an optional callback invoked after eeprom is probed; enables kernel |
| 20 | code to access eeprom via memory_accessor, see example | ||
| 21 | * @context: optional parameter passed to setup() | ||
| 13 | * | 22 | * |
| 14 | * If you set up a custom eeprom type, please double-check the parameters. | 23 | * If you set up a custom eeprom type, please double-check the parameters. |
| 15 | * Especially page_size needs extra care, as you risk data loss if your value | 24 | * Especially page_size needs extra care, as you risk data loss if your value |
| 16 | * is bigger than what the chip actually supports! | 25 | * is bigger than what the chip actually supports! |
| 26 | * | ||
| 27 | * An example in pseudo code for a setup() callback: | ||
| 28 | * | ||
| 29 | * void get_mac_addr(struct memory_accessor *mem_acc, void *context) | ||
| 30 | * { | ||
| 31 | * u8 *mac_addr = ethernet_pdata->mac_addr; | ||
| 32 | * off_t offset = context; | ||
| 33 | * | ||
| 34 | * // Read MAC addr from EEPROM | ||
| 35 | * if (mem_acc->read(mem_acc, mac_addr, offset, ETH_ALEN) == ETH_ALEN) | ||
| 36 | * pr_info("Read MAC addr from EEPROM: %pM\n", mac_addr); | ||
| 37 | * } | ||
| 38 | * | ||
| 39 | * This function pointer and context can now be set up in at24_platform_data. | ||
| 17 | */ | 40 | */ |
| 18 | 41 | ||
| 19 | struct at24_platform_data { | 42 | struct at24_platform_data { |
diff --git a/include/linux/i2c/tc35876x.h b/include/linux/i2c/tc35876x.h new file mode 100644 index 000000000000..cd6a51c71e7e --- /dev/null +++ b/include/linux/i2c/tc35876x.h | |||
| @@ -0,0 +1,11 @@ | |||
| 1 | |||
| 2 | #ifndef _TC35876X_H | ||
| 3 | #define _TC35876X_H | ||
| 4 | |||
| 5 | struct tc35876x_platform_data { | ||
| 6 | int gpio_bridge_reset; | ||
| 7 | int gpio_panel_bl_en; | ||
| 8 | int gpio_panel_vadd; | ||
| 9 | }; | ||
| 10 | |||
| 11 | #endif /* _TC35876X_H */ | ||
diff --git a/include/linux/i2c/twl.h b/include/linux/i2c/twl.h index 78d3465251d6..7fcab23c59ce 100644 --- a/include/linux/i2c/twl.h +++ b/include/linux/i2c/twl.h | |||
| @@ -712,6 +712,9 @@ struct twl4030_platform_data { | |||
| 712 | struct regulator_init_data *vaux1; | 712 | struct regulator_init_data *vaux1; |
| 713 | struct regulator_init_data *vaux2; | 713 | struct regulator_init_data *vaux2; |
| 714 | struct regulator_init_data *vaux3; | 714 | struct regulator_init_data *vaux3; |
| 715 | struct regulator_init_data *vdd1; | ||
| 716 | struct regulator_init_data *vdd2; | ||
| 717 | struct regulator_init_data *vdd3; | ||
| 715 | /* TWL4030 LDO regulators */ | 718 | /* TWL4030 LDO regulators */ |
| 716 | struct regulator_init_data *vpll1; | 719 | struct regulator_init_data *vpll1; |
| 717 | struct regulator_init_data *vpll2; | 720 | struct regulator_init_data *vpll2; |
| @@ -720,8 +723,6 @@ struct twl4030_platform_data { | |||
| 720 | struct regulator_init_data *vsim; | 723 | struct regulator_init_data *vsim; |
| 721 | struct regulator_init_data *vaux4; | 724 | struct regulator_init_data *vaux4; |
| 722 | struct regulator_init_data *vio; | 725 | struct regulator_init_data *vio; |
| 723 | struct regulator_init_data *vdd1; | ||
| 724 | struct regulator_init_data *vdd2; | ||
| 725 | struct regulator_init_data *vintana1; | 726 | struct regulator_init_data *vintana1; |
| 726 | struct regulator_init_data *vintana2; | 727 | struct regulator_init_data *vintana2; |
| 727 | struct regulator_init_data *vintdig; | 728 | struct regulator_init_data *vintdig; |
| @@ -733,6 +734,8 @@ struct twl4030_platform_data { | |||
| 733 | struct regulator_init_data *vcxio; | 734 | struct regulator_init_data *vcxio; |
| 734 | struct regulator_init_data *vusb; | 735 | struct regulator_init_data *vusb; |
| 735 | struct regulator_init_data *clk32kg; | 736 | struct regulator_init_data *clk32kg; |
| 737 | struct regulator_init_data *v1v8; | ||
| 738 | struct regulator_init_data *v2v1; | ||
| 736 | /* TWL6025 LDO regulators */ | 739 | /* TWL6025 LDO regulators */ |
| 737 | struct regulator_init_data *ldo1; | 740 | struct regulator_init_data *ldo1; |
| 738 | struct regulator_init_data *ldo2; | 741 | struct regulator_init_data *ldo2; |
| @@ -749,6 +752,13 @@ struct twl4030_platform_data { | |||
| 749 | struct regulator_init_data *vio6025; | 752 | struct regulator_init_data *vio6025; |
| 750 | }; | 753 | }; |
| 751 | 754 | ||
| 755 | struct twl_regulator_driver_data { | ||
| 756 | int (*set_voltage)(void *data, int target_uV); | ||
| 757 | int (*get_voltage)(void *data); | ||
| 758 | void *data; | ||
| 759 | unsigned long features; | ||
| 760 | }; | ||
| 761 | |||
| 752 | /*----------------------------------------------------------------------*/ | 762 | /*----------------------------------------------------------------------*/ |
| 753 | 763 | ||
| 754 | int twl4030_sih_setup(int module); | 764 | int twl4030_sih_setup(int module); |
diff --git a/include/linux/i2o.h b/include/linux/i2o.h index a6deef4f4f67..d23c3c20b201 100644 --- a/include/linux/i2o.h +++ b/include/linux/i2o.h | |||
| @@ -24,6 +24,7 @@ | |||
| 24 | #define I2O_MAX_DRIVERS 8 | 24 | #define I2O_MAX_DRIVERS 8 |
| 25 | 25 | ||
| 26 | #include <linux/pci.h> | 26 | #include <linux/pci.h> |
| 27 | #include <linux/bug.h> | ||
| 27 | #include <linux/dma-mapping.h> | 28 | #include <linux/dma-mapping.h> |
| 28 | #include <linux/string.h> | 29 | #include <linux/string.h> |
| 29 | #include <linux/slab.h> | 30 | #include <linux/slab.h> |
diff --git a/include/linux/ide.h b/include/linux/ide.h index 501370b61ee5..7afe15f916da 100644 --- a/include/linux/ide.h +++ b/include/linux/ide.h | |||
| @@ -14,7 +14,6 @@ | |||
| 14 | #include <linux/interrupt.h> | 14 | #include <linux/interrupt.h> |
| 15 | #include <linux/bitops.h> | 15 | #include <linux/bitops.h> |
| 16 | #include <linux/bio.h> | 16 | #include <linux/bio.h> |
| 17 | #include <linux/device.h> | ||
| 18 | #include <linux/pci.h> | 17 | #include <linux/pci.h> |
| 19 | #include <linux/completion.h> | 18 | #include <linux/completion.h> |
| 20 | #include <linux/pm.h> | 19 | #include <linux/pm.h> |
| @@ -43,6 +42,8 @@ | |||
| 43 | #define ERROR_RESET 3 /* Reset controller every 4th retry */ | 42 | #define ERROR_RESET 3 /* Reset controller every 4th retry */ |
| 44 | #define ERROR_RECAL 1 /* Recalibrate every 2nd retry */ | 43 | #define ERROR_RECAL 1 /* Recalibrate every 2nd retry */ |
| 45 | 44 | ||
| 45 | struct device; | ||
| 46 | |||
| 46 | /* Error codes returned in rq->errors to the higher part of the driver. */ | 47 | /* Error codes returned in rq->errors to the higher part of the driver. */ |
| 47 | enum { | 48 | enum { |
| 48 | IDE_DRV_ERROR_GENERAL = 101, | 49 | IDE_DRV_ERROR_GENERAL = 101, |
diff --git a/include/linux/if.h b/include/linux/if.h index 06b6ef60c821..f995c663c493 100644 --- a/include/linux/if.h +++ b/include/linux/if.h | |||
| @@ -80,6 +80,8 @@ | |||
| 80 | * skbs on transmit */ | 80 | * skbs on transmit */ |
| 81 | #define IFF_UNICAST_FLT 0x20000 /* Supports unicast filtering */ | 81 | #define IFF_UNICAST_FLT 0x20000 /* Supports unicast filtering */ |
| 82 | #define IFF_TEAM_PORT 0x40000 /* device used as team port */ | 82 | #define IFF_TEAM_PORT 0x40000 /* device used as team port */ |
| 83 | #define IFF_SUPP_NOFCS 0x80000 /* device supports sending custom FCS */ | ||
| 84 | |||
| 83 | 85 | ||
| 84 | #define IF_GET_IFACE 0x0001 /* for querying only */ | 86 | #define IF_GET_IFACE 0x0001 /* for querying only */ |
| 85 | #define IF_GET_PROTO 0x0002 | 87 | #define IF_GET_PROTO 0x0002 |
diff --git a/include/linux/if_ppp.h b/include/linux/if_ppp.h index c9ad38322576..9048fabb7a4e 100644 --- a/include/linux/if_ppp.h +++ b/include/linux/if_ppp.h | |||
| @@ -1,173 +1 @@ | |||
| 1 | /* | #include <linux/ppp-ioctl.h> | |
| 2 | * if_ppp.h - Point-to-Point Protocol definitions. | ||
| 3 | * | ||
| 4 | * Copyright (c) 1989 Carnegie Mellon University. | ||
| 5 | * All rights reserved. | ||
| 6 | * | ||
| 7 | * Redistribution and use in source and binary forms are permitted | ||
| 8 | * provided that the above copyright notice and this paragraph are | ||
| 9 | * duplicated in all such forms and that any documentation, | ||
| 10 | * advertising materials, and other materials related to such | ||
| 11 | * distribution and use acknowledge that the software was developed | ||
| 12 | * by Carnegie Mellon University. The name of the | ||
| 13 | * University may not be used to endorse or promote products derived | ||
| 14 | * from this software without specific prior written permission. | ||
| 15 | * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR | ||
| 16 | * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED | ||
| 17 | * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. | ||
| 18 | * | ||
| 19 | */ | ||
| 20 | |||
| 21 | /* | ||
| 22 | * ==FILEVERSION 20050812== | ||
| 23 | * | ||
| 24 | * NOTE TO MAINTAINERS: | ||
| 25 | * If you modify this file at all, please set the above date. | ||
| 26 | * if_ppp.h is shipped with a PPP distribution as well as with the kernel; | ||
| 27 | * if everyone increases the FILEVERSION number above, then scripts | ||
| 28 | * can do the right thing when deciding whether to install a new if_ppp.h | ||
| 29 | * file. Don't change the format of that line otherwise, so the | ||
| 30 | * installation script can recognize it. | ||
| 31 | */ | ||
| 32 | |||
| 33 | #ifndef _IF_PPP_H_ | ||
| 34 | #define _IF_PPP_H_ | ||
| 35 | |||
| 36 | #include <linux/types.h> | ||
| 37 | #include <linux/compiler.h> | ||
| 38 | |||
| 39 | /* | ||
| 40 | * Packet sizes | ||
| 41 | */ | ||
| 42 | |||
| 43 | #define PPP_MTU 1500 /* Default MTU (size of Info field) */ | ||
| 44 | #define PPP_MAXMRU 65000 /* Largest MRU we allow */ | ||
| 45 | #define PROTO_IPX 0x002b /* protocol numbers */ | ||
| 46 | #define PROTO_DNA_RT 0x0027 /* DNA Routing */ | ||
| 47 | |||
| 48 | |||
| 49 | /* | ||
| 50 | * Bit definitions for flags. | ||
| 51 | */ | ||
| 52 | |||
| 53 | #define SC_COMP_PROT 0x00000001 /* protocol compression (output) */ | ||
| 54 | #define SC_COMP_AC 0x00000002 /* header compression (output) */ | ||
| 55 | #define SC_COMP_TCP 0x00000004 /* TCP (VJ) compression (output) */ | ||
| 56 | #define SC_NO_TCP_CCID 0x00000008 /* disable VJ connection-id comp. */ | ||
| 57 | #define SC_REJ_COMP_AC 0x00000010 /* reject adrs/ctrl comp. on input */ | ||
| 58 | #define SC_REJ_COMP_TCP 0x00000020 /* reject TCP (VJ) comp. on input */ | ||
| 59 | #define SC_CCP_OPEN 0x00000040 /* Look at CCP packets */ | ||
| 60 | #define SC_CCP_UP 0x00000080 /* May send/recv compressed packets */ | ||
| 61 | #define SC_ENABLE_IP 0x00000100 /* IP packets may be exchanged */ | ||
| 62 | #define SC_LOOP_TRAFFIC 0x00000200 /* send traffic to pppd */ | ||
| 63 | #define SC_MULTILINK 0x00000400 /* do multilink encapsulation */ | ||
| 64 | #define SC_MP_SHORTSEQ 0x00000800 /* use short MP sequence numbers */ | ||
| 65 | #define SC_COMP_RUN 0x00001000 /* compressor has been inited */ | ||
| 66 | #define SC_DECOMP_RUN 0x00002000 /* decompressor has been inited */ | ||
| 67 | #define SC_MP_XSHORTSEQ 0x00004000 /* transmit short MP seq numbers */ | ||
| 68 | #define SC_DEBUG 0x00010000 /* enable debug messages */ | ||
| 69 | #define SC_LOG_INPKT 0x00020000 /* log contents of good pkts recvd */ | ||
| 70 | #define SC_LOG_OUTPKT 0x00040000 /* log contents of pkts sent */ | ||
| 71 | #define SC_LOG_RAWIN 0x00080000 /* log all chars received */ | ||
| 72 | #define SC_LOG_FLUSH 0x00100000 /* log all chars flushed */ | ||
| 73 | #define SC_SYNC 0x00200000 /* synchronous serial mode */ | ||
| 74 | #define SC_MUST_COMP 0x00400000 /* no uncompressed packets may be sent or received */ | ||
| 75 | #define SC_MASK 0x0f600fff /* bits that user can change */ | ||
| 76 | |||
| 77 | /* state bits */ | ||
| 78 | #define SC_XMIT_BUSY 0x10000000 /* (used by isdn_ppp?) */ | ||
| 79 | #define SC_RCV_ODDP 0x08000000 /* have rcvd char with odd parity */ | ||
| 80 | #define SC_RCV_EVNP 0x04000000 /* have rcvd char with even parity */ | ||
| 81 | #define SC_RCV_B7_1 0x02000000 /* have rcvd char with bit 7 = 1 */ | ||
| 82 | #define SC_RCV_B7_0 0x01000000 /* have rcvd char with bit 7 = 0 */ | ||
| 83 | #define SC_DC_FERROR 0x00800000 /* fatal decomp error detected */ | ||
| 84 | #define SC_DC_ERROR 0x00400000 /* non-fatal decomp error detected */ | ||
| 85 | |||
| 86 | /* | ||
| 87 | * Ioctl definitions. | ||
| 88 | */ | ||
| 89 | |||
| 90 | struct npioctl { | ||
| 91 | int protocol; /* PPP protocol, e.g. PPP_IP */ | ||
| 92 | enum NPmode mode; | ||
| 93 | }; | ||
| 94 | |||
| 95 | /* Structure describing a CCP configuration option, for PPPIOCSCOMPRESS */ | ||
| 96 | struct ppp_option_data { | ||
| 97 | __u8 __user *ptr; | ||
| 98 | __u32 length; | ||
| 99 | int transmit; | ||
| 100 | }; | ||
| 101 | |||
| 102 | struct ifpppstatsreq { | ||
| 103 | struct ifreq b; | ||
| 104 | struct ppp_stats stats; /* statistic information */ | ||
| 105 | }; | ||
| 106 | |||
| 107 | struct ifpppcstatsreq { | ||
| 108 | struct ifreq b; | ||
| 109 | struct ppp_comp_stats stats; | ||
| 110 | }; | ||
| 111 | |||
| 112 | /* For PPPIOCGL2TPSTATS */ | ||
| 113 | struct pppol2tp_ioc_stats { | ||
| 114 | __u16 tunnel_id; /* redundant */ | ||
| 115 | __u16 session_id; /* if zero, get tunnel stats */ | ||
| 116 | __u32 using_ipsec:1; /* valid only for session_id == 0 */ | ||
| 117 | __aligned_u64 tx_packets; | ||
| 118 | __aligned_u64 tx_bytes; | ||
| 119 | __aligned_u64 tx_errors; | ||
| 120 | __aligned_u64 rx_packets; | ||
| 121 | __aligned_u64 rx_bytes; | ||
| 122 | __aligned_u64 rx_seq_discards; | ||
| 123 | __aligned_u64 rx_oos_packets; | ||
| 124 | __aligned_u64 rx_errors; | ||
| 125 | }; | ||
| 126 | |||
| 127 | #define ifr__name b.ifr_ifrn.ifrn_name | ||
| 128 | #define stats_ptr b.ifr_ifru.ifru_data | ||
| 129 | |||
| 130 | /* | ||
| 131 | * Ioctl definitions. | ||
| 132 | */ | ||
| 133 | |||
| 134 | #define PPPIOCGFLAGS _IOR('t', 90, int) /* get configuration flags */ | ||
| 135 | #define PPPIOCSFLAGS _IOW('t', 89, int) /* set configuration flags */ | ||
| 136 | #define PPPIOCGASYNCMAP _IOR('t', 88, int) /* get async map */ | ||
| 137 | #define PPPIOCSASYNCMAP _IOW('t', 87, int) /* set async map */ | ||
| 138 | #define PPPIOCGUNIT _IOR('t', 86, int) /* get ppp unit number */ | ||
| 139 | #define PPPIOCGRASYNCMAP _IOR('t', 85, int) /* get receive async map */ | ||
| 140 | #define PPPIOCSRASYNCMAP _IOW('t', 84, int) /* set receive async map */ | ||
| 141 | #define PPPIOCGMRU _IOR('t', 83, int) /* get max receive unit */ | ||
| 142 | #define PPPIOCSMRU _IOW('t', 82, int) /* set max receive unit */ | ||
| 143 | #define PPPIOCSMAXCID _IOW('t', 81, int) /* set VJ max slot ID */ | ||
| 144 | #define PPPIOCGXASYNCMAP _IOR('t', 80, ext_accm) /* get extended ACCM */ | ||
| 145 | #define PPPIOCSXASYNCMAP _IOW('t', 79, ext_accm) /* set extended ACCM */ | ||
| 146 | #define PPPIOCXFERUNIT _IO('t', 78) /* transfer PPP unit */ | ||
| 147 | #define PPPIOCSCOMPRESS _IOW('t', 77, struct ppp_option_data) | ||
| 148 | #define PPPIOCGNPMODE _IOWR('t', 76, struct npioctl) /* get NP mode */ | ||
| 149 | #define PPPIOCSNPMODE _IOW('t', 75, struct npioctl) /* set NP mode */ | ||
| 150 | #define PPPIOCSPASS _IOW('t', 71, struct sock_fprog) /* set pass filter */ | ||
| 151 | #define PPPIOCSACTIVE _IOW('t', 70, struct sock_fprog) /* set active filt */ | ||
| 152 | #define PPPIOCGDEBUG _IOR('t', 65, int) /* Read debug level */ | ||
| 153 | #define PPPIOCSDEBUG _IOW('t', 64, int) /* Set debug level */ | ||
| 154 | #define PPPIOCGIDLE _IOR('t', 63, struct ppp_idle) /* get idle time */ | ||
| 155 | #define PPPIOCNEWUNIT _IOWR('t', 62, int) /* create new ppp unit */ | ||
| 156 | #define PPPIOCATTACH _IOW('t', 61, int) /* attach to ppp unit */ | ||
| 157 | #define PPPIOCDETACH _IOW('t', 60, int) /* detach from ppp unit/chan */ | ||
| 158 | #define PPPIOCSMRRU _IOW('t', 59, int) /* set multilink MRU */ | ||
| 159 | #define PPPIOCCONNECT _IOW('t', 58, int) /* connect channel to unit */ | ||
| 160 | #define PPPIOCDISCONN _IO('t', 57) /* disconnect channel */ | ||
| 161 | #define PPPIOCATTCHAN _IOW('t', 56, int) /* attach to ppp channel */ | ||
| 162 | #define PPPIOCGCHAN _IOR('t', 55, int) /* get ppp channel number */ | ||
| 163 | #define PPPIOCGL2TPSTATS _IOR('t', 54, struct pppol2tp_ioc_stats) | ||
| 164 | |||
| 165 | #define SIOCGPPPSTATS (SIOCDEVPRIVATE + 0) | ||
| 166 | #define SIOCGPPPVER (SIOCDEVPRIVATE + 1) /* NEVER change this!! */ | ||
| 167 | #define SIOCGPPPCSTATS (SIOCDEVPRIVATE + 2) | ||
| 168 | |||
| 169 | #if !defined(ifr_mtu) | ||
| 170 | #define ifr_mtu ifr_ifru.ifru_metric | ||
| 171 | #endif | ||
| 172 | |||
| 173 | #endif /* _IF_PPP_H_ */ | ||
diff --git a/include/linux/if_vlan.h b/include/linux/if_vlan.h index 13aff1e2183b..a810987cb80e 100644 --- a/include/linux/if_vlan.h +++ b/include/linux/if_vlan.h | |||
| @@ -17,11 +17,11 @@ | |||
| 17 | #include <linux/netdevice.h> | 17 | #include <linux/netdevice.h> |
| 18 | #include <linux/etherdevice.h> | 18 | #include <linux/etherdevice.h> |
| 19 | #include <linux/rtnetlink.h> | 19 | #include <linux/rtnetlink.h> |
| 20 | #include <linux/bug.h> | ||
| 20 | 21 | ||
| 21 | #define VLAN_HLEN 4 /* The additional bytes (on top of the Ethernet header) | 22 | #define VLAN_HLEN 4 /* The additional bytes required by VLAN |
| 22 | * that VLAN requires. | 23 | * (in addition to the Ethernet header) |
| 23 | */ | 24 | */ |
| 24 | #define VLAN_ETH_ALEN 6 /* Octets in one ethernet addr */ | ||
| 25 | #define VLAN_ETH_HLEN 18 /* Total octets in header. */ | 25 | #define VLAN_ETH_HLEN 18 /* Total octets in header. */ |
| 26 | #define VLAN_ETH_ZLEN 64 /* Min. octets in frame sans FCS */ | 26 | #define VLAN_ETH_ZLEN 64 /* Min. octets in frame sans FCS */ |
| 27 | 27 | ||
| @@ -177,7 +177,7 @@ static inline struct sk_buff *vlan_insert_tag(struct sk_buff *skb, u16 vlan_tci) | |||
| 177 | veth = (struct vlan_ethhdr *)skb_push(skb, VLAN_HLEN); | 177 | veth = (struct vlan_ethhdr *)skb_push(skb, VLAN_HLEN); |
| 178 | 178 | ||
| 179 | /* Move the mac addresses to the beginning of the new header. */ | 179 | /* Move the mac addresses to the beginning of the new header. */ |
| 180 | memmove(skb->data, skb->data + VLAN_HLEN, 2 * VLAN_ETH_ALEN); | 180 | memmove(skb->data, skb->data + VLAN_HLEN, 2 * ETH_ALEN); |
| 181 | skb->mac_header -= VLAN_HLEN; | 181 | skb->mac_header -= VLAN_HLEN; |
| 182 | 182 | ||
| 183 | /* first, the ethernet type */ | 183 | /* first, the ethernet type */ |
diff --git a/include/linux/in.h b/include/linux/in.h index 01129c0ea87c..e0337f11d92e 100644 --- a/include/linux/in.h +++ b/include/linux/in.h | |||
| @@ -111,6 +111,7 @@ struct in_addr { | |||
| 111 | #define MCAST_LEAVE_SOURCE_GROUP 47 | 111 | #define MCAST_LEAVE_SOURCE_GROUP 47 |
| 112 | #define MCAST_MSFILTER 48 | 112 | #define MCAST_MSFILTER 48 |
| 113 | #define IP_MULTICAST_ALL 49 | 113 | #define IP_MULTICAST_ALL 49 |
| 114 | #define IP_UNICAST_IF 50 | ||
| 114 | 115 | ||
| 115 | #define MCAST_EXCLUDE 0 | 116 | #define MCAST_EXCLUDE 0 |
| 116 | #define MCAST_INCLUDE 1 | 117 | #define MCAST_INCLUDE 1 |
diff --git a/include/linux/in6.h b/include/linux/in6.h index 097a34b55560..5c83d9e3eb8f 100644 --- a/include/linux/in6.h +++ b/include/linux/in6.h | |||
| @@ -271,6 +271,7 @@ struct in6_flowlabel_req { | |||
| 271 | #define IPV6_ORIGDSTADDR 74 | 271 | #define IPV6_ORIGDSTADDR 74 |
| 272 | #define IPV6_RECVORIGDSTADDR IPV6_ORIGDSTADDR | 272 | #define IPV6_RECVORIGDSTADDR IPV6_ORIGDSTADDR |
| 273 | #define IPV6_TRANSPARENT 75 | 273 | #define IPV6_TRANSPARENT 75 |
| 274 | #define IPV6_UNICAST_IF 76 | ||
| 274 | 275 | ||
| 275 | /* | 276 | /* |
| 276 | * Multicast Routing: | 277 | * Multicast Routing: |
diff --git a/include/linux/inetdevice.h b/include/linux/inetdevice.h index 5f8146695b7f..597f4a9f3240 100644 --- a/include/linux/inetdevice.h +++ b/include/linux/inetdevice.h | |||
| @@ -139,6 +139,7 @@ static inline void ipv4_devconf_setall(struct in_device *in_dev) | |||
| 139 | IN_DEV_ORCONF((in_dev), ACCEPT_REDIRECTS))) | 139 | IN_DEV_ORCONF((in_dev), ACCEPT_REDIRECTS))) |
| 140 | 140 | ||
| 141 | #define IN_DEV_ARPFILTER(in_dev) IN_DEV_ORCONF((in_dev), ARPFILTER) | 141 | #define IN_DEV_ARPFILTER(in_dev) IN_DEV_ORCONF((in_dev), ARPFILTER) |
| 142 | #define IN_DEV_ARP_ACCEPT(in_dev) IN_DEV_ORCONF((in_dev), ARP_ACCEPT) | ||
| 142 | #define IN_DEV_ARP_ANNOUNCE(in_dev) IN_DEV_MAXCONF((in_dev), ARP_ANNOUNCE) | 143 | #define IN_DEV_ARP_ANNOUNCE(in_dev) IN_DEV_MAXCONF((in_dev), ARP_ANNOUNCE) |
| 143 | #define IN_DEV_ARP_IGNORE(in_dev) IN_DEV_MAXCONF((in_dev), ARP_IGNORE) | 144 | #define IN_DEV_ARP_IGNORE(in_dev) IN_DEV_MAXCONF((in_dev), ARP_IGNORE) |
| 144 | #define IN_DEV_ARP_NOTIFY(in_dev) IN_DEV_MAXCONF((in_dev), ARP_NOTIFY) | 145 | #define IN_DEV_ARP_NOTIFY(in_dev) IN_DEV_MAXCONF((in_dev), ARP_NOTIFY) |
diff --git a/include/linux/init_task.h b/include/linux/init_task.h index 9c66b1ada9d7..e4baff5f7ff4 100644 --- a/include/linux/init_task.h +++ b/include/linux/init_task.h | |||
| @@ -29,6 +29,13 @@ extern struct fs_struct init_fs; | |||
| 29 | #define INIT_GROUP_RWSEM(sig) | 29 | #define INIT_GROUP_RWSEM(sig) |
| 30 | #endif | 30 | #endif |
| 31 | 31 | ||
| 32 | #ifdef CONFIG_CPUSETS | ||
| 33 | #define INIT_CPUSET_SEQ \ | ||
| 34 | .mems_allowed_seq = SEQCNT_ZERO, | ||
| 35 | #else | ||
| 36 | #define INIT_CPUSET_SEQ | ||
| 37 | #endif | ||
| 38 | |||
| 32 | #define INIT_SIGNALS(sig) { \ | 39 | #define INIT_SIGNALS(sig) { \ |
| 33 | .nr_threads = 1, \ | 40 | .nr_threads = 1, \ |
| 34 | .wait_chldexit = __WAIT_QUEUE_HEAD_INITIALIZER(sig.wait_chldexit),\ | 41 | .wait_chldexit = __WAIT_QUEUE_HEAD_INITIALIZER(sig.wait_chldexit),\ |
| @@ -149,7 +156,7 @@ extern struct cred init_cred; | |||
| 149 | }, \ | 156 | }, \ |
| 150 | .rt = { \ | 157 | .rt = { \ |
| 151 | .run_list = LIST_HEAD_INIT(tsk.rt.run_list), \ | 158 | .run_list = LIST_HEAD_INIT(tsk.rt.run_list), \ |
| 152 | .time_slice = HZ, \ | 159 | .time_slice = RR_TIMESLICE, \ |
| 153 | .nr_cpus_allowed = NR_CPUS, \ | 160 | .nr_cpus_allowed = NR_CPUS, \ |
| 154 | }, \ | 161 | }, \ |
| 155 | .tasks = LIST_HEAD_INIT(tsk.tasks), \ | 162 | .tasks = LIST_HEAD_INIT(tsk.tasks), \ |
| @@ -192,6 +199,7 @@ extern struct cred init_cred; | |||
| 192 | INIT_FTRACE_GRAPH \ | 199 | INIT_FTRACE_GRAPH \ |
| 193 | INIT_TRACE_RECURSION \ | 200 | INIT_TRACE_RECURSION \ |
| 194 | INIT_TASK_RCU_PREEMPT(tsk) \ | 201 | INIT_TASK_RCU_PREEMPT(tsk) \ |
| 202 | INIT_CPUSET_SEQ \ | ||
| 195 | } | 203 | } |
| 196 | 204 | ||
| 197 | 205 | ||
diff --git a/include/linux/input.h b/include/linux/input.h index 3862e32c4eeb..a81671453575 100644 --- a/include/linux/input.h +++ b/include/linux/input.h | |||
| @@ -114,6 +114,31 @@ struct input_keymap_entry { | |||
| 114 | #define EVIOCGUNIQ(len) _IOC(_IOC_READ, 'E', 0x08, len) /* get unique identifier */ | 114 | #define EVIOCGUNIQ(len) _IOC(_IOC_READ, 'E', 0x08, len) /* get unique identifier */ |
| 115 | #define EVIOCGPROP(len) _IOC(_IOC_READ, 'E', 0x09, len) /* get device properties */ | 115 | #define EVIOCGPROP(len) _IOC(_IOC_READ, 'E', 0x09, len) /* get device properties */ |
| 116 | 116 | ||
| 117 | /** | ||
| 118 | * EVIOCGMTSLOTS(len) - get MT slot values | ||
| 119 | * | ||
| 120 | * The ioctl buffer argument should be binary equivalent to | ||
| 121 | * | ||
| 122 | * struct input_mt_request_layout { | ||
| 123 | * __u32 code; | ||
| 124 | * __s32 values[num_slots]; | ||
| 125 | * }; | ||
| 126 | * | ||
| 127 | * where num_slots is the (arbitrary) number of MT slots to extract. | ||
| 128 | * | ||
| 129 | * The ioctl size argument (len) is the size of the buffer, which | ||
| 130 | * should satisfy len = (num_slots + 1) * sizeof(__s32). If len is | ||
| 131 | * too small to fit all available slots, the first num_slots are | ||
| 132 | * returned. | ||
| 133 | * | ||
| 134 | * Before the call, code is set to the wanted ABS_MT event type. On | ||
| 135 | * return, values[] is filled with the slot values for the specified | ||
| 136 | * ABS_MT code. | ||
| 137 | * | ||
| 138 | * If the request code is not an ABS_MT value, -EINVAL is returned. | ||
| 139 | */ | ||
| 140 | #define EVIOCGMTSLOTS(len) _IOC(_IOC_READ, 'E', 0x0a, len) | ||
| 141 | |||
| 117 | #define EVIOCGKEY(len) _IOC(_IOC_READ, 'E', 0x18, len) /* get global key state */ | 142 | #define EVIOCGKEY(len) _IOC(_IOC_READ, 'E', 0x18, len) /* get global key state */ |
| 118 | #define EVIOCGLED(len) _IOC(_IOC_READ, 'E', 0x19, len) /* get all LEDs */ | 143 | #define EVIOCGLED(len) _IOC(_IOC_READ, 'E', 0x19, len) /* get all LEDs */ |
| 119 | #define EVIOCGSND(len) _IOC(_IOC_READ, 'E', 0x1a, len) /* get all sounds status */ | 144 | #define EVIOCGSND(len) _IOC(_IOC_READ, 'E', 0x1a, len) /* get all sounds status */ |
| @@ -129,6 +154,8 @@ struct input_keymap_entry { | |||
| 129 | 154 | ||
| 130 | #define EVIOCGRAB _IOW('E', 0x90, int) /* Grab/Release device */ | 155 | #define EVIOCGRAB _IOW('E', 0x90, int) /* Grab/Release device */ |
| 131 | 156 | ||
| 157 | #define EVIOCSCLOCKID _IOW('E', 0xa0, int) /* Set clockid to be used for timestamps */ | ||
| 158 | |||
| 132 | /* | 159 | /* |
| 133 | * Device properties and quirks | 160 | * Device properties and quirks |
| 134 | */ | 161 | */ |
diff --git a/include/linux/input/cyttsp.h b/include/linux/input/cyttsp.h new file mode 100644 index 000000000000..5af7c66f1fca --- /dev/null +++ b/include/linux/input/cyttsp.h | |||
| @@ -0,0 +1,58 @@ | |||
| 1 | /* | ||
| 2 | * Header file for: | ||
| 3 | * Cypress TrueTouch(TM) Standard Product (TTSP) touchscreen drivers. | ||
| 4 | * For use with Cypress Txx3xx parts. | ||
| 5 | * Supported parts include: | ||
| 6 | * CY8CTST341 | ||
| 7 | * CY8CTMA340 | ||
| 8 | * | ||
| 9 | * Copyright (C) 2009, 2010, 2011 Cypress Semiconductor, Inc. | ||
| 10 | * Copyright (C) 2012 Javier Martinez Canillas <javier@dowhile0.org> | ||
| 11 | * | ||
| 12 | * This program is free software; you can redistribute it and/or | ||
| 13 | * modify it under the terms of the GNU General Public License | ||
| 14 | * version 2, and only version 2, as published by the | ||
| 15 | * Free Software Foundation. | ||
| 16 | * | ||
| 17 | * This program is distributed in the hope that it will be useful, | ||
| 18 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 19 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 20 | * GNU General Public License for more details. | ||
| 21 | * | ||
| 22 | * You should have received a copy of the GNU General Public License along | ||
| 23 | * with this program; if not, write to the Free Software Foundation, Inc., | ||
| 24 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | ||
| 25 | * | ||
| 26 | * Contact Cypress Semiconductor at www.cypress.com (kev@cypress.com) | ||
| 27 | * | ||
| 28 | */ | ||
| 29 | #ifndef _CYTTSP_H_ | ||
| 30 | #define _CYTTSP_H_ | ||
| 31 | |||
| 32 | #define CY_SPI_NAME "cyttsp-spi" | ||
| 33 | #define CY_I2C_NAME "cyttsp-i2c" | ||
| 34 | /* Active Power state scanning/processing refresh interval */ | ||
| 35 | #define CY_ACT_INTRVL_DFLT 0x00 /* ms */ | ||
| 36 | /* touch timeout for the Active power */ | ||
| 37 | #define CY_TCH_TMOUT_DFLT 0xFF /* ms */ | ||
| 38 | /* Low Power state scanning/processing refresh interval */ | ||
| 39 | #define CY_LP_INTRVL_DFLT 0x0A /* ms */ | ||
| 40 | /* Active distance in pixels for a gesture to be reported */ | ||
| 41 | #define CY_ACT_DIST_DFLT 0xF8 /* pixels */ | ||
| 42 | |||
| 43 | struct cyttsp_platform_data { | ||
| 44 | u32 maxx; | ||
| 45 | u32 maxy; | ||
| 46 | bool use_hndshk; | ||
| 47 | u8 act_dist; /* Active distance */ | ||
| 48 | u8 act_intrvl; /* Active refresh interval; ms */ | ||
| 49 | u8 tch_tmout; /* Active touch timeout; ms */ | ||
| 50 | u8 lp_intrvl; /* Low power refresh interval; ms */ | ||
| 51 | int (*init)(void); | ||
| 52 | void (*exit)(void); | ||
| 53 | char *name; | ||
| 54 | s16 irq_gpio; | ||
| 55 | u8 *bl_keys; | ||
| 56 | }; | ||
| 57 | |||
| 58 | #endif /* _CYTTSP_H_ */ | ||
diff --git a/include/linux/input/ili210x.h b/include/linux/input/ili210x.h new file mode 100644 index 000000000000..a5471245a13c --- /dev/null +++ b/include/linux/input/ili210x.h | |||
| @@ -0,0 +1,10 @@ | |||
| 1 | #ifndef _ILI210X_H | ||
| 2 | #define _ILI210X_H | ||
| 3 | |||
| 4 | struct ili210x_platform_data { | ||
| 5 | unsigned long irq_flags; | ||
| 6 | unsigned int poll_period; | ||
| 7 | bool (*get_pendown_state)(void); | ||
| 8 | }; | ||
| 9 | |||
| 10 | #endif | ||
diff --git a/include/linux/input/kxtj9.h b/include/linux/input/kxtj9.h index f6bac89537b8..d415579b56fe 100644 --- a/include/linux/input/kxtj9.h +++ b/include/linux/input/kxtj9.h | |||
| @@ -24,6 +24,7 @@ | |||
| 24 | 24 | ||
| 25 | struct kxtj9_platform_data { | 25 | struct kxtj9_platform_data { |
| 26 | unsigned int min_interval; /* minimum poll interval (in milli-seconds) */ | 26 | unsigned int min_interval; /* minimum poll interval (in milli-seconds) */ |
| 27 | unsigned int init_interval; /* initial poll interval (in milli-seconds) */ | ||
| 27 | 28 | ||
| 28 | /* | 29 | /* |
| 29 | * By default, x is axis 0, y is axis 1, z is axis 2; these can be | 30 | * By default, x is axis 0, y is axis 1, z is axis 2; these can be |
| @@ -52,16 +53,6 @@ struct kxtj9_platform_data { | |||
| 52 | #define KXTJ9_G_8G (1 << 4) | 53 | #define KXTJ9_G_8G (1 << 4) |
| 53 | u8 g_range; | 54 | u8 g_range; |
| 54 | 55 | ||
| 55 | /* DATA_CTRL_REG: controls the output data rate of the part */ | ||
| 56 | #define ODR12_5F 0 | ||
| 57 | #define ODR25F 1 | ||
| 58 | #define ODR50F 2 | ||
| 59 | #define ODR100F 3 | ||
| 60 | #define ODR200F 4 | ||
| 61 | #define ODR400F 5 | ||
| 62 | #define ODR800F 6 | ||
| 63 | u8 data_odr_init; | ||
| 64 | |||
| 65 | int (*init)(void); | 56 | int (*init)(void); |
| 66 | void (*exit)(void); | 57 | void (*exit)(void); |
| 67 | int (*power_on)(void); | 58 | int (*power_on)(void); |
diff --git a/include/linux/input/matrix_keypad.h b/include/linux/input/matrix_keypad.h index fe7c4b9ae270..6c07ced0af81 100644 --- a/include/linux/input/matrix_keypad.h +++ b/include/linux/input/matrix_keypad.h | |||
| @@ -3,6 +3,7 @@ | |||
| 3 | 3 | ||
| 4 | #include <linux/types.h> | 4 | #include <linux/types.h> |
| 5 | #include <linux/input.h> | 5 | #include <linux/input.h> |
| 6 | #include <linux/of.h> | ||
| 6 | 7 | ||
| 7 | #define MATRIX_MAX_ROWS 32 | 8 | #define MATRIX_MAX_ROWS 32 |
| 8 | #define MATRIX_MAX_COLS 32 | 9 | #define MATRIX_MAX_COLS 32 |
| @@ -106,4 +107,22 @@ matrix_keypad_build_keymap(const struct matrix_keymap_data *keymap_data, | |||
| 106 | __clear_bit(KEY_RESERVED, keybit); | 107 | __clear_bit(KEY_RESERVED, keybit); |
| 107 | } | 108 | } |
| 108 | 109 | ||
| 110 | #ifdef CONFIG_INPUT_OF_MATRIX_KEYMAP | ||
| 111 | struct matrix_keymap_data * | ||
| 112 | matrix_keyboard_of_fill_keymap(struct device_node *np, const char *propname); | ||
| 113 | |||
| 114 | void matrix_keyboard_of_free_keymap(const struct matrix_keymap_data *kd); | ||
| 115 | #else | ||
| 116 | static inline struct matrix_keymap_data * | ||
| 117 | matrix_keyboard_of_fill_keymap(struct device_node *np, const char *propname) | ||
| 118 | { | ||
| 119 | return NULL; | ||
| 120 | } | ||
| 121 | |||
| 122 | static inline void | ||
| 123 | matrix_keyboard_of_free_keymap(const struct matrix_keymap_data *kd) | ||
| 124 | { | ||
| 125 | } | ||
| 126 | #endif | ||
| 127 | |||
| 109 | #endif /* _MATRIX_KEYPAD_H */ | 128 | #endif /* _MATRIX_KEYPAD_H */ |
diff --git a/include/linux/input/mt.h b/include/linux/input/mt.h index 318bb82325a6..f86737586e19 100644 --- a/include/linux/input/mt.h +++ b/include/linux/input/mt.h | |||
| @@ -48,10 +48,14 @@ static inline void input_mt_slot(struct input_dev *dev, int slot) | |||
| 48 | input_event(dev, EV_ABS, ABS_MT_SLOT, slot); | 48 | input_event(dev, EV_ABS, ABS_MT_SLOT, slot); |
| 49 | } | 49 | } |
| 50 | 50 | ||
| 51 | static inline bool input_is_mt_value(int axis) | ||
| 52 | { | ||
| 53 | return axis >= ABS_MT_FIRST && axis <= ABS_MT_LAST; | ||
| 54 | } | ||
| 55 | |||
| 51 | static inline bool input_is_mt_axis(int axis) | 56 | static inline bool input_is_mt_axis(int axis) |
| 52 | { | 57 | { |
| 53 | return axis == ABS_MT_SLOT || | 58 | return axis == ABS_MT_SLOT || input_is_mt_value(axis); |
| 54 | (axis >= ABS_MT_FIRST && axis <= ABS_MT_LAST); | ||
| 55 | } | 59 | } |
| 56 | 60 | ||
| 57 | void input_mt_report_slot_state(struct input_dev *dev, | 61 | void input_mt_report_slot_state(struct input_dev *dev, |
diff --git a/include/linux/input/ti_tscadc.h b/include/linux/input/ti_tscadc.h new file mode 100644 index 000000000000..b10a527a92a4 --- /dev/null +++ b/include/linux/input/ti_tscadc.h | |||
| @@ -0,0 +1,17 @@ | |||
| 1 | #ifndef __LINUX_TI_TSCADC_H | ||
| 2 | #define __LINUX_TI_TSCADC_H | ||
| 3 | |||
| 4 | /** | ||
| 5 | * struct tsc_data Touchscreen wire configuration | ||
| 6 | * @wires: Wires refer to application modes | ||
| 7 | * i.e. 4/5/8 wire touchscreen support | ||
| 8 | * on the platform. | ||
| 9 | * @x_plate_resistance: X plate resistance. | ||
| 10 | */ | ||
| 11 | |||
| 12 | struct tsc_data { | ||
| 13 | int wires; | ||
| 14 | int x_plate_resistance; | ||
| 15 | }; | ||
| 16 | |||
| 17 | #endif | ||
diff --git a/include/linux/io-mapping.h b/include/linux/io-mapping.h index e44e84f0156c..657fab4efab3 100644 --- a/include/linux/io-mapping.h +++ b/include/linux/io-mapping.h | |||
| @@ -20,6 +20,7 @@ | |||
| 20 | 20 | ||
| 21 | #include <linux/types.h> | 21 | #include <linux/types.h> |
| 22 | #include <linux/slab.h> | 22 | #include <linux/slab.h> |
| 23 | #include <linux/bug.h> | ||
| 23 | #include <asm/io.h> | 24 | #include <asm/io.h> |
| 24 | #include <asm/page.h> | 25 | #include <asm/page.h> |
| 25 | 26 | ||
diff --git a/include/linux/iocontext.h b/include/linux/iocontext.h index 119773eebe31..1a3018063034 100644 --- a/include/linux/iocontext.h +++ b/include/linux/iocontext.h | |||
| @@ -6,8 +6,11 @@ | |||
| 6 | #include <linux/workqueue.h> | 6 | #include <linux/workqueue.h> |
| 7 | 7 | ||
| 8 | enum { | 8 | enum { |
| 9 | ICQ_IOPRIO_CHANGED, | 9 | ICQ_IOPRIO_CHANGED = 1 << 0, |
| 10 | ICQ_CGROUP_CHANGED, | 10 | ICQ_CGROUP_CHANGED = 1 << 1, |
| 11 | ICQ_EXITED = 1 << 2, | ||
| 12 | |||
| 13 | ICQ_CHANGED_MASK = ICQ_IOPRIO_CHANGED | ICQ_CGROUP_CHANGED, | ||
| 11 | }; | 14 | }; |
| 12 | 15 | ||
| 13 | /* | 16 | /* |
| @@ -88,7 +91,7 @@ struct io_cq { | |||
| 88 | struct rcu_head __rcu_head; | 91 | struct rcu_head __rcu_head; |
| 89 | }; | 92 | }; |
| 90 | 93 | ||
| 91 | unsigned long changed; | 94 | unsigned int flags; |
| 92 | }; | 95 | }; |
| 93 | 96 | ||
| 94 | /* | 97 | /* |
| @@ -139,6 +142,7 @@ struct io_context *get_task_io_context(struct task_struct *task, | |||
| 139 | gfp_t gfp_flags, int node); | 142 | gfp_t gfp_flags, int node); |
| 140 | void ioc_ioprio_changed(struct io_context *ioc, int ioprio); | 143 | void ioc_ioprio_changed(struct io_context *ioc, int ioprio); |
| 141 | void ioc_cgroup_changed(struct io_context *ioc); | 144 | void ioc_cgroup_changed(struct io_context *ioc); |
| 145 | unsigned int icq_get_changed(struct io_cq *icq); | ||
| 142 | #else | 146 | #else |
| 143 | struct io_context; | 147 | struct io_context; |
| 144 | static inline void put_io_context(struct io_context *ioc) { } | 148 | static inline void put_io_context(struct io_context *ioc) { } |
diff --git a/include/linux/ioport.h b/include/linux/ioport.h index 9d57a71775b5..e885ba23de70 100644 --- a/include/linux/ioport.h +++ b/include/linux/ioport.h | |||
| @@ -23,12 +23,6 @@ struct resource { | |||
| 23 | struct resource *parent, *sibling, *child; | 23 | struct resource *parent, *sibling, *child; |
| 24 | }; | 24 | }; |
| 25 | 25 | ||
| 26 | struct resource_list { | ||
| 27 | struct resource_list *next; | ||
| 28 | struct resource *res; | ||
| 29 | struct pci_dev *dev; | ||
| 30 | }; | ||
| 31 | |||
| 32 | /* | 26 | /* |
| 33 | * IO resources have these defined flags. | 27 | * IO resources have these defined flags. |
| 34 | */ | 28 | */ |
diff --git a/include/linux/ipmi.h b/include/linux/ipmi.h index bbd156bb953b..48dcba9b2065 100644 --- a/include/linux/ipmi.h +++ b/include/linux/ipmi.h | |||
| @@ -220,10 +220,10 @@ struct kernel_ipmi_msg { | |||
| 220 | * The in-kernel interface. | 220 | * The in-kernel interface. |
| 221 | */ | 221 | */ |
| 222 | #include <linux/list.h> | 222 | #include <linux/list.h> |
| 223 | #include <linux/device.h> | ||
| 224 | #include <linux/proc_fs.h> | 223 | #include <linux/proc_fs.h> |
| 225 | 224 | ||
| 226 | struct module; | 225 | struct module; |
| 226 | struct device; | ||
| 227 | 227 | ||
| 228 | /* Opaque type for a IPMI message user. One of these is needed to | 228 | /* Opaque type for a IPMI message user. One of these is needed to |
| 229 | send and receive messages. */ | 229 | send and receive messages. */ |
diff --git a/include/linux/ipmi_smi.h b/include/linux/ipmi_smi.h index 3ef0d8b6aa6f..fcb5d44ea635 100644 --- a/include/linux/ipmi_smi.h +++ b/include/linux/ipmi_smi.h | |||
| @@ -36,10 +36,11 @@ | |||
| 36 | 36 | ||
| 37 | #include <linux/ipmi_msgdefs.h> | 37 | #include <linux/ipmi_msgdefs.h> |
| 38 | #include <linux/proc_fs.h> | 38 | #include <linux/proc_fs.h> |
| 39 | #include <linux/device.h> | ||
| 40 | #include <linux/platform_device.h> | 39 | #include <linux/platform_device.h> |
| 41 | #include <linux/ipmi.h> | 40 | #include <linux/ipmi.h> |
| 42 | 41 | ||
| 42 | struct device; | ||
| 43 | |||
| 43 | /* This files describes the interface for IPMI system management interface | 44 | /* This files describes the interface for IPMI system management interface |
| 44 | drivers to bind into the IPMI message handler. */ | 45 | drivers to bind into the IPMI message handler. */ |
| 45 | 46 | ||
diff --git a/include/linux/ipv6.h b/include/linux/ipv6.h index 6318268dcaf5..8260ef779762 100644 --- a/include/linux/ipv6.h +++ b/include/linux/ipv6.h | |||
| @@ -233,6 +233,11 @@ static inline struct ipv6hdr *ipipv6_hdr(const struct sk_buff *skb) | |||
| 233 | return (struct ipv6hdr *)skb_transport_header(skb); | 233 | return (struct ipv6hdr *)skb_transport_header(skb); |
| 234 | } | 234 | } |
| 235 | 235 | ||
| 236 | static inline __u8 ipv6_tclass(const struct ipv6hdr *iph) | ||
| 237 | { | ||
| 238 | return (ntohl(*(__be32 *)iph) >> 20) & 0xff; | ||
| 239 | } | ||
| 240 | |||
| 236 | /* | 241 | /* |
| 237 | This structure contains results of exthdrs parsing | 242 | This structure contains results of exthdrs parsing |
| 238 | as offsets from skb->nh. | 243 | as offsets from skb->nh. |
| @@ -324,6 +329,7 @@ struct ipv6_pinfo { | |||
| 324 | __unused_2:6; | 329 | __unused_2:6; |
| 325 | __s16 mcast_hops:9; | 330 | __s16 mcast_hops:9; |
| 326 | #endif | 331 | #endif |
| 332 | int ucast_oif; | ||
| 327 | int mcast_oif; | 333 | int mcast_oif; |
| 328 | 334 | ||
| 329 | /* pktoption flags */ | 335 | /* pktoption flags */ |
| @@ -360,7 +366,7 @@ struct ipv6_pinfo { | |||
| 360 | dontfrag:1; | 366 | dontfrag:1; |
| 361 | __u8 min_hopcount; | 367 | __u8 min_hopcount; |
| 362 | __u8 tclass; | 368 | __u8 tclass; |
| 363 | __u8 padding; | 369 | __u8 rcv_tclass; |
| 364 | 370 | ||
| 365 | __u32 dst_cookie; | 371 | __u32 dst_cookie; |
| 366 | 372 | ||
diff --git a/include/linux/irqdomain.h b/include/linux/irqdomain.h index bd4272b61a14..ead4a4215797 100644 --- a/include/linux/irqdomain.h +++ b/include/linux/irqdomain.h | |||
| @@ -9,99 +9,182 @@ | |||
| 9 | * representation into a hardware irq number that can be mapped back to a | 9 | * representation into a hardware irq number that can be mapped back to a |
| 10 | * Linux irq number without any extra platform support code. | 10 | * Linux irq number without any extra platform support code. |
| 11 | * | 11 | * |
| 12 | * irq_domain is expected to be embedded in an interrupt controller's private | 12 | * Interrupt controller "domain" data structure. This could be defined as a |
| 13 | * data structure. | 13 | * irq domain controller. That is, it handles the mapping between hardware |
| 14 | * and virtual interrupt numbers for a given interrupt domain. The domain | ||
| 15 | * structure is generally created by the PIC code for a given PIC instance | ||
| 16 | * (though a domain can cover more than one PIC if they have a flat number | ||
| 17 | * model). It's the domain callbacks that are responsible for setting the | ||
| 18 | * irq_chip on a given irq_desc after it's been mapped. | ||
| 19 | * | ||
| 20 | * The host code and data structures are agnostic to whether or not | ||
| 21 | * we use an open firmware device-tree. We do have references to struct | ||
| 22 | * device_node in two places: in irq_find_host() to find the host matching | ||
| 23 | * a given interrupt controller node, and of course as an argument to its | ||
| 24 | * counterpart domain->ops->match() callback. However, those are treated as | ||
| 25 | * generic pointers by the core and the fact that it's actually a device-node | ||
| 26 | * pointer is purely a convention between callers and implementation. This | ||
| 27 | * code could thus be used on other architectures by replacing those two | ||
| 28 | * by some sort of arch-specific void * "token" used to identify interrupt | ||
| 29 | * controllers. | ||
| 14 | */ | 30 | */ |
| 31 | |||
| 15 | #ifndef _LINUX_IRQDOMAIN_H | 32 | #ifndef _LINUX_IRQDOMAIN_H |
| 16 | #define _LINUX_IRQDOMAIN_H | 33 | #define _LINUX_IRQDOMAIN_H |
| 17 | 34 | ||
| 18 | #include <linux/irq.h> | 35 | #include <linux/types.h> |
| 19 | #include <linux/mod_devicetable.h> | 36 | #include <linux/radix-tree.h> |
| 20 | 37 | ||
| 21 | #ifdef CONFIG_IRQ_DOMAIN | ||
| 22 | struct device_node; | 38 | struct device_node; |
| 23 | struct irq_domain; | 39 | struct irq_domain; |
| 40 | struct of_device_id; | ||
| 41 | |||
| 42 | /* Number of irqs reserved for a legacy isa controller */ | ||
| 43 | #define NUM_ISA_INTERRUPTS 16 | ||
| 44 | |||
| 45 | /* This type is the placeholder for a hardware interrupt number. It has to | ||
| 46 | * be big enough to enclose whatever representation is used by a given | ||
| 47 | * platform. | ||
| 48 | */ | ||
| 49 | typedef unsigned long irq_hw_number_t; | ||
| 24 | 50 | ||
| 25 | /** | 51 | /** |
| 26 | * struct irq_domain_ops - Methods for irq_domain objects | 52 | * struct irq_domain_ops - Methods for irq_domain objects |
| 27 | * @to_irq: (optional) given a local hardware irq number, return the linux | 53 | * @match: Match an interrupt controller device node to a host, returns |
| 28 | * irq number. If to_irq is not implemented, then the irq_domain | 54 | * 1 on a match |
| 29 | * will use this translation: irq = (domain->irq_base + hwirq) | 55 | * @map: Create or update a mapping between a virtual irq number and a hw |
| 30 | * @dt_translate: Given a device tree node and interrupt specifier, decode | 56 | * irq number. This is called only once for a given mapping. |
| 31 | * the hardware irq number and linux irq type value. | 57 | * @unmap: Dispose of such a mapping |
| 58 | * @xlate: Given a device tree node and interrupt specifier, decode | ||
| 59 | * the hardware irq number and linux irq type value. | ||
| 60 | * | ||
| 61 | * Functions below are provided by the driver and called whenever a new mapping | ||
| 62 | * is created or an old mapping is disposed. The driver can then proceed to | ||
| 63 | * whatever internal data structures management is required. It also needs | ||
| 64 | * to setup the irq_desc when returning from map(). | ||
| 32 | */ | 65 | */ |
| 33 | struct irq_domain_ops { | 66 | struct irq_domain_ops { |
| 34 | unsigned int (*to_irq)(struct irq_domain *d, unsigned long hwirq); | 67 | int (*match)(struct irq_domain *d, struct device_node *node); |
| 35 | 68 | int (*map)(struct irq_domain *d, unsigned int virq, irq_hw_number_t hw); | |
| 36 | #ifdef CONFIG_OF | 69 | void (*unmap)(struct irq_domain *d, unsigned int virq); |
| 37 | int (*dt_translate)(struct irq_domain *d, struct device_node *node, | 70 | int (*xlate)(struct irq_domain *d, struct device_node *node, |
| 38 | const u32 *intspec, unsigned int intsize, | 71 | const u32 *intspec, unsigned int intsize, |
| 39 | unsigned long *out_hwirq, unsigned int *out_type); | 72 | unsigned long *out_hwirq, unsigned int *out_type); |
| 40 | #endif /* CONFIG_OF */ | ||
| 41 | }; | 73 | }; |
| 42 | 74 | ||
| 43 | /** | 75 | /** |
| 44 | * struct irq_domain - Hardware interrupt number translation object | 76 | * struct irq_domain - Hardware interrupt number translation object |
| 45 | * @list: Element in global irq_domain list. | 77 | * @link: Element in global irq_domain list. |
| 78 | * @revmap_type: Method used for reverse mapping hwirq numbers to linux irq. This | ||
| 79 | * will be one of the IRQ_DOMAIN_MAP_* values. | ||
| 80 | * @revmap_data: Revmap method specific data. | ||
| 81 | * @ops: pointer to irq_domain methods | ||
| 82 | * @host_data: private data pointer for use by owner. Not touched by irq_domain | ||
| 83 | * core code. | ||
| 46 | * @irq_base: Start of irq_desc range assigned to the irq_domain. The creator | 84 | * @irq_base: Start of irq_desc range assigned to the irq_domain. The creator |
| 47 | * of the irq_domain is responsible for allocating the array of | 85 | * of the irq_domain is responsible for allocating the array of |
| 48 | * irq_desc structures. | 86 | * irq_desc structures. |
| 49 | * @nr_irq: Number of irqs managed by the irq domain | 87 | * @nr_irq: Number of irqs managed by the irq domain |
| 50 | * @hwirq_base: Starting number for hwirqs managed by the irq domain | 88 | * @hwirq_base: Starting number for hwirqs managed by the irq domain |
| 51 | * @ops: pointer to irq_domain methods | ||
| 52 | * @priv: private data pointer for use by owner. Not touched by irq_domain | ||
| 53 | * core code. | ||
| 54 | * @of_node: (optional) Pointer to device tree nodes associated with the | 89 | * @of_node: (optional) Pointer to device tree nodes associated with the |
| 55 | * irq_domain. Used when decoding device tree interrupt specifiers. | 90 | * irq_domain. Used when decoding device tree interrupt specifiers. |
| 56 | */ | 91 | */ |
| 57 | struct irq_domain { | 92 | struct irq_domain { |
| 58 | struct list_head list; | 93 | struct list_head link; |
| 59 | unsigned int irq_base; | 94 | |
| 60 | unsigned int nr_irq; | 95 | /* type of reverse mapping_technique */ |
| 61 | unsigned int hwirq_base; | 96 | unsigned int revmap_type; |
| 97 | union { | ||
| 98 | struct { | ||
| 99 | unsigned int size; | ||
| 100 | unsigned int first_irq; | ||
| 101 | irq_hw_number_t first_hwirq; | ||
| 102 | } legacy; | ||
| 103 | struct { | ||
| 104 | unsigned int size; | ||
| 105 | unsigned int *revmap; | ||
| 106 | } linear; | ||
| 107 | struct radix_tree_root tree; | ||
| 108 | } revmap_data; | ||
| 62 | const struct irq_domain_ops *ops; | 109 | const struct irq_domain_ops *ops; |
| 63 | void *priv; | 110 | void *host_data; |
| 111 | irq_hw_number_t inval_irq; | ||
| 112 | |||
| 113 | /* Optional device node pointer */ | ||
| 64 | struct device_node *of_node; | 114 | struct device_node *of_node; |
| 65 | }; | 115 | }; |
| 66 | 116 | ||
| 67 | /** | 117 | #ifdef CONFIG_IRQ_DOMAIN |
| 68 | * irq_domain_to_irq() - Translate from a hardware irq to a linux irq number | 118 | struct irq_domain *irq_domain_add_legacy(struct device_node *of_node, |
| 69 | * | 119 | unsigned int size, |
| 70 | * Returns the linux irq number associated with a hardware irq. By default, | 120 | unsigned int first_irq, |
| 71 | * the mapping is irq == domain->irq_base + hwirq, but this mapping can | 121 | irq_hw_number_t first_hwirq, |
| 72 | * be overridden if the irq_domain implements a .to_irq() hook. | 122 | const struct irq_domain_ops *ops, |
| 73 | */ | 123 | void *host_data); |
| 74 | static inline unsigned int irq_domain_to_irq(struct irq_domain *d, | 124 | struct irq_domain *irq_domain_add_linear(struct device_node *of_node, |
| 75 | unsigned long hwirq) | 125 | unsigned int size, |
| 126 | const struct irq_domain_ops *ops, | ||
| 127 | void *host_data); | ||
| 128 | struct irq_domain *irq_domain_add_nomap(struct device_node *of_node, | ||
| 129 | const struct irq_domain_ops *ops, | ||
| 130 | void *host_data); | ||
| 131 | struct irq_domain *irq_domain_add_tree(struct device_node *of_node, | ||
| 132 | const struct irq_domain_ops *ops, | ||
| 133 | void *host_data); | ||
| 134 | |||
| 135 | extern struct irq_domain *irq_find_host(struct device_node *node); | ||
| 136 | extern void irq_set_default_host(struct irq_domain *host); | ||
| 137 | extern void irq_set_virq_count(unsigned int count); | ||
| 138 | |||
| 139 | static inline struct irq_domain *irq_domain_add_legacy_isa( | ||
| 140 | struct device_node *of_node, | ||
| 141 | const struct irq_domain_ops *ops, | ||
| 142 | void *host_data) | ||
| 76 | { | 143 | { |
| 77 | if (d->ops->to_irq) | 144 | return irq_domain_add_legacy(of_node, NUM_ISA_INTERRUPTS, 0, 0, ops, |
| 78 | return d->ops->to_irq(d, hwirq); | 145 | host_data); |
| 79 | if (WARN_ON(hwirq < d->hwirq_base)) | ||
| 80 | return 0; | ||
| 81 | return d->irq_base + hwirq - d->hwirq_base; | ||
| 82 | } | 146 | } |
| 147 | extern struct irq_domain *irq_find_host(struct device_node *node); | ||
| 148 | extern void irq_set_default_host(struct irq_domain *host); | ||
| 149 | extern void irq_set_virq_count(unsigned int count); | ||
| 83 | 150 | ||
| 84 | #define irq_domain_for_each_hwirq(d, hw) \ | ||
| 85 | for (hw = d->hwirq_base; hw < d->hwirq_base + d->nr_irq; hw++) | ||
| 86 | 151 | ||
| 87 | #define irq_domain_for_each_irq(d, hw, irq) \ | 152 | extern unsigned int irq_create_mapping(struct irq_domain *host, |
| 88 | for (hw = d->hwirq_base, irq = irq_domain_to_irq(d, hw); \ | 153 | irq_hw_number_t hwirq); |
| 89 | hw < d->hwirq_base + d->nr_irq; \ | 154 | extern void irq_dispose_mapping(unsigned int virq); |
| 90 | hw++, irq = irq_domain_to_irq(d, hw)) | 155 | extern unsigned int irq_find_mapping(struct irq_domain *host, |
| 156 | irq_hw_number_t hwirq); | ||
| 157 | extern unsigned int irq_create_direct_mapping(struct irq_domain *host); | ||
| 158 | extern void irq_radix_revmap_insert(struct irq_domain *host, unsigned int virq, | ||
| 159 | irq_hw_number_t hwirq); | ||
| 160 | extern unsigned int irq_radix_revmap_lookup(struct irq_domain *host, | ||
| 161 | irq_hw_number_t hwirq); | ||
| 162 | extern unsigned int irq_linear_revmap(struct irq_domain *host, | ||
| 163 | irq_hw_number_t hwirq); | ||
| 91 | 164 | ||
| 92 | extern void irq_domain_add(struct irq_domain *domain); | 165 | extern const struct irq_domain_ops irq_domain_simple_ops; |
| 93 | extern void irq_domain_del(struct irq_domain *domain); | ||
| 94 | 166 | ||
| 95 | extern struct irq_domain_ops irq_domain_simple_ops; | 167 | /* stock xlate functions */ |
| 96 | #endif /* CONFIG_IRQ_DOMAIN */ | 168 | int irq_domain_xlate_onecell(struct irq_domain *d, struct device_node *ctrlr, |
| 169 | const u32 *intspec, unsigned int intsize, | ||
| 170 | irq_hw_number_t *out_hwirq, unsigned int *out_type); | ||
| 171 | int irq_domain_xlate_twocell(struct irq_domain *d, struct device_node *ctrlr, | ||
| 172 | const u32 *intspec, unsigned int intsize, | ||
| 173 | irq_hw_number_t *out_hwirq, unsigned int *out_type); | ||
| 174 | int irq_domain_xlate_onetwocell(struct irq_domain *d, struct device_node *ctrlr, | ||
| 175 | const u32 *intspec, unsigned int intsize, | ||
| 176 | irq_hw_number_t *out_hwirq, unsigned int *out_type); | ||
| 97 | 177 | ||
| 98 | #if defined(CONFIG_IRQ_DOMAIN) && defined(CONFIG_OF_IRQ) | 178 | #if defined(CONFIG_OF_IRQ) |
| 99 | extern void irq_domain_add_simple(struct device_node *controller, int irq_base); | ||
| 100 | extern void irq_domain_generate_simple(const struct of_device_id *match, | 179 | extern void irq_domain_generate_simple(const struct of_device_id *match, |
| 101 | u64 phys_base, unsigned int irq_start); | 180 | u64 phys_base, unsigned int irq_start); |
| 102 | #else /* CONFIG_IRQ_DOMAIN && CONFIG_OF_IRQ */ | 181 | #else /* CONFIG_OF_IRQ */ |
| 103 | static inline void irq_domain_generate_simple(const struct of_device_id *match, | 182 | static inline void irq_domain_generate_simple(const struct of_device_id *match, |
| 104 | u64 phys_base, unsigned int irq_start) { } | 183 | u64 phys_base, unsigned int irq_start) { } |
| 105 | #endif /* CONFIG_IRQ_DOMAIN && CONFIG_OF_IRQ */ | 184 | #endif /* !CONFIG_OF_IRQ */ |
| 185 | |||
| 186 | #else /* CONFIG_IRQ_DOMAIN */ | ||
| 187 | static inline void irq_dispose_mapping(unsigned int virq) { } | ||
| 188 | #endif /* !CONFIG_IRQ_DOMAIN */ | ||
| 106 | 189 | ||
| 107 | #endif /* _LINUX_IRQDOMAIN_H */ | 190 | #endif /* _LINUX_IRQDOMAIN_H */ |
diff --git a/include/linux/isdn.h b/include/linux/isdn.h index 4ccf95d681b4..292f27a793d4 100644 --- a/include/linux/isdn.h +++ b/include/linux/isdn.h | |||
| @@ -187,7 +187,7 @@ typedef struct { | |||
| 187 | #endif | 187 | #endif |
| 188 | 188 | ||
| 189 | #include <linux/ppp_defs.h> | 189 | #include <linux/ppp_defs.h> |
| 190 | #include <linux/if_ppp.h> | 190 | #include <linux/ppp-ioctl.h> |
| 191 | 191 | ||
| 192 | #include <linux/isdn_ppp.h> | 192 | #include <linux/isdn_ppp.h> |
| 193 | #endif | 193 | #endif |
diff --git a/include/linux/ivtv.h b/include/linux/ivtv.h index 062d20f74322..42bf725751af 100644 --- a/include/linux/ivtv.h +++ b/include/linux/ivtv.h | |||
| @@ -58,7 +58,11 @@ struct ivtv_dma_frame { | |||
| 58 | __u32 src_height; | 58 | __u32 src_height; |
| 59 | }; | 59 | }; |
| 60 | 60 | ||
| 61 | #define IVTV_IOC_DMA_FRAME _IOW ('V', BASE_VIDIOC_PRIVATE+0, struct ivtv_dma_frame) | 61 | #define IVTV_IOC_DMA_FRAME _IOW ('V', BASE_VIDIOC_PRIVATE+0, struct ivtv_dma_frame) |
| 62 | |||
| 63 | /* Select the passthrough mode (if the argument is non-zero). In the passthrough | ||
| 64 | mode the output of the encoder is passed immediately into the decoder. */ | ||
| 65 | #define IVTV_IOC_PASSTHROUGH_MODE _IOW ('V', BASE_VIDIOC_PRIVATE+1, int) | ||
| 62 | 66 | ||
| 63 | /* Deprecated defines: applications should use the defines from videodev2.h */ | 67 | /* Deprecated defines: applications should use the defines from videodev2.h */ |
| 64 | #define IVTV_SLICED_TYPE_TELETEXT_B V4L2_MPEG_VBI_IVTV_TELETEXT_B | 68 | #define IVTV_SLICED_TYPE_TELETEXT_B V4L2_MPEG_VBI_IVTV_TELETEXT_B |
diff --git a/include/linux/jz4740-adc.h b/include/linux/jz4740-adc.h index 9053f95e9687..8184578fbfa4 100644 --- a/include/linux/jz4740-adc.h +++ b/include/linux/jz4740-adc.h | |||
| @@ -2,7 +2,7 @@ | |||
| 2 | #ifndef __LINUX_JZ4740_ADC | 2 | #ifndef __LINUX_JZ4740_ADC |
| 3 | #define __LINUX_JZ4740_ADC | 3 | #define __LINUX_JZ4740_ADC |
| 4 | 4 | ||
| 5 | #include <linux/device.h> | 5 | struct device; |
| 6 | 6 | ||
| 7 | /* | 7 | /* |
| 8 | * jz4740_adc_set_config - Configure a JZ4740 adc device | 8 | * jz4740_adc_set_config - Configure a JZ4740 adc device |
diff --git a/include/linux/kbd_kern.h b/include/linux/kbd_kern.h index ec2d17bc1f1e..daf4a3a40ee0 100644 --- a/include/linux/kbd_kern.h +++ b/include/linux/kbd_kern.h | |||
| @@ -7,8 +7,6 @@ | |||
| 7 | 7 | ||
| 8 | extern struct tasklet_struct keyboard_tasklet; | 8 | extern struct tasklet_struct keyboard_tasklet; |
| 9 | 9 | ||
| 10 | extern int shift_state; | ||
| 11 | |||
| 12 | extern char *func_table[MAX_NR_FUNC]; | 10 | extern char *func_table[MAX_NR_FUNC]; |
| 13 | extern char func_buf[]; | 11 | extern char func_buf[]; |
| 14 | extern char *funcbufptr; | 12 | extern char *funcbufptr; |
| @@ -65,8 +63,6 @@ struct kbd_struct { | |||
| 65 | #define VC_META 4 /* 0 - meta, 1 - meta=prefix with ESC */ | 63 | #define VC_META 4 /* 0 - meta, 1 - meta=prefix with ESC */ |
| 66 | }; | 64 | }; |
| 67 | 65 | ||
| 68 | extern struct kbd_struct kbd_table[]; | ||
| 69 | |||
| 70 | extern int kbd_init(void); | 66 | extern int kbd_init(void); |
| 71 | 67 | ||
| 72 | extern unsigned char getledstate(void); | 68 | extern unsigned char getledstate(void); |
| @@ -79,6 +75,7 @@ extern void (*kbd_ledfunc)(unsigned int led); | |||
| 79 | extern int set_console(int nr); | 75 | extern int set_console(int nr); |
| 80 | extern void schedule_console_callback(void); | 76 | extern void schedule_console_callback(void); |
| 81 | 77 | ||
| 78 | /* FIXME: review locking for vt.c callers */ | ||
| 82 | static inline void set_leds(void) | 79 | static inline void set_leds(void) |
| 83 | { | 80 | { |
| 84 | tasklet_schedule(&keyboard_tasklet); | 81 | tasklet_schedule(&keyboard_tasklet); |
| @@ -142,8 +139,6 @@ static inline void chg_vc_kbd_led(struct kbd_struct * kbd, int flag) | |||
| 142 | 139 | ||
| 143 | struct console; | 140 | struct console; |
| 144 | 141 | ||
| 145 | int getkeycode(unsigned int scancode); | ||
| 146 | int setkeycode(unsigned int scancode, unsigned int keycode); | ||
| 147 | void compute_shiftstate(void); | 142 | void compute_shiftstate(void); |
| 148 | 143 | ||
| 149 | /* defkeymap.c */ | 144 | /* defkeymap.c */ |
diff --git a/include/linux/kernel-page-flags.h b/include/linux/kernel-page-flags.h index bd92a89f4b0a..26a65711676f 100644 --- a/include/linux/kernel-page-flags.h +++ b/include/linux/kernel-page-flags.h | |||
| @@ -30,6 +30,7 @@ | |||
| 30 | #define KPF_NOPAGE 20 | 30 | #define KPF_NOPAGE 20 |
| 31 | 31 | ||
| 32 | #define KPF_KSM 21 | 32 | #define KPF_KSM 21 |
| 33 | #define KPF_THP 22 | ||
| 33 | 34 | ||
| 34 | /* kernel hacking assistances | 35 | /* kernel hacking assistances |
| 35 | * WARNING: subject to change, never rely on them! | 36 | * WARNING: subject to change, never rely on them! |
diff --git a/include/linux/kernel.h b/include/linux/kernel.h index e8343422240a..92c10262d346 100644 --- a/include/linux/kernel.h +++ b/include/linux/kernel.h | |||
| @@ -20,7 +20,6 @@ | |||
| 20 | #include <linux/printk.h> | 20 | #include <linux/printk.h> |
| 21 | #include <linux/dynamic_debug.h> | 21 | #include <linux/dynamic_debug.h> |
| 22 | #include <asm/byteorder.h> | 22 | #include <asm/byteorder.h> |
| 23 | #include <asm/bug.h> | ||
| 24 | 23 | ||
| 25 | #define USHRT_MAX ((u16)(~0U)) | 24 | #define USHRT_MAX ((u16)(~0U)) |
| 26 | #define SHRT_MAX ((s16)(USHRT_MAX>>1)) | 25 | #define SHRT_MAX ((s16)(USHRT_MAX>>1)) |
| @@ -85,6 +84,19 @@ | |||
| 85 | } \ | 84 | } \ |
| 86 | ) | 85 | ) |
| 87 | 86 | ||
| 87 | /* | ||
| 88 | * Multiplies an integer by a fraction, while avoiding unnecessary | ||
| 89 | * overflow or loss of precision. | ||
| 90 | */ | ||
| 91 | #define mult_frac(x, numer, denom)( \ | ||
| 92 | { \ | ||
| 93 | typeof(x) quot = (x) / (denom); \ | ||
| 94 | typeof(x) rem = (x) % (denom); \ | ||
| 95 | (quot * (numer)) + ((rem * (numer)) / (denom)); \ | ||
| 96 | } \ | ||
| 97 | ) | ||
| 98 | |||
| 99 | |||
| 88 | #define _RET_IP_ (unsigned long)__builtin_return_address(0) | 100 | #define _RET_IP_ (unsigned long)__builtin_return_address(0) |
| 89 | #define _THIS_IP_ ({ __label__ __here; __here: (unsigned long)&&__here; }) | 101 | #define _THIS_IP_ ({ __label__ __here; __here: (unsigned long)&&__here; }) |
| 90 | 102 | ||
| @@ -299,6 +311,8 @@ extern long long simple_strtoll(const char *,char **,unsigned int); | |||
| 299 | #define strict_strtoull kstrtoull | 311 | #define strict_strtoull kstrtoull |
| 300 | #define strict_strtoll kstrtoll | 312 | #define strict_strtoll kstrtoll |
| 301 | 313 | ||
| 314 | extern int num_to_str(char *buf, int size, unsigned long long num); | ||
| 315 | |||
| 302 | /* lib/printf utilities */ | 316 | /* lib/printf utilities */ |
| 303 | 317 | ||
| 304 | extern __printf(2, 3) int sprintf(char *buf, const char * fmt, ...); | 318 | extern __printf(2, 3) int sprintf(char *buf, const char * fmt, ...); |
| @@ -315,10 +329,10 @@ extern __printf(2, 3) | |||
| 315 | char *kasprintf(gfp_t gfp, const char *fmt, ...); | 329 | char *kasprintf(gfp_t gfp, const char *fmt, ...); |
| 316 | extern char *kvasprintf(gfp_t gfp, const char *fmt, va_list args); | 330 | extern char *kvasprintf(gfp_t gfp, const char *fmt, va_list args); |
| 317 | 331 | ||
| 318 | extern int sscanf(const char *, const char *, ...) | 332 | extern __scanf(2, 3) |
| 319 | __attribute__ ((format (scanf, 2, 3))); | 333 | int sscanf(const char *, const char *, ...); |
| 320 | extern int vsscanf(const char *, const char *, va_list) | 334 | extern __scanf(2, 0) |
| 321 | __attribute__ ((format (scanf, 2, 0))); | 335 | int vsscanf(const char *, const char *, va_list); |
| 322 | 336 | ||
| 323 | extern int get_option(char **str, int *pint); | 337 | extern int get_option(char **str, int *pint); |
| 324 | extern char *get_options(const char *str, int nints, int *ints); | 338 | extern char *get_options(const char *str, int nints, int *ints); |
| @@ -414,16 +428,10 @@ extern int __must_check hex2bin(u8 *dst, const char *src, size_t count); | |||
| 414 | * Most likely, you want to use tracing_on/tracing_off. | 428 | * Most likely, you want to use tracing_on/tracing_off. |
| 415 | */ | 429 | */ |
| 416 | #ifdef CONFIG_RING_BUFFER | 430 | #ifdef CONFIG_RING_BUFFER |
| 417 | void tracing_on(void); | ||
| 418 | void tracing_off(void); | ||
| 419 | /* trace_off_permanent stops recording with no way to bring it back */ | 431 | /* trace_off_permanent stops recording with no way to bring it back */ |
| 420 | void tracing_off_permanent(void); | 432 | void tracing_off_permanent(void); |
| 421 | int tracing_is_on(void); | ||
| 422 | #else | 433 | #else |
| 423 | static inline void tracing_on(void) { } | ||
| 424 | static inline void tracing_off(void) { } | ||
| 425 | static inline void tracing_off_permanent(void) { } | 434 | static inline void tracing_off_permanent(void) { } |
| 426 | static inline int tracing_is_on(void) { return 0; } | ||
| 427 | #endif | 435 | #endif |
| 428 | 436 | ||
| 429 | enum ftrace_dump_mode { | 437 | enum ftrace_dump_mode { |
| @@ -433,6 +441,10 @@ enum ftrace_dump_mode { | |||
| 433 | }; | 441 | }; |
| 434 | 442 | ||
| 435 | #ifdef CONFIG_TRACING | 443 | #ifdef CONFIG_TRACING |
| 444 | void tracing_on(void); | ||
| 445 | void tracing_off(void); | ||
| 446 | int tracing_is_on(void); | ||
| 447 | |||
| 436 | extern void tracing_start(void); | 448 | extern void tracing_start(void); |
| 437 | extern void tracing_stop(void); | 449 | extern void tracing_stop(void); |
| 438 | extern void ftrace_off_permanent(void); | 450 | extern void ftrace_off_permanent(void); |
| @@ -517,6 +529,11 @@ static inline void tracing_start(void) { } | |||
| 517 | static inline void tracing_stop(void) { } | 529 | static inline void tracing_stop(void) { } |
| 518 | static inline void ftrace_off_permanent(void) { } | 530 | static inline void ftrace_off_permanent(void) { } |
| 519 | static inline void trace_dump_stack(void) { } | 531 | static inline void trace_dump_stack(void) { } |
| 532 | |||
| 533 | static inline void tracing_on(void) { } | ||
| 534 | static inline void tracing_off(void) { } | ||
| 535 | static inline int tracing_is_on(void) { return 0; } | ||
| 536 | |||
| 520 | static inline int | 537 | static inline int |
| 521 | trace_printk(const char *fmt, ...) | 538 | trace_printk(const char *fmt, ...) |
| 522 | { | 539 | { |
| @@ -662,67 +679,6 @@ static inline void ftrace_dump(enum ftrace_dump_mode oops_dump_mode) { } | |||
| 662 | const typeof( ((type *)0)->member ) *__mptr = (ptr); \ | 679 | const typeof( ((type *)0)->member ) *__mptr = (ptr); \ |
| 663 | (type *)( (char *)__mptr - offsetof(type,member) );}) | 680 | (type *)( (char *)__mptr - offsetof(type,member) );}) |
| 664 | 681 | ||
| 665 | #ifdef __CHECKER__ | ||
| 666 | #define BUILD_BUG_ON_NOT_POWER_OF_2(n) | ||
| 667 | #define BUILD_BUG_ON_ZERO(e) (0) | ||
| 668 | #define BUILD_BUG_ON_NULL(e) ((void*)0) | ||
| 669 | #define BUILD_BUG_ON(condition) | ||
| 670 | #define BUILD_BUG() (0) | ||
| 671 | #else /* __CHECKER__ */ | ||
| 672 | |||
| 673 | /* Force a compilation error if a constant expression is not a power of 2 */ | ||
| 674 | #define BUILD_BUG_ON_NOT_POWER_OF_2(n) \ | ||
| 675 | BUILD_BUG_ON((n) == 0 || (((n) & ((n) - 1)) != 0)) | ||
| 676 | |||
| 677 | /* Force a compilation error if condition is true, but also produce a | ||
| 678 | result (of value 0 and type size_t), so the expression can be used | ||
| 679 | e.g. in a structure initializer (or where-ever else comma expressions | ||
| 680 | aren't permitted). */ | ||
| 681 | #define BUILD_BUG_ON_ZERO(e) (sizeof(struct { int:-!!(e); })) | ||
| 682 | #define BUILD_BUG_ON_NULL(e) ((void *)sizeof(struct { int:-!!(e); })) | ||
| 683 | |||
| 684 | /** | ||
| 685 | * BUILD_BUG_ON - break compile if a condition is true. | ||
| 686 | * @condition: the condition which the compiler should know is false. | ||
| 687 | * | ||
| 688 | * If you have some code which relies on certain constants being equal, or | ||
| 689 | * other compile-time-evaluated condition, you should use BUILD_BUG_ON to | ||
| 690 | * detect if someone changes it. | ||
| 691 | * | ||
| 692 | * The implementation uses gcc's reluctance to create a negative array, but | ||
| 693 | * gcc (as of 4.4) only emits that error for obvious cases (eg. not arguments | ||
| 694 | * to inline functions). So as a fallback we use the optimizer; if it can't | ||
| 695 | * prove the condition is false, it will cause a link error on the undefined | ||
| 696 | * "__build_bug_on_failed". This error message can be harder to track down | ||
| 697 | * though, hence the two different methods. | ||
| 698 | */ | ||
| 699 | #ifndef __OPTIMIZE__ | ||
| 700 | #define BUILD_BUG_ON(condition) ((void)sizeof(char[1 - 2*!!(condition)])) | ||
| 701 | #else | ||
| 702 | extern int __build_bug_on_failed; | ||
| 703 | #define BUILD_BUG_ON(condition) \ | ||
| 704 | do { \ | ||
| 705 | ((void)sizeof(char[1 - 2*!!(condition)])); \ | ||
| 706 | if (condition) __build_bug_on_failed = 1; \ | ||
| 707 | } while(0) | ||
| 708 | #endif | ||
| 709 | |||
| 710 | /** | ||
| 711 | * BUILD_BUG - break compile if used. | ||
| 712 | * | ||
| 713 | * If you have some code that you expect the compiler to eliminate at | ||
| 714 | * build time, you should use BUILD_BUG to detect if it is | ||
| 715 | * unexpectedly used. | ||
| 716 | */ | ||
| 717 | #define BUILD_BUG() \ | ||
| 718 | do { \ | ||
| 719 | extern void __build_bug_failed(void) \ | ||
| 720 | __linktime_error("BUILD_BUG failed"); \ | ||
| 721 | __build_bug_failed(); \ | ||
| 722 | } while (0) | ||
| 723 | |||
| 724 | #endif /* __CHECKER__ */ | ||
| 725 | |||
| 726 | /* Trap pasters of __FUNCTION__ at compile-time */ | 682 | /* Trap pasters of __FUNCTION__ at compile-time */ |
| 727 | #define __FUNCTION__ (__func__) | 683 | #define __FUNCTION__ (__func__) |
| 728 | 684 | ||
diff --git a/include/linux/key.h b/include/linux/key.h index 5253471cd2ea..96933b1e5d24 100644 --- a/include/linux/key.h +++ b/include/linux/key.h | |||
| @@ -155,6 +155,7 @@ struct key { | |||
| 155 | #define KEY_FLAG_IN_QUOTA 3 /* set if key consumes quota */ | 155 | #define KEY_FLAG_IN_QUOTA 3 /* set if key consumes quota */ |
| 156 | #define KEY_FLAG_USER_CONSTRUCT 4 /* set if key is being constructed in userspace */ | 156 | #define KEY_FLAG_USER_CONSTRUCT 4 /* set if key is being constructed in userspace */ |
| 157 | #define KEY_FLAG_NEGATIVE 5 /* set if key is negative */ | 157 | #define KEY_FLAG_NEGATIVE 5 /* set if key is negative */ |
| 158 | #define KEY_FLAG_ROOT_CAN_CLEAR 6 /* set if key can be cleared by root without permission */ | ||
| 158 | 159 | ||
| 159 | /* the description string | 160 | /* the description string |
| 160 | * - this is used to match a key against search criteria | 161 | * - this is used to match a key against search criteria |
| @@ -276,6 +277,8 @@ static inline key_serial_t key_serial(const struct key *key) | |||
| 276 | return key ? key->serial : 0; | 277 | return key ? key->serial : 0; |
| 277 | } | 278 | } |
| 278 | 279 | ||
| 280 | extern void key_set_timeout(struct key *, unsigned); | ||
| 281 | |||
| 279 | /** | 282 | /** |
| 280 | * key_is_instantiated - Determine if a key has been positively instantiated | 283 | * key_is_instantiated - Determine if a key has been positively instantiated |
| 281 | * @key: The key to check. | 284 | * @key: The key to check. |
diff --git a/include/linux/keyboard.h b/include/linux/keyboard.h index 33a63f62d57f..86e5214ae735 100644 --- a/include/linux/keyboard.h +++ b/include/linux/keyboard.h | |||
| @@ -24,8 +24,6 @@ | |||
| 24 | 24 | ||
| 25 | #ifdef __KERNEL__ | 25 | #ifdef __KERNEL__ |
| 26 | struct notifier_block; | 26 | struct notifier_block; |
| 27 | extern const int NR_TYPES; | ||
| 28 | extern const int max_vals[]; | ||
| 29 | extern unsigned short *key_maps[MAX_NR_KEYMAPS]; | 27 | extern unsigned short *key_maps[MAX_NR_KEYMAPS]; |
| 30 | extern unsigned short plain_map[NR_KEYS]; | 28 | extern unsigned short plain_map[NR_KEYS]; |
| 31 | 29 | ||
diff --git a/include/linux/kmod.h b/include/linux/kmod.h index 722f477c4ef7..9efeae679106 100644 --- a/include/linux/kmod.h +++ b/include/linux/kmod.h | |||
| @@ -48,11 +48,10 @@ static inline int request_module_nowait(const char *name, ...) { return -ENOSYS; | |||
| 48 | struct cred; | 48 | struct cred; |
| 49 | struct file; | 49 | struct file; |
| 50 | 50 | ||
| 51 | enum umh_wait { | 51 | #define UMH_NO_WAIT 0 /* don't wait at all */ |
| 52 | UMH_NO_WAIT = -1, /* don't wait at all */ | 52 | #define UMH_WAIT_EXEC 1 /* wait for the exec, but not the process */ |
| 53 | UMH_WAIT_EXEC = 0, /* wait for the exec, but not the process */ | 53 | #define UMH_WAIT_PROC 2 /* wait for the process to complete */ |
| 54 | UMH_WAIT_PROC = 1, /* wait for the process to complete */ | 54 | #define UMH_KILLABLE 4 /* wait for EXEC/PROC killable */ |
| 55 | }; | ||
| 56 | 55 | ||
| 57 | struct subprocess_info { | 56 | struct subprocess_info { |
| 58 | struct work_struct work; | 57 | struct work_struct work; |
| @@ -60,7 +59,7 @@ struct subprocess_info { | |||
| 60 | char *path; | 59 | char *path; |
| 61 | char **argv; | 60 | char **argv; |
| 62 | char **envp; | 61 | char **envp; |
| 63 | enum umh_wait wait; | 62 | int wait; |
| 64 | int retval; | 63 | int retval; |
| 65 | int (*init)(struct subprocess_info *info, struct cred *new); | 64 | int (*init)(struct subprocess_info *info, struct cred *new); |
| 66 | void (*cleanup)(struct subprocess_info *info); | 65 | void (*cleanup)(struct subprocess_info *info); |
| @@ -78,15 +77,14 @@ void call_usermodehelper_setfns(struct subprocess_info *info, | |||
| 78 | void *data); | 77 | void *data); |
| 79 | 78 | ||
| 80 | /* Actually execute the sub-process */ | 79 | /* Actually execute the sub-process */ |
| 81 | int call_usermodehelper_exec(struct subprocess_info *info, enum umh_wait wait); | 80 | int call_usermodehelper_exec(struct subprocess_info *info, int wait); |
| 82 | 81 | ||
| 83 | /* Free the subprocess_info. This is only needed if you're not going | 82 | /* Free the subprocess_info. This is only needed if you're not going |
| 84 | to call call_usermodehelper_exec */ | 83 | to call call_usermodehelper_exec */ |
| 85 | void call_usermodehelper_freeinfo(struct subprocess_info *info); | 84 | void call_usermodehelper_freeinfo(struct subprocess_info *info); |
| 86 | 85 | ||
| 87 | static inline int | 86 | static inline int |
| 88 | call_usermodehelper_fns(char *path, char **argv, char **envp, | 87 | call_usermodehelper_fns(char *path, char **argv, char **envp, int wait, |
| 89 | enum umh_wait wait, | ||
| 90 | int (*init)(struct subprocess_info *info, struct cred *new), | 88 | int (*init)(struct subprocess_info *info, struct cred *new), |
| 91 | void (*cleanup)(struct subprocess_info *), void *data) | 89 | void (*cleanup)(struct subprocess_info *), void *data) |
| 92 | { | 90 | { |
| @@ -104,7 +102,7 @@ call_usermodehelper_fns(char *path, char **argv, char **envp, | |||
| 104 | } | 102 | } |
| 105 | 103 | ||
| 106 | static inline int | 104 | static inline int |
| 107 | call_usermodehelper(char *path, char **argv, char **envp, enum umh_wait wait) | 105 | call_usermodehelper(char *path, char **argv, char **envp, int wait) |
| 108 | { | 106 | { |
| 109 | return call_usermodehelper_fns(path, argv, envp, wait, | 107 | return call_usermodehelper_fns(path, argv, envp, wait, |
| 110 | NULL, NULL, NULL); | 108 | NULL, NULL, NULL); |
diff --git a/include/linux/kprobes.h b/include/linux/kprobes.h index dce6e4dbeda7..b6e1f8c00577 100644 --- a/include/linux/kprobes.h +++ b/include/linux/kprobes.h | |||
| @@ -33,6 +33,7 @@ | |||
| 33 | #include <linux/list.h> | 33 | #include <linux/list.h> |
| 34 | #include <linux/notifier.h> | 34 | #include <linux/notifier.h> |
| 35 | #include <linux/smp.h> | 35 | #include <linux/smp.h> |
| 36 | #include <linux/bug.h> | ||
| 36 | #include <linux/percpu.h> | 37 | #include <linux/percpu.h> |
| 37 | #include <linux/spinlock.h> | 38 | #include <linux/spinlock.h> |
| 38 | #include <linux/rcupdate.h> | 39 | #include <linux/rcupdate.h> |
diff --git a/include/linux/kvm_host.h b/include/linux/kvm_host.h index 900c76337e8f..ca1b153585d3 100644 --- a/include/linux/kvm_host.h +++ b/include/linux/kvm_host.h | |||
| @@ -13,6 +13,7 @@ | |||
| 13 | #include <linux/spinlock.h> | 13 | #include <linux/spinlock.h> |
| 14 | #include <linux/signal.h> | 14 | #include <linux/signal.h> |
| 15 | #include <linux/sched.h> | 15 | #include <linux/sched.h> |
| 16 | #include <linux/bug.h> | ||
| 16 | #include <linux/mm.h> | 17 | #include <linux/mm.h> |
| 17 | #include <linux/mmu_notifier.h> | 18 | #include <linux/mmu_notifier.h> |
| 18 | #include <linux/preempt.h> | 19 | #include <linux/preempt.h> |
diff --git a/include/linux/led-lm3530.h b/include/linux/led-lm3530.h index 8eb12357a110..eeae6e742471 100644 --- a/include/linux/led-lm3530.h +++ b/include/linux/led-lm3530.h | |||
| @@ -72,6 +72,12 @@ enum lm3530_als_mode { | |||
| 72 | LM3530_INPUT_CEIL, /* Max of ALS1 and ALS2 */ | 72 | LM3530_INPUT_CEIL, /* Max of ALS1 and ALS2 */ |
| 73 | }; | 73 | }; |
| 74 | 74 | ||
| 75 | /* PWM Platform Specific Data */ | ||
| 76 | struct lm3530_pwm_data { | ||
| 77 | void (*pwm_set_intensity) (int brightness, int max_brightness); | ||
| 78 | int (*pwm_get_intensity) (int max_brightness); | ||
| 79 | }; | ||
| 80 | |||
| 75 | /** | 81 | /** |
| 76 | * struct lm3530_platform_data | 82 | * struct lm3530_platform_data |
| 77 | * @mode: mode of operation i.e. Manual, ALS or PWM | 83 | * @mode: mode of operation i.e. Manual, ALS or PWM |
| @@ -87,6 +93,7 @@ enum lm3530_als_mode { | |||
| 87 | * @als_vmin: als input voltage calibrated for max brightness in mV | 93 | * @als_vmin: als input voltage calibrated for max brightness in mV |
| 88 | * @als_vmax: als input voltage calibrated for min brightness in mV | 94 | * @als_vmax: als input voltage calibrated for min brightness in mV |
| 89 | * @brt_val: brightness value (0-255) | 95 | * @brt_val: brightness value (0-255) |
| 96 | * @pwm_data: PWM control functions (only valid when the mode is PWM) | ||
| 90 | */ | 97 | */ |
| 91 | struct lm3530_platform_data { | 98 | struct lm3530_platform_data { |
| 92 | enum lm3530_mode mode; | 99 | enum lm3530_mode mode; |
| @@ -107,6 +114,8 @@ struct lm3530_platform_data { | |||
| 107 | u32 als_vmax; | 114 | u32 als_vmax; |
| 108 | 115 | ||
| 109 | u8 brt_val; | 116 | u8 brt_val; |
| 117 | |||
| 118 | struct lm3530_pwm_data pwm_data; | ||
| 110 | }; | 119 | }; |
| 111 | 120 | ||
| 112 | #endif /* _LINUX_LED_LM3530_H__ */ | 121 | #endif /* _LINUX_LED_LM3530_H__ */ |
diff --git a/include/linux/leds-lp5521.h b/include/linux/leds-lp5521.h index fd548d2a8775..3f071ec019b2 100644 --- a/include/linux/leds-lp5521.h +++ b/include/linux/leds-lp5521.h | |||
| @@ -26,15 +26,37 @@ | |||
| 26 | /* See Documentation/leds/leds-lp5521.txt */ | 26 | /* See Documentation/leds/leds-lp5521.txt */ |
| 27 | 27 | ||
| 28 | struct lp5521_led_config { | 28 | struct lp5521_led_config { |
| 29 | char *name; | ||
| 29 | u8 chan_nr; | 30 | u8 chan_nr; |
| 30 | u8 led_current; /* mA x10, 0 if led is not connected */ | 31 | u8 led_current; /* mA x10, 0 if led is not connected */ |
| 31 | u8 max_current; | 32 | u8 max_current; |
| 32 | }; | 33 | }; |
| 33 | 34 | ||
| 35 | struct lp5521_led_pattern { | ||
| 36 | u8 *r; | ||
| 37 | u8 *g; | ||
| 38 | u8 *b; | ||
| 39 | u8 size_r; | ||
| 40 | u8 size_g; | ||
| 41 | u8 size_b; | ||
| 42 | }; | ||
| 43 | |||
| 34 | #define LP5521_CLOCK_AUTO 0 | 44 | #define LP5521_CLOCK_AUTO 0 |
| 35 | #define LP5521_CLOCK_INT 1 | 45 | #define LP5521_CLOCK_INT 1 |
| 36 | #define LP5521_CLOCK_EXT 2 | 46 | #define LP5521_CLOCK_EXT 2 |
| 37 | 47 | ||
| 48 | /* Bits in CONFIG register */ | ||
| 49 | #define LP5521_PWM_HF 0x40 /* PWM: 0 = 256Hz, 1 = 558Hz */ | ||
| 50 | #define LP5521_PWRSAVE_EN 0x20 /* 1 = Power save mode */ | ||
| 51 | #define LP5521_CP_MODE_OFF 0 /* Charge pump (CP) off */ | ||
| 52 | #define LP5521_CP_MODE_BYPASS 8 /* CP forced to bypass mode */ | ||
| 53 | #define LP5521_CP_MODE_1X5 0x10 /* CP forced to 1.5x mode */ | ||
| 54 | #define LP5521_CP_MODE_AUTO 0x18 /* Automatic mode selection */ | ||
| 55 | #define LP5521_R_TO_BATT 4 /* R out: 0 = CP, 1 = Vbat */ | ||
| 56 | #define LP5521_CLK_SRC_EXT 0 /* Ext-clk source (CLK_32K) */ | ||
| 57 | #define LP5521_CLK_INT 1 /* Internal clock */ | ||
| 58 | #define LP5521_CLK_AUTO 2 /* Automatic clock selection */ | ||
| 59 | |||
| 38 | struct lp5521_platform_data { | 60 | struct lp5521_platform_data { |
| 39 | struct lp5521_led_config *led_config; | 61 | struct lp5521_led_config *led_config; |
| 40 | u8 num_channels; | 62 | u8 num_channels; |
| @@ -43,6 +65,9 @@ struct lp5521_platform_data { | |||
| 43 | void (*release_resources)(void); | 65 | void (*release_resources)(void); |
| 44 | void (*enable)(bool state); | 66 | void (*enable)(bool state); |
| 45 | const char *label; | 67 | const char *label; |
| 68 | u8 update_config; | ||
| 69 | struct lp5521_led_pattern *patterns; | ||
| 70 | int num_patterns; | ||
| 46 | }; | 71 | }; |
| 47 | 72 | ||
| 48 | #endif /* __LINUX_LP5521_H */ | 73 | #endif /* __LINUX_LP5521_H */ |
diff --git a/include/linux/libata.h b/include/linux/libata.h index cafc09a64fe4..42378d637ffb 100644 --- a/include/linux/libata.h +++ b/include/linux/libata.h | |||
| @@ -996,6 +996,7 @@ extern int ata_sas_scsi_ioctl(struct ata_port *ap, struct scsi_device *dev, | |||
| 996 | extern void ata_sas_port_destroy(struct ata_port *); | 996 | extern void ata_sas_port_destroy(struct ata_port *); |
| 997 | extern struct ata_port *ata_sas_port_alloc(struct ata_host *, | 997 | extern struct ata_port *ata_sas_port_alloc(struct ata_host *, |
| 998 | struct ata_port_info *, struct Scsi_Host *); | 998 | struct ata_port_info *, struct Scsi_Host *); |
| 999 | extern int ata_sas_async_port_init(struct ata_port *); | ||
| 999 | extern int ata_sas_port_init(struct ata_port *); | 1000 | extern int ata_sas_port_init(struct ata_port *); |
| 1000 | extern int ata_sas_port_start(struct ata_port *ap); | 1001 | extern int ata_sas_port_start(struct ata_port *ap); |
| 1001 | extern void ata_sas_port_stop(struct ata_port *ap); | 1002 | extern void ata_sas_port_stop(struct ata_port *ap); |
| @@ -1147,6 +1148,7 @@ static inline int ata_acpi_cbl_80wire(struct ata_port *ap, | |||
| 1147 | * EH - drivers/ata/libata-eh.c | 1148 | * EH - drivers/ata/libata-eh.c |
| 1148 | */ | 1149 | */ |
| 1149 | extern void ata_port_schedule_eh(struct ata_port *ap); | 1150 | extern void ata_port_schedule_eh(struct ata_port *ap); |
| 1151 | extern void ata_port_wait_eh(struct ata_port *ap); | ||
| 1150 | extern int ata_link_abort(struct ata_link *link); | 1152 | extern int ata_link_abort(struct ata_link *link); |
| 1151 | extern int ata_port_abort(struct ata_port *ap); | 1153 | extern int ata_port_abort(struct ata_port *ap); |
| 1152 | extern int ata_port_freeze(struct ata_port *ap); | 1154 | extern int ata_port_freeze(struct ata_port *ap); |
diff --git a/include/linux/lockd/bind.h b/include/linux/lockd/bind.h index fbc48f898521..11a966e5f829 100644 --- a/include/linux/lockd/bind.h +++ b/include/linux/lockd/bind.h | |||
| @@ -42,6 +42,7 @@ struct nlmclnt_initdata { | |||
| 42 | unsigned short protocol; | 42 | unsigned short protocol; |
| 43 | u32 nfs_version; | 43 | u32 nfs_version; |
| 44 | int noresvport; | 44 | int noresvport; |
| 45 | struct net *net; | ||
| 45 | }; | 46 | }; |
| 46 | 47 | ||
| 47 | /* | 48 | /* |
diff --git a/include/linux/lockd/lockd.h b/include/linux/lockd/lockd.h index 88a114fce477..f04ce6ac6d04 100644 --- a/include/linux/lockd/lockd.h +++ b/include/linux/lockd/lockd.h | |||
| @@ -67,6 +67,7 @@ struct nlm_host { | |||
| 67 | struct list_head h_reclaim; /* Locks in RECLAIM state */ | 67 | struct list_head h_reclaim; /* Locks in RECLAIM state */ |
| 68 | struct nsm_handle *h_nsmhandle; /* NSM status handle */ | 68 | struct nsm_handle *h_nsmhandle; /* NSM status handle */ |
| 69 | char *h_addrbuf; /* address eyecatcher */ | 69 | char *h_addrbuf; /* address eyecatcher */ |
| 70 | struct net *net; /* host net */ | ||
| 70 | }; | 71 | }; |
| 71 | 72 | ||
| 72 | /* | 73 | /* |
| @@ -188,7 +189,7 @@ struct nlm_block { | |||
| 188 | /* | 189 | /* |
| 189 | * Global variables | 190 | * Global variables |
| 190 | */ | 191 | */ |
| 191 | extern struct rpc_program nlm_program; | 192 | extern const struct rpc_program nlm_program; |
| 192 | extern struct svc_procedure nlmsvc_procedures[]; | 193 | extern struct svc_procedure nlmsvc_procedures[]; |
| 193 | #ifdef CONFIG_LOCKD_V4 | 194 | #ifdef CONFIG_LOCKD_V4 |
| 194 | extern struct svc_procedure nlmsvc_procedures4[]; | 195 | extern struct svc_procedure nlmsvc_procedures4[]; |
| @@ -222,7 +223,8 @@ struct nlm_host *nlmclnt_lookup_host(const struct sockaddr *sap, | |||
| 222 | const unsigned short protocol, | 223 | const unsigned short protocol, |
| 223 | const u32 version, | 224 | const u32 version, |
| 224 | const char *hostname, | 225 | const char *hostname, |
| 225 | int noresvport); | 226 | int noresvport, |
| 227 | struct net *net); | ||
| 226 | void nlmclnt_release_host(struct nlm_host *); | 228 | void nlmclnt_release_host(struct nlm_host *); |
| 227 | struct nlm_host *nlmsvc_lookup_host(const struct svc_rqst *rqstp, | 229 | struct nlm_host *nlmsvc_lookup_host(const struct svc_rqst *rqstp, |
| 228 | const char *hostname, | 230 | const char *hostname, |
| @@ -232,6 +234,7 @@ struct rpc_clnt * nlm_bind_host(struct nlm_host *); | |||
| 232 | void nlm_rebind_host(struct nlm_host *); | 234 | void nlm_rebind_host(struct nlm_host *); |
| 233 | struct nlm_host * nlm_get_host(struct nlm_host *); | 235 | struct nlm_host * nlm_get_host(struct nlm_host *); |
| 234 | void nlm_shutdown_hosts(void); | 236 | void nlm_shutdown_hosts(void); |
| 237 | void nlm_shutdown_hosts_net(struct net *net); | ||
| 235 | void nlm_host_rebooted(const struct nlm_reboot *); | 238 | void nlm_host_rebooted(const struct nlm_reboot *); |
| 236 | 239 | ||
| 237 | /* | 240 | /* |
diff --git a/include/linux/lockd/xdr4.h b/include/linux/lockd/xdr4.h index 7353821341ed..e58c88b52ce1 100644 --- a/include/linux/lockd/xdr4.h +++ b/include/linux/lockd/xdr4.h | |||
| @@ -42,6 +42,6 @@ int nlmclt_encode_lockargs(struct rpc_rqst *, u32 *, struct nlm_args *); | |||
| 42 | int nlmclt_encode_cancargs(struct rpc_rqst *, u32 *, struct nlm_args *); | 42 | int nlmclt_encode_cancargs(struct rpc_rqst *, u32 *, struct nlm_args *); |
| 43 | int nlmclt_encode_unlockargs(struct rpc_rqst *, u32 *, struct nlm_args *); | 43 | int nlmclt_encode_unlockargs(struct rpc_rqst *, u32 *, struct nlm_args *); |
| 44 | */ | 44 | */ |
| 45 | extern struct rpc_version nlm_version4; | 45 | extern const struct rpc_version nlm_version4; |
| 46 | 46 | ||
| 47 | #endif /* LOCKD_XDR4_H */ | 47 | #endif /* LOCKD_XDR4_H */ |
diff --git a/include/linux/lp855x.h b/include/linux/lp855x.h new file mode 100644 index 000000000000..781a490a451b --- /dev/null +++ b/include/linux/lp855x.h | |||
| @@ -0,0 +1,131 @@ | |||
| 1 | /* | ||
| 2 | * LP855x Backlight Driver | ||
| 3 | * | ||
| 4 | * Copyright (C) 2011 Texas Instruments | ||
| 5 | * | ||
| 6 | * This program is free software; you can redistribute it and/or modify | ||
| 7 | * it under the terms of the GNU General Public License version 2 as | ||
| 8 | * published by the Free Software Foundation. | ||
| 9 | * | ||
| 10 | */ | ||
| 11 | |||
| 12 | #ifndef _LP855X_H | ||
| 13 | #define _LP855X_H | ||
| 14 | |||
| 15 | #define BL_CTL_SHFT (0) | ||
| 16 | #define BRT_MODE_SHFT (1) | ||
| 17 | #define BRT_MODE_MASK (0x06) | ||
| 18 | |||
| 19 | /* Enable backlight. Only valid when BRT_MODE=10(I2C only) */ | ||
| 20 | #define ENABLE_BL (1) | ||
| 21 | #define DISABLE_BL (0) | ||
| 22 | |||
| 23 | #define I2C_CONFIG(id) id ## _I2C_CONFIG | ||
| 24 | #define PWM_CONFIG(id) id ## _PWM_CONFIG | ||
| 25 | |||
| 26 | /* DEVICE CONTROL register - LP8550 */ | ||
| 27 | #define LP8550_PWM_CONFIG (LP8550_PWM_ONLY << BRT_MODE_SHFT) | ||
| 28 | #define LP8550_I2C_CONFIG ((ENABLE_BL << BL_CTL_SHFT) | \ | ||
| 29 | (LP8550_I2C_ONLY << BRT_MODE_SHFT)) | ||
| 30 | |||
| 31 | /* DEVICE CONTROL register - LP8551 */ | ||
| 32 | #define LP8551_PWM_CONFIG LP8550_PWM_CONFIG | ||
| 33 | #define LP8551_I2C_CONFIG LP8550_I2C_CONFIG | ||
| 34 | |||
| 35 | /* DEVICE CONTROL register - LP8552 */ | ||
| 36 | #define LP8552_PWM_CONFIG LP8550_PWM_CONFIG | ||
| 37 | #define LP8552_I2C_CONFIG LP8550_I2C_CONFIG | ||
| 38 | |||
| 39 | /* DEVICE CONTROL register - LP8553 */ | ||
| 40 | #define LP8553_PWM_CONFIG LP8550_PWM_CONFIG | ||
| 41 | #define LP8553_I2C_CONFIG LP8550_I2C_CONFIG | ||
| 42 | |||
| 43 | /* DEVICE CONTROL register - LP8556 */ | ||
| 44 | #define LP8556_PWM_CONFIG (LP8556_PWM_ONLY << BRT_MODE_SHFT) | ||
| 45 | #define LP8556_COMB1_CONFIG (LP8556_COMBINED1 << BRT_MODE_SHFT) | ||
| 46 | #define LP8556_I2C_CONFIG ((ENABLE_BL << BL_CTL_SHFT) | \ | ||
| 47 | (LP8556_I2C_ONLY << BRT_MODE_SHFT)) | ||
| 48 | #define LP8556_COMB2_CONFIG (LP8556_COMBINED2 << BRT_MODE_SHFT) | ||
| 49 | |||
| 50 | /* ROM area boundary */ | ||
| 51 | #define EEPROM_START (0xA0) | ||
| 52 | #define EEPROM_END (0xA7) | ||
| 53 | #define EPROM_START (0xA0) | ||
| 54 | #define EPROM_END (0xAF) | ||
| 55 | |||
| 56 | enum lp855x_chip_id { | ||
| 57 | LP8550, | ||
| 58 | LP8551, | ||
| 59 | LP8552, | ||
| 60 | LP8553, | ||
| 61 | LP8556, | ||
| 62 | }; | ||
| 63 | |||
| 64 | enum lp855x_brightness_ctrl_mode { | ||
| 65 | PWM_BASED = 1, | ||
| 66 | REGISTER_BASED, | ||
| 67 | }; | ||
| 68 | |||
| 69 | enum lp8550_brighntess_source { | ||
| 70 | LP8550_PWM_ONLY, | ||
| 71 | LP8550_I2C_ONLY = 2, | ||
| 72 | }; | ||
| 73 | |||
| 74 | enum lp8551_brighntess_source { | ||
| 75 | LP8551_PWM_ONLY = LP8550_PWM_ONLY, | ||
| 76 | LP8551_I2C_ONLY = LP8550_I2C_ONLY, | ||
| 77 | }; | ||
| 78 | |||
| 79 | enum lp8552_brighntess_source { | ||
| 80 | LP8552_PWM_ONLY = LP8550_PWM_ONLY, | ||
| 81 | LP8552_I2C_ONLY = LP8550_I2C_ONLY, | ||
| 82 | }; | ||
| 83 | |||
| 84 | enum lp8553_brighntess_source { | ||
| 85 | LP8553_PWM_ONLY = LP8550_PWM_ONLY, | ||
| 86 | LP8553_I2C_ONLY = LP8550_I2C_ONLY, | ||
| 87 | }; | ||
| 88 | |||
| 89 | enum lp8556_brightness_source { | ||
| 90 | LP8556_PWM_ONLY, | ||
| 91 | LP8556_COMBINED1, /* pwm + i2c before the shaper block */ | ||
| 92 | LP8556_I2C_ONLY, | ||
| 93 | LP8556_COMBINED2, /* pwm + i2c after the shaper block */ | ||
| 94 | }; | ||
| 95 | |||
| 96 | struct lp855x_pwm_data { | ||
| 97 | void (*pwm_set_intensity) (int brightness, int max_brightness); | ||
| 98 | int (*pwm_get_intensity) (int max_brightness); | ||
| 99 | }; | ||
| 100 | |||
| 101 | struct lp855x_rom_data { | ||
| 102 | u8 addr; | ||
| 103 | u8 val; | ||
| 104 | }; | ||
| 105 | |||
| 106 | /** | ||
| 107 | * struct lp855x_platform_data | ||
| 108 | * @name : Backlight driver name. If it is not defined, default name is set. | ||
| 109 | * @mode : brightness control by pwm or lp855x register | ||
| 110 | * @device_control : value of DEVICE CONTROL register | ||
| 111 | * @initial_brightness : initial value of backlight brightness | ||
| 112 | * @pwm_data : platform specific pwm generation functions. | ||
| 113 | Only valid when mode is PWM_BASED. | ||
| 114 | * @load_new_rom_data : | ||
| 115 | 0 : use default configuration data | ||
| 116 | 1 : update values of eeprom or eprom registers on loading driver | ||
| 117 | * @size_program : total size of lp855x_rom_data | ||
| 118 | * @rom_data : list of new eeprom/eprom registers | ||
| 119 | */ | ||
| 120 | struct lp855x_platform_data { | ||
| 121 | char *name; | ||
| 122 | enum lp855x_brightness_ctrl_mode mode; | ||
| 123 | u8 device_control; | ||
| 124 | int initial_brightness; | ||
| 125 | struct lp855x_pwm_data pwm_data; | ||
| 126 | u8 load_new_rom_data; | ||
| 127 | int size_program; | ||
| 128 | struct lp855x_rom_data *rom_data; | ||
| 129 | }; | ||
| 130 | |||
| 131 | #endif | ||
diff --git a/include/linux/magic.h b/include/linux/magic.h index 2d4beab0d5b7..e15192cb9cf4 100644 --- a/include/linux/magic.h +++ b/include/linux/magic.h | |||
| @@ -9,7 +9,6 @@ | |||
| 9 | #define CRAMFS_MAGIC 0x28cd3d45 /* some random number */ | 9 | #define CRAMFS_MAGIC 0x28cd3d45 /* some random number */ |
| 10 | #define CRAMFS_MAGIC_WEND 0x453dcd28 /* magic number with the wrong endianess */ | 10 | #define CRAMFS_MAGIC_WEND 0x453dcd28 /* magic number with the wrong endianess */ |
| 11 | #define DEBUGFS_MAGIC 0x64626720 | 11 | #define DEBUGFS_MAGIC 0x64626720 |
| 12 | #define SYSFS_MAGIC 0x62656572 | ||
| 13 | #define SECURITYFS_MAGIC 0x73636673 | 12 | #define SECURITYFS_MAGIC 0x73636673 |
| 14 | #define SELINUX_MAGIC 0xf97cff8c | 13 | #define SELINUX_MAGIC 0xf97cff8c |
| 15 | #define RAMFS_MAGIC 0x858458f6 /* some random number */ | 14 | #define RAMFS_MAGIC 0x858458f6 /* some random number */ |
| @@ -27,7 +26,6 @@ | |||
| 27 | #define HPFS_SUPER_MAGIC 0xf995e849 | 26 | #define HPFS_SUPER_MAGIC 0xf995e849 |
| 28 | #define ISOFS_SUPER_MAGIC 0x9660 | 27 | #define ISOFS_SUPER_MAGIC 0x9660 |
| 29 | #define JFFS2_SUPER_MAGIC 0x72b6 | 28 | #define JFFS2_SUPER_MAGIC 0x72b6 |
| 30 | #define ANON_INODE_FS_MAGIC 0x09041934 | ||
| 31 | #define PSTOREFS_MAGIC 0x6165676C | 29 | #define PSTOREFS_MAGIC 0x6165676C |
| 32 | 30 | ||
| 33 | #define MINIX_SUPER_MAGIC 0x137F /* minix v1 fs, 14 char names */ | 31 | #define MINIX_SUPER_MAGIC 0x137F /* minix v1 fs, 14 char names */ |
| @@ -40,8 +38,8 @@ | |||
| 40 | #define NCP_SUPER_MAGIC 0x564c /* Guess, what 0x564c is :-) */ | 38 | #define NCP_SUPER_MAGIC 0x564c /* Guess, what 0x564c is :-) */ |
| 41 | #define NFS_SUPER_MAGIC 0x6969 | 39 | #define NFS_SUPER_MAGIC 0x6969 |
| 42 | #define OPENPROM_SUPER_MAGIC 0x9fa1 | 40 | #define OPENPROM_SUPER_MAGIC 0x9fa1 |
| 43 | #define PROC_SUPER_MAGIC 0x9fa0 | ||
| 44 | #define QNX4_SUPER_MAGIC 0x002f /* qnx4 fs detection */ | 41 | #define QNX4_SUPER_MAGIC 0x002f /* qnx4 fs detection */ |
| 42 | #define QNX6_SUPER_MAGIC 0x68191122 /* qnx6 fs detection */ | ||
| 45 | 43 | ||
| 46 | #define REISERFS_SUPER_MAGIC 0x52654973 /* used by gcc */ | 44 | #define REISERFS_SUPER_MAGIC 0x52654973 /* used by gcc */ |
| 47 | /* used by file system utilities that | 45 | /* used by file system utilities that |
| @@ -51,15 +49,24 @@ | |||
| 51 | #define REISER2FS_JR_SUPER_MAGIC_STRING "ReIsEr3Fs" | 49 | #define REISER2FS_JR_SUPER_MAGIC_STRING "ReIsEr3Fs" |
| 52 | 50 | ||
| 53 | #define SMB_SUPER_MAGIC 0x517B | 51 | #define SMB_SUPER_MAGIC 0x517B |
| 54 | #define USBDEVICE_SUPER_MAGIC 0x9fa2 | ||
| 55 | #define CGROUP_SUPER_MAGIC 0x27e0eb | 52 | #define CGROUP_SUPER_MAGIC 0x27e0eb |
| 56 | 53 | ||
| 57 | #define FUTEXFS_SUPER_MAGIC 0xBAD1DEA | ||
| 58 | 54 | ||
| 59 | #define STACK_END_MAGIC 0x57AC6E9D | 55 | #define STACK_END_MAGIC 0x57AC6E9D |
| 60 | 56 | ||
| 57 | #define V9FS_MAGIC 0x01021997 | ||
| 58 | |||
| 59 | #define BDEVFS_MAGIC 0x62646576 | ||
| 60 | #define BINFMTFS_MAGIC 0x42494e4d | ||
| 61 | #define DEVPTS_SUPER_MAGIC 0x1cd1 | 61 | #define DEVPTS_SUPER_MAGIC 0x1cd1 |
| 62 | #define FUTEXFS_SUPER_MAGIC 0xBAD1DEA | ||
| 63 | #define PIPEFS_MAGIC 0x50495045 | ||
| 64 | #define PROC_SUPER_MAGIC 0x9fa0 | ||
| 62 | #define SOCKFS_MAGIC 0x534F434B | 65 | #define SOCKFS_MAGIC 0x534F434B |
| 63 | #define V9FS_MAGIC 0x01021997 | 66 | #define SYSFS_MAGIC 0x62656572 |
| 67 | #define USBDEVICE_SUPER_MAGIC 0x9fa2 | ||
| 68 | #define MTD_INODE_FS_MAGIC 0x11307854 | ||
| 69 | #define ANON_INODE_FS_MAGIC 0x09041934 | ||
| 70 | |||
| 64 | 71 | ||
| 65 | #endif /* __LINUX_MAGIC_H__ */ | 72 | #endif /* __LINUX_MAGIC_H__ */ |
diff --git a/include/linux/maple.h b/include/linux/maple.h index d9a51b9b3300..c37288b23e0c 100644 --- a/include/linux/maple.h +++ b/include/linux/maple.h | |||
| @@ -1,9 +1,9 @@ | |||
| 1 | #ifndef __LINUX_MAPLE_H | 1 | #ifndef __LINUX_MAPLE_H |
| 2 | #define __LINUX_MAPLE_H | 2 | #define __LINUX_MAPLE_H |
| 3 | 3 | ||
| 4 | #include <linux/device.h> | ||
| 5 | #include <mach/maple.h> | 4 | #include <mach/maple.h> |
| 6 | 5 | ||
| 6 | struct device; | ||
| 7 | extern struct bus_type maple_bus_type; | 7 | extern struct bus_type maple_bus_type; |
| 8 | 8 | ||
| 9 | /* Maple Bus command and response codes */ | 9 | /* Maple Bus command and response codes */ |
diff --git a/include/linux/math64.h b/include/linux/math64.h index 23fcdfcba81b..b8ba85544721 100644 --- a/include/linux/math64.h +++ b/include/linux/math64.h | |||
| @@ -6,6 +6,8 @@ | |||
| 6 | 6 | ||
| 7 | #if BITS_PER_LONG == 64 | 7 | #if BITS_PER_LONG == 64 |
| 8 | 8 | ||
| 9 | #define div64_long(x,y) div64_s64((x),(y)) | ||
| 10 | |||
| 9 | /** | 11 | /** |
| 10 | * div_u64_rem - unsigned 64bit divide with 32bit divisor with remainder | 12 | * div_u64_rem - unsigned 64bit divide with 32bit divisor with remainder |
| 11 | * | 13 | * |
| @@ -45,6 +47,8 @@ static inline s64 div64_s64(s64 dividend, s64 divisor) | |||
| 45 | 47 | ||
| 46 | #elif BITS_PER_LONG == 32 | 48 | #elif BITS_PER_LONG == 32 |
| 47 | 49 | ||
| 50 | #define div64_long(x,y) div_s64((x),(y)) | ||
| 51 | |||
| 48 | #ifndef div_u64_rem | 52 | #ifndef div_u64_rem |
| 49 | static inline u64 div_u64_rem(u64 dividend, u32 divisor, u32 *remainder) | 53 | static inline u64 div_u64_rem(u64 dividend, u32 divisor, u32 *remainder) |
| 50 | { | 54 | { |
diff --git a/include/linux/mdio.h b/include/linux/mdio.h index b1494aced217..dfb947959ec9 100644 --- a/include/linux/mdio.h +++ b/include/linux/mdio.h | |||
| @@ -10,6 +10,7 @@ | |||
| 10 | #ifndef __LINUX_MDIO_H__ | 10 | #ifndef __LINUX_MDIO_H__ |
| 11 | #define __LINUX_MDIO_H__ | 11 | #define __LINUX_MDIO_H__ |
| 12 | 12 | ||
| 13 | #include <linux/types.h> | ||
| 13 | #include <linux/mii.h> | 14 | #include <linux/mii.h> |
| 14 | 15 | ||
| 15 | /* MDIO Manageable Devices (MMDs). */ | 16 | /* MDIO Manageable Devices (MMDs). */ |
| @@ -273,6 +274,8 @@ static inline __u16 mdio_phy_id_c45(int prtad, int devad) | |||
| 273 | return MDIO_PHY_ID_C45 | (prtad << 5) | devad; | 274 | return MDIO_PHY_ID_C45 | (prtad << 5) | devad; |
| 274 | } | 275 | } |
| 275 | 276 | ||
| 277 | #ifdef __KERNEL__ | ||
| 278 | |||
| 276 | static inline bool mdio_phy_id_is_c45(int phy_id) | 279 | static inline bool mdio_phy_id_is_c45(int phy_id) |
| 277 | { | 280 | { |
| 278 | return (phy_id & MDIO_PHY_ID_C45) && !(phy_id & ~MDIO_PHY_ID_C45_MASK); | 281 | return (phy_id & MDIO_PHY_ID_C45) && !(phy_id & ~MDIO_PHY_ID_C45_MASK); |
| @@ -288,11 +291,6 @@ static inline __u16 mdio_phy_id_devad(int phy_id) | |||
| 288 | return phy_id & MDIO_PHY_ID_DEVAD; | 291 | return phy_id & MDIO_PHY_ID_DEVAD; |
| 289 | } | 292 | } |
| 290 | 293 | ||
| 291 | #define MDIO_SUPPORTS_C22 1 | ||
| 292 | #define MDIO_SUPPORTS_C45 2 | ||
| 293 | |||
| 294 | #ifdef __KERNEL__ | ||
| 295 | |||
| 296 | /** | 294 | /** |
| 297 | * struct mdio_if_info - Ethernet controller MDIO interface | 295 | * struct mdio_if_info - Ethernet controller MDIO interface |
| 298 | * @prtad: PRTAD of the PHY (%MDIO_PRTAD_NONE if not present/unknown) | 296 | * @prtad: PRTAD of the PHY (%MDIO_PRTAD_NONE if not present/unknown) |
| @@ -321,6 +319,8 @@ struct mdio_if_info { | |||
| 321 | 319 | ||
| 322 | #define MDIO_PRTAD_NONE (-1) | 320 | #define MDIO_PRTAD_NONE (-1) |
| 323 | #define MDIO_DEVAD_NONE (-1) | 321 | #define MDIO_DEVAD_NONE (-1) |
| 322 | #define MDIO_SUPPORTS_C22 1 | ||
| 323 | #define MDIO_SUPPORTS_C45 2 | ||
| 324 | #define MDIO_EMULATE_C22 4 | 324 | #define MDIO_EMULATE_C22 4 |
| 325 | 325 | ||
| 326 | struct ethtool_cmd; | 326 | struct ethtool_cmd; |
diff --git a/include/linux/memcontrol.h b/include/linux/memcontrol.h index b80de520670b..f94efd2f6c27 100644 --- a/include/linux/memcontrol.h +++ b/include/linux/memcontrol.h | |||
| @@ -77,7 +77,8 @@ extern void mem_cgroup_uncharge_end(void); | |||
| 77 | extern void mem_cgroup_uncharge_page(struct page *page); | 77 | extern void mem_cgroup_uncharge_page(struct page *page); |
| 78 | extern void mem_cgroup_uncharge_cache_page(struct page *page); | 78 | extern void mem_cgroup_uncharge_cache_page(struct page *page); |
| 79 | 79 | ||
| 80 | extern void mem_cgroup_out_of_memory(struct mem_cgroup *memcg, gfp_t gfp_mask); | 80 | extern void mem_cgroup_out_of_memory(struct mem_cgroup *memcg, gfp_t gfp_mask, |
| 81 | int order); | ||
| 81 | int task_in_mem_cgroup(struct task_struct *task, const struct mem_cgroup *memcg); | 82 | int task_in_mem_cgroup(struct task_struct *task, const struct mem_cgroup *memcg); |
| 82 | 83 | ||
| 83 | extern struct mem_cgroup *try_get_mem_cgroup_from_page(struct page *page); | 84 | extern struct mem_cgroup *try_get_mem_cgroup_from_page(struct page *page); |
| @@ -140,6 +141,34 @@ static inline bool mem_cgroup_disabled(void) | |||
| 140 | return false; | 141 | return false; |
| 141 | } | 142 | } |
| 142 | 143 | ||
| 144 | void __mem_cgroup_begin_update_page_stat(struct page *page, bool *locked, | ||
| 145 | unsigned long *flags); | ||
| 146 | |||
| 147 | extern atomic_t memcg_moving; | ||
| 148 | |||
| 149 | static inline void mem_cgroup_begin_update_page_stat(struct page *page, | ||
| 150 | bool *locked, unsigned long *flags) | ||
| 151 | { | ||
| 152 | if (mem_cgroup_disabled()) | ||
| 153 | return; | ||
| 154 | rcu_read_lock(); | ||
| 155 | *locked = false; | ||
| 156 | if (atomic_read(&memcg_moving)) | ||
| 157 | __mem_cgroup_begin_update_page_stat(page, locked, flags); | ||
| 158 | } | ||
| 159 | |||
| 160 | void __mem_cgroup_end_update_page_stat(struct page *page, | ||
| 161 | unsigned long *flags); | ||
| 162 | static inline void mem_cgroup_end_update_page_stat(struct page *page, | ||
| 163 | bool *locked, unsigned long *flags) | ||
| 164 | { | ||
| 165 | if (mem_cgroup_disabled()) | ||
| 166 | return; | ||
| 167 | if (*locked) | ||
| 168 | __mem_cgroup_end_update_page_stat(page, flags); | ||
| 169 | rcu_read_unlock(); | ||
| 170 | } | ||
| 171 | |||
| 143 | void mem_cgroup_update_page_stat(struct page *page, | 172 | void mem_cgroup_update_page_stat(struct page *page, |
| 144 | enum mem_cgroup_page_stat_item idx, | 173 | enum mem_cgroup_page_stat_item idx, |
| 145 | int val); | 174 | int val); |
| @@ -298,21 +327,6 @@ static inline void mem_cgroup_iter_break(struct mem_cgroup *root, | |||
| 298 | { | 327 | { |
| 299 | } | 328 | } |
| 300 | 329 | ||
| 301 | static inline int mem_cgroup_get_reclaim_priority(struct mem_cgroup *memcg) | ||
| 302 | { | ||
| 303 | return 0; | ||
| 304 | } | ||
| 305 | |||
| 306 | static inline void mem_cgroup_note_reclaim_priority(struct mem_cgroup *memcg, | ||
| 307 | int priority) | ||
| 308 | { | ||
| 309 | } | ||
| 310 | |||
| 311 | static inline void mem_cgroup_record_reclaim_priority(struct mem_cgroup *memcg, | ||
| 312 | int priority) | ||
| 313 | { | ||
| 314 | } | ||
| 315 | |||
| 316 | static inline bool mem_cgroup_disabled(void) | 330 | static inline bool mem_cgroup_disabled(void) |
| 317 | { | 331 | { |
| 318 | return true; | 332 | return true; |
| @@ -355,6 +369,16 @@ mem_cgroup_print_oom_info(struct mem_cgroup *memcg, struct task_struct *p) | |||
| 355 | { | 369 | { |
| 356 | } | 370 | } |
| 357 | 371 | ||
| 372 | static inline void mem_cgroup_begin_update_page_stat(struct page *page, | ||
| 373 | bool *locked, unsigned long *flags) | ||
| 374 | { | ||
| 375 | } | ||
| 376 | |||
| 377 | static inline void mem_cgroup_end_update_page_stat(struct page *page, | ||
| 378 | bool *locked, unsigned long *flags) | ||
| 379 | { | ||
| 380 | } | ||
| 381 | |||
| 358 | static inline void mem_cgroup_inc_page_stat(struct page *page, | 382 | static inline void mem_cgroup_inc_page_stat(struct page *page, |
| 359 | enum mem_cgroup_page_stat_item idx) | 383 | enum mem_cgroup_page_stat_item idx) |
| 360 | { | 384 | { |
| @@ -391,7 +415,7 @@ static inline void mem_cgroup_replace_page_cache(struct page *oldpage, | |||
| 391 | struct page *newpage) | 415 | struct page *newpage) |
| 392 | { | 416 | { |
| 393 | } | 417 | } |
| 394 | #endif /* CONFIG_CGROUP_MEM_CONT */ | 418 | #endif /* CONFIG_CGROUP_MEM_RES_CTLR */ |
| 395 | 419 | ||
| 396 | #if !defined(CONFIG_CGROUP_MEM_RES_CTLR) || !defined(CONFIG_DEBUG_VM) | 420 | #if !defined(CONFIG_CGROUP_MEM_RES_CTLR) || !defined(CONFIG_DEBUG_VM) |
| 397 | static inline bool | 421 | static inline bool |
diff --git a/include/linux/memory_hotplug.h b/include/linux/memory_hotplug.h index 0b8e2a742600..910550f3b70e 100644 --- a/include/linux/memory_hotplug.h +++ b/include/linux/memory_hotplug.h | |||
| @@ -4,6 +4,7 @@ | |||
| 4 | #include <linux/mmzone.h> | 4 | #include <linux/mmzone.h> |
| 5 | #include <linux/spinlock.h> | 5 | #include <linux/spinlock.h> |
| 6 | #include <linux/notifier.h> | 6 | #include <linux/notifier.h> |
| 7 | #include <linux/bug.h> | ||
| 7 | 8 | ||
| 8 | struct page; | 9 | struct page; |
| 9 | struct zone; | 10 | struct zone; |
diff --git a/include/linux/mfd/abx500.h b/include/linux/mfd/abx500.h index 9970337ff041..e20dd6ead1d0 100644 --- a/include/linux/mfd/abx500.h +++ b/include/linux/mfd/abx500.h | |||
| @@ -14,9 +14,10 @@ | |||
| 14 | * Author: Rickard Andersson <rickard.andersson@stericsson.com> | 14 | * Author: Rickard Andersson <rickard.andersson@stericsson.com> |
| 15 | */ | 15 | */ |
| 16 | 16 | ||
| 17 | #include <linux/device.h> | ||
| 18 | #include <linux/regulator/machine.h> | 17 | #include <linux/regulator/machine.h> |
| 19 | 18 | ||
| 19 | struct device; | ||
| 20 | |||
| 20 | #ifndef MFD_ABX500_H | 21 | #ifndef MFD_ABX500_H |
| 21 | #define MFD_ABX500_H | 22 | #define MFD_ABX500_H |
| 22 | 23 | ||
diff --git a/include/linux/mfd/abx500/ab5500.h b/include/linux/mfd/abx500/ab5500.h index a720051ae933..54f820ed73bb 100644 --- a/include/linux/mfd/abx500/ab5500.h +++ b/include/linux/mfd/abx500/ab5500.h | |||
| @@ -6,7 +6,7 @@ | |||
| 6 | #ifndef MFD_AB5500_H | 6 | #ifndef MFD_AB5500_H |
| 7 | #define MFD_AB5500_H | 7 | #define MFD_AB5500_H |
| 8 | 8 | ||
| 9 | #include <linux/device.h> | 9 | struct device; |
| 10 | 10 | ||
| 11 | enum ab5500_devid { | 11 | enum ab5500_devid { |
| 12 | AB5500_DEVID_ADC, | 12 | AB5500_DEVID_ADC, |
diff --git a/include/linux/mfd/abx500/ab8500.h b/include/linux/mfd/abx500/ab8500.h index 838c6b487cc5..dca94396190d 100644 --- a/include/linux/mfd/abx500/ab8500.h +++ b/include/linux/mfd/abx500/ab8500.h | |||
| @@ -7,7 +7,9 @@ | |||
| 7 | #ifndef MFD_AB8500_H | 7 | #ifndef MFD_AB8500_H |
| 8 | #define MFD_AB8500_H | 8 | #define MFD_AB8500_H |
| 9 | 9 | ||
| 10 | #include <linux/device.h> | 10 | #include <linux/mutex.h> |
| 11 | |||
| 12 | struct device; | ||
| 11 | 13 | ||
| 12 | /* | 14 | /* |
| 13 | * AB8500 bank addresses | 15 | * AB8500 bank addresses |
diff --git a/include/linux/mfd/max8997.h b/include/linux/mfd/max8997.h index fff590521e50..28726dd540f2 100644 --- a/include/linux/mfd/max8997.h +++ b/include/linux/mfd/max8997.h | |||
| @@ -131,6 +131,55 @@ struct max8997_muic_platform_data { | |||
| 131 | int num_init_data; | 131 | int num_init_data; |
| 132 | }; | 132 | }; |
| 133 | 133 | ||
| 134 | enum max8997_haptic_motor_type { | ||
| 135 | MAX8997_HAPTIC_ERM, | ||
| 136 | MAX8997_HAPTIC_LRA, | ||
| 137 | }; | ||
| 138 | |||
| 139 | enum max8997_haptic_pulse_mode { | ||
| 140 | MAX8997_EXTERNAL_MODE, | ||
| 141 | MAX8997_INTERNAL_MODE, | ||
| 142 | }; | ||
| 143 | |||
| 144 | enum max8997_haptic_pwm_divisor { | ||
| 145 | MAX8997_PWM_DIVISOR_32, | ||
| 146 | MAX8997_PWM_DIVISOR_64, | ||
| 147 | MAX8997_PWM_DIVISOR_128, | ||
| 148 | MAX8997_PWM_DIVISOR_256, | ||
| 149 | }; | ||
| 150 | |||
| 151 | /** | ||
| 152 | * max8997_haptic_platform_data | ||
| 153 | * @pwm_channel_id: channel number of PWM device | ||
| 154 | * valid for MAX8997_EXTERNAL_MODE | ||
| 155 | * @pwm_period: period in nano second for PWM device | ||
| 156 | * valid for MAX8997_EXTERNAL_MODE | ||
| 157 | * @type: motor type | ||
| 158 | * @mode: pulse mode | ||
| 159 | * MAX8997_EXTERNAL_MODE: external PWM device is used to control motor | ||
| 160 | * MAX8997_INTERNAL_MODE: internal pulse generator is used to control motor | ||
| 161 | * @pwm_divisor: divisor for external PWM device | ||
| 162 | * @internal_mode_pattern: internal mode pattern for internal mode | ||
| 163 | * [0 - 3]: valid pattern number | ||
| 164 | * @pattern_cycle: the number of cycles of the waveform | ||
| 165 | * for the internal mode pattern | ||
| 166 | * [0 - 15]: available cycles | ||
| 167 | * @pattern_signal_period: period of the waveform for the internal mode pattern | ||
| 168 | * [0 - 255]: available period | ||
| 169 | */ | ||
| 170 | struct max8997_haptic_platform_data { | ||
| 171 | unsigned int pwm_channel_id; | ||
| 172 | unsigned int pwm_period; | ||
| 173 | |||
| 174 | enum max8997_haptic_motor_type type; | ||
| 175 | enum max8997_haptic_pulse_mode mode; | ||
| 176 | enum max8997_haptic_pwm_divisor pwm_divisor; | ||
| 177 | |||
| 178 | unsigned int internal_mode_pattern; | ||
| 179 | unsigned int pattern_cycle; | ||
| 180 | unsigned int pattern_signal_period; | ||
| 181 | }; | ||
| 182 | |||
| 134 | enum max8997_led_mode { | 183 | enum max8997_led_mode { |
| 135 | MAX8997_NONE, | 184 | MAX8997_NONE, |
| 136 | MAX8997_FLASH_MODE, | 185 | MAX8997_FLASH_MODE, |
| @@ -192,7 +241,9 @@ struct max8997_platform_data { | |||
| 192 | /* ---- MUIC ---- */ | 241 | /* ---- MUIC ---- */ |
| 193 | struct max8997_muic_platform_data *muic_pdata; | 242 | struct max8997_muic_platform_data *muic_pdata; |
| 194 | 243 | ||
| 195 | /* HAPTIC: Not implemented */ | 244 | /* ---- HAPTIC ---- */ |
| 245 | struct max8997_haptic_platform_data *haptic_pdata; | ||
| 246 | |||
| 196 | /* RTC: Not implemented */ | 247 | /* RTC: Not implemented */ |
| 197 | /* ---- LED ---- */ | 248 | /* ---- LED ---- */ |
| 198 | struct max8997_led_platform_data *led_pdata; | 249 | struct max8997_led_platform_data *led_pdata; |
diff --git a/include/linux/mfd/pm8xxx/pm8921.h b/include/linux/mfd/pm8xxx/pm8921.h index d5517fd32d1b..00fa3de7659d 100644 --- a/include/linux/mfd/pm8xxx/pm8921.h +++ b/include/linux/mfd/pm8xxx/pm8921.h | |||
| @@ -18,7 +18,6 @@ | |||
| 18 | #ifndef __MFD_PM8921_H | 18 | #ifndef __MFD_PM8921_H |
| 19 | #define __MFD_PM8921_H | 19 | #define __MFD_PM8921_H |
| 20 | 20 | ||
| 21 | #include <linux/device.h> | ||
| 22 | #include <linux/mfd/pm8xxx/irq.h> | 21 | #include <linux/mfd/pm8xxx/irq.h> |
| 23 | 22 | ||
| 24 | #define PM8921_NR_IRQS 256 | 23 | #define PM8921_NR_IRQS 256 |
diff --git a/include/linux/mfd/stmpe.h b/include/linux/mfd/stmpe.h index ca1d7a347600..8c54de674b4b 100644 --- a/include/linux/mfd/stmpe.h +++ b/include/linux/mfd/stmpe.h | |||
| @@ -8,7 +8,9 @@ | |||
| 8 | #ifndef __LINUX_MFD_STMPE_H | 8 | #ifndef __LINUX_MFD_STMPE_H |
| 9 | #define __LINUX_MFD_STMPE_H | 9 | #define __LINUX_MFD_STMPE_H |
| 10 | 10 | ||
| 11 | #include <linux/device.h> | 11 | #include <linux/mutex.h> |
| 12 | |||
| 13 | struct device; | ||
| 12 | 14 | ||
| 13 | enum stmpe_block { | 15 | enum stmpe_block { |
| 14 | STMPE_BLOCK_GPIO = 1 << 0, | 16 | STMPE_BLOCK_GPIO = 1 << 0, |
diff --git a/include/linux/mfd/tc3589x.h b/include/linux/mfd/tc3589x.h index 16c76e124f9c..3acb3a8e3af5 100644 --- a/include/linux/mfd/tc3589x.h +++ b/include/linux/mfd/tc3589x.h | |||
| @@ -7,7 +7,7 @@ | |||
| 7 | #ifndef __LINUX_MFD_TC3589x_H | 7 | #ifndef __LINUX_MFD_TC3589x_H |
| 8 | #define __LINUX_MFD_TC3589x_H | 8 | #define __LINUX_MFD_TC3589x_H |
| 9 | 9 | ||
| 10 | #include <linux/device.h> | 10 | struct device; |
| 11 | 11 | ||
| 12 | enum tx3589x_block { | 12 | enum tx3589x_block { |
| 13 | TC3589x_BLOCK_GPIO = 1 << 0, | 13 | TC3589x_BLOCK_GPIO = 1 << 0, |
diff --git a/include/linux/mfd/tps65910.h b/include/linux/mfd/tps65910.h index d0cb12eba402..76700b5eee92 100644 --- a/include/linux/mfd/tps65910.h +++ b/include/linux/mfd/tps65910.h | |||
| @@ -768,6 +768,12 @@ | |||
| 768 | /* Max number of TPS65910/11 regulators */ | 768 | /* Max number of TPS65910/11 regulators */ |
| 769 | #define TPS65910_NUM_REGS 13 | 769 | #define TPS65910_NUM_REGS 13 |
| 770 | 770 | ||
| 771 | /* External sleep controls through EN1/EN2/EN3/SLEEP inputs */ | ||
| 772 | #define TPS65910_SLEEP_CONTROL_EXT_INPUT_EN1 0x1 | ||
| 773 | #define TPS65910_SLEEP_CONTROL_EXT_INPUT_EN2 0x2 | ||
| 774 | #define TPS65910_SLEEP_CONTROL_EXT_INPUT_EN3 0x4 | ||
| 775 | #define TPS65911_SLEEP_CONTROL_EXT_INPUT_SLEEP 0x8 | ||
| 776 | |||
| 771 | /** | 777 | /** |
| 772 | * struct tps65910_board | 778 | * struct tps65910_board |
| 773 | * Board platform data may be used to initialize regulators. | 779 | * Board platform data may be used to initialize regulators. |
| @@ -779,6 +785,7 @@ struct tps65910_board { | |||
| 779 | int irq_base; | 785 | int irq_base; |
| 780 | int vmbch_threshold; | 786 | int vmbch_threshold; |
| 781 | int vmbch2_threshold; | 787 | int vmbch2_threshold; |
| 788 | unsigned long regulator_ext_sleep_control[TPS65910_NUM_REGS]; | ||
| 782 | struct regulator_init_data *tps65910_pmic_init_data[TPS65910_NUM_REGS]; | 789 | struct regulator_init_data *tps65910_pmic_init_data[TPS65910_NUM_REGS]; |
| 783 | }; | 790 | }; |
| 784 | 791 | ||
diff --git a/include/linux/mfd/wm8994/pdata.h b/include/linux/mfd/wm8994/pdata.h index 3fb1f407d5e6..dc3e05011689 100644 --- a/include/linux/mfd/wm8994/pdata.h +++ b/include/linux/mfd/wm8994/pdata.h | |||
| @@ -185,6 +185,9 @@ struct wm8994_pdata { | |||
| 185 | unsigned int jd_scthr:2; | 185 | unsigned int jd_scthr:2; |
| 186 | unsigned int jd_thr:2; | 186 | unsigned int jd_thr:2; |
| 187 | 187 | ||
| 188 | /* Configure WM1811 jack detection for use with external capacitor */ | ||
| 189 | unsigned int jd_ext_cap:1; | ||
| 190 | |||
| 188 | /* WM8958 microphone bias configuration */ | 191 | /* WM8958 microphone bias configuration */ |
| 189 | int micbias[2]; | 192 | int micbias[2]; |
| 190 | 193 | ||
diff --git a/include/linux/migrate.h b/include/linux/migrate.h index 05ed2828a553..855c337b20c3 100644 --- a/include/linux/migrate.h +++ b/include/linux/migrate.h | |||
| @@ -8,7 +8,6 @@ | |||
| 8 | typedef struct page *new_page_t(struct page *, unsigned long private, int **); | 8 | typedef struct page *new_page_t(struct page *, unsigned long private, int **); |
| 9 | 9 | ||
| 10 | #ifdef CONFIG_MIGRATION | 10 | #ifdef CONFIG_MIGRATION |
| 11 | #define PAGE_MIGRATION 1 | ||
| 12 | 11 | ||
| 13 | extern void putback_lru_pages(struct list_head *l); | 12 | extern void putback_lru_pages(struct list_head *l); |
| 14 | extern int migrate_page(struct address_space *, | 13 | extern int migrate_page(struct address_space *, |
| @@ -32,7 +31,6 @@ extern void migrate_page_copy(struct page *newpage, struct page *page); | |||
| 32 | extern int migrate_huge_page_move_mapping(struct address_space *mapping, | 31 | extern int migrate_huge_page_move_mapping(struct address_space *mapping, |
| 33 | struct page *newpage, struct page *page); | 32 | struct page *newpage, struct page *page); |
| 34 | #else | 33 | #else |
| 35 | #define PAGE_MIGRATION 0 | ||
| 36 | 34 | ||
| 37 | static inline void putback_lru_pages(struct list_head *l) {} | 35 | static inline void putback_lru_pages(struct list_head *l) {} |
| 38 | static inline int migrate_pages(struct list_head *l, new_page_t x, | 36 | static inline int migrate_pages(struct list_head *l, new_page_t x, |
diff --git a/include/linux/mlx4/device.h b/include/linux/mlx4/device.h index aea61905499b..834c96c5d879 100644 --- a/include/linux/mlx4/device.h +++ b/include/linux/mlx4/device.h | |||
| @@ -101,10 +101,6 @@ enum { | |||
| 101 | #define MLX4_ATTR_EXTENDED_PORT_INFO cpu_to_be16(0xff90) | 101 | #define MLX4_ATTR_EXTENDED_PORT_INFO cpu_to_be16(0xff90) |
| 102 | 102 | ||
| 103 | enum { | 103 | enum { |
| 104 | MLX_EXT_PORT_CAP_FLAG_EXTENDED_PORT_INFO = 1 << 0 | ||
| 105 | }; | ||
| 106 | |||
| 107 | enum { | ||
| 108 | MLX4_BMME_FLAG_LOCAL_INV = 1 << 6, | 104 | MLX4_BMME_FLAG_LOCAL_INV = 1 << 6, |
| 109 | MLX4_BMME_FLAG_REMOTE_INV = 1 << 7, | 105 | MLX4_BMME_FLAG_REMOTE_INV = 1 << 7, |
| 110 | MLX4_BMME_FLAG_TYPE_2_WIN = 1 << 9, | 106 | MLX4_BMME_FLAG_TYPE_2_WIN = 1 << 9, |
| @@ -133,6 +129,7 @@ enum mlx4_event { | |||
| 133 | MLX4_EVENT_TYPE_CMD = 0x0a, | 129 | MLX4_EVENT_TYPE_CMD = 0x0a, |
| 134 | MLX4_EVENT_TYPE_VEP_UPDATE = 0x19, | 130 | MLX4_EVENT_TYPE_VEP_UPDATE = 0x19, |
| 135 | MLX4_EVENT_TYPE_COMM_CHANNEL = 0x18, | 131 | MLX4_EVENT_TYPE_COMM_CHANNEL = 0x18, |
| 132 | MLX4_EVENT_TYPE_FATAL_WARNING = 0x1b, | ||
| 136 | MLX4_EVENT_TYPE_FLR_EVENT = 0x1c, | 133 | MLX4_EVENT_TYPE_FLR_EVENT = 0x1c, |
| 137 | MLX4_EVENT_TYPE_NONE = 0xff, | 134 | MLX4_EVENT_TYPE_NONE = 0xff, |
| 138 | }; | 135 | }; |
| @@ -143,6 +140,10 @@ enum { | |||
| 143 | }; | 140 | }; |
| 144 | 141 | ||
| 145 | enum { | 142 | enum { |
| 143 | MLX4_FATAL_WARNING_SUBTYPE_WARMING = 0, | ||
| 144 | }; | ||
| 145 | |||
| 146 | enum { | ||
| 146 | MLX4_PERM_LOCAL_READ = 1 << 10, | 147 | MLX4_PERM_LOCAL_READ = 1 << 10, |
| 147 | MLX4_PERM_LOCAL_WRITE = 1 << 11, | 148 | MLX4_PERM_LOCAL_WRITE = 1 << 11, |
| 148 | MLX4_PERM_REMOTE_READ = 1 << 12, | 149 | MLX4_PERM_REMOTE_READ = 1 << 12, |
| @@ -273,6 +274,7 @@ struct mlx4_caps { | |||
| 273 | int num_comp_vectors; | 274 | int num_comp_vectors; |
| 274 | int comp_pool; | 275 | int comp_pool; |
| 275 | int num_mpts; | 276 | int num_mpts; |
| 277 | int max_fmr_maps; | ||
| 276 | int num_mtts; | 278 | int num_mtts; |
| 277 | int fmr_reserved_mtts; | 279 | int fmr_reserved_mtts; |
| 278 | int reserved_mtts; | 280 | int reserved_mtts; |
| @@ -308,7 +310,7 @@ struct mlx4_caps { | |||
| 308 | u32 port_mask[MLX4_MAX_PORTS + 1]; | 310 | u32 port_mask[MLX4_MAX_PORTS + 1]; |
| 309 | enum mlx4_port_type possible_type[MLX4_MAX_PORTS + 1]; | 311 | enum mlx4_port_type possible_type[MLX4_MAX_PORTS + 1]; |
| 310 | u32 max_counters; | 312 | u32 max_counters; |
| 311 | u8 ext_port_cap[MLX4_MAX_PORTS + 1]; | 313 | u8 port_ib_mtu[MLX4_MAX_PORTS + 1]; |
| 312 | }; | 314 | }; |
| 313 | 315 | ||
| 314 | struct mlx4_buf_list { | 316 | struct mlx4_buf_list { |
| @@ -622,7 +624,10 @@ int mlx4_replace_mac(struct mlx4_dev *dev, u8 port, int qpn, u64 new_mac); | |||
| 622 | int mlx4_get_eth_qp(struct mlx4_dev *dev, u8 port, u64 mac, int *qpn); | 624 | int mlx4_get_eth_qp(struct mlx4_dev *dev, u8 port, u64 mac, int *qpn); |
| 623 | void mlx4_put_eth_qp(struct mlx4_dev *dev, u8 port, u64 mac, int qpn); | 625 | void mlx4_put_eth_qp(struct mlx4_dev *dev, u8 port, u64 mac, int qpn); |
| 624 | void mlx4_set_stats_bitmap(struct mlx4_dev *dev, u64 *stats_bitmap); | 626 | void mlx4_set_stats_bitmap(struct mlx4_dev *dev, u64 *stats_bitmap); |
| 625 | 627 | int mlx4_SET_PORT_general(struct mlx4_dev *dev, u8 port, int mtu, | |
| 628 | u8 pptx, u8 pfctx, u8 pprx, u8 pfcrx); | ||
| 629 | int mlx4_SET_PORT_qpn_calc(struct mlx4_dev *dev, u8 port, u32 base_qpn, | ||
| 630 | u8 promisc); | ||
| 626 | int mlx4_find_cached_vlan(struct mlx4_dev *dev, u8 port, u16 vid, int *idx); | 631 | int mlx4_find_cached_vlan(struct mlx4_dev *dev, u8 port, u16 vid, int *idx); |
| 627 | int mlx4_register_vlan(struct mlx4_dev *dev, u8 port, u16 vlan, int *index); | 632 | int mlx4_register_vlan(struct mlx4_dev *dev, u8 port, u16 vlan, int *index); |
| 628 | void mlx4_unregister_vlan(struct mlx4_dev *dev, u8 port, int index); | 633 | void mlx4_unregister_vlan(struct mlx4_dev *dev, u8 port, int index); |
diff --git a/include/linux/mlx4/driver.h b/include/linux/mlx4/driver.h index e1eebf78caba..5f1298b1b5ef 100644 --- a/include/linux/mlx4/driver.h +++ b/include/linux/mlx4/driver.h | |||
| @@ -33,7 +33,6 @@ | |||
| 33 | #ifndef MLX4_DRIVER_H | 33 | #ifndef MLX4_DRIVER_H |
| 34 | #define MLX4_DRIVER_H | 34 | #define MLX4_DRIVER_H |
| 35 | 35 | ||
| 36 | #include <linux/device.h> | ||
| 37 | #include <linux/mlx4/device.h> | 36 | #include <linux/mlx4/device.h> |
| 38 | 37 | ||
| 39 | struct mlx4_dev; | 38 | struct mlx4_dev; |
diff --git a/include/linux/mlx4/qp.h b/include/linux/mlx4/qp.h index bee8fa231276..091f9e7dc8b9 100644 --- a/include/linux/mlx4/qp.h +++ b/include/linux/mlx4/qp.h | |||
| @@ -212,7 +212,10 @@ struct mlx4_wqe_ctrl_seg { | |||
| 212 | * [1] SE (solicited event) | 212 | * [1] SE (solicited event) |
| 213 | * [0] FL (force loopback) | 213 | * [0] FL (force loopback) |
| 214 | */ | 214 | */ |
| 215 | __be32 srcrb_flags; | 215 | union { |
| 216 | __be32 srcrb_flags; | ||
| 217 | __be16 srcrb_flags16[2]; | ||
| 218 | }; | ||
| 216 | /* | 219 | /* |
| 217 | * imm is immediate data for send/RDMA write w/ immediate; | 220 | * imm is immediate data for send/RDMA write w/ immediate; |
| 218 | * also invalidation key for send with invalidate; input | 221 | * also invalidation key for send with invalidate; input |
diff --git a/include/linux/mm.h b/include/linux/mm.h index 17b27cd269c4..cf7982336103 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h | |||
| @@ -6,6 +6,7 @@ | |||
| 6 | #ifdef __KERNEL__ | 6 | #ifdef __KERNEL__ |
| 7 | 7 | ||
| 8 | #include <linux/gfp.h> | 8 | #include <linux/gfp.h> |
| 9 | #include <linux/bug.h> | ||
| 9 | #include <linux/list.h> | 10 | #include <linux/list.h> |
| 10 | #include <linux/mmzone.h> | 11 | #include <linux/mmzone.h> |
| 11 | #include <linux/rbtree.h> | 12 | #include <linux/rbtree.h> |
| @@ -111,7 +112,7 @@ extern unsigned int kobjsize(const void *objp); | |||
| 111 | #define VM_HUGEPAGE 0x01000000 /* MADV_HUGEPAGE marked this vma */ | 112 | #define VM_HUGEPAGE 0x01000000 /* MADV_HUGEPAGE marked this vma */ |
| 112 | #endif | 113 | #endif |
| 113 | #define VM_INSERTPAGE 0x02000000 /* The vma has had "vm_insert_page()" done on it */ | 114 | #define VM_INSERTPAGE 0x02000000 /* The vma has had "vm_insert_page()" done on it */ |
| 114 | #define VM_ALWAYSDUMP 0x04000000 /* Always include in core dumps */ | 115 | #define VM_NODUMP 0x04000000 /* Do not include in the core dump */ |
| 115 | 116 | ||
| 116 | #define VM_CAN_NONLINEAR 0x08000000 /* Has ->fault & does nonlinear pages */ | 117 | #define VM_CAN_NONLINEAR 0x08000000 /* Has ->fault & does nonlinear pages */ |
| 117 | #define VM_MIXEDMAP 0x10000000 /* Can contain "struct page" and pure PFN pages */ | 118 | #define VM_MIXEDMAP 0x10000000 /* Can contain "struct page" and pure PFN pages */ |
| @@ -893,9 +894,9 @@ struct page *vm_normal_page(struct vm_area_struct *vma, unsigned long addr, | |||
| 893 | 894 | ||
| 894 | int zap_vma_ptes(struct vm_area_struct *vma, unsigned long address, | 895 | int zap_vma_ptes(struct vm_area_struct *vma, unsigned long address, |
| 895 | unsigned long size); | 896 | unsigned long size); |
| 896 | unsigned long zap_page_range(struct vm_area_struct *vma, unsigned long address, | 897 | void zap_page_range(struct vm_area_struct *vma, unsigned long address, |
| 897 | unsigned long size, struct zap_details *); | 898 | unsigned long size, struct zap_details *); |
| 898 | unsigned long unmap_vmas(struct mmu_gather *tlb, | 899 | void unmap_vmas(struct mmu_gather *tlb, |
| 899 | struct vm_area_struct *start_vma, unsigned long start_addr, | 900 | struct vm_area_struct *start_vma, unsigned long start_addr, |
| 900 | unsigned long end_addr, unsigned long *nr_accounted, | 901 | unsigned long end_addr, unsigned long *nr_accounted, |
| 901 | struct zap_details *); | 902 | struct zap_details *); |
| @@ -1040,6 +1041,9 @@ static inline int stack_guard_page_end(struct vm_area_struct *vma, | |||
| 1040 | !vma_growsup(vma->vm_next, addr); | 1041 | !vma_growsup(vma->vm_next, addr); |
| 1041 | } | 1042 | } |
| 1042 | 1043 | ||
| 1044 | extern pid_t | ||
| 1045 | vm_is_stack(struct task_struct *task, struct vm_area_struct *vma, int in_group); | ||
| 1046 | |||
| 1043 | extern unsigned long move_page_tables(struct vm_area_struct *vma, | 1047 | extern unsigned long move_page_tables(struct vm_area_struct *vma, |
| 1044 | unsigned long old_addr, struct vm_area_struct *new_vma, | 1048 | unsigned long old_addr, struct vm_area_struct *new_vma, |
| 1045 | unsigned long new_addr, unsigned long len); | 1049 | unsigned long new_addr, unsigned long len); |
| @@ -1058,19 +1062,20 @@ int __get_user_pages_fast(unsigned long start, int nr_pages, int write, | |||
| 1058 | /* | 1062 | /* |
| 1059 | * per-process(per-mm_struct) statistics. | 1063 | * per-process(per-mm_struct) statistics. |
| 1060 | */ | 1064 | */ |
| 1061 | static inline void set_mm_counter(struct mm_struct *mm, int member, long value) | ||
| 1062 | { | ||
| 1063 | atomic_long_set(&mm->rss_stat.count[member], value); | ||
| 1064 | } | ||
| 1065 | |||
| 1066 | #if defined(SPLIT_RSS_COUNTING) | ||
| 1067 | unsigned long get_mm_counter(struct mm_struct *mm, int member); | ||
| 1068 | #else | ||
| 1069 | static inline unsigned long get_mm_counter(struct mm_struct *mm, int member) | 1065 | static inline unsigned long get_mm_counter(struct mm_struct *mm, int member) |
| 1070 | { | 1066 | { |
| 1071 | return atomic_long_read(&mm->rss_stat.count[member]); | 1067 | long val = atomic_long_read(&mm->rss_stat.count[member]); |
| 1072 | } | 1068 | |
| 1069 | #ifdef SPLIT_RSS_COUNTING | ||
| 1070 | /* | ||
| 1071 | * counter is updated in asynchronous manner and may go to minus. | ||
| 1072 | * But it's never be expected number for users. | ||
| 1073 | */ | ||
| 1074 | if (val < 0) | ||
| 1075 | val = 0; | ||
| 1073 | #endif | 1076 | #endif |
| 1077 | return (unsigned long)val; | ||
| 1078 | } | ||
| 1074 | 1079 | ||
| 1075 | static inline void add_mm_counter(struct mm_struct *mm, int member, long value) | 1080 | static inline void add_mm_counter(struct mm_struct *mm, int member, long value) |
| 1076 | { | 1081 | { |
| @@ -1127,9 +1132,9 @@ static inline void setmax_mm_hiwater_rss(unsigned long *maxrss, | |||
| 1127 | } | 1132 | } |
| 1128 | 1133 | ||
| 1129 | #if defined(SPLIT_RSS_COUNTING) | 1134 | #if defined(SPLIT_RSS_COUNTING) |
| 1130 | void sync_mm_rss(struct task_struct *task, struct mm_struct *mm); | 1135 | void sync_mm_rss(struct mm_struct *mm); |
| 1131 | #else | 1136 | #else |
| 1132 | static inline void sync_mm_rss(struct task_struct *task, struct mm_struct *mm) | 1137 | static inline void sync_mm_rss(struct mm_struct *mm) |
| 1133 | { | 1138 | { |
| 1134 | } | 1139 | } |
| 1135 | #endif | 1140 | #endif |
| @@ -1291,8 +1296,6 @@ extern void get_pfn_range_for_nid(unsigned int nid, | |||
| 1291 | extern unsigned long find_min_pfn_with_active_regions(void); | 1296 | extern unsigned long find_min_pfn_with_active_regions(void); |
| 1292 | extern void free_bootmem_with_active_regions(int nid, | 1297 | extern void free_bootmem_with_active_regions(int nid, |
| 1293 | unsigned long max_low_pfn); | 1298 | unsigned long max_low_pfn); |
| 1294 | int add_from_early_node_map(struct range *range, int az, | ||
| 1295 | int nr_range, int nid); | ||
| 1296 | extern void sparse_memory_present_with_active_regions(int nid); | 1299 | extern void sparse_memory_present_with_active_regions(int nid); |
| 1297 | 1300 | ||
| 1298 | #endif /* CONFIG_HAVE_MEMBLOCK_NODE_MAP */ | 1301 | #endif /* CONFIG_HAVE_MEMBLOCK_NODE_MAP */ |
| @@ -1598,9 +1601,9 @@ void vmemmap_populate_print_last(void); | |||
| 1598 | 1601 | ||
| 1599 | enum mf_flags { | 1602 | enum mf_flags { |
| 1600 | MF_COUNT_INCREASED = 1 << 0, | 1603 | MF_COUNT_INCREASED = 1 << 0, |
| 1604 | MF_ACTION_REQUIRED = 1 << 1, | ||
| 1601 | }; | 1605 | }; |
| 1602 | extern void memory_failure(unsigned long pfn, int trapno); | 1606 | extern int memory_failure(unsigned long pfn, int trapno, int flags); |
| 1603 | extern int __memory_failure(unsigned long pfn, int trapno, int flags); | ||
| 1604 | extern void memory_failure_queue(unsigned long pfn, int trapno, int flags); | 1607 | extern void memory_failure_queue(unsigned long pfn, int trapno, int flags); |
| 1605 | extern int unpoison_memory(unsigned long pfn); | 1608 | extern int unpoison_memory(unsigned long pfn); |
| 1606 | extern int sysctl_memory_failure_early_kill; | 1609 | extern int sysctl_memory_failure_early_kill; |
diff --git a/include/linux/mmc/card.h b/include/linux/mmc/card.h index 19a41d1737af..6faa145c81e3 100644 --- a/include/linux/mmc/card.h +++ b/include/linux/mmc/card.h | |||
| @@ -10,6 +10,7 @@ | |||
| 10 | #ifndef LINUX_MMC_CARD_H | 10 | #ifndef LINUX_MMC_CARD_H |
| 11 | #define LINUX_MMC_CARD_H | 11 | #define LINUX_MMC_CARD_H |
| 12 | 12 | ||
| 13 | #include <linux/device.h> | ||
| 13 | #include <linux/mmc/core.h> | 14 | #include <linux/mmc/core.h> |
| 14 | #include <linux/mod_devicetable.h> | 15 | #include <linux/mod_devicetable.h> |
| 15 | 16 | ||
diff --git a/include/linux/mmc/core.h b/include/linux/mmc/core.h index 87a976cc5654..2e6a681fceb2 100644 --- a/include/linux/mmc/core.h +++ b/include/linux/mmc/core.h | |||
| @@ -9,7 +9,7 @@ | |||
| 9 | #define LINUX_MMC_CORE_H | 9 | #define LINUX_MMC_CORE_H |
| 10 | 10 | ||
| 11 | #include <linux/interrupt.h> | 11 | #include <linux/interrupt.h> |
| 12 | #include <linux/device.h> | 12 | #include <linux/completion.h> |
| 13 | 13 | ||
| 14 | struct request; | 14 | struct request; |
| 15 | struct mmc_data; | 15 | struct mmc_data; |
diff --git a/include/linux/mmc/host.h b/include/linux/mmc/host.h index ee2b0363c040..91924e8c642b 100644 --- a/include/linux/mmc/host.h +++ b/include/linux/mmc/host.h | |||
| @@ -12,6 +12,7 @@ | |||
| 12 | 12 | ||
| 13 | #include <linux/leds.h> | 13 | #include <linux/leds.h> |
| 14 | #include <linux/sched.h> | 14 | #include <linux/sched.h> |
| 15 | #include <linux/device.h> | ||
| 15 | #include <linux/fault-inject.h> | 16 | #include <linux/fault-inject.h> |
| 16 | 17 | ||
| 17 | #include <linux/mmc/core.h> | 18 | #include <linux/mmc/core.h> |
diff --git a/include/linux/mmc/ioctl.h b/include/linux/mmc/ioctl.h index 8fa5bc5f8059..1f5e68923929 100644 --- a/include/linux/mmc/ioctl.h +++ b/include/linux/mmc/ioctl.h | |||
| @@ -1,5 +1,8 @@ | |||
| 1 | #ifndef LINUX_MMC_IOCTL_H | 1 | #ifndef LINUX_MMC_IOCTL_H |
| 2 | #define LINUX_MMC_IOCTL_H | 2 | #define LINUX_MMC_IOCTL_H |
| 3 | |||
| 4 | #include <linux/types.h> | ||
| 5 | |||
| 3 | struct mmc_ioc_cmd { | 6 | struct mmc_ioc_cmd { |
| 4 | /* Implies direction of data. true = write, false = read */ | 7 | /* Implies direction of data. true = write, false = read */ |
| 5 | int write_flag; | 8 | int write_flag; |
diff --git a/include/linux/mmzone.h b/include/linux/mmzone.h index 650ba2fb3301..dff711509661 100644 --- a/include/linux/mmzone.h +++ b/include/linux/mmzone.h | |||
| @@ -365,6 +365,7 @@ struct zone { | |||
| 365 | */ | 365 | */ |
| 366 | unsigned int compact_considered; | 366 | unsigned int compact_considered; |
| 367 | unsigned int compact_defer_shift; | 367 | unsigned int compact_defer_shift; |
| 368 | int compact_order_failed; | ||
| 368 | #endif | 369 | #endif |
| 369 | 370 | ||
| 370 | ZONE_PADDING(_pad1_) | 371 | ZONE_PADDING(_pad1_) |
diff --git a/include/linux/mod_devicetable.h b/include/linux/mod_devicetable.h index 83ac0713ed0a..fb69ad191ad7 100644 --- a/include/linux/mod_devicetable.h +++ b/include/linux/mod_devicetable.h | |||
| @@ -560,4 +560,25 @@ struct amba_id { | |||
| 560 | #endif | 560 | #endif |
| 561 | }; | 561 | }; |
| 562 | 562 | ||
| 563 | /* | ||
| 564 | * Match x86 CPUs for CPU specific drivers. | ||
| 565 | * See documentation of "x86_match_cpu" for details. | ||
| 566 | */ | ||
| 567 | |||
| 568 | struct x86_cpu_id { | ||
| 569 | __u16 vendor; | ||
| 570 | __u16 family; | ||
| 571 | __u16 model; | ||
| 572 | __u16 feature; /* bit index */ | ||
| 573 | kernel_ulong_t driver_data; | ||
| 574 | }; | ||
| 575 | |||
| 576 | #define X86_FEATURE_MATCH(x) \ | ||
| 577 | { X86_VENDOR_ANY, X86_FAMILY_ANY, X86_MODEL_ANY, x } | ||
| 578 | |||
| 579 | #define X86_VENDOR_ANY 0xffff | ||
| 580 | #define X86_FAMILY_ANY 0 | ||
| 581 | #define X86_MODEL_ANY 0 | ||
| 582 | #define X86_FEATURE_ANY 0 /* Same as FPU, you can't test for that */ | ||
| 583 | |||
| 563 | #endif /* LINUX_MOD_DEVICETABLE_H */ | 584 | #endif /* LINUX_MOD_DEVICETABLE_H */ |
diff --git a/include/linux/mtd/cfi.h b/include/linux/mtd/cfi.h index d5d2ec6494bb..37ef6b194089 100644 --- a/include/linux/mtd/cfi.h +++ b/include/linux/mtd/cfi.h | |||
| @@ -22,6 +22,7 @@ | |||
| 22 | 22 | ||
| 23 | #include <linux/delay.h> | 23 | #include <linux/delay.h> |
| 24 | #include <linux/types.h> | 24 | #include <linux/types.h> |
| 25 | #include <linux/bug.h> | ||
| 25 | #include <linux/interrupt.h> | 26 | #include <linux/interrupt.h> |
| 26 | #include <linux/mtd/flashchip.h> | 27 | #include <linux/mtd/flashchip.h> |
| 27 | #include <linux/mtd/map.h> | 28 | #include <linux/mtd/map.h> |
diff --git a/include/linux/net.h b/include/linux/net.h index b29923006b11..be60c7f5e145 100644 --- a/include/linux/net.h +++ b/include/linux/net.h | |||
| @@ -206,6 +206,7 @@ struct proto_ops { | |||
| 206 | int offset, size_t size, int flags); | 206 | int offset, size_t size, int flags); |
| 207 | ssize_t (*splice_read)(struct socket *sock, loff_t *ppos, | 207 | ssize_t (*splice_read)(struct socket *sock, loff_t *ppos, |
| 208 | struct pipe_inode_info *pipe, size_t len, unsigned int flags); | 208 | struct pipe_inode_info *pipe, size_t len, unsigned int flags); |
| 209 | void (*set_peek_off)(struct sock *sk, int val); | ||
| 209 | }; | 210 | }; |
| 210 | 211 | ||
| 211 | #define DECLARE_SOCKADDR(type, dst, src) \ | 212 | #define DECLARE_SOCKADDR(type, dst, src) \ |
diff --git a/include/linux/netdev_features.h b/include/linux/netdev_features.h index 77f5202977ce..5ac32123035a 100644 --- a/include/linux/netdev_features.h +++ b/include/linux/netdev_features.h | |||
| @@ -54,6 +54,8 @@ enum { | |||
| 54 | NETIF_F_RXCSUM_BIT, /* Receive checksumming offload */ | 54 | NETIF_F_RXCSUM_BIT, /* Receive checksumming offload */ |
| 55 | NETIF_F_NOCACHE_COPY_BIT, /* Use no-cache copyfromuser */ | 55 | NETIF_F_NOCACHE_COPY_BIT, /* Use no-cache copyfromuser */ |
| 56 | NETIF_F_LOOPBACK_BIT, /* Enable loopback */ | 56 | NETIF_F_LOOPBACK_BIT, /* Enable loopback */ |
| 57 | NETIF_F_RXFCS_BIT, /* Append FCS to skb pkt data */ | ||
| 58 | NETIF_F_RXALL_BIT, /* Receive errored frames too */ | ||
| 57 | 59 | ||
| 58 | /* | 60 | /* |
| 59 | * Add your fresh new feature above and remember to update | 61 | * Add your fresh new feature above and remember to update |
| @@ -98,6 +100,8 @@ enum { | |||
| 98 | #define NETIF_F_TSO __NETIF_F(TSO) | 100 | #define NETIF_F_TSO __NETIF_F(TSO) |
| 99 | #define NETIF_F_UFO __NETIF_F(UFO) | 101 | #define NETIF_F_UFO __NETIF_F(UFO) |
| 100 | #define NETIF_F_VLAN_CHALLENGED __NETIF_F(VLAN_CHALLENGED) | 102 | #define NETIF_F_VLAN_CHALLENGED __NETIF_F(VLAN_CHALLENGED) |
| 103 | #define NETIF_F_RXFCS __NETIF_F(RXFCS) | ||
| 104 | #define NETIF_F_RXALL __NETIF_F(RXALL) | ||
| 101 | 105 | ||
| 102 | /* Features valid for ethtool to change */ | 106 | /* Features valid for ethtool to change */ |
| 103 | /* = all defined minus driver/device-class-related */ | 107 | /* = all defined minus driver/device-class-related */ |
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h index 7dfaae7846ab..1f77540bdc95 100644 --- a/include/linux/netdevice.h +++ b/include/linux/netdevice.h | |||
| @@ -33,12 +33,12 @@ | |||
| 33 | #ifdef __KERNEL__ | 33 | #ifdef __KERNEL__ |
| 34 | #include <linux/pm_qos.h> | 34 | #include <linux/pm_qos.h> |
| 35 | #include <linux/timer.h> | 35 | #include <linux/timer.h> |
| 36 | #include <linux/bug.h> | ||
| 36 | #include <linux/delay.h> | 37 | #include <linux/delay.h> |
| 37 | #include <linux/atomic.h> | 38 | #include <linux/atomic.h> |
| 38 | #include <asm/cache.h> | 39 | #include <asm/cache.h> |
| 39 | #include <asm/byteorder.h> | 40 | #include <asm/byteorder.h> |
| 40 | 41 | ||
| 41 | #include <linux/device.h> | ||
| 42 | #include <linux/percpu.h> | 42 | #include <linux/percpu.h> |
| 43 | #include <linux/rculist.h> | 43 | #include <linux/rculist.h> |
| 44 | #include <linux/dmaengine.h> | 44 | #include <linux/dmaengine.h> |
| @@ -56,6 +56,7 @@ | |||
| 56 | #include <linux/netdev_features.h> | 56 | #include <linux/netdev_features.h> |
| 57 | 57 | ||
| 58 | struct netpoll_info; | 58 | struct netpoll_info; |
| 59 | struct device; | ||
| 59 | struct phy_device; | 60 | struct phy_device; |
| 60 | /* 802.11 specific */ | 61 | /* 802.11 specific */ |
| 61 | struct wireless_dev; | 62 | struct wireless_dev; |
| @@ -417,7 +418,7 @@ typedef rx_handler_result_t rx_handler_func_t(struct sk_buff **pskb); | |||
| 417 | 418 | ||
| 418 | extern void __napi_schedule(struct napi_struct *n); | 419 | extern void __napi_schedule(struct napi_struct *n); |
| 419 | 420 | ||
| 420 | static inline int napi_disable_pending(struct napi_struct *n) | 421 | static inline bool napi_disable_pending(struct napi_struct *n) |
| 421 | { | 422 | { |
| 422 | return test_bit(NAPI_STATE_DISABLE, &n->state); | 423 | return test_bit(NAPI_STATE_DISABLE, &n->state); |
| 423 | } | 424 | } |
| @@ -431,7 +432,7 @@ static inline int napi_disable_pending(struct napi_struct *n) | |||
| 431 | * insure only one NAPI poll instance runs. We also make | 432 | * insure only one NAPI poll instance runs. We also make |
| 432 | * sure there is no pending NAPI disable. | 433 | * sure there is no pending NAPI disable. |
| 433 | */ | 434 | */ |
| 434 | static inline int napi_schedule_prep(struct napi_struct *n) | 435 | static inline bool napi_schedule_prep(struct napi_struct *n) |
| 435 | { | 436 | { |
| 436 | return !napi_disable_pending(n) && | 437 | return !napi_disable_pending(n) && |
| 437 | !test_and_set_bit(NAPI_STATE_SCHED, &n->state); | 438 | !test_and_set_bit(NAPI_STATE_SCHED, &n->state); |
| @@ -451,13 +452,13 @@ static inline void napi_schedule(struct napi_struct *n) | |||
| 451 | } | 452 | } |
| 452 | 453 | ||
| 453 | /* Try to reschedule poll. Called by dev->poll() after napi_complete(). */ | 454 | /* Try to reschedule poll. Called by dev->poll() after napi_complete(). */ |
| 454 | static inline int napi_reschedule(struct napi_struct *napi) | 455 | static inline bool napi_reschedule(struct napi_struct *napi) |
| 455 | { | 456 | { |
| 456 | if (napi_schedule_prep(napi)) { | 457 | if (napi_schedule_prep(napi)) { |
| 457 | __napi_schedule(napi); | 458 | __napi_schedule(napi); |
| 458 | return 1; | 459 | return true; |
| 459 | } | 460 | } |
| 460 | return 0; | 461 | return false; |
| 461 | } | 462 | } |
| 462 | 463 | ||
| 463 | /** | 464 | /** |
| @@ -1082,7 +1083,8 @@ struct net_device { | |||
| 1082 | const struct header_ops *header_ops; | 1083 | const struct header_ops *header_ops; |
| 1083 | 1084 | ||
| 1084 | unsigned int flags; /* interface flags (a la BSD) */ | 1085 | unsigned int flags; /* interface flags (a la BSD) */ |
| 1085 | unsigned int priv_flags; /* Like 'flags' but invisible to userspace. */ | 1086 | unsigned int priv_flags; /* Like 'flags' but invisible to userspace. |
| 1087 | * See if.h for definitions. */ | ||
| 1086 | unsigned short gflags; | 1088 | unsigned short gflags; |
| 1087 | unsigned short padded; /* How much padding added by alloc_netdev() */ | 1089 | unsigned short padded; /* How much padding added by alloc_netdev() */ |
| 1088 | 1090 | ||
| @@ -1867,7 +1869,7 @@ static inline void netif_tx_stop_all_queues(struct net_device *dev) | |||
| 1867 | } | 1869 | } |
| 1868 | } | 1870 | } |
| 1869 | 1871 | ||
| 1870 | static inline int netif_tx_queue_stopped(const struct netdev_queue *dev_queue) | 1872 | static inline bool netif_tx_queue_stopped(const struct netdev_queue *dev_queue) |
| 1871 | { | 1873 | { |
| 1872 | return test_bit(__QUEUE_STATE_DRV_XOFF, &dev_queue->state); | 1874 | return test_bit(__QUEUE_STATE_DRV_XOFF, &dev_queue->state); |
| 1873 | } | 1875 | } |
| @@ -1878,17 +1880,17 @@ static inline int netif_tx_queue_stopped(const struct netdev_queue *dev_queue) | |||
| 1878 | * | 1880 | * |
| 1879 | * Test if transmit queue on device is currently unable to send. | 1881 | * Test if transmit queue on device is currently unable to send. |
| 1880 | */ | 1882 | */ |
| 1881 | static inline int netif_queue_stopped(const struct net_device *dev) | 1883 | static inline bool netif_queue_stopped(const struct net_device *dev) |
| 1882 | { | 1884 | { |
| 1883 | return netif_tx_queue_stopped(netdev_get_tx_queue(dev, 0)); | 1885 | return netif_tx_queue_stopped(netdev_get_tx_queue(dev, 0)); |
| 1884 | } | 1886 | } |
| 1885 | 1887 | ||
| 1886 | static inline int netif_xmit_stopped(const struct netdev_queue *dev_queue) | 1888 | static inline bool netif_xmit_stopped(const struct netdev_queue *dev_queue) |
| 1887 | { | 1889 | { |
| 1888 | return dev_queue->state & QUEUE_STATE_ANY_XOFF; | 1890 | return dev_queue->state & QUEUE_STATE_ANY_XOFF; |
| 1889 | } | 1891 | } |
| 1890 | 1892 | ||
| 1891 | static inline int netif_xmit_frozen_or_stopped(const struct netdev_queue *dev_queue) | 1893 | static inline bool netif_xmit_frozen_or_stopped(const struct netdev_queue *dev_queue) |
| 1892 | { | 1894 | { |
| 1893 | return dev_queue->state & QUEUE_STATE_ANY_XOFF_OR_FROZEN; | 1895 | return dev_queue->state & QUEUE_STATE_ANY_XOFF_OR_FROZEN; |
| 1894 | } | 1896 | } |
| @@ -1898,12 +1900,22 @@ static inline void netdev_tx_sent_queue(struct netdev_queue *dev_queue, | |||
| 1898 | { | 1900 | { |
| 1899 | #ifdef CONFIG_BQL | 1901 | #ifdef CONFIG_BQL |
| 1900 | dql_queued(&dev_queue->dql, bytes); | 1902 | dql_queued(&dev_queue->dql, bytes); |
| 1901 | if (unlikely(dql_avail(&dev_queue->dql) < 0)) { | 1903 | |
| 1902 | set_bit(__QUEUE_STATE_STACK_XOFF, &dev_queue->state); | 1904 | if (likely(dql_avail(&dev_queue->dql) >= 0)) |
| 1903 | if (unlikely(dql_avail(&dev_queue->dql) >= 0)) | 1905 | return; |
| 1904 | clear_bit(__QUEUE_STATE_STACK_XOFF, | 1906 | |
| 1905 | &dev_queue->state); | 1907 | set_bit(__QUEUE_STATE_STACK_XOFF, &dev_queue->state); |
| 1906 | } | 1908 | |
| 1909 | /* | ||
| 1910 | * The XOFF flag must be set before checking the dql_avail below, | ||
| 1911 | * because in netdev_tx_completed_queue we update the dql_completed | ||
| 1912 | * before checking the XOFF flag. | ||
| 1913 | */ | ||
| 1914 | smp_mb(); | ||
| 1915 | |||
| 1916 | /* check again in case another CPU has just made room avail */ | ||
| 1917 | if (unlikely(dql_avail(&dev_queue->dql) >= 0)) | ||
| 1918 | clear_bit(__QUEUE_STATE_STACK_XOFF, &dev_queue->state); | ||
| 1907 | #endif | 1919 | #endif |
| 1908 | } | 1920 | } |
| 1909 | 1921 | ||
| @@ -1916,16 +1928,23 @@ static inline void netdev_tx_completed_queue(struct netdev_queue *dev_queue, | |||
| 1916 | unsigned pkts, unsigned bytes) | 1928 | unsigned pkts, unsigned bytes) |
| 1917 | { | 1929 | { |
| 1918 | #ifdef CONFIG_BQL | 1930 | #ifdef CONFIG_BQL |
| 1919 | if (likely(bytes)) { | 1931 | if (unlikely(!bytes)) |
| 1920 | dql_completed(&dev_queue->dql, bytes); | 1932 | return; |
| 1921 | if (unlikely(test_bit(__QUEUE_STATE_STACK_XOFF, | 1933 | |
| 1922 | &dev_queue->state) && | 1934 | dql_completed(&dev_queue->dql, bytes); |
| 1923 | dql_avail(&dev_queue->dql) >= 0)) { | 1935 | |
| 1924 | if (test_and_clear_bit(__QUEUE_STATE_STACK_XOFF, | 1936 | /* |
| 1925 | &dev_queue->state)) | 1937 | * Without the memory barrier there is a small possiblity that |
| 1926 | netif_schedule_queue(dev_queue); | 1938 | * netdev_tx_sent_queue will miss the update and cause the queue to |
| 1927 | } | 1939 | * be stopped forever |
| 1928 | } | 1940 | */ |
| 1941 | smp_mb(); | ||
| 1942 | |||
| 1943 | if (dql_avail(&dev_queue->dql) < 0) | ||
| 1944 | return; | ||
| 1945 | |||
| 1946 | if (test_and_clear_bit(__QUEUE_STATE_STACK_XOFF, &dev_queue->state)) | ||
| 1947 | netif_schedule_queue(dev_queue); | ||
| 1929 | #endif | 1948 | #endif |
| 1930 | } | 1949 | } |
| 1931 | 1950 | ||
| @@ -1938,6 +1957,7 @@ static inline void netdev_completed_queue(struct net_device *dev, | |||
| 1938 | static inline void netdev_tx_reset_queue(struct netdev_queue *q) | 1957 | static inline void netdev_tx_reset_queue(struct netdev_queue *q) |
| 1939 | { | 1958 | { |
| 1940 | #ifdef CONFIG_BQL | 1959 | #ifdef CONFIG_BQL |
| 1960 | clear_bit(__QUEUE_STATE_STACK_XOFF, &q->state); | ||
| 1941 | dql_reset(&q->dql); | 1961 | dql_reset(&q->dql); |
| 1942 | #endif | 1962 | #endif |
| 1943 | } | 1963 | } |
| @@ -1953,7 +1973,7 @@ static inline void netdev_reset_queue(struct net_device *dev_queue) | |||
| 1953 | * | 1973 | * |
| 1954 | * Test if the device has been brought up. | 1974 | * Test if the device has been brought up. |
| 1955 | */ | 1975 | */ |
| 1956 | static inline int netif_running(const struct net_device *dev) | 1976 | static inline bool netif_running(const struct net_device *dev) |
| 1957 | { | 1977 | { |
| 1958 | return test_bit(__LINK_STATE_START, &dev->state); | 1978 | return test_bit(__LINK_STATE_START, &dev->state); |
| 1959 | } | 1979 | } |
| @@ -2003,16 +2023,16 @@ static inline void netif_stop_subqueue(struct net_device *dev, u16 queue_index) | |||
| 2003 | * | 2023 | * |
| 2004 | * Check individual transmit queue of a device with multiple transmit queues. | 2024 | * Check individual transmit queue of a device with multiple transmit queues. |
| 2005 | */ | 2025 | */ |
| 2006 | static inline int __netif_subqueue_stopped(const struct net_device *dev, | 2026 | static inline bool __netif_subqueue_stopped(const struct net_device *dev, |
| 2007 | u16 queue_index) | 2027 | u16 queue_index) |
| 2008 | { | 2028 | { |
| 2009 | struct netdev_queue *txq = netdev_get_tx_queue(dev, queue_index); | 2029 | struct netdev_queue *txq = netdev_get_tx_queue(dev, queue_index); |
| 2010 | 2030 | ||
| 2011 | return netif_tx_queue_stopped(txq); | 2031 | return netif_tx_queue_stopped(txq); |
| 2012 | } | 2032 | } |
| 2013 | 2033 | ||
| 2014 | static inline int netif_subqueue_stopped(const struct net_device *dev, | 2034 | static inline bool netif_subqueue_stopped(const struct net_device *dev, |
| 2015 | struct sk_buff *skb) | 2035 | struct sk_buff *skb) |
| 2016 | { | 2036 | { |
| 2017 | return __netif_subqueue_stopped(dev, skb_get_queue_mapping(skb)); | 2037 | return __netif_subqueue_stopped(dev, skb_get_queue_mapping(skb)); |
| 2018 | } | 2038 | } |
| @@ -2051,7 +2071,7 @@ static inline u16 skb_tx_hash(const struct net_device *dev, | |||
| 2051 | * | 2071 | * |
| 2052 | * Check if device has multiple transmit queues | 2072 | * Check if device has multiple transmit queues |
| 2053 | */ | 2073 | */ |
| 2054 | static inline int netif_is_multiqueue(const struct net_device *dev) | 2074 | static inline bool netif_is_multiqueue(const struct net_device *dev) |
| 2055 | { | 2075 | { |
| 2056 | return dev->num_tx_queues > 1; | 2076 | return dev->num_tx_queues > 1; |
| 2057 | } | 2077 | } |
| @@ -2121,7 +2141,7 @@ extern int netdev_rx_handler_register(struct net_device *dev, | |||
| 2121 | void *rx_handler_data); | 2141 | void *rx_handler_data); |
| 2122 | extern void netdev_rx_handler_unregister(struct net_device *dev); | 2142 | extern void netdev_rx_handler_unregister(struct net_device *dev); |
| 2123 | 2143 | ||
| 2124 | extern int dev_valid_name(const char *name); | 2144 | extern bool dev_valid_name(const char *name); |
| 2125 | extern int dev_ioctl(struct net *net, unsigned int cmd, void __user *); | 2145 | extern int dev_ioctl(struct net *net, unsigned int cmd, void __user *); |
| 2126 | extern int dev_ethtool(struct net *net, struct ifreq *); | 2146 | extern int dev_ethtool(struct net *net, struct ifreq *); |
| 2127 | extern unsigned dev_get_flags(const struct net_device *); | 2147 | extern unsigned dev_get_flags(const struct net_device *); |
| @@ -2187,7 +2207,7 @@ extern void linkwatch_forget_dev(struct net_device *dev); | |||
| 2187 | * | 2207 | * |
| 2188 | * Check if carrier is present on device | 2208 | * Check if carrier is present on device |
| 2189 | */ | 2209 | */ |
| 2190 | static inline int netif_carrier_ok(const struct net_device *dev) | 2210 | static inline bool netif_carrier_ok(const struct net_device *dev) |
| 2191 | { | 2211 | { |
| 2192 | return !test_bit(__LINK_STATE_NOCARRIER, &dev->state); | 2212 | return !test_bit(__LINK_STATE_NOCARRIER, &dev->state); |
| 2193 | } | 2213 | } |
| @@ -2239,7 +2259,7 @@ static inline void netif_dormant_off(struct net_device *dev) | |||
| 2239 | * | 2259 | * |
| 2240 | * Check if carrier is present on device | 2260 | * Check if carrier is present on device |
| 2241 | */ | 2261 | */ |
| 2242 | static inline int netif_dormant(const struct net_device *dev) | 2262 | static inline bool netif_dormant(const struct net_device *dev) |
| 2243 | { | 2263 | { |
| 2244 | return test_bit(__LINK_STATE_DORMANT, &dev->state); | 2264 | return test_bit(__LINK_STATE_DORMANT, &dev->state); |
| 2245 | } | 2265 | } |
| @@ -2251,7 +2271,7 @@ static inline int netif_dormant(const struct net_device *dev) | |||
| 2251 | * | 2271 | * |
| 2252 | * Check if carrier is operational | 2272 | * Check if carrier is operational |
| 2253 | */ | 2273 | */ |
| 2254 | static inline int netif_oper_up(const struct net_device *dev) | 2274 | static inline bool netif_oper_up(const struct net_device *dev) |
| 2255 | { | 2275 | { |
| 2256 | return (dev->operstate == IF_OPER_UP || | 2276 | return (dev->operstate == IF_OPER_UP || |
| 2257 | dev->operstate == IF_OPER_UNKNOWN /* backward compat */); | 2277 | dev->operstate == IF_OPER_UNKNOWN /* backward compat */); |
| @@ -2263,7 +2283,7 @@ static inline int netif_oper_up(const struct net_device *dev) | |||
| 2263 | * | 2283 | * |
| 2264 | * Check if device has not been removed from system. | 2284 | * Check if device has not been removed from system. |
| 2265 | */ | 2285 | */ |
| 2266 | static inline int netif_device_present(struct net_device *dev) | 2286 | static inline bool netif_device_present(struct net_device *dev) |
| 2267 | { | 2287 | { |
| 2268 | return test_bit(__LINK_STATE_PRESENT, &dev->state); | 2288 | return test_bit(__LINK_STATE_PRESENT, &dev->state); |
| 2269 | } | 2289 | } |
| @@ -2333,9 +2353,9 @@ static inline void __netif_tx_lock_bh(struct netdev_queue *txq) | |||
| 2333 | txq->xmit_lock_owner = smp_processor_id(); | 2353 | txq->xmit_lock_owner = smp_processor_id(); |
| 2334 | } | 2354 | } |
| 2335 | 2355 | ||
| 2336 | static inline int __netif_tx_trylock(struct netdev_queue *txq) | 2356 | static inline bool __netif_tx_trylock(struct netdev_queue *txq) |
| 2337 | { | 2357 | { |
| 2338 | int ok = spin_trylock(&txq->_xmit_lock); | 2358 | bool ok = spin_trylock(&txq->_xmit_lock); |
| 2339 | if (likely(ok)) | 2359 | if (likely(ok)) |
| 2340 | txq->xmit_lock_owner = smp_processor_id(); | 2360 | txq->xmit_lock_owner = smp_processor_id(); |
| 2341 | return ok; | 2361 | return ok; |
| @@ -2556,6 +2576,8 @@ extern void dev_load(struct net *net, const char *name); | |||
| 2556 | extern void dev_mcast_init(void); | 2576 | extern void dev_mcast_init(void); |
| 2557 | extern struct rtnl_link_stats64 *dev_get_stats(struct net_device *dev, | 2577 | extern struct rtnl_link_stats64 *dev_get_stats(struct net_device *dev, |
| 2558 | struct rtnl_link_stats64 *storage); | 2578 | struct rtnl_link_stats64 *storage); |
| 2579 | extern void netdev_stats_to_stats64(struct rtnl_link_stats64 *stats64, | ||
| 2580 | const struct net_device_stats *netdev_stats); | ||
| 2559 | 2581 | ||
| 2560 | extern int netdev_max_backlog; | 2582 | extern int netdev_max_backlog; |
| 2561 | extern int netdev_tstamp_prequeue; | 2583 | extern int netdev_tstamp_prequeue; |
| @@ -2611,7 +2633,7 @@ void netif_stacked_transfer_operstate(const struct net_device *rootdev, | |||
| 2611 | 2633 | ||
| 2612 | netdev_features_t netif_skb_features(struct sk_buff *skb); | 2634 | netdev_features_t netif_skb_features(struct sk_buff *skb); |
| 2613 | 2635 | ||
| 2614 | static inline int net_gso_ok(netdev_features_t features, int gso_type) | 2636 | static inline bool net_gso_ok(netdev_features_t features, int gso_type) |
| 2615 | { | 2637 | { |
| 2616 | netdev_features_t feature = gso_type << NETIF_F_GSO_SHIFT; | 2638 | netdev_features_t feature = gso_type << NETIF_F_GSO_SHIFT; |
| 2617 | 2639 | ||
| @@ -2626,17 +2648,18 @@ static inline int net_gso_ok(netdev_features_t features, int gso_type) | |||
| 2626 | return (features & feature) == feature; | 2648 | return (features & feature) == feature; |
| 2627 | } | 2649 | } |
| 2628 | 2650 | ||
| 2629 | static inline int skb_gso_ok(struct sk_buff *skb, netdev_features_t features) | 2651 | static inline bool skb_gso_ok(struct sk_buff *skb, netdev_features_t features) |
| 2630 | { | 2652 | { |
| 2631 | return net_gso_ok(features, skb_shinfo(skb)->gso_type) && | 2653 | return net_gso_ok(features, skb_shinfo(skb)->gso_type) && |
| 2632 | (!skb_has_frag_list(skb) || (features & NETIF_F_FRAGLIST)); | 2654 | (!skb_has_frag_list(skb) || (features & NETIF_F_FRAGLIST)); |
| 2633 | } | 2655 | } |
| 2634 | 2656 | ||
| 2635 | static inline int netif_needs_gso(struct sk_buff *skb, | 2657 | static inline bool netif_needs_gso(struct sk_buff *skb, |
| 2636 | netdev_features_t features) | 2658 | netdev_features_t features) |
| 2637 | { | 2659 | { |
| 2638 | return skb_is_gso(skb) && (!skb_gso_ok(skb, features) || | 2660 | return skb_is_gso(skb) && (!skb_gso_ok(skb, features) || |
| 2639 | unlikely(skb->ip_summed != CHECKSUM_PARTIAL)); | 2661 | unlikely((skb->ip_summed != CHECKSUM_PARTIAL) && |
| 2662 | (skb->ip_summed != CHECKSUM_UNNECESSARY))); | ||
| 2640 | } | 2663 | } |
| 2641 | 2664 | ||
| 2642 | static inline void netif_set_gso_max_size(struct net_device *dev, | 2665 | static inline void netif_set_gso_max_size(struct net_device *dev, |
| @@ -2645,11 +2668,16 @@ static inline void netif_set_gso_max_size(struct net_device *dev, | |||
| 2645 | dev->gso_max_size = size; | 2668 | dev->gso_max_size = size; |
| 2646 | } | 2669 | } |
| 2647 | 2670 | ||
| 2648 | static inline int netif_is_bond_slave(struct net_device *dev) | 2671 | static inline bool netif_is_bond_slave(struct net_device *dev) |
| 2649 | { | 2672 | { |
| 2650 | return dev->flags & IFF_SLAVE && dev->priv_flags & IFF_BONDING; | 2673 | return dev->flags & IFF_SLAVE && dev->priv_flags & IFF_BONDING; |
| 2651 | } | 2674 | } |
| 2652 | 2675 | ||
| 2676 | static inline bool netif_supports_nofcs(struct net_device *dev) | ||
| 2677 | { | ||
| 2678 | return dev->priv_flags & IFF_SUPP_NOFCS; | ||
| 2679 | } | ||
| 2680 | |||
| 2653 | extern struct pernet_operations __net_initdata loopback_net_ops; | 2681 | extern struct pernet_operations __net_initdata loopback_net_ops; |
| 2654 | 2682 | ||
| 2655 | /* Logging, debugging and troubleshooting/diagnostic helpers. */ | 2683 | /* Logging, debugging and troubleshooting/diagnostic helpers. */ |
| @@ -2687,14 +2715,14 @@ int netdev_info(const struct net_device *dev, const char *format, ...); | |||
| 2687 | #define MODULE_ALIAS_NETDEV(device) \ | 2715 | #define MODULE_ALIAS_NETDEV(device) \ |
| 2688 | MODULE_ALIAS("netdev-" device) | 2716 | MODULE_ALIAS("netdev-" device) |
| 2689 | 2717 | ||
| 2690 | #if defined(DEBUG) | 2718 | #if defined(CONFIG_DYNAMIC_DEBUG) |
| 2691 | #define netdev_dbg(__dev, format, args...) \ | ||
| 2692 | netdev_printk(KERN_DEBUG, __dev, format, ##args) | ||
| 2693 | #elif defined(CONFIG_DYNAMIC_DEBUG) | ||
| 2694 | #define netdev_dbg(__dev, format, args...) \ | 2719 | #define netdev_dbg(__dev, format, args...) \ |
| 2695 | do { \ | 2720 | do { \ |
| 2696 | dynamic_netdev_dbg(__dev, format, ##args); \ | 2721 | dynamic_netdev_dbg(__dev, format, ##args); \ |
| 2697 | } while (0) | 2722 | } while (0) |
| 2723 | #elif defined(DEBUG) | ||
| 2724 | #define netdev_dbg(__dev, format, args...) \ | ||
| 2725 | netdev_printk(KERN_DEBUG, __dev, format, ##args) | ||
| 2698 | #else | 2726 | #else |
| 2699 | #define netdev_dbg(__dev, format, args...) \ | 2727 | #define netdev_dbg(__dev, format, args...) \ |
| 2700 | ({ \ | 2728 | ({ \ |
diff --git a/include/linux/netfilter/Kbuild b/include/linux/netfilter/Kbuild index e144f54185c0..1697036336b6 100644 --- a/include/linux/netfilter/Kbuild +++ b/include/linux/netfilter/Kbuild | |||
| @@ -10,6 +10,7 @@ header-y += nfnetlink.h | |||
| 10 | header-y += nfnetlink_acct.h | 10 | header-y += nfnetlink_acct.h |
| 11 | header-y += nfnetlink_compat.h | 11 | header-y += nfnetlink_compat.h |
| 12 | header-y += nfnetlink_conntrack.h | 12 | header-y += nfnetlink_conntrack.h |
| 13 | header-y += nfnetlink_cttimeout.h | ||
| 13 | header-y += nfnetlink_log.h | 14 | header-y += nfnetlink_log.h |
| 14 | header-y += nfnetlink_queue.h | 15 | header-y += nfnetlink_queue.h |
| 15 | header-y += x_tables.h | 16 | header-y += x_tables.h |
| @@ -22,6 +23,7 @@ header-y += xt_CT.h | |||
| 22 | header-y += xt_DSCP.h | 23 | header-y += xt_DSCP.h |
| 23 | header-y += xt_IDLETIMER.h | 24 | header-y += xt_IDLETIMER.h |
| 24 | header-y += xt_LED.h | 25 | header-y += xt_LED.h |
| 26 | header-y += xt_LOG.h | ||
| 25 | header-y += xt_MARK.h | 27 | header-y += xt_MARK.h |
| 26 | header-y += xt_nfacct.h | 28 | header-y += xt_nfacct.h |
| 27 | header-y += xt_NFLOG.h | 29 | header-y += xt_NFLOG.h |
diff --git a/include/linux/netfilter/ipset/ip_set.h b/include/linux/netfilter/ipset/ip_set.h index 3540c6e262f7..2f8e18a23227 100644 --- a/include/linux/netfilter/ipset/ip_set.h +++ b/include/linux/netfilter/ipset/ip_set.h | |||
| @@ -11,6 +11,8 @@ | |||
| 11 | * published by the Free Software Foundation. | 11 | * published by the Free Software Foundation. |
| 12 | */ | 12 | */ |
| 13 | 13 | ||
| 14 | #include <linux/types.h> | ||
| 15 | |||
| 14 | /* The protocol version */ | 16 | /* The protocol version */ |
| 15 | #define IPSET_PROTOCOL 6 | 17 | #define IPSET_PROTOCOL 6 |
| 16 | 18 | ||
| @@ -148,6 +150,7 @@ enum ipset_cmd_flags { | |||
| 148 | IPSET_FLAG_LIST_SETNAME = (1 << IPSET_FLAG_BIT_LIST_SETNAME), | 150 | IPSET_FLAG_LIST_SETNAME = (1 << IPSET_FLAG_BIT_LIST_SETNAME), |
| 149 | IPSET_FLAG_BIT_LIST_HEADER = 2, | 151 | IPSET_FLAG_BIT_LIST_HEADER = 2, |
| 150 | IPSET_FLAG_LIST_HEADER = (1 << IPSET_FLAG_BIT_LIST_HEADER), | 152 | IPSET_FLAG_LIST_HEADER = (1 << IPSET_FLAG_BIT_LIST_HEADER), |
| 153 | IPSET_FLAG_CMD_MAX = 15, /* Lower half */ | ||
| 151 | }; | 154 | }; |
| 152 | 155 | ||
| 153 | /* Flags at CADT attribute level */ | 156 | /* Flags at CADT attribute level */ |
| @@ -156,6 +159,9 @@ enum ipset_cadt_flags { | |||
| 156 | IPSET_FLAG_BEFORE = (1 << IPSET_FLAG_BIT_BEFORE), | 159 | IPSET_FLAG_BEFORE = (1 << IPSET_FLAG_BIT_BEFORE), |
| 157 | IPSET_FLAG_BIT_PHYSDEV = 1, | 160 | IPSET_FLAG_BIT_PHYSDEV = 1, |
| 158 | IPSET_FLAG_PHYSDEV = (1 << IPSET_FLAG_BIT_PHYSDEV), | 161 | IPSET_FLAG_PHYSDEV = (1 << IPSET_FLAG_BIT_PHYSDEV), |
| 162 | IPSET_FLAG_BIT_NOMATCH = 2, | ||
| 163 | IPSET_FLAG_NOMATCH = (1 << IPSET_FLAG_BIT_NOMATCH), | ||
| 164 | IPSET_FLAG_CADT_MAX = 15, /* Upper half */ | ||
| 159 | }; | 165 | }; |
| 160 | 166 | ||
| 161 | /* Commands with settype-specific attributes */ | 167 | /* Commands with settype-specific attributes */ |
| @@ -168,19 +174,10 @@ enum ipset_adt { | |||
| 168 | IPSET_CADT_MAX, | 174 | IPSET_CADT_MAX, |
| 169 | }; | 175 | }; |
| 170 | 176 | ||
| 171 | #ifdef __KERNEL__ | ||
| 172 | #include <linux/ip.h> | ||
| 173 | #include <linux/ipv6.h> | ||
| 174 | #include <linux/netlink.h> | ||
| 175 | #include <linux/netfilter.h> | ||
| 176 | #include <linux/netfilter/x_tables.h> | ||
| 177 | #include <linux/vmalloc.h> | ||
| 178 | #include <net/netlink.h> | ||
| 179 | |||
| 180 | /* Sets are identified by an index in kernel space. Tweak with ip_set_id_t | 177 | /* Sets are identified by an index in kernel space. Tweak with ip_set_id_t |
| 181 | * and IPSET_INVALID_ID if you want to increase the max number of sets. | 178 | * and IPSET_INVALID_ID if you want to increase the max number of sets. |
| 182 | */ | 179 | */ |
| 183 | typedef u16 ip_set_id_t; | 180 | typedef __u16 ip_set_id_t; |
| 184 | 181 | ||
| 185 | #define IPSET_INVALID_ID 65535 | 182 | #define IPSET_INVALID_ID 65535 |
| 186 | 183 | ||
| @@ -203,6 +200,15 @@ enum ip_set_kopt { | |||
| 203 | IPSET_DIM_THREE_SRC = (1 << IPSET_DIM_THREE), | 200 | IPSET_DIM_THREE_SRC = (1 << IPSET_DIM_THREE), |
| 204 | }; | 201 | }; |
| 205 | 202 | ||
| 203 | #ifdef __KERNEL__ | ||
| 204 | #include <linux/ip.h> | ||
| 205 | #include <linux/ipv6.h> | ||
| 206 | #include <linux/netlink.h> | ||
| 207 | #include <linux/netfilter.h> | ||
| 208 | #include <linux/netfilter/x_tables.h> | ||
| 209 | #include <linux/vmalloc.h> | ||
| 210 | #include <net/netlink.h> | ||
| 211 | |||
| 206 | /* Set features */ | 212 | /* Set features */ |
| 207 | enum ip_set_feature { | 213 | enum ip_set_feature { |
| 208 | IPSET_TYPE_IP_FLAG = 0, | 214 | IPSET_TYPE_IP_FLAG = 0, |
| @@ -288,7 +294,10 @@ struct ip_set_type { | |||
| 288 | u8 features; | 294 | u8 features; |
| 289 | /* Set type dimension */ | 295 | /* Set type dimension */ |
| 290 | u8 dimension; | 296 | u8 dimension; |
| 291 | /* Supported family: may be AF_UNSPEC for both AF_INET/AF_INET6 */ | 297 | /* |
| 298 | * Supported family: may be NFPROTO_UNSPEC for both | ||
| 299 | * NFPROTO_IPV4/NFPROTO_IPV6. | ||
| 300 | */ | ||
| 292 | u8 family; | 301 | u8 family; |
| 293 | /* Type revisions */ | 302 | /* Type revisions */ |
| 294 | u8 revision_min, revision_max; | 303 | u8 revision_min, revision_max; |
| @@ -450,6 +459,8 @@ bitmap_bytes(u32 a, u32 b) | |||
| 450 | return 4 * ((((b - a + 8) / 8) + 3) / 4); | 459 | return 4 * ((((b - a + 8) / 8) + 3) / 4); |
| 451 | } | 460 | } |
| 452 | 461 | ||
| 462 | #endif /* __KERNEL__ */ | ||
| 463 | |||
| 453 | /* Interface to iptables/ip6tables */ | 464 | /* Interface to iptables/ip6tables */ |
| 454 | 465 | ||
| 455 | #define SO_IP_SET 83 | 466 | #define SO_IP_SET 83 |
| @@ -475,6 +486,4 @@ struct ip_set_req_version { | |||
| 475 | unsigned version; | 486 | unsigned version; |
| 476 | }; | 487 | }; |
| 477 | 488 | ||
| 478 | #endif /* __KERNEL__ */ | ||
| 479 | |||
| 480 | #endif /*_IP_SET_H */ | 489 | #endif /*_IP_SET_H */ |
diff --git a/include/linux/netfilter/ipset/ip_set_ahash.h b/include/linux/netfilter/ipset/ip_set_ahash.h index b89fb79cb44f..05a5d72680be 100644 --- a/include/linux/netfilter/ipset/ip_set_ahash.h +++ b/include/linux/netfilter/ipset/ip_set_ahash.h | |||
| @@ -113,6 +113,12 @@ htable_bits(u32 hashsize) | |||
| 113 | } | 113 | } |
| 114 | 114 | ||
| 115 | #ifdef IP_SET_HASH_WITH_NETS | 115 | #ifdef IP_SET_HASH_WITH_NETS |
| 116 | #ifdef IP_SET_HASH_WITH_NETS_PACKED | ||
| 117 | /* When cidr is packed with nomatch, cidr - 1 is stored in the entry */ | ||
| 118 | #define CIDR(cidr) (cidr + 1) | ||
| 119 | #else | ||
| 120 | #define CIDR(cidr) (cidr) | ||
| 121 | #endif | ||
| 116 | 122 | ||
| 117 | #define SET_HOST_MASK(family) (family == AF_INET ? 32 : 128) | 123 | #define SET_HOST_MASK(family) (family == AF_INET ? 32 : 128) |
| 118 | 124 | ||
| @@ -262,6 +268,12 @@ ip_set_hash_destroy(struct ip_set *set) | |||
| 262 | #define type_pf_data_list TOKEN(TYPE, PF, _data_list) | 268 | #define type_pf_data_list TOKEN(TYPE, PF, _data_list) |
| 263 | #define type_pf_data_tlist TOKEN(TYPE, PF, _data_tlist) | 269 | #define type_pf_data_tlist TOKEN(TYPE, PF, _data_tlist) |
| 264 | #define type_pf_data_next TOKEN(TYPE, PF, _data_next) | 270 | #define type_pf_data_next TOKEN(TYPE, PF, _data_next) |
| 271 | #define type_pf_data_flags TOKEN(TYPE, PF, _data_flags) | ||
| 272 | #ifdef IP_SET_HASH_WITH_NETS | ||
| 273 | #define type_pf_data_match TOKEN(TYPE, PF, _data_match) | ||
| 274 | #else | ||
| 275 | #define type_pf_data_match(d) 1 | ||
| 276 | #endif | ||
| 265 | 277 | ||
| 266 | #define type_pf_elem TOKEN(TYPE, PF, _elem) | 278 | #define type_pf_elem TOKEN(TYPE, PF, _elem) |
| 267 | #define type_pf_telem TOKEN(TYPE, PF, _telem) | 279 | #define type_pf_telem TOKEN(TYPE, PF, _telem) |
| @@ -308,8 +320,10 @@ ip_set_hash_destroy(struct ip_set *set) | |||
| 308 | * we spare the maintenance of the internal counters. */ | 320 | * we spare the maintenance of the internal counters. */ |
| 309 | static int | 321 | static int |
| 310 | type_pf_elem_add(struct hbucket *n, const struct type_pf_elem *value, | 322 | type_pf_elem_add(struct hbucket *n, const struct type_pf_elem *value, |
| 311 | u8 ahash_max) | 323 | u8 ahash_max, u32 cadt_flags) |
| 312 | { | 324 | { |
| 325 | struct type_pf_elem *data; | ||
| 326 | |||
| 313 | if (n->pos >= n->size) { | 327 | if (n->pos >= n->size) { |
| 314 | void *tmp; | 328 | void *tmp; |
| 315 | 329 | ||
| @@ -330,7 +344,13 @@ type_pf_elem_add(struct hbucket *n, const struct type_pf_elem *value, | |||
| 330 | n->value = tmp; | 344 | n->value = tmp; |
| 331 | n->size += AHASH_INIT_SIZE; | 345 | n->size += AHASH_INIT_SIZE; |
| 332 | } | 346 | } |
| 333 | type_pf_data_copy(ahash_data(n, n->pos++), value); | 347 | data = ahash_data(n, n->pos++); |
| 348 | type_pf_data_copy(data, value); | ||
| 349 | #ifdef IP_SET_HASH_WITH_NETS | ||
| 350 | /* Resizing won't overwrite stored flags */ | ||
| 351 | if (cadt_flags) | ||
| 352 | type_pf_data_flags(data, cadt_flags); | ||
| 353 | #endif | ||
| 334 | return 0; | 354 | return 0; |
| 335 | } | 355 | } |
| 336 | 356 | ||
| @@ -353,9 +373,12 @@ retry: | |||
| 353 | htable_bits++; | 373 | htable_bits++; |
| 354 | pr_debug("attempt to resize set %s from %u to %u, t %p\n", | 374 | pr_debug("attempt to resize set %s from %u to %u, t %p\n", |
| 355 | set->name, orig->htable_bits, htable_bits, orig); | 375 | set->name, orig->htable_bits, htable_bits, orig); |
| 356 | if (!htable_bits) | 376 | if (!htable_bits) { |
| 357 | /* In case we have plenty of memory :-) */ | 377 | /* In case we have plenty of memory :-) */ |
| 378 | pr_warning("Cannot increase the hashsize of set %s further\n", | ||
| 379 | set->name); | ||
| 358 | return -IPSET_ERR_HASH_FULL; | 380 | return -IPSET_ERR_HASH_FULL; |
| 381 | } | ||
| 359 | t = ip_set_alloc(sizeof(*t) | 382 | t = ip_set_alloc(sizeof(*t) |
| 360 | + jhash_size(htable_bits) * sizeof(struct hbucket)); | 383 | + jhash_size(htable_bits) * sizeof(struct hbucket)); |
| 361 | if (!t) | 384 | if (!t) |
| @@ -368,7 +391,7 @@ retry: | |||
| 368 | for (j = 0; j < n->pos; j++) { | 391 | for (j = 0; j < n->pos; j++) { |
| 369 | data = ahash_data(n, j); | 392 | data = ahash_data(n, j); |
| 370 | m = hbucket(t, HKEY(data, h->initval, htable_bits)); | 393 | m = hbucket(t, HKEY(data, h->initval, htable_bits)); |
| 371 | ret = type_pf_elem_add(m, data, AHASH_MAX(h)); | 394 | ret = type_pf_elem_add(m, data, AHASH_MAX(h), 0); |
| 372 | if (ret < 0) { | 395 | if (ret < 0) { |
| 373 | read_unlock_bh(&set->lock); | 396 | read_unlock_bh(&set->lock); |
| 374 | ahash_destroy(t); | 397 | ahash_destroy(t); |
| @@ -406,9 +429,14 @@ type_pf_add(struct ip_set *set, void *value, u32 timeout, u32 flags) | |||
| 406 | struct hbucket *n; | 429 | struct hbucket *n; |
| 407 | int i, ret = 0; | 430 | int i, ret = 0; |
| 408 | u32 key, multi = 0; | 431 | u32 key, multi = 0; |
| 432 | u32 cadt_flags = flags >> 16; | ||
| 409 | 433 | ||
| 410 | if (h->elements >= h->maxelem) | 434 | if (h->elements >= h->maxelem) { |
| 435 | if (net_ratelimit()) | ||
| 436 | pr_warning("Set %s is full, maxelem %u reached\n", | ||
| 437 | set->name, h->maxelem); | ||
| 411 | return -IPSET_ERR_HASH_FULL; | 438 | return -IPSET_ERR_HASH_FULL; |
| 439 | } | ||
| 412 | 440 | ||
| 413 | rcu_read_lock_bh(); | 441 | rcu_read_lock_bh(); |
| 414 | t = rcu_dereference_bh(h->table); | 442 | t = rcu_dereference_bh(h->table); |
| @@ -416,11 +444,17 @@ type_pf_add(struct ip_set *set, void *value, u32 timeout, u32 flags) | |||
| 416 | n = hbucket(t, key); | 444 | n = hbucket(t, key); |
| 417 | for (i = 0; i < n->pos; i++) | 445 | for (i = 0; i < n->pos; i++) |
| 418 | if (type_pf_data_equal(ahash_data(n, i), d, &multi)) { | 446 | if (type_pf_data_equal(ahash_data(n, i), d, &multi)) { |
| 447 | #ifdef IP_SET_HASH_WITH_NETS | ||
| 448 | if (flags & IPSET_FLAG_EXIST) | ||
| 449 | /* Support overwriting just the flags */ | ||
| 450 | type_pf_data_flags(ahash_data(n, i), | ||
| 451 | cadt_flags); | ||
| 452 | #endif | ||
| 419 | ret = -IPSET_ERR_EXIST; | 453 | ret = -IPSET_ERR_EXIST; |
| 420 | goto out; | 454 | goto out; |
| 421 | } | 455 | } |
| 422 | TUNE_AHASH_MAX(h, multi); | 456 | TUNE_AHASH_MAX(h, multi); |
| 423 | ret = type_pf_elem_add(n, value, AHASH_MAX(h)); | 457 | ret = type_pf_elem_add(n, value, AHASH_MAX(h), cadt_flags); |
| 424 | if (ret != 0) { | 458 | if (ret != 0) { |
| 425 | if (ret == -EAGAIN) | 459 | if (ret == -EAGAIN) |
| 426 | type_pf_data_next(h, d); | 460 | type_pf_data_next(h, d); |
| @@ -428,7 +462,7 @@ type_pf_add(struct ip_set *set, void *value, u32 timeout, u32 flags) | |||
| 428 | } | 462 | } |
| 429 | 463 | ||
| 430 | #ifdef IP_SET_HASH_WITH_NETS | 464 | #ifdef IP_SET_HASH_WITH_NETS |
| 431 | add_cidr(h, d->cidr, HOST_MASK); | 465 | add_cidr(h, CIDR(d->cidr), HOST_MASK); |
| 432 | #endif | 466 | #endif |
| 433 | h->elements++; | 467 | h->elements++; |
| 434 | out: | 468 | out: |
| @@ -463,7 +497,7 @@ type_pf_del(struct ip_set *set, void *value, u32 timeout, u32 flags) | |||
| 463 | n->pos--; | 497 | n->pos--; |
| 464 | h->elements--; | 498 | h->elements--; |
| 465 | #ifdef IP_SET_HASH_WITH_NETS | 499 | #ifdef IP_SET_HASH_WITH_NETS |
| 466 | del_cidr(h, d->cidr, HOST_MASK); | 500 | del_cidr(h, CIDR(d->cidr), HOST_MASK); |
| 467 | #endif | 501 | #endif |
| 468 | if (n->pos + AHASH_INIT_SIZE < n->size) { | 502 | if (n->pos + AHASH_INIT_SIZE < n->size) { |
| 469 | void *tmp = kzalloc((n->size - AHASH_INIT_SIZE) | 503 | void *tmp = kzalloc((n->size - AHASH_INIT_SIZE) |
| @@ -506,7 +540,7 @@ type_pf_test_cidrs(struct ip_set *set, struct type_pf_elem *d, u32 timeout) | |||
| 506 | for (i = 0; i < n->pos; i++) { | 540 | for (i = 0; i < n->pos; i++) { |
| 507 | data = ahash_data(n, i); | 541 | data = ahash_data(n, i); |
| 508 | if (type_pf_data_equal(data, d, &multi)) | 542 | if (type_pf_data_equal(data, d, &multi)) |
| 509 | return 1; | 543 | return type_pf_data_match(data); |
| 510 | } | 544 | } |
| 511 | } | 545 | } |
| 512 | return 0; | 546 | return 0; |
| @@ -528,7 +562,7 @@ type_pf_test(struct ip_set *set, void *value, u32 timeout, u32 flags) | |||
| 528 | #ifdef IP_SET_HASH_WITH_NETS | 562 | #ifdef IP_SET_HASH_WITH_NETS |
| 529 | /* If we test an IP address and not a network address, | 563 | /* If we test an IP address and not a network address, |
| 530 | * try all possible network sizes */ | 564 | * try all possible network sizes */ |
| 531 | if (d->cidr == SET_HOST_MASK(set->family)) | 565 | if (CIDR(d->cidr) == SET_HOST_MASK(set->family)) |
| 532 | return type_pf_test_cidrs(set, d, timeout); | 566 | return type_pf_test_cidrs(set, d, timeout); |
| 533 | #endif | 567 | #endif |
| 534 | 568 | ||
| @@ -537,7 +571,7 @@ type_pf_test(struct ip_set *set, void *value, u32 timeout, u32 flags) | |||
| 537 | for (i = 0; i < n->pos; i++) { | 571 | for (i = 0; i < n->pos; i++) { |
| 538 | data = ahash_data(n, i); | 572 | data = ahash_data(n, i); |
| 539 | if (type_pf_data_equal(data, d, &multi)) | 573 | if (type_pf_data_equal(data, d, &multi)) |
| 540 | return 1; | 574 | return type_pf_data_match(data); |
| 541 | } | 575 | } |
| 542 | return 0; | 576 | return 0; |
| 543 | } | 577 | } |
| @@ -693,7 +727,7 @@ type_pf_data_timeout_set(struct type_pf_elem *data, u32 timeout) | |||
| 693 | 727 | ||
| 694 | static int | 728 | static int |
| 695 | type_pf_elem_tadd(struct hbucket *n, const struct type_pf_elem *value, | 729 | type_pf_elem_tadd(struct hbucket *n, const struct type_pf_elem *value, |
| 696 | u8 ahash_max, u32 timeout) | 730 | u8 ahash_max, u32 cadt_flags, u32 timeout) |
| 697 | { | 731 | { |
| 698 | struct type_pf_elem *data; | 732 | struct type_pf_elem *data; |
| 699 | 733 | ||
| @@ -720,6 +754,11 @@ type_pf_elem_tadd(struct hbucket *n, const struct type_pf_elem *value, | |||
| 720 | data = ahash_tdata(n, n->pos++); | 754 | data = ahash_tdata(n, n->pos++); |
| 721 | type_pf_data_copy(data, value); | 755 | type_pf_data_copy(data, value); |
| 722 | type_pf_data_timeout_set(data, timeout); | 756 | type_pf_data_timeout_set(data, timeout); |
| 757 | #ifdef IP_SET_HASH_WITH_NETS | ||
| 758 | /* Resizing won't overwrite stored flags */ | ||
| 759 | if (cadt_flags) | ||
| 760 | type_pf_data_flags(data, cadt_flags); | ||
| 761 | #endif | ||
| 723 | return 0; | 762 | return 0; |
| 724 | } | 763 | } |
| 725 | 764 | ||
| @@ -740,7 +779,7 @@ type_pf_expire(struct ip_set_hash *h) | |||
| 740 | if (type_pf_data_expired(data)) { | 779 | if (type_pf_data_expired(data)) { |
| 741 | pr_debug("expired %u/%u\n", i, j); | 780 | pr_debug("expired %u/%u\n", i, j); |
| 742 | #ifdef IP_SET_HASH_WITH_NETS | 781 | #ifdef IP_SET_HASH_WITH_NETS |
| 743 | del_cidr(h, data->cidr, HOST_MASK); | 782 | del_cidr(h, CIDR(data->cidr), HOST_MASK); |
| 744 | #endif | 783 | #endif |
| 745 | if (j != n->pos - 1) | 784 | if (j != n->pos - 1) |
| 746 | /* Not last one */ | 785 | /* Not last one */ |
| @@ -790,9 +829,12 @@ type_pf_tresize(struct ip_set *set, bool retried) | |||
| 790 | retry: | 829 | retry: |
| 791 | ret = 0; | 830 | ret = 0; |
| 792 | htable_bits++; | 831 | htable_bits++; |
| 793 | if (!htable_bits) | 832 | if (!htable_bits) { |
| 794 | /* In case we have plenty of memory :-) */ | 833 | /* In case we have plenty of memory :-) */ |
| 834 | pr_warning("Cannot increase the hashsize of set %s further\n", | ||
| 835 | set->name); | ||
| 795 | return -IPSET_ERR_HASH_FULL; | 836 | return -IPSET_ERR_HASH_FULL; |
| 837 | } | ||
| 796 | t = ip_set_alloc(sizeof(*t) | 838 | t = ip_set_alloc(sizeof(*t) |
| 797 | + jhash_size(htable_bits) * sizeof(struct hbucket)); | 839 | + jhash_size(htable_bits) * sizeof(struct hbucket)); |
| 798 | if (!t) | 840 | if (!t) |
| @@ -805,7 +847,7 @@ retry: | |||
| 805 | for (j = 0; j < n->pos; j++) { | 847 | for (j = 0; j < n->pos; j++) { |
| 806 | data = ahash_tdata(n, j); | 848 | data = ahash_tdata(n, j); |
| 807 | m = hbucket(t, HKEY(data, h->initval, htable_bits)); | 849 | m = hbucket(t, HKEY(data, h->initval, htable_bits)); |
| 808 | ret = type_pf_elem_tadd(m, data, AHASH_MAX(h), | 850 | ret = type_pf_elem_tadd(m, data, AHASH_MAX(h), 0, |
| 809 | type_pf_data_timeout(data)); | 851 | type_pf_data_timeout(data)); |
| 810 | if (ret < 0) { | 852 | if (ret < 0) { |
| 811 | read_unlock_bh(&set->lock); | 853 | read_unlock_bh(&set->lock); |
| @@ -839,12 +881,17 @@ type_pf_tadd(struct ip_set *set, void *value, u32 timeout, u32 flags) | |||
| 839 | int ret = 0, i, j = AHASH_MAX(h) + 1; | 881 | int ret = 0, i, j = AHASH_MAX(h) + 1; |
| 840 | bool flag_exist = flags & IPSET_FLAG_EXIST; | 882 | bool flag_exist = flags & IPSET_FLAG_EXIST; |
| 841 | u32 key, multi = 0; | 883 | u32 key, multi = 0; |
| 884 | u32 cadt_flags = flags >> 16; | ||
| 842 | 885 | ||
| 843 | if (h->elements >= h->maxelem) | 886 | if (h->elements >= h->maxelem) |
| 844 | /* FIXME: when set is full, we slow down here */ | 887 | /* FIXME: when set is full, we slow down here */ |
| 845 | type_pf_expire(h); | 888 | type_pf_expire(h); |
| 846 | if (h->elements >= h->maxelem) | 889 | if (h->elements >= h->maxelem) { |
| 890 | if (net_ratelimit()) | ||
| 891 | pr_warning("Set %s is full, maxelem %u reached\n", | ||
| 892 | set->name, h->maxelem); | ||
| 847 | return -IPSET_ERR_HASH_FULL; | 893 | return -IPSET_ERR_HASH_FULL; |
| 894 | } | ||
| 848 | 895 | ||
| 849 | rcu_read_lock_bh(); | 896 | rcu_read_lock_bh(); |
| 850 | t = rcu_dereference_bh(h->table); | 897 | t = rcu_dereference_bh(h->table); |
| @@ -854,6 +901,7 @@ type_pf_tadd(struct ip_set *set, void *value, u32 timeout, u32 flags) | |||
| 854 | data = ahash_tdata(n, i); | 901 | data = ahash_tdata(n, i); |
| 855 | if (type_pf_data_equal(data, d, &multi)) { | 902 | if (type_pf_data_equal(data, d, &multi)) { |
| 856 | if (type_pf_data_expired(data) || flag_exist) | 903 | if (type_pf_data_expired(data) || flag_exist) |
| 904 | /* Just timeout value may be updated */ | ||
| 857 | j = i; | 905 | j = i; |
| 858 | else { | 906 | else { |
| 859 | ret = -IPSET_ERR_EXIST; | 907 | ret = -IPSET_ERR_EXIST; |
| @@ -866,15 +914,18 @@ type_pf_tadd(struct ip_set *set, void *value, u32 timeout, u32 flags) | |||
| 866 | if (j != AHASH_MAX(h) + 1) { | 914 | if (j != AHASH_MAX(h) + 1) { |
| 867 | data = ahash_tdata(n, j); | 915 | data = ahash_tdata(n, j); |
| 868 | #ifdef IP_SET_HASH_WITH_NETS | 916 | #ifdef IP_SET_HASH_WITH_NETS |
| 869 | del_cidr(h, data->cidr, HOST_MASK); | 917 | del_cidr(h, CIDR(data->cidr), HOST_MASK); |
| 870 | add_cidr(h, d->cidr, HOST_MASK); | 918 | add_cidr(h, CIDR(d->cidr), HOST_MASK); |
| 871 | #endif | 919 | #endif |
| 872 | type_pf_data_copy(data, d); | 920 | type_pf_data_copy(data, d); |
| 873 | type_pf_data_timeout_set(data, timeout); | 921 | type_pf_data_timeout_set(data, timeout); |
| 922 | #ifdef IP_SET_HASH_WITH_NETS | ||
| 923 | type_pf_data_flags(data, cadt_flags); | ||
| 924 | #endif | ||
| 874 | goto out; | 925 | goto out; |
| 875 | } | 926 | } |
| 876 | TUNE_AHASH_MAX(h, multi); | 927 | TUNE_AHASH_MAX(h, multi); |
| 877 | ret = type_pf_elem_tadd(n, d, AHASH_MAX(h), timeout); | 928 | ret = type_pf_elem_tadd(n, d, AHASH_MAX(h), cadt_flags, timeout); |
| 878 | if (ret != 0) { | 929 | if (ret != 0) { |
| 879 | if (ret == -EAGAIN) | 930 | if (ret == -EAGAIN) |
| 880 | type_pf_data_next(h, d); | 931 | type_pf_data_next(h, d); |
| @@ -882,7 +933,7 @@ type_pf_tadd(struct ip_set *set, void *value, u32 timeout, u32 flags) | |||
| 882 | } | 933 | } |
| 883 | 934 | ||
| 884 | #ifdef IP_SET_HASH_WITH_NETS | 935 | #ifdef IP_SET_HASH_WITH_NETS |
| 885 | add_cidr(h, d->cidr, HOST_MASK); | 936 | add_cidr(h, CIDR(d->cidr), HOST_MASK); |
| 886 | #endif | 937 | #endif |
| 887 | h->elements++; | 938 | h->elements++; |
| 888 | out: | 939 | out: |
| @@ -916,7 +967,7 @@ type_pf_tdel(struct ip_set *set, void *value, u32 timeout, u32 flags) | |||
| 916 | n->pos--; | 967 | n->pos--; |
| 917 | h->elements--; | 968 | h->elements--; |
| 918 | #ifdef IP_SET_HASH_WITH_NETS | 969 | #ifdef IP_SET_HASH_WITH_NETS |
| 919 | del_cidr(h, d->cidr, HOST_MASK); | 970 | del_cidr(h, CIDR(d->cidr), HOST_MASK); |
| 920 | #endif | 971 | #endif |
| 921 | if (n->pos + AHASH_INIT_SIZE < n->size) { | 972 | if (n->pos + AHASH_INIT_SIZE < n->size) { |
| 922 | void *tmp = kzalloc((n->size - AHASH_INIT_SIZE) | 973 | void *tmp = kzalloc((n->size - AHASH_INIT_SIZE) |
| @@ -954,8 +1005,17 @@ type_pf_ttest_cidrs(struct ip_set *set, struct type_pf_elem *d, u32 timeout) | |||
| 954 | n = hbucket(t, key); | 1005 | n = hbucket(t, key); |
| 955 | for (i = 0; i < n->pos; i++) { | 1006 | for (i = 0; i < n->pos; i++) { |
| 956 | data = ahash_tdata(n, i); | 1007 | data = ahash_tdata(n, i); |
| 957 | if (type_pf_data_equal(data, d, &multi)) | 1008 | #ifdef IP_SET_HASH_WITH_MULTI |
| 958 | return !type_pf_data_expired(data); | 1009 | if (type_pf_data_equal(data, d, &multi)) { |
| 1010 | if (!type_pf_data_expired(data)) | ||
| 1011 | return type_pf_data_match(data); | ||
| 1012 | multi = 0; | ||
| 1013 | } | ||
| 1014 | #else | ||
| 1015 | if (type_pf_data_equal(data, d, &multi) && | ||
| 1016 | !type_pf_data_expired(data)) | ||
| 1017 | return type_pf_data_match(data); | ||
| 1018 | #endif | ||
| 959 | } | 1019 | } |
| 960 | } | 1020 | } |
| 961 | return 0; | 1021 | return 0; |
| @@ -973,15 +1033,16 @@ type_pf_ttest(struct ip_set *set, void *value, u32 timeout, u32 flags) | |||
| 973 | u32 key, multi = 0; | 1033 | u32 key, multi = 0; |
| 974 | 1034 | ||
| 975 | #ifdef IP_SET_HASH_WITH_NETS | 1035 | #ifdef IP_SET_HASH_WITH_NETS |
| 976 | if (d->cidr == SET_HOST_MASK(set->family)) | 1036 | if (CIDR(d->cidr) == SET_HOST_MASK(set->family)) |
| 977 | return type_pf_ttest_cidrs(set, d, timeout); | 1037 | return type_pf_ttest_cidrs(set, d, timeout); |
| 978 | #endif | 1038 | #endif |
| 979 | key = HKEY(d, h->initval, t->htable_bits); | 1039 | key = HKEY(d, h->initval, t->htable_bits); |
| 980 | n = hbucket(t, key); | 1040 | n = hbucket(t, key); |
| 981 | for (i = 0; i < n->pos; i++) { | 1041 | for (i = 0; i < n->pos; i++) { |
| 982 | data = ahash_tdata(n, i); | 1042 | data = ahash_tdata(n, i); |
| 983 | if (type_pf_data_equal(data, d, &multi)) | 1043 | if (type_pf_data_equal(data, d, &multi) && |
| 984 | return !type_pf_data_expired(data); | 1044 | !type_pf_data_expired(data)) |
| 1045 | return type_pf_data_match(data); | ||
| 985 | } | 1046 | } |
| 986 | return 0; | 1047 | return 0; |
| 987 | } | 1048 | } |
| @@ -1094,14 +1155,17 @@ type_pf_gc_init(struct ip_set *set) | |||
| 1094 | #undef type_pf_data_isnull | 1155 | #undef type_pf_data_isnull |
| 1095 | #undef type_pf_data_copy | 1156 | #undef type_pf_data_copy |
| 1096 | #undef type_pf_data_zero_out | 1157 | #undef type_pf_data_zero_out |
| 1158 | #undef type_pf_data_netmask | ||
| 1097 | #undef type_pf_data_list | 1159 | #undef type_pf_data_list |
| 1098 | #undef type_pf_data_tlist | 1160 | #undef type_pf_data_tlist |
| 1161 | #undef type_pf_data_next | ||
| 1162 | #undef type_pf_data_flags | ||
| 1163 | #undef type_pf_data_match | ||
| 1099 | 1164 | ||
| 1100 | #undef type_pf_elem | 1165 | #undef type_pf_elem |
| 1101 | #undef type_pf_telem | 1166 | #undef type_pf_telem |
| 1102 | #undef type_pf_data_timeout | 1167 | #undef type_pf_data_timeout |
| 1103 | #undef type_pf_data_expired | 1168 | #undef type_pf_data_expired |
| 1104 | #undef type_pf_data_netmask | ||
| 1105 | #undef type_pf_data_timeout_set | 1169 | #undef type_pf_data_timeout_set |
| 1106 | 1170 | ||
| 1107 | #undef type_pf_elem_add | 1171 | #undef type_pf_elem_add |
| @@ -1111,6 +1175,7 @@ type_pf_gc_init(struct ip_set *set) | |||
| 1111 | #undef type_pf_test | 1175 | #undef type_pf_test |
| 1112 | 1176 | ||
| 1113 | #undef type_pf_elem_tadd | 1177 | #undef type_pf_elem_tadd |
| 1178 | #undef type_pf_del_telem | ||
| 1114 | #undef type_pf_expire | 1179 | #undef type_pf_expire |
| 1115 | #undef type_pf_tadd | 1180 | #undef type_pf_tadd |
| 1116 | #undef type_pf_tdel | 1181 | #undef type_pf_tdel |
diff --git a/include/linux/netfilter/nf_conntrack_tcp.h b/include/linux/netfilter/nf_conntrack_tcp.h index 6e135f97e59a..e59868ae12d4 100644 --- a/include/linux/netfilter/nf_conntrack_tcp.h +++ b/include/linux/netfilter/nf_conntrack_tcp.h | |||
| @@ -18,7 +18,10 @@ enum tcp_conntrack { | |||
| 18 | TCP_CONNTRACK_LISTEN, /* obsolete */ | 18 | TCP_CONNTRACK_LISTEN, /* obsolete */ |
| 19 | #define TCP_CONNTRACK_SYN_SENT2 TCP_CONNTRACK_LISTEN | 19 | #define TCP_CONNTRACK_SYN_SENT2 TCP_CONNTRACK_LISTEN |
| 20 | TCP_CONNTRACK_MAX, | 20 | TCP_CONNTRACK_MAX, |
| 21 | TCP_CONNTRACK_IGNORE | 21 | TCP_CONNTRACK_IGNORE, |
| 22 | TCP_CONNTRACK_RETRANS, | ||
| 23 | TCP_CONNTRACK_UNACK, | ||
| 24 | TCP_CONNTRACK_TIMEOUT_MAX | ||
| 22 | }; | 25 | }; |
| 23 | 26 | ||
| 24 | /* Window scaling is advertised by the sender */ | 27 | /* Window scaling is advertised by the sender */ |
diff --git a/include/linux/netfilter/nfnetlink.h b/include/linux/netfilter/nfnetlink.h index b64454c2f79f..6fd1f0d07e64 100644 --- a/include/linux/netfilter/nfnetlink.h +++ b/include/linux/netfilter/nfnetlink.h | |||
| @@ -49,7 +49,8 @@ struct nfgenmsg { | |||
| 49 | #define NFNL_SUBSYS_OSF 5 | 49 | #define NFNL_SUBSYS_OSF 5 |
| 50 | #define NFNL_SUBSYS_IPSET 6 | 50 | #define NFNL_SUBSYS_IPSET 6 |
| 51 | #define NFNL_SUBSYS_ACCT 7 | 51 | #define NFNL_SUBSYS_ACCT 7 |
| 52 | #define NFNL_SUBSYS_COUNT 8 | 52 | #define NFNL_SUBSYS_CTNETLINK_TIMEOUT 8 |
| 53 | #define NFNL_SUBSYS_COUNT 9 | ||
| 53 | 54 | ||
| 54 | #ifdef __KERNEL__ | 55 | #ifdef __KERNEL__ |
| 55 | 56 | ||
diff --git a/include/linux/netfilter/nfnetlink_conntrack.h b/include/linux/netfilter/nfnetlink_conntrack.h index debf1aefd753..e58e4b93c108 100644 --- a/include/linux/netfilter/nfnetlink_conntrack.h +++ b/include/linux/netfilter/nfnetlink_conntrack.h | |||
| @@ -43,6 +43,7 @@ enum ctattr_type { | |||
| 43 | CTA_ZONE, | 43 | CTA_ZONE, |
| 44 | CTA_SECCTX, | 44 | CTA_SECCTX, |
| 45 | CTA_TIMESTAMP, | 45 | CTA_TIMESTAMP, |
| 46 | CTA_MARK_MASK, | ||
| 46 | __CTA_MAX | 47 | __CTA_MAX |
| 47 | }; | 48 | }; |
| 48 | #define CTA_MAX (__CTA_MAX - 1) | 49 | #define CTA_MAX (__CTA_MAX - 1) |
| @@ -172,10 +173,21 @@ enum ctattr_expect { | |||
| 172 | CTA_EXPECT_HELP_NAME, | 173 | CTA_EXPECT_HELP_NAME, |
| 173 | CTA_EXPECT_ZONE, | 174 | CTA_EXPECT_ZONE, |
| 174 | CTA_EXPECT_FLAGS, | 175 | CTA_EXPECT_FLAGS, |
| 176 | CTA_EXPECT_CLASS, | ||
| 177 | CTA_EXPECT_NAT, | ||
| 178 | CTA_EXPECT_FN, | ||
| 175 | __CTA_EXPECT_MAX | 179 | __CTA_EXPECT_MAX |
| 176 | }; | 180 | }; |
| 177 | #define CTA_EXPECT_MAX (__CTA_EXPECT_MAX - 1) | 181 | #define CTA_EXPECT_MAX (__CTA_EXPECT_MAX - 1) |
| 178 | 182 | ||
| 183 | enum ctattr_expect_nat { | ||
| 184 | CTA_EXPECT_NAT_UNSPEC, | ||
| 185 | CTA_EXPECT_NAT_DIR, | ||
| 186 | CTA_EXPECT_NAT_TUPLE, | ||
| 187 | __CTA_EXPECT_NAT_MAX | ||
| 188 | }; | ||
| 189 | #define CTA_EXPECT_NAT_MAX (__CTA_EXPECT_NAT_MAX - 1) | ||
| 190 | |||
| 179 | enum ctattr_help { | 191 | enum ctattr_help { |
| 180 | CTA_HELP_UNSPEC, | 192 | CTA_HELP_UNSPEC, |
| 181 | CTA_HELP_NAME, | 193 | CTA_HELP_NAME, |
diff --git a/include/linux/netfilter/nfnetlink_cttimeout.h b/include/linux/netfilter/nfnetlink_cttimeout.h new file mode 100644 index 000000000000..a2810a7c5e30 --- /dev/null +++ b/include/linux/netfilter/nfnetlink_cttimeout.h | |||
| @@ -0,0 +1,114 @@ | |||
| 1 | #ifndef _CTTIMEOUT_NETLINK_H | ||
| 2 | #define _CTTIMEOUT_NETLINK_H | ||
| 3 | #include <linux/netfilter/nfnetlink.h> | ||
| 4 | |||
| 5 | enum ctnl_timeout_msg_types { | ||
| 6 | IPCTNL_MSG_TIMEOUT_NEW, | ||
| 7 | IPCTNL_MSG_TIMEOUT_GET, | ||
| 8 | IPCTNL_MSG_TIMEOUT_DELETE, | ||
| 9 | |||
| 10 | IPCTNL_MSG_TIMEOUT_MAX | ||
| 11 | }; | ||
| 12 | |||
| 13 | enum ctattr_timeout { | ||
| 14 | CTA_TIMEOUT_UNSPEC, | ||
| 15 | CTA_TIMEOUT_NAME, | ||
| 16 | CTA_TIMEOUT_L3PROTO, | ||
| 17 | CTA_TIMEOUT_L4PROTO, | ||
| 18 | CTA_TIMEOUT_DATA, | ||
| 19 | CTA_TIMEOUT_USE, | ||
| 20 | __CTA_TIMEOUT_MAX | ||
| 21 | }; | ||
| 22 | #define CTA_TIMEOUT_MAX (__CTA_TIMEOUT_MAX - 1) | ||
| 23 | |||
| 24 | enum ctattr_timeout_generic { | ||
| 25 | CTA_TIMEOUT_GENERIC_UNSPEC, | ||
| 26 | CTA_TIMEOUT_GENERIC_TIMEOUT, | ||
| 27 | __CTA_TIMEOUT_GENERIC_MAX | ||
| 28 | }; | ||
| 29 | #define CTA_TIMEOUT_GENERIC_MAX (__CTA_TIMEOUT_GENERIC_MAX - 1) | ||
| 30 | |||
| 31 | enum ctattr_timeout_tcp { | ||
| 32 | CTA_TIMEOUT_TCP_UNSPEC, | ||
| 33 | CTA_TIMEOUT_TCP_SYN_SENT, | ||
| 34 | CTA_TIMEOUT_TCP_SYN_RECV, | ||
| 35 | CTA_TIMEOUT_TCP_ESTABLISHED, | ||
| 36 | CTA_TIMEOUT_TCP_FIN_WAIT, | ||
| 37 | CTA_TIMEOUT_TCP_CLOSE_WAIT, | ||
| 38 | CTA_TIMEOUT_TCP_LAST_ACK, | ||
| 39 | CTA_TIMEOUT_TCP_TIME_WAIT, | ||
| 40 | CTA_TIMEOUT_TCP_CLOSE, | ||
| 41 | CTA_TIMEOUT_TCP_SYN_SENT2, | ||
| 42 | CTA_TIMEOUT_TCP_RETRANS, | ||
| 43 | CTA_TIMEOUT_TCP_UNACK, | ||
| 44 | __CTA_TIMEOUT_TCP_MAX | ||
| 45 | }; | ||
| 46 | #define CTA_TIMEOUT_TCP_MAX (__CTA_TIMEOUT_TCP_MAX - 1) | ||
| 47 | |||
| 48 | enum ctattr_timeout_udp { | ||
| 49 | CTA_TIMEOUT_UDP_UNSPEC, | ||
| 50 | CTA_TIMEOUT_UDP_UNREPLIED, | ||
| 51 | CTA_TIMEOUT_UDP_REPLIED, | ||
| 52 | __CTA_TIMEOUT_UDP_MAX | ||
| 53 | }; | ||
| 54 | #define CTA_TIMEOUT_UDP_MAX (__CTA_TIMEOUT_UDP_MAX - 1) | ||
| 55 | |||
| 56 | enum ctattr_timeout_udplite { | ||
| 57 | CTA_TIMEOUT_UDPLITE_UNSPEC, | ||
| 58 | CTA_TIMEOUT_UDPLITE_UNREPLIED, | ||
| 59 | CTA_TIMEOUT_UDPLITE_REPLIED, | ||
| 60 | __CTA_TIMEOUT_UDPLITE_MAX | ||
| 61 | }; | ||
| 62 | #define CTA_TIMEOUT_UDPLITE_MAX (__CTA_TIMEOUT_UDPLITE_MAX - 1) | ||
| 63 | |||
| 64 | enum ctattr_timeout_icmp { | ||
| 65 | CTA_TIMEOUT_ICMP_UNSPEC, | ||
| 66 | CTA_TIMEOUT_ICMP_TIMEOUT, | ||
| 67 | __CTA_TIMEOUT_ICMP_MAX | ||
| 68 | }; | ||
| 69 | #define CTA_TIMEOUT_ICMP_MAX (__CTA_TIMEOUT_ICMP_MAX - 1) | ||
| 70 | |||
| 71 | enum ctattr_timeout_dccp { | ||
| 72 | CTA_TIMEOUT_DCCP_UNSPEC, | ||
| 73 | CTA_TIMEOUT_DCCP_REQUEST, | ||
| 74 | CTA_TIMEOUT_DCCP_RESPOND, | ||
| 75 | CTA_TIMEOUT_DCCP_PARTOPEN, | ||
| 76 | CTA_TIMEOUT_DCCP_OPEN, | ||
| 77 | CTA_TIMEOUT_DCCP_CLOSEREQ, | ||
| 78 | CTA_TIMEOUT_DCCP_CLOSING, | ||
| 79 | CTA_TIMEOUT_DCCP_TIMEWAIT, | ||
| 80 | __CTA_TIMEOUT_DCCP_MAX | ||
| 81 | }; | ||
| 82 | #define CTA_TIMEOUT_DCCP_MAX (__CTA_TIMEOUT_DCCP_MAX - 1) | ||
| 83 | |||
| 84 | enum ctattr_timeout_sctp { | ||
| 85 | CTA_TIMEOUT_SCTP_UNSPEC, | ||
| 86 | CTA_TIMEOUT_SCTP_CLOSED, | ||
| 87 | CTA_TIMEOUT_SCTP_COOKIE_WAIT, | ||
| 88 | CTA_TIMEOUT_SCTP_COOKIE_ECHOED, | ||
| 89 | CTA_TIMEOUT_SCTP_ESTABLISHED, | ||
| 90 | CTA_TIMEOUT_SCTP_SHUTDOWN_SENT, | ||
| 91 | CTA_TIMEOUT_SCTP_SHUTDOWN_RECD, | ||
| 92 | CTA_TIMEOUT_SCTP_SHUTDOWN_ACK_SENT, | ||
| 93 | __CTA_TIMEOUT_SCTP_MAX | ||
| 94 | }; | ||
| 95 | #define CTA_TIMEOUT_SCTP_MAX (__CTA_TIMEOUT_SCTP_MAX - 1) | ||
| 96 | |||
| 97 | enum ctattr_timeout_icmpv6 { | ||
| 98 | CTA_TIMEOUT_ICMPV6_UNSPEC, | ||
| 99 | CTA_TIMEOUT_ICMPV6_TIMEOUT, | ||
| 100 | __CTA_TIMEOUT_ICMPV6_MAX | ||
| 101 | }; | ||
| 102 | #define CTA_TIMEOUT_ICMPV6_MAX (__CTA_TIMEOUT_ICMPV6_MAX - 1) | ||
| 103 | |||
| 104 | enum ctattr_timeout_gre { | ||
| 105 | CTA_TIMEOUT_GRE_UNSPEC, | ||
| 106 | CTA_TIMEOUT_GRE_UNREPLIED, | ||
| 107 | CTA_TIMEOUT_GRE_REPLIED, | ||
| 108 | __CTA_TIMEOUT_GRE_MAX | ||
| 109 | }; | ||
| 110 | #define CTA_TIMEOUT_GRE_MAX (__CTA_TIMEOUT_GRE_MAX - 1) | ||
| 111 | |||
| 112 | #define CTNL_TIMEOUT_NAME_MAX 32 | ||
| 113 | |||
| 114 | #endif | ||
diff --git a/include/linux/netfilter/xt_CT.h b/include/linux/netfilter/xt_CT.h index b56e76811c04..a064b8af360c 100644 --- a/include/linux/netfilter/xt_CT.h +++ b/include/linux/netfilter/xt_CT.h | |||
| @@ -16,4 +16,16 @@ struct xt_ct_target_info { | |||
| 16 | struct nf_conn *ct __attribute__((aligned(8))); | 16 | struct nf_conn *ct __attribute__((aligned(8))); |
| 17 | }; | 17 | }; |
| 18 | 18 | ||
| 19 | struct xt_ct_target_info_v1 { | ||
| 20 | __u16 flags; | ||
| 21 | __u16 zone; | ||
| 22 | __u32 ct_events; | ||
| 23 | __u32 exp_events; | ||
| 24 | char helper[16]; | ||
| 25 | char timeout[32]; | ||
| 26 | |||
| 27 | /* Used internally by the kernel */ | ||
| 28 | struct nf_conn *ct __attribute__((aligned(8))); | ||
| 29 | }; | ||
| 30 | |||
| 19 | #endif /* _XT_CT_H */ | 31 | #endif /* _XT_CT_H */ |
diff --git a/include/linux/netfilter/xt_LOG.h b/include/linux/netfilter/xt_LOG.h new file mode 100644 index 000000000000..cac079095305 --- /dev/null +++ b/include/linux/netfilter/xt_LOG.h | |||
| @@ -0,0 +1,19 @@ | |||
| 1 | #ifndef _XT_LOG_H | ||
| 2 | #define _XT_LOG_H | ||
| 3 | |||
| 4 | /* make sure not to change this without changing nf_log.h:NF_LOG_* (!) */ | ||
| 5 | #define XT_LOG_TCPSEQ 0x01 /* Log TCP sequence numbers */ | ||
| 6 | #define XT_LOG_TCPOPT 0x02 /* Log TCP options */ | ||
| 7 | #define XT_LOG_IPOPT 0x04 /* Log IP options */ | ||
| 8 | #define XT_LOG_UID 0x08 /* Log UID owning local socket */ | ||
| 9 | #define XT_LOG_NFLOG 0x10 /* Unsupported, don't reuse */ | ||
| 10 | #define XT_LOG_MACDECODE 0x20 /* Decode MAC header */ | ||
| 11 | #define XT_LOG_MASK 0x2f | ||
| 12 | |||
| 13 | struct xt_log_info { | ||
| 14 | unsigned char level; | ||
| 15 | unsigned char logflags; | ||
| 16 | char prefix[30]; | ||
| 17 | }; | ||
| 18 | |||
| 19 | #endif /* _XT_LOG_H */ | ||
diff --git a/include/linux/netfilter_ipv4/Kbuild b/include/linux/netfilter_ipv4/Kbuild index f9930c87fff3..31f8bec95650 100644 --- a/include/linux/netfilter_ipv4/Kbuild +++ b/include/linux/netfilter_ipv4/Kbuild | |||
| @@ -4,11 +4,9 @@ header-y += ipt_CLUSTERIP.h | |||
| 4 | header-y += ipt_ECN.h | 4 | header-y += ipt_ECN.h |
| 5 | header-y += ipt_LOG.h | 5 | header-y += ipt_LOG.h |
| 6 | header-y += ipt_REJECT.h | 6 | header-y += ipt_REJECT.h |
| 7 | header-y += ipt_SAME.h | ||
| 8 | header-y += ipt_TTL.h | 7 | header-y += ipt_TTL.h |
| 9 | header-y += ipt_ULOG.h | 8 | header-y += ipt_ULOG.h |
| 10 | header-y += ipt_addrtype.h | 9 | header-y += ipt_addrtype.h |
| 11 | header-y += ipt_ah.h | 10 | header-y += ipt_ah.h |
| 12 | header-y += ipt_ecn.h | 11 | header-y += ipt_ecn.h |
| 13 | header-y += ipt_realm.h | ||
| 14 | header-y += ipt_ttl.h | 12 | header-y += ipt_ttl.h |
diff --git a/include/linux/netfilter_ipv4/ipt_LOG.h b/include/linux/netfilter_ipv4/ipt_LOG.h index dcdbadf9fd4a..5d8152077d71 100644 --- a/include/linux/netfilter_ipv4/ipt_LOG.h +++ b/include/linux/netfilter_ipv4/ipt_LOG.h | |||
| @@ -1,6 +1,8 @@ | |||
| 1 | #ifndef _IPT_LOG_H | 1 | #ifndef _IPT_LOG_H |
| 2 | #define _IPT_LOG_H | 2 | #define _IPT_LOG_H |
| 3 | 3 | ||
| 4 | #warning "Please update iptables, this file will be removed soon!" | ||
| 5 | |||
| 4 | /* make sure not to change this without changing netfilter.h:NF_LOG_* (!) */ | 6 | /* make sure not to change this without changing netfilter.h:NF_LOG_* (!) */ |
| 5 | #define IPT_LOG_TCPSEQ 0x01 /* Log TCP sequence numbers */ | 7 | #define IPT_LOG_TCPSEQ 0x01 /* Log TCP sequence numbers */ |
| 6 | #define IPT_LOG_TCPOPT 0x02 /* Log TCP options */ | 8 | #define IPT_LOG_TCPOPT 0x02 /* Log TCP options */ |
diff --git a/include/linux/netfilter_ipv4/ipt_SAME.h b/include/linux/netfilter_ipv4/ipt_SAME.h deleted file mode 100644 index 5bca78267afd..000000000000 --- a/include/linux/netfilter_ipv4/ipt_SAME.h +++ /dev/null | |||
| @@ -1,20 +0,0 @@ | |||
| 1 | #ifndef _IPT_SAME_H | ||
| 2 | #define _IPT_SAME_H | ||
| 3 | |||
| 4 | #include <linux/types.h> | ||
| 5 | |||
| 6 | #define IPT_SAME_MAX_RANGE 10 | ||
| 7 | |||
| 8 | #define IPT_SAME_NODST 0x01 | ||
| 9 | |||
| 10 | struct ipt_same_info { | ||
| 11 | unsigned char info; | ||
| 12 | __u32 rangesize; | ||
| 13 | __u32 ipnum; | ||
| 14 | __u32 *iparray; | ||
| 15 | |||
| 16 | /* hangs off end. */ | ||
| 17 | struct nf_nat_range range[IPT_SAME_MAX_RANGE]; | ||
| 18 | }; | ||
| 19 | |||
| 20 | #endif /*_IPT_SAME_H*/ | ||
diff --git a/include/linux/netfilter_ipv4/ipt_realm.h b/include/linux/netfilter_ipv4/ipt_realm.h deleted file mode 100644 index b3996eaa0188..000000000000 --- a/include/linux/netfilter_ipv4/ipt_realm.h +++ /dev/null | |||
| @@ -1,7 +0,0 @@ | |||
| 1 | #ifndef _IPT_REALM_H | ||
| 2 | #define _IPT_REALM_H | ||
| 3 | |||
| 4 | #include <linux/netfilter/xt_realm.h> | ||
| 5 | #define ipt_realm_info xt_realm_info | ||
| 6 | |||
| 7 | #endif /* _IPT_REALM_H */ | ||
diff --git a/include/linux/netfilter_ipv6/ip6t_LOG.h b/include/linux/netfilter_ipv6/ip6t_LOG.h index 9dd5579e02ec..3dd0bc4e0735 100644 --- a/include/linux/netfilter_ipv6/ip6t_LOG.h +++ b/include/linux/netfilter_ipv6/ip6t_LOG.h | |||
| @@ -1,6 +1,8 @@ | |||
| 1 | #ifndef _IP6T_LOG_H | 1 | #ifndef _IP6T_LOG_H |
| 2 | #define _IP6T_LOG_H | 2 | #define _IP6T_LOG_H |
| 3 | 3 | ||
| 4 | #warning "Please update iptables, this file will be removed soon!" | ||
| 5 | |||
| 4 | /* make sure not to change this without changing netfilter.h:NF_LOG_* (!) */ | 6 | /* make sure not to change this without changing netfilter.h:NF_LOG_* (!) */ |
| 5 | #define IP6T_LOG_TCPSEQ 0x01 /* Log TCP sequence numbers */ | 7 | #define IP6T_LOG_TCPSEQ 0x01 /* Log TCP sequence numbers */ |
| 6 | #define IP6T_LOG_TCPOPT 0x02 /* Log TCP options */ | 8 | #define IP6T_LOG_TCPOPT 0x02 /* Log TCP options */ |
diff --git a/include/linux/netlink.h b/include/linux/netlink.h index 52e48959cfa1..a2092f582a78 100644 --- a/include/linux/netlink.h +++ b/include/linux/netlink.h | |||
| @@ -225,6 +225,7 @@ struct netlink_callback { | |||
| 225 | int (*dump)(struct sk_buff * skb, | 225 | int (*dump)(struct sk_buff * skb, |
| 226 | struct netlink_callback *cb); | 226 | struct netlink_callback *cb); |
| 227 | int (*done)(struct netlink_callback *cb); | 227 | int (*done)(struct netlink_callback *cb); |
| 228 | void *data; | ||
| 228 | u16 family; | 229 | u16 family; |
| 229 | u16 min_dump_alloc; | 230 | u16 min_dump_alloc; |
| 230 | unsigned int prev_seq, seq; | 231 | unsigned int prev_seq, seq; |
| @@ -237,22 +238,8 @@ struct netlink_notify { | |||
| 237 | int protocol; | 238 | int protocol; |
| 238 | }; | 239 | }; |
| 239 | 240 | ||
| 240 | static __inline__ struct nlmsghdr * | 241 | struct nlmsghdr * |
| 241 | __nlmsg_put(struct sk_buff *skb, u32 pid, u32 seq, int type, int len, int flags) | 242 | __nlmsg_put(struct sk_buff *skb, u32 pid, u32 seq, int type, int len, int flags); |
| 242 | { | ||
| 243 | struct nlmsghdr *nlh; | ||
| 244 | int size = NLMSG_LENGTH(len); | ||
| 245 | |||
| 246 | nlh = (struct nlmsghdr*)skb_put(skb, NLMSG_ALIGN(size)); | ||
| 247 | nlh->nlmsg_type = type; | ||
| 248 | nlh->nlmsg_len = size; | ||
| 249 | nlh->nlmsg_flags = flags; | ||
| 250 | nlh->nlmsg_pid = pid; | ||
| 251 | nlh->nlmsg_seq = seq; | ||
| 252 | if (!__builtin_constant_p(size) || NLMSG_ALIGN(size) - size != 0) | ||
| 253 | memset(NLMSG_DATA(nlh) + len, 0, NLMSG_ALIGN(size) - size); | ||
| 254 | return nlh; | ||
| 255 | } | ||
| 256 | 243 | ||
| 257 | #define NLMSG_NEW(skb, pid, seq, type, len, flags) \ | 244 | #define NLMSG_NEW(skb, pid, seq, type, len, flags) \ |
| 258 | ({ if (unlikely(skb_tailroom(skb) < (int)NLMSG_SPACE(len))) \ | 245 | ({ if (unlikely(skb_tailroom(skb) < (int)NLMSG_SPACE(len))) \ |
| @@ -262,11 +249,16 @@ __nlmsg_put(struct sk_buff *skb, u32 pid, u32 seq, int type, int len, int flags) | |||
| 262 | #define NLMSG_PUT(skb, pid, seq, type, len) \ | 249 | #define NLMSG_PUT(skb, pid, seq, type, len) \ |
| 263 | NLMSG_NEW(skb, pid, seq, type, len, 0) | 250 | NLMSG_NEW(skb, pid, seq, type, len, 0) |
| 264 | 251 | ||
| 252 | struct netlink_dump_control { | ||
| 253 | int (*dump)(struct sk_buff *skb, struct netlink_callback *); | ||
| 254 | int (*done)(struct netlink_callback*); | ||
| 255 | void *data; | ||
| 256 | u16 min_dump_alloc; | ||
| 257 | }; | ||
| 258 | |||
| 265 | extern int netlink_dump_start(struct sock *ssk, struct sk_buff *skb, | 259 | extern int netlink_dump_start(struct sock *ssk, struct sk_buff *skb, |
| 266 | const struct nlmsghdr *nlh, | 260 | const struct nlmsghdr *nlh, |
| 267 | int (*dump)(struct sk_buff *skb, struct netlink_callback*), | 261 | struct netlink_dump_control *control); |
| 268 | int (*done)(struct netlink_callback*), | ||
| 269 | u16 min_dump_alloc); | ||
| 270 | 262 | ||
| 271 | 263 | ||
| 272 | #define NL_NONROOT_RECV 0x1 | 264 | #define NL_NONROOT_RECV 0x1 |
diff --git a/include/linux/nfc.h b/include/linux/nfc.h index 01d4e5d60325..39c1fcf089c0 100644 --- a/include/linux/nfc.h +++ b/include/linux/nfc.h | |||
| @@ -89,6 +89,8 @@ enum nfc_commands { | |||
| 89 | * @NFC_ATTR_TARGET_SEL_RES: NFC-A targets extra information (useful if the | 89 | * @NFC_ATTR_TARGET_SEL_RES: NFC-A targets extra information (useful if the |
| 90 | * target is not NFC-Forum compliant) | 90 | * target is not NFC-Forum compliant) |
| 91 | * @NFC_ATTR_TARGET_NFCID1: NFC-A targets identifier, max 10 bytes | 91 | * @NFC_ATTR_TARGET_NFCID1: NFC-A targets identifier, max 10 bytes |
| 92 | * @NFC_ATTR_TARGET_SENSB_RES: NFC-B targets extra information, max 12 bytes | ||
| 93 | * @NFC_ATTR_TARGET_SENSF_RES: NFC-F targets extra information, max 18 bytes | ||
| 92 | * @NFC_ATTR_COMM_MODE: Passive or active mode | 94 | * @NFC_ATTR_COMM_MODE: Passive or active mode |
| 93 | * @NFC_ATTR_RF_MODE: Initiator or target | 95 | * @NFC_ATTR_RF_MODE: Initiator or target |
| 94 | */ | 96 | */ |
| @@ -101,14 +103,20 @@ enum nfc_attrs { | |||
| 101 | NFC_ATTR_TARGET_SENS_RES, | 103 | NFC_ATTR_TARGET_SENS_RES, |
| 102 | NFC_ATTR_TARGET_SEL_RES, | 104 | NFC_ATTR_TARGET_SEL_RES, |
| 103 | NFC_ATTR_TARGET_NFCID1, | 105 | NFC_ATTR_TARGET_NFCID1, |
| 106 | NFC_ATTR_TARGET_SENSB_RES, | ||
| 107 | NFC_ATTR_TARGET_SENSF_RES, | ||
| 104 | NFC_ATTR_COMM_MODE, | 108 | NFC_ATTR_COMM_MODE, |
| 105 | NFC_ATTR_RF_MODE, | 109 | NFC_ATTR_RF_MODE, |
| 110 | NFC_ATTR_DEVICE_POWERED, | ||
| 106 | /* private: internal use only */ | 111 | /* private: internal use only */ |
| 107 | __NFC_ATTR_AFTER_LAST | 112 | __NFC_ATTR_AFTER_LAST |
| 108 | }; | 113 | }; |
| 109 | #define NFC_ATTR_MAX (__NFC_ATTR_AFTER_LAST - 1) | 114 | #define NFC_ATTR_MAX (__NFC_ATTR_AFTER_LAST - 1) |
| 110 | 115 | ||
| 111 | #define NFC_DEVICE_NAME_MAXSIZE 8 | 116 | #define NFC_DEVICE_NAME_MAXSIZE 8 |
| 117 | #define NFC_NFCID1_MAXSIZE 10 | ||
| 118 | #define NFC_SENSB_RES_MAXSIZE 12 | ||
| 119 | #define NFC_SENSF_RES_MAXSIZE 18 | ||
| 112 | 120 | ||
| 113 | /* NFC protocols */ | 121 | /* NFC protocols */ |
| 114 | #define NFC_PROTO_JEWEL 1 | 122 | #define NFC_PROTO_JEWEL 1 |
diff --git a/include/linux/nfs.h b/include/linux/nfs.h index 8c6ee44914cb..6d1fb63f5922 100644 --- a/include/linux/nfs.h +++ b/include/linux/nfs.h | |||
| @@ -29,7 +29,7 @@ | |||
| 29 | #define NFS_MNT_VERSION 1 | 29 | #define NFS_MNT_VERSION 1 |
| 30 | #define NFS_MNT3_VERSION 3 | 30 | #define NFS_MNT3_VERSION 3 |
| 31 | 31 | ||
| 32 | #define NFS_PIPE_DIRNAME "/nfs" | 32 | #define NFS_PIPE_DIRNAME "nfs" |
| 33 | 33 | ||
| 34 | /* | 34 | /* |
| 35 | * NFS stats. The good thing with these values is that NFSv3 errors are | 35 | * NFS stats. The good thing with these values is that NFSv3 errors are |
diff --git a/include/linux/nfs4.h b/include/linux/nfs4.h index 32345c2805c0..834df8bf08b6 100644 --- a/include/linux/nfs4.h +++ b/include/linux/nfs4.h | |||
| @@ -183,15 +183,12 @@ struct nfs4_acl { | |||
| 183 | 183 | ||
| 184 | typedef struct { char data[NFS4_VERIFIER_SIZE]; } nfs4_verifier; | 184 | typedef struct { char data[NFS4_VERIFIER_SIZE]; } nfs4_verifier; |
| 185 | 185 | ||
| 186 | struct nfs41_stateid { | 186 | struct nfs_stateid4 { |
| 187 | __be32 seqid; | 187 | __be32 seqid; |
| 188 | char other[NFS4_STATEID_OTHER_SIZE]; | 188 | char other[NFS4_STATEID_OTHER_SIZE]; |
| 189 | } __attribute__ ((packed)); | 189 | } __attribute__ ((packed)); |
| 190 | 190 | ||
| 191 | typedef union { | 191 | typedef struct nfs_stateid4 nfs4_stateid; |
| 192 | char data[NFS4_STATEID_SIZE]; | ||
| 193 | struct nfs41_stateid stateid; | ||
| 194 | } nfs4_stateid; | ||
| 195 | 192 | ||
| 196 | enum nfs_opnum4 { | 193 | enum nfs_opnum4 { |
| 197 | OP_ACCESS = 3, | 194 | OP_ACCESS = 3, |
diff --git a/include/linux/nfs_fs.h b/include/linux/nfs_fs.h index 8c29950d2fa5..52a1bdb4ee2b 100644 --- a/include/linux/nfs_fs.h +++ b/include/linux/nfs_fs.h | |||
| @@ -38,6 +38,13 @@ | |||
| 38 | 38 | ||
| 39 | #ifdef __KERNEL__ | 39 | #ifdef __KERNEL__ |
| 40 | 40 | ||
| 41 | /* | ||
| 42 | * Enable dprintk() debugging support for nfs client. | ||
| 43 | */ | ||
| 44 | #ifdef CONFIG_NFS_DEBUG | ||
| 45 | # define NFS_DEBUG | ||
| 46 | #endif | ||
| 47 | |||
| 41 | #include <linux/in.h> | 48 | #include <linux/in.h> |
| 42 | #include <linux/mm.h> | 49 | #include <linux/mm.h> |
| 43 | #include <linux/pagemap.h> | 50 | #include <linux/pagemap.h> |
| @@ -171,13 +178,9 @@ struct nfs_inode { | |||
| 171 | */ | 178 | */ |
| 172 | __be32 cookieverf[2]; | 179 | __be32 cookieverf[2]; |
| 173 | 180 | ||
| 174 | /* | ||
| 175 | * This is the list of dirty unwritten pages. | ||
| 176 | */ | ||
| 177 | struct radix_tree_root nfs_page_tree; | ||
| 178 | |||
| 179 | unsigned long npages; | 181 | unsigned long npages; |
| 180 | unsigned long ncommit; | 182 | unsigned long ncommit; |
| 183 | struct list_head commit_list; | ||
| 181 | 184 | ||
| 182 | /* Open contexts for shared mmap writes */ | 185 | /* Open contexts for shared mmap writes */ |
| 183 | struct list_head open_files; | 186 | struct list_head open_files; |
| @@ -395,6 +398,29 @@ static inline void nfs_free_fhandle(const struct nfs_fh *fh) | |||
| 395 | kfree(fh); | 398 | kfree(fh); |
| 396 | } | 399 | } |
| 397 | 400 | ||
| 401 | #ifdef NFS_DEBUG | ||
| 402 | extern u32 _nfs_display_fhandle_hash(const struct nfs_fh *fh); | ||
| 403 | static inline u32 nfs_display_fhandle_hash(const struct nfs_fh *fh) | ||
| 404 | { | ||
| 405 | return _nfs_display_fhandle_hash(fh); | ||
| 406 | } | ||
| 407 | extern void _nfs_display_fhandle(const struct nfs_fh *fh, const char *caption); | ||
| 408 | #define nfs_display_fhandle(fh, caption) \ | ||
| 409 | do { \ | ||
| 410 | if (unlikely(nfs_debug & NFSDBG_FACILITY)) \ | ||
| 411 | _nfs_display_fhandle(fh, caption); \ | ||
| 412 | } while (0) | ||
| 413 | #else | ||
| 414 | static inline u32 nfs_display_fhandle_hash(const struct nfs_fh *fh) | ||
| 415 | { | ||
| 416 | return 0; | ||
| 417 | } | ||
| 418 | static inline void nfs_display_fhandle(const struct nfs_fh *fh, | ||
| 419 | const char *caption) | ||
| 420 | { | ||
| 421 | } | ||
| 422 | #endif | ||
| 423 | |||
| 398 | /* | 424 | /* |
| 399 | * linux/fs/nfs/nfsroot.c | 425 | * linux/fs/nfs/nfsroot.c |
| 400 | */ | 426 | */ |
| @@ -632,19 +658,13 @@ nfs_fileid_to_ino_t(u64 fileid) | |||
| 632 | 658 | ||
| 633 | #ifdef __KERNEL__ | 659 | #ifdef __KERNEL__ |
| 634 | 660 | ||
| 635 | /* | ||
| 636 | * Enable debugging support for nfs client. | ||
| 637 | * Requires RPC_DEBUG. | ||
| 638 | */ | ||
| 639 | #ifdef RPC_DEBUG | ||
| 640 | # define NFS_DEBUG | ||
| 641 | #endif | ||
| 642 | |||
| 643 | # undef ifdebug | 661 | # undef ifdebug |
| 644 | # ifdef NFS_DEBUG | 662 | # ifdef NFS_DEBUG |
| 645 | # define ifdebug(fac) if (unlikely(nfs_debug & NFSDBG_##fac)) | 663 | # define ifdebug(fac) if (unlikely(nfs_debug & NFSDBG_##fac)) |
| 664 | # define NFS_IFDEBUG(x) x | ||
| 646 | # else | 665 | # else |
| 647 | # define ifdebug(fac) if (0) | 666 | # define ifdebug(fac) if (0) |
| 667 | # define NFS_IFDEBUG(x) | ||
| 648 | # endif | 668 | # endif |
| 649 | #endif /* __KERNEL */ | 669 | #endif /* __KERNEL */ |
| 650 | 670 | ||
diff --git a/include/linux/nfs_fs_i.h b/include/linux/nfs_fs_i.h index 861730275ba0..a5c50d97341e 100644 --- a/include/linux/nfs_fs_i.h +++ b/include/linux/nfs_fs_i.h | |||
| @@ -1,10 +1,6 @@ | |||
| 1 | #ifndef _NFS_FS_I | 1 | #ifndef _NFS_FS_I |
| 2 | #define _NFS_FS_I | 2 | #define _NFS_FS_I |
| 3 | 3 | ||
| 4 | #include <asm/types.h> | ||
| 5 | #include <linux/list.h> | ||
| 6 | #include <linux/nfs.h> | ||
| 7 | |||
| 8 | struct nlm_lockowner; | 4 | struct nlm_lockowner; |
| 9 | 5 | ||
| 10 | /* | 6 | /* |
diff --git a/include/linux/nfs_fs_sb.h b/include/linux/nfs_fs_sb.h index ba4d7656ecfd..7073fc74481c 100644 --- a/include/linux/nfs_fs_sb.h +++ b/include/linux/nfs_fs_sb.h | |||
| @@ -3,6 +3,7 @@ | |||
| 3 | 3 | ||
| 4 | #include <linux/list.h> | 4 | #include <linux/list.h> |
| 5 | #include <linux/backing-dev.h> | 5 | #include <linux/backing-dev.h> |
| 6 | #include <linux/idr.h> | ||
| 6 | #include <linux/wait.h> | 7 | #include <linux/wait.h> |
| 7 | #include <linux/nfs_xdr.h> | 8 | #include <linux/nfs_xdr.h> |
| 8 | #include <linux/sunrpc/xprt.h> | 9 | #include <linux/sunrpc/xprt.h> |
| @@ -17,6 +18,7 @@ struct nfs4_sequence_res; | |||
| 17 | struct nfs_server; | 18 | struct nfs_server; |
| 18 | struct nfs4_minor_version_ops; | 19 | struct nfs4_minor_version_ops; |
| 19 | struct server_scope; | 20 | struct server_scope; |
| 21 | struct nfs41_impl_id; | ||
| 20 | 22 | ||
| 21 | /* | 23 | /* |
| 22 | * The nfs_client identifies our client state to the server. | 24 | * The nfs_client identifies our client state to the server. |
| @@ -85,6 +87,8 @@ struct nfs_client { | |||
| 85 | #endif | 87 | #endif |
| 86 | 88 | ||
| 87 | struct server_scope *server_scope; /* from exchange_id */ | 89 | struct server_scope *server_scope; /* from exchange_id */ |
| 90 | struct nfs41_impl_id *impl_id; /* from exchange_id */ | ||
| 91 | struct net *net; | ||
| 88 | }; | 92 | }; |
| 89 | 93 | ||
| 90 | /* | 94 | /* |
| @@ -144,15 +148,18 @@ struct nfs_server { | |||
| 144 | u32 acl_bitmask; /* V4 bitmask representing the ACEs | 148 | u32 acl_bitmask; /* V4 bitmask representing the ACEs |
| 145 | that are supported on this | 149 | that are supported on this |
| 146 | filesystem */ | 150 | filesystem */ |
| 151 | u32 fh_expire_type; /* V4 bitmask representing file | ||
| 152 | handle volatility type for | ||
| 153 | this filesystem */ | ||
| 147 | struct pnfs_layoutdriver_type *pnfs_curr_ld; /* Active layout driver */ | 154 | struct pnfs_layoutdriver_type *pnfs_curr_ld; /* Active layout driver */ |
| 148 | struct rpc_wait_queue roc_rpcwaitq; | 155 | struct rpc_wait_queue roc_rpcwaitq; |
| 149 | void *pnfs_ld_data; /* per mount point data */ | 156 | void *pnfs_ld_data; /* per mount point data */ |
| 150 | 157 | ||
| 151 | /* the following fields are protected by nfs_client->cl_lock */ | 158 | /* the following fields are protected by nfs_client->cl_lock */ |
| 152 | struct rb_root state_owners; | 159 | struct rb_root state_owners; |
| 153 | struct rb_root openowner_id; | ||
| 154 | struct rb_root lockowner_id; | ||
| 155 | #endif | 160 | #endif |
| 161 | struct ida openowner_id; | ||
| 162 | struct ida lockowner_id; | ||
| 156 | struct list_head state_owners_lru; | 163 | struct list_head state_owners_lru; |
| 157 | struct list_head layouts; | 164 | struct list_head layouts; |
| 158 | struct list_head delegations; | 165 | struct list_head delegations; |
| @@ -188,21 +195,23 @@ struct nfs_server { | |||
| 188 | 195 | ||
| 189 | 196 | ||
| 190 | /* maximum number of slots to use */ | 197 | /* maximum number of slots to use */ |
| 191 | #define NFS4_MAX_SLOT_TABLE RPC_MAX_SLOT_TABLE | 198 | #define NFS4_DEF_SLOT_TABLE_SIZE (16U) |
| 199 | #define NFS4_MAX_SLOT_TABLE (256U) | ||
| 200 | #define NFS4_NO_SLOT ((u32)-1) | ||
| 192 | 201 | ||
| 193 | #if defined(CONFIG_NFS_V4) | 202 | #if defined(CONFIG_NFS_V4) |
| 194 | 203 | ||
| 195 | /* Sessions */ | 204 | /* Sessions */ |
| 196 | #define SLOT_TABLE_SZ (NFS4_MAX_SLOT_TABLE/(8*sizeof(long))) | 205 | #define SLOT_TABLE_SZ DIV_ROUND_UP(NFS4_MAX_SLOT_TABLE, 8*sizeof(long)) |
| 197 | struct nfs4_slot_table { | 206 | struct nfs4_slot_table { |
| 198 | struct nfs4_slot *slots; /* seqid per slot */ | 207 | struct nfs4_slot *slots; /* seqid per slot */ |
| 199 | unsigned long used_slots[SLOT_TABLE_SZ]; /* used/unused bitmap */ | 208 | unsigned long used_slots[SLOT_TABLE_SZ]; /* used/unused bitmap */ |
| 200 | spinlock_t slot_tbl_lock; | 209 | spinlock_t slot_tbl_lock; |
| 201 | struct rpc_wait_queue slot_tbl_waitq; /* allocators may wait here */ | 210 | struct rpc_wait_queue slot_tbl_waitq; /* allocators may wait here */ |
| 202 | int max_slots; /* # slots in table */ | 211 | u32 max_slots; /* # slots in table */ |
| 203 | int highest_used_slotid; /* sent to server on each SEQ. | 212 | u32 highest_used_slotid; /* sent to server on each SEQ. |
| 204 | * op for dynamic resizing */ | 213 | * op for dynamic resizing */ |
| 205 | int target_max_slots; /* Set by CB_RECALL_SLOT as | 214 | u32 target_max_slots; /* Set by CB_RECALL_SLOT as |
| 206 | * the new max_slots */ | 215 | * the new max_slots */ |
| 207 | struct completion complete; | 216 | struct completion complete; |
| 208 | }; | 217 | }; |
diff --git a/include/linux/nfs_idmap.h b/include/linux/nfs_idmap.h index 308c18877018..7eed2012d288 100644 --- a/include/linux/nfs_idmap.h +++ b/include/linux/nfs_idmap.h | |||
| @@ -69,36 +69,22 @@ struct nfs_server; | |||
| 69 | struct nfs_fattr; | 69 | struct nfs_fattr; |
| 70 | struct nfs4_string; | 70 | struct nfs4_string; |
| 71 | 71 | ||
| 72 | #ifdef CONFIG_NFS_USE_NEW_IDMAPPER | 72 | #ifdef CONFIG_NFS_V4 |
| 73 | |||
| 74 | int nfs_idmap_init(void); | 73 | int nfs_idmap_init(void); |
| 75 | void nfs_idmap_quit(void); | 74 | void nfs_idmap_quit(void); |
| 76 | 75 | #else | |
| 77 | static inline int nfs_idmap_new(struct nfs_client *clp) | ||
| 78 | { | ||
| 79 | return 0; | ||
| 80 | } | ||
| 81 | |||
| 82 | static inline void nfs_idmap_delete(struct nfs_client *clp) | ||
| 83 | { | ||
| 84 | } | ||
| 85 | |||
| 86 | #else /* CONFIG_NFS_USE_NEW_IDMAPPER not set */ | ||
| 87 | |||
| 88 | static inline int nfs_idmap_init(void) | 76 | static inline int nfs_idmap_init(void) |
| 89 | { | 77 | { |
| 90 | return 0; | 78 | return 0; |
| 91 | } | 79 | } |
| 92 | 80 | ||
| 93 | static inline void nfs_idmap_quit(void) | 81 | static inline void nfs_idmap_quit(void) |
| 94 | { | 82 | {} |
| 95 | } | 83 | #endif |
| 96 | 84 | ||
| 97 | int nfs_idmap_new(struct nfs_client *); | 85 | int nfs_idmap_new(struct nfs_client *); |
| 98 | void nfs_idmap_delete(struct nfs_client *); | 86 | void nfs_idmap_delete(struct nfs_client *); |
| 99 | 87 | ||
| 100 | #endif /* CONFIG_NFS_USE_NEW_IDMAPPER */ | ||
| 101 | |||
| 102 | void nfs_fattr_init_names(struct nfs_fattr *fattr, | 88 | void nfs_fattr_init_names(struct nfs_fattr *fattr, |
| 103 | struct nfs4_string *owner_name, | 89 | struct nfs4_string *owner_name, |
| 104 | struct nfs4_string *group_name); | 90 | struct nfs4_string *group_name); |
diff --git a/include/linux/nfs_iostat.h b/include/linux/nfs_iostat.h index 8866bb3502ee..9dcbbe9a51fb 100644 --- a/include/linux/nfs_iostat.h +++ b/include/linux/nfs_iostat.h | |||
| @@ -21,7 +21,7 @@ | |||
| 21 | #ifndef _LINUX_NFS_IOSTAT | 21 | #ifndef _LINUX_NFS_IOSTAT |
| 22 | #define _LINUX_NFS_IOSTAT | 22 | #define _LINUX_NFS_IOSTAT |
| 23 | 23 | ||
| 24 | #define NFS_IOSTAT_VERS "1.0" | 24 | #define NFS_IOSTAT_VERS "1.1" |
| 25 | 25 | ||
| 26 | /* | 26 | /* |
| 27 | * NFS byte counters | 27 | * NFS byte counters |
diff --git a/include/linux/nfs_page.h b/include/linux/nfs_page.h index ab465fe8c3d6..eac30d6bec17 100644 --- a/include/linux/nfs_page.h +++ b/include/linux/nfs_page.h | |||
| @@ -19,12 +19,6 @@ | |||
| 19 | #include <linux/kref.h> | 19 | #include <linux/kref.h> |
| 20 | 20 | ||
| 21 | /* | 21 | /* |
| 22 | * Valid flags for the radix tree | ||
| 23 | */ | ||
| 24 | #define NFS_PAGE_TAG_LOCKED 0 | ||
| 25 | #define NFS_PAGE_TAG_COMMIT 1 | ||
| 26 | |||
| 27 | /* | ||
| 28 | * Valid flags for a dirty buffer | 22 | * Valid flags for a dirty buffer |
| 29 | */ | 23 | */ |
| 30 | enum { | 24 | enum { |
| @@ -33,16 +27,13 @@ enum { | |||
| 33 | PG_CLEAN, | 27 | PG_CLEAN, |
| 34 | PG_NEED_COMMIT, | 28 | PG_NEED_COMMIT, |
| 35 | PG_NEED_RESCHED, | 29 | PG_NEED_RESCHED, |
| 36 | PG_PNFS_COMMIT, | ||
| 37 | PG_PARTIAL_READ_FAILED, | 30 | PG_PARTIAL_READ_FAILED, |
| 31 | PG_COMMIT_TO_DS, | ||
| 38 | }; | 32 | }; |
| 39 | 33 | ||
| 40 | struct nfs_inode; | 34 | struct nfs_inode; |
| 41 | struct nfs_page { | 35 | struct nfs_page { |
| 42 | union { | 36 | struct list_head wb_list; /* Defines state of page: */ |
| 43 | struct list_head wb_list; /* Defines state of page: */ | ||
| 44 | struct pnfs_layout_segment *wb_commit_lseg; /* Used when PG_PNFS_COMMIT set */ | ||
| 45 | }; | ||
| 46 | struct page *wb_page; /* page to read in/write out */ | 37 | struct page *wb_page; /* page to read in/write out */ |
| 47 | struct nfs_open_context *wb_context; /* File state context info */ | 38 | struct nfs_open_context *wb_context; /* File state context info */ |
| 48 | struct nfs_lock_context *wb_lock_context; /* lock context info */ | 39 | struct nfs_lock_context *wb_lock_context; /* lock context info */ |
| @@ -90,8 +81,6 @@ extern struct nfs_page *nfs_create_request(struct nfs_open_context *ctx, | |||
| 90 | extern void nfs_release_request(struct nfs_page *req); | 81 | extern void nfs_release_request(struct nfs_page *req); |
| 91 | 82 | ||
| 92 | 83 | ||
| 93 | extern int nfs_scan_list(struct nfs_inode *nfsi, struct list_head *dst, | ||
| 94 | pgoff_t idx_start, unsigned int npages, int tag); | ||
| 95 | extern void nfs_pageio_init(struct nfs_pageio_descriptor *desc, | 84 | extern void nfs_pageio_init(struct nfs_pageio_descriptor *desc, |
| 96 | struct inode *inode, | 85 | struct inode *inode, |
| 97 | const struct nfs_pageio_ops *pg_ops, | 86 | const struct nfs_pageio_ops *pg_ops, |
| @@ -106,8 +95,6 @@ extern bool nfs_generic_pg_test(struct nfs_pageio_descriptor *desc, | |||
| 106 | struct nfs_page *req); | 95 | struct nfs_page *req); |
| 107 | extern int nfs_wait_on_request(struct nfs_page *); | 96 | extern int nfs_wait_on_request(struct nfs_page *); |
| 108 | extern void nfs_unlock_request(struct nfs_page *req); | 97 | extern void nfs_unlock_request(struct nfs_page *req); |
| 109 | extern int nfs_set_page_tag_locked(struct nfs_page *req); | ||
| 110 | extern void nfs_clear_page_tag_locked(struct nfs_page *req); | ||
| 111 | 98 | ||
| 112 | /* | 99 | /* |
| 113 | * Lock the page of an asynchronous request without getting a new reference | 100 | * Lock the page of an asynchronous request without getting a new reference |
| @@ -118,6 +105,16 @@ nfs_lock_request_dontget(struct nfs_page *req) | |||
| 118 | return !test_and_set_bit(PG_BUSY, &req->wb_flags); | 105 | return !test_and_set_bit(PG_BUSY, &req->wb_flags); |
| 119 | } | 106 | } |
| 120 | 107 | ||
| 108 | static inline int | ||
| 109 | nfs_lock_request(struct nfs_page *req) | ||
| 110 | { | ||
| 111 | if (test_and_set_bit(PG_BUSY, &req->wb_flags)) | ||
| 112 | return 0; | ||
| 113 | kref_get(&req->wb_kref); | ||
| 114 | return 1; | ||
| 115 | } | ||
| 116 | |||
| 117 | |||
| 121 | /** | 118 | /** |
| 122 | * nfs_list_add_request - Insert a request into a list | 119 | * nfs_list_add_request - Insert a request into a list |
| 123 | * @req: request | 120 | * @req: request |
diff --git a/include/linux/nfs_xdr.h b/include/linux/nfs_xdr.h index d6ba9a12591e..bfd0d1bf6707 100644 --- a/include/linux/nfs_xdr.h +++ b/include/linux/nfs_xdr.h | |||
| @@ -2,7 +2,6 @@ | |||
| 2 | #define _LINUX_NFS_XDR_H | 2 | #define _LINUX_NFS_XDR_H |
| 3 | 3 | ||
| 4 | #include <linux/nfsacl.h> | 4 | #include <linux/nfsacl.h> |
| 5 | #include <linux/nfs3.h> | ||
| 6 | #include <linux/sunrpc/gss_api.h> | 5 | #include <linux/sunrpc/gss_api.h> |
| 7 | 6 | ||
| 8 | /* | 7 | /* |
| @@ -89,11 +88,12 @@ struct nfs_fattr { | |||
| 89 | #define NFS_ATTR_FATTR_PRECTIME (1U << 16) | 88 | #define NFS_ATTR_FATTR_PRECTIME (1U << 16) |
| 90 | #define NFS_ATTR_FATTR_CHANGE (1U << 17) | 89 | #define NFS_ATTR_FATTR_CHANGE (1U << 17) |
| 91 | #define NFS_ATTR_FATTR_PRECHANGE (1U << 18) | 90 | #define NFS_ATTR_FATTR_PRECHANGE (1U << 18) |
| 92 | #define NFS_ATTR_FATTR_V4_REFERRAL (1U << 19) /* NFSv4 referral */ | 91 | #define NFS_ATTR_FATTR_V4_LOCATIONS (1U << 19) |
| 93 | #define NFS_ATTR_FATTR_MOUNTPOINT (1U << 20) /* Treat as mountpoint */ | 92 | #define NFS_ATTR_FATTR_V4_REFERRAL (1U << 20) |
| 94 | #define NFS_ATTR_FATTR_MOUNTED_ON_FILEID (1U << 21) | 93 | #define NFS_ATTR_FATTR_MOUNTPOINT (1U << 21) |
| 95 | #define NFS_ATTR_FATTR_OWNER_NAME (1U << 22) | 94 | #define NFS_ATTR_FATTR_MOUNTED_ON_FILEID (1U << 22) |
| 96 | #define NFS_ATTR_FATTR_GROUP_NAME (1U << 23) | 95 | #define NFS_ATTR_FATTR_OWNER_NAME (1U << 23) |
| 96 | #define NFS_ATTR_FATTR_GROUP_NAME (1U << 24) | ||
| 97 | 97 | ||
| 98 | #define NFS_ATTR_FATTR (NFS_ATTR_FATTR_TYPE \ | 98 | #define NFS_ATTR_FATTR (NFS_ATTR_FATTR_TYPE \ |
| 99 | | NFS_ATTR_FATTR_MODE \ | 99 | | NFS_ATTR_FATTR_MODE \ |
| @@ -182,7 +182,7 @@ struct nfs4_slot { | |||
| 182 | 182 | ||
| 183 | struct nfs4_sequence_args { | 183 | struct nfs4_sequence_args { |
| 184 | struct nfs4_session *sa_session; | 184 | struct nfs4_session *sa_session; |
| 185 | u8 sa_slotid; | 185 | u32 sa_slotid; |
| 186 | u8 sa_cache_this; | 186 | u8 sa_cache_this; |
| 187 | }; | 187 | }; |
| 188 | 188 | ||
| @@ -977,6 +977,7 @@ struct nfs4_server_caps_res { | |||
| 977 | u32 acl_bitmask; | 977 | u32 acl_bitmask; |
| 978 | u32 has_links; | 978 | u32 has_links; |
| 979 | u32 has_symlinks; | 979 | u32 has_symlinks; |
| 980 | u32 fh_expire_type; | ||
| 980 | struct nfs4_sequence_res seq_res; | 981 | struct nfs4_sequence_res seq_res; |
| 981 | }; | 982 | }; |
| 982 | 983 | ||
| @@ -1055,14 +1056,6 @@ struct nfstime4 { | |||
| 1055 | }; | 1056 | }; |
| 1056 | 1057 | ||
| 1057 | #ifdef CONFIG_NFS_V4_1 | 1058 | #ifdef CONFIG_NFS_V4_1 |
| 1058 | struct nfs_impl_id4 { | ||
| 1059 | u32 domain_len; | ||
| 1060 | char *domain; | ||
| 1061 | u32 name_len; | ||
| 1062 | char *name; | ||
| 1063 | struct nfstime4 date; | ||
| 1064 | }; | ||
| 1065 | |||
| 1066 | #define NFS4_EXCHANGE_ID_LEN (48) | 1059 | #define NFS4_EXCHANGE_ID_LEN (48) |
| 1067 | struct nfs41_exchange_id_args { | 1060 | struct nfs41_exchange_id_args { |
| 1068 | struct nfs_client *client; | 1061 | struct nfs_client *client; |
| @@ -1083,10 +1076,17 @@ struct server_scope { | |||
| 1083 | char server_scope[NFS4_OPAQUE_LIMIT]; | 1076 | char server_scope[NFS4_OPAQUE_LIMIT]; |
| 1084 | }; | 1077 | }; |
| 1085 | 1078 | ||
| 1079 | struct nfs41_impl_id { | ||
| 1080 | char domain[NFS4_OPAQUE_LIMIT + 1]; | ||
| 1081 | char name[NFS4_OPAQUE_LIMIT + 1]; | ||
| 1082 | struct nfstime4 date; | ||
| 1083 | }; | ||
| 1084 | |||
| 1086 | struct nfs41_exchange_id_res { | 1085 | struct nfs41_exchange_id_res { |
| 1087 | struct nfs_client *client; | 1086 | struct nfs_client *client; |
| 1088 | u32 flags; | 1087 | u32 flags; |
| 1089 | struct server_scope *server_scope; | 1088 | struct server_scope *server_scope; |
| 1089 | struct nfs41_impl_id *impl_id; | ||
| 1090 | }; | 1090 | }; |
| 1091 | 1091 | ||
| 1092 | struct nfs41_create_session_args { | 1092 | struct nfs41_create_session_args { |
| @@ -1192,6 +1192,27 @@ struct nfs_write_data { | |||
| 1192 | struct page *page_array[NFS_PAGEVEC_SIZE]; | 1192 | struct page *page_array[NFS_PAGEVEC_SIZE]; |
| 1193 | }; | 1193 | }; |
| 1194 | 1194 | ||
| 1195 | struct nfs_unlinkdata { | ||
| 1196 | struct hlist_node list; | ||
| 1197 | struct nfs_removeargs args; | ||
| 1198 | struct nfs_removeres res; | ||
| 1199 | struct inode *dir; | ||
| 1200 | struct rpc_cred *cred; | ||
| 1201 | struct nfs_fattr dir_attr; | ||
| 1202 | }; | ||
| 1203 | |||
| 1204 | struct nfs_renamedata { | ||
| 1205 | struct nfs_renameargs args; | ||
| 1206 | struct nfs_renameres res; | ||
| 1207 | struct rpc_cred *cred; | ||
| 1208 | struct inode *old_dir; | ||
| 1209 | struct dentry *old_dentry; | ||
| 1210 | struct nfs_fattr old_fattr; | ||
| 1211 | struct inode *new_dir; | ||
| 1212 | struct dentry *new_dentry; | ||
| 1213 | struct nfs_fattr new_fattr; | ||
| 1214 | }; | ||
| 1215 | |||
| 1195 | struct nfs_access_entry; | 1216 | struct nfs_access_entry; |
| 1196 | struct nfs_client; | 1217 | struct nfs_client; |
| 1197 | struct rpc_timeout; | 1218 | struct rpc_timeout; |
| @@ -1221,10 +1242,12 @@ struct nfs_rpc_ops { | |||
| 1221 | struct iattr *, int, struct nfs_open_context *); | 1242 | struct iattr *, int, struct nfs_open_context *); |
| 1222 | int (*remove) (struct inode *, struct qstr *); | 1243 | int (*remove) (struct inode *, struct qstr *); |
| 1223 | void (*unlink_setup) (struct rpc_message *, struct inode *dir); | 1244 | void (*unlink_setup) (struct rpc_message *, struct inode *dir); |
| 1245 | void (*unlink_rpc_prepare) (struct rpc_task *, struct nfs_unlinkdata *); | ||
| 1224 | int (*unlink_done) (struct rpc_task *, struct inode *); | 1246 | int (*unlink_done) (struct rpc_task *, struct inode *); |
| 1225 | int (*rename) (struct inode *, struct qstr *, | 1247 | int (*rename) (struct inode *, struct qstr *, |
| 1226 | struct inode *, struct qstr *); | 1248 | struct inode *, struct qstr *); |
| 1227 | void (*rename_setup) (struct rpc_message *msg, struct inode *dir); | 1249 | void (*rename_setup) (struct rpc_message *msg, struct inode *dir); |
| 1250 | void (*rename_rpc_prepare)(struct rpc_task *task, struct nfs_renamedata *); | ||
| 1228 | int (*rename_done) (struct rpc_task *task, struct inode *old_dir, struct inode *new_dir); | 1251 | int (*rename_done) (struct rpc_task *task, struct inode *old_dir, struct inode *new_dir); |
| 1229 | int (*link) (struct inode *, struct inode *, struct qstr *); | 1252 | int (*link) (struct inode *, struct inode *, struct qstr *); |
| 1230 | int (*symlink) (struct inode *, struct dentry *, struct page *, | 1253 | int (*symlink) (struct inode *, struct dentry *, struct page *, |
| @@ -1244,8 +1267,10 @@ struct nfs_rpc_ops { | |||
| 1244 | int (*set_capabilities)(struct nfs_server *, struct nfs_fh *); | 1267 | int (*set_capabilities)(struct nfs_server *, struct nfs_fh *); |
| 1245 | int (*decode_dirent)(struct xdr_stream *, struct nfs_entry *, int); | 1268 | int (*decode_dirent)(struct xdr_stream *, struct nfs_entry *, int); |
| 1246 | void (*read_setup) (struct nfs_read_data *, struct rpc_message *); | 1269 | void (*read_setup) (struct nfs_read_data *, struct rpc_message *); |
| 1270 | void (*read_rpc_prepare)(struct rpc_task *, struct nfs_read_data *); | ||
| 1247 | int (*read_done) (struct rpc_task *, struct nfs_read_data *); | 1271 | int (*read_done) (struct rpc_task *, struct nfs_read_data *); |
| 1248 | void (*write_setup) (struct nfs_write_data *, struct rpc_message *); | 1272 | void (*write_setup) (struct nfs_write_data *, struct rpc_message *); |
| 1273 | void (*write_rpc_prepare)(struct rpc_task *, struct nfs_write_data *); | ||
| 1249 | int (*write_done) (struct rpc_task *, struct nfs_write_data *); | 1274 | int (*write_done) (struct rpc_task *, struct nfs_write_data *); |
| 1250 | void (*commit_setup) (struct nfs_write_data *, struct rpc_message *); | 1275 | void (*commit_setup) (struct nfs_write_data *, struct rpc_message *); |
| 1251 | int (*commit_done) (struct rpc_task *, struct nfs_write_data *); | 1276 | int (*commit_done) (struct rpc_task *, struct nfs_write_data *); |
| @@ -1275,11 +1300,11 @@ struct nfs_rpc_ops { | |||
| 1275 | extern const struct nfs_rpc_ops nfs_v2_clientops; | 1300 | extern const struct nfs_rpc_ops nfs_v2_clientops; |
| 1276 | extern const struct nfs_rpc_ops nfs_v3_clientops; | 1301 | extern const struct nfs_rpc_ops nfs_v3_clientops; |
| 1277 | extern const struct nfs_rpc_ops nfs_v4_clientops; | 1302 | extern const struct nfs_rpc_ops nfs_v4_clientops; |
| 1278 | extern struct rpc_version nfs_version2; | 1303 | extern const struct rpc_version nfs_version2; |
| 1279 | extern struct rpc_version nfs_version3; | 1304 | extern const struct rpc_version nfs_version3; |
| 1280 | extern struct rpc_version nfs_version4; | 1305 | extern const struct rpc_version nfs_version4; |
| 1281 | 1306 | ||
| 1282 | extern struct rpc_version nfsacl_version3; | 1307 | extern const struct rpc_version nfsacl_version3; |
| 1283 | extern struct rpc_program nfsacl_program; | 1308 | extern const struct rpc_program nfsacl_program; |
| 1284 | 1309 | ||
| 1285 | #endif | 1310 | #endif |
diff --git a/include/linux/nilfs2_fs.h b/include/linux/nilfs2_fs.h index 7454ad7451b4..89bd4a4dcfb4 100644 --- a/include/linux/nilfs2_fs.h +++ b/include/linux/nilfs2_fs.h | |||
| @@ -41,6 +41,7 @@ | |||
| 41 | #include <linux/types.h> | 41 | #include <linux/types.h> |
| 42 | #include <linux/ioctl.h> | 42 | #include <linux/ioctl.h> |
| 43 | #include <linux/magic.h> | 43 | #include <linux/magic.h> |
| 44 | #include <linux/bug.h> | ||
| 44 | 45 | ||
| 45 | 46 | ||
| 46 | #define NILFS_INODE_BMAP_SIZE 7 | 47 | #define NILFS_INODE_BMAP_SIZE 7 |
diff --git a/include/linux/nl80211.h b/include/linux/nl80211.h index 0f5ff3739820..e474f6e780cc 100644 --- a/include/linux/nl80211.h +++ b/include/linux/nl80211.h | |||
| @@ -156,21 +156,23 @@ | |||
| 156 | * @NL80211_CMD_DEL_KEY: delete a key identified by %NL80211_ATTR_KEY_IDX | 156 | * @NL80211_CMD_DEL_KEY: delete a key identified by %NL80211_ATTR_KEY_IDX |
| 157 | * or %NL80211_ATTR_MAC. | 157 | * or %NL80211_ATTR_MAC. |
| 158 | * | 158 | * |
| 159 | * @NL80211_CMD_GET_BEACON: retrieve beacon information (returned in a | 159 | * @NL80211_CMD_GET_BEACON: (not used) |
| 160 | * %NL80222_CMD_NEW_BEACON message) | 160 | * @NL80211_CMD_SET_BEACON: change the beacon on an access point interface |
| 161 | * @NL80211_CMD_SET_BEACON: set the beacon on an access point interface | 161 | * using the %NL80211_ATTR_BEACON_HEAD and %NL80211_ATTR_BEACON_TAIL |
| 162 | * using the %NL80211_ATTR_BEACON_INTERVAL, %NL80211_ATTR_DTIM_PERIOD, | 162 | * attributes. For drivers that generate the beacon and probe responses |
| 163 | * %NL80211_ATTR_BEACON_HEAD and %NL80211_ATTR_BEACON_TAIL attributes. | 163 | * internally, the following attributes must be provided: %NL80211_ATTR_IE, |
| 164 | * Following attributes are provided for drivers that generate full Beacon | 164 | * %NL80211_ATTR_IE_PROBE_RESP and %NL80211_ATTR_IE_ASSOC_RESP. |
| 165 | * and Probe Response frames internally: %NL80211_ATTR_SSID, | 165 | * @NL80211_CMD_START_AP: Start AP operation on an AP interface, parameters |
| 166 | * are like for %NL80211_CMD_SET_BEACON, and additionally parameters that | ||
| 167 | * do not change are used, these include %NL80211_ATTR_BEACON_INTERVAL, | ||
| 168 | * %NL80211_ATTR_DTIM_PERIOD, %NL80211_ATTR_SSID, | ||
| 166 | * %NL80211_ATTR_HIDDEN_SSID, %NL80211_ATTR_CIPHERS_PAIRWISE, | 169 | * %NL80211_ATTR_HIDDEN_SSID, %NL80211_ATTR_CIPHERS_PAIRWISE, |
| 167 | * %NL80211_ATTR_CIPHER_GROUP, %NL80211_ATTR_WPA_VERSIONS, | 170 | * %NL80211_ATTR_CIPHER_GROUP, %NL80211_ATTR_WPA_VERSIONS, |
| 168 | * %NL80211_ATTR_AKM_SUITES, %NL80211_ATTR_PRIVACY, | 171 | * %NL80211_ATTR_AKM_SUITES, %NL80211_ATTR_PRIVACY, |
| 169 | * %NL80211_ATTR_AUTH_TYPE, %NL80211_ATTR_IE, %NL80211_ATTR_IE_PROBE_RESP, | 172 | * %NL80211_ATTR_AUTH_TYPE and %NL80211_ATTR_INACTIVITY_TIMEOUT. |
| 170 | * %NL80211_ATTR_IE_ASSOC_RESP. | 173 | * @NL80211_CMD_NEW_BEACON: old alias for %NL80211_CMD_START_AP |
| 171 | * @NL80211_CMD_NEW_BEACON: add a new beacon to an access point interface, | 174 | * @NL80211_CMD_STOP_AP: Stop AP operation on the given interface |
| 172 | * parameters are like for %NL80211_CMD_SET_BEACON. | 175 | * @NL80211_CMD_DEL_BEACON: old alias for %NL80211_CMD_STOP_AP |
| 173 | * @NL80211_CMD_DEL_BEACON: remove the beacon, stop sending it | ||
| 174 | * | 176 | * |
| 175 | * @NL80211_CMD_GET_STATION: Get station attributes for station identified by | 177 | * @NL80211_CMD_GET_STATION: Get station attributes for station identified by |
| 176 | * %NL80211_ATTR_MAC on the interface identified by %NL80211_ATTR_IFINDEX. | 178 | * %NL80211_ATTR_MAC on the interface identified by %NL80211_ATTR_IFINDEX. |
| @@ -367,6 +369,11 @@ | |||
| 367 | * %NL80211_ATTR_WIPHY_FREQ, %NL80211_ATTR_CONTROL_PORT, | 369 | * %NL80211_ATTR_WIPHY_FREQ, %NL80211_ATTR_CONTROL_PORT, |
| 368 | * %NL80211_ATTR_CONTROL_PORT_ETHERTYPE and | 370 | * %NL80211_ATTR_CONTROL_PORT_ETHERTYPE and |
| 369 | * %NL80211_ATTR_CONTROL_PORT_NO_ENCRYPT. | 371 | * %NL80211_ATTR_CONTROL_PORT_NO_ENCRYPT. |
| 372 | * Background scan period can optionally be | ||
| 373 | * specified in %NL80211_ATTR_BG_SCAN_PERIOD, | ||
| 374 | * if not specified default background scan configuration | ||
| 375 | * in driver is used and if period value is 0, bg scan will be disabled. | ||
| 376 | * This attribute is ignored if driver does not support roam scan. | ||
| 370 | * It is also sent as an event, with the BSSID and response IEs when the | 377 | * It is also sent as an event, with the BSSID and response IEs when the |
| 371 | * connection is established or failed to be established. This can be | 378 | * connection is established or failed to be established. This can be |
| 372 | * determined by the STATUS_CODE attribute. | 379 | * determined by the STATUS_CODE attribute. |
| @@ -565,8 +572,10 @@ enum nl80211_commands { | |||
| 565 | 572 | ||
| 566 | NL80211_CMD_GET_BEACON, | 573 | NL80211_CMD_GET_BEACON, |
| 567 | NL80211_CMD_SET_BEACON, | 574 | NL80211_CMD_SET_BEACON, |
| 568 | NL80211_CMD_NEW_BEACON, | 575 | NL80211_CMD_START_AP, |
| 569 | NL80211_CMD_DEL_BEACON, | 576 | NL80211_CMD_NEW_BEACON = NL80211_CMD_START_AP, |
| 577 | NL80211_CMD_STOP_AP, | ||
| 578 | NL80211_CMD_DEL_BEACON = NL80211_CMD_STOP_AP, | ||
| 570 | 579 | ||
| 571 | NL80211_CMD_GET_STATION, | 580 | NL80211_CMD_GET_STATION, |
| 572 | NL80211_CMD_SET_STATION, | 581 | NL80211_CMD_SET_STATION, |
| @@ -1193,6 +1202,19 @@ enum nl80211_commands { | |||
| 1193 | * @NL80211_ATTR_NOACK_MAP: This u16 bitmap contains the No Ack Policy of | 1202 | * @NL80211_ATTR_NOACK_MAP: This u16 bitmap contains the No Ack Policy of |
| 1194 | * up to 16 TIDs. | 1203 | * up to 16 TIDs. |
| 1195 | * | 1204 | * |
| 1205 | * @NL80211_ATTR_INACTIVITY_TIMEOUT: timeout value in seconds, this can be | ||
| 1206 | * used by the drivers which has MLME in firmware and does not have support | ||
| 1207 | * to report per station tx/rx activity to free up the staion entry from | ||
| 1208 | * the list. This needs to be used when the driver advertises the | ||
| 1209 | * capability to timeout the stations. | ||
| 1210 | * | ||
| 1211 | * @NL80211_ATTR_RX_SIGNAL_DBM: signal strength in dBm (as a 32-bit int); | ||
| 1212 | * this attribute is (depending on the driver capabilities) added to | ||
| 1213 | * received frames indicated with %NL80211_CMD_FRAME. | ||
| 1214 | * | ||
| 1215 | * @NL80211_ATTR_BG_SCAN_PERIOD: Background scan period in seconds | ||
| 1216 | * or 0 to disable background scan. | ||
| 1217 | * | ||
| 1196 | * @NL80211_ATTR_MAX: highest attribute number currently defined | 1218 | * @NL80211_ATTR_MAX: highest attribute number currently defined |
| 1197 | * @__NL80211_ATTR_AFTER_LAST: internal use | 1219 | * @__NL80211_ATTR_AFTER_LAST: internal use |
| 1198 | */ | 1220 | */ |
| @@ -1438,6 +1460,12 @@ enum nl80211_attrs { | |||
| 1438 | 1460 | ||
| 1439 | NL80211_ATTR_NOACK_MAP, | 1461 | NL80211_ATTR_NOACK_MAP, |
| 1440 | 1462 | ||
| 1463 | NL80211_ATTR_INACTIVITY_TIMEOUT, | ||
| 1464 | |||
| 1465 | NL80211_ATTR_RX_SIGNAL_DBM, | ||
| 1466 | |||
| 1467 | NL80211_ATTR_BG_SCAN_PERIOD, | ||
| 1468 | |||
| 1441 | /* add attributes here, update the policy in nl80211.c */ | 1469 | /* add attributes here, update the policy in nl80211.c */ |
| 1442 | 1470 | ||
| 1443 | __NL80211_ATTR_AFTER_LAST, | 1471 | __NL80211_ATTR_AFTER_LAST, |
| @@ -1475,6 +1503,7 @@ enum nl80211_attrs { | |||
| 1475 | #define NL80211_ATTR_FEATURE_FLAGS NL80211_ATTR_FEATURE_FLAGS | 1503 | #define NL80211_ATTR_FEATURE_FLAGS NL80211_ATTR_FEATURE_FLAGS |
| 1476 | 1504 | ||
| 1477 | #define NL80211_MAX_SUPP_RATES 32 | 1505 | #define NL80211_MAX_SUPP_RATES 32 |
| 1506 | #define NL80211_MAX_SUPP_HT_RATES 77 | ||
| 1478 | #define NL80211_MAX_SUPP_REG_RULES 32 | 1507 | #define NL80211_MAX_SUPP_REG_RULES 32 |
| 1479 | #define NL80211_TKIP_DATA_OFFSET_ENCR_KEY 0 | 1508 | #define NL80211_TKIP_DATA_OFFSET_ENCR_KEY 0 |
| 1480 | #define NL80211_TKIP_DATA_OFFSET_TX_MIC_KEY 16 | 1509 | #define NL80211_TKIP_DATA_OFFSET_TX_MIC_KEY 16 |
| @@ -2104,6 +2133,13 @@ enum nl80211_mntr_flags { | |||
| 2104 | * TUs) during which a mesh STA can send only one Action frame containing a | 2133 | * TUs) during which a mesh STA can send only one Action frame containing a |
| 2105 | * PERR element. | 2134 | * PERR element. |
| 2106 | * | 2135 | * |
| 2136 | * @NL80211_MESHCONF_FORWARDING: set Mesh STA as forwarding or non-forwarding | ||
| 2137 | * or forwarding entity (default is TRUE - forwarding entity) | ||
| 2138 | * | ||
| 2139 | * @NL80211_MESHCONF_RSSI_THRESHOLD: RSSI threshold in dBm. This specifies the | ||
| 2140 | * threshold for average signal strength of candidate station to establish | ||
| 2141 | * a peer link. | ||
| 2142 | * | ||
| 2107 | * @NL80211_MESHCONF_ATTR_MAX: highest possible mesh configuration attribute | 2143 | * @NL80211_MESHCONF_ATTR_MAX: highest possible mesh configuration attribute |
| 2108 | * | 2144 | * |
| 2109 | * @__NL80211_MESHCONF_ATTR_AFTER_LAST: internal use | 2145 | * @__NL80211_MESHCONF_ATTR_AFTER_LAST: internal use |
| @@ -2128,6 +2164,8 @@ enum nl80211_meshconf_params { | |||
| 2128 | NL80211_MESHCONF_HWMP_RANN_INTERVAL, | 2164 | NL80211_MESHCONF_HWMP_RANN_INTERVAL, |
| 2129 | NL80211_MESHCONF_GATE_ANNOUNCEMENTS, | 2165 | NL80211_MESHCONF_GATE_ANNOUNCEMENTS, |
| 2130 | NL80211_MESHCONF_HWMP_PERR_MIN_INTERVAL, | 2166 | NL80211_MESHCONF_HWMP_PERR_MIN_INTERVAL, |
| 2167 | NL80211_MESHCONF_FORWARDING, | ||
| 2168 | NL80211_MESHCONF_RSSI_THRESHOLD, | ||
| 2131 | 2169 | ||
| 2132 | /* keep last */ | 2170 | /* keep last */ |
| 2133 | __NL80211_MESHCONF_ATTR_AFTER_LAST, | 2171 | __NL80211_MESHCONF_ATTR_AFTER_LAST, |
| @@ -2401,12 +2439,15 @@ enum nl80211_key_attributes { | |||
| 2401 | * in an array of rates as defined in IEEE 802.11 7.3.2.2 (u8 values with | 2439 | * in an array of rates as defined in IEEE 802.11 7.3.2.2 (u8 values with |
| 2402 | * 1 = 500 kbps) but without the IE length restriction (at most | 2440 | * 1 = 500 kbps) but without the IE length restriction (at most |
| 2403 | * %NL80211_MAX_SUPP_RATES in a single array). | 2441 | * %NL80211_MAX_SUPP_RATES in a single array). |
| 2442 | * @NL80211_TXRATE_MCS: HT (MCS) rates allowed for TX rate selection | ||
| 2443 | * in an array of MCS numbers. | ||
| 2404 | * @__NL80211_TXRATE_AFTER_LAST: internal | 2444 | * @__NL80211_TXRATE_AFTER_LAST: internal |
| 2405 | * @NL80211_TXRATE_MAX: highest TX rate attribute | 2445 | * @NL80211_TXRATE_MAX: highest TX rate attribute |
| 2406 | */ | 2446 | */ |
| 2407 | enum nl80211_tx_rate_attributes { | 2447 | enum nl80211_tx_rate_attributes { |
| 2408 | __NL80211_TXRATE_INVALID, | 2448 | __NL80211_TXRATE_INVALID, |
| 2409 | NL80211_TXRATE_LEGACY, | 2449 | NL80211_TXRATE_LEGACY, |
| 2450 | NL80211_TXRATE_MCS, | ||
| 2410 | 2451 | ||
| 2411 | /* keep last */ | 2452 | /* keep last */ |
| 2412 | __NL80211_TXRATE_AFTER_LAST, | 2453 | __NL80211_TXRATE_AFTER_LAST, |
| @@ -2792,10 +2833,13 @@ enum nl80211_ap_sme_features { | |||
| 2792 | * TX status to the socket error queue when requested with the | 2833 | * TX status to the socket error queue when requested with the |
| 2793 | * socket option. | 2834 | * socket option. |
| 2794 | * @NL80211_FEATURE_HT_IBSS: This driver supports IBSS with HT datarates. | 2835 | * @NL80211_FEATURE_HT_IBSS: This driver supports IBSS with HT datarates. |
| 2836 | * @NL80211_FEATURE_INACTIVITY_TIMER: This driver takes care of freeing up | ||
| 2837 | * the connected inactive stations in AP mode. | ||
| 2795 | */ | 2838 | */ |
| 2796 | enum nl80211_feature_flags { | 2839 | enum nl80211_feature_flags { |
| 2797 | NL80211_FEATURE_SK_TX_STATUS = 1 << 0, | 2840 | NL80211_FEATURE_SK_TX_STATUS = 1 << 0, |
| 2798 | NL80211_FEATURE_HT_IBSS = 1 << 1, | 2841 | NL80211_FEATURE_HT_IBSS = 1 << 1, |
| 2842 | NL80211_FEATURE_INACTIVITY_TIMER = 1 << 2, | ||
| 2799 | }; | 2843 | }; |
| 2800 | 2844 | ||
| 2801 | /** | 2845 | /** |
diff --git a/include/linux/nmi.h b/include/linux/nmi.h index 2d304efc89df..db50840e6355 100644 --- a/include/linux/nmi.h +++ b/include/linux/nmi.h | |||
| @@ -14,7 +14,7 @@ | |||
| 14 | * may be used to reset the timeout - for code which intentionally | 14 | * may be used to reset the timeout - for code which intentionally |
| 15 | * disables interrupts for a long time. This call is stateless. | 15 | * disables interrupts for a long time. This call is stateless. |
| 16 | */ | 16 | */ |
| 17 | #if defined(ARCH_HAS_NMI_WATCHDOG) || defined(CONFIG_HARDLOCKUP_DETECTOR) | 17 | #if defined(CONFIG_HAVE_NMI_WATCHDOG) || defined(CONFIG_HARDLOCKUP_DETECTOR) |
| 18 | #include <asm/nmi.h> | 18 | #include <asm/nmi.h> |
| 19 | extern void touch_nmi_watchdog(void); | 19 | extern void touch_nmi_watchdog(void); |
| 20 | #else | 20 | #else |
diff --git a/include/linux/of.h b/include/linux/of.h index 92cf6ad35e0e..d46a18ffbebb 100644 --- a/include/linux/of.h +++ b/include/linux/of.h | |||
| @@ -58,6 +58,9 @@ struct device_node { | |||
| 58 | struct kref kref; | 58 | struct kref kref; |
| 59 | unsigned long _flags; | 59 | unsigned long _flags; |
| 60 | void *data; | 60 | void *data; |
| 61 | #if defined(CONFIG_EEH) | ||
| 62 | struct eeh_dev *edev; | ||
| 63 | #endif | ||
| 61 | #if defined(CONFIG_SPARC) | 64 | #if defined(CONFIG_SPARC) |
| 62 | char *path_component_name; | 65 | char *path_component_name; |
| 63 | unsigned int unique_id; | 66 | unsigned int unique_id; |
| @@ -72,19 +75,24 @@ struct of_phandle_args { | |||
| 72 | uint32_t args[MAX_PHANDLE_ARGS]; | 75 | uint32_t args[MAX_PHANDLE_ARGS]; |
| 73 | }; | 76 | }; |
| 74 | 77 | ||
| 75 | #if defined(CONFIG_SPARC) || !defined(CONFIG_OF) | 78 | #if defined(CONFIG_EEH) |
| 79 | static inline struct eeh_dev *of_node_to_eeh_dev(struct device_node *dn) | ||
| 80 | { | ||
| 81 | return dn->edev; | ||
| 82 | } | ||
| 83 | #endif | ||
| 84 | |||
| 85 | #ifdef CONFIG_OF_DYNAMIC | ||
| 86 | extern struct device_node *of_node_get(struct device_node *node); | ||
| 87 | extern void of_node_put(struct device_node *node); | ||
| 88 | #else /* CONFIG_OF_DYNAMIC */ | ||
| 76 | /* Dummy ref counting routines - to be implemented later */ | 89 | /* Dummy ref counting routines - to be implemented later */ |
| 77 | static inline struct device_node *of_node_get(struct device_node *node) | 90 | static inline struct device_node *of_node_get(struct device_node *node) |
| 78 | { | 91 | { |
| 79 | return node; | 92 | return node; |
| 80 | } | 93 | } |
| 81 | static inline void of_node_put(struct device_node *node) | 94 | static inline void of_node_put(struct device_node *node) { } |
| 82 | { | 95 | #endif /* !CONFIG_OF_DYNAMIC */ |
| 83 | } | ||
| 84 | #else | ||
| 85 | extern struct device_node *of_node_get(struct device_node *node); | ||
| 86 | extern void of_node_put(struct device_node *node); | ||
| 87 | #endif | ||
| 88 | 96 | ||
| 89 | #ifdef CONFIG_OF | 97 | #ifdef CONFIG_OF |
| 90 | 98 | ||
| @@ -217,6 +225,9 @@ extern int of_property_read_string(struct device_node *np, | |||
| 217 | extern int of_property_read_string_index(struct device_node *np, | 225 | extern int of_property_read_string_index(struct device_node *np, |
| 218 | const char *propname, | 226 | const char *propname, |
| 219 | int index, const char **output); | 227 | int index, const char **output); |
| 228 | extern int of_property_match_string(struct device_node *np, | ||
| 229 | const char *propname, | ||
| 230 | const char *string); | ||
| 220 | extern int of_property_count_strings(struct device_node *np, | 231 | extern int of_property_count_strings(struct device_node *np, |
| 221 | const char *propname); | 232 | const char *propname); |
| 222 | extern int of_device_is_compatible(const struct device_node *device, | 233 | extern int of_device_is_compatible(const struct device_node *device, |
diff --git a/include/linux/of_address.h b/include/linux/of_address.h index 3118623c2c1f..01b925ad8d78 100644 --- a/include/linux/of_address.h +++ b/include/linux/of_address.h | |||
| @@ -4,6 +4,7 @@ | |||
| 4 | #include <linux/errno.h> | 4 | #include <linux/errno.h> |
| 5 | #include <linux/of.h> | 5 | #include <linux/of.h> |
| 6 | 6 | ||
| 7 | #ifdef CONFIG_OF_ADDRESS | ||
| 7 | extern u64 of_translate_address(struct device_node *np, const __be32 *addr); | 8 | extern u64 of_translate_address(struct device_node *np, const __be32 *addr); |
| 8 | extern int of_address_to_resource(struct device_node *dev, int index, | 9 | extern int of_address_to_resource(struct device_node *dev, int index, |
| 9 | struct resource *r); | 10 | struct resource *r); |
| @@ -25,12 +26,37 @@ static inline unsigned long pci_address_to_pio(phys_addr_t addr) { return -1; } | |||
| 25 | #define pci_address_to_pio pci_address_to_pio | 26 | #define pci_address_to_pio pci_address_to_pio |
| 26 | #endif | 27 | #endif |
| 27 | 28 | ||
| 28 | #ifdef CONFIG_PCI | 29 | #else /* CONFIG_OF_ADDRESS */ |
| 30 | static inline int of_address_to_resource(struct device_node *dev, int index, | ||
| 31 | struct resource *r) | ||
| 32 | { | ||
| 33 | return -EINVAL; | ||
| 34 | } | ||
| 35 | static inline struct device_node *of_find_matching_node_by_address( | ||
| 36 | struct device_node *from, | ||
| 37 | const struct of_device_id *matches, | ||
| 38 | u64 base_address) | ||
| 39 | { | ||
| 40 | return NULL; | ||
| 41 | } | ||
| 42 | static inline void __iomem *of_iomap(struct device_node *device, int index) | ||
| 43 | { | ||
| 44 | return NULL; | ||
| 45 | } | ||
| 46 | static inline const u32 *of_get_address(struct device_node *dev, int index, | ||
| 47 | u64 *size, unsigned int *flags) | ||
| 48 | { | ||
| 49 | return NULL; | ||
| 50 | } | ||
| 51 | #endif /* CONFIG_OF_ADDRESS */ | ||
| 52 | |||
| 53 | |||
| 54 | #if defined(CONFIG_OF_ADDRESS) && defined(CONFIG_PCI) | ||
| 29 | extern const __be32 *of_get_pci_address(struct device_node *dev, int bar_no, | 55 | extern const __be32 *of_get_pci_address(struct device_node *dev, int bar_no, |
| 30 | u64 *size, unsigned int *flags); | 56 | u64 *size, unsigned int *flags); |
| 31 | extern int of_pci_address_to_resource(struct device_node *dev, int bar, | 57 | extern int of_pci_address_to_resource(struct device_node *dev, int bar, |
| 32 | struct resource *r); | 58 | struct resource *r); |
| 33 | #else /* CONFIG_PCI */ | 59 | #else /* CONFIG_OF_ADDRESS && CONFIG_PCI */ |
| 34 | static inline int of_pci_address_to_resource(struct device_node *dev, int bar, | 60 | static inline int of_pci_address_to_resource(struct device_node *dev, int bar, |
| 35 | struct resource *r) | 61 | struct resource *r) |
| 36 | { | 62 | { |
| @@ -42,8 +68,7 @@ static inline const __be32 *of_get_pci_address(struct device_node *dev, | |||
| 42 | { | 68 | { |
| 43 | return NULL; | 69 | return NULL; |
| 44 | } | 70 | } |
| 45 | #endif /* CONFIG_PCI */ | 71 | #endif /* CONFIG_OF_ADDRESS && CONFIG_PCI */ |
| 46 | |||
| 47 | 72 | ||
| 48 | #endif /* __OF_ADDRESS_H */ | 73 | #endif /* __OF_ADDRESS_H */ |
| 49 | 74 | ||
diff --git a/include/linux/of_device.h b/include/linux/of_device.h index ae5638480ef2..901b7435e890 100644 --- a/include/linux/of_device.h +++ b/include/linux/of_device.h | |||
| @@ -5,10 +5,11 @@ | |||
| 5 | #include <linux/of_platform.h> /* temporary until merge */ | 5 | #include <linux/of_platform.h> /* temporary until merge */ |
| 6 | 6 | ||
| 7 | #ifdef CONFIG_OF_DEVICE | 7 | #ifdef CONFIG_OF_DEVICE |
| 8 | #include <linux/device.h> | ||
| 9 | #include <linux/of.h> | 8 | #include <linux/of.h> |
| 10 | #include <linux/mod_devicetable.h> | 9 | #include <linux/mod_devicetable.h> |
| 11 | 10 | ||
| 11 | struct device; | ||
| 12 | |||
| 12 | extern const struct of_device_id *of_match_device( | 13 | extern const struct of_device_id *of_match_device( |
| 13 | const struct of_device_id *matches, const struct device *dev); | 14 | const struct of_device_id *matches, const struct device *dev); |
| 14 | extern void of_device_make_bus_id(struct device *dev); | 15 | extern void of_device_make_bus_id(struct device *dev); |
| @@ -34,7 +35,8 @@ extern void of_device_unregister(struct platform_device *ofdev); | |||
| 34 | extern ssize_t of_device_get_modalias(struct device *dev, | 35 | extern ssize_t of_device_get_modalias(struct device *dev, |
| 35 | char *str, ssize_t len); | 36 | char *str, ssize_t len); |
| 36 | 37 | ||
| 37 | extern int of_device_uevent(struct device *dev, struct kobj_uevent_env *env); | 38 | extern void of_device_uevent(struct device *dev, struct kobj_uevent_env *env); |
| 39 | extern int of_device_uevent_modalias(struct device *dev, struct kobj_uevent_env *env); | ||
| 38 | 40 | ||
| 39 | static inline void of_device_node_put(struct device *dev) | 41 | static inline void of_device_node_put(struct device *dev) |
| 40 | { | 42 | { |
| @@ -49,7 +51,10 @@ static inline int of_driver_match_device(struct device *dev, | |||
| 49 | return 0; | 51 | return 0; |
| 50 | } | 52 | } |
| 51 | 53 | ||
| 52 | static inline int of_device_uevent(struct device *dev, | 54 | static inline void of_device_uevent(struct device *dev, |
| 55 | struct kobj_uevent_env *env) { } | ||
| 56 | |||
| 57 | static inline int of_device_uevent_modalias(struct device *dev, | ||
| 53 | struct kobj_uevent_env *env) | 58 | struct kobj_uevent_env *env) |
| 54 | { | 59 | { |
| 55 | return -ENODEV; | 60 | return -ENODEV; |
diff --git a/include/linux/of_irq.h b/include/linux/of_irq.h index d0307eed20c9..d229ad3edee0 100644 --- a/include/linux/of_irq.h +++ b/include/linux/of_irq.h | |||
| @@ -6,6 +6,7 @@ struct of_irq; | |||
| 6 | #include <linux/types.h> | 6 | #include <linux/types.h> |
| 7 | #include <linux/errno.h> | 7 | #include <linux/errno.h> |
| 8 | #include <linux/irq.h> | 8 | #include <linux/irq.h> |
| 9 | #include <linux/irqdomain.h> | ||
| 9 | #include <linux/ioport.h> | 10 | #include <linux/ioport.h> |
| 10 | #include <linux/of.h> | 11 | #include <linux/of.h> |
| 11 | 12 | ||
| @@ -65,9 +66,6 @@ extern int of_irq_map_one(struct device_node *device, int index, | |||
| 65 | extern unsigned int irq_create_of_mapping(struct device_node *controller, | 66 | extern unsigned int irq_create_of_mapping(struct device_node *controller, |
| 66 | const u32 *intspec, | 67 | const u32 *intspec, |
| 67 | unsigned int intsize); | 68 | unsigned int intsize); |
| 68 | #ifdef CONFIG_IRQ_DOMAIN | ||
| 69 | extern void irq_dispose_mapping(unsigned int irq); | ||
| 70 | #endif | ||
| 71 | extern int of_irq_to_resource(struct device_node *dev, int index, | 69 | extern int of_irq_to_resource(struct device_node *dev, int index, |
| 72 | struct resource *r); | 70 | struct resource *r); |
| 73 | extern int of_irq_count(struct device_node *dev); | 71 | extern int of_irq_count(struct device_node *dev); |
diff --git a/include/linux/of_platform.h b/include/linux/of_platform.h index 040ce2f6e8de..b47d2040c9f2 100644 --- a/include/linux/of_platform.h +++ b/include/linux/of_platform.h | |||
| @@ -81,7 +81,7 @@ extern struct platform_device *of_device_alloc(struct device_node *np, | |||
| 81 | struct device *parent); | 81 | struct device *parent); |
| 82 | extern struct platform_device *of_find_device_by_node(struct device_node *np); | 82 | extern struct platform_device *of_find_device_by_node(struct device_node *np); |
| 83 | 83 | ||
| 84 | #if !defined(CONFIG_SPARC) /* SPARC has its own device registration method */ | 84 | #ifdef CONFIG_OF_ADDRESS /* device reg helpers depend on OF_ADDRESS */ |
| 85 | /* Platform devices and busses creation */ | 85 | /* Platform devices and busses creation */ |
| 86 | extern struct platform_device *of_platform_device_create(struct device_node *np, | 86 | extern struct platform_device *of_platform_device_create(struct device_node *np, |
| 87 | const char *bus_id, | 87 | const char *bus_id, |
| @@ -94,8 +94,19 @@ extern int of_platform_populate(struct device_node *root, | |||
| 94 | const struct of_device_id *matches, | 94 | const struct of_device_id *matches, |
| 95 | const struct of_dev_auxdata *lookup, | 95 | const struct of_dev_auxdata *lookup, |
| 96 | struct device *parent); | 96 | struct device *parent); |
| 97 | #endif /* !CONFIG_SPARC */ | 97 | #endif /* CONFIG_OF_ADDRESS */ |
| 98 | 98 | ||
| 99 | #endif /* CONFIG_OF_DEVICE */ | 99 | #endif /* CONFIG_OF_DEVICE */ |
| 100 | 100 | ||
| 101 | #if !defined(CONFIG_OF_ADDRESS) | ||
| 102 | struct of_dev_auxdata; | ||
| 103 | static inline int of_platform_populate(struct device_node *root, | ||
| 104 | const struct of_device_id *matches, | ||
| 105 | const struct of_dev_auxdata *lookup, | ||
| 106 | struct device *parent) | ||
| 107 | { | ||
| 108 | return -ENODEV; | ||
| 109 | } | ||
| 110 | #endif /* !CONFIG_OF_ADDRESS */ | ||
| 111 | |||
| 101 | #endif /* _LINUX_OF_PLATFORM_H */ | 112 | #endif /* _LINUX_OF_PLATFORM_H */ |
diff --git a/include/linux/omapfb.h b/include/linux/omapfb.h index c0b018790f07..4ff57e81051d 100644 --- a/include/linux/omapfb.h +++ b/include/linux/omapfb.h | |||
| @@ -222,41 +222,11 @@ struct omapfb_display_info { | |||
| 222 | 222 | ||
| 223 | #include <plat/board.h> | 223 | #include <plat/board.h> |
| 224 | 224 | ||
| 225 | #ifdef CONFIG_ARCH_OMAP1 | ||
| 226 | #define OMAPFB_PLANE_NUM 1 | ||
| 227 | #else | ||
| 228 | #define OMAPFB_PLANE_NUM 3 | ||
| 229 | #endif | ||
| 230 | |||
| 231 | struct omapfb_mem_region { | ||
| 232 | u32 paddr; | ||
| 233 | void __iomem *vaddr; | ||
| 234 | unsigned long size; | ||
| 235 | u8 type; /* OMAPFB_PLANE_MEM_* */ | ||
| 236 | enum omapfb_color_format format;/* OMAPFB_COLOR_* */ | ||
| 237 | unsigned format_used:1; /* Must be set when format is set. | ||
| 238 | * Needed b/c of the badly chosen 0 | ||
| 239 | * base for OMAPFB_COLOR_* values | ||
| 240 | */ | ||
| 241 | unsigned alloc:1; /* allocated by the driver */ | ||
| 242 | unsigned map:1; /* kernel mapped by the driver */ | ||
| 243 | }; | ||
| 244 | |||
| 245 | struct omapfb_mem_desc { | ||
| 246 | int region_cnt; | ||
| 247 | struct omapfb_mem_region region[OMAPFB_PLANE_NUM]; | ||
| 248 | }; | ||
| 249 | |||
| 250 | struct omapfb_platform_data { | 225 | struct omapfb_platform_data { |
| 251 | struct omap_lcd_config lcd; | 226 | struct omap_lcd_config lcd; |
| 252 | struct omapfb_mem_desc mem_desc; | ||
| 253 | void *ctrl_platform_data; | ||
| 254 | }; | 227 | }; |
| 255 | 228 | ||
| 256 | /* in arch/arm/plat-omap/fb.c */ | 229 | void __init omapfb_set_lcd_config(const struct omap_lcd_config *config); |
| 257 | extern void omapfb_set_platform_data(struct omapfb_platform_data *data); | ||
| 258 | extern void omapfb_set_ctrl_platform_data(void *pdata); | ||
| 259 | extern void omapfb_reserve_sdram_memblock(void); | ||
| 260 | 230 | ||
| 261 | #endif | 231 | #endif |
| 262 | 232 | ||
diff --git a/include/linux/oom.h b/include/linux/oom.h index 552fba9c7d5a..3d7647536b03 100644 --- a/include/linux/oom.h +++ b/include/linux/oom.h | |||
| @@ -49,7 +49,7 @@ extern int try_set_zonelist_oom(struct zonelist *zonelist, gfp_t gfp_flags); | |||
| 49 | extern void clear_zonelist_oom(struct zonelist *zonelist, gfp_t gfp_flags); | 49 | extern void clear_zonelist_oom(struct zonelist *zonelist, gfp_t gfp_flags); |
| 50 | 50 | ||
| 51 | extern void out_of_memory(struct zonelist *zonelist, gfp_t gfp_mask, | 51 | extern void out_of_memory(struct zonelist *zonelist, gfp_t gfp_mask, |
| 52 | int order, nodemask_t *mask); | 52 | int order, nodemask_t *mask, bool force_kill); |
| 53 | extern int register_oom_notifier(struct notifier_block *nb); | 53 | extern int register_oom_notifier(struct notifier_block *nb); |
| 54 | extern int unregister_oom_notifier(struct notifier_block *nb); | 54 | extern int unregister_oom_notifier(struct notifier_block *nb); |
| 55 | 55 | ||
diff --git a/include/linux/opp.h b/include/linux/opp.h index ee94b33080c2..2a4e5faee904 100644 --- a/include/linux/opp.h +++ b/include/linux/opp.h | |||
| @@ -19,6 +19,7 @@ | |||
| 19 | #include <linux/notifier.h> | 19 | #include <linux/notifier.h> |
| 20 | 20 | ||
| 21 | struct opp; | 21 | struct opp; |
| 22 | struct device; | ||
| 22 | 23 | ||
| 23 | enum opp_event { | 24 | enum opp_event { |
| 24 | OPP_EVENT_ADD, OPP_EVENT_ENABLE, OPP_EVENT_DISABLE, | 25 | OPP_EVENT_ADD, OPP_EVENT_ENABLE, OPP_EVENT_DISABLE, |
diff --git a/include/linux/padata.h b/include/linux/padata.h index 4633b2f726b6..86292beebfe2 100644 --- a/include/linux/padata.h +++ b/include/linux/padata.h | |||
| @@ -46,7 +46,6 @@ struct padata_priv { | |||
| 46 | struct list_head list; | 46 | struct list_head list; |
| 47 | struct parallel_data *pd; | 47 | struct parallel_data *pd; |
| 48 | int cb_cpu; | 48 | int cb_cpu; |
| 49 | int seq_nr; | ||
| 50 | int info; | 49 | int info; |
| 51 | void (*parallel)(struct padata_priv *padata); | 50 | void (*parallel)(struct padata_priv *padata); |
| 52 | void (*serial)(struct padata_priv *padata); | 51 | void (*serial)(struct padata_priv *padata); |
| @@ -116,7 +115,6 @@ struct padata_cpumask { | |||
| 116 | * @pinst: padata instance. | 115 | * @pinst: padata instance. |
| 117 | * @pqueue: percpu padata queues used for parallelization. | 116 | * @pqueue: percpu padata queues used for parallelization. |
| 118 | * @squeue: percpu padata queues used for serialuzation. | 117 | * @squeue: percpu padata queues used for serialuzation. |
| 119 | * @seq_nr: The sequence number that will be attached to the next object. | ||
| 120 | * @reorder_objects: Number of objects waiting in the reorder queues. | 118 | * @reorder_objects: Number of objects waiting in the reorder queues. |
| 121 | * @refcnt: Number of objects holding a reference on this parallel_data. | 119 | * @refcnt: Number of objects holding a reference on this parallel_data. |
| 122 | * @max_seq_nr: Maximal used sequence number. | 120 | * @max_seq_nr: Maximal used sequence number. |
| @@ -129,12 +127,12 @@ struct parallel_data { | |||
| 129 | struct padata_instance *pinst; | 127 | struct padata_instance *pinst; |
| 130 | struct padata_parallel_queue __percpu *pqueue; | 128 | struct padata_parallel_queue __percpu *pqueue; |
| 131 | struct padata_serial_queue __percpu *squeue; | 129 | struct padata_serial_queue __percpu *squeue; |
| 132 | atomic_t seq_nr; | ||
| 133 | atomic_t reorder_objects; | 130 | atomic_t reorder_objects; |
| 134 | atomic_t refcnt; | 131 | atomic_t refcnt; |
| 135 | unsigned int max_seq_nr; | ||
| 136 | struct padata_cpumask cpumask; | 132 | struct padata_cpumask cpumask; |
| 137 | spinlock_t lock ____cacheline_aligned; | 133 | spinlock_t lock ____cacheline_aligned; |
| 134 | spinlock_t seq_lock; | ||
| 135 | unsigned int seq_nr; | ||
| 138 | unsigned int processed; | 136 | unsigned int processed; |
| 139 | struct timer_list timer; | 137 | struct timer_list timer; |
| 140 | }; | 138 | }; |
diff --git a/include/linux/page-flags.h b/include/linux/page-flags.h index e90a673be67e..c88d2a9451af 100644 --- a/include/linux/page-flags.h +++ b/include/linux/page-flags.h | |||
| @@ -6,6 +6,7 @@ | |||
| 6 | #define PAGE_FLAGS_H | 6 | #define PAGE_FLAGS_H |
| 7 | 7 | ||
| 8 | #include <linux/types.h> | 8 | #include <linux/types.h> |
| 9 | #include <linux/bug.h> | ||
| 9 | #ifndef __GENERATING_BOUNDS_H | 10 | #ifndef __GENERATING_BOUNDS_H |
| 10 | #include <linux/mm_types.h> | 11 | #include <linux/mm_types.h> |
| 11 | #include <generated/bounds.h> | 12 | #include <generated/bounds.h> |
| @@ -414,11 +415,26 @@ static inline int PageTransHuge(struct page *page) | |||
| 414 | return PageHead(page); | 415 | return PageHead(page); |
| 415 | } | 416 | } |
| 416 | 417 | ||
| 418 | /* | ||
| 419 | * PageTransCompound returns true for both transparent huge pages | ||
| 420 | * and hugetlbfs pages, so it should only be called when it's known | ||
| 421 | * that hugetlbfs pages aren't involved. | ||
| 422 | */ | ||
| 417 | static inline int PageTransCompound(struct page *page) | 423 | static inline int PageTransCompound(struct page *page) |
| 418 | { | 424 | { |
| 419 | return PageCompound(page); | 425 | return PageCompound(page); |
| 420 | } | 426 | } |
| 421 | 427 | ||
| 428 | /* | ||
| 429 | * PageTransTail returns true for both transparent huge pages | ||
| 430 | * and hugetlbfs pages, so it should only be called when it's known | ||
| 431 | * that hugetlbfs pages aren't involved. | ||
| 432 | */ | ||
| 433 | static inline int PageTransTail(struct page *page) | ||
| 434 | { | ||
| 435 | return PageTail(page); | ||
| 436 | } | ||
| 437 | |||
| 422 | #else | 438 | #else |
| 423 | 439 | ||
| 424 | static inline int PageTransHuge(struct page *page) | 440 | static inline int PageTransHuge(struct page *page) |
| @@ -430,6 +446,11 @@ static inline int PageTransCompound(struct page *page) | |||
| 430 | { | 446 | { |
| 431 | return 0; | 447 | return 0; |
| 432 | } | 448 | } |
| 449 | |||
| 450 | static inline int PageTransTail(struct page *page) | ||
| 451 | { | ||
| 452 | return 0; | ||
| 453 | } | ||
| 433 | #endif | 454 | #endif |
| 434 | 455 | ||
| 435 | #ifdef CONFIG_MMU | 456 | #ifdef CONFIG_MMU |
diff --git a/include/linux/page_cgroup.h b/include/linux/page_cgroup.h index a2d11771c84b..a88cdba27809 100644 --- a/include/linux/page_cgroup.h +++ b/include/linux/page_cgroup.h | |||
| @@ -4,12 +4,8 @@ | |||
| 4 | enum { | 4 | enum { |
| 5 | /* flags for mem_cgroup */ | 5 | /* flags for mem_cgroup */ |
| 6 | PCG_LOCK, /* Lock for pc->mem_cgroup and following bits. */ | 6 | PCG_LOCK, /* Lock for pc->mem_cgroup and following bits. */ |
| 7 | PCG_CACHE, /* charged as cache */ | ||
| 8 | PCG_USED, /* this object is in use. */ | 7 | PCG_USED, /* this object is in use. */ |
| 9 | PCG_MIGRATION, /* under page migration */ | 8 | PCG_MIGRATION, /* under page migration */ |
| 10 | /* flags for mem_cgroup and file and I/O status */ | ||
| 11 | PCG_MOVE_LOCK, /* For race between move_account v.s. following bits */ | ||
| 12 | PCG_FILE_MAPPED, /* page is accounted as "mapped" */ | ||
| 13 | __NR_PCG_FLAGS, | 9 | __NR_PCG_FLAGS, |
| 14 | }; | 10 | }; |
| 15 | 11 | ||
| @@ -64,19 +60,10 @@ static inline void ClearPageCgroup##uname(struct page_cgroup *pc) \ | |||
| 64 | static inline int TestClearPageCgroup##uname(struct page_cgroup *pc) \ | 60 | static inline int TestClearPageCgroup##uname(struct page_cgroup *pc) \ |
| 65 | { return test_and_clear_bit(PCG_##lname, &pc->flags); } | 61 | { return test_and_clear_bit(PCG_##lname, &pc->flags); } |
| 66 | 62 | ||
| 67 | /* Cache flag is set only once (at allocation) */ | ||
| 68 | TESTPCGFLAG(Cache, CACHE) | ||
| 69 | CLEARPCGFLAG(Cache, CACHE) | ||
| 70 | SETPCGFLAG(Cache, CACHE) | ||
| 71 | |||
| 72 | TESTPCGFLAG(Used, USED) | 63 | TESTPCGFLAG(Used, USED) |
| 73 | CLEARPCGFLAG(Used, USED) | 64 | CLEARPCGFLAG(Used, USED) |
| 74 | SETPCGFLAG(Used, USED) | 65 | SETPCGFLAG(Used, USED) |
| 75 | 66 | ||
| 76 | SETPCGFLAG(FileMapped, FILE_MAPPED) | ||
| 77 | CLEARPCGFLAG(FileMapped, FILE_MAPPED) | ||
| 78 | TESTPCGFLAG(FileMapped, FILE_MAPPED) | ||
| 79 | |||
| 80 | SETPCGFLAG(Migration, MIGRATION) | 67 | SETPCGFLAG(Migration, MIGRATION) |
| 81 | CLEARPCGFLAG(Migration, MIGRATION) | 68 | CLEARPCGFLAG(Migration, MIGRATION) |
| 82 | TESTPCGFLAG(Migration, MIGRATION) | 69 | TESTPCGFLAG(Migration, MIGRATION) |
| @@ -85,7 +72,7 @@ static inline void lock_page_cgroup(struct page_cgroup *pc) | |||
| 85 | { | 72 | { |
| 86 | /* | 73 | /* |
| 87 | * Don't take this lock in IRQ context. | 74 | * Don't take this lock in IRQ context. |
| 88 | * This lock is for pc->mem_cgroup, USED, CACHE, MIGRATION | 75 | * This lock is for pc->mem_cgroup, USED, MIGRATION |
| 89 | */ | 76 | */ |
| 90 | bit_spin_lock(PCG_LOCK, &pc->flags); | 77 | bit_spin_lock(PCG_LOCK, &pc->flags); |
| 91 | } | 78 | } |
| @@ -95,24 +82,6 @@ static inline void unlock_page_cgroup(struct page_cgroup *pc) | |||
| 95 | bit_spin_unlock(PCG_LOCK, &pc->flags); | 82 | bit_spin_unlock(PCG_LOCK, &pc->flags); |
| 96 | } | 83 | } |
| 97 | 84 | ||
| 98 | static inline void move_lock_page_cgroup(struct page_cgroup *pc, | ||
| 99 | unsigned long *flags) | ||
| 100 | { | ||
| 101 | /* | ||
| 102 | * We know updates to pc->flags of page cache's stats are from both of | ||
| 103 | * usual context or IRQ context. Disable IRQ to avoid deadlock. | ||
| 104 | */ | ||
| 105 | local_irq_save(*flags); | ||
| 106 | bit_spin_lock(PCG_MOVE_LOCK, &pc->flags); | ||
| 107 | } | ||
| 108 | |||
| 109 | static inline void move_unlock_page_cgroup(struct page_cgroup *pc, | ||
| 110 | unsigned long *flags) | ||
| 111 | { | ||
| 112 | bit_spin_unlock(PCG_MOVE_LOCK, &pc->flags); | ||
| 113 | local_irq_restore(*flags); | ||
| 114 | } | ||
| 115 | |||
| 116 | #else /* CONFIG_CGROUP_MEM_RES_CTLR */ | 85 | #else /* CONFIG_CGROUP_MEM_RES_CTLR */ |
| 117 | struct page_cgroup; | 86 | struct page_cgroup; |
| 118 | 87 | ||
diff --git a/include/linux/pci.h b/include/linux/pci.h index a16b1df3deff..e444f5b49118 100644 --- a/include/linux/pci.h +++ b/include/linux/pci.h | |||
| @@ -299,7 +299,6 @@ struct pci_dev { | |||
| 299 | */ | 299 | */ |
| 300 | unsigned int irq; | 300 | unsigned int irq; |
| 301 | struct resource resource[DEVICE_COUNT_RESOURCE]; /* I/O and memory regions + expansion ROMs */ | 301 | struct resource resource[DEVICE_COUNT_RESOURCE]; /* I/O and memory regions + expansion ROMs */ |
| 302 | resource_size_t fw_addr[DEVICE_COUNT_RESOURCE]; /* FW-assigned addr */ | ||
| 303 | 302 | ||
| 304 | /* These fields are used by common fixups */ | 303 | /* These fields are used by common fixups */ |
| 305 | unsigned int transparent:1; /* Transparent PCI bridge */ | 304 | unsigned int transparent:1; /* Transparent PCI bridge */ |
| @@ -369,24 +368,17 @@ static inline int pci_channel_offline(struct pci_dev *pdev) | |||
| 369 | return (pdev->error_state != pci_channel_io_normal); | 368 | return (pdev->error_state != pci_channel_io_normal); |
| 370 | } | 369 | } |
| 371 | 370 | ||
| 372 | static inline struct pci_cap_saved_state *pci_find_saved_cap( | 371 | struct pci_host_bridge_window { |
| 373 | struct pci_dev *pci_dev, char cap) | 372 | struct list_head list; |
| 374 | { | 373 | struct resource *res; /* host bridge aperture (CPU address) */ |
| 375 | struct pci_cap_saved_state *tmp; | 374 | resource_size_t offset; /* bus address + offset = CPU address */ |
| 376 | struct hlist_node *pos; | 375 | }; |
| 377 | |||
| 378 | hlist_for_each_entry(tmp, pos, &pci_dev->saved_cap_space, next) { | ||
| 379 | if (tmp->cap.cap_nr == cap) | ||
| 380 | return tmp; | ||
| 381 | } | ||
| 382 | return NULL; | ||
| 383 | } | ||
| 384 | 376 | ||
| 385 | static inline void pci_add_saved_cap(struct pci_dev *pci_dev, | 377 | struct pci_host_bridge { |
| 386 | struct pci_cap_saved_state *new_cap) | 378 | struct list_head list; |
| 387 | { | 379 | struct pci_bus *bus; /* root bus */ |
| 388 | hlist_add_head(&new_cap->next, &pci_dev->saved_cap_space); | 380 | struct list_head windows; /* pci_host_bridge_windows */ |
| 389 | } | 381 | }; |
| 390 | 382 | ||
| 391 | /* | 383 | /* |
| 392 | * The first PCI_BRIDGE_RESOURCE_NUM PCI bus resources (those that correspond | 384 | * The first PCI_BRIDGE_RESOURCE_NUM PCI bus resources (those that correspond |
| @@ -656,6 +648,10 @@ void pci_fixup_cardbus(struct pci_bus *); | |||
| 656 | 648 | ||
| 657 | /* Generic PCI functions used internally */ | 649 | /* Generic PCI functions used internally */ |
| 658 | 650 | ||
| 651 | void pcibios_resource_to_bus(struct pci_dev *dev, struct pci_bus_region *region, | ||
| 652 | struct resource *res); | ||
| 653 | void pcibios_bus_to_resource(struct pci_dev *dev, struct resource *res, | ||
| 654 | struct pci_bus_region *region); | ||
| 659 | void pcibios_scan_specific_bus(int busn); | 655 | void pcibios_scan_specific_bus(int busn); |
| 660 | extern struct pci_bus *pci_find_bus(int domain, int busnr); | 656 | extern struct pci_bus *pci_find_bus(int domain, int busnr); |
| 661 | void pci_bus_add_devices(const struct pci_bus *bus); | 657 | void pci_bus_add_devices(const struct pci_bus *bus); |
| @@ -690,7 +686,8 @@ u8 pci_common_swizzle(struct pci_dev *dev, u8 *pinp); | |||
| 690 | extern struct pci_dev *pci_dev_get(struct pci_dev *dev); | 686 | extern struct pci_dev *pci_dev_get(struct pci_dev *dev); |
| 691 | extern void pci_dev_put(struct pci_dev *dev); | 687 | extern void pci_dev_put(struct pci_dev *dev); |
| 692 | extern void pci_remove_bus(struct pci_bus *b); | 688 | extern void pci_remove_bus(struct pci_bus *b); |
| 693 | extern void pci_remove_bus_device(struct pci_dev *dev); | 689 | extern void __pci_remove_bus_device(struct pci_dev *dev); |
| 690 | extern void pci_stop_and_remove_bus_device(struct pci_dev *dev); | ||
| 694 | extern void pci_stop_bus_device(struct pci_dev *dev); | 691 | extern void pci_stop_bus_device(struct pci_dev *dev); |
| 695 | void pci_setup_cardbus(struct pci_bus *bus); | 692 | void pci_setup_cardbus(struct pci_bus *bus); |
| 696 | extern void pci_sort_breadthfirst(void); | 693 | extern void pci_sort_breadthfirst(void); |
| @@ -746,28 +743,28 @@ int pci_bus_write_config_dword(struct pci_bus *bus, unsigned int devfn, | |||
| 746 | int where, u32 val); | 743 | int where, u32 val); |
| 747 | struct pci_ops *pci_bus_set_ops(struct pci_bus *bus, struct pci_ops *ops); | 744 | struct pci_ops *pci_bus_set_ops(struct pci_bus *bus, struct pci_ops *ops); |
| 748 | 745 | ||
| 749 | static inline int pci_read_config_byte(struct pci_dev *dev, int where, u8 *val) | 746 | static inline int pci_read_config_byte(const struct pci_dev *dev, int where, u8 *val) |
| 750 | { | 747 | { |
| 751 | return pci_bus_read_config_byte(dev->bus, dev->devfn, where, val); | 748 | return pci_bus_read_config_byte(dev->bus, dev->devfn, where, val); |
| 752 | } | 749 | } |
| 753 | static inline int pci_read_config_word(struct pci_dev *dev, int where, u16 *val) | 750 | static inline int pci_read_config_word(const struct pci_dev *dev, int where, u16 *val) |
| 754 | { | 751 | { |
| 755 | return pci_bus_read_config_word(dev->bus, dev->devfn, where, val); | 752 | return pci_bus_read_config_word(dev->bus, dev->devfn, where, val); |
| 756 | } | 753 | } |
| 757 | static inline int pci_read_config_dword(struct pci_dev *dev, int where, | 754 | static inline int pci_read_config_dword(const struct pci_dev *dev, int where, |
| 758 | u32 *val) | 755 | u32 *val) |
| 759 | { | 756 | { |
| 760 | return pci_bus_read_config_dword(dev->bus, dev->devfn, where, val); | 757 | return pci_bus_read_config_dword(dev->bus, dev->devfn, where, val); |
| 761 | } | 758 | } |
| 762 | static inline int pci_write_config_byte(struct pci_dev *dev, int where, u8 val) | 759 | static inline int pci_write_config_byte(const struct pci_dev *dev, int where, u8 val) |
| 763 | { | 760 | { |
| 764 | return pci_bus_write_config_byte(dev->bus, dev->devfn, where, val); | 761 | return pci_bus_write_config_byte(dev->bus, dev->devfn, where, val); |
| 765 | } | 762 | } |
| 766 | static inline int pci_write_config_word(struct pci_dev *dev, int where, u16 val) | 763 | static inline int pci_write_config_word(const struct pci_dev *dev, int where, u16 val) |
| 767 | { | 764 | { |
| 768 | return pci_bus_write_config_word(dev->bus, dev->devfn, where, val); | 765 | return pci_bus_write_config_word(dev->bus, dev->devfn, where, val); |
| 769 | } | 766 | } |
| 770 | static inline int pci_write_config_dword(struct pci_dev *dev, int where, | 767 | static inline int pci_write_config_dword(const struct pci_dev *dev, int where, |
| 771 | u32 val) | 768 | u32 val) |
| 772 | { | 769 | { |
| 773 | return pci_bus_write_config_dword(dev->bus, dev->devfn, where, val); | 770 | return pci_bus_write_config_dword(dev->bus, dev->devfn, where, val); |
| @@ -817,6 +814,7 @@ int pcie_set_readrq(struct pci_dev *dev, int rq); | |||
| 817 | int pcie_get_mps(struct pci_dev *dev); | 814 | int pcie_get_mps(struct pci_dev *dev); |
| 818 | int pcie_set_mps(struct pci_dev *dev, int mps); | 815 | int pcie_set_mps(struct pci_dev *dev, int mps); |
| 819 | int __pci_reset_function(struct pci_dev *dev); | 816 | int __pci_reset_function(struct pci_dev *dev); |
| 817 | int __pci_reset_function_locked(struct pci_dev *dev); | ||
| 820 | int pci_reset_function(struct pci_dev *dev); | 818 | int pci_reset_function(struct pci_dev *dev); |
| 821 | void pci_update_resource(struct pci_dev *dev, int resno); | 819 | void pci_update_resource(struct pci_dev *dev, int resno); |
| 822 | int __must_check pci_assign_resource(struct pci_dev *dev, int i); | 820 | int __must_check pci_assign_resource(struct pci_dev *dev, int i); |
| @@ -882,6 +880,7 @@ void set_pcie_hotplug_bridge(struct pci_dev *pdev); | |||
| 882 | /* Functions for PCI Hotplug drivers to use */ | 880 | /* Functions for PCI Hotplug drivers to use */ |
| 883 | int pci_bus_find_capability(struct pci_bus *bus, unsigned int devfn, int cap); | 881 | int pci_bus_find_capability(struct pci_bus *bus, unsigned int devfn, int cap); |
| 884 | #ifdef CONFIG_HOTPLUG | 882 | #ifdef CONFIG_HOTPLUG |
| 883 | unsigned int pci_rescan_bus_bridge_resize(struct pci_dev *bridge); | ||
| 885 | unsigned int pci_rescan_bus(struct pci_bus *bus); | 884 | unsigned int pci_rescan_bus(struct pci_bus *bus); |
| 886 | #endif | 885 | #endif |
| 887 | 886 | ||
| @@ -891,13 +890,13 @@ ssize_t pci_write_vpd(struct pci_dev *dev, loff_t pos, size_t count, const void | |||
| 891 | int pci_vpd_truncate(struct pci_dev *dev, size_t size); | 890 | int pci_vpd_truncate(struct pci_dev *dev, size_t size); |
| 892 | 891 | ||
| 893 | /* Helper functions for low-level code (drivers/pci/setup-[bus,res].c) */ | 892 | /* Helper functions for low-level code (drivers/pci/setup-[bus,res].c) */ |
| 893 | resource_size_t pcibios_retrieve_fw_addr(struct pci_dev *dev, int idx); | ||
| 894 | void pci_bus_assign_resources(const struct pci_bus *bus); | 894 | void pci_bus_assign_resources(const struct pci_bus *bus); |
| 895 | void pci_bus_size_bridges(struct pci_bus *bus); | 895 | void pci_bus_size_bridges(struct pci_bus *bus); |
| 896 | int pci_claim_resource(struct pci_dev *, int); | 896 | int pci_claim_resource(struct pci_dev *, int); |
| 897 | void pci_assign_unassigned_resources(void); | 897 | void pci_assign_unassigned_resources(void); |
| 898 | void pci_assign_unassigned_bridge_resources(struct pci_dev *bridge); | 898 | void pci_assign_unassigned_bridge_resources(struct pci_dev *bridge); |
| 899 | void pdev_enable_device(struct pci_dev *); | 899 | void pdev_enable_device(struct pci_dev *); |
| 900 | void pdev_sort_resources(struct pci_dev *, struct resource_list *); | ||
| 901 | int pci_enable_resources(struct pci_dev *, int mask); | 900 | int pci_enable_resources(struct pci_dev *, int mask); |
| 902 | void pci_fixup_irqs(u8 (*)(struct pci_dev *, u8 *), | 901 | void pci_fixup_irqs(u8 (*)(struct pci_dev *, u8 *), |
| 903 | int (*)(const struct pci_dev *, u8, u8)); | 902 | int (*)(const struct pci_dev *, u8, u8)); |
| @@ -914,6 +913,8 @@ void pci_release_selected_regions(struct pci_dev *, int); | |||
| 914 | 913 | ||
| 915 | /* drivers/pci/bus.c */ | 914 | /* drivers/pci/bus.c */ |
| 916 | void pci_add_resource(struct list_head *resources, struct resource *res); | 915 | void pci_add_resource(struct list_head *resources, struct resource *res); |
| 916 | void pci_add_resource_offset(struct list_head *resources, struct resource *res, | ||
| 917 | resource_size_t offset); | ||
| 917 | void pci_free_resource_list(struct list_head *resources); | 918 | void pci_free_resource_list(struct list_head *resources); |
| 918 | void pci_bus_add_resource(struct pci_bus *bus, struct resource *res, unsigned int flags); | 919 | void pci_bus_add_resource(struct pci_bus *bus, struct resource *res, unsigned int flags); |
| 919 | struct resource *pci_bus_resource_n(const struct pci_bus *bus, int n); | 920 | struct resource *pci_bus_resource_n(const struct pci_bus *bus, int n); |
| @@ -946,7 +947,20 @@ int __must_check __pci_register_driver(struct pci_driver *, struct module *, | |||
| 946 | __pci_register_driver(driver, THIS_MODULE, KBUILD_MODNAME) | 947 | __pci_register_driver(driver, THIS_MODULE, KBUILD_MODNAME) |
| 947 | 948 | ||
| 948 | void pci_unregister_driver(struct pci_driver *dev); | 949 | void pci_unregister_driver(struct pci_driver *dev); |
| 949 | void pci_remove_behind_bridge(struct pci_dev *dev); | 950 | |
| 951 | /** | ||
| 952 | * module_pci_driver() - Helper macro for registering a PCI driver | ||
| 953 | * @__pci_driver: pci_driver struct | ||
| 954 | * | ||
| 955 | * Helper macro for PCI drivers which do not do anything special in module | ||
| 956 | * init/exit. This eliminates a lot of boilerplate. Each module may only | ||
| 957 | * use this macro once, and calling it replaces module_init() and module_exit() | ||
| 958 | */ | ||
| 959 | #define module_pci_driver(__pci_driver) \ | ||
| 960 | module_driver(__pci_driver, pci_register_driver, \ | ||
| 961 | pci_unregister_driver) | ||
| 962 | |||
| 963 | void pci_stop_and_remove_behind_bridge(struct pci_dev *dev); | ||
| 950 | struct pci_driver *pci_dev_driver(const struct pci_dev *dev); | 964 | struct pci_driver *pci_dev_driver(const struct pci_dev *dev); |
| 951 | int pci_add_dynid(struct pci_driver *drv, | 965 | int pci_add_dynid(struct pci_driver *drv, |
| 952 | unsigned int vendor, unsigned int device, | 966 | unsigned int vendor, unsigned int device, |
| @@ -1382,7 +1396,10 @@ static inline void pci_resource_to_user(const struct pci_dev *dev, int bar, | |||
| 1382 | */ | 1396 | */ |
| 1383 | 1397 | ||
| 1384 | struct pci_fixup { | 1398 | struct pci_fixup { |
| 1385 | u16 vendor, device; /* You can use PCI_ANY_ID here of course */ | 1399 | u16 vendor; /* You can use PCI_ANY_ID here of course */ |
| 1400 | u16 device; /* You can use PCI_ANY_ID here of course */ | ||
| 1401 | u32 class; /* You can use PCI_ANY_ID here too */ | ||
| 1402 | unsigned int class_shift; /* should be 0, 8, 16 */ | ||
| 1386 | void (*hook)(struct pci_dev *dev); | 1403 | void (*hook)(struct pci_dev *dev); |
| 1387 | }; | 1404 | }; |
| 1388 | 1405 | ||
| @@ -1397,30 +1414,68 @@ enum pci_fixup_pass { | |||
| 1397 | }; | 1414 | }; |
| 1398 | 1415 | ||
| 1399 | /* Anonymous variables would be nice... */ | 1416 | /* Anonymous variables would be nice... */ |
| 1400 | #define DECLARE_PCI_FIXUP_SECTION(section, name, vendor, device, hook) \ | 1417 | #define DECLARE_PCI_FIXUP_SECTION(section, name, vendor, device, class, \ |
| 1401 | static const struct pci_fixup __pci_fixup_##name __used \ | 1418 | class_shift, hook) \ |
| 1402 | __attribute__((__section__(#section))) = { vendor, device, hook }; | 1419 | static const struct pci_fixup const __pci_fixup_##name __used \ |
| 1420 | __attribute__((__section__(#section), aligned((sizeof(void *))))) \ | ||
| 1421 | = { vendor, device, class, class_shift, hook }; | ||
| 1422 | |||
| 1423 | #define DECLARE_PCI_FIXUP_CLASS_EARLY(vendor, device, class, \ | ||
| 1424 | class_shift, hook) \ | ||
| 1425 | DECLARE_PCI_FIXUP_SECTION(.pci_fixup_early, \ | ||
| 1426 | vendor##device##hook, vendor, device, class, class_shift, hook) | ||
| 1427 | #define DECLARE_PCI_FIXUP_CLASS_HEADER(vendor, device, class, \ | ||
| 1428 | class_shift, hook) \ | ||
| 1429 | DECLARE_PCI_FIXUP_SECTION(.pci_fixup_header, \ | ||
| 1430 | vendor##device##hook, vendor, device, class, class_shift, hook) | ||
| 1431 | #define DECLARE_PCI_FIXUP_CLASS_FINAL(vendor, device, class, \ | ||
| 1432 | class_shift, hook) \ | ||
| 1433 | DECLARE_PCI_FIXUP_SECTION(.pci_fixup_final, \ | ||
| 1434 | vendor##device##hook, vendor, device, class, class_shift, hook) | ||
| 1435 | #define DECLARE_PCI_FIXUP_CLASS_ENABLE(vendor, device, class, \ | ||
| 1436 | class_shift, hook) \ | ||
| 1437 | DECLARE_PCI_FIXUP_SECTION(.pci_fixup_enable, \ | ||
| 1438 | vendor##device##hook, vendor, device, class, class_shift, hook) | ||
| 1439 | #define DECLARE_PCI_FIXUP_CLASS_RESUME(vendor, device, class, \ | ||
| 1440 | class_shift, hook) \ | ||
| 1441 | DECLARE_PCI_FIXUP_SECTION(.pci_fixup_resume, \ | ||
| 1442 | resume##vendor##device##hook, vendor, device, class, \ | ||
| 1443 | class_shift, hook) | ||
| 1444 | #define DECLARE_PCI_FIXUP_CLASS_RESUME_EARLY(vendor, device, class, \ | ||
| 1445 | class_shift, hook) \ | ||
| 1446 | DECLARE_PCI_FIXUP_SECTION(.pci_fixup_resume_early, \ | ||
| 1447 | resume_early##vendor##device##hook, vendor, device, \ | ||
| 1448 | class, class_shift, hook) | ||
| 1449 | #define DECLARE_PCI_FIXUP_CLASS_SUSPEND(vendor, device, class, \ | ||
| 1450 | class_shift, hook) \ | ||
| 1451 | DECLARE_PCI_FIXUP_SECTION(.pci_fixup_suspend, \ | ||
| 1452 | suspend##vendor##device##hook, vendor, device, class, \ | ||
| 1453 | class_shift, hook) | ||
| 1454 | |||
| 1403 | #define DECLARE_PCI_FIXUP_EARLY(vendor, device, hook) \ | 1455 | #define DECLARE_PCI_FIXUP_EARLY(vendor, device, hook) \ |
| 1404 | DECLARE_PCI_FIXUP_SECTION(.pci_fixup_early, \ | 1456 | DECLARE_PCI_FIXUP_SECTION(.pci_fixup_early, \ |
| 1405 | vendor##device##hook, vendor, device, hook) | 1457 | vendor##device##hook, vendor, device, PCI_ANY_ID, 0, hook) |
| 1406 | #define DECLARE_PCI_FIXUP_HEADER(vendor, device, hook) \ | 1458 | #define DECLARE_PCI_FIXUP_HEADER(vendor, device, hook) \ |
| 1407 | DECLARE_PCI_FIXUP_SECTION(.pci_fixup_header, \ | 1459 | DECLARE_PCI_FIXUP_SECTION(.pci_fixup_header, \ |
| 1408 | vendor##device##hook, vendor, device, hook) | 1460 | vendor##device##hook, vendor, device, PCI_ANY_ID, 0, hook) |
| 1409 | #define DECLARE_PCI_FIXUP_FINAL(vendor, device, hook) \ | 1461 | #define DECLARE_PCI_FIXUP_FINAL(vendor, device, hook) \ |
| 1410 | DECLARE_PCI_FIXUP_SECTION(.pci_fixup_final, \ | 1462 | DECLARE_PCI_FIXUP_SECTION(.pci_fixup_final, \ |
| 1411 | vendor##device##hook, vendor, device, hook) | 1463 | vendor##device##hook, vendor, device, PCI_ANY_ID, 0, hook) |
| 1412 | #define DECLARE_PCI_FIXUP_ENABLE(vendor, device, hook) \ | 1464 | #define DECLARE_PCI_FIXUP_ENABLE(vendor, device, hook) \ |
| 1413 | DECLARE_PCI_FIXUP_SECTION(.pci_fixup_enable, \ | 1465 | DECLARE_PCI_FIXUP_SECTION(.pci_fixup_enable, \ |
| 1414 | vendor##device##hook, vendor, device, hook) | 1466 | vendor##device##hook, vendor, device, PCI_ANY_ID, 0, hook) |
| 1415 | #define DECLARE_PCI_FIXUP_RESUME(vendor, device, hook) \ | 1467 | #define DECLARE_PCI_FIXUP_RESUME(vendor, device, hook) \ |
| 1416 | DECLARE_PCI_FIXUP_SECTION(.pci_fixup_resume, \ | 1468 | DECLARE_PCI_FIXUP_SECTION(.pci_fixup_resume, \ |
| 1417 | resume##vendor##device##hook, vendor, device, hook) | 1469 | resume##vendor##device##hook, vendor, device, \ |
| 1470 | PCI_ANY_ID, 0, hook) | ||
| 1418 | #define DECLARE_PCI_FIXUP_RESUME_EARLY(vendor, device, hook) \ | 1471 | #define DECLARE_PCI_FIXUP_RESUME_EARLY(vendor, device, hook) \ |
| 1419 | DECLARE_PCI_FIXUP_SECTION(.pci_fixup_resume_early, \ | 1472 | DECLARE_PCI_FIXUP_SECTION(.pci_fixup_resume_early, \ |
| 1420 | resume_early##vendor##device##hook, vendor, device, hook) | 1473 | resume_early##vendor##device##hook, vendor, device, \ |
| 1474 | PCI_ANY_ID, 0, hook) | ||
| 1421 | #define DECLARE_PCI_FIXUP_SUSPEND(vendor, device, hook) \ | 1475 | #define DECLARE_PCI_FIXUP_SUSPEND(vendor, device, hook) \ |
| 1422 | DECLARE_PCI_FIXUP_SECTION(.pci_fixup_suspend, \ | 1476 | DECLARE_PCI_FIXUP_SECTION(.pci_fixup_suspend, \ |
| 1423 | suspend##vendor##device##hook, vendor, device, hook) | 1477 | suspend##vendor##device##hook, vendor, device, \ |
| 1478 | PCI_ANY_ID, 0, hook) | ||
| 1424 | 1479 | ||
| 1425 | #ifdef CONFIG_PCI_QUIRKS | 1480 | #ifdef CONFIG_PCI_QUIRKS |
| 1426 | void pci_fixup_device(enum pci_fixup_pass pass, struct pci_dev *dev); | 1481 | void pci_fixup_device(enum pci_fixup_pass pass, struct pci_dev *dev); |
| @@ -1647,6 +1702,13 @@ static inline void pci_set_bus_of_node(struct pci_bus *bus) { } | |||
| 1647 | static inline void pci_release_bus_of_node(struct pci_bus *bus) { } | 1702 | static inline void pci_release_bus_of_node(struct pci_bus *bus) { } |
| 1648 | #endif /* CONFIG_OF */ | 1703 | #endif /* CONFIG_OF */ |
| 1649 | 1704 | ||
| 1705 | #ifdef CONFIG_EEH | ||
| 1706 | static inline struct eeh_dev *pci_dev_to_eeh_dev(struct pci_dev *pdev) | ||
| 1707 | { | ||
| 1708 | return pdev->dev.archdata.edev; | ||
| 1709 | } | ||
| 1710 | #endif | ||
| 1711 | |||
| 1650 | /** | 1712 | /** |
| 1651 | * pci_find_upstream_pcie_bridge - find upstream PCIe-to-PCI bridge of a device | 1713 | * pci_find_upstream_pcie_bridge - find upstream PCIe-to-PCI bridge of a device |
| 1652 | * @pdev: the PCI device | 1714 | * @pdev: the PCI device |
diff --git a/include/linux/pci_ids.h b/include/linux/pci_ids.h index 31d77af2ef42..3329965ed63f 100644 --- a/include/linux/pci_ids.h +++ b/include/linux/pci_ids.h | |||
| @@ -2105,6 +2105,7 @@ | |||
| 2105 | #define PCI_DEVICE_ID_NX2_57711E 0x1650 | 2105 | #define PCI_DEVICE_ID_NX2_57711E 0x1650 |
| 2106 | #define PCI_DEVICE_ID_TIGON3_5705 0x1653 | 2106 | #define PCI_DEVICE_ID_TIGON3_5705 0x1653 |
| 2107 | #define PCI_DEVICE_ID_TIGON3_5705_2 0x1654 | 2107 | #define PCI_DEVICE_ID_TIGON3_5705_2 0x1654 |
| 2108 | #define PCI_DEVICE_ID_TIGON3_5719 0x1657 | ||
| 2108 | #define PCI_DEVICE_ID_TIGON3_5721 0x1659 | 2109 | #define PCI_DEVICE_ID_TIGON3_5721 0x1659 |
| 2109 | #define PCI_DEVICE_ID_TIGON3_5722 0x165a | 2110 | #define PCI_DEVICE_ID_TIGON3_5722 0x165a |
| 2110 | #define PCI_DEVICE_ID_TIGON3_5723 0x165b | 2111 | #define PCI_DEVICE_ID_TIGON3_5723 0x165b |
diff --git a/include/linux/pci_regs.h b/include/linux/pci_regs.h index e41a10f5ae83..4b608f543412 100644 --- a/include/linux/pci_regs.h +++ b/include/linux/pci_regs.h | |||
| @@ -391,6 +391,7 @@ | |||
| 391 | #define PCI_EXP_TYPE_UPSTREAM 0x5 /* Upstream Port */ | 391 | #define PCI_EXP_TYPE_UPSTREAM 0x5 /* Upstream Port */ |
| 392 | #define PCI_EXP_TYPE_DOWNSTREAM 0x6 /* Downstream Port */ | 392 | #define PCI_EXP_TYPE_DOWNSTREAM 0x6 /* Downstream Port */ |
| 393 | #define PCI_EXP_TYPE_PCI_BRIDGE 0x7 /* PCI/PCI-X Bridge */ | 393 | #define PCI_EXP_TYPE_PCI_BRIDGE 0x7 /* PCI/PCI-X Bridge */ |
| 394 | #define PCI_EXP_TYPE_PCIE_BRIDGE 0x8 /* PCI/PCI-X to PCIE Bridge */ | ||
| 394 | #define PCI_EXP_TYPE_RC_END 0x9 /* Root Complex Integrated Endpoint */ | 395 | #define PCI_EXP_TYPE_RC_END 0x9 /* Root Complex Integrated Endpoint */ |
| 395 | #define PCI_EXP_TYPE_RC_EC 0xa /* Root Complex Event Collector */ | 396 | #define PCI_EXP_TYPE_RC_EC 0xa /* Root Complex Event Collector */ |
| 396 | #define PCI_EXP_FLAGS_SLOT 0x0100 /* Slot implemented */ | 397 | #define PCI_EXP_FLAGS_SLOT 0x0100 /* Slot implemented */ |
diff --git a/include/linux/perf_event.h b/include/linux/perf_event.h index 57ae485e80fc..ddbb6a901f65 100644 --- a/include/linux/perf_event.h +++ b/include/linux/perf_event.h | |||
| @@ -299,18 +299,31 @@ struct perf_event_mmap_page { | |||
| 299 | /* | 299 | /* |
| 300 | * Bits needed to read the hw events in user-space. | 300 | * Bits needed to read the hw events in user-space. |
| 301 | * | 301 | * |
| 302 | * u32 seq; | 302 | * u32 seq, time_mult, time_shift, idx, width; |
| 303 | * s64 count; | 303 | * u64 count, enabled, running; |
| 304 | * u64 cyc, time_offset; | ||
| 305 | * s64 pmc = 0; | ||
| 304 | * | 306 | * |
| 305 | * do { | 307 | * do { |
| 306 | * seq = pc->lock; | 308 | * seq = pc->lock; |
| 307 | * | ||
| 308 | * barrier() | 309 | * barrier() |
| 309 | * if (pc->index) { | 310 | * |
| 310 | * count = pmc_read(pc->index - 1); | 311 | * enabled = pc->time_enabled; |
| 311 | * count += pc->offset; | 312 | * running = pc->time_running; |
| 312 | * } else | 313 | * |
| 313 | * goto regular_read; | 314 | * if (pc->cap_usr_time && enabled != running) { |
| 315 | * cyc = rdtsc(); | ||
| 316 | * time_offset = pc->time_offset; | ||
| 317 | * time_mult = pc->time_mult; | ||
| 318 | * time_shift = pc->time_shift; | ||
| 319 | * } | ||
| 320 | * | ||
| 321 | * idx = pc->index; | ||
| 322 | * count = pc->offset; | ||
| 323 | * if (pc->cap_usr_rdpmc && idx) { | ||
| 324 | * width = pc->pmc_width; | ||
| 325 | * pmc = rdpmc(idx - 1); | ||
| 326 | * } | ||
| 314 | * | 327 | * |
| 315 | * barrier(); | 328 | * barrier(); |
| 316 | * } while (pc->lock != seq); | 329 | * } while (pc->lock != seq); |
| @@ -323,14 +336,57 @@ struct perf_event_mmap_page { | |||
| 323 | __s64 offset; /* add to hardware event value */ | 336 | __s64 offset; /* add to hardware event value */ |
| 324 | __u64 time_enabled; /* time event active */ | 337 | __u64 time_enabled; /* time event active */ |
| 325 | __u64 time_running; /* time event on cpu */ | 338 | __u64 time_running; /* time event on cpu */ |
| 326 | __u32 time_mult, time_shift; | 339 | union { |
| 340 | __u64 capabilities; | ||
| 341 | __u64 cap_usr_time : 1, | ||
| 342 | cap_usr_rdpmc : 1, | ||
| 343 | cap_____res : 62; | ||
| 344 | }; | ||
| 345 | |||
| 346 | /* | ||
| 347 | * If cap_usr_rdpmc this field provides the bit-width of the value | ||
| 348 | * read using the rdpmc() or equivalent instruction. This can be used | ||
| 349 | * to sign extend the result like: | ||
| 350 | * | ||
| 351 | * pmc <<= 64 - width; | ||
| 352 | * pmc >>= 64 - width; // signed shift right | ||
| 353 | * count += pmc; | ||
| 354 | */ | ||
| 355 | __u16 pmc_width; | ||
| 356 | |||
| 357 | /* | ||
| 358 | * If cap_usr_time the below fields can be used to compute the time | ||
| 359 | * delta since time_enabled (in ns) using rdtsc or similar. | ||
| 360 | * | ||
| 361 | * u64 quot, rem; | ||
| 362 | * u64 delta; | ||
| 363 | * | ||
| 364 | * quot = (cyc >> time_shift); | ||
| 365 | * rem = cyc & ((1 << time_shift) - 1); | ||
| 366 | * delta = time_offset + quot * time_mult + | ||
| 367 | * ((rem * time_mult) >> time_shift); | ||
| 368 | * | ||
| 369 | * Where time_offset,time_mult,time_shift and cyc are read in the | ||
| 370 | * seqcount loop described above. This delta can then be added to | ||
| 371 | * enabled and possible running (if idx), improving the scaling: | ||
| 372 | * | ||
| 373 | * enabled += delta; | ||
| 374 | * if (idx) | ||
| 375 | * running += delta; | ||
| 376 | * | ||
| 377 | * quot = count / running; | ||
| 378 | * rem = count % running; | ||
| 379 | * count = quot * enabled + (rem * enabled) / running; | ||
| 380 | */ | ||
| 381 | __u16 time_shift; | ||
| 382 | __u32 time_mult; | ||
| 327 | __u64 time_offset; | 383 | __u64 time_offset; |
| 328 | 384 | ||
| 329 | /* | 385 | /* |
| 330 | * Hole for extension of the self monitor capabilities | 386 | * Hole for extension of the self monitor capabilities |
| 331 | */ | 387 | */ |
| 332 | 388 | ||
| 333 | __u64 __reserved[121]; /* align to 1k */ | 389 | __u64 __reserved[120]; /* align to 1k */ |
| 334 | 390 | ||
| 335 | /* | 391 | /* |
| 336 | * Control data for the mmap() data buffer. | 392 | * Control data for the mmap() data buffer. |
diff --git a/include/linux/phy.h b/include/linux/phy.h index c599f7eca1e7..6fe0a37d4abf 100644 --- a/include/linux/phy.h +++ b/include/linux/phy.h | |||
| @@ -19,7 +19,6 @@ | |||
| 19 | #define __PHY_H | 19 | #define __PHY_H |
| 20 | 20 | ||
| 21 | #include <linux/spinlock.h> | 21 | #include <linux/spinlock.h> |
| 22 | #include <linux/device.h> | ||
| 23 | #include <linux/ethtool.h> | 22 | #include <linux/ethtool.h> |
| 24 | #include <linux/mii.h> | 23 | #include <linux/mii.h> |
| 25 | #include <linux/timer.h> | 24 | #include <linux/timer.h> |
| @@ -88,6 +87,9 @@ typedef enum { | |||
| 88 | IEEE 802.3ae clause 45 addressing mode used by 10GIGE phy chips. */ | 87 | IEEE 802.3ae clause 45 addressing mode used by 10GIGE phy chips. */ |
| 89 | #define MII_ADDR_C45 (1<<30) | 88 | #define MII_ADDR_C45 (1<<30) |
| 90 | 89 | ||
| 90 | struct device; | ||
| 91 | struct sk_buff; | ||
| 92 | |||
| 91 | /* | 93 | /* |
| 92 | * The Bus class for PHYs. Devices which provide access to | 94 | * The Bus class for PHYs. Devices which provide access to |
| 93 | * PHYs should register using this structure | 95 | * PHYs should register using this structure |
| @@ -241,7 +243,6 @@ enum phy_state { | |||
| 241 | PHY_RESUMING | 243 | PHY_RESUMING |
| 242 | }; | 244 | }; |
| 243 | 245 | ||
| 244 | struct sk_buff; | ||
| 245 | 246 | ||
| 246 | /* phy_device: An instance of a PHY | 247 | /* phy_device: An instance of a PHY |
| 247 | * | 248 | * |
diff --git a/include/linux/pid_namespace.h b/include/linux/pid_namespace.h index e7cf6669ac34..f5bd679be46b 100644 --- a/include/linux/pid_namespace.h +++ b/include/linux/pid_namespace.h | |||
| @@ -2,6 +2,7 @@ | |||
| 2 | #define _LINUX_PID_NS_H | 2 | #define _LINUX_PID_NS_H |
| 3 | 3 | ||
| 4 | #include <linux/sched.h> | 4 | #include <linux/sched.h> |
| 5 | #include <linux/bug.h> | ||
| 5 | #include <linux/mm.h> | 6 | #include <linux/mm.h> |
| 6 | #include <linux/threads.h> | 7 | #include <linux/threads.h> |
| 7 | #include <linux/nsproxy.h> | 8 | #include <linux/nsproxy.h> |
diff --git a/include/linux/pinctrl/consumer.h b/include/linux/pinctrl/consumer.h new file mode 100644 index 000000000000..191e72688481 --- /dev/null +++ b/include/linux/pinctrl/consumer.h | |||
| @@ -0,0 +1,159 @@ | |||
| 1 | /* | ||
| 2 | * Consumer interface the pin control subsystem | ||
| 3 | * | ||
| 4 | * Copyright (C) 2012 ST-Ericsson SA | ||
| 5 | * Written on behalf of Linaro for ST-Ericsson | ||
| 6 | * Based on bits of regulator core, gpio core and clk core | ||
| 7 | * | ||
| 8 | * Author: Linus Walleij <linus.walleij@linaro.org> | ||
| 9 | * | ||
| 10 | * License terms: GNU General Public License (GPL) version 2 | ||
| 11 | */ | ||
| 12 | #ifndef __LINUX_PINCTRL_CONSUMER_H | ||
| 13 | #define __LINUX_PINCTRL_CONSUMER_H | ||
| 14 | |||
| 15 | #include <linux/err.h> | ||
| 16 | #include <linux/list.h> | ||
| 17 | #include <linux/seq_file.h> | ||
| 18 | #include "pinctrl-state.h" | ||
| 19 | |||
| 20 | /* This struct is private to the core and should be regarded as a cookie */ | ||
| 21 | struct pinctrl; | ||
| 22 | struct pinctrl_state; | ||
| 23 | |||
| 24 | #ifdef CONFIG_PINCTRL | ||
| 25 | |||
| 26 | /* External interface to pin control */ | ||
| 27 | extern int pinctrl_request_gpio(unsigned gpio); | ||
| 28 | extern void pinctrl_free_gpio(unsigned gpio); | ||
| 29 | extern int pinctrl_gpio_direction_input(unsigned gpio); | ||
| 30 | extern int pinctrl_gpio_direction_output(unsigned gpio); | ||
| 31 | |||
| 32 | extern struct pinctrl * __must_check pinctrl_get(struct device *dev); | ||
| 33 | extern void pinctrl_put(struct pinctrl *p); | ||
| 34 | extern struct pinctrl_state * __must_check pinctrl_lookup_state( | ||
| 35 | struct pinctrl *p, | ||
| 36 | const char *name); | ||
| 37 | extern int pinctrl_select_state(struct pinctrl *p, struct pinctrl_state *s); | ||
| 38 | |||
| 39 | #else /* !CONFIG_PINCTRL */ | ||
| 40 | |||
| 41 | static inline int pinctrl_request_gpio(unsigned gpio) | ||
| 42 | { | ||
| 43 | return 0; | ||
| 44 | } | ||
| 45 | |||
| 46 | static inline void pinctrl_free_gpio(unsigned gpio) | ||
| 47 | { | ||
| 48 | } | ||
| 49 | |||
| 50 | static inline int pinctrl_gpio_direction_input(unsigned gpio) | ||
| 51 | { | ||
| 52 | return 0; | ||
| 53 | } | ||
| 54 | |||
| 55 | static inline int pinctrl_gpio_direction_output(unsigned gpio) | ||
| 56 | { | ||
| 57 | return 0; | ||
| 58 | } | ||
| 59 | |||
| 60 | static inline struct pinctrl * __must_check pinctrl_get(struct device *dev) | ||
| 61 | { | ||
| 62 | return NULL; | ||
| 63 | } | ||
| 64 | |||
| 65 | static inline void pinctrl_put(struct pinctrl *p) | ||
| 66 | { | ||
| 67 | } | ||
| 68 | |||
| 69 | static inline struct pinctrl_state * __must_check pinctrl_lookup_state( | ||
| 70 | struct pinctrl *p, | ||
| 71 | const char *name) | ||
| 72 | { | ||
| 73 | return NULL; | ||
| 74 | } | ||
| 75 | |||
| 76 | static inline int pinctrl_select_state(struct pinctrl *p, | ||
| 77 | struct pinctrl_state *s) | ||
| 78 | { | ||
| 79 | return 0; | ||
| 80 | } | ||
| 81 | |||
| 82 | #endif /* CONFIG_PINCTRL */ | ||
| 83 | |||
| 84 | static inline struct pinctrl * __must_check pinctrl_get_select( | ||
| 85 | struct device *dev, const char *name) | ||
| 86 | { | ||
| 87 | struct pinctrl *p; | ||
| 88 | struct pinctrl_state *s; | ||
| 89 | int ret; | ||
| 90 | |||
| 91 | p = pinctrl_get(dev); | ||
| 92 | if (IS_ERR(p)) | ||
| 93 | return p; | ||
| 94 | |||
| 95 | s = pinctrl_lookup_state(p, name); | ||
| 96 | if (IS_ERR(s)) { | ||
| 97 | pinctrl_put(p); | ||
| 98 | return ERR_PTR(PTR_ERR(s)); | ||
| 99 | } | ||
| 100 | |||
| 101 | ret = pinctrl_select_state(p, s); | ||
| 102 | if (ret < 0) { | ||
| 103 | pinctrl_put(p); | ||
| 104 | return ERR_PTR(ret); | ||
| 105 | } | ||
| 106 | |||
| 107 | return p; | ||
| 108 | } | ||
| 109 | |||
| 110 | static inline struct pinctrl * __must_check pinctrl_get_select_default( | ||
| 111 | struct device *dev) | ||
| 112 | { | ||
| 113 | return pinctrl_get_select(dev, PINCTRL_STATE_DEFAULT); | ||
| 114 | } | ||
| 115 | |||
| 116 | #ifdef CONFIG_PINCONF | ||
| 117 | |||
| 118 | extern int pin_config_get(const char *dev_name, const char *name, | ||
| 119 | unsigned long *config); | ||
| 120 | extern int pin_config_set(const char *dev_name, const char *name, | ||
| 121 | unsigned long config); | ||
| 122 | extern int pin_config_group_get(const char *dev_name, | ||
| 123 | const char *pin_group, | ||
| 124 | unsigned long *config); | ||
| 125 | extern int pin_config_group_set(const char *dev_name, | ||
| 126 | const char *pin_group, | ||
| 127 | unsigned long config); | ||
| 128 | |||
| 129 | #else | ||
| 130 | |||
| 131 | static inline int pin_config_get(const char *dev_name, const char *name, | ||
| 132 | unsigned long *config) | ||
| 133 | { | ||
| 134 | return 0; | ||
| 135 | } | ||
| 136 | |||
| 137 | static inline int pin_config_set(const char *dev_name, const char *name, | ||
| 138 | unsigned long config) | ||
| 139 | { | ||
| 140 | return 0; | ||
| 141 | } | ||
| 142 | |||
| 143 | static inline int pin_config_group_get(const char *dev_name, | ||
| 144 | const char *pin_group, | ||
| 145 | unsigned long *config) | ||
| 146 | { | ||
| 147 | return 0; | ||
| 148 | } | ||
| 149 | |||
| 150 | static inline int pin_config_group_set(const char *dev_name, | ||
| 151 | const char *pin_group, | ||
| 152 | unsigned long config) | ||
| 153 | { | ||
| 154 | return 0; | ||
| 155 | } | ||
| 156 | |||
| 157 | #endif | ||
| 158 | |||
| 159 | #endif /* __LINUX_PINCTRL_CONSUMER_H */ | ||
diff --git a/include/linux/pinctrl/machine.h b/include/linux/pinctrl/machine.h index d0aecb7f6fb9..fee4349364f7 100644 --- a/include/linux/pinctrl/machine.h +++ b/include/linux/pinctrl/machine.h | |||
| @@ -9,87 +9,153 @@ | |||
| 9 | * | 9 | * |
| 10 | * License terms: GNU General Public License (GPL) version 2 | 10 | * License terms: GNU General Public License (GPL) version 2 |
| 11 | */ | 11 | */ |
| 12 | #ifndef __LINUX_PINMUX_MACHINE_H | 12 | #ifndef __LINUX_PINCTRL_MACHINE_H |
| 13 | #define __LINUX_PINMUX_MACHINE_H | 13 | #define __LINUX_PINCTRL_MACHINE_H |
| 14 | |||
| 15 | #include "pinctrl-state.h" | ||
| 16 | |||
| 17 | enum pinctrl_map_type { | ||
| 18 | PIN_MAP_TYPE_INVALID, | ||
| 19 | PIN_MAP_TYPE_DUMMY_STATE, | ||
| 20 | PIN_MAP_TYPE_MUX_GROUP, | ||
| 21 | PIN_MAP_TYPE_CONFIGS_PIN, | ||
| 22 | PIN_MAP_TYPE_CONFIGS_GROUP, | ||
| 23 | }; | ||
| 24 | |||
| 25 | /** | ||
| 26 | * struct pinctrl_map_mux - mapping table content for MAP_TYPE_MUX_GROUP | ||
| 27 | * @group: the name of the group whose mux function is to be configured. This | ||
| 28 | * field may be left NULL, and the first applicable group for the function | ||
| 29 | * will be used. | ||
| 30 | * @function: the mux function to select for the group | ||
| 31 | */ | ||
| 32 | struct pinctrl_map_mux { | ||
| 33 | const char *group; | ||
| 34 | const char *function; | ||
| 35 | }; | ||
| 14 | 36 | ||
| 15 | /** | 37 | /** |
| 16 | * struct pinmux_map - boards/machines shall provide this map for devices | 38 | * struct pinctrl_map_configs - mapping table content for MAP_TYPE_CONFIGS_* |
| 39 | * @group_or_pin: the name of the pin or group whose configuration parameters | ||
| 40 | * are to be configured. | ||
| 41 | * @configs: a pointer to an array of config parameters/values to program into | ||
| 42 | * hardware. Each individual pin controller defines the format and meaning | ||
| 43 | * of config parameters. | ||
| 44 | * @num_configs: the number of entries in array @configs | ||
| 45 | */ | ||
| 46 | struct pinctrl_map_configs { | ||
| 47 | const char *group_or_pin; | ||
| 48 | unsigned long *configs; | ||
| 49 | unsigned num_configs; | ||
| 50 | }; | ||
| 51 | |||
| 52 | /** | ||
| 53 | * struct pinctrl_map - boards/machines shall provide this map for devices | ||
| 54 | * @dev_name: the name of the device using this specific mapping, the name | ||
| 55 | * must be the same as in your struct device*. If this name is set to the | ||
| 56 | * same name as the pin controllers own dev_name(), the map entry will be | ||
| 57 | * hogged by the driver itself upon registration | ||
| 17 | * @name: the name of this specific map entry for the particular machine. | 58 | * @name: the name of this specific map entry for the particular machine. |
| 18 | * This is the second parameter passed to pinmux_get() when you want | 59 | * This is the parameter passed to pinmux_lookup_state() |
| 19 | * to have several mappings to the same device | 60 | * @type: the type of mapping table entry |
| 20 | * @ctrl_dev: the pin control device to be used by this mapping, may be NULL | ||
| 21 | * if you provide .ctrl_dev_name instead (this is more common) | ||
| 22 | * @ctrl_dev_name: the name of the device controlling this specific mapping, | 61 | * @ctrl_dev_name: the name of the device controlling this specific mapping, |
| 23 | * the name must be the same as in your struct device*, may be NULL if | 62 | * the name must be the same as in your struct device*. This field is not |
| 24 | * you provide .ctrl_dev instead | 63 | * used for PIN_MAP_TYPE_DUMMY_STATE |
| 25 | * @function: a function in the driver to use for this mapping, the driver | 64 | * @data: Data specific to the mapping type |
| 26 | * will lookup the function referenced by this ID on the specified | ||
| 27 | * pin control device | ||
| 28 | * @group: sometimes a function can map to different pin groups, so this | ||
| 29 | * selects a certain specific pin group to activate for the function, if | ||
| 30 | * left as NULL, the first applicable group will be used | ||
| 31 | * @dev: the device using this specific mapping, may be NULL if you provide | ||
| 32 | * .dev_name instead (this is more common) | ||
| 33 | * @dev_name: the name of the device using this specific mapping, the name | ||
| 34 | * must be the same as in your struct device*, may be NULL if you | ||
| 35 | * provide .dev instead | ||
| 36 | * @hog_on_boot: if this is set to true, the pin control subsystem will itself | ||
| 37 | * hog the mappings as the pinmux device drivers are attached, so this is | ||
| 38 | * typically used with system maps (mux mappings without an assigned | ||
| 39 | * device) that you want to get hogged and enabled by default as soon as | ||
| 40 | * a pinmux device supporting it is registered. These maps will not be | ||
| 41 | * disabled and put until the system shuts down. | ||
| 42 | */ | 65 | */ |
| 43 | struct pinmux_map { | 66 | struct pinctrl_map { |
| 67 | const char *dev_name; | ||
| 44 | const char *name; | 68 | const char *name; |
| 45 | struct device *ctrl_dev; | 69 | enum pinctrl_map_type type; |
| 46 | const char *ctrl_dev_name; | 70 | const char *ctrl_dev_name; |
| 47 | const char *function; | 71 | union { |
| 48 | const char *group; | 72 | struct pinctrl_map_mux mux; |
| 49 | struct device *dev; | 73 | struct pinctrl_map_configs configs; |
| 50 | const char *dev_name; | 74 | } data; |
| 51 | bool hog_on_boot; | ||
| 52 | }; | 75 | }; |
| 53 | 76 | ||
| 54 | /* | 77 | /* Convenience macros to create mapping table entries */ |
| 55 | * Convenience macro to set a simple map from a certain pin controller and a | ||
| 56 | * certain function to a named device | ||
| 57 | */ | ||
| 58 | #define PINMUX_MAP(a, b, c, d) \ | ||
| 59 | { .name = a, .ctrl_dev_name = b, .function = c, .dev_name = d } | ||
| 60 | 78 | ||
| 61 | /* | 79 | #define PIN_MAP_DUMMY_STATE(dev, state) \ |
| 62 | * Convenience macro to map a system function onto a certain pinctrl device. | 80 | { \ |
| 63 | * System functions are not assigned to a particular device. | 81 | .dev_name = dev, \ |
| 64 | */ | 82 | .name = state, \ |
| 65 | #define PINMUX_MAP_SYS(a, b, c) \ | 83 | .type = PIN_MAP_TYPE_DUMMY_STATE, \ |
| 66 | { .name = a, .ctrl_dev_name = b, .function = c } | 84 | } |
| 67 | 85 | ||
| 68 | /* | 86 | #define PIN_MAP_MUX_GROUP(dev, state, pinctrl, grp, func) \ |
| 69 | * Convenience macro to map a system function onto a certain pinctrl device, | 87 | { \ |
| 70 | * to be hogged by the pinmux core until the system shuts down. | 88 | .dev_name = dev, \ |
| 71 | */ | 89 | .name = state, \ |
| 72 | #define PINMUX_MAP_SYS_HOG(a, b, c) \ | 90 | .type = PIN_MAP_TYPE_MUX_GROUP, \ |
| 73 | { .name = a, .ctrl_dev_name = b, .function = c, \ | 91 | .ctrl_dev_name = pinctrl, \ |
| 74 | .hog_on_boot = true } | 92 | .data.mux = { \ |
| 93 | .group = grp, \ | ||
| 94 | .function = func, \ | ||
| 95 | }, \ | ||
| 96 | } | ||
| 75 | 97 | ||
| 76 | /* | 98 | #define PIN_MAP_MUX_GROUP_DEFAULT(dev, pinctrl, grp, func) \ |
| 77 | * Convenience macro to map a system function onto a certain pinctrl device | 99 | PIN_MAP_MUX_GROUP(dev, PINCTRL_STATE_DEFAULT, pinctrl, grp, func) |
| 78 | * using a specified group, to be hogged by the pinmux core until the system | 100 | |
| 79 | * shuts down. | 101 | #define PIN_MAP_MUX_GROUP_HOG(dev, state, grp, func) \ |
| 80 | */ | 102 | PIN_MAP_MUX_GROUP(dev, state, dev, grp, func) |
| 81 | #define PINMUX_MAP_SYS_HOG_GROUP(a, b, c, d) \ | 103 | |
| 82 | { .name = a, .ctrl_dev_name = b, .function = c, .group = d, \ | 104 | #define PIN_MAP_MUX_GROUP_HOG_DEFAULT(dev, grp, func) \ |
| 83 | .hog_on_boot = true } | 105 | PIN_MAP_MUX_GROUP(dev, PINCTRL_STATE_DEFAULT, dev, grp, func) |
| 106 | |||
| 107 | #define PIN_MAP_CONFIGS_PIN(dev, state, pinctrl, pin, cfgs) \ | ||
| 108 | { \ | ||
| 109 | .dev_name = dev, \ | ||
| 110 | .name = state, \ | ||
| 111 | .type = PIN_MAP_TYPE_CONFIGS_PIN, \ | ||
| 112 | .ctrl_dev_name = pinctrl, \ | ||
| 113 | .data.configs = { \ | ||
| 114 | .group_or_pin = pin, \ | ||
| 115 | .configs = cfgs, \ | ||
| 116 | .num_configs = ARRAY_SIZE(cfgs), \ | ||
| 117 | }, \ | ||
| 118 | } | ||
| 119 | |||
| 120 | #define PIN_MAP_CONFIGS_PIN_DEFAULT(dev, pinctrl, pin, cfgs) \ | ||
| 121 | PIN_MAP_CONFIGS_PIN(dev, PINCTRL_STATE_DEFAULT, pinctrl, pin, cfgs) | ||
| 122 | |||
| 123 | #define PIN_MAP_CONFIGS_PIN_HOG(dev, state, pin, cfgs) \ | ||
| 124 | PIN_MAP_CONFIGS_PIN(dev, state, dev, pin, cfgs) | ||
| 125 | |||
| 126 | #define PIN_MAP_CONFIGS_PIN_HOG_DEFAULT(dev, pin, cfgs) \ | ||
| 127 | PIN_MAP_CONFIGS_PIN(dev, PINCTRL_STATE_DEFAULT, dev, pin, cfgs) | ||
| 128 | |||
| 129 | #define PIN_MAP_CONFIGS_GROUP(dev, state, pinctrl, grp, cfgs) \ | ||
| 130 | { \ | ||
| 131 | .dev_name = dev, \ | ||
| 132 | .name = state, \ | ||
| 133 | .type = PIN_MAP_TYPE_CONFIGS_GROUP, \ | ||
| 134 | .ctrl_dev_name = pinctrl, \ | ||
| 135 | .data.configs = { \ | ||
| 136 | .group_or_pin = grp, \ | ||
| 137 | .configs = cfgs, \ | ||
| 138 | .num_configs = ARRAY_SIZE(cfgs), \ | ||
| 139 | }, \ | ||
| 140 | } | ||
| 141 | |||
| 142 | #define PIN_MAP_CONFIGS_GROUP_DEFAULT(dev, pinctrl, grp, cfgs) \ | ||
| 143 | PIN_MAP_CONFIGS_GROUP(dev, PINCTRL_STATE_DEFAULT, pinctrl, grp, cfgs) | ||
| 144 | |||
| 145 | #define PIN_MAP_CONFIGS_GROUP_HOG(dev, state, grp, cfgs) \ | ||
| 146 | PIN_MAP_CONFIGS_GROUP(dev, state, dev, grp, cfgs) | ||
| 147 | |||
| 148 | #define PIN_MAP_CONFIGS_GROUP_HOG_DEFAULT(dev, grp, cfgs) \ | ||
| 149 | PIN_MAP_CONFIGS_GROUP(dev, PINCTRL_STATE_DEFAULT, dev, grp, cfgs) | ||
| 84 | 150 | ||
| 85 | #ifdef CONFIG_PINMUX | 151 | #ifdef CONFIG_PINMUX |
| 86 | 152 | ||
| 87 | extern int pinmux_register_mappings(struct pinmux_map const *map, | 153 | extern int pinctrl_register_mappings(struct pinctrl_map const *map, |
| 88 | unsigned num_maps); | 154 | unsigned num_maps); |
| 89 | 155 | ||
| 90 | #else | 156 | #else |
| 91 | 157 | ||
| 92 | static inline int pinmux_register_mappings(struct pinmux_map const *map, | 158 | static inline int pinctrl_register_mappings(struct pinctrl_map const *map, |
| 93 | unsigned num_maps) | 159 | unsigned num_maps) |
| 94 | { | 160 | { |
| 95 | return 0; | 161 | return 0; |
diff --git a/include/linux/pinctrl/pinconf-generic.h b/include/linux/pinctrl/pinconf-generic.h new file mode 100644 index 000000000000..4f0abb9f1c09 --- /dev/null +++ b/include/linux/pinctrl/pinconf-generic.h | |||
| @@ -0,0 +1,114 @@ | |||
| 1 | /* | ||
| 2 | * Interface the generic pinconfig portions of the pinctrl subsystem | ||
| 3 | * | ||
| 4 | * Copyright (C) 2011 ST-Ericsson SA | ||
| 5 | * Written on behalf of Linaro for ST-Ericsson | ||
| 6 | * This interface is used in the core to keep track of pins. | ||
| 7 | * | ||
| 8 | * Author: Linus Walleij <linus.walleij@linaro.org> | ||
| 9 | * | ||
| 10 | * License terms: GNU General Public License (GPL) version 2 | ||
| 11 | */ | ||
| 12 | #ifndef __LINUX_PINCTRL_PINCONF_GENERIC_H | ||
| 13 | #define __LINUX_PINCTRL_PINCONF_GENERIC_H | ||
| 14 | |||
| 15 | /* | ||
| 16 | * You shouldn't even be able to compile with these enums etc unless you're | ||
| 17 | * using generic pin config. That is why this is defined out. | ||
| 18 | */ | ||
| 19 | #ifdef CONFIG_GENERIC_PINCONF | ||
| 20 | |||
| 21 | /** | ||
| 22 | * enum pin_config_param - possible pin configuration parameters | ||
| 23 | * @PIN_CONFIG_BIAS_DISABLE: disable any pin bias on the pin, a | ||
| 24 | * transition from say pull-up to pull-down implies that you disable | ||
| 25 | * pull-up in the process, this setting disables all biasing. | ||
| 26 | * @PIN_CONFIG_BIAS_HIGH_IMPEDANCE: the pin will be set to a high impedance | ||
| 27 | * mode, also know as "third-state" (tristate) or "high-Z" or "floating". | ||
| 28 | * On output pins this effectively disconnects the pin, which is useful | ||
| 29 | * if for example some other pin is going to drive the signal connected | ||
| 30 | * to it for a while. Pins used for input are usually always high | ||
| 31 | * impedance. | ||
| 32 | * @PIN_CONFIG_BIAS_PULL_UP: the pin will be pulled up (usually with high | ||
| 33 | * impedance to VDD). If the argument is != 0 pull-up is enabled, | ||
| 34 | * if it is 0, pull-up is disabled. | ||
| 35 | * @PIN_CONFIG_BIAS_PULL_DOWN: the pin will be pulled down (usually with high | ||
| 36 | * impedance to GROUND). If the argument is != 0 pull-down is enabled, | ||
| 37 | * if it is 0, pull-down is disabled. | ||
| 38 | * @PIN_CONFIG_DRIVE_PUSH_PULL: the pin will be driven actively high and | ||
| 39 | * low, this is the most typical case and is typically achieved with two | ||
| 40 | * active transistors on the output. Sending this config will enabale | ||
| 41 | * push-pull mode, the argument is ignored. | ||
| 42 | * @PIN_CONFIG_DRIVE_OPEN_DRAIN: the pin will be driven with open drain (open | ||
| 43 | * collector) which means it is usually wired with other output ports | ||
| 44 | * which are then pulled up with an external resistor. Sending this | ||
| 45 | * config will enabale open drain mode, the argument is ignored. | ||
| 46 | * @PIN_CONFIG_DRIVE_OPEN_SOURCE: the pin will be driven with open source | ||
| 47 | * (open emitter). Sending this config will enabale open drain mode, the | ||
| 48 | * argument is ignored. | ||
| 49 | * @PIN_CONFIG_INPUT_SCHMITT: this will configure an input pin to run in | ||
| 50 | * schmitt-trigger mode. If the schmitt-trigger has adjustable hysteresis, | ||
| 51 | * the threshold value is given on a custom format as argument when | ||
| 52 | * setting pins to this mode. The argument zero turns the schmitt trigger | ||
| 53 | * off. | ||
| 54 | * @PIN_CONFIG_INPUT_DEBOUNCE: this will configure the pin to debounce mode, | ||
| 55 | * which means it will wait for signals to settle when reading inputs. The | ||
| 56 | * argument gives the debounce time on a custom format. Setting the | ||
| 57 | * argument to zero turns debouncing off. | ||
| 58 | * @PIN_CONFIG_POWER_SOURCE: if the pin can select between different power | ||
| 59 | * supplies, the argument to this parameter (on a custom format) tells | ||
| 60 | * the driver which alternative power source to use. | ||
| 61 | * @PIN_CONFIG_LOW_POWER_MODE: this will configure the pin for low power | ||
| 62 | * operation, if several modes of operation are supported these can be | ||
| 63 | * passed in the argument on a custom form, else just use argument 1 | ||
| 64 | * to indicate low power mode, argument 0 turns low power mode off. | ||
| 65 | * @PIN_CONFIG_END: this is the last enumerator for pin configurations, if | ||
| 66 | * you need to pass in custom configurations to the pin controller, use | ||
| 67 | * PIN_CONFIG_END+1 as the base offset. | ||
| 68 | */ | ||
| 69 | enum pin_config_param { | ||
| 70 | PIN_CONFIG_BIAS_DISABLE, | ||
| 71 | PIN_CONFIG_BIAS_HIGH_IMPEDANCE, | ||
| 72 | PIN_CONFIG_BIAS_PULL_UP, | ||
| 73 | PIN_CONFIG_BIAS_PULL_DOWN, | ||
| 74 | PIN_CONFIG_DRIVE_PUSH_PULL, | ||
| 75 | PIN_CONFIG_DRIVE_OPEN_DRAIN, | ||
| 76 | PIN_CONFIG_DRIVE_OPEN_SOURCE, | ||
| 77 | PIN_CONFIG_INPUT_SCHMITT, | ||
| 78 | PIN_CONFIG_INPUT_DEBOUNCE, | ||
| 79 | PIN_CONFIG_POWER_SOURCE, | ||
| 80 | PIN_CONFIG_LOW_POWER_MODE, | ||
| 81 | PIN_CONFIG_END = 0x7FFF, | ||
| 82 | }; | ||
| 83 | |||
| 84 | /* | ||
| 85 | * Helpful configuration macro to be used in tables etc. | ||
| 86 | */ | ||
| 87 | #define PIN_CONF_PACKED(p, a) ((a << 16) | ((unsigned long) p & 0xffffUL)) | ||
| 88 | |||
| 89 | /* | ||
| 90 | * The following inlines stuffs a configuration parameter and data value | ||
| 91 | * into and out of an unsigned long argument, as used by the generic pin config | ||
| 92 | * system. We put the parameter in the lower 16 bits and the argument in the | ||
| 93 | * upper 16 bits. | ||
| 94 | */ | ||
| 95 | |||
| 96 | static inline enum pin_config_param pinconf_to_config_param(unsigned long config) | ||
| 97 | { | ||
| 98 | return (enum pin_config_param) (config & 0xffffUL); | ||
| 99 | } | ||
| 100 | |||
| 101 | static inline u16 pinconf_to_config_argument(unsigned long config) | ||
| 102 | { | ||
| 103 | return (enum pin_config_param) ((config >> 16) & 0xffffUL); | ||
| 104 | } | ||
| 105 | |||
| 106 | static inline unsigned long pinconf_to_config_packed(enum pin_config_param param, | ||
| 107 | u16 argument) | ||
| 108 | { | ||
| 109 | return PIN_CONF_PACKED(param, argument); | ||
| 110 | } | ||
| 111 | |||
| 112 | #endif /* CONFIG_GENERIC_PINCONF */ | ||
| 113 | |||
| 114 | #endif /* __LINUX_PINCTRL_PINCONF_GENERIC_H */ | ||
diff --git a/include/linux/pinctrl/pinconf.h b/include/linux/pinctrl/pinconf.h index 477922cf043a..ec431f03362d 100644 --- a/include/linux/pinctrl/pinconf.h +++ b/include/linux/pinctrl/pinconf.h | |||
| @@ -20,6 +20,8 @@ struct seq_file; | |||
| 20 | /** | 20 | /** |
| 21 | * struct pinconf_ops - pin config operations, to be implemented by | 21 | * struct pinconf_ops - pin config operations, to be implemented by |
| 22 | * pin configuration capable drivers. | 22 | * pin configuration capable drivers. |
| 23 | * @is_generic: for pin controllers that want to use the generic interface, | ||
| 24 | * this flag tells the framework that it's generic. | ||
| 23 | * @pin_config_get: get the config of a certain pin, if the requested config | 25 | * @pin_config_get: get the config of a certain pin, if the requested config |
| 24 | * is not available on this controller this should return -ENOTSUPP | 26 | * is not available on this controller this should return -ENOTSUPP |
| 25 | * and if it is available but disabled it should return -EINVAL | 27 | * and if it is available but disabled it should return -EINVAL |
| @@ -33,6 +35,9 @@ struct seq_file; | |||
| 33 | * per-device info for a certain group in debugfs | 35 | * per-device info for a certain group in debugfs |
| 34 | */ | 36 | */ |
| 35 | struct pinconf_ops { | 37 | struct pinconf_ops { |
| 38 | #ifdef CONFIG_GENERIC_PINCONF | ||
| 39 | bool is_generic; | ||
| 40 | #endif | ||
| 36 | int (*pin_config_get) (struct pinctrl_dev *pctldev, | 41 | int (*pin_config_get) (struct pinctrl_dev *pctldev, |
| 37 | unsigned pin, | 42 | unsigned pin, |
| 38 | unsigned long *config); | 43 | unsigned long *config); |
| @@ -53,45 +58,6 @@ struct pinconf_ops { | |||
| 53 | unsigned selector); | 58 | unsigned selector); |
| 54 | }; | 59 | }; |
| 55 | 60 | ||
| 56 | extern int pin_config_get(const char *dev_name, const char *name, | ||
| 57 | unsigned long *config); | ||
| 58 | extern int pin_config_set(const char *dev_name, const char *name, | ||
| 59 | unsigned long config); | ||
| 60 | extern int pin_config_group_get(const char *dev_name, | ||
| 61 | const char *pin_group, | ||
| 62 | unsigned long *config); | ||
| 63 | extern int pin_config_group_set(const char *dev_name, | ||
| 64 | const char *pin_group, | ||
| 65 | unsigned long config); | ||
| 66 | |||
| 67 | #else | ||
| 68 | |||
| 69 | static inline int pin_config_get(const char *dev_name, const char *name, | ||
| 70 | unsigned long *config) | ||
| 71 | { | ||
| 72 | return 0; | ||
| 73 | } | ||
| 74 | |||
| 75 | static inline int pin_config_set(const char *dev_name, const char *name, | ||
| 76 | unsigned long config) | ||
| 77 | { | ||
| 78 | return 0; | ||
| 79 | } | ||
| 80 | |||
| 81 | static inline int pin_config_group_get(const char *dev_name, | ||
| 82 | const char *pin_group, | ||
| 83 | unsigned long *config) | ||
| 84 | { | ||
| 85 | return 0; | ||
| 86 | } | ||
| 87 | |||
| 88 | static inline int pin_config_group_set(const char *dev_name, | ||
| 89 | const char *pin_group, | ||
| 90 | unsigned long config) | ||
| 91 | { | ||
| 92 | return 0; | ||
| 93 | } | ||
| 94 | |||
| 95 | #endif | 61 | #endif |
| 96 | 62 | ||
| 97 | #endif /* __LINUX_PINCTRL_PINCONF_H */ | 63 | #endif /* __LINUX_PINCTRL_PINCONF_H */ |
diff --git a/include/linux/pinctrl/pinctrl-state.h b/include/linux/pinctrl/pinctrl-state.h new file mode 100644 index 000000000000..3920e28b4da7 --- /dev/null +++ b/include/linux/pinctrl/pinctrl-state.h | |||
| @@ -0,0 +1,6 @@ | |||
| 1 | /* | ||
| 2 | * Standard pin control state definitions | ||
| 3 | */ | ||
| 4 | |||
| 5 | #define PINCTRL_STATE_DEFAULT "default" | ||
| 6 | #define PINCTRL_STATE_IDLE "idle" | ||
diff --git a/include/linux/pinctrl/pinctrl.h b/include/linux/pinctrl/pinctrl.h index 8bd22ee7aa09..4e9f0788c221 100644 --- a/include/linux/pinctrl/pinctrl.h +++ b/include/linux/pinctrl/pinctrl.h | |||
| @@ -15,10 +15,11 @@ | |||
| 15 | #ifdef CONFIG_PINCTRL | 15 | #ifdef CONFIG_PINCTRL |
| 16 | 16 | ||
| 17 | #include <linux/radix-tree.h> | 17 | #include <linux/radix-tree.h> |
| 18 | #include <linux/spinlock.h> | ||
| 19 | #include <linux/list.h> | 18 | #include <linux/list.h> |
| 20 | #include <linux/seq_file.h> | 19 | #include <linux/seq_file.h> |
| 20 | #include "pinctrl-state.h" | ||
| 21 | 21 | ||
| 22 | struct device; | ||
| 22 | struct pinctrl_dev; | 23 | struct pinctrl_dev; |
| 23 | struct pinmux_ops; | 24 | struct pinmux_ops; |
| 24 | struct pinconf_ops; | 25 | struct pinconf_ops; |
diff --git a/include/linux/pinctrl/pinmux.h b/include/linux/pinctrl/pinmux.h index 937b3e2fa36f..47e9237edd47 100644 --- a/include/linux/pinctrl/pinmux.h +++ b/include/linux/pinctrl/pinmux.h | |||
| @@ -16,9 +16,6 @@ | |||
| 16 | #include <linux/seq_file.h> | 16 | #include <linux/seq_file.h> |
| 17 | #include "pinctrl.h" | 17 | #include "pinctrl.h" |
| 18 | 18 | ||
| 19 | /* This struct is private to the core and should be regarded as a cookie */ | ||
| 20 | struct pinmux; | ||
| 21 | |||
| 22 | #ifdef CONFIG_PINMUX | 19 | #ifdef CONFIG_PINMUX |
| 23 | 20 | ||
| 24 | struct pinctrl_dev; | 21 | struct pinctrl_dev; |
| @@ -88,55 +85,6 @@ struct pinmux_ops { | |||
| 88 | bool input); | 85 | bool input); |
| 89 | }; | 86 | }; |
| 90 | 87 | ||
| 91 | /* External interface to pinmux */ | ||
| 92 | extern int pinmux_request_gpio(unsigned gpio); | ||
| 93 | extern void pinmux_free_gpio(unsigned gpio); | ||
| 94 | extern int pinmux_gpio_direction_input(unsigned gpio); | ||
| 95 | extern int pinmux_gpio_direction_output(unsigned gpio); | ||
| 96 | extern struct pinmux * __must_check pinmux_get(struct device *dev, const char *name); | ||
| 97 | extern void pinmux_put(struct pinmux *pmx); | ||
| 98 | extern int pinmux_enable(struct pinmux *pmx); | ||
| 99 | extern void pinmux_disable(struct pinmux *pmx); | ||
| 100 | |||
| 101 | #else /* !CONFIG_PINMUX */ | ||
| 102 | |||
| 103 | static inline int pinmux_request_gpio(unsigned gpio) | ||
| 104 | { | ||
| 105 | return 0; | ||
| 106 | } | ||
| 107 | |||
| 108 | static inline void pinmux_free_gpio(unsigned gpio) | ||
| 109 | { | ||
| 110 | } | ||
| 111 | |||
| 112 | static inline int pinmux_gpio_direction_input(unsigned gpio) | ||
| 113 | { | ||
| 114 | return 0; | ||
| 115 | } | ||
| 116 | |||
| 117 | static inline int pinmux_gpio_direction_output(unsigned gpio) | ||
| 118 | { | ||
| 119 | return 0; | ||
| 120 | } | ||
| 121 | |||
| 122 | static inline struct pinmux * __must_check pinmux_get(struct device *dev, const char *name) | ||
| 123 | { | ||
| 124 | return NULL; | ||
| 125 | } | ||
| 126 | |||
| 127 | static inline void pinmux_put(struct pinmux *pmx) | ||
| 128 | { | ||
| 129 | } | ||
| 130 | |||
| 131 | static inline int pinmux_enable(struct pinmux *pmx) | ||
| 132 | { | ||
| 133 | return 0; | ||
| 134 | } | ||
| 135 | |||
| 136 | static inline void pinmux_disable(struct pinmux *pmx) | ||
| 137 | { | ||
| 138 | } | ||
| 139 | |||
| 140 | #endif /* CONFIG_PINMUX */ | 88 | #endif /* CONFIG_PINMUX */ |
| 141 | 89 | ||
| 142 | #endif /* __LINUX_PINCTRL_PINMUX_H */ | 90 | #endif /* __LINUX_PINCTRL_PINMUX_H */ |
diff --git a/include/linux/pipe_fs_i.h b/include/linux/pipe_fs_i.h index 77257c92155a..6d626ff0cfd0 100644 --- a/include/linux/pipe_fs_i.h +++ b/include/linux/pipe_fs_i.h | |||
| @@ -1,8 +1,6 @@ | |||
| 1 | #ifndef _LINUX_PIPE_FS_I_H | 1 | #ifndef _LINUX_PIPE_FS_I_H |
| 2 | #define _LINUX_PIPE_FS_I_H | 2 | #define _LINUX_PIPE_FS_I_H |
| 3 | 3 | ||
| 4 | #define PIPEFS_MAGIC 0x50495045 | ||
| 5 | |||
| 6 | #define PIPE_DEF_BUFFERS 16 | 4 | #define PIPE_DEF_BUFFERS 16 |
| 7 | 5 | ||
| 8 | #define PIPE_BUF_FLAG_LRU 0x01 /* page is on the LRU */ | 6 | #define PIPE_BUF_FLAG_LRU 0x01 /* page is on the LRU */ |
diff --git a/include/linux/pkt_sched.h b/include/linux/pkt_sched.h index 0d5b79365d03..410b33d014d2 100644 --- a/include/linux/pkt_sched.h +++ b/include/linux/pkt_sched.h | |||
| @@ -127,6 +127,27 @@ struct tc_multiq_qopt { | |||
| 127 | __u16 max_bands; /* Maximum number of queues */ | 127 | __u16 max_bands; /* Maximum number of queues */ |
| 128 | }; | 128 | }; |
| 129 | 129 | ||
| 130 | /* PLUG section */ | ||
| 131 | |||
| 132 | #define TCQ_PLUG_BUFFER 0 | ||
| 133 | #define TCQ_PLUG_RELEASE_ONE 1 | ||
| 134 | #define TCQ_PLUG_RELEASE_INDEFINITE 2 | ||
| 135 | #define TCQ_PLUG_LIMIT 3 | ||
| 136 | |||
| 137 | struct tc_plug_qopt { | ||
| 138 | /* TCQ_PLUG_BUFFER: Inset a plug into the queue and | ||
| 139 | * buffer any incoming packets | ||
| 140 | * TCQ_PLUG_RELEASE_ONE: Dequeue packets from queue head | ||
| 141 | * to beginning of the next plug. | ||
| 142 | * TCQ_PLUG_RELEASE_INDEFINITE: Dequeue all packets from queue. | ||
| 143 | * Stop buffering packets until the next TCQ_PLUG_BUFFER | ||
| 144 | * command is received (just act as a pass-thru queue). | ||
| 145 | * TCQ_PLUG_LIMIT: Increase/decrease queue size | ||
| 146 | */ | ||
| 147 | int action; | ||
| 148 | __u32 limit; | ||
| 149 | }; | ||
| 150 | |||
| 130 | /* TBF section */ | 151 | /* TBF section */ |
| 131 | 152 | ||
| 132 | struct tc_tbf_qopt { | 153 | struct tc_tbf_qopt { |
diff --git a/include/linux/platform_data/cpsw.h b/include/linux/platform_data/cpsw.h new file mode 100644 index 000000000000..c4e23d029498 --- /dev/null +++ b/include/linux/platform_data/cpsw.h | |||
| @@ -0,0 +1,55 @@ | |||
| 1 | /* | ||
| 2 | * Texas Instruments Ethernet Switch Driver | ||
| 3 | * | ||
| 4 | * Copyright (C) 2012 Texas Instruments | ||
| 5 | * | ||
| 6 | * This program is free software; you can redistribute it and/or | ||
| 7 | * modify it under the terms of the GNU General Public License as | ||
| 8 | * published by the Free Software Foundation version 2. | ||
| 9 | * | ||
| 10 | * This program is distributed "as is" WITHOUT ANY WARRANTY of any | ||
| 11 | * kind, whether express or implied; without even the implied warranty | ||
| 12 | * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 13 | * GNU General Public License for more details. | ||
| 14 | */ | ||
| 15 | #ifndef __CPSW_H__ | ||
| 16 | #define __CPSW_H__ | ||
| 17 | |||
| 18 | #include <linux/if_ether.h> | ||
| 19 | |||
| 20 | struct cpsw_slave_data { | ||
| 21 | u32 slave_reg_ofs; | ||
| 22 | u32 sliver_reg_ofs; | ||
| 23 | const char *phy_id; | ||
| 24 | int phy_if; | ||
| 25 | u8 mac_addr[ETH_ALEN]; | ||
| 26 | }; | ||
| 27 | |||
| 28 | struct cpsw_platform_data { | ||
| 29 | u32 ss_reg_ofs; /* Subsystem control register offset */ | ||
| 30 | u32 channels; /* number of cpdma channels (symmetric) */ | ||
| 31 | u32 cpdma_reg_ofs; /* cpdma register offset */ | ||
| 32 | u32 cpdma_sram_ofs; /* cpdma sram offset */ | ||
| 33 | |||
| 34 | u32 slaves; /* number of slave cpgmac ports */ | ||
| 35 | struct cpsw_slave_data *slave_data; | ||
| 36 | |||
| 37 | u32 ale_reg_ofs; /* address lookup engine reg offset */ | ||
| 38 | u32 ale_entries; /* ale table size */ | ||
| 39 | |||
| 40 | u32 host_port_reg_ofs; /* cpsw cpdma host port registers */ | ||
| 41 | u32 host_port_num; /* The port number for the host port */ | ||
| 42 | |||
| 43 | u32 hw_stats_reg_ofs; /* cpsw hardware statistics counters */ | ||
| 44 | |||
| 45 | u32 bd_ram_ofs; /* embedded buffer descriptor RAM offset*/ | ||
| 46 | u32 bd_ram_size; /*buffer descriptor ram size */ | ||
| 47 | u32 hw_ram_addr; /*if the HW address for BD RAM is different */ | ||
| 48 | bool no_bd_ram; /* no embedded BD ram*/ | ||
| 49 | |||
| 50 | u32 rx_descs; /* Number of Rx Descriptios */ | ||
| 51 | |||
| 52 | u32 mac_control; /* Mac control register */ | ||
| 53 | }; | ||
| 54 | |||
| 55 | #endif /* __CPSW_H__ */ | ||
diff --git a/include/linux/platform_data/dwc3-exynos.h b/include/linux/platform_data/dwc3-exynos.h new file mode 100644 index 000000000000..5eb7da9b3772 --- /dev/null +++ b/include/linux/platform_data/dwc3-exynos.h | |||
| @@ -0,0 +1,24 @@ | |||
| 1 | /** | ||
| 2 | * dwc3-exynos.h - Samsung EXYNOS DWC3 Specific Glue layer, header. | ||
| 3 | * | ||
| 4 | * Copyright (c) 2012 Samsung Electronics Co., Ltd. | ||
| 5 | * http://www.samsung.com | ||
| 6 | * | ||
| 7 | * Author: Anton Tikhomirov <av.tikhomirov@samsung.com> | ||
| 8 | * | ||
| 9 | * This program is free software; you can redistribute it and/or modify | ||
| 10 | * it under the terms of the GNU General Public License as published by | ||
| 11 | * the Free Software Foundation; either version 2 of the License, or | ||
| 12 | * (at your option) any later version. | ||
| 13 | */ | ||
| 14 | |||
| 15 | #ifndef _DWC3_EXYNOS_H_ | ||
| 16 | #define _DWC3_EXYNOS_H_ | ||
| 17 | |||
| 18 | struct dwc3_exynos_data { | ||
| 19 | int phy_type; | ||
| 20 | int (*phy_init)(struct platform_device *pdev, int type); | ||
| 21 | int (*phy_exit)(struct platform_device *pdev, int type); | ||
| 22 | }; | ||
| 23 | |||
| 24 | #endif /* _DWC3_EXYNOS_H_ */ | ||
diff --git a/include/linux/platform_data/efm32-uart.h b/include/linux/platform_data/efm32-uart.h new file mode 100644 index 000000000000..ed0e975b3c54 --- /dev/null +++ b/include/linux/platform_data/efm32-uart.h | |||
| @@ -0,0 +1,18 @@ | |||
| 1 | /* | ||
| 2 | * | ||
| 3 | * | ||
| 4 | */ | ||
| 5 | #ifndef __LINUX_PLATFORM_DATA_EFM32_UART_H__ | ||
| 6 | #define __LINUX_PLATFORM_DATA_EFM32_UART_H__ | ||
| 7 | |||
| 8 | #include <linux/types.h> | ||
| 9 | |||
| 10 | /** | ||
| 11 | * struct efm32_uart_pdata | ||
| 12 | * @location: pinmux location for the I/O pins (to be written to the ROUTE | ||
| 13 | * register) | ||
| 14 | */ | ||
| 15 | struct efm32_uart_pdata { | ||
| 16 | u8 location; | ||
| 17 | }; | ||
| 18 | #endif /* ifndef __LINUX_PLATFORM_DATA_EFM32_UART_H__ */ | ||
diff --git a/include/linux/platform_data/omap-abe-twl6040.h b/include/linux/platform_data/omap-abe-twl6040.h new file mode 100644 index 000000000000..5d298ac10fc2 --- /dev/null +++ b/include/linux/platform_data/omap-abe-twl6040.h | |||
| @@ -0,0 +1,49 @@ | |||
| 1 | /** | ||
| 2 | * omap-abe-twl6040.h - ASoC machine driver OMAP4+ devices, header. | ||
| 3 | * | ||
| 4 | * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com | ||
| 5 | * All rights reserved. | ||
| 6 | * | ||
| 7 | * Author: Peter Ujfalusi <peter.ujfalusi@ti.com> | ||
| 8 | * | ||
| 9 | * This program is free software; you can redistribute it and/or | ||
| 10 | * modify it under the terms of the GNU General Public License | ||
| 11 | * version 2 as published by the Free Software Foundation. | ||
| 12 | * | ||
| 13 | * This program is distributed in the hope that it will be useful, but | ||
| 14 | * WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
| 16 | * General Public License for more details. | ||
| 17 | * | ||
| 18 | * You should have received a copy of the GNU General Public License | ||
| 19 | * along with this program; if not, write to the Free Software | ||
| 20 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA | ||
| 21 | * 02110-1301 USA | ||
| 22 | */ | ||
| 23 | |||
| 24 | #ifndef _OMAP_ABE_TWL6040_H_ | ||
| 25 | #define _OMAP_ABE_TWL6040_H_ | ||
| 26 | |||
| 27 | /* To select if only one channel is connected in a stereo port */ | ||
| 28 | #define ABE_TWL6040_LEFT (1 << 0) | ||
| 29 | #define ABE_TWL6040_RIGHT (1 << 1) | ||
| 30 | |||
| 31 | struct omap_abe_twl6040_data { | ||
| 32 | char *card_name; | ||
| 33 | /* Feature flags for connected audio pins */ | ||
| 34 | u8 has_hs; | ||
| 35 | u8 has_hf; | ||
| 36 | bool has_ep; | ||
| 37 | u8 has_aux; | ||
| 38 | u8 has_vibra; | ||
| 39 | bool has_dmic; | ||
| 40 | bool has_hsmic; | ||
| 41 | bool has_mainmic; | ||
| 42 | bool has_submic; | ||
| 43 | u8 has_afm; | ||
| 44 | /* Other features */ | ||
| 45 | bool jack_detection; /* board can detect jack events */ | ||
| 46 | int mclk_freq; /* MCLK frequency speed for twl6040 */ | ||
| 47 | }; | ||
| 48 | |||
| 49 | #endif /* _OMAP_ABE_TWL6040_H_ */ | ||
diff --git a/include/linux/platform_data/omap4-keypad.h b/include/linux/platform_data/omap4-keypad.h new file mode 100644 index 000000000000..4eef5fb05a17 --- /dev/null +++ b/include/linux/platform_data/omap4-keypad.h | |||
| @@ -0,0 +1,13 @@ | |||
| 1 | #ifndef __LINUX_INPUT_OMAP4_KEYPAD_H | ||
| 2 | #define __LINUX_INPUT_OMAP4_KEYPAD_H | ||
| 3 | |||
| 4 | #include <linux/input/matrix_keypad.h> | ||
| 5 | |||
| 6 | struct omap4_keypad_platform_data { | ||
| 7 | const struct matrix_keymap_data *keymap_data; | ||
| 8 | |||
| 9 | u8 rows; | ||
| 10 | u8 cols; | ||
| 11 | }; | ||
| 12 | |||
| 13 | #endif /* __LINUX_INPUT_OMAP4_KEYPAD_H */ | ||
diff --git a/include/linux/pm.h b/include/linux/pm.h index e4982ac3fbbc..715305e05123 100644 --- a/include/linux/pm.h +++ b/include/linux/pm.h | |||
| @@ -110,6 +110,10 @@ typedef struct pm_message { | |||
| 110 | * Subsystem-level @suspend() is executed for all devices after invoking | 110 | * Subsystem-level @suspend() is executed for all devices after invoking |
| 111 | * subsystem-level @prepare() for all of them. | 111 | * subsystem-level @prepare() for all of them. |
| 112 | * | 112 | * |
| 113 | * @suspend_late: Continue operations started by @suspend(). For a number of | ||
| 114 | * devices @suspend_late() may point to the same callback routine as the | ||
| 115 | * runtime suspend callback. | ||
| 116 | * | ||
| 113 | * @resume: Executed after waking the system up from a sleep state in which the | 117 | * @resume: Executed after waking the system up from a sleep state in which the |
| 114 | * contents of main memory were preserved. The exact action to perform | 118 | * contents of main memory were preserved. The exact action to perform |
| 115 | * depends on the device's subsystem, but generally the driver is expected | 119 | * depends on the device's subsystem, but generally the driver is expected |
| @@ -122,6 +126,10 @@ typedef struct pm_message { | |||
| 122 | * Subsystem-level @resume() is executed for all devices after invoking | 126 | * Subsystem-level @resume() is executed for all devices after invoking |
| 123 | * subsystem-level @resume_noirq() for all of them. | 127 | * subsystem-level @resume_noirq() for all of them. |
| 124 | * | 128 | * |
| 129 | * @resume_early: Prepare to execute @resume(). For a number of devices | ||
| 130 | * @resume_early() may point to the same callback routine as the runtime | ||
| 131 | * resume callback. | ||
| 132 | * | ||
| 125 | * @freeze: Hibernation-specific, executed before creating a hibernation image. | 133 | * @freeze: Hibernation-specific, executed before creating a hibernation image. |
| 126 | * Analogous to @suspend(), but it should not enable the device to signal | 134 | * Analogous to @suspend(), but it should not enable the device to signal |
| 127 | * wakeup events or change its power state. The majority of subsystems | 135 | * wakeup events or change its power state. The majority of subsystems |
| @@ -131,6 +139,10 @@ typedef struct pm_message { | |||
| 131 | * Subsystem-level @freeze() is executed for all devices after invoking | 139 | * Subsystem-level @freeze() is executed for all devices after invoking |
| 132 | * subsystem-level @prepare() for all of them. | 140 | * subsystem-level @prepare() for all of them. |
| 133 | * | 141 | * |
| 142 | * @freeze_late: Continue operations started by @freeze(). Analogous to | ||
| 143 | * @suspend_late(), but it should not enable the device to signal wakeup | ||
| 144 | * events or change its power state. | ||
| 145 | * | ||
| 134 | * @thaw: Hibernation-specific, executed after creating a hibernation image OR | 146 | * @thaw: Hibernation-specific, executed after creating a hibernation image OR |
| 135 | * if the creation of an image has failed. Also executed after a failing | 147 | * if the creation of an image has failed. Also executed after a failing |
| 136 | * attempt to restore the contents of main memory from such an image. | 148 | * attempt to restore the contents of main memory from such an image. |
| @@ -140,15 +152,23 @@ typedef struct pm_message { | |||
| 140 | * subsystem-level @thaw_noirq() for all of them. It also may be executed | 152 | * subsystem-level @thaw_noirq() for all of them. It also may be executed |
| 141 | * directly after @freeze() in case of a transition error. | 153 | * directly after @freeze() in case of a transition error. |
| 142 | * | 154 | * |
| 155 | * @thaw_early: Prepare to execute @thaw(). Undo the changes made by the | ||
| 156 | * preceding @freeze_late(). | ||
| 157 | * | ||
| 143 | * @poweroff: Hibernation-specific, executed after saving a hibernation image. | 158 | * @poweroff: Hibernation-specific, executed after saving a hibernation image. |
| 144 | * Analogous to @suspend(), but it need not save the device's settings in | 159 | * Analogous to @suspend(), but it need not save the device's settings in |
| 145 | * memory. | 160 | * memory. |
| 146 | * Subsystem-level @poweroff() is executed for all devices after invoking | 161 | * Subsystem-level @poweroff() is executed for all devices after invoking |
| 147 | * subsystem-level @prepare() for all of them. | 162 | * subsystem-level @prepare() for all of them. |
| 148 | * | 163 | * |
| 164 | * @poweroff_late: Continue operations started by @poweroff(). Analogous to | ||
| 165 | * @suspend_late(), but it need not save the device's settings in memory. | ||
| 166 | * | ||
| 149 | * @restore: Hibernation-specific, executed after restoring the contents of main | 167 | * @restore: Hibernation-specific, executed after restoring the contents of main |
| 150 | * memory from a hibernation image, analogous to @resume(). | 168 | * memory from a hibernation image, analogous to @resume(). |
| 151 | * | 169 | * |
| 170 | * @restore_early: Prepare to execute @restore(), analogous to @resume_early(). | ||
| 171 | * | ||
| 152 | * @suspend_noirq: Complete the actions started by @suspend(). Carry out any | 172 | * @suspend_noirq: Complete the actions started by @suspend(). Carry out any |
| 153 | * additional operations required for suspending the device that might be | 173 | * additional operations required for suspending the device that might be |
| 154 | * racing with its driver's interrupt handler, which is guaranteed not to | 174 | * racing with its driver's interrupt handler, which is guaranteed not to |
| @@ -158,9 +178,10 @@ typedef struct pm_message { | |||
| 158 | * @suspend_noirq() has returned successfully. If the device can generate | 178 | * @suspend_noirq() has returned successfully. If the device can generate |
| 159 | * system wakeup signals and is enabled to wake up the system, it should be | 179 | * system wakeup signals and is enabled to wake up the system, it should be |
| 160 | * configured to do so at that time. However, depending on the platform | 180 | * configured to do so at that time. However, depending on the platform |
| 161 | * and device's subsystem, @suspend() may be allowed to put the device into | 181 | * and device's subsystem, @suspend() or @suspend_late() may be allowed to |
| 162 | * the low-power state and configure it to generate wakeup signals, in | 182 | * put the device into the low-power state and configure it to generate |
| 163 | * which case it generally is not necessary to define @suspend_noirq(). | 183 | * wakeup signals, in which case it generally is not necessary to define |
| 184 | * @suspend_noirq(). | ||
| 164 | * | 185 | * |
| 165 | * @resume_noirq: Prepare for the execution of @resume() by carrying out any | 186 | * @resume_noirq: Prepare for the execution of @resume() by carrying out any |
| 166 | * operations required for resuming the device that might be racing with | 187 | * operations required for resuming the device that might be racing with |
| @@ -171,9 +192,9 @@ typedef struct pm_message { | |||
| 171 | * additional operations required for freezing the device that might be | 192 | * additional operations required for freezing the device that might be |
| 172 | * racing with its driver's interrupt handler, which is guaranteed not to | 193 | * racing with its driver's interrupt handler, which is guaranteed not to |
| 173 | * run while @freeze_noirq() is being executed. | 194 | * run while @freeze_noirq() is being executed. |
| 174 | * The power state of the device should not be changed by either @freeze() | 195 | * The power state of the device should not be changed by either @freeze(), |
| 175 | * or @freeze_noirq() and it should not be configured to signal system | 196 | * or @freeze_late(), or @freeze_noirq() and it should not be configured to |
| 176 | * wakeup by any of these callbacks. | 197 | * signal system wakeup by any of these callbacks. |
| 177 | * | 198 | * |
| 178 | * @thaw_noirq: Prepare for the execution of @thaw() by carrying out any | 199 | * @thaw_noirq: Prepare for the execution of @thaw() by carrying out any |
| 179 | * operations required for thawing the device that might be racing with its | 200 | * operations required for thawing the device that might be racing with its |
| @@ -249,6 +270,12 @@ struct dev_pm_ops { | |||
| 249 | int (*thaw)(struct device *dev); | 270 | int (*thaw)(struct device *dev); |
| 250 | int (*poweroff)(struct device *dev); | 271 | int (*poweroff)(struct device *dev); |
| 251 | int (*restore)(struct device *dev); | 272 | int (*restore)(struct device *dev); |
| 273 | int (*suspend_late)(struct device *dev); | ||
| 274 | int (*resume_early)(struct device *dev); | ||
| 275 | int (*freeze_late)(struct device *dev); | ||
| 276 | int (*thaw_early)(struct device *dev); | ||
| 277 | int (*poweroff_late)(struct device *dev); | ||
| 278 | int (*restore_early)(struct device *dev); | ||
| 252 | int (*suspend_noirq)(struct device *dev); | 279 | int (*suspend_noirq)(struct device *dev); |
| 253 | int (*resume_noirq)(struct device *dev); | 280 | int (*resume_noirq)(struct device *dev); |
| 254 | int (*freeze_noirq)(struct device *dev); | 281 | int (*freeze_noirq)(struct device *dev); |
| @@ -293,6 +320,15 @@ const struct dev_pm_ops name = { \ | |||
| 293 | /* | 320 | /* |
| 294 | * Use this for defining a set of PM operations to be used in all situations | 321 | * Use this for defining a set of PM operations to be used in all situations |
| 295 | * (sustem suspend, hibernation or runtime PM). | 322 | * (sustem suspend, hibernation or runtime PM). |
| 323 | * NOTE: In general, system suspend callbacks, .suspend() and .resume(), should | ||
| 324 | * be different from the corresponding runtime PM callbacks, .runtime_suspend(), | ||
| 325 | * and .runtime_resume(), because .runtime_suspend() always works on an already | ||
| 326 | * quiescent device, while .suspend() should assume that the device may be doing | ||
| 327 | * something when it is called (it should ensure that the device will be | ||
| 328 | * quiescent after it has returned). Therefore it's better to point the "late" | ||
| 329 | * suspend and "early" resume callback pointers, .suspend_late() and | ||
| 330 | * .resume_early(), to the same routines as .runtime_suspend() and | ||
| 331 | * .runtime_resume(), respectively (and analogously for hibernation). | ||
| 296 | */ | 332 | */ |
| 297 | #define UNIVERSAL_DEV_PM_OPS(name, suspend_fn, resume_fn, idle_fn) \ | 333 | #define UNIVERSAL_DEV_PM_OPS(name, suspend_fn, resume_fn, idle_fn) \ |
| 298 | const struct dev_pm_ops name = { \ | 334 | const struct dev_pm_ops name = { \ |
| @@ -510,6 +546,7 @@ struct dev_pm_info { | |||
| 510 | unsigned long accounting_timestamp; | 546 | unsigned long accounting_timestamp; |
| 511 | ktime_t suspend_time; | 547 | ktime_t suspend_time; |
| 512 | s64 max_time_suspended_ns; | 548 | s64 max_time_suspended_ns; |
| 549 | struct dev_pm_qos_request *pq_req; | ||
| 513 | #endif | 550 | #endif |
| 514 | struct pm_subsys_data *subsys_data; /* Owned by the subsystem. */ | 551 | struct pm_subsys_data *subsys_data; /* Owned by the subsystem. */ |
| 515 | struct pm_qos_constraints *constraints; | 552 | struct pm_qos_constraints *constraints; |
| @@ -584,13 +621,13 @@ struct dev_pm_domain { | |||
| 584 | 621 | ||
| 585 | #ifdef CONFIG_PM_SLEEP | 622 | #ifdef CONFIG_PM_SLEEP |
| 586 | extern void device_pm_lock(void); | 623 | extern void device_pm_lock(void); |
| 587 | extern void dpm_resume_noirq(pm_message_t state); | 624 | extern void dpm_resume_start(pm_message_t state); |
| 588 | extern void dpm_resume_end(pm_message_t state); | 625 | extern void dpm_resume_end(pm_message_t state); |
| 589 | extern void dpm_resume(pm_message_t state); | 626 | extern void dpm_resume(pm_message_t state); |
| 590 | extern void dpm_complete(pm_message_t state); | 627 | extern void dpm_complete(pm_message_t state); |
| 591 | 628 | ||
| 592 | extern void device_pm_unlock(void); | 629 | extern void device_pm_unlock(void); |
| 593 | extern int dpm_suspend_noirq(pm_message_t state); | 630 | extern int dpm_suspend_end(pm_message_t state); |
| 594 | extern int dpm_suspend_start(pm_message_t state); | 631 | extern int dpm_suspend_start(pm_message_t state); |
| 595 | extern int dpm_suspend(pm_message_t state); | 632 | extern int dpm_suspend(pm_message_t state); |
| 596 | extern int dpm_prepare(pm_message_t state); | 633 | extern int dpm_prepare(pm_message_t state); |
| @@ -605,17 +642,23 @@ extern void __suspend_report_result(const char *function, void *fn, int ret); | |||
| 605 | extern int device_pm_wait_for_dev(struct device *sub, struct device *dev); | 642 | extern int device_pm_wait_for_dev(struct device *sub, struct device *dev); |
| 606 | 643 | ||
| 607 | extern int pm_generic_prepare(struct device *dev); | 644 | extern int pm_generic_prepare(struct device *dev); |
| 645 | extern int pm_generic_suspend_late(struct device *dev); | ||
| 608 | extern int pm_generic_suspend_noirq(struct device *dev); | 646 | extern int pm_generic_suspend_noirq(struct device *dev); |
| 609 | extern int pm_generic_suspend(struct device *dev); | 647 | extern int pm_generic_suspend(struct device *dev); |
| 648 | extern int pm_generic_resume_early(struct device *dev); | ||
| 610 | extern int pm_generic_resume_noirq(struct device *dev); | 649 | extern int pm_generic_resume_noirq(struct device *dev); |
| 611 | extern int pm_generic_resume(struct device *dev); | 650 | extern int pm_generic_resume(struct device *dev); |
| 612 | extern int pm_generic_freeze_noirq(struct device *dev); | 651 | extern int pm_generic_freeze_noirq(struct device *dev); |
| 652 | extern int pm_generic_freeze_late(struct device *dev); | ||
| 613 | extern int pm_generic_freeze(struct device *dev); | 653 | extern int pm_generic_freeze(struct device *dev); |
| 614 | extern int pm_generic_thaw_noirq(struct device *dev); | 654 | extern int pm_generic_thaw_noirq(struct device *dev); |
| 655 | extern int pm_generic_thaw_early(struct device *dev); | ||
| 615 | extern int pm_generic_thaw(struct device *dev); | 656 | extern int pm_generic_thaw(struct device *dev); |
| 616 | extern int pm_generic_restore_noirq(struct device *dev); | 657 | extern int pm_generic_restore_noirq(struct device *dev); |
| 658 | extern int pm_generic_restore_early(struct device *dev); | ||
| 617 | extern int pm_generic_restore(struct device *dev); | 659 | extern int pm_generic_restore(struct device *dev); |
| 618 | extern int pm_generic_poweroff_noirq(struct device *dev); | 660 | extern int pm_generic_poweroff_noirq(struct device *dev); |
| 661 | extern int pm_generic_poweroff_late(struct device *dev); | ||
| 619 | extern int pm_generic_poweroff(struct device *dev); | 662 | extern int pm_generic_poweroff(struct device *dev); |
| 620 | extern void pm_generic_complete(struct device *dev); | 663 | extern void pm_generic_complete(struct device *dev); |
| 621 | 664 | ||
diff --git a/include/linux/pm_domain.h b/include/linux/pm_domain.h index a03a0ad998b8..91f8286106ea 100644 --- a/include/linux/pm_domain.h +++ b/include/linux/pm_domain.h | |||
| @@ -10,7 +10,10 @@ | |||
| 10 | #define _LINUX_PM_DOMAIN_H | 10 | #define _LINUX_PM_DOMAIN_H |
| 11 | 11 | ||
| 12 | #include <linux/device.h> | 12 | #include <linux/device.h> |
| 13 | #include <linux/mutex.h> | ||
| 14 | #include <linux/pm.h> | ||
| 13 | #include <linux/err.h> | 15 | #include <linux/err.h> |
| 16 | #include <linux/of.h> | ||
| 14 | 17 | ||
| 15 | enum gpd_status { | 18 | enum gpd_status { |
| 16 | GPD_STATE_ACTIVE = 0, /* PM domain is active */ | 19 | GPD_STATE_ACTIVE = 0, /* PM domain is active */ |
| @@ -70,6 +73,7 @@ struct generic_pm_domain { | |||
| 70 | s64 break_even_ns; /* Power break even for the entire domain. */ | 73 | s64 break_even_ns; /* Power break even for the entire domain. */ |
| 71 | s64 max_off_time_ns; /* Maximum allowed "suspended" time. */ | 74 | s64 max_off_time_ns; /* Maximum allowed "suspended" time. */ |
| 72 | ktime_t power_off_time; | 75 | ktime_t power_off_time; |
| 76 | struct device_node *of_node; /* Node in device tree */ | ||
| 73 | }; | 77 | }; |
| 74 | 78 | ||
| 75 | static inline struct generic_pm_domain *pd_to_genpd(struct dev_pm_domain *pd) | 79 | static inline struct generic_pm_domain *pd_to_genpd(struct dev_pm_domain *pd) |
| @@ -97,14 +101,15 @@ struct generic_pm_domain_data { | |||
| 97 | struct gpd_dev_ops ops; | 101 | struct gpd_dev_ops ops; |
| 98 | struct gpd_timing_data td; | 102 | struct gpd_timing_data td; |
| 99 | bool need_restore; | 103 | bool need_restore; |
| 104 | bool always_on; | ||
| 100 | }; | 105 | }; |
| 101 | 106 | ||
| 107 | #ifdef CONFIG_PM_GENERIC_DOMAINS | ||
| 102 | static inline struct generic_pm_domain_data *to_gpd_data(struct pm_domain_data *pdd) | 108 | static inline struct generic_pm_domain_data *to_gpd_data(struct pm_domain_data *pdd) |
| 103 | { | 109 | { |
| 104 | return container_of(pdd, struct generic_pm_domain_data, base); | 110 | return container_of(pdd, struct generic_pm_domain_data, base); |
| 105 | } | 111 | } |
| 106 | 112 | ||
| 107 | #ifdef CONFIG_PM_GENERIC_DOMAINS | ||
| 108 | static inline struct generic_pm_domain_data *dev_gpd_data(struct device *dev) | 113 | static inline struct generic_pm_domain_data *dev_gpd_data(struct device *dev) |
| 109 | { | 114 | { |
| 110 | return to_gpd_data(dev->power.subsys_data->domain_data); | 115 | return to_gpd_data(dev->power.subsys_data->domain_data); |
| @@ -117,14 +122,25 @@ extern int __pm_genpd_add_device(struct generic_pm_domain *genpd, | |||
| 117 | struct device *dev, | 122 | struct device *dev, |
| 118 | struct gpd_timing_data *td); | 123 | struct gpd_timing_data *td); |
| 119 | 124 | ||
| 125 | extern int __pm_genpd_of_add_device(struct device_node *genpd_node, | ||
| 126 | struct device *dev, | ||
| 127 | struct gpd_timing_data *td); | ||
| 128 | |||
| 120 | static inline int pm_genpd_add_device(struct generic_pm_domain *genpd, | 129 | static inline int pm_genpd_add_device(struct generic_pm_domain *genpd, |
| 121 | struct device *dev) | 130 | struct device *dev) |
| 122 | { | 131 | { |
| 123 | return __pm_genpd_add_device(genpd, dev, NULL); | 132 | return __pm_genpd_add_device(genpd, dev, NULL); |
| 124 | } | 133 | } |
| 125 | 134 | ||
| 135 | static inline int pm_genpd_of_add_device(struct device_node *genpd_node, | ||
| 136 | struct device *dev) | ||
| 137 | { | ||
| 138 | return __pm_genpd_of_add_device(genpd_node, dev, NULL); | ||
| 139 | } | ||
| 140 | |||
| 126 | extern int pm_genpd_remove_device(struct generic_pm_domain *genpd, | 141 | extern int pm_genpd_remove_device(struct generic_pm_domain *genpd, |
| 127 | struct device *dev); | 142 | struct device *dev); |
| 143 | extern void pm_genpd_dev_always_on(struct device *dev, bool val); | ||
| 128 | extern int pm_genpd_add_subdomain(struct generic_pm_domain *genpd, | 144 | extern int pm_genpd_add_subdomain(struct generic_pm_domain *genpd, |
| 129 | struct generic_pm_domain *new_subdomain); | 145 | struct generic_pm_domain *new_subdomain); |
| 130 | extern int pm_genpd_remove_subdomain(struct generic_pm_domain *genpd, | 146 | extern int pm_genpd_remove_subdomain(struct generic_pm_domain *genpd, |
| @@ -143,6 +159,10 @@ extern bool default_stop_ok(struct device *dev); | |||
| 143 | extern struct dev_power_governor pm_domain_always_on_gov; | 159 | extern struct dev_power_governor pm_domain_always_on_gov; |
| 144 | #else | 160 | #else |
| 145 | 161 | ||
| 162 | static inline struct generic_pm_domain_data *dev_gpd_data(struct device *dev) | ||
| 163 | { | ||
| 164 | return ERR_PTR(-ENOSYS); | ||
| 165 | } | ||
| 146 | static inline struct generic_pm_domain *dev_to_genpd(struct device *dev) | 166 | static inline struct generic_pm_domain *dev_to_genpd(struct device *dev) |
| 147 | { | 167 | { |
| 148 | return ERR_PTR(-ENOSYS); | 168 | return ERR_PTR(-ENOSYS); |
| @@ -163,6 +183,7 @@ static inline int pm_genpd_remove_device(struct generic_pm_domain *genpd, | |||
| 163 | { | 183 | { |
| 164 | return -ENOSYS; | 184 | return -ENOSYS; |
| 165 | } | 185 | } |
| 186 | static inline void pm_genpd_dev_always_on(struct device *dev, bool val) {} | ||
| 166 | static inline int pm_genpd_add_subdomain(struct generic_pm_domain *genpd, | 187 | static inline int pm_genpd_add_subdomain(struct generic_pm_domain *genpd, |
| 167 | struct generic_pm_domain *new_sd) | 188 | struct generic_pm_domain *new_sd) |
| 168 | { | 189 | { |
| @@ -183,7 +204,8 @@ static inline int __pm_genpd_remove_callbacks(struct device *dev, bool clear_td) | |||
| 183 | { | 204 | { |
| 184 | return -ENOSYS; | 205 | return -ENOSYS; |
| 185 | } | 206 | } |
| 186 | static inline void pm_genpd_init(struct generic_pm_domain *genpd, bool is_off) | 207 | static inline void pm_genpd_init(struct generic_pm_domain *genpd, |
| 208 | struct dev_power_governor *gov, bool is_off) | ||
| 187 | { | 209 | { |
| 188 | } | 210 | } |
| 189 | static inline int pm_genpd_poweron(struct generic_pm_domain *genpd) | 211 | static inline int pm_genpd_poweron(struct generic_pm_domain *genpd) |
| @@ -194,6 +216,7 @@ static inline bool default_stop_ok(struct device *dev) | |||
| 194 | { | 216 | { |
| 195 | return false; | 217 | return false; |
| 196 | } | 218 | } |
| 219 | #define simple_qos_governor NULL | ||
| 197 | #define pm_domain_always_on_gov NULL | 220 | #define pm_domain_always_on_gov NULL |
| 198 | #endif | 221 | #endif |
| 199 | 222 | ||
diff --git a/include/linux/pm_qos.h b/include/linux/pm_qos.h index 4d99e4e6ef83..2e9191a712f3 100644 --- a/include/linux/pm_qos.h +++ b/include/linux/pm_qos.h | |||
| @@ -9,12 +9,16 @@ | |||
| 9 | #include <linux/miscdevice.h> | 9 | #include <linux/miscdevice.h> |
| 10 | #include <linux/device.h> | 10 | #include <linux/device.h> |
| 11 | 11 | ||
| 12 | #define PM_QOS_RESERVED 0 | 12 | enum { |
| 13 | #define PM_QOS_CPU_DMA_LATENCY 1 | 13 | PM_QOS_RESERVED = 0, |
| 14 | #define PM_QOS_NETWORK_LATENCY 2 | 14 | PM_QOS_CPU_DMA_LATENCY, |
| 15 | #define PM_QOS_NETWORK_THROUGHPUT 3 | 15 | PM_QOS_NETWORK_LATENCY, |
| 16 | PM_QOS_NETWORK_THROUGHPUT, | ||
| 17 | |||
| 18 | /* insert new class ID */ | ||
| 19 | PM_QOS_NUM_CLASSES, | ||
| 20 | }; | ||
| 16 | 21 | ||
| 17 | #define PM_QOS_NUM_CLASSES 4 | ||
| 18 | #define PM_QOS_DEFAULT_VALUE -1 | 22 | #define PM_QOS_DEFAULT_VALUE -1 |
| 19 | 23 | ||
| 20 | #define PM_QOS_CPU_DMA_LAT_DEFAULT_VALUE (2000 * USEC_PER_SEC) | 24 | #define PM_QOS_CPU_DMA_LAT_DEFAULT_VALUE (2000 * USEC_PER_SEC) |
| @@ -63,7 +67,6 @@ static inline int dev_pm_qos_request_active(struct dev_pm_qos_request *req) | |||
| 63 | return req->dev != 0; | 67 | return req->dev != 0; |
| 64 | } | 68 | } |
| 65 | 69 | ||
| 66 | #ifdef CONFIG_PM | ||
| 67 | int pm_qos_update_target(struct pm_qos_constraints *c, struct plist_node *node, | 70 | int pm_qos_update_target(struct pm_qos_constraints *c, struct plist_node *node, |
| 68 | enum pm_qos_req_action action, int value); | 71 | enum pm_qos_req_action action, int value); |
| 69 | void pm_qos_add_request(struct pm_qos_request *req, int pm_qos_class, | 72 | void pm_qos_add_request(struct pm_qos_request *req, int pm_qos_class, |
| @@ -78,6 +81,7 @@ int pm_qos_remove_notifier(int pm_qos_class, struct notifier_block *notifier); | |||
| 78 | int pm_qos_request_active(struct pm_qos_request *req); | 81 | int pm_qos_request_active(struct pm_qos_request *req); |
| 79 | s32 pm_qos_read_value(struct pm_qos_constraints *c); | 82 | s32 pm_qos_read_value(struct pm_qos_constraints *c); |
| 80 | 83 | ||
| 84 | #ifdef CONFIG_PM | ||
| 81 | s32 __dev_pm_qos_read_value(struct device *dev); | 85 | s32 __dev_pm_qos_read_value(struct device *dev); |
| 82 | s32 dev_pm_qos_read_value(struct device *dev); | 86 | s32 dev_pm_qos_read_value(struct device *dev); |
| 83 | int dev_pm_qos_add_request(struct device *dev, struct dev_pm_qos_request *req, | 87 | int dev_pm_qos_add_request(struct device *dev, struct dev_pm_qos_request *req, |
| @@ -95,45 +99,6 @@ void dev_pm_qos_constraints_destroy(struct device *dev); | |||
| 95 | int dev_pm_qos_add_ancestor_request(struct device *dev, | 99 | int dev_pm_qos_add_ancestor_request(struct device *dev, |
| 96 | struct dev_pm_qos_request *req, s32 value); | 100 | struct dev_pm_qos_request *req, s32 value); |
| 97 | #else | 101 | #else |
| 98 | static inline int pm_qos_update_target(struct pm_qos_constraints *c, | ||
| 99 | struct plist_node *node, | ||
| 100 | enum pm_qos_req_action action, | ||
| 101 | int value) | ||
| 102 | { return 0; } | ||
| 103 | static inline void pm_qos_add_request(struct pm_qos_request *req, | ||
| 104 | int pm_qos_class, s32 value) | ||
| 105 | { return; } | ||
| 106 | static inline void pm_qos_update_request(struct pm_qos_request *req, | ||
| 107 | s32 new_value) | ||
| 108 | { return; } | ||
| 109 | static inline void pm_qos_remove_request(struct pm_qos_request *req) | ||
| 110 | { return; } | ||
| 111 | |||
| 112 | static inline int pm_qos_request(int pm_qos_class) | ||
| 113 | { | ||
| 114 | switch (pm_qos_class) { | ||
| 115 | case PM_QOS_CPU_DMA_LATENCY: | ||
| 116 | return PM_QOS_CPU_DMA_LAT_DEFAULT_VALUE; | ||
| 117 | case PM_QOS_NETWORK_LATENCY: | ||
| 118 | return PM_QOS_NETWORK_LAT_DEFAULT_VALUE; | ||
| 119 | case PM_QOS_NETWORK_THROUGHPUT: | ||
| 120 | return PM_QOS_NETWORK_THROUGHPUT_DEFAULT_VALUE; | ||
| 121 | default: | ||
| 122 | return PM_QOS_DEFAULT_VALUE; | ||
| 123 | } | ||
| 124 | } | ||
| 125 | |||
| 126 | static inline int pm_qos_add_notifier(int pm_qos_class, | ||
| 127 | struct notifier_block *notifier) | ||
| 128 | { return 0; } | ||
| 129 | static inline int pm_qos_remove_notifier(int pm_qos_class, | ||
| 130 | struct notifier_block *notifier) | ||
| 131 | { return 0; } | ||
| 132 | static inline int pm_qos_request_active(struct pm_qos_request *req) | ||
| 133 | { return 0; } | ||
| 134 | static inline s32 pm_qos_read_value(struct pm_qos_constraints *c) | ||
| 135 | { return 0; } | ||
| 136 | |||
| 137 | static inline s32 __dev_pm_qos_read_value(struct device *dev) | 102 | static inline s32 __dev_pm_qos_read_value(struct device *dev) |
| 138 | { return 0; } | 103 | { return 0; } |
| 139 | static inline s32 dev_pm_qos_read_value(struct device *dev) | 104 | static inline s32 dev_pm_qos_read_value(struct device *dev) |
| @@ -172,4 +137,13 @@ static inline int dev_pm_qos_add_ancestor_request(struct device *dev, | |||
| 172 | { return 0; } | 137 | { return 0; } |
| 173 | #endif | 138 | #endif |
| 174 | 139 | ||
| 140 | #ifdef CONFIG_PM_RUNTIME | ||
| 141 | int dev_pm_qos_expose_latency_limit(struct device *dev, s32 value); | ||
| 142 | void dev_pm_qos_hide_latency_limit(struct device *dev); | ||
| 143 | #else | ||
| 144 | static inline int dev_pm_qos_expose_latency_limit(struct device *dev, s32 value) | ||
| 145 | { return 0; } | ||
| 146 | static inline void dev_pm_qos_hide_latency_limit(struct device *dev) {} | ||
| 147 | #endif | ||
| 148 | |||
| 175 | #endif | 149 | #endif |
diff --git a/include/linux/pm_wakeup.h b/include/linux/pm_wakeup.h index a32da962d693..d9f05113e5fb 100644 --- a/include/linux/pm_wakeup.h +++ b/include/linux/pm_wakeup.h | |||
| @@ -41,7 +41,7 @@ | |||
| 41 | * @active: Status of the wakeup source. | 41 | * @active: Status of the wakeup source. |
| 42 | */ | 42 | */ |
| 43 | struct wakeup_source { | 43 | struct wakeup_source { |
| 44 | char *name; | 44 | const char *name; |
| 45 | struct list_head entry; | 45 | struct list_head entry; |
| 46 | spinlock_t lock; | 46 | spinlock_t lock; |
| 47 | struct timer_list timer; | 47 | struct timer_list timer; |
| @@ -73,7 +73,9 @@ static inline bool device_may_wakeup(struct device *dev) | |||
| 73 | } | 73 | } |
| 74 | 74 | ||
| 75 | /* drivers/base/power/wakeup.c */ | 75 | /* drivers/base/power/wakeup.c */ |
| 76 | extern void wakeup_source_prepare(struct wakeup_source *ws, const char *name); | ||
| 76 | extern struct wakeup_source *wakeup_source_create(const char *name); | 77 | extern struct wakeup_source *wakeup_source_create(const char *name); |
| 78 | extern void wakeup_source_drop(struct wakeup_source *ws); | ||
| 77 | extern void wakeup_source_destroy(struct wakeup_source *ws); | 79 | extern void wakeup_source_destroy(struct wakeup_source *ws); |
| 78 | extern void wakeup_source_add(struct wakeup_source *ws); | 80 | extern void wakeup_source_add(struct wakeup_source *ws); |
| 79 | extern void wakeup_source_remove(struct wakeup_source *ws); | 81 | extern void wakeup_source_remove(struct wakeup_source *ws); |
| @@ -103,11 +105,16 @@ static inline bool device_can_wakeup(struct device *dev) | |||
| 103 | return dev->power.can_wakeup; | 105 | return dev->power.can_wakeup; |
| 104 | } | 106 | } |
| 105 | 107 | ||
| 108 | static inline void wakeup_source_prepare(struct wakeup_source *ws, | ||
| 109 | const char *name) {} | ||
| 110 | |||
| 106 | static inline struct wakeup_source *wakeup_source_create(const char *name) | 111 | static inline struct wakeup_source *wakeup_source_create(const char *name) |
| 107 | { | 112 | { |
| 108 | return NULL; | 113 | return NULL; |
| 109 | } | 114 | } |
| 110 | 115 | ||
| 116 | static inline void wakeup_source_drop(struct wakeup_source *ws) {} | ||
| 117 | |||
| 111 | static inline void wakeup_source_destroy(struct wakeup_source *ws) {} | 118 | static inline void wakeup_source_destroy(struct wakeup_source *ws) {} |
| 112 | 119 | ||
| 113 | static inline void wakeup_source_add(struct wakeup_source *ws) {} | 120 | static inline void wakeup_source_add(struct wakeup_source *ws) {} |
| @@ -165,4 +172,17 @@ static inline void pm_wakeup_event(struct device *dev, unsigned int msec) {} | |||
| 165 | 172 | ||
| 166 | #endif /* !CONFIG_PM_SLEEP */ | 173 | #endif /* !CONFIG_PM_SLEEP */ |
| 167 | 174 | ||
| 175 | static inline void wakeup_source_init(struct wakeup_source *ws, | ||
| 176 | const char *name) | ||
| 177 | { | ||
| 178 | wakeup_source_prepare(ws, name); | ||
| 179 | wakeup_source_add(ws); | ||
| 180 | } | ||
| 181 | |||
| 182 | static inline void wakeup_source_trash(struct wakeup_source *ws) | ||
| 183 | { | ||
| 184 | wakeup_source_remove(ws); | ||
| 185 | wakeup_source_drop(ws); | ||
| 186 | } | ||
| 187 | |||
| 168 | #endif /* _LINUX_PM_WAKEUP_H */ | 188 | #endif /* _LINUX_PM_WAKEUP_H */ |
diff --git a/include/linux/poll.h b/include/linux/poll.h index cf40010ce0cd..48fe8bc398d1 100644 --- a/include/linux/poll.h +++ b/include/linux/poll.h | |||
| @@ -32,21 +32,46 @@ struct poll_table_struct; | |||
| 32 | */ | 32 | */ |
| 33 | typedef void (*poll_queue_proc)(struct file *, wait_queue_head_t *, struct poll_table_struct *); | 33 | typedef void (*poll_queue_proc)(struct file *, wait_queue_head_t *, struct poll_table_struct *); |
| 34 | 34 | ||
| 35 | /* | ||
| 36 | * Do not touch the structure directly, use the access functions | ||
| 37 | * poll_does_not_wait() and poll_requested_events() instead. | ||
| 38 | */ | ||
| 35 | typedef struct poll_table_struct { | 39 | typedef struct poll_table_struct { |
| 36 | poll_queue_proc qproc; | 40 | poll_queue_proc _qproc; |
| 37 | unsigned long key; | 41 | unsigned long _key; |
| 38 | } poll_table; | 42 | } poll_table; |
| 39 | 43 | ||
| 40 | static inline void poll_wait(struct file * filp, wait_queue_head_t * wait_address, poll_table *p) | 44 | static inline void poll_wait(struct file * filp, wait_queue_head_t * wait_address, poll_table *p) |
| 41 | { | 45 | { |
| 42 | if (p && wait_address) | 46 | if (p && p->_qproc && wait_address) |
| 43 | p->qproc(filp, wait_address, p); | 47 | p->_qproc(filp, wait_address, p); |
| 48 | } | ||
| 49 | |||
| 50 | /* | ||
| 51 | * Return true if it is guaranteed that poll will not wait. This is the case | ||
| 52 | * if the poll() of another file descriptor in the set got an event, so there | ||
| 53 | * is no need for waiting. | ||
| 54 | */ | ||
| 55 | static inline bool poll_does_not_wait(const poll_table *p) | ||
| 56 | { | ||
| 57 | return p == NULL || p->_qproc == NULL; | ||
| 58 | } | ||
| 59 | |||
| 60 | /* | ||
| 61 | * Return the set of events that the application wants to poll for. | ||
| 62 | * This is useful for drivers that need to know whether a DMA transfer has | ||
| 63 | * to be started implicitly on poll(). You typically only want to do that | ||
| 64 | * if the application is actually polling for POLLIN and/or POLLOUT. | ||
| 65 | */ | ||
| 66 | static inline unsigned long poll_requested_events(const poll_table *p) | ||
| 67 | { | ||
| 68 | return p ? p->_key : ~0UL; | ||
| 44 | } | 69 | } |
| 45 | 70 | ||
| 46 | static inline void init_poll_funcptr(poll_table *pt, poll_queue_proc qproc) | 71 | static inline void init_poll_funcptr(poll_table *pt, poll_queue_proc qproc) |
| 47 | { | 72 | { |
| 48 | pt->qproc = qproc; | 73 | pt->_qproc = qproc; |
| 49 | pt->key = ~0UL; /* all events enabled */ | 74 | pt->_key = ~0UL; /* all events enabled */ |
| 50 | } | 75 | } |
| 51 | 76 | ||
| 52 | struct poll_table_entry { | 77 | struct poll_table_entry { |
diff --git a/include/linux/posix_acl.h b/include/linux/posix_acl.h index b7681102a4b9..11bad91c4433 100644 --- a/include/linux/posix_acl.h +++ b/include/linux/posix_acl.h | |||
| @@ -8,6 +8,7 @@ | |||
| 8 | #ifndef __LINUX_POSIX_ACL_H | 8 | #ifndef __LINUX_POSIX_ACL_H |
| 9 | #define __LINUX_POSIX_ACL_H | 9 | #define __LINUX_POSIX_ACL_H |
| 10 | 10 | ||
| 11 | #include <linux/bug.h> | ||
| 11 | #include <linux/slab.h> | 12 | #include <linux/slab.h> |
| 12 | #include <linux/rcupdate.h> | 13 | #include <linux/rcupdate.h> |
| 13 | 14 | ||
diff --git a/include/linux/power_supply.h b/include/linux/power_supply.h index fa9b962aec12..c38c13db8832 100644 --- a/include/linux/power_supply.h +++ b/include/linux/power_supply.h | |||
| @@ -13,10 +13,11 @@ | |||
| 13 | #ifndef __LINUX_POWER_SUPPLY_H__ | 13 | #ifndef __LINUX_POWER_SUPPLY_H__ |
| 14 | #define __LINUX_POWER_SUPPLY_H__ | 14 | #define __LINUX_POWER_SUPPLY_H__ |
| 15 | 15 | ||
| 16 | #include <linux/device.h> | ||
| 17 | #include <linux/workqueue.h> | 16 | #include <linux/workqueue.h> |
| 18 | #include <linux/leds.h> | 17 | #include <linux/leds.h> |
| 19 | 18 | ||
| 19 | struct device; | ||
| 20 | |||
| 20 | /* | 21 | /* |
| 21 | * All voltages, currents, charges, energies, time and temperatures in uV, | 22 | * All voltages, currents, charges, energies, time and temperatures in uV, |
| 22 | * µA, µAh, µWh, seconds and tenths of degree Celsius unless otherwise | 23 | * µA, µAh, µWh, seconds and tenths of degree Celsius unless otherwise |
diff --git a/include/linux/ppp-comp.h b/include/linux/ppp-comp.h index b8d4ddd22736..e53ff65935dd 100644 --- a/include/linux/ppp-comp.h +++ b/include/linux/ppp-comp.h | |||
| @@ -1,42 +1,12 @@ | |||
| 1 | /* | 1 | /* |
| 2 | * ppp-comp.h - Definitions for doing PPP packet compression. | 2 | * ppp-comp.h - Definitions for doing PPP packet compression. |
| 3 | * | 3 | * |
| 4 | * Copyright (c) 1994 The Australian National University. | 4 | * Copyright 1994-1998 Paul Mackerras. |
| 5 | * All rights reserved. | ||
| 6 | * | 5 | * |
| 7 | * Permission to use, copy, modify, and distribute this software and its | 6 | * This program is free software; you can redistribute it and/or |
| 8 | * documentation is hereby granted, provided that the above copyright | 7 | * modify it under the terms of the GNU General Public License |
| 9 | * notice appears in all copies. This software is provided without any | 8 | * version 2 as published by the Free Software Foundation. |
| 10 | * warranty, express or implied. The Australian National University | ||
| 11 | * makes no representations about the suitability of this software for | ||
| 12 | * any purpose. | ||
| 13 | * | ||
| 14 | * IN NO EVENT SHALL THE AUSTRALIAN NATIONAL UNIVERSITY BE LIABLE TO ANY | ||
| 15 | * PARTY FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES | ||
| 16 | * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF | ||
| 17 | * THE AUSTRALIAN NATIONAL UNIVERSITY HAVE BEEN ADVISED OF THE POSSIBILITY | ||
| 18 | * OF SUCH DAMAGE. | ||
| 19 | * | ||
| 20 | * THE AUSTRALIAN NATIONAL UNIVERSITY SPECIFICALLY DISCLAIMS ANY WARRANTIES, | ||
| 21 | * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY | ||
| 22 | * AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS | ||
| 23 | * ON AN "AS IS" BASIS, AND THE AUSTRALIAN NATIONAL UNIVERSITY HAS NO | ||
| 24 | * OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, | ||
| 25 | * OR MODIFICATIONS. | ||
| 26 | */ | 9 | */ |
| 27 | |||
| 28 | /* | ||
| 29 | * ==FILEVERSION 980319== | ||
| 30 | * | ||
| 31 | * NOTE TO MAINTAINERS: | ||
| 32 | * If you modify this file at all, please set the above date. | ||
| 33 | * ppp-comp.h is shipped with a PPP distribution as well as with the kernel; | ||
| 34 | * if everyone increases the FILEVERSION number above, then scripts | ||
| 35 | * can do the right thing when deciding whether to install a new ppp-comp.h | ||
| 36 | * file. Don't change the format of that line otherwise, so the | ||
| 37 | * installation script can recognize it. | ||
| 38 | */ | ||
| 39 | |||
| 40 | #ifndef _NET_PPP_COMP_H | 10 | #ifndef _NET_PPP_COMP_H |
| 41 | #define _NET_PPP_COMP_H | 11 | #define _NET_PPP_COMP_H |
| 42 | 12 | ||
diff --git a/include/linux/ppp-ioctl.h b/include/linux/ppp-ioctl.h new file mode 100644 index 000000000000..2d9a8859550a --- /dev/null +++ b/include/linux/ppp-ioctl.h | |||
| @@ -0,0 +1,119 @@ | |||
| 1 | /* | ||
| 2 | * ppp-ioctl.h - PPP ioctl definitions. | ||
| 3 | * | ||
| 4 | * Copyright 1999-2002 Paul Mackerras. | ||
| 5 | * | ||
| 6 | * This program is free software; you can redistribute it and/or | ||
| 7 | * modify it under the terms of the GNU General Public License | ||
| 8 | * version 2 as published by the Free Software Foundation. | ||
| 9 | */ | ||
| 10 | #ifndef _PPP_IOCTL_H | ||
| 11 | #define _PPP_IOCTL_H | ||
| 12 | |||
| 13 | #include <linux/types.h> | ||
| 14 | #include <linux/compiler.h> | ||
| 15 | |||
| 16 | /* | ||
| 17 | * Bit definitions for flags argument to PPPIOCGFLAGS/PPPIOCSFLAGS. | ||
| 18 | */ | ||
| 19 | #define SC_COMP_PROT 0x00000001 /* protocol compression (output) */ | ||
| 20 | #define SC_COMP_AC 0x00000002 /* header compression (output) */ | ||
| 21 | #define SC_COMP_TCP 0x00000004 /* TCP (VJ) compression (output) */ | ||
| 22 | #define SC_NO_TCP_CCID 0x00000008 /* disable VJ connection-id comp. */ | ||
| 23 | #define SC_REJ_COMP_AC 0x00000010 /* reject adrs/ctrl comp. on input */ | ||
| 24 | #define SC_REJ_COMP_TCP 0x00000020 /* reject TCP (VJ) comp. on input */ | ||
| 25 | #define SC_CCP_OPEN 0x00000040 /* Look at CCP packets */ | ||
| 26 | #define SC_CCP_UP 0x00000080 /* May send/recv compressed packets */ | ||
| 27 | #define SC_ENABLE_IP 0x00000100 /* IP packets may be exchanged */ | ||
| 28 | #define SC_LOOP_TRAFFIC 0x00000200 /* send traffic to pppd */ | ||
| 29 | #define SC_MULTILINK 0x00000400 /* do multilink encapsulation */ | ||
| 30 | #define SC_MP_SHORTSEQ 0x00000800 /* use short MP sequence numbers */ | ||
| 31 | #define SC_COMP_RUN 0x00001000 /* compressor has been inited */ | ||
| 32 | #define SC_DECOMP_RUN 0x00002000 /* decompressor has been inited */ | ||
| 33 | #define SC_MP_XSHORTSEQ 0x00004000 /* transmit short MP seq numbers */ | ||
| 34 | #define SC_DEBUG 0x00010000 /* enable debug messages */ | ||
| 35 | #define SC_LOG_INPKT 0x00020000 /* log contents of good pkts recvd */ | ||
| 36 | #define SC_LOG_OUTPKT 0x00040000 /* log contents of pkts sent */ | ||
| 37 | #define SC_LOG_RAWIN 0x00080000 /* log all chars received */ | ||
| 38 | #define SC_LOG_FLUSH 0x00100000 /* log all chars flushed */ | ||
| 39 | #define SC_SYNC 0x00200000 /* synchronous serial mode */ | ||
| 40 | #define SC_MUST_COMP 0x00400000 /* no uncompressed packets may be sent or received */ | ||
| 41 | #define SC_MASK 0x0f600fff /* bits that user can change */ | ||
| 42 | |||
| 43 | /* state bits */ | ||
| 44 | #define SC_XMIT_BUSY 0x10000000 /* (used by isdn_ppp?) */ | ||
| 45 | #define SC_RCV_ODDP 0x08000000 /* have rcvd char with odd parity */ | ||
| 46 | #define SC_RCV_EVNP 0x04000000 /* have rcvd char with even parity */ | ||
| 47 | #define SC_RCV_B7_1 0x02000000 /* have rcvd char with bit 7 = 1 */ | ||
| 48 | #define SC_RCV_B7_0 0x01000000 /* have rcvd char with bit 7 = 0 */ | ||
| 49 | #define SC_DC_FERROR 0x00800000 /* fatal decomp error detected */ | ||
| 50 | #define SC_DC_ERROR 0x00400000 /* non-fatal decomp error detected */ | ||
| 51 | |||
| 52 | /* Used with PPPIOCGNPMODE/PPPIOCSNPMODE */ | ||
| 53 | struct npioctl { | ||
| 54 | int protocol; /* PPP protocol, e.g. PPP_IP */ | ||
| 55 | enum NPmode mode; | ||
| 56 | }; | ||
| 57 | |||
| 58 | /* Structure describing a CCP configuration option, for PPPIOCSCOMPRESS */ | ||
| 59 | struct ppp_option_data { | ||
| 60 | __u8 __user *ptr; | ||
| 61 | __u32 length; | ||
| 62 | int transmit; | ||
| 63 | }; | ||
| 64 | |||
| 65 | /* For PPPIOCGL2TPSTATS */ | ||
| 66 | struct pppol2tp_ioc_stats { | ||
| 67 | __u16 tunnel_id; /* redundant */ | ||
| 68 | __u16 session_id; /* if zero, get tunnel stats */ | ||
| 69 | __u32 using_ipsec:1; /* valid only for session_id == 0 */ | ||
| 70 | __aligned_u64 tx_packets; | ||
| 71 | __aligned_u64 tx_bytes; | ||
| 72 | __aligned_u64 tx_errors; | ||
| 73 | __aligned_u64 rx_packets; | ||
| 74 | __aligned_u64 rx_bytes; | ||
| 75 | __aligned_u64 rx_seq_discards; | ||
| 76 | __aligned_u64 rx_oos_packets; | ||
| 77 | __aligned_u64 rx_errors; | ||
| 78 | }; | ||
| 79 | |||
| 80 | /* | ||
| 81 | * Ioctl definitions. | ||
| 82 | */ | ||
| 83 | |||
| 84 | #define PPPIOCGFLAGS _IOR('t', 90, int) /* get configuration flags */ | ||
| 85 | #define PPPIOCSFLAGS _IOW('t', 89, int) /* set configuration flags */ | ||
| 86 | #define PPPIOCGASYNCMAP _IOR('t', 88, int) /* get async map */ | ||
| 87 | #define PPPIOCSASYNCMAP _IOW('t', 87, int) /* set async map */ | ||
| 88 | #define PPPIOCGUNIT _IOR('t', 86, int) /* get ppp unit number */ | ||
| 89 | #define PPPIOCGRASYNCMAP _IOR('t', 85, int) /* get receive async map */ | ||
| 90 | #define PPPIOCSRASYNCMAP _IOW('t', 84, int) /* set receive async map */ | ||
| 91 | #define PPPIOCGMRU _IOR('t', 83, int) /* get max receive unit */ | ||
| 92 | #define PPPIOCSMRU _IOW('t', 82, int) /* set max receive unit */ | ||
| 93 | #define PPPIOCSMAXCID _IOW('t', 81, int) /* set VJ max slot ID */ | ||
| 94 | #define PPPIOCGXASYNCMAP _IOR('t', 80, ext_accm) /* get extended ACCM */ | ||
| 95 | #define PPPIOCSXASYNCMAP _IOW('t', 79, ext_accm) /* set extended ACCM */ | ||
| 96 | #define PPPIOCXFERUNIT _IO('t', 78) /* transfer PPP unit */ | ||
| 97 | #define PPPIOCSCOMPRESS _IOW('t', 77, struct ppp_option_data) | ||
| 98 | #define PPPIOCGNPMODE _IOWR('t', 76, struct npioctl) /* get NP mode */ | ||
| 99 | #define PPPIOCSNPMODE _IOW('t', 75, struct npioctl) /* set NP mode */ | ||
| 100 | #define PPPIOCSPASS _IOW('t', 71, struct sock_fprog) /* set pass filter */ | ||
| 101 | #define PPPIOCSACTIVE _IOW('t', 70, struct sock_fprog) /* set active filt */ | ||
| 102 | #define PPPIOCGDEBUG _IOR('t', 65, int) /* Read debug level */ | ||
| 103 | #define PPPIOCSDEBUG _IOW('t', 64, int) /* Set debug level */ | ||
| 104 | #define PPPIOCGIDLE _IOR('t', 63, struct ppp_idle) /* get idle time */ | ||
| 105 | #define PPPIOCNEWUNIT _IOWR('t', 62, int) /* create new ppp unit */ | ||
| 106 | #define PPPIOCATTACH _IOW('t', 61, int) /* attach to ppp unit */ | ||
| 107 | #define PPPIOCDETACH _IOW('t', 60, int) /* detach from ppp unit/chan */ | ||
| 108 | #define PPPIOCSMRRU _IOW('t', 59, int) /* set multilink MRU */ | ||
| 109 | #define PPPIOCCONNECT _IOW('t', 58, int) /* connect channel to unit */ | ||
| 110 | #define PPPIOCDISCONN _IO('t', 57) /* disconnect channel */ | ||
| 111 | #define PPPIOCATTCHAN _IOW('t', 56, int) /* attach to ppp channel */ | ||
| 112 | #define PPPIOCGCHAN _IOR('t', 55, int) /* get ppp channel number */ | ||
| 113 | #define PPPIOCGL2TPSTATS _IOR('t', 54, struct pppol2tp_ioc_stats) | ||
| 114 | |||
| 115 | #define SIOCGPPPSTATS (SIOCDEVPRIVATE + 0) | ||
| 116 | #define SIOCGPPPVER (SIOCDEVPRIVATE + 1) /* NEVER change this!! */ | ||
| 117 | #define SIOCGPPPCSTATS (SIOCDEVPRIVATE + 2) | ||
| 118 | |||
| 119 | #endif /* _PPP_IOCTL_H */ | ||
diff --git a/include/linux/ppp_defs.h b/include/linux/ppp_defs.h index 0f93ed6b4a88..ba416f67eb62 100644 --- a/include/linux/ppp_defs.h +++ b/include/linux/ppp_defs.h | |||
| @@ -1,44 +1,14 @@ | |||
| 1 | /* | 1 | /* |
| 2 | * ppp_defs.h - PPP definitions. | 2 | * ppp_defs.h - PPP definitions. |
| 3 | * | 3 | * |
| 4 | * Copyright (c) 1994 The Australian National University. | 4 | * Copyright 1994-2000 Paul Mackerras. |
| 5 | * All rights reserved. | ||
| 6 | * | 5 | * |
| 7 | * Permission to use, copy, modify, and distribute this software and its | 6 | * This program is free software; you can redistribute it and/or |
| 8 | * documentation is hereby granted, provided that the above copyright | 7 | * modify it under the terms of the GNU General Public License |
| 9 | * notice appears in all copies. This software is provided without any | 8 | * version 2 as published by the Free Software Foundation. |
| 10 | * warranty, express or implied. The Australian National University | ||
| 11 | * makes no representations about the suitability of this software for | ||
| 12 | * any purpose. | ||
| 13 | * | ||
| 14 | * IN NO EVENT SHALL THE AUSTRALIAN NATIONAL UNIVERSITY BE LIABLE TO ANY | ||
| 15 | * PARTY FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES | ||
| 16 | * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF | ||
| 17 | * THE AUSTRALIAN NATIONAL UNIVERSITY HAVE BEEN ADVISED OF THE POSSIBILITY | ||
| 18 | * OF SUCH DAMAGE. | ||
| 19 | * | ||
| 20 | * THE AUSTRALIAN NATIONAL UNIVERSITY SPECIFICALLY DISCLAIMS ANY WARRANTIES, | ||
| 21 | * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY | ||
| 22 | * AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS | ||
| 23 | * ON AN "AS IS" BASIS, AND THE AUSTRALIAN NATIONAL UNIVERSITY HAS NO | ||
| 24 | * OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, | ||
| 25 | * OR MODIFICATIONS. | ||
| 26 | */ | 9 | */ |
| 27 | |||
| 28 | #include <linux/types.h> | 10 | #include <linux/types.h> |
| 29 | 11 | ||
| 30 | /* | ||
| 31 | * ==FILEVERSION 20000114== | ||
| 32 | * | ||
| 33 | * NOTE TO MAINTAINERS: | ||
| 34 | * If you modify this file at all, please set the above date. | ||
| 35 | * ppp_defs.h is shipped with a PPP distribution as well as with the kernel; | ||
| 36 | * if everyone increases the FILEVERSION number above, then scripts | ||
| 37 | * can do the right thing when deciding whether to install a new ppp_defs.h | ||
| 38 | * file. Don't change the format of that line otherwise, so the | ||
| 39 | * installation script can recognize it. | ||
| 40 | */ | ||
| 41 | |||
| 42 | #ifndef _PPP_DEFS_H_ | 12 | #ifndef _PPP_DEFS_H_ |
| 43 | #define _PPP_DEFS_H_ | 13 | #define _PPP_DEFS_H_ |
| 44 | 14 | ||
diff --git a/include/linux/prctl.h b/include/linux/prctl.h index 7ddc7f1b480f..e0cfec2490aa 100644 --- a/include/linux/prctl.h +++ b/include/linux/prctl.h | |||
| @@ -114,4 +114,14 @@ | |||
| 114 | # define PR_SET_MM_START_BRK 6 | 114 | # define PR_SET_MM_START_BRK 6 |
| 115 | # define PR_SET_MM_BRK 7 | 115 | # define PR_SET_MM_BRK 7 |
| 116 | 116 | ||
| 117 | /* | ||
| 118 | * Set specific pid that is allowed to ptrace the current task. | ||
| 119 | * A value of 0 mean "no process". | ||
| 120 | */ | ||
| 121 | #define PR_SET_PTRACER 0x59616d61 | ||
| 122 | # define PR_SET_PTRACER_ANY ((unsigned long)-1) | ||
| 123 | |||
| 124 | #define PR_SET_CHILD_SUBREAPER 36 | ||
| 125 | #define PR_GET_CHILD_SUBREAPER 37 | ||
| 126 | |||
| 117 | #endif /* _LINUX_PRCTL_H */ | 127 | #endif /* _LINUX_PRCTL_H */ |
diff --git a/include/linux/preempt.h b/include/linux/preempt.h index 58969b2a8a82..5a710b9c578e 100644 --- a/include/linux/preempt.h +++ b/include/linux/preempt.h | |||
| @@ -48,12 +48,14 @@ do { \ | |||
| 48 | barrier(); \ | 48 | barrier(); \ |
| 49 | } while (0) | 49 | } while (0) |
| 50 | 50 | ||
| 51 | #define preempt_enable_no_resched() \ | 51 | #define sched_preempt_enable_no_resched() \ |
| 52 | do { \ | 52 | do { \ |
| 53 | barrier(); \ | 53 | barrier(); \ |
| 54 | dec_preempt_count(); \ | 54 | dec_preempt_count(); \ |
| 55 | } while (0) | 55 | } while (0) |
| 56 | 56 | ||
| 57 | #define preempt_enable_no_resched() sched_preempt_enable_no_resched() | ||
| 58 | |||
| 57 | #define preempt_enable() \ | 59 | #define preempt_enable() \ |
| 58 | do { \ | 60 | do { \ |
| 59 | preempt_enable_no_resched(); \ | 61 | preempt_enable_no_resched(); \ |
| @@ -92,6 +94,7 @@ do { \ | |||
| 92 | #else /* !CONFIG_PREEMPT_COUNT */ | 94 | #else /* !CONFIG_PREEMPT_COUNT */ |
| 93 | 95 | ||
| 94 | #define preempt_disable() do { } while (0) | 96 | #define preempt_disable() do { } while (0) |
| 97 | #define sched_preempt_enable_no_resched() do { } while (0) | ||
| 95 | #define preempt_enable_no_resched() do { } while (0) | 98 | #define preempt_enable_no_resched() do { } while (0) |
| 96 | #define preempt_enable() do { } while (0) | 99 | #define preempt_enable() do { } while (0) |
| 97 | 100 | ||
diff --git a/include/linux/printk.h b/include/linux/printk.h index f0e22f75143f..0525927f203f 100644 --- a/include/linux/printk.h +++ b/include/linux/printk.h | |||
| @@ -101,6 +101,11 @@ asmlinkage __printf(1, 2) __cold | |||
| 101 | int printk(const char *fmt, ...); | 101 | int printk(const char *fmt, ...); |
| 102 | 102 | ||
| 103 | /* | 103 | /* |
| 104 | * Special printk facility for scheduler use only, _DO_NOT_USE_ ! | ||
| 105 | */ | ||
| 106 | __printf(1, 2) __cold int printk_sched(const char *fmt, ...); | ||
| 107 | |||
| 108 | /* | ||
| 104 | * Please don't use printk_ratelimit(), because it shares ratelimiting state | 109 | * Please don't use printk_ratelimit(), because it shares ratelimiting state |
| 105 | * with all other unrelated printk_ratelimit() callsites. Instead use | 110 | * with all other unrelated printk_ratelimit() callsites. Instead use |
| 106 | * printk_ratelimited() or plain old __ratelimit(). | 111 | * printk_ratelimited() or plain old __ratelimit(). |
| @@ -127,6 +132,11 @@ int printk(const char *s, ...) | |||
| 127 | { | 132 | { |
| 128 | return 0; | 133 | return 0; |
| 129 | } | 134 | } |
| 135 | static inline __printf(1, 2) __cold | ||
| 136 | int printk_sched(const char *s, ...) | ||
| 137 | { | ||
| 138 | return 0; | ||
| 139 | } | ||
| 130 | static inline int printk_ratelimit(void) | 140 | static inline int printk_ratelimit(void) |
| 131 | { | 141 | { |
| 132 | return 0; | 142 | return 0; |
| @@ -180,13 +190,13 @@ extern void dump_stack(void) __cold; | |||
| 180 | #endif | 190 | #endif |
| 181 | 191 | ||
| 182 | /* If you are writing a driver, please use dev_dbg instead */ | 192 | /* If you are writing a driver, please use dev_dbg instead */ |
| 183 | #if defined(DEBUG) | 193 | #if defined(CONFIG_DYNAMIC_DEBUG) |
| 184 | #define pr_debug(fmt, ...) \ | ||
| 185 | printk(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__) | ||
| 186 | #elif defined(CONFIG_DYNAMIC_DEBUG) | ||
| 187 | /* dynamic_pr_debug() uses pr_fmt() internally so we don't need it here */ | 194 | /* dynamic_pr_debug() uses pr_fmt() internally so we don't need it here */ |
| 188 | #define pr_debug(fmt, ...) \ | 195 | #define pr_debug(fmt, ...) \ |
| 189 | dynamic_pr_debug(fmt, ##__VA_ARGS__) | 196 | dynamic_pr_debug(fmt, ##__VA_ARGS__) |
| 197 | #elif defined(DEBUG) | ||
| 198 | #define pr_debug(fmt, ...) \ | ||
| 199 | printk(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__) | ||
| 190 | #else | 200 | #else |
| 191 | #define pr_debug(fmt, ...) \ | 201 | #define pr_debug(fmt, ...) \ |
| 192 | no_printk(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__) | 202 | no_printk(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__) |
diff --git a/include/linux/ptrace.h b/include/linux/ptrace.h index c2f1f6a5fcb8..5c719627c2aa 100644 --- a/include/linux/ptrace.h +++ b/include/linux/ptrace.h | |||
| @@ -51,20 +51,6 @@ | |||
| 51 | #define PTRACE_INTERRUPT 0x4207 | 51 | #define PTRACE_INTERRUPT 0x4207 |
| 52 | #define PTRACE_LISTEN 0x4208 | 52 | #define PTRACE_LISTEN 0x4208 |
| 53 | 53 | ||
| 54 | /* flags in @data for PTRACE_SEIZE */ | ||
| 55 | #define PTRACE_SEIZE_DEVEL 0x80000000 /* temp flag for development */ | ||
| 56 | |||
| 57 | /* options set using PTRACE_SETOPTIONS */ | ||
| 58 | #define PTRACE_O_TRACESYSGOOD 0x00000001 | ||
| 59 | #define PTRACE_O_TRACEFORK 0x00000002 | ||
| 60 | #define PTRACE_O_TRACEVFORK 0x00000004 | ||
| 61 | #define PTRACE_O_TRACECLONE 0x00000008 | ||
| 62 | #define PTRACE_O_TRACEEXEC 0x00000010 | ||
| 63 | #define PTRACE_O_TRACEVFORKDONE 0x00000020 | ||
| 64 | #define PTRACE_O_TRACEEXIT 0x00000040 | ||
| 65 | |||
| 66 | #define PTRACE_O_MASK 0x0000007f | ||
| 67 | |||
| 68 | /* Wait extended result codes for the above trace options. */ | 54 | /* Wait extended result codes for the above trace options. */ |
| 69 | #define PTRACE_EVENT_FORK 1 | 55 | #define PTRACE_EVENT_FORK 1 |
| 70 | #define PTRACE_EVENT_VFORK 2 | 56 | #define PTRACE_EVENT_VFORK 2 |
| @@ -72,7 +58,19 @@ | |||
| 72 | #define PTRACE_EVENT_EXEC 4 | 58 | #define PTRACE_EVENT_EXEC 4 |
| 73 | #define PTRACE_EVENT_VFORK_DONE 5 | 59 | #define PTRACE_EVENT_VFORK_DONE 5 |
| 74 | #define PTRACE_EVENT_EXIT 6 | 60 | #define PTRACE_EVENT_EXIT 6 |
| 75 | #define PTRACE_EVENT_STOP 7 | 61 | /* Extended result codes which enabled by means other than options. */ |
| 62 | #define PTRACE_EVENT_STOP 128 | ||
| 63 | |||
| 64 | /* Options set using PTRACE_SETOPTIONS or using PTRACE_SEIZE @data param */ | ||
| 65 | #define PTRACE_O_TRACESYSGOOD 1 | ||
| 66 | #define PTRACE_O_TRACEFORK (1 << PTRACE_EVENT_FORK) | ||
| 67 | #define PTRACE_O_TRACEVFORK (1 << PTRACE_EVENT_VFORK) | ||
| 68 | #define PTRACE_O_TRACECLONE (1 << PTRACE_EVENT_CLONE) | ||
| 69 | #define PTRACE_O_TRACEEXEC (1 << PTRACE_EVENT_EXEC) | ||
| 70 | #define PTRACE_O_TRACEVFORKDONE (1 << PTRACE_EVENT_VFORK_DONE) | ||
| 71 | #define PTRACE_O_TRACEEXIT (1 << PTRACE_EVENT_EXIT) | ||
| 72 | |||
| 73 | #define PTRACE_O_MASK 0x0000007f | ||
| 76 | 74 | ||
| 77 | #include <asm/ptrace.h> | 75 | #include <asm/ptrace.h> |
| 78 | 76 | ||
| @@ -88,13 +86,12 @@ | |||
| 88 | #define PT_SEIZED 0x00010000 /* SEIZE used, enable new behavior */ | 86 | #define PT_SEIZED 0x00010000 /* SEIZE used, enable new behavior */ |
| 89 | #define PT_PTRACED 0x00000001 | 87 | #define PT_PTRACED 0x00000001 |
| 90 | #define PT_DTRACE 0x00000002 /* delayed trace (used on m68k, i386) */ | 88 | #define PT_DTRACE 0x00000002 /* delayed trace (used on m68k, i386) */ |
| 91 | #define PT_TRACESYSGOOD 0x00000004 | 89 | #define PT_PTRACE_CAP 0x00000004 /* ptracer can follow suid-exec */ |
| 92 | #define PT_PTRACE_CAP 0x00000008 /* ptracer can follow suid-exec */ | ||
| 93 | 90 | ||
| 91 | #define PT_OPT_FLAG_SHIFT 3 | ||
| 94 | /* PT_TRACE_* event enable flags */ | 92 | /* PT_TRACE_* event enable flags */ |
| 95 | #define PT_EVENT_FLAG_SHIFT 4 | 93 | #define PT_EVENT_FLAG(event) (1 << (PT_OPT_FLAG_SHIFT + (event))) |
| 96 | #define PT_EVENT_FLAG(event) (1 << (PT_EVENT_FLAG_SHIFT + (event) - 1)) | 94 | #define PT_TRACESYSGOOD PT_EVENT_FLAG(0) |
| 97 | |||
| 98 | #define PT_TRACE_FORK PT_EVENT_FLAG(PTRACE_EVENT_FORK) | 95 | #define PT_TRACE_FORK PT_EVENT_FLAG(PTRACE_EVENT_FORK) |
| 99 | #define PT_TRACE_VFORK PT_EVENT_FLAG(PTRACE_EVENT_VFORK) | 96 | #define PT_TRACE_VFORK PT_EVENT_FLAG(PTRACE_EVENT_VFORK) |
| 100 | #define PT_TRACE_CLONE PT_EVENT_FLAG(PTRACE_EVENT_CLONE) | 97 | #define PT_TRACE_CLONE PT_EVENT_FLAG(PTRACE_EVENT_CLONE) |
| @@ -102,8 +99,6 @@ | |||
| 102 | #define PT_TRACE_VFORK_DONE PT_EVENT_FLAG(PTRACE_EVENT_VFORK_DONE) | 99 | #define PT_TRACE_VFORK_DONE PT_EVENT_FLAG(PTRACE_EVENT_VFORK_DONE) |
| 103 | #define PT_TRACE_EXIT PT_EVENT_FLAG(PTRACE_EVENT_EXIT) | 100 | #define PT_TRACE_EXIT PT_EVENT_FLAG(PTRACE_EVENT_EXIT) |
| 104 | 101 | ||
| 105 | #define PT_TRACE_MASK 0x000003f4 | ||
| 106 | |||
| 107 | /* single stepping state bits (used on ARM and PA-RISC) */ | 102 | /* single stepping state bits (used on ARM and PA-RISC) */ |
| 108 | #define PT_SINGLESTEP_BIT 31 | 103 | #define PT_SINGLESTEP_BIT 31 |
| 109 | #define PT_SINGLESTEP (1<<PT_SINGLESTEP_BIT) | 104 | #define PT_SINGLESTEP (1<<PT_SINGLESTEP_BIT) |
| @@ -113,6 +108,7 @@ | |||
| 113 | #include <linux/compiler.h> /* For unlikely. */ | 108 | #include <linux/compiler.h> /* For unlikely. */ |
| 114 | #include <linux/sched.h> /* For struct task_struct. */ | 109 | #include <linux/sched.h> /* For struct task_struct. */ |
| 115 | #include <linux/err.h> /* for IS_ERR_VALUE */ | 110 | #include <linux/err.h> /* for IS_ERR_VALUE */ |
| 111 | #include <linux/bug.h> /* For BUG_ON. */ | ||
| 116 | 112 | ||
| 117 | 113 | ||
| 118 | extern long arch_ptrace(struct task_struct *child, long request, | 114 | extern long arch_ptrace(struct task_struct *child, long request, |
| @@ -199,9 +195,10 @@ static inline void ptrace_event(int event, unsigned long message) | |||
| 199 | if (unlikely(ptrace_event_enabled(current, event))) { | 195 | if (unlikely(ptrace_event_enabled(current, event))) { |
| 200 | current->ptrace_message = message; | 196 | current->ptrace_message = message; |
| 201 | ptrace_notify((event << 8) | SIGTRAP); | 197 | ptrace_notify((event << 8) | SIGTRAP); |
| 202 | } else if (event == PTRACE_EVENT_EXEC && unlikely(current->ptrace)) { | 198 | } else if (event == PTRACE_EVENT_EXEC) { |
| 203 | /* legacy EXEC report via SIGTRAP */ | 199 | /* legacy EXEC report via SIGTRAP */ |
| 204 | send_sig(SIGTRAP, current, 0); | 200 | if ((current->ptrace & (PT_PTRACED|PT_SEIZED)) == PT_PTRACED) |
| 201 | send_sig(SIGTRAP, current, 0); | ||
| 205 | } | 202 | } |
| 206 | } | 203 | } |
| 207 | 204 | ||
diff --git a/include/linux/qnx6_fs.h b/include/linux/qnx6_fs.h new file mode 100644 index 000000000000..26049eab9010 --- /dev/null +++ b/include/linux/qnx6_fs.h | |||
| @@ -0,0 +1,134 @@ | |||
| 1 | /* | ||
| 2 | * Name : qnx6_fs.h | ||
| 3 | * Author : Kai Bankett | ||
| 4 | * Function : qnx6 global filesystem definitions | ||
| 5 | * History : 17-01-2012 created | ||
| 6 | */ | ||
| 7 | #ifndef _LINUX_QNX6_FS_H | ||
| 8 | #define _LINUX_QNX6_FS_H | ||
| 9 | |||
| 10 | #include <linux/types.h> | ||
| 11 | #include <linux/magic.h> | ||
| 12 | |||
| 13 | #define QNX6_ROOT_INO 1 | ||
| 14 | |||
| 15 | /* for di_status */ | ||
| 16 | #define QNX6_FILE_DIRECTORY 0x01 | ||
| 17 | #define QNX6_FILE_DELETED 0x02 | ||
| 18 | #define QNX6_FILE_NORMAL 0x03 | ||
| 19 | |||
| 20 | #define QNX6_SUPERBLOCK_SIZE 0x200 /* superblock always is 512 bytes */ | ||
| 21 | #define QNX6_SUPERBLOCK_AREA 0x1000 /* area reserved for superblock */ | ||
| 22 | #define QNX6_BOOTBLOCK_SIZE 0x2000 /* heading bootblock area */ | ||
| 23 | #define QNX6_DIR_ENTRY_SIZE 0x20 /* dir entry size of 32 bytes */ | ||
| 24 | #define QNX6_INODE_SIZE 0x80 /* each inode is 128 bytes */ | ||
| 25 | #define QNX6_INODE_SIZE_BITS 7 /* inode entry size shift */ | ||
| 26 | |||
| 27 | #define QNX6_NO_DIRECT_POINTERS 16 /* 16 blockptrs in sbl/inode */ | ||
| 28 | #define QNX6_PTR_MAX_LEVELS 5 /* maximum indirect levels */ | ||
| 29 | |||
| 30 | /* for filenames */ | ||
| 31 | #define QNX6_SHORT_NAME_MAX 27 | ||
| 32 | #define QNX6_LONG_NAME_MAX 510 | ||
| 33 | |||
| 34 | /* list of mount options */ | ||
| 35 | #define QNX6_MOUNT_MMI_FS 0x010000 /* mount as Audi MMI 3G fs */ | ||
| 36 | |||
| 37 | /* | ||
| 38 | * This is the original qnx6 inode layout on disk. | ||
| 39 | * Each inode is 128 byte long. | ||
| 40 | */ | ||
| 41 | struct qnx6_inode_entry { | ||
| 42 | __fs64 di_size; | ||
| 43 | __fs32 di_uid; | ||
| 44 | __fs32 di_gid; | ||
| 45 | __fs32 di_ftime; | ||
| 46 | __fs32 di_mtime; | ||
| 47 | __fs32 di_atime; | ||
| 48 | __fs32 di_ctime; | ||
| 49 | __fs16 di_mode; | ||
| 50 | __fs16 di_ext_mode; | ||
| 51 | __fs32 di_block_ptr[QNX6_NO_DIRECT_POINTERS]; | ||
| 52 | __u8 di_filelevels; | ||
| 53 | __u8 di_status; | ||
| 54 | __u8 di_unknown2[2]; | ||
| 55 | __fs32 di_zero2[6]; | ||
| 56 | }; | ||
| 57 | |||
| 58 | /* | ||
| 59 | * Each directory entry is maximum 32 bytes long. | ||
| 60 | * If more characters or special characters required it is stored | ||
| 61 | * in the longfilenames structure. | ||
| 62 | */ | ||
| 63 | struct qnx6_dir_entry { | ||
| 64 | __fs32 de_inode; | ||
| 65 | __u8 de_size; | ||
| 66 | char de_fname[QNX6_SHORT_NAME_MAX]; | ||
| 67 | }; | ||
| 68 | |||
| 69 | /* | ||
| 70 | * Longfilename direntries have a different structure | ||
| 71 | */ | ||
| 72 | struct qnx6_long_dir_entry { | ||
| 73 | __fs32 de_inode; | ||
| 74 | __u8 de_size; | ||
| 75 | __u8 de_unknown[3]; | ||
| 76 | __fs32 de_long_inode; | ||
| 77 | __fs32 de_checksum; | ||
| 78 | }; | ||
| 79 | |||
| 80 | struct qnx6_long_filename { | ||
| 81 | __fs16 lf_size; | ||
| 82 | __u8 lf_fname[QNX6_LONG_NAME_MAX]; | ||
| 83 | }; | ||
| 84 | |||
| 85 | struct qnx6_root_node { | ||
| 86 | __fs64 size; | ||
| 87 | __fs32 ptr[QNX6_NO_DIRECT_POINTERS]; | ||
| 88 | __u8 levels; | ||
| 89 | __u8 mode; | ||
| 90 | __u8 spare[6]; | ||
| 91 | }; | ||
| 92 | |||
| 93 | struct qnx6_super_block { | ||
| 94 | __fs32 sb_magic; | ||
| 95 | __fs32 sb_checksum; | ||
| 96 | __fs64 sb_serial; | ||
| 97 | __fs32 sb_ctime; /* time the fs was created */ | ||
| 98 | __fs32 sb_atime; /* last access time */ | ||
| 99 | __fs32 sb_flags; | ||
| 100 | __fs16 sb_version1; /* filesystem version information */ | ||
| 101 | __fs16 sb_version2; /* filesystem version information */ | ||
| 102 | __u8 sb_volumeid[16]; | ||
| 103 | __fs32 sb_blocksize; | ||
| 104 | __fs32 sb_num_inodes; | ||
| 105 | __fs32 sb_free_inodes; | ||
| 106 | __fs32 sb_num_blocks; | ||
| 107 | __fs32 sb_free_blocks; | ||
| 108 | __fs32 sb_allocgroup; | ||
| 109 | struct qnx6_root_node Inode; | ||
| 110 | struct qnx6_root_node Bitmap; | ||
| 111 | struct qnx6_root_node Longfile; | ||
| 112 | struct qnx6_root_node Unknown; | ||
| 113 | }; | ||
| 114 | |||
| 115 | /* Audi MMI 3G superblock layout is different to plain qnx6 */ | ||
| 116 | struct qnx6_mmi_super_block { | ||
| 117 | __fs32 sb_magic; | ||
| 118 | __fs32 sb_checksum; | ||
| 119 | __fs64 sb_serial; | ||
| 120 | __u8 sb_spare0[12]; | ||
| 121 | __u8 sb_id[12]; | ||
| 122 | __fs32 sb_blocksize; | ||
| 123 | __fs32 sb_num_inodes; | ||
| 124 | __fs32 sb_free_inodes; | ||
| 125 | __fs32 sb_num_blocks; | ||
| 126 | __fs32 sb_free_blocks; | ||
| 127 | __u8 sb_spare1[4]; | ||
| 128 | struct qnx6_root_node Inode; | ||
| 129 | struct qnx6_root_node Bitmap; | ||
| 130 | struct qnx6_root_node Longfile; | ||
| 131 | struct qnx6_root_node Unknown; | ||
| 132 | }; | ||
| 133 | |||
| 134 | #endif | ||
diff --git a/include/linux/radix-tree.h b/include/linux/radix-tree.h index 07e360b1b282..e9a48234e693 100644 --- a/include/linux/radix-tree.h +++ b/include/linux/radix-tree.h | |||
| @@ -22,6 +22,7 @@ | |||
| 22 | 22 | ||
| 23 | #include <linux/preempt.h> | 23 | #include <linux/preempt.h> |
| 24 | #include <linux/types.h> | 24 | #include <linux/types.h> |
| 25 | #include <linux/bug.h> | ||
| 25 | #include <linux/kernel.h> | 26 | #include <linux/kernel.h> |
| 26 | #include <linux/rcupdate.h> | 27 | #include <linux/rcupdate.h> |
| 27 | 28 | ||
diff --git a/include/linux/raid/md_p.h b/include/linux/raid/md_p.h index 6f6df86f1ae5..8c0a3adc5df5 100644 --- a/include/linux/raid/md_p.h +++ b/include/linux/raid/md_p.h | |||
| @@ -281,6 +281,10 @@ struct mdp_superblock_1 { | |||
| 281 | * active device with same 'role'. | 281 | * active device with same 'role'. |
| 282 | * 'recovery_offset' is also set. | 282 | * 'recovery_offset' is also set. |
| 283 | */ | 283 | */ |
| 284 | #define MD_FEATURE_ALL (1|2|4|8|16) | 284 | #define MD_FEATURE_ALL (MD_FEATURE_BITMAP_OFFSET \ |
| 285 | |MD_FEATURE_RECOVERY_OFFSET \ | ||
| 286 | |MD_FEATURE_RESHAPE_ACTIVE \ | ||
| 287 | |MD_FEATURE_BAD_BLOCKS \ | ||
| 288 | |MD_FEATURE_REPLACEMENT) | ||
| 285 | 289 | ||
| 286 | #endif | 290 | #endif |
diff --git a/include/linux/rar_register.h b/include/linux/rar_register.h deleted file mode 100644 index 5c6118189363..000000000000 --- a/include/linux/rar_register.h +++ /dev/null | |||
| @@ -1,60 +0,0 @@ | |||
| 1 | /* | ||
| 2 | * Copyright (C) 2010 Intel Corporation. All rights reserved. | ||
| 3 | * | ||
| 4 | * This program is free software; you can redistribute it and/or | ||
| 5 | * modify it under the terms of version 2 of the GNU General | ||
| 6 | * Public License as published by the Free Software Foundation. | ||
| 7 | * | ||
| 8 | * This program is distributed in the hope that it will be | ||
| 9 | * useful, but WITHOUT ANY WARRANTY; without even the implied | ||
| 10 | * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR | ||
| 11 | * PURPOSE. See the GNU General Public License for more details. | ||
| 12 | * You should have received a copy of the GNU General Public | ||
| 13 | * License along with this program; if not, write to the Free | ||
| 14 | * Software Foundation, Inc., 59 Temple Place - Suite 330, | ||
| 15 | * Boston, MA 02111-1307, USA. | ||
| 16 | * The full GNU General Public License is included in this | ||
| 17 | * distribution in the file called COPYING. | ||
| 18 | */ | ||
| 19 | |||
| 20 | |||
| 21 | #ifndef _RAR_REGISTER_H | ||
| 22 | #define _RAR_REGISTER_H | ||
| 23 | |||
| 24 | #include <linux/types.h> | ||
| 25 | |||
| 26 | /* following are used both in drivers as well as user space apps */ | ||
| 27 | |||
| 28 | #define RAR_TYPE_VIDEO 0 | ||
| 29 | #define RAR_TYPE_AUDIO 1 | ||
| 30 | #define RAR_TYPE_IMAGE 2 | ||
| 31 | #define RAR_TYPE_DATA 3 | ||
| 32 | |||
| 33 | #ifdef __KERNEL__ | ||
| 34 | |||
| 35 | struct rar_device; | ||
| 36 | |||
| 37 | #if defined(CONFIG_RAR_REGISTER) | ||
| 38 | int register_rar(int num, | ||
| 39 | int (*callback)(unsigned long data), unsigned long data); | ||
| 40 | void unregister_rar(int num); | ||
| 41 | int rar_get_address(int rar_index, dma_addr_t *start, dma_addr_t *end); | ||
| 42 | int rar_lock(int rar_index); | ||
| 43 | #else | ||
| 44 | extern void unregister_rar(int num) { } | ||
| 45 | extern int rar_lock(int rar_index) { return -EIO; } | ||
| 46 | |||
| 47 | extern inline int register_rar(int num, | ||
| 48 | int (*callback)(unsigned long data), unsigned long data) | ||
| 49 | { | ||
| 50 | return -ENODEV; | ||
| 51 | } | ||
| 52 | |||
| 53 | extern int rar_get_address(int rar_index, dma_addr_t *start, dma_addr_t *end) | ||
| 54 | { | ||
| 55 | return -ENODEV; | ||
| 56 | } | ||
| 57 | #endif /* RAR_REGISTER */ | ||
| 58 | |||
| 59 | #endif /* __KERNEL__ */ | ||
| 60 | #endif /* _RAR_REGISTER_H */ | ||
diff --git a/include/linux/rcupdate.h b/include/linux/rcupdate.h index 81c04f4348ec..20fb776a1d4a 100644 --- a/include/linux/rcupdate.h +++ b/include/linux/rcupdate.h | |||
| @@ -42,6 +42,7 @@ | |||
| 42 | #include <linux/lockdep.h> | 42 | #include <linux/lockdep.h> |
| 43 | #include <linux/completion.h> | 43 | #include <linux/completion.h> |
| 44 | #include <linux/debugobjects.h> | 44 | #include <linux/debugobjects.h> |
| 45 | #include <linux/bug.h> | ||
| 45 | #include <linux/compiler.h> | 46 | #include <linux/compiler.h> |
| 46 | 47 | ||
| 47 | #ifdef CONFIG_RCU_TORTURE_TEST | 48 | #ifdef CONFIG_RCU_TORTURE_TEST |
| @@ -190,6 +191,33 @@ extern void rcu_idle_exit(void); | |||
| 190 | extern void rcu_irq_enter(void); | 191 | extern void rcu_irq_enter(void); |
| 191 | extern void rcu_irq_exit(void); | 192 | extern void rcu_irq_exit(void); |
| 192 | 193 | ||
| 194 | /** | ||
| 195 | * RCU_NONIDLE - Indicate idle-loop code that needs RCU readers | ||
| 196 | * @a: Code that RCU needs to pay attention to. | ||
| 197 | * | ||
| 198 | * RCU, RCU-bh, and RCU-sched read-side critical sections are forbidden | ||
| 199 | * in the inner idle loop, that is, between the rcu_idle_enter() and | ||
| 200 | * the rcu_idle_exit() -- RCU will happily ignore any such read-side | ||
| 201 | * critical sections. However, things like powertop need tracepoints | ||
| 202 | * in the inner idle loop. | ||
| 203 | * | ||
| 204 | * This macro provides the way out: RCU_NONIDLE(do_something_with_RCU()) | ||
| 205 | * will tell RCU that it needs to pay attending, invoke its argument | ||
| 206 | * (in this example, a call to the do_something_with_RCU() function), | ||
| 207 | * and then tell RCU to go back to ignoring this CPU. It is permissible | ||
| 208 | * to nest RCU_NONIDLE() wrappers, but the nesting level is currently | ||
| 209 | * quite limited. If deeper nesting is required, it will be necessary | ||
| 210 | * to adjust DYNTICK_TASK_NESTING_VALUE accordingly. | ||
| 211 | * | ||
| 212 | * This macro may be used from process-level code only. | ||
| 213 | */ | ||
| 214 | #define RCU_NONIDLE(a) \ | ||
| 215 | do { \ | ||
| 216 | rcu_idle_exit(); \ | ||
| 217 | do { a; } while (0); \ | ||
| 218 | rcu_idle_enter(); \ | ||
| 219 | } while (0) | ||
| 220 | |||
| 193 | /* | 221 | /* |
| 194 | * Infrastructure to implement the synchronize_() primitives in | 222 | * Infrastructure to implement the synchronize_() primitives in |
| 195 | * TREE_RCU and rcu_barrier_() primitives in TINY_RCU. | 223 | * TREE_RCU and rcu_barrier_() primitives in TINY_RCU. |
| @@ -226,6 +254,15 @@ static inline void destroy_rcu_head_on_stack(struct rcu_head *head) | |||
| 226 | } | 254 | } |
| 227 | #endif /* #else !CONFIG_DEBUG_OBJECTS_RCU_HEAD */ | 255 | #endif /* #else !CONFIG_DEBUG_OBJECTS_RCU_HEAD */ |
| 228 | 256 | ||
| 257 | #if defined(CONFIG_HOTPLUG_CPU) && defined(CONFIG_PROVE_RCU) | ||
| 258 | bool rcu_lockdep_current_cpu_online(void); | ||
| 259 | #else /* #if defined(CONFIG_HOTPLUG_CPU) && defined(CONFIG_PROVE_RCU) */ | ||
| 260 | static inline bool rcu_lockdep_current_cpu_online(void) | ||
| 261 | { | ||
| 262 | return 1; | ||
| 263 | } | ||
| 264 | #endif /* #else #if defined(CONFIG_HOTPLUG_CPU) && defined(CONFIG_PROVE_RCU) */ | ||
| 265 | |||
| 229 | #ifdef CONFIG_DEBUG_LOCK_ALLOC | 266 | #ifdef CONFIG_DEBUG_LOCK_ALLOC |
| 230 | 267 | ||
| 231 | #ifdef CONFIG_PROVE_RCU | 268 | #ifdef CONFIG_PROVE_RCU |
| @@ -239,13 +276,11 @@ static inline int rcu_is_cpu_idle(void) | |||
| 239 | 276 | ||
| 240 | static inline void rcu_lock_acquire(struct lockdep_map *map) | 277 | static inline void rcu_lock_acquire(struct lockdep_map *map) |
| 241 | { | 278 | { |
| 242 | WARN_ON_ONCE(rcu_is_cpu_idle()); | ||
| 243 | lock_acquire(map, 0, 0, 2, 1, NULL, _THIS_IP_); | 279 | lock_acquire(map, 0, 0, 2, 1, NULL, _THIS_IP_); |
| 244 | } | 280 | } |
| 245 | 281 | ||
| 246 | static inline void rcu_lock_release(struct lockdep_map *map) | 282 | static inline void rcu_lock_release(struct lockdep_map *map) |
| 247 | { | 283 | { |
| 248 | WARN_ON_ONCE(rcu_is_cpu_idle()); | ||
| 249 | lock_release(map, 1, _THIS_IP_); | 284 | lock_release(map, 1, _THIS_IP_); |
| 250 | } | 285 | } |
| 251 | 286 | ||
| @@ -270,6 +305,9 @@ extern int debug_lockdep_rcu_enabled(void); | |||
| 270 | * occur in the same context, for example, it is illegal to invoke | 305 | * occur in the same context, for example, it is illegal to invoke |
| 271 | * rcu_read_unlock() in process context if the matching rcu_read_lock() | 306 | * rcu_read_unlock() in process context if the matching rcu_read_lock() |
| 272 | * was invoked from within an irq handler. | 307 | * was invoked from within an irq handler. |
| 308 | * | ||
| 309 | * Note that rcu_read_lock() is disallowed if the CPU is either idle or | ||
| 310 | * offline from an RCU perspective, so check for those as well. | ||
| 273 | */ | 311 | */ |
| 274 | static inline int rcu_read_lock_held(void) | 312 | static inline int rcu_read_lock_held(void) |
| 275 | { | 313 | { |
| @@ -277,6 +315,8 @@ static inline int rcu_read_lock_held(void) | |||
| 277 | return 1; | 315 | return 1; |
| 278 | if (rcu_is_cpu_idle()) | 316 | if (rcu_is_cpu_idle()) |
| 279 | return 0; | 317 | return 0; |
| 318 | if (!rcu_lockdep_current_cpu_online()) | ||
| 319 | return 0; | ||
| 280 | return lock_is_held(&rcu_lock_map); | 320 | return lock_is_held(&rcu_lock_map); |
| 281 | } | 321 | } |
| 282 | 322 | ||
| @@ -313,6 +353,9 @@ extern int rcu_read_lock_bh_held(void); | |||
| 313 | * notice an extended quiescent state to other CPUs that started a grace | 353 | * notice an extended quiescent state to other CPUs that started a grace |
| 314 | * period. Otherwise we would delay any grace period as long as we run in | 354 | * period. Otherwise we would delay any grace period as long as we run in |
| 315 | * the idle task. | 355 | * the idle task. |
| 356 | * | ||
| 357 | * Similarly, we avoid claiming an SRCU read lock held if the current | ||
| 358 | * CPU is offline. | ||
| 316 | */ | 359 | */ |
| 317 | #ifdef CONFIG_PREEMPT_COUNT | 360 | #ifdef CONFIG_PREEMPT_COUNT |
| 318 | static inline int rcu_read_lock_sched_held(void) | 361 | static inline int rcu_read_lock_sched_held(void) |
| @@ -323,6 +366,8 @@ static inline int rcu_read_lock_sched_held(void) | |||
| 323 | return 1; | 366 | return 1; |
| 324 | if (rcu_is_cpu_idle()) | 367 | if (rcu_is_cpu_idle()) |
| 325 | return 0; | 368 | return 0; |
| 369 | if (!rcu_lockdep_current_cpu_online()) | ||
| 370 | return 0; | ||
| 326 | if (debug_locks) | 371 | if (debug_locks) |
| 327 | lockdep_opinion = lock_is_held(&rcu_sched_lock_map); | 372 | lockdep_opinion = lock_is_held(&rcu_sched_lock_map); |
| 328 | return lockdep_opinion || preempt_count() != 0 || irqs_disabled(); | 373 | return lockdep_opinion || preempt_count() != 0 || irqs_disabled(); |
| @@ -374,15 +419,29 @@ extern int rcu_my_thread_group_empty(void); | |||
| 374 | */ | 419 | */ |
| 375 | #define rcu_lockdep_assert(c, s) \ | 420 | #define rcu_lockdep_assert(c, s) \ |
| 376 | do { \ | 421 | do { \ |
| 377 | static bool __warned; \ | 422 | static bool __section(.data.unlikely) __warned; \ |
| 378 | if (debug_lockdep_rcu_enabled() && !__warned && !(c)) { \ | 423 | if (debug_lockdep_rcu_enabled() && !__warned && !(c)) { \ |
| 379 | __warned = true; \ | 424 | __warned = true; \ |
| 380 | lockdep_rcu_suspicious(__FILE__, __LINE__, s); \ | 425 | lockdep_rcu_suspicious(__FILE__, __LINE__, s); \ |
| 381 | } \ | 426 | } \ |
| 382 | } while (0) | 427 | } while (0) |
| 383 | 428 | ||
| 429 | #if defined(CONFIG_PROVE_RCU) && !defined(CONFIG_PREEMPT_RCU) | ||
| 430 | static inline void rcu_preempt_sleep_check(void) | ||
| 431 | { | ||
| 432 | rcu_lockdep_assert(!lock_is_held(&rcu_lock_map), | ||
| 433 | "Illegal context switch in RCU read-side " | ||
| 434 | "critical section"); | ||
| 435 | } | ||
| 436 | #else /* #ifdef CONFIG_PROVE_RCU */ | ||
| 437 | static inline void rcu_preempt_sleep_check(void) | ||
| 438 | { | ||
| 439 | } | ||
| 440 | #endif /* #else #ifdef CONFIG_PROVE_RCU */ | ||
| 441 | |||
| 384 | #define rcu_sleep_check() \ | 442 | #define rcu_sleep_check() \ |
| 385 | do { \ | 443 | do { \ |
| 444 | rcu_preempt_sleep_check(); \ | ||
| 386 | rcu_lockdep_assert(!lock_is_held(&rcu_bh_lock_map), \ | 445 | rcu_lockdep_assert(!lock_is_held(&rcu_bh_lock_map), \ |
| 387 | "Illegal context switch in RCU-bh" \ | 446 | "Illegal context switch in RCU-bh" \ |
| 388 | " read-side critical section"); \ | 447 | " read-side critical section"); \ |
| @@ -470,6 +529,13 @@ extern int rcu_my_thread_group_empty(void); | |||
| 470 | * NULL. Although rcu_access_pointer() may also be used in cases where | 529 | * NULL. Although rcu_access_pointer() may also be used in cases where |
| 471 | * update-side locks prevent the value of the pointer from changing, you | 530 | * update-side locks prevent the value of the pointer from changing, you |
| 472 | * should instead use rcu_dereference_protected() for this use case. | 531 | * should instead use rcu_dereference_protected() for this use case. |
| 532 | * | ||
| 533 | * It is also permissible to use rcu_access_pointer() when read-side | ||
| 534 | * access to the pointer was removed at least one grace period ago, as | ||
| 535 | * is the case in the context of the RCU callback that is freeing up | ||
| 536 | * the data, or after a synchronize_rcu() returns. This can be useful | ||
| 537 | * when tearing down multi-linked structures after a grace period | ||
| 538 | * has elapsed. | ||
| 473 | */ | 539 | */ |
| 474 | #define rcu_access_pointer(p) __rcu_access_pointer((p), __rcu) | 540 | #define rcu_access_pointer(p) __rcu_access_pointer((p), __rcu) |
| 475 | 541 | ||
| @@ -659,6 +725,8 @@ static inline void rcu_read_lock(void) | |||
| 659 | __rcu_read_lock(); | 725 | __rcu_read_lock(); |
| 660 | __acquire(RCU); | 726 | __acquire(RCU); |
| 661 | rcu_lock_acquire(&rcu_lock_map); | 727 | rcu_lock_acquire(&rcu_lock_map); |
| 728 | rcu_lockdep_assert(!rcu_is_cpu_idle(), | ||
| 729 | "rcu_read_lock() used illegally while idle"); | ||
| 662 | } | 730 | } |
| 663 | 731 | ||
| 664 | /* | 732 | /* |
| @@ -678,6 +746,8 @@ static inline void rcu_read_lock(void) | |||
| 678 | */ | 746 | */ |
| 679 | static inline void rcu_read_unlock(void) | 747 | static inline void rcu_read_unlock(void) |
| 680 | { | 748 | { |
| 749 | rcu_lockdep_assert(!rcu_is_cpu_idle(), | ||
| 750 | "rcu_read_unlock() used illegally while idle"); | ||
| 681 | rcu_lock_release(&rcu_lock_map); | 751 | rcu_lock_release(&rcu_lock_map); |
| 682 | __release(RCU); | 752 | __release(RCU); |
| 683 | __rcu_read_unlock(); | 753 | __rcu_read_unlock(); |
| @@ -705,6 +775,8 @@ static inline void rcu_read_lock_bh(void) | |||
| 705 | local_bh_disable(); | 775 | local_bh_disable(); |
| 706 | __acquire(RCU_BH); | 776 | __acquire(RCU_BH); |
| 707 | rcu_lock_acquire(&rcu_bh_lock_map); | 777 | rcu_lock_acquire(&rcu_bh_lock_map); |
| 778 | rcu_lockdep_assert(!rcu_is_cpu_idle(), | ||
| 779 | "rcu_read_lock_bh() used illegally while idle"); | ||
| 708 | } | 780 | } |
| 709 | 781 | ||
| 710 | /* | 782 | /* |
| @@ -714,6 +786,8 @@ static inline void rcu_read_lock_bh(void) | |||
| 714 | */ | 786 | */ |
| 715 | static inline void rcu_read_unlock_bh(void) | 787 | static inline void rcu_read_unlock_bh(void) |
| 716 | { | 788 | { |
| 789 | rcu_lockdep_assert(!rcu_is_cpu_idle(), | ||
| 790 | "rcu_read_unlock_bh() used illegally while idle"); | ||
| 717 | rcu_lock_release(&rcu_bh_lock_map); | 791 | rcu_lock_release(&rcu_bh_lock_map); |
| 718 | __release(RCU_BH); | 792 | __release(RCU_BH); |
| 719 | local_bh_enable(); | 793 | local_bh_enable(); |
| @@ -737,6 +811,8 @@ static inline void rcu_read_lock_sched(void) | |||
| 737 | preempt_disable(); | 811 | preempt_disable(); |
| 738 | __acquire(RCU_SCHED); | 812 | __acquire(RCU_SCHED); |
| 739 | rcu_lock_acquire(&rcu_sched_lock_map); | 813 | rcu_lock_acquire(&rcu_sched_lock_map); |
| 814 | rcu_lockdep_assert(!rcu_is_cpu_idle(), | ||
| 815 | "rcu_read_lock_sched() used illegally while idle"); | ||
| 740 | } | 816 | } |
| 741 | 817 | ||
| 742 | /* Used by lockdep and tracing: cannot be traced, cannot call lockdep. */ | 818 | /* Used by lockdep and tracing: cannot be traced, cannot call lockdep. */ |
| @@ -753,6 +829,8 @@ static inline notrace void rcu_read_lock_sched_notrace(void) | |||
| 753 | */ | 829 | */ |
| 754 | static inline void rcu_read_unlock_sched(void) | 830 | static inline void rcu_read_unlock_sched(void) |
| 755 | { | 831 | { |
| 832 | rcu_lockdep_assert(!rcu_is_cpu_idle(), | ||
| 833 | "rcu_read_unlock_sched() used illegally while idle"); | ||
| 756 | rcu_lock_release(&rcu_sched_lock_map); | 834 | rcu_lock_release(&rcu_sched_lock_map); |
| 757 | __release(RCU_SCHED); | 835 | __release(RCU_SCHED); |
| 758 | preempt_enable(); | 836 | preempt_enable(); |
| @@ -841,7 +919,7 @@ void __kfree_rcu(struct rcu_head *head, unsigned long offset) | |||
| 841 | /* See the kfree_rcu() header comment. */ | 919 | /* See the kfree_rcu() header comment. */ |
| 842 | BUILD_BUG_ON(!__is_kfree_rcu_offset(offset)); | 920 | BUILD_BUG_ON(!__is_kfree_rcu_offset(offset)); |
| 843 | 921 | ||
| 844 | call_rcu(head, (rcu_callback)offset); | 922 | kfree_call_rcu(head, (rcu_callback)offset); |
| 845 | } | 923 | } |
| 846 | 924 | ||
| 847 | /** | 925 | /** |
diff --git a/include/linux/rcutiny.h b/include/linux/rcutiny.h index 00b7a5e493d2..e93df77176d1 100644 --- a/include/linux/rcutiny.h +++ b/include/linux/rcutiny.h | |||
| @@ -27,13 +27,9 @@ | |||
| 27 | 27 | ||
| 28 | #include <linux/cache.h> | 28 | #include <linux/cache.h> |
| 29 | 29 | ||
| 30 | #ifdef CONFIG_RCU_BOOST | ||
| 31 | static inline void rcu_init(void) | 30 | static inline void rcu_init(void) |
| 32 | { | 31 | { |
| 33 | } | 32 | } |
| 34 | #else /* #ifdef CONFIG_RCU_BOOST */ | ||
| 35 | void rcu_init(void); | ||
| 36 | #endif /* #else #ifdef CONFIG_RCU_BOOST */ | ||
| 37 | 33 | ||
| 38 | static inline void rcu_barrier_bh(void) | 34 | static inline void rcu_barrier_bh(void) |
| 39 | { | 35 | { |
| @@ -83,6 +79,12 @@ static inline void synchronize_sched_expedited(void) | |||
| 83 | synchronize_sched(); | 79 | synchronize_sched(); |
| 84 | } | 80 | } |
| 85 | 81 | ||
| 82 | static inline void kfree_call_rcu(struct rcu_head *head, | ||
| 83 | void (*func)(struct rcu_head *rcu)) | ||
| 84 | { | ||
| 85 | call_rcu(head, func); | ||
| 86 | } | ||
| 87 | |||
| 86 | #ifdef CONFIG_TINY_RCU | 88 | #ifdef CONFIG_TINY_RCU |
| 87 | 89 | ||
| 88 | static inline void rcu_preempt_note_context_switch(void) | 90 | static inline void rcu_preempt_note_context_switch(void) |
diff --git a/include/linux/rcutree.h b/include/linux/rcutree.h index 67458468f1a8..e8ee5dd0854c 100644 --- a/include/linux/rcutree.h +++ b/include/linux/rcutree.h | |||
| @@ -61,6 +61,24 @@ extern void synchronize_rcu_bh(void); | |||
| 61 | extern void synchronize_sched_expedited(void); | 61 | extern void synchronize_sched_expedited(void); |
| 62 | extern void synchronize_rcu_expedited(void); | 62 | extern void synchronize_rcu_expedited(void); |
| 63 | 63 | ||
| 64 | void kfree_call_rcu(struct rcu_head *head, void (*func)(struct rcu_head *rcu)); | ||
| 65 | |||
| 66 | /** | ||
| 67 | * synchronize_rcu_bh_expedited - Brute-force RCU-bh grace period | ||
| 68 | * | ||
| 69 | * Wait for an RCU-bh grace period to elapse, but use a "big hammer" | ||
| 70 | * approach to force the grace period to end quickly. This consumes | ||
| 71 | * significant time on all CPUs and is unfriendly to real-time workloads, | ||
| 72 | * so is thus not recommended for any sort of common-case code. In fact, | ||
| 73 | * if you are using synchronize_rcu_bh_expedited() in a loop, please | ||
| 74 | * restructure your code to batch your updates, and then use a single | ||
| 75 | * synchronize_rcu_bh() instead. | ||
| 76 | * | ||
| 77 | * Note that it is illegal to call this function while holding any lock | ||
| 78 | * that is acquired by a CPU-hotplug notifier. And yes, it is also illegal | ||
| 79 | * to call this function from a CPU-hotplug notifier. Failing to observe | ||
| 80 | * these restriction will result in deadlock. | ||
| 81 | */ | ||
| 64 | static inline void synchronize_rcu_bh_expedited(void) | 82 | static inline void synchronize_rcu_bh_expedited(void) |
| 65 | { | 83 | { |
| 66 | synchronize_sched_expedited(); | 84 | synchronize_sched_expedited(); |
| @@ -83,6 +101,7 @@ extern void rcu_sched_force_quiescent_state(void); | |||
| 83 | /* A context switch is a grace period for RCU-sched and RCU-bh. */ | 101 | /* A context switch is a grace period for RCU-sched and RCU-bh. */ |
| 84 | static inline int rcu_blocking_is_gp(void) | 102 | static inline int rcu_blocking_is_gp(void) |
| 85 | { | 103 | { |
| 104 | might_sleep(); /* Check for RCU read-side critical section. */ | ||
| 86 | return num_online_cpus() == 1; | 105 | return num_online_cpus() == 1; |
| 87 | } | 106 | } |
| 88 | 107 | ||
diff --git a/include/linux/regmap.h b/include/linux/regmap.h index eb93921cdd30..a90abb6bfa64 100644 --- a/include/linux/regmap.h +++ b/include/linux/regmap.h | |||
| @@ -13,12 +13,13 @@ | |||
| 13 | * published by the Free Software Foundation. | 13 | * published by the Free Software Foundation. |
| 14 | */ | 14 | */ |
| 15 | 15 | ||
| 16 | #include <linux/device.h> | ||
| 17 | #include <linux/list.h> | 16 | #include <linux/list.h> |
| 18 | 17 | ||
| 19 | struct module; | 18 | struct module; |
| 19 | struct device; | ||
| 20 | struct i2c_client; | 20 | struct i2c_client; |
| 21 | struct spi_device; | 21 | struct spi_device; |
| 22 | struct regmap; | ||
| 22 | 23 | ||
| 23 | /* An enum of all the supported cache types */ | 24 | /* An enum of all the supported cache types */ |
| 24 | enum regcache_type { | 25 | enum regcache_type { |
| @@ -40,10 +41,13 @@ struct reg_default { | |||
| 40 | unsigned int def; | 41 | unsigned int def; |
| 41 | }; | 42 | }; |
| 42 | 43 | ||
| 44 | #ifdef CONFIG_REGMAP | ||
| 45 | |||
| 43 | /** | 46 | /** |
| 44 | * Configuration for the register map of a device. | 47 | * Configuration for the register map of a device. |
| 45 | * | 48 | * |
| 46 | * @reg_bits: Number of bits in a register address, mandatory. | 49 | * @reg_bits: Number of bits in a register address, mandatory. |
| 50 | * @pad_bits: Number of bits of padding between register and value. | ||
| 47 | * @val_bits: Number of bits in a register value, mandatory. | 51 | * @val_bits: Number of bits in a register value, mandatory. |
| 48 | * | 52 | * |
| 49 | * @writeable_reg: Optional callback returning true if the register | 53 | * @writeable_reg: Optional callback returning true if the register |
| @@ -74,6 +78,7 @@ struct reg_default { | |||
| 74 | */ | 78 | */ |
| 75 | struct regmap_config { | 79 | struct regmap_config { |
| 76 | int reg_bits; | 80 | int reg_bits; |
| 81 | int pad_bits; | ||
| 77 | int val_bits; | 82 | int val_bits; |
| 78 | 83 | ||
| 79 | bool (*writeable_reg)(struct device *dev, unsigned int reg); | 84 | bool (*writeable_reg)(struct device *dev, unsigned int reg); |
| @@ -127,12 +132,22 @@ struct regmap *regmap_init_i2c(struct i2c_client *i2c, | |||
| 127 | struct regmap *regmap_init_spi(struct spi_device *dev, | 132 | struct regmap *regmap_init_spi(struct spi_device *dev, |
| 128 | const struct regmap_config *config); | 133 | const struct regmap_config *config); |
| 129 | 134 | ||
| 135 | struct regmap *devm_regmap_init(struct device *dev, | ||
| 136 | const struct regmap_bus *bus, | ||
| 137 | const struct regmap_config *config); | ||
| 138 | struct regmap *devm_regmap_init_i2c(struct i2c_client *i2c, | ||
| 139 | const struct regmap_config *config); | ||
| 140 | struct regmap *devm_regmap_init_spi(struct spi_device *dev, | ||
| 141 | const struct regmap_config *config); | ||
| 142 | |||
| 130 | void regmap_exit(struct regmap *map); | 143 | void regmap_exit(struct regmap *map); |
| 131 | int regmap_reinit_cache(struct regmap *map, | 144 | int regmap_reinit_cache(struct regmap *map, |
| 132 | const struct regmap_config *config); | 145 | const struct regmap_config *config); |
| 133 | int regmap_write(struct regmap *map, unsigned int reg, unsigned int val); | 146 | int regmap_write(struct regmap *map, unsigned int reg, unsigned int val); |
| 134 | int regmap_raw_write(struct regmap *map, unsigned int reg, | 147 | int regmap_raw_write(struct regmap *map, unsigned int reg, |
| 135 | const void *val, size_t val_len); | 148 | const void *val, size_t val_len); |
| 149 | int regmap_bulk_write(struct regmap *map, unsigned int reg, const void *val, | ||
| 150 | size_t val_count); | ||
| 136 | int regmap_read(struct regmap *map, unsigned int reg, unsigned int *val); | 151 | int regmap_read(struct regmap *map, unsigned int reg, unsigned int *val); |
| 137 | int regmap_raw_read(struct regmap *map, unsigned int reg, | 152 | int regmap_raw_read(struct regmap *map, unsigned int reg, |
| 138 | void *val, size_t val_len); | 153 | void *val, size_t val_len); |
| @@ -143,12 +158,18 @@ int regmap_update_bits(struct regmap *map, unsigned int reg, | |||
| 143 | int regmap_update_bits_check(struct regmap *map, unsigned int reg, | 158 | int regmap_update_bits_check(struct regmap *map, unsigned int reg, |
| 144 | unsigned int mask, unsigned int val, | 159 | unsigned int mask, unsigned int val, |
| 145 | bool *change); | 160 | bool *change); |
| 161 | int regmap_get_val_bytes(struct regmap *map); | ||
| 146 | 162 | ||
| 147 | int regcache_sync(struct regmap *map); | 163 | int regcache_sync(struct regmap *map); |
| 164 | int regcache_sync_region(struct regmap *map, unsigned int min, | ||
| 165 | unsigned int max); | ||
| 148 | void regcache_cache_only(struct regmap *map, bool enable); | 166 | void regcache_cache_only(struct regmap *map, bool enable); |
| 149 | void regcache_cache_bypass(struct regmap *map, bool enable); | 167 | void regcache_cache_bypass(struct regmap *map, bool enable); |
| 150 | void regcache_mark_dirty(struct regmap *map); | 168 | void regcache_mark_dirty(struct regmap *map); |
| 151 | 169 | ||
| 170 | int regmap_register_patch(struct regmap *map, const struct reg_default *regs, | ||
| 171 | int num_regs); | ||
| 172 | |||
| 152 | /** | 173 | /** |
| 153 | * Description of an IRQ for the generic regmap irq_chip. | 174 | * Description of an IRQ for the generic regmap irq_chip. |
| 154 | * | 175 | * |
| @@ -197,4 +218,115 @@ int regmap_add_irq_chip(struct regmap *map, int irq, int irq_flags, | |||
| 197 | void regmap_del_irq_chip(int irq, struct regmap_irq_chip_data *data); | 218 | void regmap_del_irq_chip(int irq, struct regmap_irq_chip_data *data); |
| 198 | int regmap_irq_chip_get_base(struct regmap_irq_chip_data *data); | 219 | int regmap_irq_chip_get_base(struct regmap_irq_chip_data *data); |
| 199 | 220 | ||
| 221 | #else | ||
| 222 | |||
| 223 | /* | ||
| 224 | * These stubs should only ever be called by generic code which has | ||
| 225 | * regmap based facilities, if they ever get called at runtime | ||
| 226 | * something is going wrong and something probably needs to select | ||
| 227 | * REGMAP. | ||
| 228 | */ | ||
| 229 | |||
| 230 | static inline int regmap_write(struct regmap *map, unsigned int reg, | ||
| 231 | unsigned int val) | ||
| 232 | { | ||
| 233 | WARN_ONCE(1, "regmap API is disabled"); | ||
| 234 | return -EINVAL; | ||
| 235 | } | ||
| 236 | |||
| 237 | static inline int regmap_raw_write(struct regmap *map, unsigned int reg, | ||
| 238 | const void *val, size_t val_len) | ||
| 239 | { | ||
| 240 | WARN_ONCE(1, "regmap API is disabled"); | ||
| 241 | return -EINVAL; | ||
| 242 | } | ||
| 243 | |||
| 244 | static inline int regmap_bulk_write(struct regmap *map, unsigned int reg, | ||
| 245 | const void *val, size_t val_count) | ||
| 246 | { | ||
| 247 | WARN_ONCE(1, "regmap API is disabled"); | ||
| 248 | return -EINVAL; | ||
| 249 | } | ||
| 250 | |||
| 251 | static inline int regmap_read(struct regmap *map, unsigned int reg, | ||
| 252 | unsigned int *val) | ||
| 253 | { | ||
| 254 | WARN_ONCE(1, "regmap API is disabled"); | ||
| 255 | return -EINVAL; | ||
| 256 | } | ||
| 257 | |||
| 258 | static inline int regmap_raw_read(struct regmap *map, unsigned int reg, | ||
| 259 | void *val, size_t val_len) | ||
| 260 | { | ||
| 261 | WARN_ONCE(1, "regmap API is disabled"); | ||
| 262 | return -EINVAL; | ||
| 263 | } | ||
| 264 | |||
| 265 | static inline int regmap_bulk_read(struct regmap *map, unsigned int reg, | ||
| 266 | void *val, size_t val_count) | ||
| 267 | { | ||
| 268 | WARN_ONCE(1, "regmap API is disabled"); | ||
| 269 | return -EINVAL; | ||
| 270 | } | ||
| 271 | |||
| 272 | static inline int regmap_update_bits(struct regmap *map, unsigned int reg, | ||
| 273 | unsigned int mask, unsigned int val) | ||
| 274 | { | ||
| 275 | WARN_ONCE(1, "regmap API is disabled"); | ||
| 276 | return -EINVAL; | ||
| 277 | } | ||
| 278 | |||
| 279 | static inline int regmap_update_bits_check(struct regmap *map, | ||
| 280 | unsigned int reg, | ||
| 281 | unsigned int mask, unsigned int val, | ||
| 282 | bool *change) | ||
| 283 | { | ||
| 284 | WARN_ONCE(1, "regmap API is disabled"); | ||
| 285 | return -EINVAL; | ||
| 286 | } | ||
| 287 | |||
| 288 | static inline int regmap_get_val_bytes(struct regmap *map) | ||
| 289 | { | ||
| 290 | WARN_ONCE(1, "regmap API is disabled"); | ||
| 291 | return -EINVAL; | ||
| 292 | } | ||
| 293 | |||
| 294 | static inline int regcache_sync(struct regmap *map) | ||
| 295 | { | ||
| 296 | WARN_ONCE(1, "regmap API is disabled"); | ||
| 297 | return -EINVAL; | ||
| 298 | } | ||
| 299 | |||
| 300 | static inline int regcache_sync_region(struct regmap *map, unsigned int min, | ||
| 301 | unsigned int max) | ||
| 302 | { | ||
| 303 | WARN_ONCE(1, "regmap API is disabled"); | ||
| 304 | return -EINVAL; | ||
| 305 | } | ||
| 306 | |||
| 307 | static inline void regcache_cache_only(struct regmap *map, bool enable) | ||
| 308 | { | ||
| 309 | WARN_ONCE(1, "regmap API is disabled"); | ||
| 310 | } | ||
| 311 | |||
| 312 | static inline void regcache_cache_bypass(struct regmap *map, bool enable) | ||
| 313 | { | ||
| 314 | WARN_ONCE(1, "regmap API is disabled"); | ||
| 315 | } | ||
| 316 | |||
| 317 | static inline void regcache_mark_dirty(struct regmap *map) | ||
| 318 | { | ||
| 319 | WARN_ONCE(1, "regmap API is disabled"); | ||
| 320 | } | ||
| 321 | |||
| 322 | static inline int regmap_register_patch(struct regmap *map, | ||
| 323 | const struct reg_default *regs, | ||
| 324 | int num_regs) | ||
| 325 | { | ||
| 326 | WARN_ONCE(1, "regmap API is disabled"); | ||
| 327 | return -EINVAL; | ||
| 328 | } | ||
| 329 | |||
| 330 | #endif | ||
| 331 | |||
| 200 | #endif | 332 | #endif |
diff --git a/include/linux/regset.h b/include/linux/regset.h index 686f37327a49..8e0c9febf495 100644 --- a/include/linux/regset.h +++ b/include/linux/regset.h | |||
| @@ -15,6 +15,7 @@ | |||
| 15 | 15 | ||
| 16 | #include <linux/compiler.h> | 16 | #include <linux/compiler.h> |
| 17 | #include <linux/types.h> | 17 | #include <linux/types.h> |
| 18 | #include <linux/bug.h> | ||
| 18 | #include <linux/uaccess.h> | 19 | #include <linux/uaccess.h> |
| 19 | struct task_struct; | 20 | struct task_struct; |
| 20 | struct user_regset; | 21 | struct user_regset; |
diff --git a/include/linux/regulator/consumer.h b/include/linux/regulator/consumer.h index f2698a0edfc4..4ed1b30ac5fc 100644 --- a/include/linux/regulator/consumer.h +++ b/include/linux/regulator/consumer.h | |||
| @@ -35,7 +35,8 @@ | |||
| 35 | #ifndef __LINUX_REGULATOR_CONSUMER_H_ | 35 | #ifndef __LINUX_REGULATOR_CONSUMER_H_ |
| 36 | #define __LINUX_REGULATOR_CONSUMER_H_ | 36 | #define __LINUX_REGULATOR_CONSUMER_H_ |
| 37 | 37 | ||
| 38 | #include <linux/device.h> | 38 | struct device; |
| 39 | struct notifier_block; | ||
| 39 | 40 | ||
| 40 | /* | 41 | /* |
| 41 | * Regulator operating modes. | 42 | * Regulator operating modes. |
| @@ -132,9 +133,12 @@ struct regulator_bulk_data { | |||
| 132 | /* regulator get and put */ | 133 | /* regulator get and put */ |
| 133 | struct regulator *__must_check regulator_get(struct device *dev, | 134 | struct regulator *__must_check regulator_get(struct device *dev, |
| 134 | const char *id); | 135 | const char *id); |
| 136 | struct regulator *__must_check devm_regulator_get(struct device *dev, | ||
| 137 | const char *id); | ||
| 135 | struct regulator *__must_check regulator_get_exclusive(struct device *dev, | 138 | struct regulator *__must_check regulator_get_exclusive(struct device *dev, |
| 136 | const char *id); | 139 | const char *id); |
| 137 | void regulator_put(struct regulator *regulator); | 140 | void regulator_put(struct regulator *regulator); |
| 141 | void devm_regulator_put(struct regulator *regulator); | ||
| 138 | 142 | ||
| 139 | /* regulator output control and status */ | 143 | /* regulator output control and status */ |
| 140 | int regulator_enable(struct regulator *regulator); | 144 | int regulator_enable(struct regulator *regulator); |
| @@ -145,6 +149,8 @@ int regulator_disable_deferred(struct regulator *regulator, int ms); | |||
| 145 | 149 | ||
| 146 | int regulator_bulk_get(struct device *dev, int num_consumers, | 150 | int regulator_bulk_get(struct device *dev, int num_consumers, |
| 147 | struct regulator_bulk_data *consumers); | 151 | struct regulator_bulk_data *consumers); |
| 152 | int devm_regulator_bulk_get(struct device *dev, int num_consumers, | ||
| 153 | struct regulator_bulk_data *consumers); | ||
| 148 | int regulator_bulk_enable(int num_consumers, | 154 | int regulator_bulk_enable(int num_consumers, |
| 149 | struct regulator_bulk_data *consumers); | 155 | struct regulator_bulk_data *consumers); |
| 150 | int regulator_bulk_disable(int num_consumers, | 156 | int regulator_bulk_disable(int num_consumers, |
| @@ -200,10 +206,21 @@ static inline struct regulator *__must_check regulator_get(struct device *dev, | |||
| 200 | */ | 206 | */ |
| 201 | return NULL; | 207 | return NULL; |
| 202 | } | 208 | } |
| 209 | |||
| 210 | static inline struct regulator *__must_check | ||
| 211 | devm_regulator_get(struct device *dev, const char *id) | ||
| 212 | { | ||
| 213 | return NULL; | ||
| 214 | } | ||
| 215 | |||
| 203 | static inline void regulator_put(struct regulator *regulator) | 216 | static inline void regulator_put(struct regulator *regulator) |
| 204 | { | 217 | { |
| 205 | } | 218 | } |
| 206 | 219 | ||
| 220 | static inline void devm_regulator_put(struct regulator *regulator) | ||
| 221 | { | ||
| 222 | } | ||
| 223 | |||
| 207 | static inline int regulator_enable(struct regulator *regulator) | 224 | static inline int regulator_enable(struct regulator *regulator) |
| 208 | { | 225 | { |
| 209 | return 0; | 226 | return 0; |
| @@ -237,6 +254,12 @@ static inline int regulator_bulk_get(struct device *dev, | |||
| 237 | return 0; | 254 | return 0; |
| 238 | } | 255 | } |
| 239 | 256 | ||
| 257 | static inline int devm_regulator_bulk_get(struct device *dev, int num_consumers, | ||
| 258 | struct regulator_bulk_data *consumers) | ||
| 259 | { | ||
| 260 | return 0; | ||
| 261 | } | ||
| 262 | |||
| 240 | static inline int regulator_bulk_enable(int num_consumers, | 263 | static inline int regulator_bulk_enable(int num_consumers, |
| 241 | struct regulator_bulk_data *consumers) | 264 | struct regulator_bulk_data *consumers) |
| 242 | { | 265 | { |
diff --git a/include/linux/regulator/driver.h b/include/linux/regulator/driver.h index 4214b9a9d1c9..fa8b55b8191c 100644 --- a/include/linux/regulator/driver.h +++ b/include/linux/regulator/driver.h | |||
| @@ -104,7 +104,7 @@ struct regulator_ops { | |||
| 104 | int (*disable) (struct regulator_dev *); | 104 | int (*disable) (struct regulator_dev *); |
| 105 | int (*is_enabled) (struct regulator_dev *); | 105 | int (*is_enabled) (struct regulator_dev *); |
| 106 | 106 | ||
| 107 | /* get/set regulator operating mode (defined in regulator.h) */ | 107 | /* get/set regulator operating mode (defined in consumer.h) */ |
| 108 | int (*set_mode) (struct regulator_dev *, unsigned int mode); | 108 | int (*set_mode) (struct regulator_dev *, unsigned int mode); |
| 109 | unsigned int (*get_mode) (struct regulator_dev *); | 109 | unsigned int (*get_mode) (struct regulator_dev *); |
| 110 | 110 | ||
| @@ -135,7 +135,7 @@ struct regulator_ops { | |||
| 135 | int (*set_suspend_enable) (struct regulator_dev *); | 135 | int (*set_suspend_enable) (struct regulator_dev *); |
| 136 | int (*set_suspend_disable) (struct regulator_dev *); | 136 | int (*set_suspend_disable) (struct regulator_dev *); |
| 137 | 137 | ||
| 138 | /* set regulator suspend operating mode (defined in regulator.h) */ | 138 | /* set regulator suspend operating mode (defined in consumer.h) */ |
| 139 | int (*set_suspend_mode) (struct regulator_dev *, unsigned int mode); | 139 | int (*set_suspend_mode) (struct regulator_dev *, unsigned int mode); |
| 140 | }; | 140 | }; |
| 141 | 141 | ||
| @@ -207,9 +207,7 @@ struct regulator_dev { | |||
| 207 | 207 | ||
| 208 | void *reg_data; /* regulator_dev data */ | 208 | void *reg_data; /* regulator_dev data */ |
| 209 | 209 | ||
| 210 | #ifdef CONFIG_DEBUG_FS | ||
| 211 | struct dentry *debugfs; | 210 | struct dentry *debugfs; |
| 212 | #endif | ||
| 213 | }; | 211 | }; |
| 214 | 212 | ||
| 215 | struct regulator_dev *regulator_register(struct regulator_desc *regulator_desc, | 213 | struct regulator_dev *regulator_register(struct regulator_desc *regulator_desc, |
diff --git a/include/linux/regulator/fixed.h b/include/linux/regulator/fixed.h index ffd7d508e726..936a7d8c11a9 100644 --- a/include/linux/regulator/fixed.h +++ b/include/linux/regulator/fixed.h | |||
| @@ -48,4 +48,17 @@ struct fixed_voltage_config { | |||
| 48 | struct regulator_init_data *init_data; | 48 | struct regulator_init_data *init_data; |
| 49 | }; | 49 | }; |
| 50 | 50 | ||
| 51 | struct regulator_consumer_supply; | ||
| 52 | |||
| 53 | #if IS_ENABLED(CONFIG_REGULATOR) | ||
| 54 | struct platform_device *regulator_register_fixed(int id, | ||
| 55 | struct regulator_consumer_supply *supplies, int num_supplies); | ||
| 56 | #else | ||
| 57 | static inline struct platform_device *regulator_register_fixed(int id, | ||
| 58 | struct regulator_consumer_supply *supplies, int num_supplies) | ||
| 59 | { | ||
| 60 | return NULL; | ||
| 61 | } | ||
| 62 | #endif | ||
| 63 | |||
| 51 | #endif | 64 | #endif |
diff --git a/include/linux/regulator/machine.h b/include/linux/regulator/machine.h index f3f13fd5868f..7abb16093312 100644 --- a/include/linux/regulator/machine.h +++ b/include/linux/regulator/machine.h | |||
| @@ -139,12 +139,10 @@ struct regulation_constraints { | |||
| 139 | * make struct device available late such as I2C and is the preferred | 139 | * make struct device available late such as I2C and is the preferred |
| 140 | * form. | 140 | * form. |
| 141 | * | 141 | * |
| 142 | * @dev: Device structure for the consumer. | ||
| 143 | * @dev_name: Result of dev_name() for the consumer. | 142 | * @dev_name: Result of dev_name() for the consumer. |
| 144 | * @supply: Name for the supply. | 143 | * @supply: Name for the supply. |
| 145 | */ | 144 | */ |
| 146 | struct regulator_consumer_supply { | 145 | struct regulator_consumer_supply { |
| 147 | struct device *dev; /* consumer */ | ||
| 148 | const char *dev_name; /* dev_name() for consumer */ | 146 | const char *dev_name; /* dev_name() for consumer */ |
| 149 | const char *supply; /* consumer supply - e.g. "vcc" */ | 147 | const char *supply; /* consumer supply - e.g. "vcc" */ |
| 150 | }; | 148 | }; |
diff --git a/include/linux/regulator/tps62360.h b/include/linux/regulator/tps62360.h new file mode 100644 index 000000000000..6a5c1b2c751e --- /dev/null +++ b/include/linux/regulator/tps62360.h | |||
| @@ -0,0 +1,57 @@ | |||
| 1 | /* | ||
| 2 | * tps62360.h -- TI tps62360 | ||
| 3 | * | ||
| 4 | * Interface for regulator driver for TI TPS62360 Processor core supply | ||
| 5 | * | ||
| 6 | * Copyright (C) 2012 NVIDIA Corporation | ||
| 7 | |||
| 8 | * Author: Laxman Dewangan <ldewangan@nvidia.com> | ||
| 9 | * | ||
| 10 | * This program is free software; you can redistribute it and/or modify | ||
| 11 | * it under the terms of the GNU General Public License as published by | ||
| 12 | * the Free Software Foundation; either version 2 of the License, or | ||
| 13 | * (at your option) any later version. | ||
| 14 | * | ||
| 15 | * This program is distributed in the hope that it will be useful, but WITHOUT | ||
| 16 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
| 17 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for | ||
| 18 | * more details. | ||
| 19 | * | ||
| 20 | * You should have received a copy of the GNU General Public License along | ||
| 21 | * with this program; if not, write to the Free Software Foundation, Inc., | ||
| 22 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | ||
| 23 | * | ||
| 24 | */ | ||
| 25 | |||
| 26 | #ifndef __LINUX_REGULATOR_TPS62360_H | ||
| 27 | #define __LINUX_REGULATOR_TPS62360_H | ||
| 28 | |||
| 29 | #include <linux/regulator/machine.h> | ||
| 30 | |||
| 31 | /* | ||
| 32 | * struct tps62360_regulator_platform_data - tps62360 regulator platform data. | ||
| 33 | * | ||
| 34 | * @reg_init_data: The regulator init data. | ||
| 35 | * @en_force_pwm: Enable force pwm or not. | ||
| 36 | * @en_discharge: Enable discharge the output capacitor via internal | ||
| 37 | * register. | ||
| 38 | * @en_internal_pulldn: internal pull down enable or not. | ||
| 39 | * @vsel0_gpio: Gpio number for vsel0. It should be -1 if this is tied with | ||
| 40 | * fixed logic. | ||
| 41 | * @vsel1_gpio: Gpio number for vsel1. It should be -1 if this is tied with | ||
| 42 | * fixed logic. | ||
| 43 | * @vsel0_def_state: Default state of vsel0. 1 if it is high else 0. | ||
| 44 | * @vsel1_def_state: Default state of vsel1. 1 if it is high else 0. | ||
| 45 | */ | ||
| 46 | struct tps62360_regulator_platform_data { | ||
| 47 | struct regulator_init_data reg_init_data; | ||
| 48 | bool en_force_pwm; | ||
| 49 | bool en_discharge; | ||
| 50 | bool en_internal_pulldn; | ||
| 51 | int vsel0_gpio; | ||
| 52 | int vsel1_gpio; | ||
| 53 | int vsel0_def_state; | ||
| 54 | int vsel1_def_state; | ||
| 55 | }; | ||
| 56 | |||
| 57 | #endif /* __LINUX_REGULATOR_TPS62360_H */ | ||
diff --git a/include/linux/reiserfs_acl.h b/include/linux/reiserfs_acl.h deleted file mode 100644 index f096b80e73d8..000000000000 --- a/include/linux/reiserfs_acl.h +++ /dev/null | |||
| @@ -1,76 +0,0 @@ | |||
| 1 | #include <linux/init.h> | ||
| 2 | #include <linux/posix_acl.h> | ||
| 3 | |||
| 4 | #define REISERFS_ACL_VERSION 0x0001 | ||
| 5 | |||
| 6 | typedef struct { | ||
| 7 | __le16 e_tag; | ||
| 8 | __le16 e_perm; | ||
| 9 | __le32 e_id; | ||
| 10 | } reiserfs_acl_entry; | ||
| 11 | |||
| 12 | typedef struct { | ||
| 13 | __le16 e_tag; | ||
| 14 | __le16 e_perm; | ||
| 15 | } reiserfs_acl_entry_short; | ||
| 16 | |||
| 17 | typedef struct { | ||
| 18 | __le32 a_version; | ||
| 19 | } reiserfs_acl_header; | ||
| 20 | |||
| 21 | static inline size_t reiserfs_acl_size(int count) | ||
| 22 | { | ||
| 23 | if (count <= 4) { | ||
| 24 | return sizeof(reiserfs_acl_header) + | ||
| 25 | count * sizeof(reiserfs_acl_entry_short); | ||
| 26 | } else { | ||
| 27 | return sizeof(reiserfs_acl_header) + | ||
| 28 | 4 * sizeof(reiserfs_acl_entry_short) + | ||
| 29 | (count - 4) * sizeof(reiserfs_acl_entry); | ||
| 30 | } | ||
| 31 | } | ||
| 32 | |||
| 33 | static inline int reiserfs_acl_count(size_t size) | ||
| 34 | { | ||
| 35 | ssize_t s; | ||
| 36 | size -= sizeof(reiserfs_acl_header); | ||
| 37 | s = size - 4 * sizeof(reiserfs_acl_entry_short); | ||
| 38 | if (s < 0) { | ||
| 39 | if (size % sizeof(reiserfs_acl_entry_short)) | ||
| 40 | return -1; | ||
| 41 | return size / sizeof(reiserfs_acl_entry_short); | ||
| 42 | } else { | ||
| 43 | if (s % sizeof(reiserfs_acl_entry)) | ||
| 44 | return -1; | ||
| 45 | return s / sizeof(reiserfs_acl_entry) + 4; | ||
| 46 | } | ||
| 47 | } | ||
| 48 | |||
| 49 | #ifdef CONFIG_REISERFS_FS_POSIX_ACL | ||
| 50 | struct posix_acl *reiserfs_get_acl(struct inode *inode, int type); | ||
| 51 | int reiserfs_acl_chmod(struct inode *inode); | ||
| 52 | int reiserfs_inherit_default_acl(struct reiserfs_transaction_handle *th, | ||
| 53 | struct inode *dir, struct dentry *dentry, | ||
| 54 | struct inode *inode); | ||
| 55 | int reiserfs_cache_default_acl(struct inode *dir); | ||
| 56 | extern const struct xattr_handler reiserfs_posix_acl_default_handler; | ||
| 57 | extern const struct xattr_handler reiserfs_posix_acl_access_handler; | ||
| 58 | |||
| 59 | #else | ||
| 60 | |||
| 61 | #define reiserfs_cache_default_acl(inode) 0 | ||
| 62 | #define reiserfs_get_acl NULL | ||
| 63 | |||
| 64 | static inline int reiserfs_acl_chmod(struct inode *inode) | ||
| 65 | { | ||
| 66 | return 0; | ||
| 67 | } | ||
| 68 | |||
| 69 | static inline int | ||
| 70 | reiserfs_inherit_default_acl(struct reiserfs_transaction_handle *th, | ||
| 71 | const struct inode *dir, struct dentry *dentry, | ||
| 72 | struct inode *inode) | ||
| 73 | { | ||
| 74 | return 0; | ||
| 75 | } | ||
| 76 | #endif | ||
diff --git a/include/linux/reiserfs_fs.h b/include/linux/reiserfs_fs.h index 2213ddcce20c..ea3700cd7367 100644 --- a/include/linux/reiserfs_fs.h +++ b/include/linux/reiserfs_fs.h | |||
| @@ -1,32 +1,12 @@ | |||
| 1 | /* | 1 | /* |
| 2 | * Copyright 1996, 1997, 1998 Hans Reiser, see reiserfs/README for licensing and copyright details | 2 | * Copyright 1996, 1997, 1998 Hans Reiser, see reiserfs/README for licensing and copyright details |
| 3 | */ | 3 | */ |
| 4 | |||
| 5 | /* this file has an amazingly stupid | ||
| 6 | name, yura please fix it to be | ||
| 7 | reiserfs.h, and merge all the rest | ||
| 8 | of our .h files that are in this | ||
| 9 | directory into it. */ | ||
| 10 | |||
| 11 | #ifndef _LINUX_REISER_FS_H | 4 | #ifndef _LINUX_REISER_FS_H |
| 12 | #define _LINUX_REISER_FS_H | 5 | #define _LINUX_REISER_FS_H |
| 13 | 6 | ||
| 14 | #include <linux/types.h> | 7 | #include <linux/types.h> |
| 15 | #include <linux/magic.h> | 8 | #include <linux/magic.h> |
| 16 | 9 | ||
| 17 | #ifdef __KERNEL__ | ||
| 18 | #include <linux/slab.h> | ||
| 19 | #include <linux/interrupt.h> | ||
| 20 | #include <linux/sched.h> | ||
| 21 | #include <linux/workqueue.h> | ||
| 22 | #include <asm/unaligned.h> | ||
| 23 | #include <linux/bitops.h> | ||
| 24 | #include <linux/proc_fs.h> | ||
| 25 | #include <linux/buffer_head.h> | ||
| 26 | #include <linux/reiserfs_fs_i.h> | ||
| 27 | #include <linux/reiserfs_fs_sb.h> | ||
| 28 | #endif | ||
| 29 | |||
| 30 | /* | 10 | /* |
| 31 | * include/linux/reiser_fs.h | 11 | * include/linux/reiser_fs.h |
| 32 | * | 12 | * |
| @@ -43,2318 +23,4 @@ | |||
| 43 | #define REISERFS_IOC_GETVERSION FS_IOC_GETVERSION | 23 | #define REISERFS_IOC_GETVERSION FS_IOC_GETVERSION |
| 44 | #define REISERFS_IOC_SETVERSION FS_IOC_SETVERSION | 24 | #define REISERFS_IOC_SETVERSION FS_IOC_SETVERSION |
| 45 | 25 | ||
| 46 | #ifdef __KERNEL__ | ||
| 47 | /* the 32 bit compat definitions with int argument */ | ||
| 48 | #define REISERFS_IOC32_UNPACK _IOW(0xCD, 1, int) | ||
| 49 | #define REISERFS_IOC32_GETFLAGS FS_IOC32_GETFLAGS | ||
| 50 | #define REISERFS_IOC32_SETFLAGS FS_IOC32_SETFLAGS | ||
| 51 | #define REISERFS_IOC32_GETVERSION FS_IOC32_GETVERSION | ||
| 52 | #define REISERFS_IOC32_SETVERSION FS_IOC32_SETVERSION | ||
| 53 | |||
| 54 | /* | ||
| 55 | * Locking primitives. The write lock is a per superblock | ||
| 56 | * special mutex that has properties close to the Big Kernel Lock | ||
| 57 | * which was used in the previous locking scheme. | ||
| 58 | */ | ||
| 59 | void reiserfs_write_lock(struct super_block *s); | ||
| 60 | void reiserfs_write_unlock(struct super_block *s); | ||
| 61 | int reiserfs_write_lock_once(struct super_block *s); | ||
| 62 | void reiserfs_write_unlock_once(struct super_block *s, int lock_depth); | ||
| 63 | |||
| 64 | #ifdef CONFIG_REISERFS_CHECK | ||
| 65 | void reiserfs_lock_check_recursive(struct super_block *s); | ||
| 66 | #else | ||
| 67 | static inline void reiserfs_lock_check_recursive(struct super_block *s) { } | ||
| 68 | #endif | ||
| 69 | |||
| 70 | /* | ||
| 71 | * Several mutexes depend on the write lock. | ||
| 72 | * However sometimes we want to relax the write lock while we hold | ||
| 73 | * these mutexes, according to the release/reacquire on schedule() | ||
| 74 | * properties of the Bkl that were used. | ||
| 75 | * Reiserfs performances and locking were based on this scheme. | ||
| 76 | * Now that the write lock is a mutex and not the bkl anymore, doing so | ||
| 77 | * may result in a deadlock: | ||
| 78 | * | ||
| 79 | * A acquire write_lock | ||
| 80 | * A acquire j_commit_mutex | ||
| 81 | * A release write_lock and wait for something | ||
| 82 | * B acquire write_lock | ||
| 83 | * B can't acquire j_commit_mutex and sleep | ||
| 84 | * A can't acquire write lock anymore | ||
| 85 | * deadlock | ||
| 86 | * | ||
| 87 | * What we do here is avoiding such deadlock by playing the same game | ||
| 88 | * than the Bkl: if we can't acquire a mutex that depends on the write lock, | ||
| 89 | * we release the write lock, wait a bit and then retry. | ||
| 90 | * | ||
| 91 | * The mutexes concerned by this hack are: | ||
| 92 | * - The commit mutex of a journal list | ||
| 93 | * - The flush mutex | ||
| 94 | * - The journal lock | ||
| 95 | * - The inode mutex | ||
| 96 | */ | ||
| 97 | static inline void reiserfs_mutex_lock_safe(struct mutex *m, | ||
| 98 | struct super_block *s) | ||
| 99 | { | ||
| 100 | reiserfs_lock_check_recursive(s); | ||
| 101 | reiserfs_write_unlock(s); | ||
| 102 | mutex_lock(m); | ||
| 103 | reiserfs_write_lock(s); | ||
| 104 | } | ||
| 105 | |||
| 106 | static inline void | ||
| 107 | reiserfs_mutex_lock_nested_safe(struct mutex *m, unsigned int subclass, | ||
| 108 | struct super_block *s) | ||
| 109 | { | ||
| 110 | reiserfs_lock_check_recursive(s); | ||
| 111 | reiserfs_write_unlock(s); | ||
| 112 | mutex_lock_nested(m, subclass); | ||
| 113 | reiserfs_write_lock(s); | ||
| 114 | } | ||
| 115 | |||
| 116 | static inline void | ||
| 117 | reiserfs_down_read_safe(struct rw_semaphore *sem, struct super_block *s) | ||
| 118 | { | ||
| 119 | reiserfs_lock_check_recursive(s); | ||
| 120 | reiserfs_write_unlock(s); | ||
| 121 | down_read(sem); | ||
| 122 | reiserfs_write_lock(s); | ||
| 123 | } | ||
| 124 | |||
| 125 | /* | ||
| 126 | * When we schedule, we usually want to also release the write lock, | ||
| 127 | * according to the previous bkl based locking scheme of reiserfs. | ||
| 128 | */ | ||
| 129 | static inline void reiserfs_cond_resched(struct super_block *s) | ||
| 130 | { | ||
| 131 | if (need_resched()) { | ||
| 132 | reiserfs_write_unlock(s); | ||
| 133 | schedule(); | ||
| 134 | reiserfs_write_lock(s); | ||
| 135 | } | ||
| 136 | } | ||
| 137 | |||
| 138 | struct fid; | ||
| 139 | |||
| 140 | /* in reading the #defines, it may help to understand that they employ | ||
| 141 | the following abbreviations: | ||
| 142 | |||
| 143 | B = Buffer | ||
| 144 | I = Item header | ||
| 145 | H = Height within the tree (should be changed to LEV) | ||
| 146 | N = Number of the item in the node | ||
| 147 | STAT = stat data | ||
| 148 | DEH = Directory Entry Header | ||
| 149 | EC = Entry Count | ||
| 150 | E = Entry number | ||
| 151 | UL = Unsigned Long | ||
| 152 | BLKH = BLocK Header | ||
| 153 | UNFM = UNForMatted node | ||
| 154 | DC = Disk Child | ||
| 155 | P = Path | ||
| 156 | |||
| 157 | These #defines are named by concatenating these abbreviations, | ||
| 158 | where first comes the arguments, and last comes the return value, | ||
| 159 | of the macro. | ||
| 160 | |||
| 161 | */ | ||
| 162 | |||
| 163 | #define USE_INODE_GENERATION_COUNTER | ||
| 164 | |||
| 165 | #define REISERFS_PREALLOCATE | ||
| 166 | #define DISPLACE_NEW_PACKING_LOCALITIES | ||
| 167 | #define PREALLOCATION_SIZE 9 | ||
| 168 | |||
| 169 | /* n must be power of 2 */ | ||
| 170 | #define _ROUND_UP(x,n) (((x)+(n)-1u) & ~((n)-1u)) | ||
| 171 | |||
| 172 | // to be ok for alpha and others we have to align structures to 8 byte | ||
| 173 | // boundary. | ||
| 174 | // FIXME: do not change 4 by anything else: there is code which relies on that | ||
| 175 | #define ROUND_UP(x) _ROUND_UP(x,8LL) | ||
| 176 | |||
| 177 | /* debug levels. Right now, CONFIG_REISERFS_CHECK means print all debug | ||
| 178 | ** messages. | ||
| 179 | */ | ||
| 180 | #define REISERFS_DEBUG_CODE 5 /* extra messages to help find/debug errors */ | ||
| 181 | |||
| 182 | void __reiserfs_warning(struct super_block *s, const char *id, | ||
| 183 | const char *func, const char *fmt, ...); | ||
| 184 | #define reiserfs_warning(s, id, fmt, args...) \ | ||
| 185 | __reiserfs_warning(s, id, __func__, fmt, ##args) | ||
| 186 | /* assertions handling */ | ||
| 187 | |||
| 188 | /** always check a condition and panic if it's false. */ | ||
| 189 | #define __RASSERT(cond, scond, format, args...) \ | ||
| 190 | do { \ | ||
| 191 | if (!(cond)) \ | ||
| 192 | reiserfs_panic(NULL, "assertion failure", "(" #cond ") at " \ | ||
| 193 | __FILE__ ":%i:%s: " format "\n", \ | ||
| 194 | in_interrupt() ? -1 : task_pid_nr(current), \ | ||
| 195 | __LINE__, __func__ , ##args); \ | ||
| 196 | } while (0) | ||
| 197 | |||
| 198 | #define RASSERT(cond, format, args...) __RASSERT(cond, #cond, format, ##args) | ||
| 199 | |||
| 200 | #if defined( CONFIG_REISERFS_CHECK ) | ||
| 201 | #define RFALSE(cond, format, args...) __RASSERT(!(cond), "!(" #cond ")", format, ##args) | ||
| 202 | #else | ||
| 203 | #define RFALSE( cond, format, args... ) do {;} while( 0 ) | ||
| 204 | #endif | ||
| 205 | |||
| 206 | #define CONSTF __attribute_const__ | ||
| 207 | /* | ||
| 208 | * Disk Data Structures | ||
| 209 | */ | ||
| 210 | |||
| 211 | /***************************************************************************/ | ||
| 212 | /* SUPER BLOCK */ | ||
| 213 | /***************************************************************************/ | ||
| 214 | |||
| 215 | /* | ||
| 216 | * Structure of super block on disk, a version of which in RAM is often accessed as REISERFS_SB(s)->s_rs | ||
| 217 | * the version in RAM is part of a larger structure containing fields never written to disk. | ||
| 218 | */ | ||
| 219 | #define UNSET_HASH 0 // read_super will guess about, what hash names | ||
| 220 | // in directories were sorted with | ||
| 221 | #define TEA_HASH 1 | ||
| 222 | #define YURA_HASH 2 | ||
| 223 | #define R5_HASH 3 | ||
| 224 | #define DEFAULT_HASH R5_HASH | ||
| 225 | |||
| 226 | struct journal_params { | ||
| 227 | __le32 jp_journal_1st_block; /* where does journal start from on its | ||
| 228 | * device */ | ||
| 229 | __le32 jp_journal_dev; /* journal device st_rdev */ | ||
| 230 | __le32 jp_journal_size; /* size of the journal */ | ||
| 231 | __le32 jp_journal_trans_max; /* max number of blocks in a transaction. */ | ||
| 232 | __le32 jp_journal_magic; /* random value made on fs creation (this | ||
| 233 | * was sb_journal_block_count) */ | ||
| 234 | __le32 jp_journal_max_batch; /* max number of blocks to batch into a | ||
| 235 | * trans */ | ||
| 236 | __le32 jp_journal_max_commit_age; /* in seconds, how old can an async | ||
| 237 | * commit be */ | ||
| 238 | __le32 jp_journal_max_trans_age; /* in seconds, how old can a transaction | ||
| 239 | * be */ | ||
| 240 | }; | ||
| 241 | |||
| 242 | /* this is the super from 3.5.X, where X >= 10 */ | ||
| 243 | struct reiserfs_super_block_v1 { | ||
| 244 | __le32 s_block_count; /* blocks count */ | ||
| 245 | __le32 s_free_blocks; /* free blocks count */ | ||
| 246 | __le32 s_root_block; /* root block number */ | ||
| 247 | struct journal_params s_journal; | ||
| 248 | __le16 s_blocksize; /* block size */ | ||
| 249 | __le16 s_oid_maxsize; /* max size of object id array, see | ||
| 250 | * get_objectid() commentary */ | ||
| 251 | __le16 s_oid_cursize; /* current size of object id array */ | ||
| 252 | __le16 s_umount_state; /* this is set to 1 when filesystem was | ||
| 253 | * umounted, to 2 - when not */ | ||
| 254 | char s_magic[10]; /* reiserfs magic string indicates that | ||
| 255 | * file system is reiserfs: | ||
| 256 | * "ReIsErFs" or "ReIsEr2Fs" or "ReIsEr3Fs" */ | ||
| 257 | __le16 s_fs_state; /* it is set to used by fsck to mark which | ||
| 258 | * phase of rebuilding is done */ | ||
| 259 | __le32 s_hash_function_code; /* indicate, what hash function is being use | ||
| 260 | * to sort names in a directory*/ | ||
| 261 | __le16 s_tree_height; /* height of disk tree */ | ||
| 262 | __le16 s_bmap_nr; /* amount of bitmap blocks needed to address | ||
| 263 | * each block of file system */ | ||
| 264 | __le16 s_version; /* this field is only reliable on filesystem | ||
| 265 | * with non-standard journal */ | ||
| 266 | __le16 s_reserved_for_journal; /* size in blocks of journal area on main | ||
| 267 | * device, we need to keep after | ||
| 268 | * making fs with non-standard journal */ | ||
| 269 | } __attribute__ ((__packed__)); | ||
| 270 | |||
| 271 | #define SB_SIZE_V1 (sizeof(struct reiserfs_super_block_v1)) | ||
| 272 | |||
| 273 | /* this is the on disk super block */ | ||
| 274 | struct reiserfs_super_block { | ||
| 275 | struct reiserfs_super_block_v1 s_v1; | ||
| 276 | __le32 s_inode_generation; | ||
| 277 | __le32 s_flags; /* Right now used only by inode-attributes, if enabled */ | ||
| 278 | unsigned char s_uuid[16]; /* filesystem unique identifier */ | ||
| 279 | unsigned char s_label[16]; /* filesystem volume label */ | ||
| 280 | __le16 s_mnt_count; /* Count of mounts since last fsck */ | ||
| 281 | __le16 s_max_mnt_count; /* Maximum mounts before check */ | ||
| 282 | __le32 s_lastcheck; /* Timestamp of last fsck */ | ||
| 283 | __le32 s_check_interval; /* Interval between checks */ | ||
| 284 | char s_unused[76]; /* zero filled by mkreiserfs and | ||
| 285 | * reiserfs_convert_objectid_map_v1() | ||
| 286 | * so any additions must be updated | ||
| 287 | * there as well. */ | ||
| 288 | } __attribute__ ((__packed__)); | ||
| 289 | |||
| 290 | #define SB_SIZE (sizeof(struct reiserfs_super_block)) | ||
| 291 | |||
| 292 | #define REISERFS_VERSION_1 0 | ||
| 293 | #define REISERFS_VERSION_2 2 | ||
| 294 | |||
| 295 | // on-disk super block fields converted to cpu form | ||
| 296 | #define SB_DISK_SUPER_BLOCK(s) (REISERFS_SB(s)->s_rs) | ||
| 297 | #define SB_V1_DISK_SUPER_BLOCK(s) (&(SB_DISK_SUPER_BLOCK(s)->s_v1)) | ||
| 298 | #define SB_BLOCKSIZE(s) \ | ||
| 299 | le32_to_cpu ((SB_V1_DISK_SUPER_BLOCK(s)->s_blocksize)) | ||
| 300 | #define SB_BLOCK_COUNT(s) \ | ||
| 301 | le32_to_cpu ((SB_V1_DISK_SUPER_BLOCK(s)->s_block_count)) | ||
| 302 | #define SB_FREE_BLOCKS(s) \ | ||
| 303 | le32_to_cpu ((SB_V1_DISK_SUPER_BLOCK(s)->s_free_blocks)) | ||
| 304 | #define SB_REISERFS_MAGIC(s) \ | ||
| 305 | (SB_V1_DISK_SUPER_BLOCK(s)->s_magic) | ||
| 306 | #define SB_ROOT_BLOCK(s) \ | ||
| 307 | le32_to_cpu ((SB_V1_DISK_SUPER_BLOCK(s)->s_root_block)) | ||
| 308 | #define SB_TREE_HEIGHT(s) \ | ||
| 309 | le16_to_cpu ((SB_V1_DISK_SUPER_BLOCK(s)->s_tree_height)) | ||
| 310 | #define SB_REISERFS_STATE(s) \ | ||
| 311 | le16_to_cpu ((SB_V1_DISK_SUPER_BLOCK(s)->s_umount_state)) | ||
| 312 | #define SB_VERSION(s) le16_to_cpu ((SB_V1_DISK_SUPER_BLOCK(s)->s_version)) | ||
| 313 | #define SB_BMAP_NR(s) le16_to_cpu ((SB_V1_DISK_SUPER_BLOCK(s)->s_bmap_nr)) | ||
| 314 | |||
| 315 | #define PUT_SB_BLOCK_COUNT(s, val) \ | ||
| 316 | do { SB_V1_DISK_SUPER_BLOCK(s)->s_block_count = cpu_to_le32(val); } while (0) | ||
| 317 | #define PUT_SB_FREE_BLOCKS(s, val) \ | ||
| 318 | do { SB_V1_DISK_SUPER_BLOCK(s)->s_free_blocks = cpu_to_le32(val); } while (0) | ||
| 319 | #define PUT_SB_ROOT_BLOCK(s, val) \ | ||
| 320 | do { SB_V1_DISK_SUPER_BLOCK(s)->s_root_block = cpu_to_le32(val); } while (0) | ||
| 321 | #define PUT_SB_TREE_HEIGHT(s, val) \ | ||
| 322 | do { SB_V1_DISK_SUPER_BLOCK(s)->s_tree_height = cpu_to_le16(val); } while (0) | ||
| 323 | #define PUT_SB_REISERFS_STATE(s, val) \ | ||
| 324 | do { SB_V1_DISK_SUPER_BLOCK(s)->s_umount_state = cpu_to_le16(val); } while (0) | ||
| 325 | #define PUT_SB_VERSION(s, val) \ | ||
| 326 | do { SB_V1_DISK_SUPER_BLOCK(s)->s_version = cpu_to_le16(val); } while (0) | ||
| 327 | #define PUT_SB_BMAP_NR(s, val) \ | ||
| 328 | do { SB_V1_DISK_SUPER_BLOCK(s)->s_bmap_nr = cpu_to_le16 (val); } while (0) | ||
| 329 | |||
| 330 | #define SB_ONDISK_JP(s) (&SB_V1_DISK_SUPER_BLOCK(s)->s_journal) | ||
| 331 | #define SB_ONDISK_JOURNAL_SIZE(s) \ | ||
| 332 | le32_to_cpu ((SB_ONDISK_JP(s)->jp_journal_size)) | ||
| 333 | #define SB_ONDISK_JOURNAL_1st_BLOCK(s) \ | ||
| 334 | le32_to_cpu ((SB_ONDISK_JP(s)->jp_journal_1st_block)) | ||
| 335 | #define SB_ONDISK_JOURNAL_DEVICE(s) \ | ||
| 336 | le32_to_cpu ((SB_ONDISK_JP(s)->jp_journal_dev)) | ||
| 337 | #define SB_ONDISK_RESERVED_FOR_JOURNAL(s) \ | ||
| 338 | le16_to_cpu ((SB_V1_DISK_SUPER_BLOCK(s)->s_reserved_for_journal)) | ||
| 339 | |||
| 340 | #define is_block_in_log_or_reserved_area(s, block) \ | ||
| 341 | block >= SB_JOURNAL_1st_RESERVED_BLOCK(s) \ | ||
| 342 | && block < SB_JOURNAL_1st_RESERVED_BLOCK(s) + \ | ||
| 343 | ((!is_reiserfs_jr(SB_DISK_SUPER_BLOCK(s)) ? \ | ||
| 344 | SB_ONDISK_JOURNAL_SIZE(s) + 1 : SB_ONDISK_RESERVED_FOR_JOURNAL(s))) | ||
| 345 | |||
| 346 | int is_reiserfs_3_5(struct reiserfs_super_block *rs); | ||
| 347 | int is_reiserfs_3_6(struct reiserfs_super_block *rs); | ||
| 348 | int is_reiserfs_jr(struct reiserfs_super_block *rs); | ||
| 349 | |||
| 350 | /* ReiserFS leaves the first 64k unused, so that partition labels have | ||
| 351 | enough space. If someone wants to write a fancy bootloader that | ||
| 352 | needs more than 64k, let us know, and this will be increased in size. | ||
| 353 | This number must be larger than than the largest block size on any | ||
| 354 | platform, or code will break. -Hans */ | ||
| 355 | #define REISERFS_DISK_OFFSET_IN_BYTES (64 * 1024) | ||
| 356 | #define REISERFS_FIRST_BLOCK unused_define | ||
| 357 | #define REISERFS_JOURNAL_OFFSET_IN_BYTES REISERFS_DISK_OFFSET_IN_BYTES | ||
| 358 | |||
| 359 | /* the spot for the super in versions 3.5 - 3.5.10 (inclusive) */ | ||
| 360 | #define REISERFS_OLD_DISK_OFFSET_IN_BYTES (8 * 1024) | ||
| 361 | |||
| 362 | /* reiserfs internal error code (used by search_by_key and fix_nodes)) */ | ||
| 363 | #define CARRY_ON 0 | ||
| 364 | #define REPEAT_SEARCH -1 | ||
| 365 | #define IO_ERROR -2 | ||
| 366 | #define NO_DISK_SPACE -3 | ||
| 367 | #define NO_BALANCING_NEEDED (-4) | ||
| 368 | #define NO_MORE_UNUSED_CONTIGUOUS_BLOCKS (-5) | ||
| 369 | #define QUOTA_EXCEEDED -6 | ||
| 370 | |||
| 371 | typedef __u32 b_blocknr_t; | ||
| 372 | typedef __le32 unp_t; | ||
| 373 | |||
| 374 | struct unfm_nodeinfo { | ||
| 375 | unp_t unfm_nodenum; | ||
| 376 | unsigned short unfm_freespace; | ||
| 377 | }; | ||
| 378 | |||
| 379 | /* there are two formats of keys: 3.5 and 3.6 | ||
| 380 | */ | ||
| 381 | #define KEY_FORMAT_3_5 0 | ||
| 382 | #define KEY_FORMAT_3_6 1 | ||
| 383 | |||
| 384 | /* there are two stat datas */ | ||
| 385 | #define STAT_DATA_V1 0 | ||
| 386 | #define STAT_DATA_V2 1 | ||
| 387 | |||
| 388 | static inline struct reiserfs_inode_info *REISERFS_I(const struct inode *inode) | ||
| 389 | { | ||
| 390 | return container_of(inode, struct reiserfs_inode_info, vfs_inode); | ||
| 391 | } | ||
| 392 | |||
| 393 | static inline struct reiserfs_sb_info *REISERFS_SB(const struct super_block *sb) | ||
| 394 | { | ||
| 395 | return sb->s_fs_info; | ||
| 396 | } | ||
| 397 | |||
| 398 | /* Don't trust REISERFS_SB(sb)->s_bmap_nr, it's a u16 | ||
| 399 | * which overflows on large file systems. */ | ||
| 400 | static inline __u32 reiserfs_bmap_count(struct super_block *sb) | ||
| 401 | { | ||
| 402 | return (SB_BLOCK_COUNT(sb) - 1) / (sb->s_blocksize * 8) + 1; | ||
| 403 | } | ||
| 404 | |||
| 405 | static inline int bmap_would_wrap(unsigned bmap_nr) | ||
| 406 | { | ||
| 407 | return bmap_nr > ((1LL << 16) - 1); | ||
| 408 | } | ||
| 409 | |||
| 410 | /** this says about version of key of all items (but stat data) the | ||
| 411 | object consists of */ | ||
| 412 | #define get_inode_item_key_version( inode ) \ | ||
| 413 | ((REISERFS_I(inode)->i_flags & i_item_key_version_mask) ? KEY_FORMAT_3_6 : KEY_FORMAT_3_5) | ||
| 414 | |||
| 415 | #define set_inode_item_key_version( inode, version ) \ | ||
| 416 | ({ if((version)==KEY_FORMAT_3_6) \ | ||
| 417 | REISERFS_I(inode)->i_flags |= i_item_key_version_mask; \ | ||
| 418 | else \ | ||
| 419 | REISERFS_I(inode)->i_flags &= ~i_item_key_version_mask; }) | ||
| 420 | |||
| 421 | #define get_inode_sd_version(inode) \ | ||
| 422 | ((REISERFS_I(inode)->i_flags & i_stat_data_version_mask) ? STAT_DATA_V2 : STAT_DATA_V1) | ||
| 423 | |||
| 424 | #define set_inode_sd_version(inode, version) \ | ||
| 425 | ({ if((version)==STAT_DATA_V2) \ | ||
| 426 | REISERFS_I(inode)->i_flags |= i_stat_data_version_mask; \ | ||
| 427 | else \ | ||
| 428 | REISERFS_I(inode)->i_flags &= ~i_stat_data_version_mask; }) | ||
| 429 | |||
| 430 | /* This is an aggressive tail suppression policy, I am hoping it | ||
| 431 | improves our benchmarks. The principle behind it is that percentage | ||
| 432 | space saving is what matters, not absolute space saving. This is | ||
| 433 | non-intuitive, but it helps to understand it if you consider that the | ||
| 434 | cost to access 4 blocks is not much more than the cost to access 1 | ||
| 435 | block, if you have to do a seek and rotate. A tail risks a | ||
| 436 | non-linear disk access that is significant as a percentage of total | ||
| 437 | time cost for a 4 block file and saves an amount of space that is | ||
| 438 | less significant as a percentage of space, or so goes the hypothesis. | ||
| 439 | -Hans */ | ||
| 440 | #define STORE_TAIL_IN_UNFM_S1(n_file_size,n_tail_size,n_block_size) \ | ||
| 441 | (\ | ||
| 442 | (!(n_tail_size)) || \ | ||
| 443 | (((n_tail_size) > MAX_DIRECT_ITEM_LEN(n_block_size)) || \ | ||
| 444 | ( (n_file_size) >= (n_block_size) * 4 ) || \ | ||
| 445 | ( ( (n_file_size) >= (n_block_size) * 3 ) && \ | ||
| 446 | ( (n_tail_size) >= (MAX_DIRECT_ITEM_LEN(n_block_size))/4) ) || \ | ||
| 447 | ( ( (n_file_size) >= (n_block_size) * 2 ) && \ | ||
| 448 | ( (n_tail_size) >= (MAX_DIRECT_ITEM_LEN(n_block_size))/2) ) || \ | ||
| 449 | ( ( (n_file_size) >= (n_block_size) ) && \ | ||
| 450 | ( (n_tail_size) >= (MAX_DIRECT_ITEM_LEN(n_block_size) * 3)/4) ) ) \ | ||
| 451 | ) | ||
| 452 | |||
| 453 | /* Another strategy for tails, this one means only create a tail if all the | ||
| 454 | file would fit into one DIRECT item. | ||
| 455 | Primary intention for this one is to increase performance by decreasing | ||
| 456 | seeking. | ||
| 457 | */ | ||
| 458 | #define STORE_TAIL_IN_UNFM_S2(n_file_size,n_tail_size,n_block_size) \ | ||
| 459 | (\ | ||
| 460 | (!(n_tail_size)) || \ | ||
| 461 | (((n_file_size) > MAX_DIRECT_ITEM_LEN(n_block_size)) ) \ | ||
| 462 | ) | ||
| 463 | |||
| 464 | /* | ||
| 465 | * values for s_umount_state field | ||
| 466 | */ | ||
| 467 | #define REISERFS_VALID_FS 1 | ||
| 468 | #define REISERFS_ERROR_FS 2 | ||
| 469 | |||
| 470 | // | ||
| 471 | // there are 5 item types currently | ||
| 472 | // | ||
| 473 | #define TYPE_STAT_DATA 0 | ||
| 474 | #define TYPE_INDIRECT 1 | ||
| 475 | #define TYPE_DIRECT 2 | ||
| 476 | #define TYPE_DIRENTRY 3 | ||
| 477 | #define TYPE_MAXTYPE 3 | ||
| 478 | #define TYPE_ANY 15 // FIXME: comment is required | ||
| 479 | |||
| 480 | /***************************************************************************/ | ||
| 481 | /* KEY & ITEM HEAD */ | ||
| 482 | /***************************************************************************/ | ||
| 483 | |||
| 484 | // | ||
| 485 | // directories use this key as well as old files | ||
| 486 | // | ||
| 487 | struct offset_v1 { | ||
| 488 | __le32 k_offset; | ||
| 489 | __le32 k_uniqueness; | ||
| 490 | } __attribute__ ((__packed__)); | ||
| 491 | |||
| 492 | struct offset_v2 { | ||
| 493 | __le64 v; | ||
| 494 | } __attribute__ ((__packed__)); | ||
| 495 | |||
| 496 | static inline __u16 offset_v2_k_type(const struct offset_v2 *v2) | ||
| 497 | { | ||
| 498 | __u8 type = le64_to_cpu(v2->v) >> 60; | ||
| 499 | return (type <= TYPE_MAXTYPE) ? type : TYPE_ANY; | ||
| 500 | } | ||
| 501 | |||
| 502 | static inline void set_offset_v2_k_type(struct offset_v2 *v2, int type) | ||
| 503 | { | ||
| 504 | v2->v = | ||
| 505 | (v2->v & cpu_to_le64(~0ULL >> 4)) | cpu_to_le64((__u64) type << 60); | ||
| 506 | } | ||
| 507 | |||
| 508 | static inline loff_t offset_v2_k_offset(const struct offset_v2 *v2) | ||
| 509 | { | ||
| 510 | return le64_to_cpu(v2->v) & (~0ULL >> 4); | ||
| 511 | } | ||
| 512 | |||
| 513 | static inline void set_offset_v2_k_offset(struct offset_v2 *v2, loff_t offset) | ||
| 514 | { | ||
| 515 | offset &= (~0ULL >> 4); | ||
| 516 | v2->v = (v2->v & cpu_to_le64(15ULL << 60)) | cpu_to_le64(offset); | ||
| 517 | } | ||
| 518 | |||
| 519 | /* Key of an item determines its location in the S+tree, and | ||
| 520 | is composed of 4 components */ | ||
| 521 | struct reiserfs_key { | ||
| 522 | __le32 k_dir_id; /* packing locality: by default parent | ||
| 523 | directory object id */ | ||
| 524 | __le32 k_objectid; /* object identifier */ | ||
| 525 | union { | ||
| 526 | struct offset_v1 k_offset_v1; | ||
| 527 | struct offset_v2 k_offset_v2; | ||
| 528 | } __attribute__ ((__packed__)) u; | ||
| 529 | } __attribute__ ((__packed__)); | ||
| 530 | |||
| 531 | struct in_core_key { | ||
| 532 | __u32 k_dir_id; /* packing locality: by default parent | ||
| 533 | directory object id */ | ||
| 534 | __u32 k_objectid; /* object identifier */ | ||
| 535 | __u64 k_offset; | ||
| 536 | __u8 k_type; | ||
| 537 | }; | ||
| 538 | |||
| 539 | struct cpu_key { | ||
| 540 | struct in_core_key on_disk_key; | ||
| 541 | int version; | ||
| 542 | int key_length; /* 3 in all cases but direct2indirect and | ||
| 543 | indirect2direct conversion */ | ||
| 544 | }; | ||
| 545 | |||
| 546 | /* Our function for comparing keys can compare keys of different | ||
| 547 | lengths. It takes as a parameter the length of the keys it is to | ||
| 548 | compare. These defines are used in determining what is to be passed | ||
| 549 | to it as that parameter. */ | ||
| 550 | #define REISERFS_FULL_KEY_LEN 4 | ||
| 551 | #define REISERFS_SHORT_KEY_LEN 2 | ||
| 552 | |||
| 553 | /* The result of the key compare */ | ||
| 554 | #define FIRST_GREATER 1 | ||
| 555 | #define SECOND_GREATER -1 | ||
| 556 | #define KEYS_IDENTICAL 0 | ||
| 557 | #define KEY_FOUND 1 | ||
| 558 | #define KEY_NOT_FOUND 0 | ||
| 559 | |||
| 560 | #define KEY_SIZE (sizeof(struct reiserfs_key)) | ||
| 561 | #define SHORT_KEY_SIZE (sizeof (__u32) + sizeof (__u32)) | ||
| 562 | |||
| 563 | /* return values for search_by_key and clones */ | ||
| 564 | #define ITEM_FOUND 1 | ||
| 565 | #define ITEM_NOT_FOUND 0 | ||
| 566 | #define ENTRY_FOUND 1 | ||
| 567 | #define ENTRY_NOT_FOUND 0 | ||
| 568 | #define DIRECTORY_NOT_FOUND -1 | ||
| 569 | #define REGULAR_FILE_FOUND -2 | ||
| 570 | #define DIRECTORY_FOUND -3 | ||
| 571 | #define BYTE_FOUND 1 | ||
| 572 | #define BYTE_NOT_FOUND 0 | ||
| 573 | #define FILE_NOT_FOUND -1 | ||
| 574 | |||
| 575 | #define POSITION_FOUND 1 | ||
| 576 | #define POSITION_NOT_FOUND 0 | ||
| 577 | |||
| 578 | // return values for reiserfs_find_entry and search_by_entry_key | ||
| 579 | #define NAME_FOUND 1 | ||
| 580 | #define NAME_NOT_FOUND 0 | ||
| 581 | #define GOTO_PREVIOUS_ITEM 2 | ||
| 582 | #define NAME_FOUND_INVISIBLE 3 | ||
| 583 | |||
| 584 | /* Everything in the filesystem is stored as a set of items. The | ||
| 585 | item head contains the key of the item, its free space (for | ||
| 586 | indirect items) and specifies the location of the item itself | ||
| 587 | within the block. */ | ||
| 588 | |||
| 589 | struct item_head { | ||
| 590 | /* Everything in the tree is found by searching for it based on | ||
| 591 | * its key.*/ | ||
| 592 | struct reiserfs_key ih_key; | ||
| 593 | union { | ||
| 594 | /* The free space in the last unformatted node of an | ||
| 595 | indirect item if this is an indirect item. This | ||
| 596 | equals 0xFFFF iff this is a direct item or stat data | ||
| 597 | item. Note that the key, not this field, is used to | ||
| 598 | determine the item type, and thus which field this | ||
| 599 | union contains. */ | ||
| 600 | __le16 ih_free_space_reserved; | ||
| 601 | /* Iff this is a directory item, this field equals the | ||
| 602 | number of directory entries in the directory item. */ | ||
| 603 | __le16 ih_entry_count; | ||
| 604 | } __attribute__ ((__packed__)) u; | ||
| 605 | __le16 ih_item_len; /* total size of the item body */ | ||
| 606 | __le16 ih_item_location; /* an offset to the item body | ||
| 607 | * within the block */ | ||
| 608 | __le16 ih_version; /* 0 for all old items, 2 for new | ||
| 609 | ones. Highest bit is set by fsck | ||
| 610 | temporary, cleaned after all | ||
| 611 | done */ | ||
| 612 | } __attribute__ ((__packed__)); | ||
| 613 | /* size of item header */ | ||
| 614 | #define IH_SIZE (sizeof(struct item_head)) | ||
| 615 | |||
| 616 | #define ih_free_space(ih) le16_to_cpu((ih)->u.ih_free_space_reserved) | ||
| 617 | #define ih_version(ih) le16_to_cpu((ih)->ih_version) | ||
| 618 | #define ih_entry_count(ih) le16_to_cpu((ih)->u.ih_entry_count) | ||
| 619 | #define ih_location(ih) le16_to_cpu((ih)->ih_item_location) | ||
| 620 | #define ih_item_len(ih) le16_to_cpu((ih)->ih_item_len) | ||
| 621 | |||
| 622 | #define put_ih_free_space(ih, val) do { (ih)->u.ih_free_space_reserved = cpu_to_le16(val); } while(0) | ||
| 623 | #define put_ih_version(ih, val) do { (ih)->ih_version = cpu_to_le16(val); } while (0) | ||
| 624 | #define put_ih_entry_count(ih, val) do { (ih)->u.ih_entry_count = cpu_to_le16(val); } while (0) | ||
| 625 | #define put_ih_location(ih, val) do { (ih)->ih_item_location = cpu_to_le16(val); } while (0) | ||
| 626 | #define put_ih_item_len(ih, val) do { (ih)->ih_item_len = cpu_to_le16(val); } while (0) | ||
| 627 | |||
| 628 | #define unreachable_item(ih) (ih_version(ih) & (1 << 15)) | ||
| 629 | |||
| 630 | #define get_ih_free_space(ih) (ih_version (ih) == KEY_FORMAT_3_6 ? 0 : ih_free_space (ih)) | ||
| 631 | #define set_ih_free_space(ih,val) put_ih_free_space((ih), ((ih_version(ih) == KEY_FORMAT_3_6) ? 0 : (val))) | ||
| 632 | |||
| 633 | /* these operate on indirect items, where you've got an array of ints | ||
| 634 | ** at a possibly unaligned location. These are a noop on ia32 | ||
| 635 | ** | ||
| 636 | ** p is the array of __u32, i is the index into the array, v is the value | ||
| 637 | ** to store there. | ||
| 638 | */ | ||
| 639 | #define get_block_num(p, i) get_unaligned_le32((p) + (i)) | ||
| 640 | #define put_block_num(p, i, v) put_unaligned_le32((v), (p) + (i)) | ||
| 641 | |||
| 642 | // | ||
| 643 | // in old version uniqueness field shows key type | ||
| 644 | // | ||
| 645 | #define V1_SD_UNIQUENESS 0 | ||
| 646 | #define V1_INDIRECT_UNIQUENESS 0xfffffffe | ||
| 647 | #define V1_DIRECT_UNIQUENESS 0xffffffff | ||
| 648 | #define V1_DIRENTRY_UNIQUENESS 500 | ||
| 649 | #define V1_ANY_UNIQUENESS 555 // FIXME: comment is required | ||
| 650 | |||
| 651 | // | ||
| 652 | // here are conversion routines | ||
| 653 | // | ||
| 654 | static inline int uniqueness2type(__u32 uniqueness) CONSTF; | ||
| 655 | static inline int uniqueness2type(__u32 uniqueness) | ||
| 656 | { | ||
| 657 | switch ((int)uniqueness) { | ||
| 658 | case V1_SD_UNIQUENESS: | ||
| 659 | return TYPE_STAT_DATA; | ||
| 660 | case V1_INDIRECT_UNIQUENESS: | ||
| 661 | return TYPE_INDIRECT; | ||
| 662 | case V1_DIRECT_UNIQUENESS: | ||
| 663 | return TYPE_DIRECT; | ||
| 664 | case V1_DIRENTRY_UNIQUENESS: | ||
| 665 | return TYPE_DIRENTRY; | ||
| 666 | case V1_ANY_UNIQUENESS: | ||
| 667 | default: | ||
| 668 | return TYPE_ANY; | ||
| 669 | } | ||
| 670 | } | ||
| 671 | |||
| 672 | static inline __u32 type2uniqueness(int type) CONSTF; | ||
| 673 | static inline __u32 type2uniqueness(int type) | ||
| 674 | { | ||
| 675 | switch (type) { | ||
| 676 | case TYPE_STAT_DATA: | ||
| 677 | return V1_SD_UNIQUENESS; | ||
| 678 | case TYPE_INDIRECT: | ||
| 679 | return V1_INDIRECT_UNIQUENESS; | ||
| 680 | case TYPE_DIRECT: | ||
| 681 | return V1_DIRECT_UNIQUENESS; | ||
| 682 | case TYPE_DIRENTRY: | ||
| 683 | return V1_DIRENTRY_UNIQUENESS; | ||
| 684 | case TYPE_ANY: | ||
| 685 | default: | ||
| 686 | return V1_ANY_UNIQUENESS; | ||
| 687 | } | ||
| 688 | } | ||
| 689 | |||
| 690 | // | ||
| 691 | // key is pointer to on disk key which is stored in le, result is cpu, | ||
| 692 | // there is no way to get version of object from key, so, provide | ||
| 693 | // version to these defines | ||
| 694 | // | ||
| 695 | static inline loff_t le_key_k_offset(int version, | ||
| 696 | const struct reiserfs_key *key) | ||
| 697 | { | ||
| 698 | return (version == KEY_FORMAT_3_5) ? | ||
| 699 | le32_to_cpu(key->u.k_offset_v1.k_offset) : | ||
| 700 | offset_v2_k_offset(&(key->u.k_offset_v2)); | ||
| 701 | } | ||
| 702 | |||
| 703 | static inline loff_t le_ih_k_offset(const struct item_head *ih) | ||
| 704 | { | ||
| 705 | return le_key_k_offset(ih_version(ih), &(ih->ih_key)); | ||
| 706 | } | ||
| 707 | |||
| 708 | static inline loff_t le_key_k_type(int version, const struct reiserfs_key *key) | ||
| 709 | { | ||
| 710 | return (version == KEY_FORMAT_3_5) ? | ||
| 711 | uniqueness2type(le32_to_cpu(key->u.k_offset_v1.k_uniqueness)) : | ||
| 712 | offset_v2_k_type(&(key->u.k_offset_v2)); | ||
| 713 | } | ||
| 714 | |||
| 715 | static inline loff_t le_ih_k_type(const struct item_head *ih) | ||
| 716 | { | ||
| 717 | return le_key_k_type(ih_version(ih), &(ih->ih_key)); | ||
| 718 | } | ||
| 719 | |||
| 720 | static inline void set_le_key_k_offset(int version, struct reiserfs_key *key, | ||
| 721 | loff_t offset) | ||
| 722 | { | ||
| 723 | (version == KEY_FORMAT_3_5) ? (void)(key->u.k_offset_v1.k_offset = cpu_to_le32(offset)) : /* jdm check */ | ||
| 724 | (void)(set_offset_v2_k_offset(&(key->u.k_offset_v2), offset)); | ||
| 725 | } | ||
| 726 | |||
| 727 | static inline void set_le_ih_k_offset(struct item_head *ih, loff_t offset) | ||
| 728 | { | ||
| 729 | set_le_key_k_offset(ih_version(ih), &(ih->ih_key), offset); | ||
| 730 | } | ||
| 731 | |||
| 732 | static inline void set_le_key_k_type(int version, struct reiserfs_key *key, | ||
| 733 | int type) | ||
| 734 | { | ||
| 735 | (version == KEY_FORMAT_3_5) ? | ||
| 736 | (void)(key->u.k_offset_v1.k_uniqueness = | ||
| 737 | cpu_to_le32(type2uniqueness(type))) | ||
| 738 | : (void)(set_offset_v2_k_type(&(key->u.k_offset_v2), type)); | ||
| 739 | } | ||
| 740 | |||
| 741 | static inline void set_le_ih_k_type(struct item_head *ih, int type) | ||
| 742 | { | ||
| 743 | set_le_key_k_type(ih_version(ih), &(ih->ih_key), type); | ||
| 744 | } | ||
| 745 | |||
| 746 | static inline int is_direntry_le_key(int version, struct reiserfs_key *key) | ||
| 747 | { | ||
| 748 | return le_key_k_type(version, key) == TYPE_DIRENTRY; | ||
| 749 | } | ||
| 750 | |||
| 751 | static inline int is_direct_le_key(int version, struct reiserfs_key *key) | ||
| 752 | { | ||
| 753 | return le_key_k_type(version, key) == TYPE_DIRECT; | ||
| 754 | } | ||
| 755 | |||
| 756 | static inline int is_indirect_le_key(int version, struct reiserfs_key *key) | ||
| 757 | { | ||
| 758 | return le_key_k_type(version, key) == TYPE_INDIRECT; | ||
| 759 | } | ||
| 760 | |||
| 761 | static inline int is_statdata_le_key(int version, struct reiserfs_key *key) | ||
| 762 | { | ||
| 763 | return le_key_k_type(version, key) == TYPE_STAT_DATA; | ||
| 764 | } | ||
| 765 | |||
| 766 | // | ||
| 767 | // item header has version. | ||
| 768 | // | ||
| 769 | static inline int is_direntry_le_ih(struct item_head *ih) | ||
| 770 | { | ||
| 771 | return is_direntry_le_key(ih_version(ih), &ih->ih_key); | ||
| 772 | } | ||
| 773 | |||
| 774 | static inline int is_direct_le_ih(struct item_head *ih) | ||
| 775 | { | ||
| 776 | return is_direct_le_key(ih_version(ih), &ih->ih_key); | ||
| 777 | } | ||
| 778 | |||
| 779 | static inline int is_indirect_le_ih(struct item_head *ih) | ||
| 780 | { | ||
| 781 | return is_indirect_le_key(ih_version(ih), &ih->ih_key); | ||
| 782 | } | ||
| 783 | |||
| 784 | static inline int is_statdata_le_ih(struct item_head *ih) | ||
| 785 | { | ||
| 786 | return is_statdata_le_key(ih_version(ih), &ih->ih_key); | ||
| 787 | } | ||
| 788 | |||
| 789 | // | ||
| 790 | // key is pointer to cpu key, result is cpu | ||
| 791 | // | ||
| 792 | static inline loff_t cpu_key_k_offset(const struct cpu_key *key) | ||
| 793 | { | ||
| 794 | return key->on_disk_key.k_offset; | ||
| 795 | } | ||
| 796 | |||
| 797 | static inline loff_t cpu_key_k_type(const struct cpu_key *key) | ||
| 798 | { | ||
| 799 | return key->on_disk_key.k_type; | ||
| 800 | } | ||
| 801 | |||
| 802 | static inline void set_cpu_key_k_offset(struct cpu_key *key, loff_t offset) | ||
| 803 | { | ||
| 804 | key->on_disk_key.k_offset = offset; | ||
| 805 | } | ||
| 806 | |||
| 807 | static inline void set_cpu_key_k_type(struct cpu_key *key, int type) | ||
| 808 | { | ||
| 809 | key->on_disk_key.k_type = type; | ||
| 810 | } | ||
| 811 | |||
| 812 | static inline void cpu_key_k_offset_dec(struct cpu_key *key) | ||
| 813 | { | ||
| 814 | key->on_disk_key.k_offset--; | ||
| 815 | } | ||
| 816 | |||
| 817 | #define is_direntry_cpu_key(key) (cpu_key_k_type (key) == TYPE_DIRENTRY) | ||
| 818 | #define is_direct_cpu_key(key) (cpu_key_k_type (key) == TYPE_DIRECT) | ||
| 819 | #define is_indirect_cpu_key(key) (cpu_key_k_type (key) == TYPE_INDIRECT) | ||
| 820 | #define is_statdata_cpu_key(key) (cpu_key_k_type (key) == TYPE_STAT_DATA) | ||
| 821 | |||
| 822 | /* are these used ? */ | ||
| 823 | #define is_direntry_cpu_ih(ih) (is_direntry_cpu_key (&((ih)->ih_key))) | ||
| 824 | #define is_direct_cpu_ih(ih) (is_direct_cpu_key (&((ih)->ih_key))) | ||
| 825 | #define is_indirect_cpu_ih(ih) (is_indirect_cpu_key (&((ih)->ih_key))) | ||
| 826 | #define is_statdata_cpu_ih(ih) (is_statdata_cpu_key (&((ih)->ih_key))) | ||
| 827 | |||
| 828 | #define I_K_KEY_IN_ITEM(ih, key, n_blocksize) \ | ||
| 829 | (!COMP_SHORT_KEYS(ih, key) && \ | ||
| 830 | I_OFF_BYTE_IN_ITEM(ih, k_offset(key), n_blocksize)) | ||
| 831 | |||
| 832 | /* maximal length of item */ | ||
| 833 | #define MAX_ITEM_LEN(block_size) (block_size - BLKH_SIZE - IH_SIZE) | ||
| 834 | #define MIN_ITEM_LEN 1 | ||
| 835 | |||
| 836 | /* object identifier for root dir */ | ||
| 837 | #define REISERFS_ROOT_OBJECTID 2 | ||
| 838 | #define REISERFS_ROOT_PARENT_OBJECTID 1 | ||
| 839 | |||
| 840 | extern struct reiserfs_key root_key; | ||
| 841 | |||
| 842 | /* | ||
| 843 | * Picture represents a leaf of the S+tree | ||
| 844 | * ______________________________________________________ | ||
| 845 | * | | Array of | | | | ||
| 846 | * |Block | Object-Item | F r e e | Objects- | | ||
| 847 | * | head | Headers | S p a c e | Items | | ||
| 848 | * |______|_______________|___________________|___________| | ||
| 849 | */ | ||
| 850 | |||
| 851 | /* Header of a disk block. More precisely, header of a formatted leaf | ||
| 852 | or internal node, and not the header of an unformatted node. */ | ||
| 853 | struct block_head { | ||
| 854 | __le16 blk_level; /* Level of a block in the tree. */ | ||
| 855 | __le16 blk_nr_item; /* Number of keys/items in a block. */ | ||
| 856 | __le16 blk_free_space; /* Block free space in bytes. */ | ||
| 857 | __le16 blk_reserved; | ||
| 858 | /* dump this in v4/planA */ | ||
| 859 | struct reiserfs_key blk_right_delim_key; /* kept only for compatibility */ | ||
| 860 | }; | ||
| 861 | |||
| 862 | #define BLKH_SIZE (sizeof(struct block_head)) | ||
| 863 | #define blkh_level(p_blkh) (le16_to_cpu((p_blkh)->blk_level)) | ||
| 864 | #define blkh_nr_item(p_blkh) (le16_to_cpu((p_blkh)->blk_nr_item)) | ||
| 865 | #define blkh_free_space(p_blkh) (le16_to_cpu((p_blkh)->blk_free_space)) | ||
| 866 | #define blkh_reserved(p_blkh) (le16_to_cpu((p_blkh)->blk_reserved)) | ||
| 867 | #define set_blkh_level(p_blkh,val) ((p_blkh)->blk_level = cpu_to_le16(val)) | ||
| 868 | #define set_blkh_nr_item(p_blkh,val) ((p_blkh)->blk_nr_item = cpu_to_le16(val)) | ||
| 869 | #define set_blkh_free_space(p_blkh,val) ((p_blkh)->blk_free_space = cpu_to_le16(val)) | ||
| 870 | #define set_blkh_reserved(p_blkh,val) ((p_blkh)->blk_reserved = cpu_to_le16(val)) | ||
| 871 | #define blkh_right_delim_key(p_blkh) ((p_blkh)->blk_right_delim_key) | ||
| 872 | #define set_blkh_right_delim_key(p_blkh,val) ((p_blkh)->blk_right_delim_key = val) | ||
| 873 | |||
| 874 | /* | ||
| 875 | * values for blk_level field of the struct block_head | ||
| 876 | */ | ||
| 877 | |||
| 878 | #define FREE_LEVEL 0 /* when node gets removed from the tree its | ||
| 879 | blk_level is set to FREE_LEVEL. It is then | ||
| 880 | used to see whether the node is still in the | ||
| 881 | tree */ | ||
| 882 | |||
| 883 | #define DISK_LEAF_NODE_LEVEL 1 /* Leaf node level. */ | ||
| 884 | |||
| 885 | /* Given the buffer head of a formatted node, resolve to the block head of that node. */ | ||
| 886 | #define B_BLK_HEAD(bh) ((struct block_head *)((bh)->b_data)) | ||
| 887 | /* Number of items that are in buffer. */ | ||
| 888 | #define B_NR_ITEMS(bh) (blkh_nr_item(B_BLK_HEAD(bh))) | ||
| 889 | #define B_LEVEL(bh) (blkh_level(B_BLK_HEAD(bh))) | ||
| 890 | #define B_FREE_SPACE(bh) (blkh_free_space(B_BLK_HEAD(bh))) | ||
| 891 | |||
| 892 | #define PUT_B_NR_ITEMS(bh, val) do { set_blkh_nr_item(B_BLK_HEAD(bh), val); } while (0) | ||
| 893 | #define PUT_B_LEVEL(bh, val) do { set_blkh_level(B_BLK_HEAD(bh), val); } while (0) | ||
| 894 | #define PUT_B_FREE_SPACE(bh, val) do { set_blkh_free_space(B_BLK_HEAD(bh), val); } while (0) | ||
| 895 | |||
| 896 | /* Get right delimiting key. -- little endian */ | ||
| 897 | #define B_PRIGHT_DELIM_KEY(bh) (&(blk_right_delim_key(B_BLK_HEAD(bh)))) | ||
| 898 | |||
| 899 | /* Does the buffer contain a disk leaf. */ | ||
| 900 | #define B_IS_ITEMS_LEVEL(bh) (B_LEVEL(bh) == DISK_LEAF_NODE_LEVEL) | ||
| 901 | |||
| 902 | /* Does the buffer contain a disk internal node */ | ||
| 903 | #define B_IS_KEYS_LEVEL(bh) (B_LEVEL(bh) > DISK_LEAF_NODE_LEVEL \ | ||
| 904 | && B_LEVEL(bh) <= MAX_HEIGHT) | ||
| 905 | |||
| 906 | /***************************************************************************/ | ||
| 907 | /* STAT DATA */ | ||
| 908 | /***************************************************************************/ | ||
| 909 | |||
| 910 | // | ||
| 911 | // old stat data is 32 bytes long. We are going to distinguish new one by | ||
| 912 | // different size | ||
| 913 | // | ||
| 914 | struct stat_data_v1 { | ||
| 915 | __le16 sd_mode; /* file type, permissions */ | ||
| 916 | __le16 sd_nlink; /* number of hard links */ | ||
| 917 | __le16 sd_uid; /* owner */ | ||
| 918 | __le16 sd_gid; /* group */ | ||
| 919 | __le32 sd_size; /* file size */ | ||
| 920 | __le32 sd_atime; /* time of last access */ | ||
| 921 | __le32 sd_mtime; /* time file was last modified */ | ||
| 922 | __le32 sd_ctime; /* time inode (stat data) was last changed (except changes to sd_atime and sd_mtime) */ | ||
| 923 | union { | ||
| 924 | __le32 sd_rdev; | ||
| 925 | __le32 sd_blocks; /* number of blocks file uses */ | ||
| 926 | } __attribute__ ((__packed__)) u; | ||
| 927 | __le32 sd_first_direct_byte; /* first byte of file which is stored | ||
| 928 | in a direct item: except that if it | ||
| 929 | equals 1 it is a symlink and if it | ||
| 930 | equals ~(__u32)0 there is no | ||
| 931 | direct item. The existence of this | ||
| 932 | field really grates on me. Let's | ||
| 933 | replace it with a macro based on | ||
| 934 | sd_size and our tail suppression | ||
| 935 | policy. Someday. -Hans */ | ||
| 936 | } __attribute__ ((__packed__)); | ||
| 937 | |||
| 938 | #define SD_V1_SIZE (sizeof(struct stat_data_v1)) | ||
| 939 | #define stat_data_v1(ih) (ih_version (ih) == KEY_FORMAT_3_5) | ||
| 940 | #define sd_v1_mode(sdp) (le16_to_cpu((sdp)->sd_mode)) | ||
| 941 | #define set_sd_v1_mode(sdp,v) ((sdp)->sd_mode = cpu_to_le16(v)) | ||
| 942 | #define sd_v1_nlink(sdp) (le16_to_cpu((sdp)->sd_nlink)) | ||
| 943 | #define set_sd_v1_nlink(sdp,v) ((sdp)->sd_nlink = cpu_to_le16(v)) | ||
| 944 | #define sd_v1_uid(sdp) (le16_to_cpu((sdp)->sd_uid)) | ||
| 945 | #define set_sd_v1_uid(sdp,v) ((sdp)->sd_uid = cpu_to_le16(v)) | ||
| 946 | #define sd_v1_gid(sdp) (le16_to_cpu((sdp)->sd_gid)) | ||
| 947 | #define set_sd_v1_gid(sdp,v) ((sdp)->sd_gid = cpu_to_le16(v)) | ||
| 948 | #define sd_v1_size(sdp) (le32_to_cpu((sdp)->sd_size)) | ||
| 949 | #define set_sd_v1_size(sdp,v) ((sdp)->sd_size = cpu_to_le32(v)) | ||
| 950 | #define sd_v1_atime(sdp) (le32_to_cpu((sdp)->sd_atime)) | ||
| 951 | #define set_sd_v1_atime(sdp,v) ((sdp)->sd_atime = cpu_to_le32(v)) | ||
| 952 | #define sd_v1_mtime(sdp) (le32_to_cpu((sdp)->sd_mtime)) | ||
| 953 | #define set_sd_v1_mtime(sdp,v) ((sdp)->sd_mtime = cpu_to_le32(v)) | ||
| 954 | #define sd_v1_ctime(sdp) (le32_to_cpu((sdp)->sd_ctime)) | ||
| 955 | #define set_sd_v1_ctime(sdp,v) ((sdp)->sd_ctime = cpu_to_le32(v)) | ||
| 956 | #define sd_v1_rdev(sdp) (le32_to_cpu((sdp)->u.sd_rdev)) | ||
| 957 | #define set_sd_v1_rdev(sdp,v) ((sdp)->u.sd_rdev = cpu_to_le32(v)) | ||
| 958 | #define sd_v1_blocks(sdp) (le32_to_cpu((sdp)->u.sd_blocks)) | ||
| 959 | #define set_sd_v1_blocks(sdp,v) ((sdp)->u.sd_blocks = cpu_to_le32(v)) | ||
| 960 | #define sd_v1_first_direct_byte(sdp) \ | ||
| 961 | (le32_to_cpu((sdp)->sd_first_direct_byte)) | ||
| 962 | #define set_sd_v1_first_direct_byte(sdp,v) \ | ||
| 963 | ((sdp)->sd_first_direct_byte = cpu_to_le32(v)) | ||
| 964 | |||
| 965 | /* inode flags stored in sd_attrs (nee sd_reserved) */ | ||
| 966 | |||
| 967 | /* we want common flags to have the same values as in ext2, | ||
| 968 | so chattr(1) will work without problems */ | ||
| 969 | #define REISERFS_IMMUTABLE_FL FS_IMMUTABLE_FL | ||
| 970 | #define REISERFS_APPEND_FL FS_APPEND_FL | ||
| 971 | #define REISERFS_SYNC_FL FS_SYNC_FL | ||
| 972 | #define REISERFS_NOATIME_FL FS_NOATIME_FL | ||
| 973 | #define REISERFS_NODUMP_FL FS_NODUMP_FL | ||
| 974 | #define REISERFS_SECRM_FL FS_SECRM_FL | ||
| 975 | #define REISERFS_UNRM_FL FS_UNRM_FL | ||
| 976 | #define REISERFS_COMPR_FL FS_COMPR_FL | ||
| 977 | #define REISERFS_NOTAIL_FL FS_NOTAIL_FL | ||
| 978 | |||
| 979 | /* persistent flags that file inherits from the parent directory */ | ||
| 980 | #define REISERFS_INHERIT_MASK ( REISERFS_IMMUTABLE_FL | \ | ||
| 981 | REISERFS_SYNC_FL | \ | ||
| 982 | REISERFS_NOATIME_FL | \ | ||
| 983 | REISERFS_NODUMP_FL | \ | ||
| 984 | REISERFS_SECRM_FL | \ | ||
| 985 | REISERFS_COMPR_FL | \ | ||
| 986 | REISERFS_NOTAIL_FL ) | ||
| 987 | |||
| 988 | /* Stat Data on disk (reiserfs version of UFS disk inode minus the | ||
| 989 | address blocks) */ | ||
| 990 | struct stat_data { | ||
| 991 | __le16 sd_mode; /* file type, permissions */ | ||
| 992 | __le16 sd_attrs; /* persistent inode flags */ | ||
| 993 | __le32 sd_nlink; /* number of hard links */ | ||
| 994 | __le64 sd_size; /* file size */ | ||
| 995 | __le32 sd_uid; /* owner */ | ||
| 996 | __le32 sd_gid; /* group */ | ||
| 997 | __le32 sd_atime; /* time of last access */ | ||
| 998 | __le32 sd_mtime; /* time file was last modified */ | ||
| 999 | __le32 sd_ctime; /* time inode (stat data) was last changed (except changes to sd_atime and sd_mtime) */ | ||
| 1000 | __le32 sd_blocks; | ||
| 1001 | union { | ||
| 1002 | __le32 sd_rdev; | ||
| 1003 | __le32 sd_generation; | ||
| 1004 | //__le32 sd_first_direct_byte; | ||
| 1005 | /* first byte of file which is stored in a | ||
| 1006 | direct item: except that if it equals 1 | ||
| 1007 | it is a symlink and if it equals | ||
| 1008 | ~(__u32)0 there is no direct item. The | ||
| 1009 | existence of this field really grates | ||
| 1010 | on me. Let's replace it with a macro | ||
| 1011 | based on sd_size and our tail | ||
| 1012 | suppression policy? */ | ||
| 1013 | } __attribute__ ((__packed__)) u; | ||
| 1014 | } __attribute__ ((__packed__)); | ||
| 1015 | // | ||
| 1016 | // this is 44 bytes long | ||
| 1017 | // | ||
| 1018 | #define SD_SIZE (sizeof(struct stat_data)) | ||
| 1019 | #define SD_V2_SIZE SD_SIZE | ||
| 1020 | #define stat_data_v2(ih) (ih_version (ih) == KEY_FORMAT_3_6) | ||
| 1021 | #define sd_v2_mode(sdp) (le16_to_cpu((sdp)->sd_mode)) | ||
| 1022 | #define set_sd_v2_mode(sdp,v) ((sdp)->sd_mode = cpu_to_le16(v)) | ||
| 1023 | /* sd_reserved */ | ||
| 1024 | /* set_sd_reserved */ | ||
| 1025 | #define sd_v2_nlink(sdp) (le32_to_cpu((sdp)->sd_nlink)) | ||
| 1026 | #define set_sd_v2_nlink(sdp,v) ((sdp)->sd_nlink = cpu_to_le32(v)) | ||
| 1027 | #define sd_v2_size(sdp) (le64_to_cpu((sdp)->sd_size)) | ||
| 1028 | #define set_sd_v2_size(sdp,v) ((sdp)->sd_size = cpu_to_le64(v)) | ||
| 1029 | #define sd_v2_uid(sdp) (le32_to_cpu((sdp)->sd_uid)) | ||
| 1030 | #define set_sd_v2_uid(sdp,v) ((sdp)->sd_uid = cpu_to_le32(v)) | ||
| 1031 | #define sd_v2_gid(sdp) (le32_to_cpu((sdp)->sd_gid)) | ||
| 1032 | #define set_sd_v2_gid(sdp,v) ((sdp)->sd_gid = cpu_to_le32(v)) | ||
| 1033 | #define sd_v2_atime(sdp) (le32_to_cpu((sdp)->sd_atime)) | ||
| 1034 | #define set_sd_v2_atime(sdp,v) ((sdp)->sd_atime = cpu_to_le32(v)) | ||
| 1035 | #define sd_v2_mtime(sdp) (le32_to_cpu((sdp)->sd_mtime)) | ||
| 1036 | #define set_sd_v2_mtime(sdp,v) ((sdp)->sd_mtime = cpu_to_le32(v)) | ||
| 1037 | #define sd_v2_ctime(sdp) (le32_to_cpu((sdp)->sd_ctime)) | ||
| 1038 | #define set_sd_v2_ctime(sdp,v) ((sdp)->sd_ctime = cpu_to_le32(v)) | ||
| 1039 | #define sd_v2_blocks(sdp) (le32_to_cpu((sdp)->sd_blocks)) | ||
| 1040 | #define set_sd_v2_blocks(sdp,v) ((sdp)->sd_blocks = cpu_to_le32(v)) | ||
| 1041 | #define sd_v2_rdev(sdp) (le32_to_cpu((sdp)->u.sd_rdev)) | ||
| 1042 | #define set_sd_v2_rdev(sdp,v) ((sdp)->u.sd_rdev = cpu_to_le32(v)) | ||
| 1043 | #define sd_v2_generation(sdp) (le32_to_cpu((sdp)->u.sd_generation)) | ||
| 1044 | #define set_sd_v2_generation(sdp,v) ((sdp)->u.sd_generation = cpu_to_le32(v)) | ||
| 1045 | #define sd_v2_attrs(sdp) (le16_to_cpu((sdp)->sd_attrs)) | ||
| 1046 | #define set_sd_v2_attrs(sdp,v) ((sdp)->sd_attrs = cpu_to_le16(v)) | ||
| 1047 | |||
| 1048 | /***************************************************************************/ | ||
| 1049 | /* DIRECTORY STRUCTURE */ | ||
| 1050 | /***************************************************************************/ | ||
| 1051 | /* | ||
| 1052 | Picture represents the structure of directory items | ||
| 1053 | ________________________________________________ | ||
| 1054 | | Array of | | | | | | | ||
| 1055 | | directory |N-1| N-2 | .... | 1st |0th| | ||
| 1056 | | entry headers | | | | | | | ||
| 1057 | |_______________|___|_____|________|_______|___| | ||
| 1058 | <---- directory entries ------> | ||
| 1059 | |||
| 1060 | First directory item has k_offset component 1. We store "." and ".." | ||
| 1061 | in one item, always, we never split "." and ".." into differing | ||
| 1062 | items. This makes, among other things, the code for removing | ||
| 1063 | directories simpler. */ | ||
| 1064 | #define SD_OFFSET 0 | ||
| 1065 | #define SD_UNIQUENESS 0 | ||
| 1066 | #define DOT_OFFSET 1 | ||
| 1067 | #define DOT_DOT_OFFSET 2 | ||
| 1068 | #define DIRENTRY_UNIQUENESS 500 | ||
| 1069 | |||
| 1070 | /* */ | ||
| 1071 | #define FIRST_ITEM_OFFSET 1 | ||
| 1072 | |||
| 1073 | /* | ||
| 1074 | Q: How to get key of object pointed to by entry from entry? | ||
| 1075 | |||
| 1076 | A: Each directory entry has its header. This header has deh_dir_id and deh_objectid fields, those are key | ||
| 1077 | of object, entry points to */ | ||
| 1078 | |||
| 1079 | /* NOT IMPLEMENTED: | ||
| 1080 | Directory will someday contain stat data of object */ | ||
| 1081 | |||
| 1082 | struct reiserfs_de_head { | ||
| 1083 | __le32 deh_offset; /* third component of the directory entry key */ | ||
| 1084 | __le32 deh_dir_id; /* objectid of the parent directory of the object, that is referenced | ||
| 1085 | by directory entry */ | ||
| 1086 | __le32 deh_objectid; /* objectid of the object, that is referenced by directory entry */ | ||
| 1087 | __le16 deh_location; /* offset of name in the whole item */ | ||
| 1088 | __le16 deh_state; /* whether 1) entry contains stat data (for future), and 2) whether | ||
| 1089 | entry is hidden (unlinked) */ | ||
| 1090 | } __attribute__ ((__packed__)); | ||
| 1091 | #define DEH_SIZE sizeof(struct reiserfs_de_head) | ||
| 1092 | #define deh_offset(p_deh) (le32_to_cpu((p_deh)->deh_offset)) | ||
| 1093 | #define deh_dir_id(p_deh) (le32_to_cpu((p_deh)->deh_dir_id)) | ||
| 1094 | #define deh_objectid(p_deh) (le32_to_cpu((p_deh)->deh_objectid)) | ||
| 1095 | #define deh_location(p_deh) (le16_to_cpu((p_deh)->deh_location)) | ||
| 1096 | #define deh_state(p_deh) (le16_to_cpu((p_deh)->deh_state)) | ||
| 1097 | |||
| 1098 | #define put_deh_offset(p_deh,v) ((p_deh)->deh_offset = cpu_to_le32((v))) | ||
| 1099 | #define put_deh_dir_id(p_deh,v) ((p_deh)->deh_dir_id = cpu_to_le32((v))) | ||
| 1100 | #define put_deh_objectid(p_deh,v) ((p_deh)->deh_objectid = cpu_to_le32((v))) | ||
| 1101 | #define put_deh_location(p_deh,v) ((p_deh)->deh_location = cpu_to_le16((v))) | ||
| 1102 | #define put_deh_state(p_deh,v) ((p_deh)->deh_state = cpu_to_le16((v))) | ||
| 1103 | |||
| 1104 | /* empty directory contains two entries "." and ".." and their headers */ | ||
| 1105 | #define EMPTY_DIR_SIZE \ | ||
| 1106 | (DEH_SIZE * 2 + ROUND_UP (strlen (".")) + ROUND_UP (strlen (".."))) | ||
| 1107 | |||
| 1108 | /* old format directories have this size when empty */ | ||
| 1109 | #define EMPTY_DIR_SIZE_V1 (DEH_SIZE * 2 + 3) | ||
| 1110 | |||
| 1111 | #define DEH_Statdata 0 /* not used now */ | ||
| 1112 | #define DEH_Visible 2 | ||
| 1113 | |||
| 1114 | /* 64 bit systems (and the S/390) need to be aligned explicitly -jdm */ | ||
| 1115 | #if BITS_PER_LONG == 64 || defined(__s390__) || defined(__hppa__) | ||
| 1116 | # define ADDR_UNALIGNED_BITS (3) | ||
| 1117 | #endif | ||
| 1118 | |||
| 1119 | /* These are only used to manipulate deh_state. | ||
| 1120 | * Because of this, we'll use the ext2_ bit routines, | ||
| 1121 | * since they are little endian */ | ||
| 1122 | #ifdef ADDR_UNALIGNED_BITS | ||
| 1123 | |||
| 1124 | # define aligned_address(addr) ((void *)((long)(addr) & ~((1UL << ADDR_UNALIGNED_BITS) - 1))) | ||
| 1125 | # define unaligned_offset(addr) (((int)((long)(addr) & ((1 << ADDR_UNALIGNED_BITS) - 1))) << 3) | ||
| 1126 | |||
| 1127 | # define set_bit_unaligned(nr, addr) \ | ||
| 1128 | __test_and_set_bit_le((nr) + unaligned_offset(addr), aligned_address(addr)) | ||
| 1129 | # define clear_bit_unaligned(nr, addr) \ | ||
| 1130 | __test_and_clear_bit_le((nr) + unaligned_offset(addr), aligned_address(addr)) | ||
| 1131 | # define test_bit_unaligned(nr, addr) \ | ||
| 1132 | test_bit_le((nr) + unaligned_offset(addr), aligned_address(addr)) | ||
| 1133 | |||
| 1134 | #else | ||
| 1135 | |||
| 1136 | # define set_bit_unaligned(nr, addr) __test_and_set_bit_le(nr, addr) | ||
| 1137 | # define clear_bit_unaligned(nr, addr) __test_and_clear_bit_le(nr, addr) | ||
| 1138 | # define test_bit_unaligned(nr, addr) test_bit_le(nr, addr) | ||
| 1139 | |||
| 1140 | #endif | ||
| 1141 | |||
| 1142 | #define mark_de_with_sd(deh) set_bit_unaligned (DEH_Statdata, &((deh)->deh_state)) | ||
| 1143 | #define mark_de_without_sd(deh) clear_bit_unaligned (DEH_Statdata, &((deh)->deh_state)) | ||
| 1144 | #define mark_de_visible(deh) set_bit_unaligned (DEH_Visible, &((deh)->deh_state)) | ||
| 1145 | #define mark_de_hidden(deh) clear_bit_unaligned (DEH_Visible, &((deh)->deh_state)) | ||
| 1146 | |||
| 1147 | #define de_with_sd(deh) test_bit_unaligned (DEH_Statdata, &((deh)->deh_state)) | ||
| 1148 | #define de_visible(deh) test_bit_unaligned (DEH_Visible, &((deh)->deh_state)) | ||
| 1149 | #define de_hidden(deh) !test_bit_unaligned (DEH_Visible, &((deh)->deh_state)) | ||
| 1150 | |||
| 1151 | extern void make_empty_dir_item_v1(char *body, __le32 dirid, __le32 objid, | ||
| 1152 | __le32 par_dirid, __le32 par_objid); | ||
| 1153 | extern void make_empty_dir_item(char *body, __le32 dirid, __le32 objid, | ||
| 1154 | __le32 par_dirid, __le32 par_objid); | ||
| 1155 | |||
| 1156 | /* array of the entry headers */ | ||
| 1157 | /* get item body */ | ||
| 1158 | #define B_I_PITEM(bh,ih) ( (bh)->b_data + ih_location(ih) ) | ||
| 1159 | #define B_I_DEH(bh,ih) ((struct reiserfs_de_head *)(B_I_PITEM(bh,ih))) | ||
| 1160 | |||
| 1161 | /* length of the directory entry in directory item. This define | ||
| 1162 | calculates length of i-th directory entry using directory entry | ||
| 1163 | locations from dir entry head. When it calculates length of 0-th | ||
| 1164 | directory entry, it uses length of whole item in place of entry | ||
| 1165 | location of the non-existent following entry in the calculation. | ||
| 1166 | See picture above.*/ | ||
| 1167 | /* | ||
| 1168 | #define I_DEH_N_ENTRY_LENGTH(ih,deh,i) \ | ||
| 1169 | ((i) ? (deh_location((deh)-1) - deh_location((deh))) : (ih_item_len((ih)) - deh_location((deh)))) | ||
| 1170 | */ | ||
| 1171 | static inline int entry_length(const struct buffer_head *bh, | ||
| 1172 | const struct item_head *ih, int pos_in_item) | ||
| 1173 | { | ||
| 1174 | struct reiserfs_de_head *deh; | ||
| 1175 | |||
| 1176 | deh = B_I_DEH(bh, ih) + pos_in_item; | ||
| 1177 | if (pos_in_item) | ||
| 1178 | return deh_location(deh - 1) - deh_location(deh); | ||
| 1179 | |||
| 1180 | return ih_item_len(ih) - deh_location(deh); | ||
| 1181 | } | ||
| 1182 | |||
| 1183 | /* number of entries in the directory item, depends on ENTRY_COUNT being at the start of directory dynamic data. */ | ||
| 1184 | #define I_ENTRY_COUNT(ih) (ih_entry_count((ih))) | ||
| 1185 | |||
| 1186 | /* name by bh, ih and entry_num */ | ||
| 1187 | #define B_I_E_NAME(bh,ih,entry_num) ((char *)(bh->b_data + ih_location(ih) + deh_location(B_I_DEH(bh,ih)+(entry_num)))) | ||
| 1188 | |||
| 1189 | // two entries per block (at least) | ||
| 1190 | #define REISERFS_MAX_NAME(block_size) 255 | ||
| 1191 | |||
| 1192 | /* this structure is used for operations on directory entries. It is | ||
| 1193 | not a disk structure. */ | ||
| 1194 | /* When reiserfs_find_entry or search_by_entry_key find directory | ||
| 1195 | entry, they return filled reiserfs_dir_entry structure */ | ||
| 1196 | struct reiserfs_dir_entry { | ||
| 1197 | struct buffer_head *de_bh; | ||
| 1198 | int de_item_num; | ||
| 1199 | struct item_head *de_ih; | ||
| 1200 | int de_entry_num; | ||
| 1201 | struct reiserfs_de_head *de_deh; | ||
| 1202 | int de_entrylen; | ||
| 1203 | int de_namelen; | ||
| 1204 | char *de_name; | ||
| 1205 | unsigned long *de_gen_number_bit_string; | ||
| 1206 | |||
| 1207 | __u32 de_dir_id; | ||
| 1208 | __u32 de_objectid; | ||
| 1209 | |||
| 1210 | struct cpu_key de_entry_key; | ||
| 1211 | }; | ||
| 1212 | |||
| 1213 | /* these defines are useful when a particular member of a reiserfs_dir_entry is needed */ | ||
| 1214 | |||
| 1215 | /* pointer to file name, stored in entry */ | ||
| 1216 | #define B_I_DEH_ENTRY_FILE_NAME(bh,ih,deh) (B_I_PITEM (bh, ih) + deh_location(deh)) | ||
| 1217 | |||
| 1218 | /* length of name */ | ||
| 1219 | #define I_DEH_N_ENTRY_FILE_NAME_LENGTH(ih,deh,entry_num) \ | ||
| 1220 | (I_DEH_N_ENTRY_LENGTH (ih, deh, entry_num) - (de_with_sd (deh) ? SD_SIZE : 0)) | ||
| 1221 | |||
| 1222 | /* hash value occupies bits from 7 up to 30 */ | ||
| 1223 | #define GET_HASH_VALUE(offset) ((offset) & 0x7fffff80LL) | ||
| 1224 | /* generation number occupies 7 bits starting from 0 up to 6 */ | ||
| 1225 | #define GET_GENERATION_NUMBER(offset) ((offset) & 0x7fLL) | ||
| 1226 | #define MAX_GENERATION_NUMBER 127 | ||
| 1227 | |||
| 1228 | #define SET_GENERATION_NUMBER(offset,gen_number) (GET_HASH_VALUE(offset)|(gen_number)) | ||
| 1229 | |||
| 1230 | /* | ||
| 1231 | * Picture represents an internal node of the reiserfs tree | ||
| 1232 | * ______________________________________________________ | ||
| 1233 | * | | Array of | Array of | Free | | ||
| 1234 | * |block | keys | pointers | space | | ||
| 1235 | * | head | N | N+1 | | | ||
| 1236 | * |______|_______________|___________________|___________| | ||
| 1237 | */ | ||
| 1238 | |||
| 1239 | /***************************************************************************/ | ||
| 1240 | /* DISK CHILD */ | ||
| 1241 | /***************************************************************************/ | ||
| 1242 | /* Disk child pointer: The pointer from an internal node of the tree | ||
| 1243 | to a node that is on disk. */ | ||
| 1244 | struct disk_child { | ||
| 1245 | __le32 dc_block_number; /* Disk child's block number. */ | ||
| 1246 | __le16 dc_size; /* Disk child's used space. */ | ||
| 1247 | __le16 dc_reserved; | ||
| 1248 | }; | ||
| 1249 | |||
| 1250 | #define DC_SIZE (sizeof(struct disk_child)) | ||
| 1251 | #define dc_block_number(dc_p) (le32_to_cpu((dc_p)->dc_block_number)) | ||
| 1252 | #define dc_size(dc_p) (le16_to_cpu((dc_p)->dc_size)) | ||
| 1253 | #define put_dc_block_number(dc_p, val) do { (dc_p)->dc_block_number = cpu_to_le32(val); } while(0) | ||
| 1254 | #define put_dc_size(dc_p, val) do { (dc_p)->dc_size = cpu_to_le16(val); } while(0) | ||
| 1255 | |||
| 1256 | /* Get disk child by buffer header and position in the tree node. */ | ||
| 1257 | #define B_N_CHILD(bh, n_pos) ((struct disk_child *)\ | ||
| 1258 | ((bh)->b_data + BLKH_SIZE + B_NR_ITEMS(bh) * KEY_SIZE + DC_SIZE * (n_pos))) | ||
| 1259 | |||
| 1260 | /* Get disk child number by buffer header and position in the tree node. */ | ||
| 1261 | #define B_N_CHILD_NUM(bh, n_pos) (dc_block_number(B_N_CHILD(bh, n_pos))) | ||
| 1262 | #define PUT_B_N_CHILD_NUM(bh, n_pos, val) \ | ||
| 1263 | (put_dc_block_number(B_N_CHILD(bh, n_pos), val)) | ||
| 1264 | |||
| 1265 | /* maximal value of field child_size in structure disk_child */ | ||
| 1266 | /* child size is the combined size of all items and their headers */ | ||
| 1267 | #define MAX_CHILD_SIZE(bh) ((int)( (bh)->b_size - BLKH_SIZE )) | ||
| 1268 | |||
| 1269 | /* amount of used space in buffer (not including block head) */ | ||
| 1270 | #define B_CHILD_SIZE(cur) (MAX_CHILD_SIZE(cur)-(B_FREE_SPACE(cur))) | ||
| 1271 | |||
| 1272 | /* max and min number of keys in internal node */ | ||
| 1273 | #define MAX_NR_KEY(bh) ( (MAX_CHILD_SIZE(bh)-DC_SIZE)/(KEY_SIZE+DC_SIZE) ) | ||
| 1274 | #define MIN_NR_KEY(bh) (MAX_NR_KEY(bh)/2) | ||
| 1275 | |||
| 1276 | /***************************************************************************/ | ||
| 1277 | /* PATH STRUCTURES AND DEFINES */ | ||
| 1278 | /***************************************************************************/ | ||
| 1279 | |||
| 1280 | /* Search_by_key fills up the path from the root to the leaf as it descends the tree looking for the | ||
| 1281 | key. It uses reiserfs_bread to try to find buffers in the cache given their block number. If it | ||
| 1282 | does not find them in the cache it reads them from disk. For each node search_by_key finds using | ||
| 1283 | reiserfs_bread it then uses bin_search to look through that node. bin_search will find the | ||
| 1284 | position of the block_number of the next node if it is looking through an internal node. If it | ||
| 1285 | is looking through a leaf node bin_search will find the position of the item which has key either | ||
| 1286 | equal to given key, or which is the maximal key less than the given key. */ | ||
| 1287 | |||
| 1288 | struct path_element { | ||
| 1289 | struct buffer_head *pe_buffer; /* Pointer to the buffer at the path in the tree. */ | ||
| 1290 | int pe_position; /* Position in the tree node which is placed in the */ | ||
| 1291 | /* buffer above. */ | ||
| 1292 | }; | ||
| 1293 | |||
| 1294 | #define MAX_HEIGHT 5 /* maximal height of a tree. don't change this without changing JOURNAL_PER_BALANCE_CNT */ | ||
| 1295 | #define EXTENDED_MAX_HEIGHT 7 /* Must be equals MAX_HEIGHT + FIRST_PATH_ELEMENT_OFFSET */ | ||
| 1296 | #define FIRST_PATH_ELEMENT_OFFSET 2 /* Must be equal to at least 2. */ | ||
| 1297 | |||
| 1298 | #define ILLEGAL_PATH_ELEMENT_OFFSET 1 /* Must be equal to FIRST_PATH_ELEMENT_OFFSET - 1 */ | ||
| 1299 | #define MAX_FEB_SIZE 6 /* this MUST be MAX_HEIGHT + 1. See about FEB below */ | ||
| 1300 | |||
| 1301 | /* We need to keep track of who the ancestors of nodes are. When we | ||
| 1302 | perform a search we record which nodes were visited while | ||
| 1303 | descending the tree looking for the node we searched for. This list | ||
| 1304 | of nodes is called the path. This information is used while | ||
| 1305 | performing balancing. Note that this path information may become | ||
| 1306 | invalid, and this means we must check it when using it to see if it | ||
| 1307 | is still valid. You'll need to read search_by_key and the comments | ||
| 1308 | in it, especially about decrement_counters_in_path(), to understand | ||
| 1309 | this structure. | ||
| 1310 | |||
| 1311 | Paths make the code so much harder to work with and debug.... An | ||
| 1312 | enormous number of bugs are due to them, and trying to write or modify | ||
| 1313 | code that uses them just makes my head hurt. They are based on an | ||
| 1314 | excessive effort to avoid disturbing the precious VFS code.:-( The | ||
| 1315 | gods only know how we are going to SMP the code that uses them. | ||
| 1316 | znodes are the way! */ | ||
| 1317 | |||
| 1318 | #define PATH_READA 0x1 /* do read ahead */ | ||
| 1319 | #define PATH_READA_BACK 0x2 /* read backwards */ | ||
| 1320 | |||
| 1321 | struct treepath { | ||
| 1322 | int path_length; /* Length of the array above. */ | ||
| 1323 | int reada; | ||
| 1324 | struct path_element path_elements[EXTENDED_MAX_HEIGHT]; /* Array of the path elements. */ | ||
| 1325 | int pos_in_item; | ||
| 1326 | }; | ||
| 1327 | |||
| 1328 | #define pos_in_item(path) ((path)->pos_in_item) | ||
| 1329 | |||
| 1330 | #define INITIALIZE_PATH(var) \ | ||
| 1331 | struct treepath var = {.path_length = ILLEGAL_PATH_ELEMENT_OFFSET, .reada = 0,} | ||
| 1332 | |||
| 1333 | /* Get path element by path and path position. */ | ||
| 1334 | #define PATH_OFFSET_PELEMENT(path, n_offset) ((path)->path_elements + (n_offset)) | ||
| 1335 | |||
| 1336 | /* Get buffer header at the path by path and path position. */ | ||
| 1337 | #define PATH_OFFSET_PBUFFER(path, n_offset) (PATH_OFFSET_PELEMENT(path, n_offset)->pe_buffer) | ||
| 1338 | |||
| 1339 | /* Get position in the element at the path by path and path position. */ | ||
| 1340 | #define PATH_OFFSET_POSITION(path, n_offset) (PATH_OFFSET_PELEMENT(path, n_offset)->pe_position) | ||
| 1341 | |||
| 1342 | #define PATH_PLAST_BUFFER(path) (PATH_OFFSET_PBUFFER((path), (path)->path_length)) | ||
| 1343 | /* you know, to the person who didn't | ||
| 1344 | write this the macro name does not | ||
| 1345 | at first suggest what it does. | ||
| 1346 | Maybe POSITION_FROM_PATH_END? Or | ||
| 1347 | maybe we should just focus on | ||
| 1348 | dumping paths... -Hans */ | ||
| 1349 | #define PATH_LAST_POSITION(path) (PATH_OFFSET_POSITION((path), (path)->path_length)) | ||
| 1350 | |||
| 1351 | #define PATH_PITEM_HEAD(path) B_N_PITEM_HEAD(PATH_PLAST_BUFFER(path), PATH_LAST_POSITION(path)) | ||
| 1352 | |||
| 1353 | /* in do_balance leaf has h == 0 in contrast with path structure, | ||
| 1354 | where root has level == 0. That is why we need these defines */ | ||
| 1355 | #define PATH_H_PBUFFER(path, h) PATH_OFFSET_PBUFFER (path, path->path_length - (h)) /* tb->S[h] */ | ||
| 1356 | #define PATH_H_PPARENT(path, h) PATH_H_PBUFFER (path, (h) + 1) /* tb->F[h] or tb->S[0]->b_parent */ | ||
| 1357 | #define PATH_H_POSITION(path, h) PATH_OFFSET_POSITION (path, path->path_length - (h)) | ||
| 1358 | #define PATH_H_B_ITEM_ORDER(path, h) PATH_H_POSITION(path, h + 1) /* tb->S[h]->b_item_order */ | ||
| 1359 | |||
| 1360 | #define PATH_H_PATH_OFFSET(path, n_h) ((path)->path_length - (n_h)) | ||
| 1361 | |||
| 1362 | #define get_last_bh(path) PATH_PLAST_BUFFER(path) | ||
| 1363 | #define get_ih(path) PATH_PITEM_HEAD(path) | ||
| 1364 | #define get_item_pos(path) PATH_LAST_POSITION(path) | ||
| 1365 | #define get_item(path) ((void *)B_N_PITEM(PATH_PLAST_BUFFER(path), PATH_LAST_POSITION (path))) | ||
| 1366 | #define item_moved(ih,path) comp_items(ih, path) | ||
| 1367 | #define path_changed(ih,path) comp_items (ih, path) | ||
| 1368 | |||
| 1369 | /***************************************************************************/ | ||
| 1370 | /* MISC */ | ||
| 1371 | /***************************************************************************/ | ||
| 1372 | |||
| 1373 | /* Size of pointer to the unformatted node. */ | ||
| 1374 | #define UNFM_P_SIZE (sizeof(unp_t)) | ||
| 1375 | #define UNFM_P_SHIFT 2 | ||
| 1376 | |||
| 1377 | // in in-core inode key is stored on le form | ||
| 1378 | #define INODE_PKEY(inode) ((struct reiserfs_key *)(REISERFS_I(inode)->i_key)) | ||
| 1379 | |||
| 1380 | #define MAX_UL_INT 0xffffffff | ||
| 1381 | #define MAX_INT 0x7ffffff | ||
| 1382 | #define MAX_US_INT 0xffff | ||
| 1383 | |||
| 1384 | // reiserfs version 2 has max offset 60 bits. Version 1 - 32 bit offset | ||
| 1385 | #define U32_MAX (~(__u32)0) | ||
| 1386 | |||
| 1387 | static inline loff_t max_reiserfs_offset(struct inode *inode) | ||
| 1388 | { | ||
| 1389 | if (get_inode_item_key_version(inode) == KEY_FORMAT_3_5) | ||
| 1390 | return (loff_t) U32_MAX; | ||
| 1391 | |||
| 1392 | return (loff_t) ((~(__u64) 0) >> 4); | ||
| 1393 | } | ||
| 1394 | |||
| 1395 | /*#define MAX_KEY_UNIQUENESS MAX_UL_INT*/ | ||
| 1396 | #define MAX_KEY_OBJECTID MAX_UL_INT | ||
| 1397 | |||
| 1398 | #define MAX_B_NUM MAX_UL_INT | ||
| 1399 | #define MAX_FC_NUM MAX_US_INT | ||
| 1400 | |||
| 1401 | /* the purpose is to detect overflow of an unsigned short */ | ||
| 1402 | #define REISERFS_LINK_MAX (MAX_US_INT - 1000) | ||
| 1403 | |||
| 1404 | /* The following defines are used in reiserfs_insert_item and reiserfs_append_item */ | ||
| 1405 | #define REISERFS_KERNEL_MEM 0 /* reiserfs kernel memory mode */ | ||
| 1406 | #define REISERFS_USER_MEM 1 /* reiserfs user memory mode */ | ||
| 1407 | |||
| 1408 | #define fs_generation(s) (REISERFS_SB(s)->s_generation_counter) | ||
| 1409 | #define get_generation(s) atomic_read (&fs_generation(s)) | ||
| 1410 | #define FILESYSTEM_CHANGED_TB(tb) (get_generation((tb)->tb_sb) != (tb)->fs_gen) | ||
| 1411 | #define __fs_changed(gen,s) (gen != get_generation (s)) | ||
| 1412 | #define fs_changed(gen,s) \ | ||
| 1413 | ({ \ | ||
| 1414 | reiserfs_cond_resched(s); \ | ||
| 1415 | __fs_changed(gen, s); \ | ||
| 1416 | }) | ||
| 1417 | |||
| 1418 | /***************************************************************************/ | ||
| 1419 | /* FIXATE NODES */ | ||
| 1420 | /***************************************************************************/ | ||
| 1421 | |||
| 1422 | #define VI_TYPE_LEFT_MERGEABLE 1 | ||
| 1423 | #define VI_TYPE_RIGHT_MERGEABLE 2 | ||
| 1424 | |||
| 1425 | /* To make any changes in the tree we always first find node, that | ||
| 1426 | contains item to be changed/deleted or place to insert a new | ||
| 1427 | item. We call this node S. To do balancing we need to decide what | ||
| 1428 | we will shift to left/right neighbor, or to a new node, where new | ||
| 1429 | item will be etc. To make this analysis simpler we build virtual | ||
| 1430 | node. Virtual node is an array of items, that will replace items of | ||
| 1431 | node S. (For instance if we are going to delete an item, virtual | ||
| 1432 | node does not contain it). Virtual node keeps information about | ||
| 1433 | item sizes and types, mergeability of first and last items, sizes | ||
| 1434 | of all entries in directory item. We use this array of items when | ||
| 1435 | calculating what we can shift to neighbors and how many nodes we | ||
| 1436 | have to have if we do not any shiftings, if we shift to left/right | ||
| 1437 | neighbor or to both. */ | ||
| 1438 | struct virtual_item { | ||
| 1439 | int vi_index; // index in the array of item operations | ||
| 1440 | unsigned short vi_type; // left/right mergeability | ||
| 1441 | unsigned short vi_item_len; /* length of item that it will have after balancing */ | ||
| 1442 | struct item_head *vi_ih; | ||
| 1443 | const char *vi_item; // body of item (old or new) | ||
| 1444 | const void *vi_new_data; // 0 always but paste mode | ||
| 1445 | void *vi_uarea; // item specific area | ||
| 1446 | }; | ||
| 1447 | |||
| 1448 | struct virtual_node { | ||
| 1449 | char *vn_free_ptr; /* this is a pointer to the free space in the buffer */ | ||
| 1450 | unsigned short vn_nr_item; /* number of items in virtual node */ | ||
| 1451 | short vn_size; /* size of node , that node would have if it has unlimited size and no balancing is performed */ | ||
| 1452 | short vn_mode; /* mode of balancing (paste, insert, delete, cut) */ | ||
| 1453 | short vn_affected_item_num; | ||
| 1454 | short vn_pos_in_item; | ||
| 1455 | struct item_head *vn_ins_ih; /* item header of inserted item, 0 for other modes */ | ||
| 1456 | const void *vn_data; | ||
| 1457 | struct virtual_item *vn_vi; /* array of items (including a new one, excluding item to be deleted) */ | ||
| 1458 | }; | ||
| 1459 | |||
| 1460 | /* used by directory items when creating virtual nodes */ | ||
| 1461 | struct direntry_uarea { | ||
| 1462 | int flags; | ||
| 1463 | __u16 entry_count; | ||
| 1464 | __u16 entry_sizes[1]; | ||
| 1465 | } __attribute__ ((__packed__)); | ||
| 1466 | |||
| 1467 | /***************************************************************************/ | ||
| 1468 | /* TREE BALANCE */ | ||
| 1469 | /***************************************************************************/ | ||
| 1470 | |||
| 1471 | /* This temporary structure is used in tree balance algorithms, and | ||
| 1472 | constructed as we go to the extent that its various parts are | ||
| 1473 | needed. It contains arrays of nodes that can potentially be | ||
| 1474 | involved in the balancing of node S, and parameters that define how | ||
| 1475 | each of the nodes must be balanced. Note that in these algorithms | ||
| 1476 | for balancing the worst case is to need to balance the current node | ||
| 1477 | S and the left and right neighbors and all of their parents plus | ||
| 1478 | create a new node. We implement S1 balancing for the leaf nodes | ||
| 1479 | and S0 balancing for the internal nodes (S1 and S0 are defined in | ||
| 1480 | our papers.)*/ | ||
| 1481 | |||
| 1482 | #define MAX_FREE_BLOCK 7 /* size of the array of buffers to free at end of do_balance */ | ||
| 1483 | |||
| 1484 | /* maximum number of FEB blocknrs on a single level */ | ||
| 1485 | #define MAX_AMOUNT_NEEDED 2 | ||
| 1486 | |||
| 1487 | /* someday somebody will prefix every field in this struct with tb_ */ | ||
| 1488 | struct tree_balance { | ||
| 1489 | int tb_mode; | ||
| 1490 | int need_balance_dirty; | ||
| 1491 | struct super_block *tb_sb; | ||
| 1492 | struct reiserfs_transaction_handle *transaction_handle; | ||
| 1493 | struct treepath *tb_path; | ||
| 1494 | struct buffer_head *L[MAX_HEIGHT]; /* array of left neighbors of nodes in the path */ | ||
| 1495 | struct buffer_head *R[MAX_HEIGHT]; /* array of right neighbors of nodes in the path */ | ||
| 1496 | struct buffer_head *FL[MAX_HEIGHT]; /* array of fathers of the left neighbors */ | ||
| 1497 | struct buffer_head *FR[MAX_HEIGHT]; /* array of fathers of the right neighbors */ | ||
| 1498 | struct buffer_head *CFL[MAX_HEIGHT]; /* array of common parents of center node and its left neighbor */ | ||
| 1499 | struct buffer_head *CFR[MAX_HEIGHT]; /* array of common parents of center node and its right neighbor */ | ||
| 1500 | |||
| 1501 | struct buffer_head *FEB[MAX_FEB_SIZE]; /* array of empty buffers. Number of buffers in array equals | ||
| 1502 | cur_blknum. */ | ||
| 1503 | struct buffer_head *used[MAX_FEB_SIZE]; | ||
| 1504 | struct buffer_head *thrown[MAX_FEB_SIZE]; | ||
| 1505 | int lnum[MAX_HEIGHT]; /* array of number of items which must be | ||
| 1506 | shifted to the left in order to balance the | ||
| 1507 | current node; for leaves includes item that | ||
| 1508 | will be partially shifted; for internal | ||
| 1509 | nodes, it is the number of child pointers | ||
| 1510 | rather than items. It includes the new item | ||
| 1511 | being created. The code sometimes subtracts | ||
| 1512 | one to get the number of wholly shifted | ||
| 1513 | items for other purposes. */ | ||
| 1514 | int rnum[MAX_HEIGHT]; /* substitute right for left in comment above */ | ||
| 1515 | int lkey[MAX_HEIGHT]; /* array indexed by height h mapping the key delimiting L[h] and | ||
| 1516 | S[h] to its item number within the node CFL[h] */ | ||
| 1517 | int rkey[MAX_HEIGHT]; /* substitute r for l in comment above */ | ||
| 1518 | int insert_size[MAX_HEIGHT]; /* the number of bytes by we are trying to add or remove from | ||
| 1519 | S[h]. A negative value means removing. */ | ||
| 1520 | int blknum[MAX_HEIGHT]; /* number of nodes that will replace node S[h] after | ||
| 1521 | balancing on the level h of the tree. If 0 then S is | ||
| 1522 | being deleted, if 1 then S is remaining and no new nodes | ||
| 1523 | are being created, if 2 or 3 then 1 or 2 new nodes is | ||
| 1524 | being created */ | ||
| 1525 | |||
| 1526 | /* fields that are used only for balancing leaves of the tree */ | ||
| 1527 | int cur_blknum; /* number of empty blocks having been already allocated */ | ||
| 1528 | int s0num; /* number of items that fall into left most node when S[0] splits */ | ||
| 1529 | int s1num; /* number of items that fall into first new node when S[0] splits */ | ||
| 1530 | int s2num; /* number of items that fall into second new node when S[0] splits */ | ||
| 1531 | int lbytes; /* number of bytes which can flow to the left neighbor from the left */ | ||
| 1532 | /* most liquid item that cannot be shifted from S[0] entirely */ | ||
| 1533 | /* if -1 then nothing will be partially shifted */ | ||
| 1534 | int rbytes; /* number of bytes which will flow to the right neighbor from the right */ | ||
| 1535 | /* most liquid item that cannot be shifted from S[0] entirely */ | ||
| 1536 | /* if -1 then nothing will be partially shifted */ | ||
| 1537 | int s1bytes; /* number of bytes which flow to the first new node when S[0] splits */ | ||
| 1538 | /* note: if S[0] splits into 3 nodes, then items do not need to be cut */ | ||
| 1539 | int s2bytes; | ||
| 1540 | struct buffer_head *buf_to_free[MAX_FREE_BLOCK]; /* buffers which are to be freed after do_balance finishes by unfix_nodes */ | ||
| 1541 | char *vn_buf; /* kmalloced memory. Used to create | ||
| 1542 | virtual node and keep map of | ||
| 1543 | dirtied bitmap blocks */ | ||
| 1544 | int vn_buf_size; /* size of the vn_buf */ | ||
| 1545 | struct virtual_node *tb_vn; /* VN starts after bitmap of bitmap blocks */ | ||
| 1546 | |||
| 1547 | int fs_gen; /* saved value of `reiserfs_generation' counter | ||
| 1548 | see FILESYSTEM_CHANGED() macro in reiserfs_fs.h */ | ||
| 1549 | #ifdef DISPLACE_NEW_PACKING_LOCALITIES | ||
| 1550 | struct in_core_key key; /* key pointer, to pass to block allocator or | ||
| 1551 | another low-level subsystem */ | ||
| 1552 | #endif | ||
| 1553 | }; | ||
| 1554 | |||
| 1555 | /* These are modes of balancing */ | ||
| 1556 | |||
| 1557 | /* When inserting an item. */ | ||
| 1558 | #define M_INSERT 'i' | ||
| 1559 | /* When inserting into (directories only) or appending onto an already | ||
| 1560 | existent item. */ | ||
| 1561 | #define M_PASTE 'p' | ||
| 1562 | /* When deleting an item. */ | ||
| 1563 | #define M_DELETE 'd' | ||
| 1564 | /* When truncating an item or removing an entry from a (directory) item. */ | ||
| 1565 | #define M_CUT 'c' | ||
| 1566 | |||
| 1567 | /* used when balancing on leaf level skipped (in reiserfsck) */ | ||
| 1568 | #define M_INTERNAL 'n' | ||
| 1569 | |||
| 1570 | /* When further balancing is not needed, then do_balance does not need | ||
| 1571 | to be called. */ | ||
| 1572 | #define M_SKIP_BALANCING 's' | ||
| 1573 | #define M_CONVERT 'v' | ||
| 1574 | |||
| 1575 | /* modes of leaf_move_items */ | ||
| 1576 | #define LEAF_FROM_S_TO_L 0 | ||
| 1577 | #define LEAF_FROM_S_TO_R 1 | ||
| 1578 | #define LEAF_FROM_R_TO_L 2 | ||
| 1579 | #define LEAF_FROM_L_TO_R 3 | ||
| 1580 | #define LEAF_FROM_S_TO_SNEW 4 | ||
| 1581 | |||
| 1582 | #define FIRST_TO_LAST 0 | ||
| 1583 | #define LAST_TO_FIRST 1 | ||
| 1584 | |||
| 1585 | /* used in do_balance for passing parent of node information that has | ||
| 1586 | been gotten from tb struct */ | ||
| 1587 | struct buffer_info { | ||
| 1588 | struct tree_balance *tb; | ||
| 1589 | struct buffer_head *bi_bh; | ||
| 1590 | struct buffer_head *bi_parent; | ||
| 1591 | int bi_position; | ||
| 1592 | }; | ||
| 1593 | |||
| 1594 | static inline struct super_block *sb_from_tb(struct tree_balance *tb) | ||
| 1595 | { | ||
| 1596 | return tb ? tb->tb_sb : NULL; | ||
| 1597 | } | ||
| 1598 | |||
| 1599 | static inline struct super_block *sb_from_bi(struct buffer_info *bi) | ||
| 1600 | { | ||
| 1601 | return bi ? sb_from_tb(bi->tb) : NULL; | ||
| 1602 | } | ||
| 1603 | |||
| 1604 | /* there are 4 types of items: stat data, directory item, indirect, direct. | ||
| 1605 | +-------------------+------------+--------------+------------+ | ||
| 1606 | | | k_offset | k_uniqueness | mergeable? | | ||
| 1607 | +-------------------+------------+--------------+------------+ | ||
| 1608 | | stat data | 0 | 0 | no | | ||
| 1609 | +-------------------+------------+--------------+------------+ | ||
| 1610 | | 1st directory item| DOT_OFFSET |DIRENTRY_UNIQUENESS| no | | ||
| 1611 | | non 1st directory | hash value | | yes | | ||
| 1612 | | item | | | | | ||
| 1613 | +-------------------+------------+--------------+------------+ | ||
| 1614 | | indirect item | offset + 1 |TYPE_INDIRECT | if this is not the first indirect item of the object | ||
| 1615 | +-------------------+------------+--------------+------------+ | ||
| 1616 | | direct item | offset + 1 |TYPE_DIRECT | if not this is not the first direct item of the object | ||
| 1617 | +-------------------+------------+--------------+------------+ | ||
| 1618 | */ | ||
| 1619 | |||
| 1620 | struct item_operations { | ||
| 1621 | int (*bytes_number) (struct item_head * ih, int block_size); | ||
| 1622 | void (*decrement_key) (struct cpu_key *); | ||
| 1623 | int (*is_left_mergeable) (struct reiserfs_key * ih, | ||
| 1624 | unsigned long bsize); | ||
| 1625 | void (*print_item) (struct item_head *, char *item); | ||
| 1626 | void (*check_item) (struct item_head *, char *item); | ||
| 1627 | |||
| 1628 | int (*create_vi) (struct virtual_node * vn, struct virtual_item * vi, | ||
| 1629 | int is_affected, int insert_size); | ||
| 1630 | int (*check_left) (struct virtual_item * vi, int free, | ||
| 1631 | int start_skip, int end_skip); | ||
| 1632 | int (*check_right) (struct virtual_item * vi, int free); | ||
| 1633 | int (*part_size) (struct virtual_item * vi, int from, int to); | ||
| 1634 | int (*unit_num) (struct virtual_item * vi); | ||
| 1635 | void (*print_vi) (struct virtual_item * vi); | ||
| 1636 | }; | ||
| 1637 | |||
| 1638 | extern struct item_operations *item_ops[TYPE_ANY + 1]; | ||
| 1639 | |||
| 1640 | #define op_bytes_number(ih,bsize) item_ops[le_ih_k_type (ih)]->bytes_number (ih, bsize) | ||
| 1641 | #define op_is_left_mergeable(key,bsize) item_ops[le_key_k_type (le_key_version (key), key)]->is_left_mergeable (key, bsize) | ||
| 1642 | #define op_print_item(ih,item) item_ops[le_ih_k_type (ih)]->print_item (ih, item) | ||
| 1643 | #define op_check_item(ih,item) item_ops[le_ih_k_type (ih)]->check_item (ih, item) | ||
| 1644 | #define op_create_vi(vn,vi,is_affected,insert_size) item_ops[le_ih_k_type ((vi)->vi_ih)]->create_vi (vn,vi,is_affected,insert_size) | ||
| 1645 | #define op_check_left(vi,free,start_skip,end_skip) item_ops[(vi)->vi_index]->check_left (vi, free, start_skip, end_skip) | ||
| 1646 | #define op_check_right(vi,free) item_ops[(vi)->vi_index]->check_right (vi, free) | ||
| 1647 | #define op_part_size(vi,from,to) item_ops[(vi)->vi_index]->part_size (vi, from, to) | ||
| 1648 | #define op_unit_num(vi) item_ops[(vi)->vi_index]->unit_num (vi) | ||
| 1649 | #define op_print_vi(vi) item_ops[(vi)->vi_index]->print_vi (vi) | ||
| 1650 | |||
| 1651 | #define COMP_SHORT_KEYS comp_short_keys | ||
| 1652 | |||
| 1653 | /* number of blocks pointed to by the indirect item */ | ||
| 1654 | #define I_UNFM_NUM(ih) (ih_item_len(ih) / UNFM_P_SIZE) | ||
| 1655 | |||
| 1656 | /* the used space within the unformatted node corresponding to pos within the item pointed to by ih */ | ||
| 1657 | #define I_POS_UNFM_SIZE(ih,pos,size) (((pos) == I_UNFM_NUM(ih) - 1 ) ? (size) - ih_free_space(ih) : (size)) | ||
| 1658 | |||
| 1659 | /* number of bytes contained by the direct item or the unformatted nodes the indirect item points to */ | ||
| 1660 | |||
| 1661 | /* get the item header */ | ||
| 1662 | #define B_N_PITEM_HEAD(bh,item_num) ( (struct item_head * )((bh)->b_data + BLKH_SIZE) + (item_num) ) | ||
| 1663 | |||
| 1664 | /* get key */ | ||
| 1665 | #define B_N_PDELIM_KEY(bh,item_num) ( (struct reiserfs_key * )((bh)->b_data + BLKH_SIZE) + (item_num) ) | ||
| 1666 | |||
| 1667 | /* get the key */ | ||
| 1668 | #define B_N_PKEY(bh,item_num) ( &(B_N_PITEM_HEAD(bh,item_num)->ih_key) ) | ||
| 1669 | |||
| 1670 | /* get item body */ | ||
| 1671 | #define B_N_PITEM(bh,item_num) ( (bh)->b_data + ih_location(B_N_PITEM_HEAD((bh),(item_num)))) | ||
| 1672 | |||
| 1673 | /* get the stat data by the buffer header and the item order */ | ||
| 1674 | #define B_N_STAT_DATA(bh,nr) \ | ||
| 1675 | ( (struct stat_data *)((bh)->b_data + ih_location(B_N_PITEM_HEAD((bh),(nr))) ) ) | ||
| 1676 | |||
| 1677 | /* following defines use reiserfs buffer header and item header */ | ||
| 1678 | |||
| 1679 | /* get stat-data */ | ||
| 1680 | #define B_I_STAT_DATA(bh, ih) ( (struct stat_data * )((bh)->b_data + ih_location(ih)) ) | ||
| 1681 | |||
| 1682 | // this is 3976 for size==4096 | ||
| 1683 | #define MAX_DIRECT_ITEM_LEN(size) ((size) - BLKH_SIZE - 2*IH_SIZE - SD_SIZE - UNFM_P_SIZE) | ||
| 1684 | |||
| 1685 | /* indirect items consist of entries which contain blocknrs, pos | ||
| 1686 | indicates which entry, and B_I_POS_UNFM_POINTER resolves to the | ||
| 1687 | blocknr contained by the entry pos points to */ | ||
| 1688 | #define B_I_POS_UNFM_POINTER(bh,ih,pos) le32_to_cpu(*(((unp_t *)B_I_PITEM(bh,ih)) + (pos))) | ||
| 1689 | #define PUT_B_I_POS_UNFM_POINTER(bh,ih,pos, val) do {*(((unp_t *)B_I_PITEM(bh,ih)) + (pos)) = cpu_to_le32(val); } while (0) | ||
| 1690 | |||
| 1691 | struct reiserfs_iget_args { | ||
| 1692 | __u32 objectid; | ||
| 1693 | __u32 dirid; | ||
| 1694 | }; | ||
| 1695 | |||
| 1696 | /***************************************************************************/ | ||
| 1697 | /* FUNCTION DECLARATIONS */ | ||
| 1698 | /***************************************************************************/ | ||
| 1699 | |||
| 1700 | #define get_journal_desc_magic(bh) (bh->b_data + bh->b_size - 12) | ||
| 1701 | |||
| 1702 | #define journal_trans_half(blocksize) \ | ||
| 1703 | ((blocksize - sizeof (struct reiserfs_journal_desc) + sizeof (__u32) - 12) / sizeof (__u32)) | ||
| 1704 | |||
| 1705 | /* journal.c see journal.c for all the comments here */ | ||
| 1706 | |||
| 1707 | /* first block written in a commit. */ | ||
| 1708 | struct reiserfs_journal_desc { | ||
| 1709 | __le32 j_trans_id; /* id of commit */ | ||
| 1710 | __le32 j_len; /* length of commit. len +1 is the commit block */ | ||
| 1711 | __le32 j_mount_id; /* mount id of this trans */ | ||
| 1712 | __le32 j_realblock[1]; /* real locations for each block */ | ||
| 1713 | }; | ||
| 1714 | |||
| 1715 | #define get_desc_trans_id(d) le32_to_cpu((d)->j_trans_id) | ||
| 1716 | #define get_desc_trans_len(d) le32_to_cpu((d)->j_len) | ||
| 1717 | #define get_desc_mount_id(d) le32_to_cpu((d)->j_mount_id) | ||
| 1718 | |||
| 1719 | #define set_desc_trans_id(d,val) do { (d)->j_trans_id = cpu_to_le32 (val); } while (0) | ||
| 1720 | #define set_desc_trans_len(d,val) do { (d)->j_len = cpu_to_le32 (val); } while (0) | ||
| 1721 | #define set_desc_mount_id(d,val) do { (d)->j_mount_id = cpu_to_le32 (val); } while (0) | ||
| 1722 | |||
| 1723 | /* last block written in a commit */ | ||
| 1724 | struct reiserfs_journal_commit { | ||
| 1725 | __le32 j_trans_id; /* must match j_trans_id from the desc block */ | ||
| 1726 | __le32 j_len; /* ditto */ | ||
| 1727 | __le32 j_realblock[1]; /* real locations for each block */ | ||
| 1728 | }; | ||
| 1729 | |||
| 1730 | #define get_commit_trans_id(c) le32_to_cpu((c)->j_trans_id) | ||
| 1731 | #define get_commit_trans_len(c) le32_to_cpu((c)->j_len) | ||
| 1732 | #define get_commit_mount_id(c) le32_to_cpu((c)->j_mount_id) | ||
| 1733 | |||
| 1734 | #define set_commit_trans_id(c,val) do { (c)->j_trans_id = cpu_to_le32 (val); } while (0) | ||
| 1735 | #define set_commit_trans_len(c,val) do { (c)->j_len = cpu_to_le32 (val); } while (0) | ||
| 1736 | |||
| 1737 | /* this header block gets written whenever a transaction is considered fully flushed, and is more recent than the | ||
| 1738 | ** last fully flushed transaction. fully flushed means all the log blocks and all the real blocks are on disk, | ||
| 1739 | ** and this transaction does not need to be replayed. | ||
| 1740 | */ | ||
| 1741 | struct reiserfs_journal_header { | ||
| 1742 | __le32 j_last_flush_trans_id; /* id of last fully flushed transaction */ | ||
| 1743 | __le32 j_first_unflushed_offset; /* offset in the log of where to start replay after a crash */ | ||
| 1744 | __le32 j_mount_id; | ||
| 1745 | /* 12 */ struct journal_params jh_journal; | ||
| 1746 | }; | ||
| 1747 | |||
| 1748 | /* biggest tunable defines are right here */ | ||
| 1749 | #define JOURNAL_BLOCK_COUNT 8192 /* number of blocks in the journal */ | ||
| 1750 | #define JOURNAL_TRANS_MAX_DEFAULT 1024 /* biggest possible single transaction, don't change for now (8/3/99) */ | ||
| 1751 | #define JOURNAL_TRANS_MIN_DEFAULT 256 | ||
| 1752 | #define JOURNAL_MAX_BATCH_DEFAULT 900 /* max blocks to batch into one transaction, don't make this any bigger than 900 */ | ||
| 1753 | #define JOURNAL_MIN_RATIO 2 | ||
| 1754 | #define JOURNAL_MAX_COMMIT_AGE 30 | ||
| 1755 | #define JOURNAL_MAX_TRANS_AGE 30 | ||
| 1756 | #define JOURNAL_PER_BALANCE_CNT (3 * (MAX_HEIGHT-2) + 9) | ||
| 1757 | #define JOURNAL_BLOCKS_PER_OBJECT(sb) (JOURNAL_PER_BALANCE_CNT * 3 + \ | ||
| 1758 | 2 * (REISERFS_QUOTA_INIT_BLOCKS(sb) + \ | ||
| 1759 | REISERFS_QUOTA_TRANS_BLOCKS(sb))) | ||
| 1760 | |||
| 1761 | #ifdef CONFIG_QUOTA | ||
| 1762 | #define REISERFS_QUOTA_OPTS ((1 << REISERFS_USRQUOTA) | (1 << REISERFS_GRPQUOTA)) | ||
| 1763 | /* We need to update data and inode (atime) */ | ||
| 1764 | #define REISERFS_QUOTA_TRANS_BLOCKS(s) (REISERFS_SB(s)->s_mount_opt & REISERFS_QUOTA_OPTS ? 2 : 0) | ||
| 1765 | /* 1 balancing, 1 bitmap, 1 data per write + stat data update */ | ||
| 1766 | #define REISERFS_QUOTA_INIT_BLOCKS(s) (REISERFS_SB(s)->s_mount_opt & REISERFS_QUOTA_OPTS ? \ | ||
| 1767 | (DQUOT_INIT_ALLOC*(JOURNAL_PER_BALANCE_CNT+2)+DQUOT_INIT_REWRITE+1) : 0) | ||
| 1768 | /* same as with INIT */ | ||
| 1769 | #define REISERFS_QUOTA_DEL_BLOCKS(s) (REISERFS_SB(s)->s_mount_opt & REISERFS_QUOTA_OPTS ? \ | ||
| 1770 | (DQUOT_DEL_ALLOC*(JOURNAL_PER_BALANCE_CNT+2)+DQUOT_DEL_REWRITE+1) : 0) | ||
| 1771 | #else | ||
| 1772 | #define REISERFS_QUOTA_TRANS_BLOCKS(s) 0 | ||
| 1773 | #define REISERFS_QUOTA_INIT_BLOCKS(s) 0 | ||
| 1774 | #define REISERFS_QUOTA_DEL_BLOCKS(s) 0 | ||
| 1775 | #endif | ||
| 1776 | |||
| 1777 | /* both of these can be as low as 1, or as high as you want. The min is the | ||
| 1778 | ** number of 4k bitmap nodes preallocated on mount. New nodes are allocated | ||
| 1779 | ** as needed, and released when transactions are committed. On release, if | ||
| 1780 | ** the current number of nodes is > max, the node is freed, otherwise, | ||
| 1781 | ** it is put on a free list for faster use later. | ||
| 1782 | */ | ||
| 1783 | #define REISERFS_MIN_BITMAP_NODES 10 | ||
| 1784 | #define REISERFS_MAX_BITMAP_NODES 100 | ||
| 1785 | |||
| 1786 | #define JBH_HASH_SHIFT 13 /* these are based on journal hash size of 8192 */ | ||
| 1787 | #define JBH_HASH_MASK 8191 | ||
| 1788 | |||
| 1789 | #define _jhashfn(sb,block) \ | ||
| 1790 | (((unsigned long)sb>>L1_CACHE_SHIFT) ^ \ | ||
| 1791 | (((block)<<(JBH_HASH_SHIFT - 6)) ^ ((block) >> 13) ^ ((block) << (JBH_HASH_SHIFT - 12)))) | ||
| 1792 | #define journal_hash(t,sb,block) ((t)[_jhashfn((sb),(block)) & JBH_HASH_MASK]) | ||
| 1793 | |||
| 1794 | // We need these to make journal.c code more readable | ||
| 1795 | #define journal_find_get_block(s, block) __find_get_block(SB_JOURNAL(s)->j_dev_bd, block, s->s_blocksize) | ||
| 1796 | #define journal_getblk(s, block) __getblk(SB_JOURNAL(s)->j_dev_bd, block, s->s_blocksize) | ||
| 1797 | #define journal_bread(s, block) __bread(SB_JOURNAL(s)->j_dev_bd, block, s->s_blocksize) | ||
| 1798 | |||
| 1799 | enum reiserfs_bh_state_bits { | ||
| 1800 | BH_JDirty = BH_PrivateStart, /* buffer is in current transaction */ | ||
| 1801 | BH_JDirty_wait, | ||
| 1802 | BH_JNew, /* disk block was taken off free list before | ||
| 1803 | * being in a finished transaction, or | ||
| 1804 | * written to disk. Can be reused immed. */ | ||
| 1805 | BH_JPrepared, | ||
| 1806 | BH_JRestore_dirty, | ||
| 1807 | BH_JTest, // debugging only will go away | ||
| 1808 | }; | ||
| 1809 | |||
| 1810 | BUFFER_FNS(JDirty, journaled); | ||
| 1811 | TAS_BUFFER_FNS(JDirty, journaled); | ||
| 1812 | BUFFER_FNS(JDirty_wait, journal_dirty); | ||
| 1813 | TAS_BUFFER_FNS(JDirty_wait, journal_dirty); | ||
| 1814 | BUFFER_FNS(JNew, journal_new); | ||
| 1815 | TAS_BUFFER_FNS(JNew, journal_new); | ||
| 1816 | BUFFER_FNS(JPrepared, journal_prepared); | ||
| 1817 | TAS_BUFFER_FNS(JPrepared, journal_prepared); | ||
| 1818 | BUFFER_FNS(JRestore_dirty, journal_restore_dirty); | ||
| 1819 | TAS_BUFFER_FNS(JRestore_dirty, journal_restore_dirty); | ||
| 1820 | BUFFER_FNS(JTest, journal_test); | ||
| 1821 | TAS_BUFFER_FNS(JTest, journal_test); | ||
| 1822 | |||
| 1823 | /* | ||
| 1824 | ** transaction handle which is passed around for all journal calls | ||
| 1825 | */ | ||
| 1826 | struct reiserfs_transaction_handle { | ||
| 1827 | struct super_block *t_super; /* super for this FS when journal_begin was | ||
| 1828 | called. saves calls to reiserfs_get_super | ||
| 1829 | also used by nested transactions to make | ||
| 1830 | sure they are nesting on the right FS | ||
| 1831 | _must_ be first in the handle | ||
| 1832 | */ | ||
| 1833 | int t_refcount; | ||
| 1834 | int t_blocks_logged; /* number of blocks this writer has logged */ | ||
| 1835 | int t_blocks_allocated; /* number of blocks this writer allocated */ | ||
| 1836 | unsigned int t_trans_id; /* sanity check, equals the current trans id */ | ||
| 1837 | void *t_handle_save; /* save existing current->journal_info */ | ||
| 1838 | unsigned displace_new_blocks:1; /* if new block allocation occurres, that block | ||
| 1839 | should be displaced from others */ | ||
| 1840 | struct list_head t_list; | ||
| 1841 | }; | ||
| 1842 | |||
| 1843 | /* used to keep track of ordered and tail writes, attached to the buffer | ||
| 1844 | * head through b_journal_head. | ||
| 1845 | */ | ||
| 1846 | struct reiserfs_jh { | ||
| 1847 | struct reiserfs_journal_list *jl; | ||
| 1848 | struct buffer_head *bh; | ||
| 1849 | struct list_head list; | ||
| 1850 | }; | ||
| 1851 | |||
| 1852 | void reiserfs_free_jh(struct buffer_head *bh); | ||
| 1853 | int reiserfs_add_tail_list(struct inode *inode, struct buffer_head *bh); | ||
| 1854 | int reiserfs_add_ordered_list(struct inode *inode, struct buffer_head *bh); | ||
| 1855 | int journal_mark_dirty(struct reiserfs_transaction_handle *, | ||
| 1856 | struct super_block *, struct buffer_head *bh); | ||
| 1857 | |||
| 1858 | static inline int reiserfs_file_data_log(struct inode *inode) | ||
| 1859 | { | ||
| 1860 | if (reiserfs_data_log(inode->i_sb) || | ||
| 1861 | (REISERFS_I(inode)->i_flags & i_data_log)) | ||
| 1862 | return 1; | ||
| 1863 | return 0; | ||
| 1864 | } | ||
| 1865 | |||
| 1866 | static inline int reiserfs_transaction_running(struct super_block *s) | ||
| 1867 | { | ||
| 1868 | struct reiserfs_transaction_handle *th = current->journal_info; | ||
| 1869 | if (th && th->t_super == s) | ||
| 1870 | return 1; | ||
| 1871 | if (th && th->t_super == NULL) | ||
| 1872 | BUG(); | ||
| 1873 | return 0; | ||
| 1874 | } | ||
| 1875 | |||
| 1876 | static inline int reiserfs_transaction_free_space(struct reiserfs_transaction_handle *th) | ||
| 1877 | { | ||
| 1878 | return th->t_blocks_allocated - th->t_blocks_logged; | ||
| 1879 | } | ||
| 1880 | |||
| 1881 | struct reiserfs_transaction_handle *reiserfs_persistent_transaction(struct | ||
| 1882 | super_block | ||
| 1883 | *, | ||
| 1884 | int count); | ||
| 1885 | int reiserfs_end_persistent_transaction(struct reiserfs_transaction_handle *); | ||
| 1886 | int reiserfs_commit_page(struct inode *inode, struct page *page, | ||
| 1887 | unsigned from, unsigned to); | ||
| 1888 | int reiserfs_flush_old_commits(struct super_block *); | ||
| 1889 | int reiserfs_commit_for_inode(struct inode *); | ||
| 1890 | int reiserfs_inode_needs_commit(struct inode *); | ||
| 1891 | void reiserfs_update_inode_transaction(struct inode *); | ||
| 1892 | void reiserfs_wait_on_write_block(struct super_block *s); | ||
| 1893 | void reiserfs_block_writes(struct reiserfs_transaction_handle *th); | ||
| 1894 | void reiserfs_allow_writes(struct super_block *s); | ||
| 1895 | void reiserfs_check_lock_depth(struct super_block *s, char *caller); | ||
| 1896 | int reiserfs_prepare_for_journal(struct super_block *, struct buffer_head *bh, | ||
| 1897 | int wait); | ||
| 1898 | void reiserfs_restore_prepared_buffer(struct super_block *, | ||
| 1899 | struct buffer_head *bh); | ||
| 1900 | int journal_init(struct super_block *, const char *j_dev_name, int old_format, | ||
| 1901 | unsigned int); | ||
| 1902 | int journal_release(struct reiserfs_transaction_handle *, struct super_block *); | ||
| 1903 | int journal_release_error(struct reiserfs_transaction_handle *, | ||
| 1904 | struct super_block *); | ||
| 1905 | int journal_end(struct reiserfs_transaction_handle *, struct super_block *, | ||
| 1906 | unsigned long); | ||
| 1907 | int journal_end_sync(struct reiserfs_transaction_handle *, struct super_block *, | ||
| 1908 | unsigned long); | ||
| 1909 | int journal_mark_freed(struct reiserfs_transaction_handle *, | ||
| 1910 | struct super_block *, b_blocknr_t blocknr); | ||
| 1911 | int journal_transaction_should_end(struct reiserfs_transaction_handle *, int); | ||
| 1912 | int reiserfs_in_journal(struct super_block *sb, unsigned int bmap_nr, | ||
| 1913 | int bit_nr, int searchall, b_blocknr_t *next); | ||
| 1914 | int journal_begin(struct reiserfs_transaction_handle *, | ||
| 1915 | struct super_block *sb, unsigned long); | ||
| 1916 | int journal_join_abort(struct reiserfs_transaction_handle *, | ||
| 1917 | struct super_block *sb, unsigned long); | ||
| 1918 | void reiserfs_abort_journal(struct super_block *sb, int errno); | ||
| 1919 | void reiserfs_abort(struct super_block *sb, int errno, const char *fmt, ...); | ||
| 1920 | int reiserfs_allocate_list_bitmaps(struct super_block *s, | ||
| 1921 | struct reiserfs_list_bitmap *, unsigned int); | ||
| 1922 | |||
| 1923 | void add_save_link(struct reiserfs_transaction_handle *th, | ||
| 1924 | struct inode *inode, int truncate); | ||
| 1925 | int remove_save_link(struct inode *inode, int truncate); | ||
| 1926 | |||
| 1927 | /* objectid.c */ | ||
| 1928 | __u32 reiserfs_get_unused_objectid(struct reiserfs_transaction_handle *th); | ||
| 1929 | void reiserfs_release_objectid(struct reiserfs_transaction_handle *th, | ||
| 1930 | __u32 objectid_to_release); | ||
| 1931 | int reiserfs_convert_objectid_map_v1(struct super_block *); | ||
| 1932 | |||
| 1933 | /* stree.c */ | ||
| 1934 | int B_IS_IN_TREE(const struct buffer_head *); | ||
| 1935 | extern void copy_item_head(struct item_head *to, | ||
| 1936 | const struct item_head *from); | ||
| 1937 | |||
| 1938 | // first key is in cpu form, second - le | ||
| 1939 | extern int comp_short_keys(const struct reiserfs_key *le_key, | ||
| 1940 | const struct cpu_key *cpu_key); | ||
| 1941 | extern void le_key2cpu_key(struct cpu_key *to, const struct reiserfs_key *from); | ||
| 1942 | |||
| 1943 | // both are in le form | ||
| 1944 | extern int comp_le_keys(const struct reiserfs_key *, | ||
| 1945 | const struct reiserfs_key *); | ||
| 1946 | extern int comp_short_le_keys(const struct reiserfs_key *, | ||
| 1947 | const struct reiserfs_key *); | ||
| 1948 | |||
| 1949 | // | ||
| 1950 | // get key version from on disk key - kludge | ||
| 1951 | // | ||
| 1952 | static inline int le_key_version(const struct reiserfs_key *key) | ||
| 1953 | { | ||
| 1954 | int type; | ||
| 1955 | |||
| 1956 | type = offset_v2_k_type(&(key->u.k_offset_v2)); | ||
| 1957 | if (type != TYPE_DIRECT && type != TYPE_INDIRECT | ||
| 1958 | && type != TYPE_DIRENTRY) | ||
| 1959 | return KEY_FORMAT_3_5; | ||
| 1960 | |||
| 1961 | return KEY_FORMAT_3_6; | ||
| 1962 | |||
| 1963 | } | ||
| 1964 | |||
| 1965 | static inline void copy_key(struct reiserfs_key *to, | ||
| 1966 | const struct reiserfs_key *from) | ||
| 1967 | { | ||
| 1968 | memcpy(to, from, KEY_SIZE); | ||
| 1969 | } | ||
| 1970 | |||
| 1971 | int comp_items(const struct item_head *stored_ih, const struct treepath *path); | ||
| 1972 | const struct reiserfs_key *get_rkey(const struct treepath *chk_path, | ||
| 1973 | const struct super_block *sb); | ||
| 1974 | int search_by_key(struct super_block *, const struct cpu_key *, | ||
| 1975 | struct treepath *, int); | ||
| 1976 | #define search_item(s,key,path) search_by_key (s, key, path, DISK_LEAF_NODE_LEVEL) | ||
| 1977 | int search_for_position_by_key(struct super_block *sb, | ||
| 1978 | const struct cpu_key *cpu_key, | ||
| 1979 | struct treepath *search_path); | ||
| 1980 | extern void decrement_bcount(struct buffer_head *bh); | ||
| 1981 | void decrement_counters_in_path(struct treepath *search_path); | ||
| 1982 | void pathrelse(struct treepath *search_path); | ||
| 1983 | int reiserfs_check_path(struct treepath *p); | ||
| 1984 | void pathrelse_and_restore(struct super_block *s, struct treepath *search_path); | ||
| 1985 | |||
| 1986 | int reiserfs_insert_item(struct reiserfs_transaction_handle *th, | ||
| 1987 | struct treepath *path, | ||
| 1988 | const struct cpu_key *key, | ||
| 1989 | struct item_head *ih, | ||
| 1990 | struct inode *inode, const char *body); | ||
| 1991 | |||
| 1992 | int reiserfs_paste_into_item(struct reiserfs_transaction_handle *th, | ||
| 1993 | struct treepath *path, | ||
| 1994 | const struct cpu_key *key, | ||
| 1995 | struct inode *inode, | ||
| 1996 | const char *body, int paste_size); | ||
| 1997 | |||
| 1998 | int reiserfs_cut_from_item(struct reiserfs_transaction_handle *th, | ||
| 1999 | struct treepath *path, | ||
| 2000 | struct cpu_key *key, | ||
| 2001 | struct inode *inode, | ||
| 2002 | struct page *page, loff_t new_file_size); | ||
| 2003 | |||
| 2004 | int reiserfs_delete_item(struct reiserfs_transaction_handle *th, | ||
| 2005 | struct treepath *path, | ||
| 2006 | const struct cpu_key *key, | ||
| 2007 | struct inode *inode, struct buffer_head *un_bh); | ||
| 2008 | |||
| 2009 | void reiserfs_delete_solid_item(struct reiserfs_transaction_handle *th, | ||
| 2010 | struct inode *inode, struct reiserfs_key *key); | ||
| 2011 | int reiserfs_delete_object(struct reiserfs_transaction_handle *th, | ||
| 2012 | struct inode *inode); | ||
| 2013 | int reiserfs_do_truncate(struct reiserfs_transaction_handle *th, | ||
| 2014 | struct inode *inode, struct page *, | ||
| 2015 | int update_timestamps); | ||
| 2016 | |||
| 2017 | #define i_block_size(inode) ((inode)->i_sb->s_blocksize) | ||
| 2018 | #define file_size(inode) ((inode)->i_size) | ||
| 2019 | #define tail_size(inode) (file_size (inode) & (i_block_size (inode) - 1)) | ||
| 2020 | |||
| 2021 | #define tail_has_to_be_packed(inode) (have_large_tails ((inode)->i_sb)?\ | ||
| 2022 | !STORE_TAIL_IN_UNFM_S1(file_size (inode), tail_size(inode), inode->i_sb->s_blocksize):have_small_tails ((inode)->i_sb)?!STORE_TAIL_IN_UNFM_S2(file_size (inode), tail_size(inode), inode->i_sb->s_blocksize):0 ) | ||
| 2023 | |||
| 2024 | void padd_item(char *item, int total_length, int length); | ||
| 2025 | |||
| 2026 | /* inode.c */ | ||
| 2027 | /* args for the create parameter of reiserfs_get_block */ | ||
| 2028 | #define GET_BLOCK_NO_CREATE 0 /* don't create new blocks or convert tails */ | ||
| 2029 | #define GET_BLOCK_CREATE 1 /* add anything you need to find block */ | ||
| 2030 | #define GET_BLOCK_NO_HOLE 2 /* return -ENOENT for file holes */ | ||
| 2031 | #define GET_BLOCK_READ_DIRECT 4 /* read the tail if indirect item not found */ | ||
| 2032 | #define GET_BLOCK_NO_IMUX 8 /* i_mutex is not held, don't preallocate */ | ||
| 2033 | #define GET_BLOCK_NO_DANGLE 16 /* don't leave any transactions running */ | ||
| 2034 | |||
| 2035 | void reiserfs_read_locked_inode(struct inode *inode, | ||
| 2036 | struct reiserfs_iget_args *args); | ||
| 2037 | int reiserfs_find_actor(struct inode *inode, void *p); | ||
| 2038 | int reiserfs_init_locked_inode(struct inode *inode, void *p); | ||
| 2039 | void reiserfs_evict_inode(struct inode *inode); | ||
| 2040 | int reiserfs_write_inode(struct inode *inode, struct writeback_control *wbc); | ||
| 2041 | int reiserfs_get_block(struct inode *inode, sector_t block, | ||
| 2042 | struct buffer_head *bh_result, int create); | ||
| 2043 | struct dentry *reiserfs_fh_to_dentry(struct super_block *sb, struct fid *fid, | ||
| 2044 | int fh_len, int fh_type); | ||
| 2045 | struct dentry *reiserfs_fh_to_parent(struct super_block *sb, struct fid *fid, | ||
| 2046 | int fh_len, int fh_type); | ||
| 2047 | int reiserfs_encode_fh(struct dentry *dentry, __u32 * data, int *lenp, | ||
| 2048 | int connectable); | ||
| 2049 | |||
| 2050 | int reiserfs_truncate_file(struct inode *, int update_timestamps); | ||
| 2051 | void make_cpu_key(struct cpu_key *cpu_key, struct inode *inode, loff_t offset, | ||
| 2052 | int type, int key_length); | ||
| 2053 | void make_le_item_head(struct item_head *ih, const struct cpu_key *key, | ||
| 2054 | int version, | ||
| 2055 | loff_t offset, int type, int length, int entry_count); | ||
| 2056 | struct inode *reiserfs_iget(struct super_block *s, const struct cpu_key *key); | ||
| 2057 | |||
| 2058 | struct reiserfs_security_handle; | ||
| 2059 | int reiserfs_new_inode(struct reiserfs_transaction_handle *th, | ||
| 2060 | struct inode *dir, umode_t mode, | ||
| 2061 | const char *symname, loff_t i_size, | ||
| 2062 | struct dentry *dentry, struct inode *inode, | ||
| 2063 | struct reiserfs_security_handle *security); | ||
| 2064 | |||
| 2065 | void reiserfs_update_sd_size(struct reiserfs_transaction_handle *th, | ||
| 2066 | struct inode *inode, loff_t size); | ||
| 2067 | |||
| 2068 | static inline void reiserfs_update_sd(struct reiserfs_transaction_handle *th, | ||
| 2069 | struct inode *inode) | ||
| 2070 | { | ||
| 2071 | reiserfs_update_sd_size(th, inode, inode->i_size); | ||
| 2072 | } | ||
| 2073 | |||
| 2074 | void sd_attrs_to_i_attrs(__u16 sd_attrs, struct inode *inode); | ||
| 2075 | void i_attrs_to_sd_attrs(struct inode *inode, __u16 * sd_attrs); | ||
| 2076 | int reiserfs_setattr(struct dentry *dentry, struct iattr *attr); | ||
| 2077 | |||
| 2078 | int __reiserfs_write_begin(struct page *page, unsigned from, unsigned len); | ||
| 2079 | |||
| 2080 | /* namei.c */ | ||
| 2081 | void set_de_name_and_namelen(struct reiserfs_dir_entry *de); | ||
| 2082 | int search_by_entry_key(struct super_block *sb, const struct cpu_key *key, | ||
| 2083 | struct treepath *path, struct reiserfs_dir_entry *de); | ||
| 2084 | struct dentry *reiserfs_get_parent(struct dentry *); | ||
| 2085 | |||
| 2086 | #ifdef CONFIG_REISERFS_PROC_INFO | ||
| 2087 | int reiserfs_proc_info_init(struct super_block *sb); | ||
| 2088 | int reiserfs_proc_info_done(struct super_block *sb); | ||
| 2089 | int reiserfs_proc_info_global_init(void); | ||
| 2090 | int reiserfs_proc_info_global_done(void); | ||
| 2091 | |||
| 2092 | #define PROC_EXP( e ) e | ||
| 2093 | |||
| 2094 | #define __PINFO( sb ) REISERFS_SB(sb) -> s_proc_info_data | ||
| 2095 | #define PROC_INFO_MAX( sb, field, value ) \ | ||
| 2096 | __PINFO( sb ).field = \ | ||
| 2097 | max( REISERFS_SB( sb ) -> s_proc_info_data.field, value ) | ||
| 2098 | #define PROC_INFO_INC( sb, field ) ( ++ ( __PINFO( sb ).field ) ) | ||
| 2099 | #define PROC_INFO_ADD( sb, field, val ) ( __PINFO( sb ).field += ( val ) ) | ||
| 2100 | #define PROC_INFO_BH_STAT( sb, bh, level ) \ | ||
| 2101 | PROC_INFO_INC( sb, sbk_read_at[ ( level ) ] ); \ | ||
| 2102 | PROC_INFO_ADD( sb, free_at[ ( level ) ], B_FREE_SPACE( bh ) ); \ | ||
| 2103 | PROC_INFO_ADD( sb, items_at[ ( level ) ], B_NR_ITEMS( bh ) ) | ||
| 2104 | #else | ||
| 2105 | static inline int reiserfs_proc_info_init(struct super_block *sb) | ||
| 2106 | { | ||
| 2107 | return 0; | ||
| 2108 | } | ||
| 2109 | |||
| 2110 | static inline int reiserfs_proc_info_done(struct super_block *sb) | ||
| 2111 | { | ||
| 2112 | return 0; | ||
| 2113 | } | ||
| 2114 | |||
| 2115 | static inline int reiserfs_proc_info_global_init(void) | ||
| 2116 | { | ||
| 2117 | return 0; | ||
| 2118 | } | ||
| 2119 | |||
| 2120 | static inline int reiserfs_proc_info_global_done(void) | ||
| 2121 | { | ||
| 2122 | return 0; | ||
| 2123 | } | ||
| 2124 | |||
| 2125 | #define PROC_EXP( e ) | ||
| 2126 | #define VOID_V ( ( void ) 0 ) | ||
| 2127 | #define PROC_INFO_MAX( sb, field, value ) VOID_V | ||
| 2128 | #define PROC_INFO_INC( sb, field ) VOID_V | ||
| 2129 | #define PROC_INFO_ADD( sb, field, val ) VOID_V | ||
| 2130 | #define PROC_INFO_BH_STAT(sb, bh, n_node_level) VOID_V | ||
| 2131 | #endif | ||
| 2132 | |||
| 2133 | /* dir.c */ | ||
| 2134 | extern const struct inode_operations reiserfs_dir_inode_operations; | ||
| 2135 | extern const struct inode_operations reiserfs_symlink_inode_operations; | ||
| 2136 | extern const struct inode_operations reiserfs_special_inode_operations; | ||
| 2137 | extern const struct file_operations reiserfs_dir_operations; | ||
| 2138 | int reiserfs_readdir_dentry(struct dentry *, void *, filldir_t, loff_t *); | ||
| 2139 | |||
| 2140 | /* tail_conversion.c */ | ||
| 2141 | int direct2indirect(struct reiserfs_transaction_handle *, struct inode *, | ||
| 2142 | struct treepath *, struct buffer_head *, loff_t); | ||
| 2143 | int indirect2direct(struct reiserfs_transaction_handle *, struct inode *, | ||
| 2144 | struct page *, struct treepath *, const struct cpu_key *, | ||
| 2145 | loff_t, char *); | ||
| 2146 | void reiserfs_unmap_buffer(struct buffer_head *); | ||
| 2147 | |||
| 2148 | /* file.c */ | ||
| 2149 | extern const struct inode_operations reiserfs_file_inode_operations; | ||
| 2150 | extern const struct file_operations reiserfs_file_operations; | ||
| 2151 | extern const struct address_space_operations reiserfs_address_space_operations; | ||
| 2152 | |||
| 2153 | /* fix_nodes.c */ | ||
| 2154 | |||
| 2155 | int fix_nodes(int n_op_mode, struct tree_balance *tb, | ||
| 2156 | struct item_head *ins_ih, const void *); | ||
| 2157 | void unfix_nodes(struct tree_balance *); | ||
| 2158 | |||
| 2159 | /* prints.c */ | ||
| 2160 | void __reiserfs_panic(struct super_block *s, const char *id, | ||
| 2161 | const char *function, const char *fmt, ...) | ||
| 2162 | __attribute__ ((noreturn)); | ||
| 2163 | #define reiserfs_panic(s, id, fmt, args...) \ | ||
| 2164 | __reiserfs_panic(s, id, __func__, fmt, ##args) | ||
| 2165 | void __reiserfs_error(struct super_block *s, const char *id, | ||
| 2166 | const char *function, const char *fmt, ...); | ||
| 2167 | #define reiserfs_error(s, id, fmt, args...) \ | ||
| 2168 | __reiserfs_error(s, id, __func__, fmt, ##args) | ||
| 2169 | void reiserfs_info(struct super_block *s, const char *fmt, ...); | ||
| 2170 | void reiserfs_debug(struct super_block *s, int level, const char *fmt, ...); | ||
| 2171 | void print_indirect_item(struct buffer_head *bh, int item_num); | ||
| 2172 | void store_print_tb(struct tree_balance *tb); | ||
| 2173 | void print_cur_tb(char *mes); | ||
| 2174 | void print_de(struct reiserfs_dir_entry *de); | ||
| 2175 | void print_bi(struct buffer_info *bi, char *mes); | ||
| 2176 | #define PRINT_LEAF_ITEMS 1 /* print all items */ | ||
| 2177 | #define PRINT_DIRECTORY_ITEMS 2 /* print directory items */ | ||
| 2178 | #define PRINT_DIRECT_ITEMS 4 /* print contents of direct items */ | ||
| 2179 | void print_block(struct buffer_head *bh, ...); | ||
| 2180 | void print_bmap(struct super_block *s, int silent); | ||
| 2181 | void print_bmap_block(int i, char *data, int size, int silent); | ||
| 2182 | /*void print_super_block (struct super_block * s, char * mes);*/ | ||
| 2183 | void print_objectid_map(struct super_block *s); | ||
| 2184 | void print_block_head(struct buffer_head *bh, char *mes); | ||
| 2185 | void check_leaf(struct buffer_head *bh); | ||
| 2186 | void check_internal(struct buffer_head *bh); | ||
| 2187 | void print_statistics(struct super_block *s); | ||
| 2188 | char *reiserfs_hashname(int code); | ||
| 2189 | |||
| 2190 | /* lbalance.c */ | ||
| 2191 | int leaf_move_items(int shift_mode, struct tree_balance *tb, int mov_num, | ||
| 2192 | int mov_bytes, struct buffer_head *Snew); | ||
| 2193 | int leaf_shift_left(struct tree_balance *tb, int shift_num, int shift_bytes); | ||
| 2194 | int leaf_shift_right(struct tree_balance *tb, int shift_num, int shift_bytes); | ||
| 2195 | void leaf_delete_items(struct buffer_info *cur_bi, int last_first, int first, | ||
| 2196 | int del_num, int del_bytes); | ||
| 2197 | void leaf_insert_into_buf(struct buffer_info *bi, int before, | ||
| 2198 | struct item_head *inserted_item_ih, | ||
| 2199 | const char *inserted_item_body, int zeros_number); | ||
| 2200 | void leaf_paste_in_buffer(struct buffer_info *bi, int pasted_item_num, | ||
| 2201 | int pos_in_item, int paste_size, const char *body, | ||
| 2202 | int zeros_number); | ||
| 2203 | void leaf_cut_from_buffer(struct buffer_info *bi, int cut_item_num, | ||
| 2204 | int pos_in_item, int cut_size); | ||
| 2205 | void leaf_paste_entries(struct buffer_info *bi, int item_num, int before, | ||
| 2206 | int new_entry_count, struct reiserfs_de_head *new_dehs, | ||
| 2207 | const char *records, int paste_size); | ||
| 2208 | /* ibalance.c */ | ||
| 2209 | int balance_internal(struct tree_balance *, int, int, struct item_head *, | ||
| 2210 | struct buffer_head **); | ||
| 2211 | |||
| 2212 | /* do_balance.c */ | ||
| 2213 | void do_balance_mark_leaf_dirty(struct tree_balance *tb, | ||
| 2214 | struct buffer_head *bh, int flag); | ||
| 2215 | #define do_balance_mark_internal_dirty do_balance_mark_leaf_dirty | ||
| 2216 | #define do_balance_mark_sb_dirty do_balance_mark_leaf_dirty | ||
| 2217 | |||
| 2218 | void do_balance(struct tree_balance *tb, struct item_head *ih, | ||
| 2219 | const char *body, int flag); | ||
| 2220 | void reiserfs_invalidate_buffer(struct tree_balance *tb, | ||
| 2221 | struct buffer_head *bh); | ||
| 2222 | |||
| 2223 | int get_left_neighbor_position(struct tree_balance *tb, int h); | ||
| 2224 | int get_right_neighbor_position(struct tree_balance *tb, int h); | ||
| 2225 | void replace_key(struct tree_balance *tb, struct buffer_head *, int, | ||
| 2226 | struct buffer_head *, int); | ||
| 2227 | void make_empty_node(struct buffer_info *); | ||
| 2228 | struct buffer_head *get_FEB(struct tree_balance *); | ||
| 2229 | |||
| 2230 | /* bitmap.c */ | ||
| 2231 | |||
| 2232 | /* structure contains hints for block allocator, and it is a container for | ||
| 2233 | * arguments, such as node, search path, transaction_handle, etc. */ | ||
| 2234 | struct __reiserfs_blocknr_hint { | ||
| 2235 | struct inode *inode; /* inode passed to allocator, if we allocate unf. nodes */ | ||
| 2236 | sector_t block; /* file offset, in blocks */ | ||
| 2237 | struct in_core_key key; | ||
| 2238 | struct treepath *path; /* search path, used by allocator to deternine search_start by | ||
| 2239 | * various ways */ | ||
| 2240 | struct reiserfs_transaction_handle *th; /* transaction handle is needed to log super blocks and | ||
| 2241 | * bitmap blocks changes */ | ||
| 2242 | b_blocknr_t beg, end; | ||
| 2243 | b_blocknr_t search_start; /* a field used to transfer search start value (block number) | ||
| 2244 | * between different block allocator procedures | ||
| 2245 | * (determine_search_start() and others) */ | ||
| 2246 | int prealloc_size; /* is set in determine_prealloc_size() function, used by underlayed | ||
| 2247 | * function that do actual allocation */ | ||
| 2248 | |||
| 2249 | unsigned formatted_node:1; /* the allocator uses different polices for getting disk space for | ||
| 2250 | * formatted/unformatted blocks with/without preallocation */ | ||
| 2251 | unsigned preallocate:1; | ||
| 2252 | }; | ||
| 2253 | |||
| 2254 | typedef struct __reiserfs_blocknr_hint reiserfs_blocknr_hint_t; | ||
| 2255 | |||
| 2256 | int reiserfs_parse_alloc_options(struct super_block *, char *); | ||
| 2257 | void reiserfs_init_alloc_options(struct super_block *s); | ||
| 2258 | |||
| 2259 | /* | ||
| 2260 | * given a directory, this will tell you what packing locality | ||
| 2261 | * to use for a new object underneat it. The locality is returned | ||
| 2262 | * in disk byte order (le). | ||
| 2263 | */ | ||
| 2264 | __le32 reiserfs_choose_packing(struct inode *dir); | ||
| 2265 | |||
| 2266 | int reiserfs_init_bitmap_cache(struct super_block *sb); | ||
| 2267 | void reiserfs_free_bitmap_cache(struct super_block *sb); | ||
| 2268 | void reiserfs_cache_bitmap_metadata(struct super_block *sb, struct buffer_head *bh, struct reiserfs_bitmap_info *info); | ||
| 2269 | struct buffer_head *reiserfs_read_bitmap_block(struct super_block *sb, unsigned int bitmap); | ||
| 2270 | int is_reusable(struct super_block *s, b_blocknr_t block, int bit_value); | ||
| 2271 | void reiserfs_free_block(struct reiserfs_transaction_handle *th, struct inode *, | ||
| 2272 | b_blocknr_t, int for_unformatted); | ||
| 2273 | int reiserfs_allocate_blocknrs(reiserfs_blocknr_hint_t *, b_blocknr_t *, int, | ||
| 2274 | int); | ||
| 2275 | static inline int reiserfs_new_form_blocknrs(struct tree_balance *tb, | ||
| 2276 | b_blocknr_t * new_blocknrs, | ||
| 2277 | int amount_needed) | ||
| 2278 | { | ||
| 2279 | reiserfs_blocknr_hint_t hint = { | ||
| 2280 | .th = tb->transaction_handle, | ||
| 2281 | .path = tb->tb_path, | ||
| 2282 | .inode = NULL, | ||
| 2283 | .key = tb->key, | ||
| 2284 | .block = 0, | ||
| 2285 | .formatted_node = 1 | ||
| 2286 | }; | ||
| 2287 | return reiserfs_allocate_blocknrs(&hint, new_blocknrs, amount_needed, | ||
| 2288 | 0); | ||
| 2289 | } | ||
| 2290 | |||
| 2291 | static inline int reiserfs_new_unf_blocknrs(struct reiserfs_transaction_handle | ||
| 2292 | *th, struct inode *inode, | ||
| 2293 | b_blocknr_t * new_blocknrs, | ||
| 2294 | struct treepath *path, | ||
| 2295 | sector_t block) | ||
| 2296 | { | ||
| 2297 | reiserfs_blocknr_hint_t hint = { | ||
| 2298 | .th = th, | ||
| 2299 | .path = path, | ||
| 2300 | .inode = inode, | ||
| 2301 | .block = block, | ||
| 2302 | .formatted_node = 0, | ||
| 2303 | .preallocate = 0 | ||
| 2304 | }; | ||
| 2305 | return reiserfs_allocate_blocknrs(&hint, new_blocknrs, 1, 0); | ||
| 2306 | } | ||
| 2307 | |||
| 2308 | #ifdef REISERFS_PREALLOCATE | ||
| 2309 | static inline int reiserfs_new_unf_blocknrs2(struct reiserfs_transaction_handle | ||
| 2310 | *th, struct inode *inode, | ||
| 2311 | b_blocknr_t * new_blocknrs, | ||
| 2312 | struct treepath *path, | ||
| 2313 | sector_t block) | ||
| 2314 | { | ||
| 2315 | reiserfs_blocknr_hint_t hint = { | ||
| 2316 | .th = th, | ||
| 2317 | .path = path, | ||
| 2318 | .inode = inode, | ||
| 2319 | .block = block, | ||
| 2320 | .formatted_node = 0, | ||
| 2321 | .preallocate = 1 | ||
| 2322 | }; | ||
| 2323 | return reiserfs_allocate_blocknrs(&hint, new_blocknrs, 1, 0); | ||
| 2324 | } | ||
| 2325 | |||
| 2326 | void reiserfs_discard_prealloc(struct reiserfs_transaction_handle *th, | ||
| 2327 | struct inode *inode); | ||
| 2328 | void reiserfs_discard_all_prealloc(struct reiserfs_transaction_handle *th); | ||
| 2329 | #endif | ||
| 2330 | |||
| 2331 | /* hashes.c */ | ||
| 2332 | __u32 keyed_hash(const signed char *msg, int len); | ||
| 2333 | __u32 yura_hash(const signed char *msg, int len); | ||
| 2334 | __u32 r5_hash(const signed char *msg, int len); | ||
| 2335 | |||
| 2336 | #define reiserfs_set_le_bit __set_bit_le | ||
| 2337 | #define reiserfs_test_and_set_le_bit __test_and_set_bit_le | ||
| 2338 | #define reiserfs_clear_le_bit __clear_bit_le | ||
| 2339 | #define reiserfs_test_and_clear_le_bit __test_and_clear_bit_le | ||
| 2340 | #define reiserfs_test_le_bit test_bit_le | ||
| 2341 | #define reiserfs_find_next_zero_le_bit find_next_zero_bit_le | ||
| 2342 | |||
| 2343 | /* sometimes reiserfs_truncate may require to allocate few new blocks | ||
| 2344 | to perform indirect2direct conversion. People probably used to | ||
| 2345 | think, that truncate should work without problems on a filesystem | ||
| 2346 | without free disk space. They may complain that they can not | ||
| 2347 | truncate due to lack of free disk space. This spare space allows us | ||
| 2348 | to not worry about it. 500 is probably too much, but it should be | ||
| 2349 | absolutely safe */ | ||
| 2350 | #define SPARE_SPACE 500 | ||
| 2351 | |||
| 2352 | /* prototypes from ioctl.c */ | ||
| 2353 | long reiserfs_ioctl(struct file *filp, unsigned int cmd, unsigned long arg); | ||
| 2354 | long reiserfs_compat_ioctl(struct file *filp, | ||
| 2355 | unsigned int cmd, unsigned long arg); | ||
| 2356 | int reiserfs_unpack(struct inode *inode, struct file *filp); | ||
| 2357 | |||
| 2358 | #endif /* __KERNEL__ */ | ||
| 2359 | |||
| 2360 | #endif /* _LINUX_REISER_FS_H */ | 26 | #endif /* _LINUX_REISER_FS_H */ |
diff --git a/include/linux/reiserfs_fs_i.h b/include/linux/reiserfs_fs_i.h deleted file mode 100644 index 97959bdfe214..000000000000 --- a/include/linux/reiserfs_fs_i.h +++ /dev/null | |||
| @@ -1,63 +0,0 @@ | |||
| 1 | #ifndef _REISER_FS_I | ||
| 2 | #define _REISER_FS_I | ||
| 3 | |||
| 4 | #include <linux/list.h> | ||
| 5 | |||
| 6 | struct reiserfs_journal_list; | ||
| 7 | |||
| 8 | /** bitmasks for i_flags field in reiserfs-specific part of inode */ | ||
| 9 | typedef enum { | ||
| 10 | /** this says what format of key do all items (but stat data) of | ||
| 11 | an object have. If this is set, that format is 3.6 otherwise | ||
| 12 | - 3.5 */ | ||
| 13 | i_item_key_version_mask = 0x0001, | ||
| 14 | /** If this is unset, object has 3.5 stat data, otherwise, it has | ||
| 15 | 3.6 stat data with 64bit size, 32bit nlink etc. */ | ||
| 16 | i_stat_data_version_mask = 0x0002, | ||
| 17 | /** file might need tail packing on close */ | ||
| 18 | i_pack_on_close_mask = 0x0004, | ||
| 19 | /** don't pack tail of file */ | ||
| 20 | i_nopack_mask = 0x0008, | ||
| 21 | /** If those is set, "safe link" was created for this file during | ||
| 22 | truncate or unlink. Safe link is used to avoid leakage of disk | ||
| 23 | space on crash with some files open, but unlinked. */ | ||
| 24 | i_link_saved_unlink_mask = 0x0010, | ||
| 25 | i_link_saved_truncate_mask = 0x0020, | ||
| 26 | i_has_xattr_dir = 0x0040, | ||
| 27 | i_data_log = 0x0080, | ||
| 28 | } reiserfs_inode_flags; | ||
| 29 | |||
| 30 | struct reiserfs_inode_info { | ||
| 31 | __u32 i_key[4]; /* key is still 4 32 bit integers */ | ||
| 32 | /** transient inode flags that are never stored on disk. Bitmasks | ||
| 33 | for this field are defined above. */ | ||
| 34 | __u32 i_flags; | ||
| 35 | |||
| 36 | __u32 i_first_direct_byte; // offset of first byte stored in direct item. | ||
| 37 | |||
| 38 | /* copy of persistent inode flags read from sd_attrs. */ | ||
| 39 | __u32 i_attrs; | ||
| 40 | |||
| 41 | int i_prealloc_block; /* first unused block of a sequence of unused blocks */ | ||
| 42 | int i_prealloc_count; /* length of that sequence */ | ||
| 43 | struct list_head i_prealloc_list; /* per-transaction list of inodes which | ||
| 44 | * have preallocated blocks */ | ||
| 45 | |||
| 46 | unsigned new_packing_locality:1; /* new_packig_locality is created; new blocks | ||
| 47 | * for the contents of this directory should be | ||
| 48 | * displaced */ | ||
| 49 | |||
| 50 | /* we use these for fsync or O_SYNC to decide which transaction | ||
| 51 | ** needs to be committed in order for this inode to be properly | ||
| 52 | ** flushed */ | ||
| 53 | unsigned int i_trans_id; | ||
| 54 | struct reiserfs_journal_list *i_jl; | ||
| 55 | atomic_t openers; | ||
| 56 | struct mutex tailpack; | ||
| 57 | #ifdef CONFIG_REISERFS_FS_XATTR | ||
| 58 | struct rw_semaphore i_xattr_sem; | ||
| 59 | #endif | ||
| 60 | struct inode vfs_inode; | ||
| 61 | }; | ||
| 62 | |||
| 63 | #endif | ||
diff --git a/include/linux/reiserfs_fs_sb.h b/include/linux/reiserfs_fs_sb.h deleted file mode 100644 index 8c9e85c64b46..000000000000 --- a/include/linux/reiserfs_fs_sb.h +++ /dev/null | |||
| @@ -1,554 +0,0 @@ | |||
| 1 | /* Copyright 1996-2000 Hans Reiser, see reiserfs/README for licensing | ||
| 2 | * and copyright details */ | ||
| 3 | |||
| 4 | #ifndef _LINUX_REISER_FS_SB | ||
| 5 | #define _LINUX_REISER_FS_SB | ||
| 6 | |||
| 7 | #ifdef __KERNEL__ | ||
| 8 | #include <linux/workqueue.h> | ||
| 9 | #include <linux/rwsem.h> | ||
| 10 | #include <linux/mutex.h> | ||
| 11 | #include <linux/sched.h> | ||
| 12 | #endif | ||
| 13 | |||
| 14 | typedef enum { | ||
| 15 | reiserfs_attrs_cleared = 0x00000001, | ||
| 16 | } reiserfs_super_block_flags; | ||
| 17 | |||
| 18 | /* struct reiserfs_super_block accessors/mutators | ||
| 19 | * since this is a disk structure, it will always be in | ||
| 20 | * little endian format. */ | ||
| 21 | #define sb_block_count(sbp) (le32_to_cpu((sbp)->s_v1.s_block_count)) | ||
| 22 | #define set_sb_block_count(sbp,v) ((sbp)->s_v1.s_block_count = cpu_to_le32(v)) | ||
| 23 | #define sb_free_blocks(sbp) (le32_to_cpu((sbp)->s_v1.s_free_blocks)) | ||
| 24 | #define set_sb_free_blocks(sbp,v) ((sbp)->s_v1.s_free_blocks = cpu_to_le32(v)) | ||
| 25 | #define sb_root_block(sbp) (le32_to_cpu((sbp)->s_v1.s_root_block)) | ||
| 26 | #define set_sb_root_block(sbp,v) ((sbp)->s_v1.s_root_block = cpu_to_le32(v)) | ||
| 27 | |||
| 28 | #define sb_jp_journal_1st_block(sbp) \ | ||
| 29 | (le32_to_cpu((sbp)->s_v1.s_journal.jp_journal_1st_block)) | ||
| 30 | #define set_sb_jp_journal_1st_block(sbp,v) \ | ||
| 31 | ((sbp)->s_v1.s_journal.jp_journal_1st_block = cpu_to_le32(v)) | ||
| 32 | #define sb_jp_journal_dev(sbp) \ | ||
| 33 | (le32_to_cpu((sbp)->s_v1.s_journal.jp_journal_dev)) | ||
| 34 | #define set_sb_jp_journal_dev(sbp,v) \ | ||
| 35 | ((sbp)->s_v1.s_journal.jp_journal_dev = cpu_to_le32(v)) | ||
| 36 | #define sb_jp_journal_size(sbp) \ | ||
| 37 | (le32_to_cpu((sbp)->s_v1.s_journal.jp_journal_size)) | ||
| 38 | #define set_sb_jp_journal_size(sbp,v) \ | ||
| 39 | ((sbp)->s_v1.s_journal.jp_journal_size = cpu_to_le32(v)) | ||
| 40 | #define sb_jp_journal_trans_max(sbp) \ | ||
| 41 | (le32_to_cpu((sbp)->s_v1.s_journal.jp_journal_trans_max)) | ||
| 42 | #define set_sb_jp_journal_trans_max(sbp,v) \ | ||
| 43 | ((sbp)->s_v1.s_journal.jp_journal_trans_max = cpu_to_le32(v)) | ||
| 44 | #define sb_jp_journal_magic(sbp) \ | ||
| 45 | (le32_to_cpu((sbp)->s_v1.s_journal.jp_journal_magic)) | ||
| 46 | #define set_sb_jp_journal_magic(sbp,v) \ | ||
| 47 | ((sbp)->s_v1.s_journal.jp_journal_magic = cpu_to_le32(v)) | ||
| 48 | #define sb_jp_journal_max_batch(sbp) \ | ||
| 49 | (le32_to_cpu((sbp)->s_v1.s_journal.jp_journal_max_batch)) | ||
| 50 | #define set_sb_jp_journal_max_batch(sbp,v) \ | ||
| 51 | ((sbp)->s_v1.s_journal.jp_journal_max_batch = cpu_to_le32(v)) | ||
| 52 | #define sb_jp_jourmal_max_commit_age(sbp) \ | ||
| 53 | (le32_to_cpu((sbp)->s_v1.s_journal.jp_journal_max_commit_age)) | ||
| 54 | #define set_sb_jp_journal_max_commit_age(sbp,v) \ | ||
| 55 | ((sbp)->s_v1.s_journal.jp_journal_max_commit_age = cpu_to_le32(v)) | ||
| 56 | |||
| 57 | #define sb_blocksize(sbp) (le16_to_cpu((sbp)->s_v1.s_blocksize)) | ||
| 58 | #define set_sb_blocksize(sbp,v) ((sbp)->s_v1.s_blocksize = cpu_to_le16(v)) | ||
| 59 | #define sb_oid_maxsize(sbp) (le16_to_cpu((sbp)->s_v1.s_oid_maxsize)) | ||
| 60 | #define set_sb_oid_maxsize(sbp,v) ((sbp)->s_v1.s_oid_maxsize = cpu_to_le16(v)) | ||
| 61 | #define sb_oid_cursize(sbp) (le16_to_cpu((sbp)->s_v1.s_oid_cursize)) | ||
| 62 | #define set_sb_oid_cursize(sbp,v) ((sbp)->s_v1.s_oid_cursize = cpu_to_le16(v)) | ||
| 63 | #define sb_umount_state(sbp) (le16_to_cpu((sbp)->s_v1.s_umount_state)) | ||
| 64 | #define set_sb_umount_state(sbp,v) ((sbp)->s_v1.s_umount_state = cpu_to_le16(v)) | ||
| 65 | #define sb_fs_state(sbp) (le16_to_cpu((sbp)->s_v1.s_fs_state)) | ||
| 66 | #define set_sb_fs_state(sbp,v) ((sbp)->s_v1.s_fs_state = cpu_to_le16(v)) | ||
| 67 | #define sb_hash_function_code(sbp) \ | ||
| 68 | (le32_to_cpu((sbp)->s_v1.s_hash_function_code)) | ||
| 69 | #define set_sb_hash_function_code(sbp,v) \ | ||
| 70 | ((sbp)->s_v1.s_hash_function_code = cpu_to_le32(v)) | ||
| 71 | #define sb_tree_height(sbp) (le16_to_cpu((sbp)->s_v1.s_tree_height)) | ||
| 72 | #define set_sb_tree_height(sbp,v) ((sbp)->s_v1.s_tree_height = cpu_to_le16(v)) | ||
| 73 | #define sb_bmap_nr(sbp) (le16_to_cpu((sbp)->s_v1.s_bmap_nr)) | ||
| 74 | #define set_sb_bmap_nr(sbp,v) ((sbp)->s_v1.s_bmap_nr = cpu_to_le16(v)) | ||
| 75 | #define sb_version(sbp) (le16_to_cpu((sbp)->s_v1.s_version)) | ||
| 76 | #define set_sb_version(sbp,v) ((sbp)->s_v1.s_version = cpu_to_le16(v)) | ||
| 77 | |||
| 78 | #define sb_mnt_count(sbp) (le16_to_cpu((sbp)->s_mnt_count)) | ||
| 79 | #define set_sb_mnt_count(sbp, v) ((sbp)->s_mnt_count = cpu_to_le16(v)) | ||
| 80 | |||
| 81 | #define sb_reserved_for_journal(sbp) \ | ||
| 82 | (le16_to_cpu((sbp)->s_v1.s_reserved_for_journal)) | ||
| 83 | #define set_sb_reserved_for_journal(sbp,v) \ | ||
| 84 | ((sbp)->s_v1.s_reserved_for_journal = cpu_to_le16(v)) | ||
| 85 | |||
| 86 | /* LOGGING -- */ | ||
| 87 | |||
| 88 | /* These all interelate for performance. | ||
| 89 | ** | ||
| 90 | ** If the journal block count is smaller than n transactions, you lose speed. | ||
| 91 | ** I don't know what n is yet, I'm guessing 8-16. | ||
| 92 | ** | ||
| 93 | ** typical transaction size depends on the application, how often fsync is | ||
| 94 | ** called, and how many metadata blocks you dirty in a 30 second period. | ||
| 95 | ** The more small files (<16k) you use, the larger your transactions will | ||
| 96 | ** be. | ||
| 97 | ** | ||
| 98 | ** If your journal fills faster than dirty buffers get flushed to disk, it must flush them before allowing the journal | ||
| 99 | ** to wrap, which slows things down. If you need high speed meta data updates, the journal should be big enough | ||
| 100 | ** to prevent wrapping before dirty meta blocks get to disk. | ||
| 101 | ** | ||
| 102 | ** If the batch max is smaller than the transaction max, you'll waste space at the end of the journal | ||
| 103 | ** because journal_end sets the next transaction to start at 0 if the next transaction has any chance of wrapping. | ||
| 104 | ** | ||
| 105 | ** The large the batch max age, the better the speed, and the more meta data changes you'll lose after a crash. | ||
| 106 | ** | ||
| 107 | */ | ||
| 108 | |||
| 109 | /* don't mess with these for a while */ | ||
| 110 | /* we have a node size define somewhere in reiserfs_fs.h. -Hans */ | ||
| 111 | #define JOURNAL_BLOCK_SIZE 4096 /* BUG gotta get rid of this */ | ||
| 112 | #define JOURNAL_MAX_CNODE 1500 /* max cnodes to allocate. */ | ||
| 113 | #define JOURNAL_HASH_SIZE 8192 | ||
| 114 | #define JOURNAL_NUM_BITMAPS 5 /* number of copies of the bitmaps to have floating. Must be >= 2 */ | ||
| 115 | |||
| 116 | /* One of these for every block in every transaction | ||
| 117 | ** Each one is in two hash tables. First, a hash of the current transaction, and after journal_end, a | ||
| 118 | ** hash of all the in memory transactions. | ||
| 119 | ** next and prev are used by the current transaction (journal_hash). | ||
| 120 | ** hnext and hprev are used by journal_list_hash. If a block is in more than one transaction, the journal_list_hash | ||
| 121 | ** links it in multiple times. This allows flush_journal_list to remove just the cnode belonging | ||
| 122 | ** to a given transaction. | ||
| 123 | */ | ||
| 124 | struct reiserfs_journal_cnode { | ||
| 125 | struct buffer_head *bh; /* real buffer head */ | ||
| 126 | struct super_block *sb; /* dev of real buffer head */ | ||
| 127 | __u32 blocknr; /* block number of real buffer head, == 0 when buffer on disk */ | ||
| 128 | unsigned long state; | ||
| 129 | struct reiserfs_journal_list *jlist; /* journal list this cnode lives in */ | ||
| 130 | struct reiserfs_journal_cnode *next; /* next in transaction list */ | ||
| 131 | struct reiserfs_journal_cnode *prev; /* prev in transaction list */ | ||
| 132 | struct reiserfs_journal_cnode *hprev; /* prev in hash list */ | ||
| 133 | struct reiserfs_journal_cnode *hnext; /* next in hash list */ | ||
| 134 | }; | ||
| 135 | |||
| 136 | struct reiserfs_bitmap_node { | ||
| 137 | int id; | ||
| 138 | char *data; | ||
| 139 | struct list_head list; | ||
| 140 | }; | ||
| 141 | |||
| 142 | struct reiserfs_list_bitmap { | ||
| 143 | struct reiserfs_journal_list *journal_list; | ||
| 144 | struct reiserfs_bitmap_node **bitmaps; | ||
| 145 | }; | ||
| 146 | |||
| 147 | /* | ||
| 148 | ** one of these for each transaction. The most important part here is the j_realblock. | ||
| 149 | ** this list of cnodes is used to hash all the blocks in all the commits, to mark all the | ||
| 150 | ** real buffer heads dirty once all the commits hit the disk, | ||
| 151 | ** and to make sure every real block in a transaction is on disk before allowing the log area | ||
| 152 | ** to be overwritten */ | ||
| 153 | struct reiserfs_journal_list { | ||
| 154 | unsigned long j_start; | ||
| 155 | unsigned long j_state; | ||
| 156 | unsigned long j_len; | ||
| 157 | atomic_t j_nonzerolen; | ||
| 158 | atomic_t j_commit_left; | ||
| 159 | atomic_t j_older_commits_done; /* all commits older than this on disk */ | ||
| 160 | struct mutex j_commit_mutex; | ||
| 161 | unsigned int j_trans_id; | ||
| 162 | time_t j_timestamp; | ||
| 163 | struct reiserfs_list_bitmap *j_list_bitmap; | ||
| 164 | struct buffer_head *j_commit_bh; /* commit buffer head */ | ||
| 165 | struct reiserfs_journal_cnode *j_realblock; | ||
| 166 | struct reiserfs_journal_cnode *j_freedlist; /* list of buffers that were freed during this trans. free each of these on flush */ | ||
| 167 | /* time ordered list of all active transactions */ | ||
| 168 | struct list_head j_list; | ||
| 169 | |||
| 170 | /* time ordered list of all transactions we haven't tried to flush yet */ | ||
| 171 | struct list_head j_working_list; | ||
| 172 | |||
| 173 | /* list of tail conversion targets in need of flush before commit */ | ||
| 174 | struct list_head j_tail_bh_list; | ||
| 175 | /* list of data=ordered buffers in need of flush before commit */ | ||
| 176 | struct list_head j_bh_list; | ||
| 177 | int j_refcount; | ||
| 178 | }; | ||
| 179 | |||
| 180 | struct reiserfs_journal { | ||
| 181 | struct buffer_head **j_ap_blocks; /* journal blocks on disk */ | ||
| 182 | struct reiserfs_journal_cnode *j_last; /* newest journal block */ | ||
| 183 | struct reiserfs_journal_cnode *j_first; /* oldest journal block. start here for traverse */ | ||
| 184 | |||
| 185 | struct block_device *j_dev_bd; | ||
| 186 | fmode_t j_dev_mode; | ||
| 187 | int j_1st_reserved_block; /* first block on s_dev of reserved area journal */ | ||
| 188 | |||
| 189 | unsigned long j_state; | ||
| 190 | unsigned int j_trans_id; | ||
| 191 | unsigned long j_mount_id; | ||
| 192 | unsigned long j_start; /* start of current waiting commit (index into j_ap_blocks) */ | ||
| 193 | unsigned long j_len; /* length of current waiting commit */ | ||
| 194 | unsigned long j_len_alloc; /* number of buffers requested by journal_begin() */ | ||
| 195 | atomic_t j_wcount; /* count of writers for current commit */ | ||
| 196 | unsigned long j_bcount; /* batch count. allows turning X transactions into 1 */ | ||
| 197 | unsigned long j_first_unflushed_offset; /* first unflushed transactions offset */ | ||
| 198 | unsigned j_last_flush_trans_id; /* last fully flushed journal timestamp */ | ||
| 199 | struct buffer_head *j_header_bh; | ||
| 200 | |||
| 201 | time_t j_trans_start_time; /* time this transaction started */ | ||
| 202 | struct mutex j_mutex; | ||
| 203 | struct mutex j_flush_mutex; | ||
| 204 | wait_queue_head_t j_join_wait; /* wait for current transaction to finish before starting new one */ | ||
| 205 | atomic_t j_jlock; /* lock for j_join_wait */ | ||
| 206 | int j_list_bitmap_index; /* number of next list bitmap to use */ | ||
| 207 | int j_must_wait; /* no more journal begins allowed. MUST sleep on j_join_wait */ | ||
| 208 | int j_next_full_flush; /* next journal_end will flush all journal list */ | ||
| 209 | int j_next_async_flush; /* next journal_end will flush all async commits */ | ||
| 210 | |||
| 211 | int j_cnode_used; /* number of cnodes on the used list */ | ||
| 212 | int j_cnode_free; /* number of cnodes on the free list */ | ||
| 213 | |||
| 214 | unsigned int j_trans_max; /* max number of blocks in a transaction. */ | ||
| 215 | unsigned int j_max_batch; /* max number of blocks to batch into a trans */ | ||
| 216 | unsigned int j_max_commit_age; /* in seconds, how old can an async commit be */ | ||
| 217 | unsigned int j_max_trans_age; /* in seconds, how old can a transaction be */ | ||
| 218 | unsigned int j_default_max_commit_age; /* the default for the max commit age */ | ||
| 219 | |||
| 220 | struct reiserfs_journal_cnode *j_cnode_free_list; | ||
| 221 | struct reiserfs_journal_cnode *j_cnode_free_orig; /* orig pointer returned from vmalloc */ | ||
| 222 | |||
| 223 | struct reiserfs_journal_list *j_current_jl; | ||
| 224 | int j_free_bitmap_nodes; | ||
| 225 | int j_used_bitmap_nodes; | ||
| 226 | |||
| 227 | int j_num_lists; /* total number of active transactions */ | ||
| 228 | int j_num_work_lists; /* number that need attention from kreiserfsd */ | ||
| 229 | |||
| 230 | /* debugging to make sure things are flushed in order */ | ||
| 231 | unsigned int j_last_flush_id; | ||
| 232 | |||
| 233 | /* debugging to make sure things are committed in order */ | ||
| 234 | unsigned int j_last_commit_id; | ||
| 235 | |||
| 236 | struct list_head j_bitmap_nodes; | ||
| 237 | struct list_head j_dirty_buffers; | ||
| 238 | spinlock_t j_dirty_buffers_lock; /* protects j_dirty_buffers */ | ||
| 239 | |||
| 240 | /* list of all active transactions */ | ||
| 241 | struct list_head j_journal_list; | ||
| 242 | /* lists that haven't been touched by writeback attempts */ | ||
| 243 | struct list_head j_working_list; | ||
| 244 | |||
| 245 | struct reiserfs_list_bitmap j_list_bitmap[JOURNAL_NUM_BITMAPS]; /* array of bitmaps to record the deleted blocks */ | ||
| 246 | struct reiserfs_journal_cnode *j_hash_table[JOURNAL_HASH_SIZE]; /* hash table for real buffer heads in current trans */ | ||
| 247 | struct reiserfs_journal_cnode *j_list_hash_table[JOURNAL_HASH_SIZE]; /* hash table for all the real buffer heads in all | ||
| 248 | the transactions */ | ||
| 249 | struct list_head j_prealloc_list; /* list of inodes which have preallocated blocks */ | ||
| 250 | int j_persistent_trans; | ||
| 251 | unsigned long j_max_trans_size; | ||
| 252 | unsigned long j_max_batch_size; | ||
| 253 | |||
| 254 | int j_errno; | ||
| 255 | |||
| 256 | /* when flushing ordered buffers, throttle new ordered writers */ | ||
| 257 | struct delayed_work j_work; | ||
| 258 | struct super_block *j_work_sb; | ||
| 259 | atomic_t j_async_throttle; | ||
| 260 | }; | ||
| 261 | |||
| 262 | enum journal_state_bits { | ||
| 263 | J_WRITERS_BLOCKED = 1, /* set when new writers not allowed */ | ||
| 264 | J_WRITERS_QUEUED, /* set when log is full due to too many writers */ | ||
| 265 | J_ABORTED, /* set when log is aborted */ | ||
| 266 | }; | ||
| 267 | |||
| 268 | #define JOURNAL_DESC_MAGIC "ReIsErLB" /* ick. magic string to find desc blocks in the journal */ | ||
| 269 | |||
| 270 | typedef __u32(*hashf_t) (const signed char *, int); | ||
| 271 | |||
| 272 | struct reiserfs_bitmap_info { | ||
| 273 | __u32 free_count; | ||
| 274 | }; | ||
| 275 | |||
| 276 | struct proc_dir_entry; | ||
| 277 | |||
| 278 | #if defined( CONFIG_PROC_FS ) && defined( CONFIG_REISERFS_PROC_INFO ) | ||
| 279 | typedef unsigned long int stat_cnt_t; | ||
| 280 | typedef struct reiserfs_proc_info_data { | ||
| 281 | spinlock_t lock; | ||
| 282 | int exiting; | ||
| 283 | int max_hash_collisions; | ||
| 284 | |||
| 285 | stat_cnt_t breads; | ||
| 286 | stat_cnt_t bread_miss; | ||
| 287 | stat_cnt_t search_by_key; | ||
| 288 | stat_cnt_t search_by_key_fs_changed; | ||
| 289 | stat_cnt_t search_by_key_restarted; | ||
| 290 | |||
| 291 | stat_cnt_t insert_item_restarted; | ||
| 292 | stat_cnt_t paste_into_item_restarted; | ||
| 293 | stat_cnt_t cut_from_item_restarted; | ||
| 294 | stat_cnt_t delete_solid_item_restarted; | ||
| 295 | stat_cnt_t delete_item_restarted; | ||
| 296 | |||
| 297 | stat_cnt_t leaked_oid; | ||
| 298 | stat_cnt_t leaves_removable; | ||
| 299 | |||
| 300 | /* balances per level. Use explicit 5 as MAX_HEIGHT is not visible yet. */ | ||
| 301 | stat_cnt_t balance_at[5]; /* XXX */ | ||
| 302 | /* sbk == search_by_key */ | ||
| 303 | stat_cnt_t sbk_read_at[5]; /* XXX */ | ||
| 304 | stat_cnt_t sbk_fs_changed[5]; | ||
| 305 | stat_cnt_t sbk_restarted[5]; | ||
| 306 | stat_cnt_t items_at[5]; /* XXX */ | ||
| 307 | stat_cnt_t free_at[5]; /* XXX */ | ||
| 308 | stat_cnt_t can_node_be_removed[5]; /* XXX */ | ||
| 309 | long int lnum[5]; /* XXX */ | ||
| 310 | long int rnum[5]; /* XXX */ | ||
| 311 | long int lbytes[5]; /* XXX */ | ||
| 312 | long int rbytes[5]; /* XXX */ | ||
| 313 | stat_cnt_t get_neighbors[5]; | ||
| 314 | stat_cnt_t get_neighbors_restart[5]; | ||
| 315 | stat_cnt_t need_l_neighbor[5]; | ||
| 316 | stat_cnt_t need_r_neighbor[5]; | ||
| 317 | |||
| 318 | stat_cnt_t free_block; | ||
| 319 | struct __scan_bitmap_stats { | ||
| 320 | stat_cnt_t call; | ||
| 321 | stat_cnt_t wait; | ||
| 322 | stat_cnt_t bmap; | ||
| 323 | stat_cnt_t retry; | ||
| 324 | stat_cnt_t in_journal_hint; | ||
| 325 | stat_cnt_t in_journal_nohint; | ||
| 326 | stat_cnt_t stolen; | ||
| 327 | } scan_bitmap; | ||
| 328 | struct __journal_stats { | ||
| 329 | stat_cnt_t in_journal; | ||
| 330 | stat_cnt_t in_journal_bitmap; | ||
| 331 | stat_cnt_t in_journal_reusable; | ||
| 332 | stat_cnt_t lock_journal; | ||
| 333 | stat_cnt_t lock_journal_wait; | ||
| 334 | stat_cnt_t journal_being; | ||
| 335 | stat_cnt_t journal_relock_writers; | ||
| 336 | stat_cnt_t journal_relock_wcount; | ||
| 337 | stat_cnt_t mark_dirty; | ||
| 338 | stat_cnt_t mark_dirty_already; | ||
| 339 | stat_cnt_t mark_dirty_notjournal; | ||
| 340 | stat_cnt_t restore_prepared; | ||
| 341 | stat_cnt_t prepare; | ||
| 342 | stat_cnt_t prepare_retry; | ||
| 343 | } journal; | ||
| 344 | } reiserfs_proc_info_data_t; | ||
| 345 | #else | ||
| 346 | typedef struct reiserfs_proc_info_data { | ||
| 347 | } reiserfs_proc_info_data_t; | ||
| 348 | #endif | ||
| 349 | |||
| 350 | /* reiserfs union of in-core super block data */ | ||
| 351 | struct reiserfs_sb_info { | ||
| 352 | struct buffer_head *s_sbh; /* Buffer containing the super block */ | ||
| 353 | /* both the comment and the choice of | ||
| 354 | name are unclear for s_rs -Hans */ | ||
| 355 | struct reiserfs_super_block *s_rs; /* Pointer to the super block in the buffer */ | ||
| 356 | struct reiserfs_bitmap_info *s_ap_bitmap; | ||
| 357 | struct reiserfs_journal *s_journal; /* pointer to journal information */ | ||
| 358 | unsigned short s_mount_state; /* reiserfs state (valid, invalid) */ | ||
| 359 | |||
| 360 | /* Serialize writers access, replace the old bkl */ | ||
| 361 | struct mutex lock; | ||
| 362 | /* Owner of the lock (can be recursive) */ | ||
| 363 | struct task_struct *lock_owner; | ||
| 364 | /* Depth of the lock, start from -1 like the bkl */ | ||
| 365 | int lock_depth; | ||
| 366 | |||
| 367 | /* Comment? -Hans */ | ||
| 368 | void (*end_io_handler) (struct buffer_head *, int); | ||
| 369 | hashf_t s_hash_function; /* pointer to function which is used | ||
| 370 | to sort names in directory. Set on | ||
| 371 | mount */ | ||
| 372 | unsigned long s_mount_opt; /* reiserfs's mount options are set | ||
| 373 | here (currently - NOTAIL, NOLOG, | ||
| 374 | REPLAYONLY) */ | ||
| 375 | |||
| 376 | struct { /* This is a structure that describes block allocator options */ | ||
| 377 | unsigned long bits; /* Bitfield for enable/disable kind of options */ | ||
| 378 | unsigned long large_file_size; /* size started from which we consider file to be a large one(in blocks) */ | ||
| 379 | int border; /* percentage of disk, border takes */ | ||
| 380 | int preallocmin; /* Minimal file size (in blocks) starting from which we do preallocations */ | ||
| 381 | int preallocsize; /* Number of blocks we try to prealloc when file | ||
| 382 | reaches preallocmin size (in blocks) or | ||
| 383 | prealloc_list is empty. */ | ||
| 384 | } s_alloc_options; | ||
| 385 | |||
| 386 | /* Comment? -Hans */ | ||
| 387 | wait_queue_head_t s_wait; | ||
| 388 | /* To be obsoleted soon by per buffer seals.. -Hans */ | ||
| 389 | atomic_t s_generation_counter; // increased by one every time the | ||
| 390 | // tree gets re-balanced | ||
| 391 | unsigned long s_properties; /* File system properties. Currently holds | ||
| 392 | on-disk FS format */ | ||
| 393 | |||
| 394 | /* session statistics */ | ||
| 395 | int s_disk_reads; | ||
| 396 | int s_disk_writes; | ||
| 397 | int s_fix_nodes; | ||
| 398 | int s_do_balance; | ||
| 399 | int s_unneeded_left_neighbor; | ||
| 400 | int s_good_search_by_key_reada; | ||
| 401 | int s_bmaps; | ||
| 402 | int s_bmaps_without_search; | ||
| 403 | int s_direct2indirect; | ||
| 404 | int s_indirect2direct; | ||
| 405 | /* set up when it's ok for reiserfs_read_inode2() to read from | ||
| 406 | disk inode with nlink==0. Currently this is only used during | ||
| 407 | finish_unfinished() processing at mount time */ | ||
| 408 | int s_is_unlinked_ok; | ||
| 409 | reiserfs_proc_info_data_t s_proc_info_data; | ||
| 410 | struct proc_dir_entry *procdir; | ||
| 411 | int reserved_blocks; /* amount of blocks reserved for further allocations */ | ||
| 412 | spinlock_t bitmap_lock; /* this lock on now only used to protect reserved_blocks variable */ | ||
| 413 | struct dentry *priv_root; /* root of /.reiserfs_priv */ | ||
| 414 | struct dentry *xattr_root; /* root of /.reiserfs_priv/xattrs */ | ||
| 415 | int j_errno; | ||
| 416 | #ifdef CONFIG_QUOTA | ||
| 417 | char *s_qf_names[MAXQUOTAS]; | ||
| 418 | int s_jquota_fmt; | ||
| 419 | #endif | ||
| 420 | char *s_jdev; /* Stored jdev for mount option showing */ | ||
| 421 | #ifdef CONFIG_REISERFS_CHECK | ||
| 422 | |||
| 423 | struct tree_balance *cur_tb; /* | ||
| 424 | * Detects whether more than one | ||
| 425 | * copy of tb exists per superblock | ||
| 426 | * as a means of checking whether | ||
| 427 | * do_balance is executing concurrently | ||
| 428 | * against another tree reader/writer | ||
| 429 | * on a same mount point. | ||
| 430 | */ | ||
| 431 | #endif | ||
| 432 | }; | ||
| 433 | |||
| 434 | /* Definitions of reiserfs on-disk properties: */ | ||
| 435 | #define REISERFS_3_5 0 | ||
| 436 | #define REISERFS_3_6 1 | ||
| 437 | #define REISERFS_OLD_FORMAT 2 | ||
| 438 | |||
| 439 | enum reiserfs_mount_options { | ||
| 440 | /* Mount options */ | ||
| 441 | REISERFS_LARGETAIL, /* large tails will be created in a session */ | ||
| 442 | REISERFS_SMALLTAIL, /* small (for files less than block size) tails will be created in a session */ | ||
| 443 | REPLAYONLY, /* replay journal and return 0. Use by fsck */ | ||
| 444 | REISERFS_CONVERT, /* -o conv: causes conversion of old | ||
| 445 | format super block to the new | ||
| 446 | format. If not specified - old | ||
| 447 | partition will be dealt with in a | ||
| 448 | manner of 3.5.x */ | ||
| 449 | |||
| 450 | /* -o hash={tea, rupasov, r5, detect} is meant for properly mounting | ||
| 451 | ** reiserfs disks from 3.5.19 or earlier. 99% of the time, this option | ||
| 452 | ** is not required. If the normal autodection code can't determine which | ||
| 453 | ** hash to use (because both hashes had the same value for a file) | ||
| 454 | ** use this option to force a specific hash. It won't allow you to override | ||
| 455 | ** the existing hash on the FS, so if you have a tea hash disk, and mount | ||
| 456 | ** with -o hash=rupasov, the mount will fail. | ||
| 457 | */ | ||
| 458 | FORCE_TEA_HASH, /* try to force tea hash on mount */ | ||
| 459 | FORCE_RUPASOV_HASH, /* try to force rupasov hash on mount */ | ||
| 460 | FORCE_R5_HASH, /* try to force rupasov hash on mount */ | ||
| 461 | FORCE_HASH_DETECT, /* try to detect hash function on mount */ | ||
| 462 | |||
| 463 | REISERFS_DATA_LOG, | ||
| 464 | REISERFS_DATA_ORDERED, | ||
| 465 | REISERFS_DATA_WRITEBACK, | ||
| 466 | |||
| 467 | /* used for testing experimental features, makes benchmarking new | ||
| 468 | features with and without more convenient, should never be used by | ||
| 469 | users in any code shipped to users (ideally) */ | ||
| 470 | |||
| 471 | REISERFS_NO_BORDER, | ||
| 472 | REISERFS_NO_UNHASHED_RELOCATION, | ||
| 473 | REISERFS_HASHED_RELOCATION, | ||
| 474 | REISERFS_ATTRS, | ||
| 475 | REISERFS_XATTRS_USER, | ||
| 476 | REISERFS_POSIXACL, | ||
| 477 | REISERFS_EXPOSE_PRIVROOT, | ||
| 478 | REISERFS_BARRIER_NONE, | ||
| 479 | REISERFS_BARRIER_FLUSH, | ||
| 480 | |||
| 481 | /* Actions on error */ | ||
| 482 | REISERFS_ERROR_PANIC, | ||
| 483 | REISERFS_ERROR_RO, | ||
| 484 | REISERFS_ERROR_CONTINUE, | ||
| 485 | |||
| 486 | REISERFS_USRQUOTA, /* User quota option specified */ | ||
| 487 | REISERFS_GRPQUOTA, /* Group quota option specified */ | ||
| 488 | |||
| 489 | REISERFS_TEST1, | ||
| 490 | REISERFS_TEST2, | ||
| 491 | REISERFS_TEST3, | ||
| 492 | REISERFS_TEST4, | ||
| 493 | REISERFS_UNSUPPORTED_OPT, | ||
| 494 | }; | ||
| 495 | |||
| 496 | #define reiserfs_r5_hash(s) (REISERFS_SB(s)->s_mount_opt & (1 << FORCE_R5_HASH)) | ||
| 497 | #define reiserfs_rupasov_hash(s) (REISERFS_SB(s)->s_mount_opt & (1 << FORCE_RUPASOV_HASH)) | ||
| 498 | #define reiserfs_tea_hash(s) (REISERFS_SB(s)->s_mount_opt & (1 << FORCE_TEA_HASH)) | ||
| 499 | #define reiserfs_hash_detect(s) (REISERFS_SB(s)->s_mount_opt & (1 << FORCE_HASH_DETECT)) | ||
| 500 | #define reiserfs_no_border(s) (REISERFS_SB(s)->s_mount_opt & (1 << REISERFS_NO_BORDER)) | ||
| 501 | #define reiserfs_no_unhashed_relocation(s) (REISERFS_SB(s)->s_mount_opt & (1 << REISERFS_NO_UNHASHED_RELOCATION)) | ||
| 502 | #define reiserfs_hashed_relocation(s) (REISERFS_SB(s)->s_mount_opt & (1 << REISERFS_HASHED_RELOCATION)) | ||
| 503 | #define reiserfs_test4(s) (REISERFS_SB(s)->s_mount_opt & (1 << REISERFS_TEST4)) | ||
| 504 | |||
| 505 | #define have_large_tails(s) (REISERFS_SB(s)->s_mount_opt & (1 << REISERFS_LARGETAIL)) | ||
| 506 | #define have_small_tails(s) (REISERFS_SB(s)->s_mount_opt & (1 << REISERFS_SMALLTAIL)) | ||
| 507 | #define replay_only(s) (REISERFS_SB(s)->s_mount_opt & (1 << REPLAYONLY)) | ||
| 508 | #define reiserfs_attrs(s) (REISERFS_SB(s)->s_mount_opt & (1 << REISERFS_ATTRS)) | ||
| 509 | #define old_format_only(s) (REISERFS_SB(s)->s_properties & (1 << REISERFS_3_5)) | ||
| 510 | #define convert_reiserfs(s) (REISERFS_SB(s)->s_mount_opt & (1 << REISERFS_CONVERT)) | ||
| 511 | #define reiserfs_data_log(s) (REISERFS_SB(s)->s_mount_opt & (1 << REISERFS_DATA_LOG)) | ||
| 512 | #define reiserfs_data_ordered(s) (REISERFS_SB(s)->s_mount_opt & (1 << REISERFS_DATA_ORDERED)) | ||
| 513 | #define reiserfs_data_writeback(s) (REISERFS_SB(s)->s_mount_opt & (1 << REISERFS_DATA_WRITEBACK)) | ||
| 514 | #define reiserfs_xattrs_user(s) (REISERFS_SB(s)->s_mount_opt & (1 << REISERFS_XATTRS_USER)) | ||
| 515 | #define reiserfs_posixacl(s) (REISERFS_SB(s)->s_mount_opt & (1 << REISERFS_POSIXACL)) | ||
| 516 | #define reiserfs_expose_privroot(s) (REISERFS_SB(s)->s_mount_opt & (1 << REISERFS_EXPOSE_PRIVROOT)) | ||
| 517 | #define reiserfs_xattrs_optional(s) (reiserfs_xattrs_user(s) || reiserfs_posixacl(s)) | ||
| 518 | #define reiserfs_barrier_none(s) (REISERFS_SB(s)->s_mount_opt & (1 << REISERFS_BARRIER_NONE)) | ||
| 519 | #define reiserfs_barrier_flush(s) (REISERFS_SB(s)->s_mount_opt & (1 << REISERFS_BARRIER_FLUSH)) | ||
| 520 | |||
| 521 | #define reiserfs_error_panic(s) (REISERFS_SB(s)->s_mount_opt & (1 << REISERFS_ERROR_PANIC)) | ||
| 522 | #define reiserfs_error_ro(s) (REISERFS_SB(s)->s_mount_opt & (1 << REISERFS_ERROR_RO)) | ||
| 523 | |||
| 524 | void reiserfs_file_buffer(struct buffer_head *bh, int list); | ||
| 525 | extern struct file_system_type reiserfs_fs_type; | ||
| 526 | int reiserfs_resize(struct super_block *, unsigned long); | ||
| 527 | |||
| 528 | #define CARRY_ON 0 | ||
| 529 | #define SCHEDULE_OCCURRED 1 | ||
| 530 | |||
| 531 | #define SB_BUFFER_WITH_SB(s) (REISERFS_SB(s)->s_sbh) | ||
| 532 | #define SB_JOURNAL(s) (REISERFS_SB(s)->s_journal) | ||
| 533 | #define SB_JOURNAL_1st_RESERVED_BLOCK(s) (SB_JOURNAL(s)->j_1st_reserved_block) | ||
| 534 | #define SB_JOURNAL_LEN_FREE(s) (SB_JOURNAL(s)->j_journal_len_free) | ||
| 535 | #define SB_AP_BITMAP(s) (REISERFS_SB(s)->s_ap_bitmap) | ||
| 536 | |||
| 537 | #define SB_DISK_JOURNAL_HEAD(s) (SB_JOURNAL(s)->j_header_bh->) | ||
| 538 | |||
| 539 | /* A safe version of the "bdevname", which returns the "s_id" field of | ||
| 540 | * a superblock or else "Null superblock" if the super block is NULL. | ||
| 541 | */ | ||
| 542 | static inline char *reiserfs_bdevname(struct super_block *s) | ||
| 543 | { | ||
| 544 | return (s == NULL) ? "Null superblock" : s->s_id; | ||
| 545 | } | ||
| 546 | |||
| 547 | #define reiserfs_is_journal_aborted(journal) (unlikely (__reiserfs_is_journal_aborted (journal))) | ||
| 548 | static inline int __reiserfs_is_journal_aborted(struct reiserfs_journal | ||
| 549 | *journal) | ||
| 550 | { | ||
| 551 | return test_bit(J_ABORTED, &journal->j_state); | ||
| 552 | } | ||
| 553 | |||
| 554 | #endif /* _LINUX_REISER_FS_SB */ | ||
diff --git a/include/linux/reiserfs_xattr.h b/include/linux/reiserfs_xattr.h index c2b71473266e..d8ce17c2459a 100644 --- a/include/linux/reiserfs_xattr.h +++ b/include/linux/reiserfs_xattr.h | |||
| @@ -21,132 +21,4 @@ struct reiserfs_security_handle { | |||
| 21 | size_t length; | 21 | size_t length; |
| 22 | }; | 22 | }; |
| 23 | 23 | ||
| 24 | #ifdef __KERNEL__ | ||
| 25 | |||
| 26 | #include <linux/init.h> | ||
| 27 | #include <linux/list.h> | ||
| 28 | #include <linux/rwsem.h> | ||
| 29 | #include <linux/reiserfs_fs_i.h> | ||
| 30 | #include <linux/reiserfs_fs.h> | ||
| 31 | |||
| 32 | struct inode; | ||
| 33 | struct dentry; | ||
| 34 | struct iattr; | ||
| 35 | struct super_block; | ||
| 36 | struct nameidata; | ||
| 37 | |||
| 38 | int reiserfs_xattr_register_handlers(void) __init; | ||
| 39 | void reiserfs_xattr_unregister_handlers(void); | ||
| 40 | int reiserfs_xattr_init(struct super_block *sb, int mount_flags); | ||
| 41 | int reiserfs_lookup_privroot(struct super_block *sb); | ||
| 42 | int reiserfs_delete_xattrs(struct inode *inode); | ||
| 43 | int reiserfs_chown_xattrs(struct inode *inode, struct iattr *attrs); | ||
| 44 | int reiserfs_permission(struct inode *inode, int mask); | ||
| 45 | |||
| 46 | #ifdef CONFIG_REISERFS_FS_XATTR | ||
| 47 | #define has_xattr_dir(inode) (REISERFS_I(inode)->i_flags & i_has_xattr_dir) | ||
| 48 | ssize_t reiserfs_getxattr(struct dentry *dentry, const char *name, | ||
| 49 | void *buffer, size_t size); | ||
| 50 | int reiserfs_setxattr(struct dentry *dentry, const char *name, | ||
| 51 | const void *value, size_t size, int flags); | ||
| 52 | ssize_t reiserfs_listxattr(struct dentry *dentry, char *buffer, size_t size); | ||
| 53 | int reiserfs_removexattr(struct dentry *dentry, const char *name); | ||
| 54 | |||
| 55 | int reiserfs_xattr_get(struct inode *, const char *, void *, size_t); | ||
| 56 | int reiserfs_xattr_set(struct inode *, const char *, const void *, size_t, int); | ||
| 57 | int reiserfs_xattr_set_handle(struct reiserfs_transaction_handle *, | ||
| 58 | struct inode *, const char *, const void *, | ||
| 59 | size_t, int); | ||
| 60 | |||
| 61 | extern const struct xattr_handler reiserfs_xattr_user_handler; | ||
| 62 | extern const struct xattr_handler reiserfs_xattr_trusted_handler; | ||
| 63 | extern const struct xattr_handler reiserfs_xattr_security_handler; | ||
| 64 | #ifdef CONFIG_REISERFS_FS_SECURITY | ||
| 65 | int reiserfs_security_init(struct inode *dir, struct inode *inode, | ||
| 66 | const struct qstr *qstr, | ||
| 67 | struct reiserfs_security_handle *sec); | ||
| 68 | int reiserfs_security_write(struct reiserfs_transaction_handle *th, | ||
| 69 | struct inode *inode, | ||
| 70 | struct reiserfs_security_handle *sec); | ||
| 71 | void reiserfs_security_free(struct reiserfs_security_handle *sec); | ||
| 72 | #endif | ||
| 73 | |||
| 74 | static inline int reiserfs_xattrs_initialized(struct super_block *sb) | ||
| 75 | { | ||
| 76 | return REISERFS_SB(sb)->priv_root != NULL; | ||
| 77 | } | ||
| 78 | |||
| 79 | #define xattr_size(size) ((size) + sizeof(struct reiserfs_xattr_header)) | ||
| 80 | static inline loff_t reiserfs_xattr_nblocks(struct inode *inode, loff_t size) | ||
| 81 | { | ||
| 82 | loff_t ret = 0; | ||
| 83 | if (reiserfs_file_data_log(inode)) { | ||
| 84 | ret = _ROUND_UP(xattr_size(size), inode->i_sb->s_blocksize); | ||
| 85 | ret >>= inode->i_sb->s_blocksize_bits; | ||
| 86 | } | ||
| 87 | return ret; | ||
| 88 | } | ||
| 89 | |||
| 90 | /* We may have to create up to 3 objects: xattr root, xattr dir, xattr file. | ||
| 91 | * Let's try to be smart about it. | ||
| 92 | * xattr root: We cache it. If it's not cached, we may need to create it. | ||
| 93 | * xattr dir: If anything has been loaded for this inode, we can set a flag | ||
| 94 | * saying so. | ||
| 95 | * xattr file: Since we don't cache xattrs, we can't tell. We always include | ||
| 96 | * blocks for it. | ||
| 97 | * | ||
| 98 | * However, since root and dir can be created between calls - YOU MUST SAVE | ||
| 99 | * THIS VALUE. | ||
| 100 | */ | ||
| 101 | static inline size_t reiserfs_xattr_jcreate_nblocks(struct inode *inode) | ||
| 102 | { | ||
| 103 | size_t nblocks = JOURNAL_BLOCKS_PER_OBJECT(inode->i_sb); | ||
| 104 | |||
| 105 | if ((REISERFS_I(inode)->i_flags & i_has_xattr_dir) == 0) { | ||
| 106 | nblocks += JOURNAL_BLOCKS_PER_OBJECT(inode->i_sb); | ||
| 107 | if (!REISERFS_SB(inode->i_sb)->xattr_root->d_inode) | ||
| 108 | nblocks += JOURNAL_BLOCKS_PER_OBJECT(inode->i_sb); | ||
| 109 | } | ||
| 110 | |||
| 111 | return nblocks; | ||
| 112 | } | ||
| 113 | |||
| 114 | static inline void reiserfs_init_xattr_rwsem(struct inode *inode) | ||
| 115 | { | ||
| 116 | init_rwsem(&REISERFS_I(inode)->i_xattr_sem); | ||
| 117 | } | ||
| 118 | |||
| 119 | #else | ||
| 120 | |||
| 121 | #define reiserfs_getxattr NULL | ||
| 122 | #define reiserfs_setxattr NULL | ||
| 123 | #define reiserfs_listxattr NULL | ||
| 124 | #define reiserfs_removexattr NULL | ||
| 125 | |||
| 126 | static inline void reiserfs_init_xattr_rwsem(struct inode *inode) | ||
| 127 | { | ||
| 128 | } | ||
| 129 | #endif /* CONFIG_REISERFS_FS_XATTR */ | ||
| 130 | |||
| 131 | #ifndef CONFIG_REISERFS_FS_SECURITY | ||
| 132 | static inline int reiserfs_security_init(struct inode *dir, | ||
| 133 | struct inode *inode, | ||
| 134 | const struct qstr *qstr, | ||
| 135 | struct reiserfs_security_handle *sec) | ||
| 136 | { | ||
| 137 | return 0; | ||
| 138 | } | ||
| 139 | static inline int | ||
| 140 | reiserfs_security_write(struct reiserfs_transaction_handle *th, | ||
| 141 | struct inode *inode, | ||
| 142 | struct reiserfs_security_handle *sec) | ||
| 143 | { | ||
| 144 | return 0; | ||
| 145 | } | ||
| 146 | static inline void reiserfs_security_free(struct reiserfs_security_handle *sec) | ||
| 147 | {} | ||
| 148 | #endif | ||
| 149 | |||
| 150 | #endif /* __KERNEL__ */ | ||
| 151 | |||
| 152 | #endif /* _LINUX_REISERFS_XATTR_H */ | 24 | #endif /* _LINUX_REISERFS_XATTR_H */ |
diff --git a/include/linux/relay.h b/include/linux/relay.h index a822fd71fd64..91cacc34c159 100644 --- a/include/linux/relay.h +++ b/include/linux/relay.h | |||
| @@ -15,6 +15,7 @@ | |||
| 15 | #include <linux/timer.h> | 15 | #include <linux/timer.h> |
| 16 | #include <linux/wait.h> | 16 | #include <linux/wait.h> |
| 17 | #include <linux/list.h> | 17 | #include <linux/list.h> |
| 18 | #include <linux/bug.h> | ||
| 18 | #include <linux/fs.h> | 19 | #include <linux/fs.h> |
| 19 | #include <linux/poll.h> | 20 | #include <linux/poll.h> |
| 20 | #include <linux/kref.h> | 21 | #include <linux/kref.h> |
diff --git a/include/linux/rfkill.h b/include/linux/rfkill.h index c6c608482cba..6fdf02737e9d 100644 --- a/include/linux/rfkill.h +++ b/include/linux/rfkill.h | |||
| @@ -117,10 +117,10 @@ enum rfkill_user_states { | |||
| 117 | #include <linux/kernel.h> | 117 | #include <linux/kernel.h> |
| 118 | #include <linux/list.h> | 118 | #include <linux/list.h> |
| 119 | #include <linux/mutex.h> | 119 | #include <linux/mutex.h> |
| 120 | #include <linux/device.h> | ||
| 121 | #include <linux/leds.h> | 120 | #include <linux/leds.h> |
| 122 | #include <linux/err.h> | 121 | #include <linux/err.h> |
| 123 | 122 | ||
| 123 | struct device; | ||
| 124 | /* this is opaque */ | 124 | /* this is opaque */ |
| 125 | struct rfkill; | 125 | struct rfkill; |
| 126 | 126 | ||
diff --git a/include/linux/ring_buffer.h b/include/linux/ring_buffer.h index 67be0376d8e3..7be2e88f23fd 100644 --- a/include/linux/ring_buffer.h +++ b/include/linux/ring_buffer.h | |||
| @@ -151,6 +151,9 @@ int ring_buffer_empty_cpu(struct ring_buffer *buffer, int cpu); | |||
| 151 | 151 | ||
| 152 | void ring_buffer_record_disable(struct ring_buffer *buffer); | 152 | void ring_buffer_record_disable(struct ring_buffer *buffer); |
| 153 | void ring_buffer_record_enable(struct ring_buffer *buffer); | 153 | void ring_buffer_record_enable(struct ring_buffer *buffer); |
| 154 | void ring_buffer_record_off(struct ring_buffer *buffer); | ||
| 155 | void ring_buffer_record_on(struct ring_buffer *buffer); | ||
| 156 | int ring_buffer_record_is_on(struct ring_buffer *buffer); | ||
| 154 | void ring_buffer_record_disable_cpu(struct ring_buffer *buffer, int cpu); | 157 | void ring_buffer_record_disable_cpu(struct ring_buffer *buffer, int cpu); |
| 155 | void ring_buffer_record_enable_cpu(struct ring_buffer *buffer, int cpu); | 158 | void ring_buffer_record_enable_cpu(struct ring_buffer *buffer, int cpu); |
| 156 | 159 | ||
diff --git a/include/linux/rio_drv.h b/include/linux/rio_drv.h index 229b3ca23134..7f07470e1ed9 100644 --- a/include/linux/rio_drv.h +++ b/include/linux/rio_drv.h | |||
| @@ -17,7 +17,6 @@ | |||
| 17 | #include <linux/ioport.h> | 17 | #include <linux/ioport.h> |
| 18 | #include <linux/list.h> | 18 | #include <linux/list.h> |
| 19 | #include <linux/errno.h> | 19 | #include <linux/errno.h> |
| 20 | #include <linux/device.h> | ||
| 21 | #include <linux/string.h> | 20 | #include <linux/string.h> |
| 22 | #include <linux/rio.h> | 21 | #include <linux/rio.h> |
| 23 | 22 | ||
diff --git a/include/linux/rmap.h b/include/linux/rmap.h index 1cdd62a2788a..fd07c4542cee 100644 --- a/include/linux/rmap.h +++ b/include/linux/rmap.h | |||
| @@ -122,7 +122,6 @@ void unlink_anon_vmas(struct vm_area_struct *); | |||
| 122 | int anon_vma_clone(struct vm_area_struct *, struct vm_area_struct *); | 122 | int anon_vma_clone(struct vm_area_struct *, struct vm_area_struct *); |
| 123 | void anon_vma_moveto_tail(struct vm_area_struct *); | 123 | void anon_vma_moveto_tail(struct vm_area_struct *); |
| 124 | int anon_vma_fork(struct vm_area_struct *, struct vm_area_struct *); | 124 | int anon_vma_fork(struct vm_area_struct *, struct vm_area_struct *); |
| 125 | void __anon_vma_link(struct vm_area_struct *); | ||
| 126 | 125 | ||
| 127 | static inline void anon_vma_merge(struct vm_area_struct *vma, | 126 | static inline void anon_vma_merge(struct vm_area_struct *vma, |
| 128 | struct vm_area_struct *next) | 127 | struct vm_area_struct *next) |
diff --git a/include/linux/scatterlist.h b/include/linux/scatterlist.h index 9aaf5bfdad1a..ac9586dadfa5 100644 --- a/include/linux/scatterlist.h +++ b/include/linux/scatterlist.h | |||
| @@ -1,10 +1,12 @@ | |||
| 1 | #ifndef _LINUX_SCATTERLIST_H | 1 | #ifndef _LINUX_SCATTERLIST_H |
| 2 | #define _LINUX_SCATTERLIST_H | 2 | #define _LINUX_SCATTERLIST_H |
| 3 | 3 | ||
| 4 | #include <linux/string.h> | ||
| 5 | #include <linux/bug.h> | ||
| 6 | #include <linux/mm.h> | ||
| 7 | |||
| 4 | #include <asm/types.h> | 8 | #include <asm/types.h> |
| 5 | #include <asm/scatterlist.h> | 9 | #include <asm/scatterlist.h> |
| 6 | #include <linux/mm.h> | ||
| 7 | #include <linux/string.h> | ||
| 8 | #include <asm/io.h> | 10 | #include <asm/io.h> |
| 9 | 11 | ||
| 10 | struct sg_table { | 12 | struct sg_table { |
diff --git a/include/linux/sched.h b/include/linux/sched.h index 0657368bd78f..0c3854b0d4b1 100644 --- a/include/linux/sched.h +++ b/include/linux/sched.h | |||
| @@ -361,6 +361,7 @@ extern signed long schedule_timeout_interruptible(signed long timeout); | |||
| 361 | extern signed long schedule_timeout_killable(signed long timeout); | 361 | extern signed long schedule_timeout_killable(signed long timeout); |
| 362 | extern signed long schedule_timeout_uninterruptible(signed long timeout); | 362 | extern signed long schedule_timeout_uninterruptible(signed long timeout); |
| 363 | asmlinkage void schedule(void); | 363 | asmlinkage void schedule(void); |
| 364 | extern void schedule_preempt_disabled(void); | ||
| 364 | extern int mutex_spin_on_owner(struct mutex *lock, struct task_struct *owner); | 365 | extern int mutex_spin_on_owner(struct mutex *lock, struct task_struct *owner); |
| 365 | 366 | ||
| 366 | struct nsproxy; | 367 | struct nsproxy; |
| @@ -552,6 +553,18 @@ struct signal_struct { | |||
| 552 | int group_stop_count; | 553 | int group_stop_count; |
| 553 | unsigned int flags; /* see SIGNAL_* flags below */ | 554 | unsigned int flags; /* see SIGNAL_* flags below */ |
| 554 | 555 | ||
| 556 | /* | ||
| 557 | * PR_SET_CHILD_SUBREAPER marks a process, like a service | ||
| 558 | * manager, to re-parent orphan (double-forking) child processes | ||
| 559 | * to this process instead of 'init'. The service manager is | ||
| 560 | * able to receive SIGCHLD signals and is able to investigate | ||
| 561 | * the process until it calls wait(). All children of this | ||
| 562 | * process will inherit a flag if they should look for a | ||
| 563 | * child_subreaper process at exit. | ||
| 564 | */ | ||
| 565 | unsigned int is_child_subreaper:1; | ||
| 566 | unsigned int has_child_subreaper:1; | ||
| 567 | |||
| 555 | /* POSIX.1b Interval Timers */ | 568 | /* POSIX.1b Interval Timers */ |
| 556 | struct list_head posix_timers; | 569 | struct list_head posix_timers; |
| 557 | 570 | ||
| @@ -905,6 +918,7 @@ struct sched_group_power { | |||
| 905 | * single CPU. | 918 | * single CPU. |
| 906 | */ | 919 | */ |
| 907 | unsigned int power, power_orig; | 920 | unsigned int power, power_orig; |
| 921 | unsigned long next_update; | ||
| 908 | /* | 922 | /* |
| 909 | * Number of busy cpus in this group. | 923 | * Number of busy cpus in this group. |
| 910 | */ | 924 | */ |
| @@ -1052,6 +1066,8 @@ static inline int test_sd_parent(struct sched_domain *sd, int flag) | |||
| 1052 | unsigned long default_scale_freq_power(struct sched_domain *sd, int cpu); | 1066 | unsigned long default_scale_freq_power(struct sched_domain *sd, int cpu); |
| 1053 | unsigned long default_scale_smt_power(struct sched_domain *sd, int cpu); | 1067 | unsigned long default_scale_smt_power(struct sched_domain *sd, int cpu); |
| 1054 | 1068 | ||
| 1069 | bool cpus_share_cache(int this_cpu, int that_cpu); | ||
| 1070 | |||
| 1055 | #else /* CONFIG_SMP */ | 1071 | #else /* CONFIG_SMP */ |
| 1056 | 1072 | ||
| 1057 | struct sched_domain_attr; | 1073 | struct sched_domain_attr; |
| @@ -1061,6 +1077,12 @@ partition_sched_domains(int ndoms_new, cpumask_var_t doms_new[], | |||
| 1061 | struct sched_domain_attr *dattr_new) | 1077 | struct sched_domain_attr *dattr_new) |
| 1062 | { | 1078 | { |
| 1063 | } | 1079 | } |
| 1080 | |||
| 1081 | static inline bool cpus_share_cache(int this_cpu, int that_cpu) | ||
| 1082 | { | ||
| 1083 | return true; | ||
| 1084 | } | ||
| 1085 | |||
| 1064 | #endif /* !CONFIG_SMP */ | 1086 | #endif /* !CONFIG_SMP */ |
| 1065 | 1087 | ||
| 1066 | 1088 | ||
| @@ -1225,6 +1247,12 @@ struct sched_rt_entity { | |||
| 1225 | #endif | 1247 | #endif |
| 1226 | }; | 1248 | }; |
| 1227 | 1249 | ||
| 1250 | /* | ||
| 1251 | * default timeslice is 100 msecs (used only for SCHED_RR tasks). | ||
| 1252 | * Timeslices get refilled after they expire. | ||
| 1253 | */ | ||
| 1254 | #define RR_TIMESLICE (100 * HZ / 1000) | ||
| 1255 | |||
| 1228 | struct rcu_node; | 1256 | struct rcu_node; |
| 1229 | 1257 | ||
| 1230 | enum perf_event_task_context { | 1258 | enum perf_event_task_context { |
| @@ -1319,6 +1347,11 @@ struct task_struct { | |||
| 1319 | unsigned sched_reset_on_fork:1; | 1347 | unsigned sched_reset_on_fork:1; |
| 1320 | unsigned sched_contributes_to_load:1; | 1348 | unsigned sched_contributes_to_load:1; |
| 1321 | 1349 | ||
| 1350 | #ifdef CONFIG_GENERIC_HARDIRQS | ||
| 1351 | /* IRQ handler threads */ | ||
| 1352 | unsigned irq_thread:1; | ||
| 1353 | #endif | ||
| 1354 | |||
| 1322 | pid_t pid; | 1355 | pid_t pid; |
| 1323 | pid_t tgid; | 1356 | pid_t tgid; |
| 1324 | 1357 | ||
| @@ -1427,11 +1460,6 @@ struct task_struct { | |||
| 1427 | * mempolicy */ | 1460 | * mempolicy */ |
| 1428 | spinlock_t alloc_lock; | 1461 | spinlock_t alloc_lock; |
| 1429 | 1462 | ||
| 1430 | #ifdef CONFIG_GENERIC_HARDIRQS | ||
| 1431 | /* IRQ handler threads */ | ||
| 1432 | struct irqaction *irqaction; | ||
| 1433 | #endif | ||
| 1434 | |||
| 1435 | /* Protection of the PI data structures: */ | 1463 | /* Protection of the PI data structures: */ |
| 1436 | raw_spinlock_t pi_lock; | 1464 | raw_spinlock_t pi_lock; |
| 1437 | 1465 | ||
| @@ -1498,7 +1526,7 @@ struct task_struct { | |||
| 1498 | #endif | 1526 | #endif |
| 1499 | #ifdef CONFIG_CPUSETS | 1527 | #ifdef CONFIG_CPUSETS |
| 1500 | nodemask_t mems_allowed; /* Protected by alloc_lock */ | 1528 | nodemask_t mems_allowed; /* Protected by alloc_lock */ |
| 1501 | int mems_allowed_change_disable; | 1529 | seqcount_t mems_allowed_seq; /* Seqence no to catch updates */ |
| 1502 | int cpuset_mem_spread_rotor; | 1530 | int cpuset_mem_spread_rotor; |
| 1503 | int cpuset_slab_spread_rotor; | 1531 | int cpuset_slab_spread_rotor; |
| 1504 | #endif | 1532 | #endif |
| @@ -1863,8 +1891,7 @@ extern void task_clear_jobctl_pending(struct task_struct *task, | |||
| 1863 | #ifdef CONFIG_PREEMPT_RCU | 1891 | #ifdef CONFIG_PREEMPT_RCU |
| 1864 | 1892 | ||
| 1865 | #define RCU_READ_UNLOCK_BLOCKED (1 << 0) /* blocked while in RCU read-side. */ | 1893 | #define RCU_READ_UNLOCK_BLOCKED (1 << 0) /* blocked while in RCU read-side. */ |
| 1866 | #define RCU_READ_UNLOCK_BOOSTED (1 << 1) /* boosted while in RCU read-side. */ | 1894 | #define RCU_READ_UNLOCK_NEED_QS (1 << 1) /* RCU core needs CPU response. */ |
| 1867 | #define RCU_READ_UNLOCK_NEED_QS (1 << 2) /* RCU core needs CPU response. */ | ||
| 1868 | 1895 | ||
| 1869 | static inline void rcu_copy_process(struct task_struct *p) | 1896 | static inline void rcu_copy_process(struct task_struct *p) |
| 1870 | { | 1897 | { |
| @@ -2048,7 +2075,7 @@ extern void sched_autogroup_fork(struct signal_struct *sig); | |||
| 2048 | extern void sched_autogroup_exit(struct signal_struct *sig); | 2075 | extern void sched_autogroup_exit(struct signal_struct *sig); |
| 2049 | #ifdef CONFIG_PROC_FS | 2076 | #ifdef CONFIG_PROC_FS |
| 2050 | extern void proc_sched_autogroup_show_task(struct task_struct *p, struct seq_file *m); | 2077 | extern void proc_sched_autogroup_show_task(struct task_struct *p, struct seq_file *m); |
| 2051 | extern int proc_sched_autogroup_set_nice(struct task_struct *p, int *nice); | 2078 | extern int proc_sched_autogroup_set_nice(struct task_struct *p, int nice); |
| 2052 | #endif | 2079 | #endif |
| 2053 | #else | 2080 | #else |
| 2054 | static inline void sched_autogroup_create_attach(struct task_struct *p) { } | 2081 | static inline void sched_autogroup_create_attach(struct task_struct *p) { } |
| @@ -2065,12 +2092,20 @@ extern unsigned int sysctl_sched_cfs_bandwidth_slice; | |||
| 2065 | extern int rt_mutex_getprio(struct task_struct *p); | 2092 | extern int rt_mutex_getprio(struct task_struct *p); |
| 2066 | extern void rt_mutex_setprio(struct task_struct *p, int prio); | 2093 | extern void rt_mutex_setprio(struct task_struct *p, int prio); |
| 2067 | extern void rt_mutex_adjust_pi(struct task_struct *p); | 2094 | extern void rt_mutex_adjust_pi(struct task_struct *p); |
| 2095 | static inline bool tsk_is_pi_blocked(struct task_struct *tsk) | ||
| 2096 | { | ||
| 2097 | return tsk->pi_blocked_on != NULL; | ||
| 2098 | } | ||
| 2068 | #else | 2099 | #else |
| 2069 | static inline int rt_mutex_getprio(struct task_struct *p) | 2100 | static inline int rt_mutex_getprio(struct task_struct *p) |
| 2070 | { | 2101 | { |
| 2071 | return p->normal_prio; | 2102 | return p->normal_prio; |
| 2072 | } | 2103 | } |
| 2073 | # define rt_mutex_adjust_pi(p) do { } while (0) | 2104 | # define rt_mutex_adjust_pi(p) do { } while (0) |
| 2105 | static inline bool tsk_is_pi_blocked(struct task_struct *tsk) | ||
| 2106 | { | ||
| 2107 | return false; | ||
| 2108 | } | ||
| 2074 | #endif | 2109 | #endif |
| 2075 | 2110 | ||
| 2076 | extern bool yield_to(struct task_struct *p, bool preempt); | 2111 | extern bool yield_to(struct task_struct *p, bool preempt); |
| @@ -2389,12 +2424,15 @@ static inline void task_unlock(struct task_struct *p) | |||
| 2389 | extern struct sighand_struct *__lock_task_sighand(struct task_struct *tsk, | 2424 | extern struct sighand_struct *__lock_task_sighand(struct task_struct *tsk, |
| 2390 | unsigned long *flags); | 2425 | unsigned long *flags); |
| 2391 | 2426 | ||
| 2392 | #define lock_task_sighand(tsk, flags) \ | 2427 | static inline struct sighand_struct *lock_task_sighand(struct task_struct *tsk, |
| 2393 | ({ struct sighand_struct *__ss; \ | 2428 | unsigned long *flags) |
| 2394 | __cond_lock(&(tsk)->sighand->siglock, \ | 2429 | { |
| 2395 | (__ss = __lock_task_sighand(tsk, flags))); \ | 2430 | struct sighand_struct *ret; |
| 2396 | __ss; \ | 2431 | |
| 2397 | }) \ | 2432 | ret = __lock_task_sighand(tsk, flags); |
| 2433 | (void)__cond_lock(&tsk->sighand->siglock, ret); | ||
| 2434 | return ret; | ||
| 2435 | } | ||
| 2398 | 2436 | ||
| 2399 | static inline void unlock_task_sighand(struct task_struct *tsk, | 2437 | static inline void unlock_task_sighand(struct task_struct *tsk, |
| 2400 | unsigned long *flags) | 2438 | unsigned long *flags) |
diff --git a/include/linux/security.h b/include/linux/security.h index 83c18e8c846d..673afbb8238a 100644 --- a/include/linux/security.h +++ b/include/linux/security.h | |||
| @@ -22,22 +22,36 @@ | |||
| 22 | #ifndef __LINUX_SECURITY_H | 22 | #ifndef __LINUX_SECURITY_H |
| 23 | #define __LINUX_SECURITY_H | 23 | #define __LINUX_SECURITY_H |
| 24 | 24 | ||
| 25 | #include <linux/fs.h> | ||
| 26 | #include <linux/fsnotify.h> | ||
| 27 | #include <linux/binfmts.h> | ||
| 28 | #include <linux/dcache.h> | ||
| 29 | #include <linux/signal.h> | ||
| 30 | #include <linux/resource.h> | ||
| 31 | #include <linux/sem.h> | ||
| 32 | #include <linux/shm.h> | ||
| 33 | #include <linux/mm.h> /* PAGE_ALIGN */ | ||
| 34 | #include <linux/msg.h> | ||
| 35 | #include <linux/sched.h> | ||
| 36 | #include <linux/key.h> | 25 | #include <linux/key.h> |
| 37 | #include <linux/xfrm.h> | 26 | #include <linux/capability.h> |
| 38 | #include <linux/slab.h> | 27 | #include <linux/slab.h> |
| 39 | #include <linux/xattr.h> | 28 | #include <linux/err.h> |
| 40 | #include <net/flow.h> | 29 | |
| 30 | struct linux_binprm; | ||
| 31 | struct cred; | ||
| 32 | struct rlimit; | ||
| 33 | struct siginfo; | ||
| 34 | struct sem_array; | ||
| 35 | struct sembuf; | ||
| 36 | struct kern_ipc_perm; | ||
| 37 | struct audit_context; | ||
| 38 | struct super_block; | ||
| 39 | struct inode; | ||
| 40 | struct dentry; | ||
| 41 | struct file; | ||
| 42 | struct vfsmount; | ||
| 43 | struct path; | ||
| 44 | struct qstr; | ||
| 45 | struct nameidata; | ||
| 46 | struct iattr; | ||
| 47 | struct fown_struct; | ||
| 48 | struct file_operations; | ||
| 49 | struct shmid_kernel; | ||
| 50 | struct msg_msg; | ||
| 51 | struct msg_queue; | ||
| 52 | struct xattr; | ||
| 53 | struct xfrm_sec_ctx; | ||
| 54 | struct mm_struct; | ||
| 41 | 55 | ||
| 42 | /* Maximum number of letters for an LSM name string */ | 56 | /* Maximum number of letters for an LSM name string */ |
| 43 | #define SECURITY_NAME_MAX 10 | 57 | #define SECURITY_NAME_MAX 10 |
| @@ -49,6 +63,7 @@ | |||
| 49 | struct ctl_table; | 63 | struct ctl_table; |
| 50 | struct audit_krule; | 64 | struct audit_krule; |
| 51 | struct user_namespace; | 65 | struct user_namespace; |
| 66 | struct timezone; | ||
| 52 | 67 | ||
| 53 | /* | 68 | /* |
| 54 | * These functions are in security/capability.c and are used | 69 | * These functions are in security/capability.c and are used |
| @@ -131,18 +146,6 @@ struct request_sock; | |||
| 131 | #define LSM_UNSAFE_PTRACE_CAP 4 | 146 | #define LSM_UNSAFE_PTRACE_CAP 4 |
| 132 | 147 | ||
| 133 | #ifdef CONFIG_MMU | 148 | #ifdef CONFIG_MMU |
| 134 | /* | ||
| 135 | * If a hint addr is less than mmap_min_addr change hint to be as | ||
| 136 | * low as possible but still greater than mmap_min_addr | ||
| 137 | */ | ||
| 138 | static inline unsigned long round_hint_to_min(unsigned long hint) | ||
| 139 | { | ||
| 140 | hint &= PAGE_MASK; | ||
| 141 | if (((void *)hint != NULL) && | ||
| 142 | (hint < mmap_min_addr)) | ||
| 143 | return PAGE_ALIGN(mmap_min_addr); | ||
| 144 | return hint; | ||
| 145 | } | ||
| 146 | extern int mmap_min_addr_handler(struct ctl_table *table, int write, | 149 | extern int mmap_min_addr_handler(struct ctl_table *table, int write, |
| 147 | void __user *buffer, size_t *lenp, loff_t *ppos); | 150 | void __user *buffer, size_t *lenp, loff_t *ppos); |
| 148 | #endif | 151 | #endif |
| @@ -651,6 +654,10 @@ static inline void security_free_mnt_opts(struct security_mnt_opts *opts) | |||
| 651 | * manual page for definitions of the @clone_flags. | 654 | * manual page for definitions of the @clone_flags. |
| 652 | * @clone_flags contains the flags indicating what should be shared. | 655 | * @clone_flags contains the flags indicating what should be shared. |
| 653 | * Return 0 if permission is granted. | 656 | * Return 0 if permission is granted. |
| 657 | * @task_free: | ||
| 658 | * @task task being freed | ||
| 659 | * Handle release of task-related resources. (Note that this can be called | ||
| 660 | * from interrupt context.) | ||
| 654 | * @cred_alloc_blank: | 661 | * @cred_alloc_blank: |
| 655 | * @cred points to the credentials. | 662 | * @cred points to the credentials. |
| 656 | * @gfp indicates the atomicity of any memory allocations. | 663 | * @gfp indicates the atomicity of any memory allocations. |
| @@ -812,7 +819,7 @@ static inline void security_free_mnt_opts(struct security_mnt_opts *opts) | |||
| 812 | * Check permissions before connecting or sending datagrams from @sock to | 819 | * Check permissions before connecting or sending datagrams from @sock to |
| 813 | * @other. | 820 | * @other. |
| 814 | * @sock contains the socket structure. | 821 | * @sock contains the socket structure. |
| 815 | * @sock contains the peer socket structure. | 822 | * @other contains the peer socket structure. |
| 816 | * Return 0 if permission is granted. | 823 | * Return 0 if permission is granted. |
| 817 | * | 824 | * |
| 818 | * The @unix_stream_connect and @unix_may_send hooks were necessary because | 825 | * The @unix_stream_connect and @unix_may_send hooks were necessary because |
| @@ -1493,6 +1500,7 @@ struct security_operations { | |||
| 1493 | int (*dentry_open) (struct file *file, const struct cred *cred); | 1500 | int (*dentry_open) (struct file *file, const struct cred *cred); |
| 1494 | 1501 | ||
| 1495 | int (*task_create) (unsigned long clone_flags); | 1502 | int (*task_create) (unsigned long clone_flags); |
| 1503 | void (*task_free) (struct task_struct *task); | ||
| 1496 | int (*cred_alloc_blank) (struct cred *cred, gfp_t gfp); | 1504 | int (*cred_alloc_blank) (struct cred *cred, gfp_t gfp); |
| 1497 | void (*cred_free) (struct cred *cred); | 1505 | void (*cred_free) (struct cred *cred); |
| 1498 | int (*cred_prepare)(struct cred *new, const struct cred *old, | 1506 | int (*cred_prepare)(struct cred *new, const struct cred *old, |
| @@ -1674,9 +1682,7 @@ int security_quotactl(int cmds, int type, int id, struct super_block *sb); | |||
| 1674 | int security_quota_on(struct dentry *dentry); | 1682 | int security_quota_on(struct dentry *dentry); |
| 1675 | int security_syslog(int type); | 1683 | int security_syslog(int type); |
| 1676 | int security_settime(const struct timespec *ts, const struct timezone *tz); | 1684 | int security_settime(const struct timespec *ts, const struct timezone *tz); |
| 1677 | int security_vm_enough_memory(long pages); | ||
| 1678 | int security_vm_enough_memory_mm(struct mm_struct *mm, long pages); | 1685 | int security_vm_enough_memory_mm(struct mm_struct *mm, long pages); |
| 1679 | int security_vm_enough_memory_kern(long pages); | ||
| 1680 | int security_bprm_set_creds(struct linux_binprm *bprm); | 1686 | int security_bprm_set_creds(struct linux_binprm *bprm); |
| 1681 | int security_bprm_check(struct linux_binprm *bprm); | 1687 | int security_bprm_check(struct linux_binprm *bprm); |
| 1682 | void security_bprm_committing_creds(struct linux_binprm *bprm); | 1688 | void security_bprm_committing_creds(struct linux_binprm *bprm); |
| @@ -1752,6 +1758,7 @@ int security_file_send_sigiotask(struct task_struct *tsk, | |||
| 1752 | int security_file_receive(struct file *file); | 1758 | int security_file_receive(struct file *file); |
| 1753 | int security_dentry_open(struct file *file, const struct cred *cred); | 1759 | int security_dentry_open(struct file *file, const struct cred *cred); |
| 1754 | int security_task_create(unsigned long clone_flags); | 1760 | int security_task_create(unsigned long clone_flags); |
| 1761 | void security_task_free(struct task_struct *task); | ||
| 1755 | int security_cred_alloc_blank(struct cred *cred, gfp_t gfp); | 1762 | int security_cred_alloc_blank(struct cred *cred, gfp_t gfp); |
| 1756 | void security_cred_free(struct cred *cred); | 1763 | void security_cred_free(struct cred *cred); |
| 1757 | int security_prepare_creds(struct cred *new, const struct cred *old, gfp_t gfp); | 1764 | int security_prepare_creds(struct cred *new, const struct cred *old, gfp_t gfp); |
| @@ -1896,25 +1903,11 @@ static inline int security_settime(const struct timespec *ts, | |||
| 1896 | return cap_settime(ts, tz); | 1903 | return cap_settime(ts, tz); |
| 1897 | } | 1904 | } |
| 1898 | 1905 | ||
| 1899 | static inline int security_vm_enough_memory(long pages) | ||
| 1900 | { | ||
| 1901 | WARN_ON(current->mm == NULL); | ||
| 1902 | return cap_vm_enough_memory(current->mm, pages); | ||
| 1903 | } | ||
| 1904 | |||
| 1905 | static inline int security_vm_enough_memory_mm(struct mm_struct *mm, long pages) | 1906 | static inline int security_vm_enough_memory_mm(struct mm_struct *mm, long pages) |
| 1906 | { | 1907 | { |
| 1907 | WARN_ON(mm == NULL); | ||
| 1908 | return cap_vm_enough_memory(mm, pages); | 1908 | return cap_vm_enough_memory(mm, pages); |
| 1909 | } | 1909 | } |
| 1910 | 1910 | ||
| 1911 | static inline int security_vm_enough_memory_kern(long pages) | ||
| 1912 | { | ||
| 1913 | /* If current->mm is a kernel thread then we will pass NULL, | ||
| 1914 | for this specific case that is fine */ | ||
| 1915 | return cap_vm_enough_memory(current->mm, pages); | ||
| 1916 | } | ||
| 1917 | |||
| 1918 | static inline int security_bprm_set_creds(struct linux_binprm *bprm) | 1911 | static inline int security_bprm_set_creds(struct linux_binprm *bprm) |
| 1919 | { | 1912 | { |
| 1920 | return cap_bprm_set_creds(bprm); | 1913 | return cap_bprm_set_creds(bprm); |
| @@ -2245,6 +2238,9 @@ static inline int security_task_create(unsigned long clone_flags) | |||
| 2245 | return 0; | 2238 | return 0; |
| 2246 | } | 2239 | } |
| 2247 | 2240 | ||
| 2241 | static inline void security_task_free(struct task_struct *task) | ||
| 2242 | { } | ||
| 2243 | |||
| 2248 | static inline int security_cred_alloc_blank(struct cred *cred, gfp_t gfp) | 2244 | static inline int security_cred_alloc_blank(struct cred *cred, gfp_t gfp) |
| 2249 | { | 2245 | { |
| 2250 | return 0; | 2246 | return 0; |
diff --git a/include/linux/seq_file.h b/include/linux/seq_file.h index 44f1514b00ba..fc61854f6224 100644 --- a/include/linux/seq_file.h +++ b/include/linux/seq_file.h | |||
| @@ -3,6 +3,7 @@ | |||
| 3 | 3 | ||
| 4 | #include <linux/types.h> | 4 | #include <linux/types.h> |
| 5 | #include <linux/string.h> | 5 | #include <linux/string.h> |
| 6 | #include <linux/bug.h> | ||
| 6 | #include <linux/mutex.h> | 7 | #include <linux/mutex.h> |
| 7 | #include <linux/cpumask.h> | 8 | #include <linux/cpumask.h> |
| 8 | #include <linux/nodemask.h> | 9 | #include <linux/nodemask.h> |
| @@ -121,9 +122,12 @@ int single_release(struct inode *, struct file *); | |||
| 121 | void *__seq_open_private(struct file *, const struct seq_operations *, int); | 122 | void *__seq_open_private(struct file *, const struct seq_operations *, int); |
| 122 | int seq_open_private(struct file *, const struct seq_operations *, int); | 123 | int seq_open_private(struct file *, const struct seq_operations *, int); |
| 123 | int seq_release_private(struct inode *, struct file *); | 124 | int seq_release_private(struct inode *, struct file *); |
| 125 | int seq_put_decimal_ull(struct seq_file *m, char delimiter, | ||
| 126 | unsigned long long num); | ||
| 127 | int seq_put_decimal_ll(struct seq_file *m, char delimiter, | ||
| 128 | long long num); | ||
| 124 | 129 | ||
| 125 | #define SEQ_START_TOKEN ((void *)1) | 130 | #define SEQ_START_TOKEN ((void *)1) |
| 126 | |||
| 127 | /* | 131 | /* |
| 128 | * Helpers for iteration over list_head-s in seq_files | 132 | * Helpers for iteration over list_head-s in seq_files |
| 129 | */ | 133 | */ |
diff --git a/include/linux/serial.h b/include/linux/serial.h index 3d86517fe7d5..441980ecc4e5 100644 --- a/include/linux/serial.h +++ b/include/linux/serial.h | |||
| @@ -152,8 +152,8 @@ struct serial_uart_config { | |||
| 152 | #define ASYNC_AUTOPROBE (1U << ASYNCB_AUTOPROBE) | 152 | #define ASYNC_AUTOPROBE (1U << ASYNCB_AUTOPROBE) |
| 153 | 153 | ||
| 154 | #define ASYNC_FLAGS ((1U << (ASYNCB_LAST_USER + 1)) - 1) | 154 | #define ASYNC_FLAGS ((1U << (ASYNCB_LAST_USER + 1)) - 1) |
| 155 | #define ASYNC_USR_MASK (ASYNC_SPD_HI|ASYNC_SPD_VHI| \ | 155 | #define ASYNC_USR_MASK (ASYNC_SPD_MASK|ASYNC_CALLOUT_NOHUP| \ |
| 156 | ASYNC_CALLOUT_NOHUP|ASYNC_SPD_SHI|ASYNC_LOW_LATENCY) | 156 | ASYNC_LOW_LATENCY) |
| 157 | #define ASYNC_SPD_CUST (ASYNC_SPD_HI|ASYNC_SPD_VHI) | 157 | #define ASYNC_SPD_CUST (ASYNC_SPD_HI|ASYNC_SPD_VHI) |
| 158 | #define ASYNC_SPD_WARP (ASYNC_SPD_HI|ASYNC_SPD_SHI) | 158 | #define ASYNC_SPD_WARP (ASYNC_SPD_HI|ASYNC_SPD_SHI) |
| 159 | #define ASYNC_SPD_MASK (ASYNC_SPD_HI|ASYNC_SPD_VHI|ASYNC_SPD_SHI) | 159 | #define ASYNC_SPD_MASK (ASYNC_SPD_HI|ASYNC_SPD_VHI|ASYNC_SPD_SHI) |
diff --git a/include/linux/serialP.h b/include/linux/serialP.h deleted file mode 100644 index e811a615f696..000000000000 --- a/include/linux/serialP.h +++ /dev/null | |||
| @@ -1,142 +0,0 @@ | |||
| 1 | /* | ||
| 2 | * Private header file for the (dumb) serial driver | ||
| 3 | * | ||
| 4 | * Copyright (C) 1997 by Theodore Ts'o. | ||
| 5 | * | ||
| 6 | * Redistribution of this file is permitted under the terms of the GNU | ||
| 7 | * Public License (GPL) | ||
| 8 | */ | ||
| 9 | |||
| 10 | #ifndef _LINUX_SERIALP_H | ||
| 11 | #define _LINUX_SERIALP_H | ||
| 12 | |||
| 13 | /* | ||
| 14 | * This is our internal structure for each serial port's state. | ||
| 15 | * | ||
| 16 | * Many fields are paralleled by the structure used by the serial_struct | ||
| 17 | * structure. | ||
| 18 | * | ||
| 19 | * For definitions of the flags field, see tty.h | ||
| 20 | */ | ||
| 21 | |||
| 22 | #include <linux/termios.h> | ||
| 23 | #include <linux/workqueue.h> | ||
| 24 | #include <linux/interrupt.h> | ||
| 25 | #include <linux/circ_buf.h> | ||
| 26 | #include <linux/wait.h> | ||
| 27 | |||
| 28 | struct serial_state { | ||
| 29 | int magic; | ||
| 30 | int baud_base; | ||
| 31 | unsigned long port; | ||
| 32 | int irq; | ||
| 33 | int flags; | ||
| 34 | int hub6; | ||
| 35 | int type; | ||
| 36 | int line; | ||
| 37 | int revision; /* Chip revision (950) */ | ||
| 38 | int xmit_fifo_size; | ||
| 39 | int custom_divisor; | ||
| 40 | int count; | ||
| 41 | u8 *iomem_base; | ||
| 42 | u16 iomem_reg_shift; | ||
| 43 | unsigned short close_delay; | ||
| 44 | unsigned short closing_wait; /* time to wait before closing */ | ||
| 45 | struct async_icount icount; | ||
| 46 | int io_type; | ||
| 47 | struct async_struct *info; | ||
| 48 | struct pci_dev *dev; | ||
| 49 | }; | ||
| 50 | |||
| 51 | struct async_struct { | ||
| 52 | int magic; | ||
| 53 | unsigned long port; | ||
| 54 | int hub6; | ||
| 55 | int flags; | ||
| 56 | int xmit_fifo_size; | ||
| 57 | struct serial_state *state; | ||
| 58 | struct tty_struct *tty; | ||
| 59 | int read_status_mask; | ||
| 60 | int ignore_status_mask; | ||
| 61 | int timeout; | ||
| 62 | int quot; | ||
| 63 | int x_char; /* xon/xoff character */ | ||
| 64 | int close_delay; | ||
| 65 | unsigned short closing_wait; | ||
| 66 | unsigned short closing_wait2; /* obsolete */ | ||
| 67 | int IER; /* Interrupt Enable Register */ | ||
| 68 | int MCR; /* Modem control register */ | ||
| 69 | int LCR; /* Line control register */ | ||
| 70 | int ACR; /* 16950 Additional Control Reg. */ | ||
| 71 | unsigned long event; | ||
| 72 | unsigned long last_active; | ||
| 73 | int line; | ||
| 74 | int blocked_open; /* # of blocked opens */ | ||
| 75 | struct circ_buf xmit; | ||
| 76 | spinlock_t xmit_lock; | ||
| 77 | u8 *iomem_base; | ||
| 78 | u16 iomem_reg_shift; | ||
| 79 | int io_type; | ||
| 80 | struct work_struct work; | ||
| 81 | struct tasklet_struct tlet; | ||
| 82 | #ifdef DECLARE_WAITQUEUE | ||
| 83 | wait_queue_head_t open_wait; | ||
| 84 | wait_queue_head_t close_wait; | ||
| 85 | wait_queue_head_t delta_msr_wait; | ||
| 86 | #else | ||
| 87 | struct wait_queue *open_wait; | ||
| 88 | struct wait_queue *close_wait; | ||
| 89 | struct wait_queue *delta_msr_wait; | ||
| 90 | #endif | ||
| 91 | struct async_struct *next_port; /* For the linked list */ | ||
| 92 | struct async_struct *prev_port; | ||
| 93 | }; | ||
| 94 | |||
| 95 | #define CONFIGURED_SERIAL_PORT(info) ((info)->port || ((info)->iomem_base)) | ||
| 96 | |||
| 97 | #define SERIAL_MAGIC 0x5301 | ||
| 98 | #define SSTATE_MAGIC 0x5302 | ||
| 99 | |||
| 100 | /* | ||
| 101 | * Events are used to schedule things to happen at timer-interrupt | ||
| 102 | * time, instead of at rs interrupt time. | ||
| 103 | */ | ||
| 104 | #define RS_EVENT_WRITE_WAKEUP 0 | ||
| 105 | |||
| 106 | /* | ||
| 107 | * Multiport serial configuration structure --- internal structure | ||
| 108 | */ | ||
| 109 | struct rs_multiport_struct { | ||
| 110 | int port1; | ||
| 111 | unsigned char mask1, match1; | ||
| 112 | int port2; | ||
| 113 | unsigned char mask2, match2; | ||
| 114 | int port3; | ||
| 115 | unsigned char mask3, match3; | ||
| 116 | int port4; | ||
| 117 | unsigned char mask4, match4; | ||
| 118 | int port_monitor; | ||
| 119 | }; | ||
| 120 | |||
| 121 | #if defined(__alpha__) && !defined(CONFIG_PCI) | ||
| 122 | /* | ||
| 123 | * Digital did something really horribly wrong with the OUT1 and OUT2 | ||
| 124 | * lines on at least some ALPHA's. The failure mode is that if either | ||
| 125 | * is cleared, the machine locks up with endless interrupts. | ||
| 126 | * | ||
| 127 | * This is still used by arch/mips/au1000/common/serial.c for some weird | ||
| 128 | * reason (mips != alpha!) | ||
| 129 | */ | ||
| 130 | #define ALPHA_KLUDGE_MCR (UART_MCR_OUT2 | UART_MCR_OUT1) | ||
| 131 | #elif defined(CONFIG_SBC8560) | ||
| 132 | /* | ||
| 133 | * WindRiver did something similarly broken on their SBC8560 board. The | ||
| 134 | * UART tristates its IRQ output while OUT2 is clear, but they pulled | ||
| 135 | * the interrupt line _up_ instead of down, so if we register the IRQ | ||
| 136 | * while the UART is in that state, we die in an IRQ storm. */ | ||
| 137 | #define ALPHA_KLUDGE_MCR (UART_MCR_OUT2) | ||
| 138 | #else | ||
| 139 | #define ALPHA_KLUDGE_MCR 0 | ||
| 140 | #endif | ||
| 141 | |||
| 142 | #endif /* _LINUX_SERIAL_H */ | ||
diff --git a/include/linux/serial_core.h b/include/linux/serial_core.h index c91ace70c21d..f51bf2e70c69 100644 --- a/include/linux/serial_core.h +++ b/include/linux/serial_core.h | |||
| @@ -210,6 +210,8 @@ | |||
| 210 | /* Atheros AR933X SoC */ | 210 | /* Atheros AR933X SoC */ |
| 211 | #define PORT_AR933X 99 | 211 | #define PORT_AR933X 99 |
| 212 | 212 | ||
| 213 | /* Energy Micro efm32 SoC */ | ||
| 214 | #define PORT_EFMUART 100 | ||
| 213 | 215 | ||
| 214 | #ifdef __KERNEL__ | 216 | #ifdef __KERNEL__ |
| 215 | 217 | ||
| @@ -381,6 +383,16 @@ struct uart_port { | |||
| 381 | void *private_data; /* generic platform data pointer */ | 383 | void *private_data; /* generic platform data pointer */ |
| 382 | }; | 384 | }; |
| 383 | 385 | ||
| 386 | static inline int serial_port_in(struct uart_port *up, int offset) | ||
| 387 | { | ||
| 388 | return up->serial_in(up, offset); | ||
| 389 | } | ||
| 390 | |||
| 391 | static inline void serial_port_out(struct uart_port *up, int offset, int value) | ||
| 392 | { | ||
| 393 | up->serial_out(up, offset, value); | ||
| 394 | } | ||
| 395 | |||
| 384 | /* | 396 | /* |
| 385 | * This is the state information which is persistent across opens. | 397 | * This is the state information which is persistent across opens. |
| 386 | */ | 398 | */ |
diff --git a/include/linux/serial_pnx8xxx.h b/include/linux/serial_pnx8xxx.h index de6c19c7f340..79ad87b0be3e 100644 --- a/include/linux/serial_pnx8xxx.h +++ b/include/linux/serial_pnx8xxx.h | |||
| @@ -20,7 +20,6 @@ | |||
| 20 | #define _LINUX_SERIAL_PNX8XXX_H | 20 | #define _LINUX_SERIAL_PNX8XXX_H |
| 21 | 21 | ||
| 22 | #include <linux/serial_core.h> | 22 | #include <linux/serial_core.h> |
| 23 | #include <linux/device.h> | ||
| 24 | 23 | ||
| 25 | #define PNX8XXX_NR_PORTS 2 | 24 | #define PNX8XXX_NR_PORTS 2 |
| 26 | 25 | ||
diff --git a/include/linux/sh_eth.h b/include/linux/sh_eth.h index 2076acf8294d..b17d765ded84 100644 --- a/include/linux/sh_eth.h +++ b/include/linux/sh_eth.h | |||
| @@ -20,6 +20,7 @@ struct sh_eth_plat_data { | |||
| 20 | unsigned char mac_addr[6]; | 20 | unsigned char mac_addr[6]; |
| 21 | unsigned no_ether_link:1; | 21 | unsigned no_ether_link:1; |
| 22 | unsigned ether_link_active_low:1; | 22 | unsigned ether_link_active_low:1; |
| 23 | unsigned needs_init:1; | ||
| 23 | }; | 24 | }; |
| 24 | 25 | ||
| 25 | #endif | 26 | #endif |
diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h index ae86adee3746..3fcb204a2612 100644 --- a/include/linux/skbuff.h +++ b/include/linux/skbuff.h | |||
| @@ -18,6 +18,7 @@ | |||
| 18 | #include <linux/kmemcheck.h> | 18 | #include <linux/kmemcheck.h> |
| 19 | #include <linux/compiler.h> | 19 | #include <linux/compiler.h> |
| 20 | #include <linux/time.h> | 20 | #include <linux/time.h> |
| 21 | #include <linux/bug.h> | ||
| 21 | #include <linux/cache.h> | 22 | #include <linux/cache.h> |
| 22 | 23 | ||
| 23 | #include <linux/atomic.h> | 24 | #include <linux/atomic.h> |
| @@ -94,6 +95,13 @@ | |||
| 94 | * about CHECKSUM_UNNECESSARY. 8) | 95 | * about CHECKSUM_UNNECESSARY. 8) |
| 95 | * NETIF_F_IPV6_CSUM about as dumb as the last one but does IPv6 instead. | 96 | * NETIF_F_IPV6_CSUM about as dumb as the last one but does IPv6 instead. |
| 96 | * | 97 | * |
| 98 | * UNNECESSARY: device will do per protocol specific csum. Protocol drivers | ||
| 99 | * that do not want net to perform the checksum calculation should use | ||
| 100 | * this flag in their outgoing skbs. | ||
| 101 | * NETIF_F_FCOE_CRC this indicates the device can do FCoE FC CRC | ||
| 102 | * offload. Correspondingly, the FCoE protocol driver | ||
| 103 | * stack should use CHECKSUM_UNNECESSARY. | ||
| 104 | * | ||
| 97 | * Any questions? No questions, good. --ANK | 105 | * Any questions? No questions, good. --ANK |
| 98 | */ | 106 | */ |
| 99 | 107 | ||
| @@ -361,6 +369,7 @@ typedef unsigned char *sk_buff_data_t; | |||
| 361 | * ports. | 369 | * ports. |
| 362 | * @wifi_acked_valid: wifi_acked was set | 370 | * @wifi_acked_valid: wifi_acked was set |
| 363 | * @wifi_acked: whether frame was acked on wifi or not | 371 | * @wifi_acked: whether frame was acked on wifi or not |
| 372 | * @no_fcs: Request NIC to treat last 4 bytes as Ethernet FCS | ||
| 364 | * @dma_cookie: a cookie to one of several possible DMA operations | 373 | * @dma_cookie: a cookie to one of several possible DMA operations |
| 365 | * done by skb DMA functions | 374 | * done by skb DMA functions |
| 366 | * @secmark: security marking | 375 | * @secmark: security marking |
| @@ -438,6 +447,11 @@ struct sk_buff { | |||
| 438 | #endif | 447 | #endif |
| 439 | 448 | ||
| 440 | int skb_iif; | 449 | int skb_iif; |
| 450 | |||
| 451 | __u32 rxhash; | ||
| 452 | |||
| 453 | __u16 vlan_tci; | ||
| 454 | |||
| 441 | #ifdef CONFIG_NET_SCHED | 455 | #ifdef CONFIG_NET_SCHED |
| 442 | __u16 tc_index; /* traffic control index */ | 456 | __u16 tc_index; /* traffic control index */ |
| 443 | #ifdef CONFIG_NET_CLS_ACT | 457 | #ifdef CONFIG_NET_CLS_ACT |
| @@ -445,8 +459,6 @@ struct sk_buff { | |||
| 445 | #endif | 459 | #endif |
| 446 | #endif | 460 | #endif |
| 447 | 461 | ||
| 448 | __u32 rxhash; | ||
| 449 | |||
| 450 | __u16 queue_mapping; | 462 | __u16 queue_mapping; |
| 451 | kmemcheck_bitfield_begin(flags2); | 463 | kmemcheck_bitfield_begin(flags2); |
| 452 | #ifdef CONFIG_IPV6_NDISC_NODETYPE | 464 | #ifdef CONFIG_IPV6_NDISC_NODETYPE |
| @@ -456,7 +468,8 @@ struct sk_buff { | |||
| 456 | __u8 l4_rxhash:1; | 468 | __u8 l4_rxhash:1; |
| 457 | __u8 wifi_acked_valid:1; | 469 | __u8 wifi_acked_valid:1; |
| 458 | __u8 wifi_acked:1; | 470 | __u8 wifi_acked:1; |
| 459 | /* 10/12 bit hole (depending on ndisc_nodetype presence) */ | 471 | __u8 no_fcs:1; |
| 472 | /* 9/11 bit hole (depending on ndisc_nodetype presence) */ | ||
| 460 | kmemcheck_bitfield_end(flags2); | 473 | kmemcheck_bitfield_end(flags2); |
| 461 | 474 | ||
| 462 | #ifdef CONFIG_NET_DMA | 475 | #ifdef CONFIG_NET_DMA |
| @@ -470,8 +483,6 @@ struct sk_buff { | |||
| 470 | __u32 dropcount; | 483 | __u32 dropcount; |
| 471 | }; | 484 | }; |
| 472 | 485 | ||
| 473 | __u16 vlan_tci; | ||
| 474 | |||
| 475 | sk_buff_data_t transport_header; | 486 | sk_buff_data_t transport_header; |
| 476 | sk_buff_data_t network_header; | 487 | sk_buff_data_t network_header; |
| 477 | sk_buff_data_t mac_header; | 488 | sk_buff_data_t mac_header; |
| @@ -876,6 +887,24 @@ static inline struct sk_buff *skb_peek(const struct sk_buff_head *list_) | |||
| 876 | } | 887 | } |
| 877 | 888 | ||
| 878 | /** | 889 | /** |
| 890 | * skb_peek_next - peek skb following the given one from a queue | ||
| 891 | * @skb: skb to start from | ||
| 892 | * @list_: list to peek at | ||
| 893 | * | ||
| 894 | * Returns %NULL when the end of the list is met or a pointer to the | ||
| 895 | * next element. The reference count is not incremented and the | ||
| 896 | * reference is therefore volatile. Use with caution. | ||
| 897 | */ | ||
| 898 | static inline struct sk_buff *skb_peek_next(struct sk_buff *skb, | ||
| 899 | const struct sk_buff_head *list_) | ||
| 900 | { | ||
| 901 | struct sk_buff *next = skb->next; | ||
| 902 | if (next == (struct sk_buff *)list_) | ||
| 903 | next = NULL; | ||
| 904 | return next; | ||
| 905 | } | ||
| 906 | |||
| 907 | /** | ||
| 879 | * skb_peek_tail - peek at the tail of an &sk_buff_head | 908 | * skb_peek_tail - peek at the tail of an &sk_buff_head |
| 880 | * @list_: list to peek at | 909 | * @list_: list to peek at |
| 881 | * | 910 | * |
| @@ -1152,7 +1181,7 @@ static inline struct sk_buff *__skb_dequeue_tail(struct sk_buff_head *list) | |||
| 1152 | } | 1181 | } |
| 1153 | 1182 | ||
| 1154 | 1183 | ||
| 1155 | static inline int skb_is_nonlinear(const struct sk_buff *skb) | 1184 | static inline bool skb_is_nonlinear(const struct sk_buff *skb) |
| 1156 | { | 1185 | { |
| 1157 | return skb->data_len; | 1186 | return skb->data_len; |
| 1158 | } | 1187 | } |
| @@ -2055,7 +2084,7 @@ static inline void skb_frag_add_head(struct sk_buff *skb, struct sk_buff *frag) | |||
| 2055 | for (iter = skb_shinfo(skb)->frag_list; iter; iter = iter->next) | 2084 | for (iter = skb_shinfo(skb)->frag_list; iter; iter = iter->next) |
| 2056 | 2085 | ||
| 2057 | extern struct sk_buff *__skb_recv_datagram(struct sock *sk, unsigned flags, | 2086 | extern struct sk_buff *__skb_recv_datagram(struct sock *sk, unsigned flags, |
| 2058 | int *peeked, int *err); | 2087 | int *peeked, int *off, int *err); |
| 2059 | extern struct sk_buff *skb_recv_datagram(struct sock *sk, unsigned flags, | 2088 | extern struct sk_buff *skb_recv_datagram(struct sock *sk, unsigned flags, |
| 2060 | int noblock, int *err); | 2089 | int noblock, int *err); |
| 2061 | extern unsigned int datagram_poll(struct file *file, struct socket *sock, | 2090 | extern unsigned int datagram_poll(struct file *file, struct socket *sock, |
| @@ -2448,12 +2477,12 @@ static inline struct sec_path *skb_sec_path(struct sk_buff *skb) | |||
| 2448 | } | 2477 | } |
| 2449 | #endif | 2478 | #endif |
| 2450 | 2479 | ||
| 2451 | static inline int skb_is_gso(const struct sk_buff *skb) | 2480 | static inline bool skb_is_gso(const struct sk_buff *skb) |
| 2452 | { | 2481 | { |
| 2453 | return skb_shinfo(skb)->gso_size; | 2482 | return skb_shinfo(skb)->gso_size; |
| 2454 | } | 2483 | } |
| 2455 | 2484 | ||
| 2456 | static inline int skb_is_gso_v6(const struct sk_buff *skb) | 2485 | static inline bool skb_is_gso_v6(const struct sk_buff *skb) |
| 2457 | { | 2486 | { |
| 2458 | return skb_shinfo(skb)->gso_type & SKB_GSO_TCPV6; | 2487 | return skb_shinfo(skb)->gso_type & SKB_GSO_TCPV6; |
| 2459 | } | 2488 | } |
diff --git a/include/linux/slub_def.h b/include/linux/slub_def.h index a32bcfdc7834..ca122b36aec1 100644 --- a/include/linux/slub_def.h +++ b/include/linux/slub_def.h | |||
| @@ -8,6 +8,7 @@ | |||
| 8 | */ | 8 | */ |
| 9 | #include <linux/types.h> | 9 | #include <linux/types.h> |
| 10 | #include <linux/gfp.h> | 10 | #include <linux/gfp.h> |
| 11 | #include <linux/bug.h> | ||
| 11 | #include <linux/workqueue.h> | 12 | #include <linux/workqueue.h> |
| 12 | #include <linux/kobject.h> | 13 | #include <linux/kobject.h> |
| 13 | 14 | ||
diff --git a/include/linux/snmp.h b/include/linux/snmp.h index c1241c428179..2e68f5ba0389 100644 --- a/include/linux/snmp.h +++ b/include/linux/snmp.h | |||
| @@ -232,6 +232,8 @@ enum | |||
| 232 | LINUX_MIB_TCPTIMEWAITOVERFLOW, /* TCPTimeWaitOverflow */ | 232 | LINUX_MIB_TCPTIMEWAITOVERFLOW, /* TCPTimeWaitOverflow */ |
| 233 | LINUX_MIB_TCPREQQFULLDOCOOKIES, /* TCPReqQFullDoCookies */ | 233 | LINUX_MIB_TCPREQQFULLDOCOOKIES, /* TCPReqQFullDoCookies */ |
| 234 | LINUX_MIB_TCPREQQFULLDROP, /* TCPReqQFullDrop */ | 234 | LINUX_MIB_TCPREQQFULLDROP, /* TCPReqQFullDrop */ |
| 235 | LINUX_MIB_TCPRETRANSFAIL, /* TCPRetransFail */ | ||
| 236 | LINUX_MIB_TCPRCVCOALESCE, /* TCPRcvCoalesce */ | ||
| 235 | __LINUX_MIB_MAX | 237 | __LINUX_MIB_MAX |
| 236 | }; | 238 | }; |
| 237 | 239 | ||
diff --git a/include/linux/socket.h b/include/linux/socket.h index d0e77f607a79..da2d3e2543f3 100644 --- a/include/linux/socket.h +++ b/include/linux/socket.h | |||
| @@ -326,11 +326,11 @@ extern int csum_partial_copy_fromiovecend(unsigned char *kdata, | |||
| 326 | int offset, | 326 | int offset, |
| 327 | unsigned int len, __wsum *csump); | 327 | unsigned int len, __wsum *csump); |
| 328 | 328 | ||
| 329 | extern int verify_iovec(struct msghdr *m, struct iovec *iov, struct sockaddr *address, int mode); | 329 | extern int verify_iovec(struct msghdr *m, struct iovec *iov, struct sockaddr_storage *address, int mode); |
| 330 | extern int memcpy_toiovec(struct iovec *v, unsigned char *kdata, int len); | 330 | extern int memcpy_toiovec(struct iovec *v, unsigned char *kdata, int len); |
| 331 | extern int memcpy_toiovecend(const struct iovec *v, unsigned char *kdata, | 331 | extern int memcpy_toiovecend(const struct iovec *v, unsigned char *kdata, |
| 332 | int offset, int len); | 332 | int offset, int len); |
| 333 | extern int move_addr_to_kernel(void __user *uaddr, int ulen, struct sockaddr *kaddr); | 333 | extern int move_addr_to_kernel(void __user *uaddr, int ulen, struct sockaddr_storage *kaddr); |
| 334 | extern int put_cmsg(struct msghdr*, int level, int type, int len, void *data); | 334 | extern int put_cmsg(struct msghdr*, int level, int type, int len, void *data); |
| 335 | 335 | ||
| 336 | struct timespec; | 336 | struct timespec; |
diff --git a/include/linux/spi/mmc_spi.h b/include/linux/spi/mmc_spi.h index 0f4eb165f254..32be8dbdf191 100644 --- a/include/linux/spi/mmc_spi.h +++ b/include/linux/spi/mmc_spi.h | |||
| @@ -1,10 +1,10 @@ | |||
| 1 | #ifndef __LINUX_SPI_MMC_SPI_H | 1 | #ifndef __LINUX_SPI_MMC_SPI_H |
| 2 | #define __LINUX_SPI_MMC_SPI_H | 2 | #define __LINUX_SPI_MMC_SPI_H |
| 3 | 3 | ||
| 4 | #include <linux/device.h> | ||
| 5 | #include <linux/spi/spi.h> | 4 | #include <linux/spi/spi.h> |
| 6 | #include <linux/interrupt.h> | 5 | #include <linux/interrupt.h> |
| 7 | 6 | ||
| 7 | struct device; | ||
| 8 | struct mmc_host; | 8 | struct mmc_host; |
| 9 | 9 | ||
| 10 | /* Put this in platform_data of a device being used to manage an MMC/SD | 10 | /* Put this in platform_data of a device being used to manage an MMC/SD |
diff --git a/include/linux/spi/sh_hspi.h b/include/linux/spi/sh_hspi.h new file mode 100644 index 000000000000..a1121f872ac1 --- /dev/null +++ b/include/linux/spi/sh_hspi.h | |||
| @@ -0,0 +1,23 @@ | |||
| 1 | /* | ||
| 2 | * Copyright (C) 2011 Kuninori Morimoto | ||
| 3 | * | ||
| 4 | * This program is free software; you can redistribute it and/or modify | ||
| 5 | * it under the terms of the GNU General Public License as published by | ||
| 6 | * the Free Software Foundation; version 2 of the License. | ||
| 7 | * | ||
| 8 | * This program is distributed in the hope that it will be useful, | ||
| 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 11 | * GNU General Public License for more details. | ||
| 12 | * | ||
| 13 | * You should have received a copy of the GNU General Public License | ||
| 14 | * along with this program; if not, write to the Free Software | ||
| 15 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA | ||
| 16 | */ | ||
| 17 | #ifndef SH_HSPI_H | ||
| 18 | #define SH_HSPI_H | ||
| 19 | |||
| 20 | struct sh_hspi_info { | ||
| 21 | }; | ||
| 22 | |||
| 23 | #endif | ||
diff --git a/include/linux/spi/spi.h b/include/linux/spi/spi.h index 176fce9cc6b1..98679b061b63 100644 --- a/include/linux/spi/spi.h +++ b/include/linux/spi/spi.h | |||
| @@ -22,6 +22,7 @@ | |||
| 22 | #include <linux/device.h> | 22 | #include <linux/device.h> |
| 23 | #include <linux/mod_devicetable.h> | 23 | #include <linux/mod_devicetable.h> |
| 24 | #include <linux/slab.h> | 24 | #include <linux/slab.h> |
| 25 | #include <linux/kthread.h> | ||
| 25 | 26 | ||
| 26 | /* | 27 | /* |
| 27 | * INTERFACES between SPI master-side drivers and SPI infrastructure. | 28 | * INTERFACES between SPI master-side drivers and SPI infrastructure. |
| @@ -235,6 +236,27 @@ static inline void spi_unregister_driver(struct spi_driver *sdrv) | |||
| 235 | * the device whose settings are being modified. | 236 | * the device whose settings are being modified. |
| 236 | * @transfer: adds a message to the controller's transfer queue. | 237 | * @transfer: adds a message to the controller's transfer queue. |
| 237 | * @cleanup: frees controller-specific state | 238 | * @cleanup: frees controller-specific state |
| 239 | * @queued: whether this master is providing an internal message queue | ||
| 240 | * @kworker: thread struct for message pump | ||
| 241 | * @kworker_task: pointer to task for message pump kworker thread | ||
| 242 | * @pump_messages: work struct for scheduling work to the message pump | ||
| 243 | * @queue_lock: spinlock to syncronise access to message queue | ||
| 244 | * @queue: message queue | ||
| 245 | * @cur_msg: the currently in-flight message | ||
| 246 | * @busy: message pump is busy | ||
| 247 | * @running: message pump is running | ||
| 248 | * @rt: whether this queue is set to run as a realtime task | ||
| 249 | * @prepare_transfer_hardware: a message will soon arrive from the queue | ||
| 250 | * so the subsystem requests the driver to prepare the transfer hardware | ||
| 251 | * by issuing this call | ||
| 252 | * @transfer_one_message: the subsystem calls the driver to transfer a single | ||
| 253 | * message while queuing transfers that arrive in the meantime. When the | ||
| 254 | * driver is finished with this message, it must call | ||
| 255 | * spi_finalize_current_message() so the subsystem can issue the next | ||
| 256 | * transfer | ||
| 257 | * @prepare_transfer_hardware: there are currently no more messages on the | ||
| 258 | * queue so the subsystem notifies the driver that it may relax the | ||
| 259 | * hardware by issuing this call | ||
| 238 | * | 260 | * |
| 239 | * Each SPI master controller can communicate with one or more @spi_device | 261 | * Each SPI master controller can communicate with one or more @spi_device |
| 240 | * children. These make a small bus, sharing MOSI, MISO and SCK signals | 262 | * children. These make a small bus, sharing MOSI, MISO and SCK signals |
| @@ -318,6 +340,28 @@ struct spi_master { | |||
| 318 | 340 | ||
| 319 | /* called on release() to free memory provided by spi_master */ | 341 | /* called on release() to free memory provided by spi_master */ |
| 320 | void (*cleanup)(struct spi_device *spi); | 342 | void (*cleanup)(struct spi_device *spi); |
| 343 | |||
| 344 | /* | ||
| 345 | * These hooks are for drivers that want to use the generic | ||
| 346 | * master transfer queueing mechanism. If these are used, the | ||
| 347 | * transfer() function above must NOT be specified by the driver. | ||
| 348 | * Over time we expect SPI drivers to be phased over to this API. | ||
| 349 | */ | ||
| 350 | bool queued; | ||
| 351 | struct kthread_worker kworker; | ||
| 352 | struct task_struct *kworker_task; | ||
| 353 | struct kthread_work pump_messages; | ||
| 354 | spinlock_t queue_lock; | ||
| 355 | struct list_head queue; | ||
| 356 | struct spi_message *cur_msg; | ||
| 357 | bool busy; | ||
| 358 | bool running; | ||
| 359 | bool rt; | ||
| 360 | |||
| 361 | int (*prepare_transfer_hardware)(struct spi_master *master); | ||
| 362 | int (*transfer_one_message)(struct spi_master *master, | ||
| 363 | struct spi_message *mesg); | ||
| 364 | int (*unprepare_transfer_hardware)(struct spi_master *master); | ||
| 321 | }; | 365 | }; |
| 322 | 366 | ||
| 323 | static inline void *spi_master_get_devdata(struct spi_master *master) | 367 | static inline void *spi_master_get_devdata(struct spi_master *master) |
| @@ -343,6 +387,13 @@ static inline void spi_master_put(struct spi_master *master) | |||
| 343 | put_device(&master->dev); | 387 | put_device(&master->dev); |
| 344 | } | 388 | } |
| 345 | 389 | ||
| 390 | /* PM calls that need to be issued by the driver */ | ||
| 391 | extern int spi_master_suspend(struct spi_master *master); | ||
| 392 | extern int spi_master_resume(struct spi_master *master); | ||
| 393 | |||
| 394 | /* Calls the driver make to interact with the message queue */ | ||
| 395 | extern struct spi_message *spi_get_next_queued_message(struct spi_master *master); | ||
| 396 | extern void spi_finalize_current_message(struct spi_master *master); | ||
| 346 | 397 | ||
| 347 | /* the spi driver core manages memory for the spi_master classdev */ | 398 | /* the spi driver core manages memory for the spi_master classdev */ |
| 348 | extern struct spi_master * | 399 | extern struct spi_master * |
| @@ -549,7 +600,7 @@ static inline struct spi_message *spi_message_alloc(unsigned ntrans, gfp_t flags | |||
| 549 | + ntrans * sizeof(struct spi_transfer), | 600 | + ntrans * sizeof(struct spi_transfer), |
| 550 | flags); | 601 | flags); |
| 551 | if (m) { | 602 | if (m) { |
| 552 | int i; | 603 | unsigned i; |
| 553 | struct spi_transfer *t = (struct spi_transfer *)(m + 1); | 604 | struct spi_transfer *t = (struct spi_transfer *)(m + 1); |
| 554 | 605 | ||
| 555 | INIT_LIST_HEAD(&m->transfers); | 606 | INIT_LIST_HEAD(&m->transfers); |
diff --git a/include/linux/spinlock.h b/include/linux/spinlock.h index 7df6c17b0281..363239087263 100644 --- a/include/linux/spinlock.h +++ b/include/linux/spinlock.h | |||
| @@ -375,10 +375,7 @@ static inline int spin_can_lock(spinlock_t *lock) | |||
| 375 | return raw_spin_can_lock(&lock->rlock); | 375 | return raw_spin_can_lock(&lock->rlock); |
| 376 | } | 376 | } |
| 377 | 377 | ||
| 378 | static inline void assert_spin_locked(spinlock_t *lock) | 378 | #define assert_spin_locked(lock) assert_raw_spin_locked(&(lock)->rlock) |
| 379 | { | ||
| 380 | assert_raw_spin_locked(&lock->rlock); | ||
| 381 | } | ||
| 382 | 379 | ||
| 383 | /* | 380 | /* |
| 384 | * Pull the atomic_t declaration: | 381 | * Pull the atomic_t declaration: |
diff --git a/include/linux/srcu.h b/include/linux/srcu.h index e1b005918bbb..d3d5fa54f25e 100644 --- a/include/linux/srcu.h +++ b/include/linux/srcu.h | |||
| @@ -99,15 +99,18 @@ long srcu_batches_completed(struct srcu_struct *sp); | |||
| 99 | * power mode. This way we can notice an extended quiescent state to | 99 | * power mode. This way we can notice an extended quiescent state to |
| 100 | * other CPUs that started a grace period. Otherwise we would delay any | 100 | * other CPUs that started a grace period. Otherwise we would delay any |
| 101 | * grace period as long as we run in the idle task. | 101 | * grace period as long as we run in the idle task. |
| 102 | * | ||
| 103 | * Similarly, we avoid claiming an SRCU read lock held if the current | ||
| 104 | * CPU is offline. | ||
| 102 | */ | 105 | */ |
| 103 | static inline int srcu_read_lock_held(struct srcu_struct *sp) | 106 | static inline int srcu_read_lock_held(struct srcu_struct *sp) |
| 104 | { | 107 | { |
| 105 | if (rcu_is_cpu_idle()) | ||
| 106 | return 0; | ||
| 107 | |||
| 108 | if (!debug_lockdep_rcu_enabled()) | 108 | if (!debug_lockdep_rcu_enabled()) |
| 109 | return 1; | 109 | return 1; |
| 110 | 110 | if (rcu_is_cpu_idle()) | |
| 111 | return 0; | ||
| 112 | if (!rcu_lockdep_current_cpu_online()) | ||
| 113 | return 0; | ||
| 111 | return lock_is_held(&sp->dep_map); | 114 | return lock_is_held(&sp->dep_map); |
| 112 | } | 115 | } |
| 113 | 116 | ||
| @@ -169,6 +172,8 @@ static inline int srcu_read_lock(struct srcu_struct *sp) __acquires(sp) | |||
| 169 | int retval = __srcu_read_lock(sp); | 172 | int retval = __srcu_read_lock(sp); |
| 170 | 173 | ||
| 171 | rcu_lock_acquire(&(sp)->dep_map); | 174 | rcu_lock_acquire(&(sp)->dep_map); |
| 175 | rcu_lockdep_assert(!rcu_is_cpu_idle(), | ||
| 176 | "srcu_read_lock() used illegally while idle"); | ||
| 172 | return retval; | 177 | return retval; |
| 173 | } | 178 | } |
| 174 | 179 | ||
| @@ -182,6 +187,8 @@ static inline int srcu_read_lock(struct srcu_struct *sp) __acquires(sp) | |||
| 182 | static inline void srcu_read_unlock(struct srcu_struct *sp, int idx) | 187 | static inline void srcu_read_unlock(struct srcu_struct *sp, int idx) |
| 183 | __releases(sp) | 188 | __releases(sp) |
| 184 | { | 189 | { |
| 190 | rcu_lockdep_assert(!rcu_is_cpu_idle(), | ||
| 191 | "srcu_read_unlock() used illegally while idle"); | ||
| 185 | rcu_lock_release(&(sp)->dep_map); | 192 | rcu_lock_release(&(sp)->dep_map); |
| 186 | __srcu_read_unlock(sp, idx); | 193 | __srcu_read_unlock(sp, idx); |
| 187 | } | 194 | } |
diff --git a/include/linux/ssb/ssb.h b/include/linux/ssb/ssb.h index dcf35b0f303a..d27683180025 100644 --- a/include/linux/ssb/ssb.h +++ b/include/linux/ssb/ssb.h | |||
| @@ -16,6 +16,12 @@ struct pcmcia_device; | |||
| 16 | struct ssb_bus; | 16 | struct ssb_bus; |
| 17 | struct ssb_driver; | 17 | struct ssb_driver; |
| 18 | 18 | ||
| 19 | struct ssb_sprom_core_pwr_info { | ||
| 20 | u8 itssi_2g, itssi_5g; | ||
| 21 | u8 maxpwr_2g, maxpwr_5gl, maxpwr_5g, maxpwr_5gh; | ||
| 22 | u16 pa_2g[4], pa_5gl[4], pa_5g[4], pa_5gh[4]; | ||
| 23 | }; | ||
| 24 | |||
| 19 | struct ssb_sprom { | 25 | struct ssb_sprom { |
| 20 | u8 revision; | 26 | u8 revision; |
| 21 | u8 il0mac[6]; /* MAC address for 802.11b/g */ | 27 | u8 il0mac[6]; /* MAC address for 802.11b/g */ |
| @@ -26,9 +32,12 @@ struct ssb_sprom { | |||
| 26 | u8 et0mdcport; /* MDIO for enet0 */ | 32 | u8 et0mdcport; /* MDIO for enet0 */ |
| 27 | u8 et1mdcport; /* MDIO for enet1 */ | 33 | u8 et1mdcport; /* MDIO for enet1 */ |
| 28 | u16 board_rev; /* Board revision number from SPROM. */ | 34 | u16 board_rev; /* Board revision number from SPROM. */ |
| 35 | u16 board_num; /* Board number from SPROM. */ | ||
| 36 | u16 board_type; /* Board type from SPROM. */ | ||
| 29 | u8 country_code; /* Country Code */ | 37 | u8 country_code; /* Country Code */ |
| 30 | u16 leddc_on_time; /* LED Powersave Duty Cycle On Count */ | 38 | char alpha2[2]; /* Country Code as two chars like EU or US */ |
| 31 | u16 leddc_off_time; /* LED Powersave Duty Cycle Off Count */ | 39 | u8 leddc_on_time; /* LED Powersave Duty Cycle On Count */ |
| 40 | u8 leddc_off_time; /* LED Powersave Duty Cycle Off Count */ | ||
| 32 | u8 ant_available_a; /* 2GHz antenna available bits (up to 4) */ | 41 | u8 ant_available_a; /* 2GHz antenna available bits (up to 4) */ |
| 33 | u8 ant_available_bg; /* 5GHz antenna available bits (up to 4) */ | 42 | u8 ant_available_bg; /* 5GHz antenna available bits (up to 4) */ |
| 34 | u16 pa0b0; | 43 | u16 pa0b0; |
| @@ -47,10 +56,10 @@ struct ssb_sprom { | |||
| 47 | u8 gpio1; /* GPIO pin 1 */ | 56 | u8 gpio1; /* GPIO pin 1 */ |
| 48 | u8 gpio2; /* GPIO pin 2 */ | 57 | u8 gpio2; /* GPIO pin 2 */ |
| 49 | u8 gpio3; /* GPIO pin 3 */ | 58 | u8 gpio3; /* GPIO pin 3 */ |
| 50 | u16 maxpwr_bg; /* 2.4GHz Amplifier Max Power (in dBm Q5.2) */ | 59 | u8 maxpwr_bg; /* 2.4GHz Amplifier Max Power (in dBm Q5.2) */ |
| 51 | u16 maxpwr_al; /* 5.2GHz Amplifier Max Power (in dBm Q5.2) */ | 60 | u8 maxpwr_al; /* 5.2GHz Amplifier Max Power (in dBm Q5.2) */ |
| 52 | u16 maxpwr_a; /* 5.3GHz Amplifier Max Power (in dBm Q5.2) */ | 61 | u8 maxpwr_a; /* 5.3GHz Amplifier Max Power (in dBm Q5.2) */ |
| 53 | u16 maxpwr_ah; /* 5.8GHz Amplifier Max Power (in dBm Q5.2) */ | 62 | u8 maxpwr_ah; /* 5.8GHz Amplifier Max Power (in dBm Q5.2) */ |
| 54 | u8 itssi_a; /* Idle TSSI Target for A-PHY */ | 63 | u8 itssi_a; /* Idle TSSI Target for A-PHY */ |
| 55 | u8 itssi_bg; /* Idle TSSI Target for B/G-PHY */ | 64 | u8 itssi_bg; /* Idle TSSI Target for B/G-PHY */ |
| 56 | u8 tri2g; /* 2.4GHz TX isolation */ | 65 | u8 tri2g; /* 2.4GHz TX isolation */ |
| @@ -61,8 +70,8 @@ struct ssb_sprom { | |||
| 61 | u8 txpid5gl[4]; /* 4.9 - 5.1GHz TX power index */ | 70 | u8 txpid5gl[4]; /* 4.9 - 5.1GHz TX power index */ |
| 62 | u8 txpid5g[4]; /* 5.1 - 5.5GHz TX power index */ | 71 | u8 txpid5g[4]; /* 5.1 - 5.5GHz TX power index */ |
| 63 | u8 txpid5gh[4]; /* 5.5 - ...GHz TX power index */ | 72 | u8 txpid5gh[4]; /* 5.5 - ...GHz TX power index */ |
| 64 | u8 rxpo2g; /* 2GHz RX power offset */ | 73 | s8 rxpo2g; /* 2GHz RX power offset */ |
| 65 | u8 rxpo5g; /* 5GHz RX power offset */ | 74 | s8 rxpo5g; /* 5GHz RX power offset */ |
| 66 | u8 rssisav2g; /* 2GHz RSSI params */ | 75 | u8 rssisav2g; /* 2GHz RSSI params */ |
| 67 | u8 rssismc2g; | 76 | u8 rssismc2g; |
| 68 | u8 rssismf2g; | 77 | u8 rssismf2g; |
| @@ -82,16 +91,13 @@ struct ssb_sprom { | |||
| 82 | u16 boardflags2_hi; /* Board flags (bits 48-63) */ | 91 | u16 boardflags2_hi; /* Board flags (bits 48-63) */ |
| 83 | /* TODO store board flags in a single u64 */ | 92 | /* TODO store board flags in a single u64 */ |
| 84 | 93 | ||
| 94 | struct ssb_sprom_core_pwr_info core_pwr_info[4]; | ||
| 95 | |||
| 85 | /* Antenna gain values for up to 4 antennas | 96 | /* Antenna gain values for up to 4 antennas |
| 86 | * on each band. Values in dBm/4 (Q5.2). Negative gain means the | 97 | * on each band. Values in dBm/4 (Q5.2). Negative gain means the |
| 87 | * loss in the connectors is bigger than the gain. */ | 98 | * loss in the connectors is bigger than the gain. */ |
| 88 | struct { | 99 | struct { |
| 89 | struct { | 100 | s8 a0, a1, a2, a3; |
| 90 | s8 a0, a1, a2, a3; | ||
| 91 | } ghz24; /* 2.4GHz band */ | ||
| 92 | struct { | ||
| 93 | s8 a0, a1, a2, a3; | ||
| 94 | } ghz5; /* 5GHz band */ | ||
| 95 | } antenna_gain; | 101 | } antenna_gain; |
| 96 | 102 | ||
| 97 | struct { | 103 | struct { |
| @@ -103,7 +109,79 @@ struct ssb_sprom { | |||
| 103 | } ghz5; | 109 | } ghz5; |
| 104 | } fem; | 110 | } fem; |
| 105 | 111 | ||
| 106 | /* TODO - add any parameters needed from rev 2, 3, 4, 5 or 8 SPROMs */ | 112 | u16 mcs2gpo[8]; |
| 113 | u16 mcs5gpo[8]; | ||
| 114 | u16 mcs5glpo[8]; | ||
| 115 | u16 mcs5ghpo[8]; | ||
| 116 | u8 opo; | ||
| 117 | |||
| 118 | u8 rxgainerr2ga[3]; | ||
| 119 | u8 rxgainerr5gla[3]; | ||
| 120 | u8 rxgainerr5gma[3]; | ||
| 121 | u8 rxgainerr5gha[3]; | ||
| 122 | u8 rxgainerr5gua[3]; | ||
| 123 | |||
| 124 | u8 noiselvl2ga[3]; | ||
| 125 | u8 noiselvl5gla[3]; | ||
| 126 | u8 noiselvl5gma[3]; | ||
| 127 | u8 noiselvl5gha[3]; | ||
| 128 | u8 noiselvl5gua[3]; | ||
| 129 | |||
| 130 | u8 regrev; | ||
| 131 | u8 txchain; | ||
| 132 | u8 rxchain; | ||
| 133 | u8 antswitch; | ||
| 134 | u16 cddpo; | ||
| 135 | u16 stbcpo; | ||
| 136 | u16 bw40po; | ||
| 137 | u16 bwduppo; | ||
| 138 | |||
| 139 | u8 tempthresh; | ||
| 140 | u8 tempoffset; | ||
| 141 | u16 rawtempsense; | ||
| 142 | u8 measpower; | ||
| 143 | u8 tempsense_slope; | ||
| 144 | u8 tempcorrx; | ||
| 145 | u8 tempsense_option; | ||
| 146 | u8 freqoffset_corr; | ||
| 147 | u8 iqcal_swp_dis; | ||
| 148 | u8 hw_iqcal_en; | ||
| 149 | u8 elna2g; | ||
| 150 | u8 elna5g; | ||
| 151 | u8 phycal_tempdelta; | ||
| 152 | u8 temps_period; | ||
| 153 | u8 temps_hysteresis; | ||
| 154 | u8 measpower1; | ||
| 155 | u8 measpower2; | ||
| 156 | u8 pcieingress_war; | ||
| 157 | |||
| 158 | /* power per rate from sromrev 9 */ | ||
| 159 | u16 cckbw202gpo; | ||
| 160 | u16 cckbw20ul2gpo; | ||
| 161 | u32 legofdmbw202gpo; | ||
| 162 | u32 legofdmbw20ul2gpo; | ||
| 163 | u32 legofdmbw205glpo; | ||
| 164 | u32 legofdmbw20ul5glpo; | ||
| 165 | u32 legofdmbw205gmpo; | ||
| 166 | u32 legofdmbw20ul5gmpo; | ||
| 167 | u32 legofdmbw205ghpo; | ||
| 168 | u32 legofdmbw20ul5ghpo; | ||
| 169 | u32 mcsbw202gpo; | ||
| 170 | u32 mcsbw20ul2gpo; | ||
| 171 | u32 mcsbw402gpo; | ||
| 172 | u32 mcsbw205glpo; | ||
| 173 | u32 mcsbw20ul5glpo; | ||
| 174 | u32 mcsbw405glpo; | ||
| 175 | u32 mcsbw205gmpo; | ||
| 176 | u32 mcsbw20ul5gmpo; | ||
| 177 | u32 mcsbw405gmpo; | ||
| 178 | u32 mcsbw205ghpo; | ||
| 179 | u32 mcsbw20ul5ghpo; | ||
| 180 | u32 mcsbw405ghpo; | ||
| 181 | u16 mcs32po; | ||
| 182 | u16 legofdm40duppo; | ||
| 183 | u8 sar2g; | ||
| 184 | u8 sar5g; | ||
| 107 | }; | 185 | }; |
| 108 | 186 | ||
| 109 | /* Information about the PCB the circuitry is soldered on. */ | 187 | /* Information about the PCB the circuitry is soldered on. */ |
diff --git a/include/linux/ssb/ssb_driver_gige.h b/include/linux/ssb/ssb_driver_gige.h index eba52a100533..6b05dcd927ff 100644 --- a/include/linux/ssb/ssb_driver_gige.h +++ b/include/linux/ssb/ssb_driver_gige.h | |||
| @@ -2,6 +2,7 @@ | |||
| 2 | #define LINUX_SSB_DRIVER_GIGE_H_ | 2 | #define LINUX_SSB_DRIVER_GIGE_H_ |
| 3 | 3 | ||
| 4 | #include <linux/ssb/ssb.h> | 4 | #include <linux/ssb/ssb.h> |
| 5 | #include <linux/bug.h> | ||
| 5 | #include <linux/pci.h> | 6 | #include <linux/pci.h> |
| 6 | #include <linux/spinlock.h> | 7 | #include <linux/spinlock.h> |
| 7 | 8 | ||
diff --git a/include/linux/ssb/ssb_regs.h b/include/linux/ssb/ssb_regs.h index c814ae6eeb22..40b1ef8595ee 100644 --- a/include/linux/ssb/ssb_regs.h +++ b/include/linux/ssb/ssb_regs.h | |||
| @@ -449,6 +449,39 @@ | |||
| 449 | #define SSB_SPROM8_TS_SLP_OPT_CORRX 0x00B6 | 449 | #define SSB_SPROM8_TS_SLP_OPT_CORRX 0x00B6 |
| 450 | #define SSB_SPROM8_FOC_HWIQ_IQSWP 0x00B8 | 450 | #define SSB_SPROM8_FOC_HWIQ_IQSWP 0x00B8 |
| 451 | #define SSB_SPROM8_PHYCAL_TEMPDELTA 0x00BA | 451 | #define SSB_SPROM8_PHYCAL_TEMPDELTA 0x00BA |
| 452 | |||
| 453 | /* There are 4 blocks with power info sharing the same layout */ | ||
| 454 | #define SSB_SROM8_PWR_INFO_CORE0 0x00C0 | ||
| 455 | #define SSB_SROM8_PWR_INFO_CORE1 0x00E0 | ||
| 456 | #define SSB_SROM8_PWR_INFO_CORE2 0x0100 | ||
| 457 | #define SSB_SROM8_PWR_INFO_CORE3 0x0120 | ||
| 458 | |||
| 459 | #define SSB_SROM8_2G_MAXP_ITSSI 0x00 | ||
| 460 | #define SSB_SPROM8_2G_MAXP 0x00FF | ||
| 461 | #define SSB_SPROM8_2G_ITSSI 0xFF00 | ||
| 462 | #define SSB_SPROM8_2G_ITSSI_SHIFT 8 | ||
| 463 | #define SSB_SROM8_2G_PA_0 0x02 /* 2GHz power amp settings */ | ||
| 464 | #define SSB_SROM8_2G_PA_1 0x04 | ||
| 465 | #define SSB_SROM8_2G_PA_2 0x06 | ||
| 466 | #define SSB_SROM8_5G_MAXP_ITSSI 0x08 /* 5GHz ITSSI and 5.3GHz Max Power */ | ||
| 467 | #define SSB_SPROM8_5G_MAXP 0x00FF | ||
| 468 | #define SSB_SPROM8_5G_ITSSI 0xFF00 | ||
| 469 | #define SSB_SPROM8_5G_ITSSI_SHIFT 8 | ||
| 470 | #define SSB_SPROM8_5GHL_MAXP 0x0A /* 5.2GHz and 5.8GHz Max Power */ | ||
| 471 | #define SSB_SPROM8_5GH_MAXP 0x00FF | ||
| 472 | #define SSB_SPROM8_5GL_MAXP 0xFF00 | ||
| 473 | #define SSB_SPROM8_5GL_MAXP_SHIFT 8 | ||
| 474 | #define SSB_SROM8_5G_PA_0 0x0C /* 5.3GHz power amp settings */ | ||
| 475 | #define SSB_SROM8_5G_PA_1 0x0E | ||
| 476 | #define SSB_SROM8_5G_PA_2 0x10 | ||
| 477 | #define SSB_SROM8_5GL_PA_0 0x12 /* 5.2GHz power amp settings */ | ||
| 478 | #define SSB_SROM8_5GL_PA_1 0x14 | ||
| 479 | #define SSB_SROM8_5GL_PA_2 0x16 | ||
| 480 | #define SSB_SROM8_5GH_PA_0 0x18 /* 5.8GHz power amp settings */ | ||
| 481 | #define SSB_SROM8_5GH_PA_1 0x1A | ||
| 482 | #define SSB_SROM8_5GH_PA_2 0x1C | ||
| 483 | |||
| 484 | /* TODO: Make it deprecated */ | ||
| 452 | #define SSB_SPROM8_MAXP_BG 0x00C0 /* Max Power 2GHz in path 1 */ | 485 | #define SSB_SPROM8_MAXP_BG 0x00C0 /* Max Power 2GHz in path 1 */ |
| 453 | #define SSB_SPROM8_MAXP_BG_MASK 0x00FF /* Mask for Max Power 2GHz */ | 486 | #define SSB_SPROM8_MAXP_BG_MASK 0x00FF /* Mask for Max Power 2GHz */ |
| 454 | #define SSB_SPROM8_ITSSI_BG 0xFF00 /* Mask for path 1 itssi_bg */ | 487 | #define SSB_SPROM8_ITSSI_BG 0xFF00 /* Mask for path 1 itssi_bg */ |
| @@ -473,6 +506,7 @@ | |||
| 473 | #define SSB_SPROM8_PA1HIB0 0x00D8 /* 5.8GHz power amp settings */ | 506 | #define SSB_SPROM8_PA1HIB0 0x00D8 /* 5.8GHz power amp settings */ |
| 474 | #define SSB_SPROM8_PA1HIB1 0x00DA | 507 | #define SSB_SPROM8_PA1HIB1 0x00DA |
| 475 | #define SSB_SPROM8_PA1HIB2 0x00DC | 508 | #define SSB_SPROM8_PA1HIB2 0x00DC |
| 509 | |||
| 476 | #define SSB_SPROM8_CCK2GPO 0x0140 /* CCK power offset */ | 510 | #define SSB_SPROM8_CCK2GPO 0x0140 /* CCK power offset */ |
| 477 | #define SSB_SPROM8_OFDM2GPO 0x0142 /* 2.4GHz OFDM power offset */ | 511 | #define SSB_SPROM8_OFDM2GPO 0x0142 /* 2.4GHz OFDM power offset */ |
| 478 | #define SSB_SPROM8_OFDM5GPO 0x0146 /* 5.3GHz OFDM power offset */ | 512 | #define SSB_SPROM8_OFDM5GPO 0x0146 /* 5.3GHz OFDM power offset */ |
diff --git a/include/linux/sunrpc/auth.h b/include/linux/sunrpc/auth.h index 7874a8a56638..492a36d72829 100644 --- a/include/linux/sunrpc/auth.h +++ b/include/linux/sunrpc/auth.h | |||
| @@ -99,6 +99,8 @@ struct rpc_authops { | |||
| 99 | 99 | ||
| 100 | struct rpc_cred * (*lookup_cred)(struct rpc_auth *, struct auth_cred *, int); | 100 | struct rpc_cred * (*lookup_cred)(struct rpc_auth *, struct auth_cred *, int); |
| 101 | struct rpc_cred * (*crcreate)(struct rpc_auth*, struct auth_cred *, int); | 101 | struct rpc_cred * (*crcreate)(struct rpc_auth*, struct auth_cred *, int); |
| 102 | int (*pipes_create)(struct rpc_auth *); | ||
| 103 | void (*pipes_destroy)(struct rpc_auth *); | ||
| 102 | }; | 104 | }; |
| 103 | 105 | ||
| 104 | struct rpc_credops { | 106 | struct rpc_credops { |
diff --git a/include/linux/sunrpc/bc_xprt.h b/include/linux/sunrpc/bc_xprt.h index f7f3ce340c08..969c0a671dbf 100644 --- a/include/linux/sunrpc/bc_xprt.h +++ b/include/linux/sunrpc/bc_xprt.h | |||
| @@ -35,7 +35,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |||
| 35 | struct rpc_rqst *xprt_alloc_bc_request(struct rpc_xprt *xprt); | 35 | struct rpc_rqst *xprt_alloc_bc_request(struct rpc_xprt *xprt); |
| 36 | void xprt_free_bc_request(struct rpc_rqst *req); | 36 | void xprt_free_bc_request(struct rpc_rqst *req); |
| 37 | int xprt_setup_backchannel(struct rpc_xprt *, unsigned int min_reqs); | 37 | int xprt_setup_backchannel(struct rpc_xprt *, unsigned int min_reqs); |
| 38 | void xprt_destroy_backchannel(struct rpc_xprt *, int max_reqs); | 38 | void xprt_destroy_backchannel(struct rpc_xprt *, unsigned int max_reqs); |
| 39 | int bc_send(struct rpc_rqst *req); | 39 | int bc_send(struct rpc_rqst *req); |
| 40 | 40 | ||
| 41 | /* | 41 | /* |
diff --git a/include/linux/sunrpc/cache.h b/include/linux/sunrpc/cache.h index 57531f8e5956..f5fd6160dbca 100644 --- a/include/linux/sunrpc/cache.h +++ b/include/linux/sunrpc/cache.h | |||
| @@ -117,6 +117,7 @@ struct cache_detail { | |||
| 117 | struct cache_detail_procfs procfs; | 117 | struct cache_detail_procfs procfs; |
| 118 | struct cache_detail_pipefs pipefs; | 118 | struct cache_detail_pipefs pipefs; |
| 119 | } u; | 119 | } u; |
| 120 | struct net *net; | ||
| 120 | }; | 121 | }; |
| 121 | 122 | ||
| 122 | 123 | ||
| @@ -197,11 +198,14 @@ extern void cache_flush(void); | |||
| 197 | extern void cache_purge(struct cache_detail *detail); | 198 | extern void cache_purge(struct cache_detail *detail); |
| 198 | #define NEVER (0x7FFFFFFF) | 199 | #define NEVER (0x7FFFFFFF) |
| 199 | extern void __init cache_initialize(void); | 200 | extern void __init cache_initialize(void); |
| 200 | extern int cache_register(struct cache_detail *cd); | ||
| 201 | extern int cache_register_net(struct cache_detail *cd, struct net *net); | 201 | extern int cache_register_net(struct cache_detail *cd, struct net *net); |
| 202 | extern void cache_unregister(struct cache_detail *cd); | ||
| 203 | extern void cache_unregister_net(struct cache_detail *cd, struct net *net); | 202 | extern void cache_unregister_net(struct cache_detail *cd, struct net *net); |
| 204 | 203 | ||
| 204 | extern struct cache_detail *cache_create_net(struct cache_detail *tmpl, struct net *net); | ||
| 205 | extern void cache_destroy_net(struct cache_detail *cd, struct net *net); | ||
| 206 | |||
| 207 | extern void sunrpc_init_cache_detail(struct cache_detail *cd); | ||
| 208 | extern void sunrpc_destroy_cache_detail(struct cache_detail *cd); | ||
| 205 | extern int sunrpc_cache_register_pipefs(struct dentry *parent, const char *, | 209 | extern int sunrpc_cache_register_pipefs(struct dentry *parent, const char *, |
| 206 | umode_t, struct cache_detail *); | 210 | umode_t, struct cache_detail *); |
| 207 | extern void sunrpc_cache_unregister_pipefs(struct cache_detail *); | 211 | extern void sunrpc_cache_unregister_pipefs(struct cache_detail *); |
diff --git a/include/linux/sunrpc/clnt.h b/include/linux/sunrpc/clnt.h index 2c5993a17c33..523547ecfee2 100644 --- a/include/linux/sunrpc/clnt.h +++ b/include/linux/sunrpc/clnt.h | |||
| @@ -35,14 +35,13 @@ struct rpc_clnt { | |||
| 35 | struct list_head cl_clients; /* Global list of clients */ | 35 | struct list_head cl_clients; /* Global list of clients */ |
| 36 | struct list_head cl_tasks; /* List of tasks */ | 36 | struct list_head cl_tasks; /* List of tasks */ |
| 37 | spinlock_t cl_lock; /* spinlock */ | 37 | spinlock_t cl_lock; /* spinlock */ |
| 38 | struct rpc_xprt * cl_xprt; /* transport */ | 38 | struct rpc_xprt __rcu * cl_xprt; /* transport */ |
| 39 | struct rpc_procinfo * cl_procinfo; /* procedure info */ | 39 | struct rpc_procinfo * cl_procinfo; /* procedure info */ |
| 40 | u32 cl_prog, /* RPC program number */ | 40 | u32 cl_prog, /* RPC program number */ |
| 41 | cl_vers, /* RPC version number */ | 41 | cl_vers, /* RPC version number */ |
| 42 | cl_maxproc; /* max procedure number */ | 42 | cl_maxproc; /* max procedure number */ |
| 43 | 43 | ||
| 44 | char * cl_server; /* server machine name */ | 44 | const char * cl_protname; /* protocol name */ |
| 45 | char * cl_protname; /* protocol name */ | ||
| 46 | struct rpc_auth * cl_auth; /* authenticator */ | 45 | struct rpc_auth * cl_auth; /* authenticator */ |
| 47 | struct rpc_stat * cl_stats; /* per-program statistics */ | 46 | struct rpc_stat * cl_stats; /* per-program statistics */ |
| 48 | struct rpc_iostats * cl_metrics; /* per-client statistics */ | 47 | struct rpc_iostats * cl_metrics; /* per-client statistics */ |
| @@ -57,12 +56,11 @@ struct rpc_clnt { | |||
| 57 | 56 | ||
| 58 | int cl_nodelen; /* nodename length */ | 57 | int cl_nodelen; /* nodename length */ |
| 59 | char cl_nodename[UNX_MAXNODENAME]; | 58 | char cl_nodename[UNX_MAXNODENAME]; |
| 60 | struct path cl_path; | 59 | struct dentry * cl_dentry; |
| 61 | struct rpc_clnt * cl_parent; /* Points to parent of clones */ | 60 | struct rpc_clnt * cl_parent; /* Points to parent of clones */ |
| 62 | struct rpc_rtt cl_rtt_default; | 61 | struct rpc_rtt cl_rtt_default; |
| 63 | struct rpc_timeout cl_timeout_default; | 62 | struct rpc_timeout cl_timeout_default; |
| 64 | struct rpc_program * cl_program; | 63 | const struct rpc_program *cl_program; |
| 65 | char cl_inline_name[32]; | ||
| 66 | char *cl_principal; /* target to authenticate to */ | 64 | char *cl_principal; /* target to authenticate to */ |
| 67 | }; | 65 | }; |
| 68 | 66 | ||
| @@ -71,12 +69,12 @@ struct rpc_clnt { | |||
| 71 | */ | 69 | */ |
| 72 | #define RPC_MAXVERSION 4 | 70 | #define RPC_MAXVERSION 4 |
| 73 | struct rpc_program { | 71 | struct rpc_program { |
| 74 | char * name; /* protocol name */ | 72 | const char * name; /* protocol name */ |
| 75 | u32 number; /* program number */ | 73 | u32 number; /* program number */ |
| 76 | unsigned int nrvers; /* number of versions */ | 74 | unsigned int nrvers; /* number of versions */ |
| 77 | struct rpc_version ** version; /* version array */ | 75 | const struct rpc_version ** version; /* version array */ |
| 78 | struct rpc_stat * stats; /* statistics */ | 76 | struct rpc_stat * stats; /* statistics */ |
| 79 | char * pipe_dir_name; /* path to rpc_pipefs dir */ | 77 | const char * pipe_dir_name; /* path to rpc_pipefs dir */ |
| 80 | }; | 78 | }; |
| 81 | 79 | ||
| 82 | struct rpc_version { | 80 | struct rpc_version { |
| @@ -97,7 +95,7 @@ struct rpc_procinfo { | |||
| 97 | unsigned int p_count; /* call count */ | 95 | unsigned int p_count; /* call count */ |
| 98 | unsigned int p_timer; /* Which RTT timer to use */ | 96 | unsigned int p_timer; /* Which RTT timer to use */ |
| 99 | u32 p_statidx; /* Which procedure to account */ | 97 | u32 p_statidx; /* Which procedure to account */ |
| 100 | char * p_name; /* name of procedure */ | 98 | const char * p_name; /* name of procedure */ |
| 101 | }; | 99 | }; |
| 102 | 100 | ||
| 103 | #ifdef __KERNEL__ | 101 | #ifdef __KERNEL__ |
| @@ -109,8 +107,8 @@ struct rpc_create_args { | |||
| 109 | size_t addrsize; | 107 | size_t addrsize; |
| 110 | struct sockaddr *saddress; | 108 | struct sockaddr *saddress; |
| 111 | const struct rpc_timeout *timeout; | 109 | const struct rpc_timeout *timeout; |
| 112 | char *servername; | 110 | const char *servername; |
| 113 | struct rpc_program *program; | 111 | const struct rpc_program *program; |
| 114 | u32 prognumber; /* overrides program->number */ | 112 | u32 prognumber; /* overrides program->number */ |
| 115 | u32 version; | 113 | u32 version; |
| 116 | rpc_authflavor_t authflavor; | 114 | rpc_authflavor_t authflavor; |
| @@ -129,17 +127,18 @@ struct rpc_create_args { | |||
| 129 | 127 | ||
| 130 | struct rpc_clnt *rpc_create(struct rpc_create_args *args); | 128 | struct rpc_clnt *rpc_create(struct rpc_create_args *args); |
| 131 | struct rpc_clnt *rpc_bind_new_program(struct rpc_clnt *, | 129 | struct rpc_clnt *rpc_bind_new_program(struct rpc_clnt *, |
| 132 | struct rpc_program *, u32); | 130 | const struct rpc_program *, u32); |
| 133 | void rpc_task_reset_client(struct rpc_task *task, struct rpc_clnt *clnt); | 131 | void rpc_task_reset_client(struct rpc_task *task, struct rpc_clnt *clnt); |
| 134 | struct rpc_clnt *rpc_clone_client(struct rpc_clnt *); | 132 | struct rpc_clnt *rpc_clone_client(struct rpc_clnt *); |
| 135 | void rpc_shutdown_client(struct rpc_clnt *); | 133 | void rpc_shutdown_client(struct rpc_clnt *); |
| 136 | void rpc_release_client(struct rpc_clnt *); | 134 | void rpc_release_client(struct rpc_clnt *); |
| 137 | void rpc_task_release_client(struct rpc_task *); | 135 | void rpc_task_release_client(struct rpc_task *); |
| 138 | 136 | ||
| 139 | int rpcb_create_local(void); | 137 | int rpcb_create_local(struct net *); |
| 140 | void rpcb_put_local(void); | 138 | void rpcb_put_local(struct net *); |
| 141 | int rpcb_register(u32, u32, int, unsigned short); | 139 | int rpcb_register(struct net *, u32, u32, int, unsigned short); |
| 142 | int rpcb_v4_register(const u32 program, const u32 version, | 140 | int rpcb_v4_register(struct net *net, const u32 program, |
| 141 | const u32 version, | ||
| 143 | const struct sockaddr *address, | 142 | const struct sockaddr *address, |
| 144 | const char *netid); | 143 | const char *netid); |
| 145 | void rpcb_getport_async(struct rpc_task *); | 144 | void rpcb_getport_async(struct rpc_task *); |
| @@ -156,16 +155,19 @@ struct rpc_task *rpc_call_null(struct rpc_clnt *clnt, struct rpc_cred *cred, | |||
| 156 | int rpc_restart_call_prepare(struct rpc_task *); | 155 | int rpc_restart_call_prepare(struct rpc_task *); |
| 157 | int rpc_restart_call(struct rpc_task *); | 156 | int rpc_restart_call(struct rpc_task *); |
| 158 | void rpc_setbufsize(struct rpc_clnt *, unsigned int, unsigned int); | 157 | void rpc_setbufsize(struct rpc_clnt *, unsigned int, unsigned int); |
| 158 | int rpc_protocol(struct rpc_clnt *); | ||
| 159 | struct net * rpc_net_ns(struct rpc_clnt *); | ||
| 159 | size_t rpc_max_payload(struct rpc_clnt *); | 160 | size_t rpc_max_payload(struct rpc_clnt *); |
| 160 | void rpc_force_rebind(struct rpc_clnt *); | 161 | void rpc_force_rebind(struct rpc_clnt *); |
| 161 | size_t rpc_peeraddr(struct rpc_clnt *, struct sockaddr *, size_t); | 162 | size_t rpc_peeraddr(struct rpc_clnt *, struct sockaddr *, size_t); |
| 162 | const char *rpc_peeraddr2str(struct rpc_clnt *, enum rpc_display_format_t); | 163 | const char *rpc_peeraddr2str(struct rpc_clnt *, enum rpc_display_format_t); |
| 164 | int rpc_localaddr(struct rpc_clnt *, struct sockaddr *, size_t); | ||
| 163 | 165 | ||
| 164 | size_t rpc_ntop(const struct sockaddr *, char *, const size_t); | 166 | size_t rpc_ntop(const struct sockaddr *, char *, const size_t); |
| 165 | size_t rpc_pton(const char *, const size_t, | 167 | size_t rpc_pton(struct net *, const char *, const size_t, |
| 166 | struct sockaddr *, const size_t); | 168 | struct sockaddr *, const size_t); |
| 167 | char * rpc_sockaddr2uaddr(const struct sockaddr *, gfp_t); | 169 | char * rpc_sockaddr2uaddr(const struct sockaddr *, gfp_t); |
| 168 | size_t rpc_uaddr2sockaddr(const char *, const size_t, | 170 | size_t rpc_uaddr2sockaddr(struct net *, const char *, const size_t, |
| 169 | struct sockaddr *, const size_t); | 171 | struct sockaddr *, const size_t); |
| 170 | 172 | ||
| 171 | static inline unsigned short rpc_get_port(const struct sockaddr *sap) | 173 | static inline unsigned short rpc_get_port(const struct sockaddr *sap) |
diff --git a/include/linux/sunrpc/debug.h b/include/linux/sunrpc/debug.h index c2786f20016f..a76cc20d98ce 100644 --- a/include/linux/sunrpc/debug.h +++ b/include/linux/sunrpc/debug.h | |||
| @@ -31,9 +31,12 @@ | |||
| 31 | /* | 31 | /* |
| 32 | * Enable RPC debugging/profiling. | 32 | * Enable RPC debugging/profiling. |
| 33 | */ | 33 | */ |
| 34 | #ifdef CONFIG_SYSCTL | 34 | #ifdef CONFIG_SUNRPC_DEBUG |
| 35 | #define RPC_DEBUG | 35 | #define RPC_DEBUG |
| 36 | #endif | 36 | #endif |
| 37 | #ifdef CONFIG_TRACEPOINTS | ||
| 38 | #define RPC_TRACEPOINTS | ||
| 39 | #endif | ||
| 37 | /* #define RPC_PROFILE */ | 40 | /* #define RPC_PROFILE */ |
| 38 | 41 | ||
| 39 | /* | 42 | /* |
| @@ -47,15 +50,32 @@ extern unsigned int nlm_debug; | |||
| 47 | #endif | 50 | #endif |
| 48 | 51 | ||
| 49 | #define dprintk(args...) dfprintk(FACILITY, ## args) | 52 | #define dprintk(args...) dfprintk(FACILITY, ## args) |
| 53 | #define dprintk_rcu(args...) dfprintk_rcu(FACILITY, ## args) | ||
| 50 | 54 | ||
| 51 | #undef ifdebug | 55 | #undef ifdebug |
| 52 | #ifdef RPC_DEBUG | 56 | #ifdef RPC_DEBUG |
| 53 | # define ifdebug(fac) if (unlikely(rpc_debug & RPCDBG_##fac)) | 57 | # define ifdebug(fac) if (unlikely(rpc_debug & RPCDBG_##fac)) |
| 54 | # define dfprintk(fac, args...) do { ifdebug(fac) printk(args); } while(0) | 58 | |
| 59 | # define dfprintk(fac, args...) \ | ||
| 60 | do { \ | ||
| 61 | ifdebug(fac) \ | ||
| 62 | printk(KERN_DEFAULT args); \ | ||
| 63 | } while (0) | ||
| 64 | |||
| 65 | # define dfprintk_rcu(fac, args...) \ | ||
| 66 | do { \ | ||
| 67 | ifdebug(fac) { \ | ||
| 68 | rcu_read_lock(); \ | ||
| 69 | printk(KERN_DEFAULT args); \ | ||
| 70 | rcu_read_unlock(); \ | ||
| 71 | } \ | ||
| 72 | } while (0) | ||
| 73 | |||
| 55 | # define RPC_IFDEBUG(x) x | 74 | # define RPC_IFDEBUG(x) x |
| 56 | #else | 75 | #else |
| 57 | # define ifdebug(fac) if (0) | 76 | # define ifdebug(fac) if (0) |
| 58 | # define dfprintk(fac, args...) do ; while (0) | 77 | # define dfprintk(fac, args...) do {} while (0) |
| 78 | # define dfprintk_rcu(fac, args...) do {} while (0) | ||
| 59 | # define RPC_IFDEBUG(x) | 79 | # define RPC_IFDEBUG(x) |
| 60 | #endif | 80 | #endif |
| 61 | 81 | ||
diff --git a/include/linux/sunrpc/metrics.h b/include/linux/sunrpc/metrics.h index b6edbc0ea83d..1565bbe86d51 100644 --- a/include/linux/sunrpc/metrics.h +++ b/include/linux/sunrpc/metrics.h | |||
| @@ -74,14 +74,16 @@ struct rpc_clnt; | |||
| 74 | #ifdef CONFIG_PROC_FS | 74 | #ifdef CONFIG_PROC_FS |
| 75 | 75 | ||
| 76 | struct rpc_iostats * rpc_alloc_iostats(struct rpc_clnt *); | 76 | struct rpc_iostats * rpc_alloc_iostats(struct rpc_clnt *); |
| 77 | void rpc_count_iostats(struct rpc_task *); | 77 | void rpc_count_iostats(const struct rpc_task *, |
| 78 | struct rpc_iostats *); | ||
| 78 | void rpc_print_iostats(struct seq_file *, struct rpc_clnt *); | 79 | void rpc_print_iostats(struct seq_file *, struct rpc_clnt *); |
| 79 | void rpc_free_iostats(struct rpc_iostats *); | 80 | void rpc_free_iostats(struct rpc_iostats *); |
| 80 | 81 | ||
| 81 | #else /* CONFIG_PROC_FS */ | 82 | #else /* CONFIG_PROC_FS */ |
| 82 | 83 | ||
| 83 | static inline struct rpc_iostats *rpc_alloc_iostats(struct rpc_clnt *clnt) { return NULL; } | 84 | static inline struct rpc_iostats *rpc_alloc_iostats(struct rpc_clnt *clnt) { return NULL; } |
| 84 | static inline void rpc_count_iostats(struct rpc_task *task) {} | 85 | static inline void rpc_count_iostats(const struct rpc_task *task, |
| 86 | struct rpc_iostats *stats) {} | ||
| 85 | static inline void rpc_print_iostats(struct seq_file *seq, struct rpc_clnt *clnt) {} | 87 | static inline void rpc_print_iostats(struct seq_file *seq, struct rpc_clnt *clnt) {} |
| 86 | static inline void rpc_free_iostats(struct rpc_iostats *stats) {} | 88 | static inline void rpc_free_iostats(struct rpc_iostats *stats) {} |
| 87 | 89 | ||
diff --git a/include/linux/sunrpc/rpc_pipe_fs.h b/include/linux/sunrpc/rpc_pipe_fs.h index 2bb03d77375a..a7b422b33eda 100644 --- a/include/linux/sunrpc/rpc_pipe_fs.h +++ b/include/linux/sunrpc/rpc_pipe_fs.h | |||
| @@ -21,21 +21,26 @@ struct rpc_pipe_ops { | |||
| 21 | void (*destroy_msg)(struct rpc_pipe_msg *); | 21 | void (*destroy_msg)(struct rpc_pipe_msg *); |
| 22 | }; | 22 | }; |
| 23 | 23 | ||
| 24 | struct rpc_inode { | 24 | struct rpc_pipe { |
| 25 | struct inode vfs_inode; | ||
| 26 | void *private; | ||
| 27 | struct list_head pipe; | 25 | struct list_head pipe; |
| 28 | struct list_head in_upcall; | 26 | struct list_head in_upcall; |
| 29 | struct list_head in_downcall; | 27 | struct list_head in_downcall; |
| 30 | int pipelen; | 28 | int pipelen; |
| 31 | int nreaders; | 29 | int nreaders; |
| 32 | int nwriters; | 30 | int nwriters; |
| 33 | int nkern_readwriters; | ||
| 34 | wait_queue_head_t waitq; | ||
| 35 | #define RPC_PIPE_WAIT_FOR_OPEN 1 | 31 | #define RPC_PIPE_WAIT_FOR_OPEN 1 |
| 36 | int flags; | 32 | int flags; |
| 37 | struct delayed_work queue_timeout; | 33 | struct delayed_work queue_timeout; |
| 38 | const struct rpc_pipe_ops *ops; | 34 | const struct rpc_pipe_ops *ops; |
| 35 | spinlock_t lock; | ||
| 36 | struct dentry *dentry; | ||
| 37 | }; | ||
| 38 | |||
| 39 | struct rpc_inode { | ||
| 40 | struct inode vfs_inode; | ||
| 41 | void *private; | ||
| 42 | struct rpc_pipe *pipe; | ||
| 43 | wait_queue_head_t waitq; | ||
| 39 | }; | 44 | }; |
| 40 | 45 | ||
| 41 | static inline struct rpc_inode * | 46 | static inline struct rpc_inode * |
| @@ -44,9 +49,28 @@ RPC_I(struct inode *inode) | |||
| 44 | return container_of(inode, struct rpc_inode, vfs_inode); | 49 | return container_of(inode, struct rpc_inode, vfs_inode); |
| 45 | } | 50 | } |
| 46 | 51 | ||
| 52 | enum { | ||
| 53 | SUNRPC_PIPEFS_NFS_PRIO, | ||
| 54 | SUNRPC_PIPEFS_RPC_PRIO, | ||
| 55 | }; | ||
| 56 | |||
| 57 | extern int rpc_pipefs_notifier_register(struct notifier_block *); | ||
| 58 | extern void rpc_pipefs_notifier_unregister(struct notifier_block *); | ||
| 59 | |||
| 60 | enum { | ||
| 61 | RPC_PIPEFS_MOUNT, | ||
| 62 | RPC_PIPEFS_UMOUNT, | ||
| 63 | }; | ||
| 64 | |||
| 65 | extern struct dentry *rpc_d_lookup_sb(const struct super_block *sb, | ||
| 66 | const unsigned char *dir_name); | ||
| 67 | extern void rpc_pipefs_init_net(struct net *net); | ||
| 68 | extern struct super_block *rpc_get_sb_net(const struct net *net); | ||
| 69 | extern void rpc_put_sb_net(const struct net *net); | ||
| 70 | |||
| 47 | extern ssize_t rpc_pipe_generic_upcall(struct file *, struct rpc_pipe_msg *, | 71 | extern ssize_t rpc_pipe_generic_upcall(struct file *, struct rpc_pipe_msg *, |
| 48 | char __user *, size_t); | 72 | char __user *, size_t); |
| 49 | extern int rpc_queue_upcall(struct inode *, struct rpc_pipe_msg *); | 73 | extern int rpc_queue_upcall(struct rpc_pipe *, struct rpc_pipe_msg *); |
| 50 | 74 | ||
| 51 | struct rpc_clnt; | 75 | struct rpc_clnt; |
| 52 | extern struct dentry *rpc_create_client_dir(struct dentry *, struct qstr *, struct rpc_clnt *); | 76 | extern struct dentry *rpc_create_client_dir(struct dentry *, struct qstr *, struct rpc_clnt *); |
| @@ -59,11 +83,13 @@ extern struct dentry *rpc_create_cache_dir(struct dentry *, | |||
| 59 | struct cache_detail *); | 83 | struct cache_detail *); |
| 60 | extern void rpc_remove_cache_dir(struct dentry *); | 84 | extern void rpc_remove_cache_dir(struct dentry *); |
| 61 | 85 | ||
| 62 | extern struct dentry *rpc_mkpipe(struct dentry *, const char *, void *, | 86 | extern int rpc_rmdir(struct dentry *dentry); |
| 63 | const struct rpc_pipe_ops *, int flags); | 87 | |
| 88 | struct rpc_pipe *rpc_mkpipe_data(const struct rpc_pipe_ops *ops, int flags); | ||
| 89 | void rpc_destroy_pipe_data(struct rpc_pipe *pipe); | ||
| 90 | extern struct dentry *rpc_mkpipe_dentry(struct dentry *, const char *, void *, | ||
| 91 | struct rpc_pipe *); | ||
| 64 | extern int rpc_unlink(struct dentry *); | 92 | extern int rpc_unlink(struct dentry *); |
| 65 | extern struct vfsmount *rpc_get_mount(void); | ||
| 66 | extern void rpc_put_mount(void); | ||
| 67 | extern int register_rpc_pipefs(void); | 93 | extern int register_rpc_pipefs(void); |
| 68 | extern void unregister_rpc_pipefs(void); | 94 | extern void unregister_rpc_pipefs(void); |
| 69 | 95 | ||
diff --git a/include/linux/sunrpc/sched.h b/include/linux/sunrpc/sched.h index e7756896f3ca..dc0c3cc3ada3 100644 --- a/include/linux/sunrpc/sched.h +++ b/include/linux/sunrpc/sched.h | |||
| @@ -103,6 +103,7 @@ typedef void (*rpc_action)(struct rpc_task *); | |||
| 103 | struct rpc_call_ops { | 103 | struct rpc_call_ops { |
| 104 | void (*rpc_call_prepare)(struct rpc_task *, void *); | 104 | void (*rpc_call_prepare)(struct rpc_task *, void *); |
| 105 | void (*rpc_call_done)(struct rpc_task *, void *); | 105 | void (*rpc_call_done)(struct rpc_task *, void *); |
| 106 | void (*rpc_count_stats)(struct rpc_task *, void *); | ||
| 106 | void (*rpc_release)(void *); | 107 | void (*rpc_release)(void *); |
| 107 | }; | 108 | }; |
| 108 | 109 | ||
| @@ -195,7 +196,7 @@ struct rpc_wait_queue { | |||
| 195 | unsigned char nr; /* # tasks remaining for cookie */ | 196 | unsigned char nr; /* # tasks remaining for cookie */ |
| 196 | unsigned short qlen; /* total # tasks waiting in queue */ | 197 | unsigned short qlen; /* total # tasks waiting in queue */ |
| 197 | struct rpc_timer timer_list; | 198 | struct rpc_timer timer_list; |
| 198 | #ifdef RPC_DEBUG | 199 | #if defined(RPC_DEBUG) || defined(RPC_TRACEPOINTS) |
| 199 | const char * name; | 200 | const char * name; |
| 200 | #endif | 201 | #endif |
| 201 | }; | 202 | }; |
| @@ -235,6 +236,9 @@ void rpc_wake_up_queued_task(struct rpc_wait_queue *, | |||
| 235 | struct rpc_task *); | 236 | struct rpc_task *); |
| 236 | void rpc_wake_up(struct rpc_wait_queue *); | 237 | void rpc_wake_up(struct rpc_wait_queue *); |
| 237 | struct rpc_task *rpc_wake_up_next(struct rpc_wait_queue *); | 238 | struct rpc_task *rpc_wake_up_next(struct rpc_wait_queue *); |
| 239 | struct rpc_task *rpc_wake_up_first(struct rpc_wait_queue *, | ||
| 240 | bool (*)(struct rpc_task *, void *), | ||
| 241 | void *); | ||
| 238 | void rpc_wake_up_status(struct rpc_wait_queue *, int); | 242 | void rpc_wake_up_status(struct rpc_wait_queue *, int); |
| 239 | int rpc_queue_empty(struct rpc_wait_queue *); | 243 | int rpc_queue_empty(struct rpc_wait_queue *); |
| 240 | void rpc_delay(struct rpc_task *, unsigned long); | 244 | void rpc_delay(struct rpc_task *, unsigned long); |
| @@ -244,7 +248,8 @@ int rpciod_up(void); | |||
| 244 | void rpciod_down(void); | 248 | void rpciod_down(void); |
| 245 | int __rpc_wait_for_completion_task(struct rpc_task *task, int (*)(void *)); | 249 | int __rpc_wait_for_completion_task(struct rpc_task *task, int (*)(void *)); |
| 246 | #ifdef RPC_DEBUG | 250 | #ifdef RPC_DEBUG |
| 247 | void rpc_show_tasks(void); | 251 | struct net; |
| 252 | void rpc_show_tasks(struct net *); | ||
| 248 | #endif | 253 | #endif |
| 249 | int rpc_init_mempool(void); | 254 | int rpc_init_mempool(void); |
| 250 | void rpc_destroy_mempool(void); | 255 | void rpc_destroy_mempool(void); |
| @@ -266,11 +271,22 @@ static inline int rpc_task_has_priority(struct rpc_task *task, unsigned char pri | |||
| 266 | return (task->tk_priority + RPC_PRIORITY_LOW == prio); | 271 | return (task->tk_priority + RPC_PRIORITY_LOW == prio); |
| 267 | } | 272 | } |
| 268 | 273 | ||
| 269 | #ifdef RPC_DEBUG | 274 | #if defined(RPC_DEBUG) || defined (RPC_TRACEPOINTS) |
| 270 | static inline const char * rpc_qname(struct rpc_wait_queue *q) | 275 | static inline const char * rpc_qname(const struct rpc_wait_queue *q) |
| 271 | { | 276 | { |
| 272 | return ((q && q->name) ? q->name : "unknown"); | 277 | return ((q && q->name) ? q->name : "unknown"); |
| 273 | } | 278 | } |
| 279 | |||
| 280 | static inline void rpc_assign_waitqueue_name(struct rpc_wait_queue *q, | ||
| 281 | const char *name) | ||
| 282 | { | ||
| 283 | q->name = name; | ||
| 284 | } | ||
| 285 | #else | ||
| 286 | static inline void rpc_assign_waitqueue_name(struct rpc_wait_queue *q, | ||
| 287 | const char *name) | ||
| 288 | { | ||
| 289 | } | ||
| 274 | #endif | 290 | #endif |
| 275 | 291 | ||
| 276 | #endif /* _LINUX_SUNRPC_SCHED_H_ */ | 292 | #endif /* _LINUX_SUNRPC_SCHED_H_ */ |
diff --git a/include/linux/sunrpc/stats.h b/include/linux/sunrpc/stats.h index 680471d1f28a..edc64219f92b 100644 --- a/include/linux/sunrpc/stats.h +++ b/include/linux/sunrpc/stats.h | |||
| @@ -12,7 +12,7 @@ | |||
| 12 | #include <linux/proc_fs.h> | 12 | #include <linux/proc_fs.h> |
| 13 | 13 | ||
| 14 | struct rpc_stat { | 14 | struct rpc_stat { |
| 15 | struct rpc_program * program; | 15 | const struct rpc_program *program; |
| 16 | 16 | ||
| 17 | unsigned int netcnt, | 17 | unsigned int netcnt, |
| 18 | netudpcnt, | 18 | netudpcnt, |
| @@ -58,24 +58,24 @@ void rpc_modcount(struct inode *, int); | |||
| 58 | #endif | 58 | #endif |
| 59 | 59 | ||
| 60 | #ifdef CONFIG_PROC_FS | 60 | #ifdef CONFIG_PROC_FS |
| 61 | struct proc_dir_entry * rpc_proc_register(struct rpc_stat *); | 61 | struct proc_dir_entry * rpc_proc_register(struct net *,struct rpc_stat *); |
| 62 | void rpc_proc_unregister(const char *); | 62 | void rpc_proc_unregister(struct net *,const char *); |
| 63 | void rpc_proc_zero(struct rpc_program *); | 63 | void rpc_proc_zero(const struct rpc_program *); |
| 64 | struct proc_dir_entry * svc_proc_register(struct svc_stat *, | 64 | struct proc_dir_entry * svc_proc_register(struct net *, struct svc_stat *, |
| 65 | const struct file_operations *); | 65 | const struct file_operations *); |
| 66 | void svc_proc_unregister(const char *); | 66 | void svc_proc_unregister(struct net *, const char *); |
| 67 | 67 | ||
| 68 | void svc_seq_show(struct seq_file *, | 68 | void svc_seq_show(struct seq_file *, |
| 69 | const struct svc_stat *); | 69 | const struct svc_stat *); |
| 70 | #else | 70 | #else |
| 71 | 71 | ||
| 72 | static inline struct proc_dir_entry *rpc_proc_register(struct rpc_stat *s) { return NULL; } | 72 | static inline struct proc_dir_entry *rpc_proc_register(struct net *net, struct rpc_stat *s) { return NULL; } |
| 73 | static inline void rpc_proc_unregister(const char *p) {} | 73 | static inline void rpc_proc_unregister(struct net *net, const char *p) {} |
| 74 | static inline void rpc_proc_zero(struct rpc_program *p) {} | 74 | static inline void rpc_proc_zero(const struct rpc_program *p) {} |
| 75 | 75 | ||
| 76 | static inline struct proc_dir_entry *svc_proc_register(struct svc_stat *s, | 76 | static inline struct proc_dir_entry *svc_proc_register(struct net *net, struct svc_stat *s, |
| 77 | const struct file_operations *f) { return NULL; } | 77 | const struct file_operations *f) { return NULL; } |
| 78 | static inline void svc_proc_unregister(const char *p) {} | 78 | static inline void svc_proc_unregister(struct net *net, const char *p) {} |
| 79 | 79 | ||
| 80 | static inline void svc_seq_show(struct seq_file *seq, | 80 | static inline void svc_seq_show(struct seq_file *seq, |
| 81 | const struct svc_stat *st) {} | 81 | const struct svc_stat *st) {} |
diff --git a/include/linux/sunrpc/svc.h b/include/linux/sunrpc/svc.h index 35b37b1e9299..51b29ac45a8e 100644 --- a/include/linux/sunrpc/svc.h +++ b/include/linux/sunrpc/svc.h | |||
| @@ -84,7 +84,8 @@ struct svc_serv { | |||
| 84 | unsigned int sv_nrpools; /* number of thread pools */ | 84 | unsigned int sv_nrpools; /* number of thread pools */ |
| 85 | struct svc_pool * sv_pools; /* array of thread pools */ | 85 | struct svc_pool * sv_pools; /* array of thread pools */ |
| 86 | 86 | ||
| 87 | void (*sv_shutdown)(struct svc_serv *serv); | 87 | void (*sv_shutdown)(struct svc_serv *serv, |
| 88 | struct net *net); | ||
| 88 | /* Callback to use when last thread | 89 | /* Callback to use when last thread |
| 89 | * exits. | 90 | * exits. |
| 90 | */ | 91 | */ |
| @@ -413,22 +414,24 @@ struct svc_procedure { | |||
| 413 | /* | 414 | /* |
| 414 | * Function prototypes. | 415 | * Function prototypes. |
| 415 | */ | 416 | */ |
| 416 | void svc_rpcb_cleanup(struct svc_serv *serv); | 417 | int svc_rpcb_setup(struct svc_serv *serv, struct net *net); |
| 418 | void svc_rpcb_cleanup(struct svc_serv *serv, struct net *net); | ||
| 417 | struct svc_serv *svc_create(struct svc_program *, unsigned int, | 419 | struct svc_serv *svc_create(struct svc_program *, unsigned int, |
| 418 | void (*shutdown)(struct svc_serv *)); | 420 | void (*shutdown)(struct svc_serv *, struct net *net)); |
| 419 | struct svc_rqst *svc_prepare_thread(struct svc_serv *serv, | 421 | struct svc_rqst *svc_prepare_thread(struct svc_serv *serv, |
| 420 | struct svc_pool *pool, int node); | 422 | struct svc_pool *pool, int node); |
| 421 | void svc_exit_thread(struct svc_rqst *); | 423 | void svc_exit_thread(struct svc_rqst *); |
| 422 | struct svc_serv * svc_create_pooled(struct svc_program *, unsigned int, | 424 | struct svc_serv * svc_create_pooled(struct svc_program *, unsigned int, |
| 423 | void (*shutdown)(struct svc_serv *), | 425 | void (*shutdown)(struct svc_serv *, struct net *net), |
| 424 | svc_thread_fn, struct module *); | 426 | svc_thread_fn, struct module *); |
| 425 | int svc_set_num_threads(struct svc_serv *, struct svc_pool *, int); | 427 | int svc_set_num_threads(struct svc_serv *, struct svc_pool *, int); |
| 426 | int svc_pool_stats_open(struct svc_serv *serv, struct file *file); | 428 | int svc_pool_stats_open(struct svc_serv *serv, struct file *file); |
| 427 | void svc_destroy(struct svc_serv *); | 429 | void svc_destroy(struct svc_serv *); |
| 430 | void svc_shutdown_net(struct svc_serv *, struct net *); | ||
| 428 | int svc_process(struct svc_rqst *); | 431 | int svc_process(struct svc_rqst *); |
| 429 | int bc_svc_process(struct svc_serv *, struct rpc_rqst *, | 432 | int bc_svc_process(struct svc_serv *, struct rpc_rqst *, |
| 430 | struct svc_rqst *); | 433 | struct svc_rqst *); |
| 431 | int svc_register(const struct svc_serv *, const int, | 434 | int svc_register(const struct svc_serv *, struct net *, const int, |
| 432 | const unsigned short, const unsigned short); | 435 | const unsigned short, const unsigned short); |
| 433 | 436 | ||
| 434 | void svc_wake_up(struct svc_serv *); | 437 | void svc_wake_up(struct svc_serv *); |
diff --git a/include/linux/sunrpc/svc_xprt.h b/include/linux/sunrpc/svc_xprt.h index dfa900948af7..b3f64b12f141 100644 --- a/include/linux/sunrpc/svc_xprt.h +++ b/include/linux/sunrpc/svc_xprt.h | |||
| @@ -121,7 +121,8 @@ void svc_close_xprt(struct svc_xprt *xprt); | |||
| 121 | int svc_port_is_privileged(struct sockaddr *sin); | 121 | int svc_port_is_privileged(struct sockaddr *sin); |
| 122 | int svc_print_xprts(char *buf, int maxlen); | 122 | int svc_print_xprts(char *buf, int maxlen); |
| 123 | struct svc_xprt *svc_find_xprt(struct svc_serv *serv, const char *xcl_name, | 123 | struct svc_xprt *svc_find_xprt(struct svc_serv *serv, const char *xcl_name, |
| 124 | const sa_family_t af, const unsigned short port); | 124 | struct net *net, const sa_family_t af, |
| 125 | const unsigned short port); | ||
| 125 | int svc_xprt_names(struct svc_serv *serv, char *buf, const int buflen); | 126 | int svc_xprt_names(struct svc_serv *serv, char *buf, const int buflen); |
| 126 | 127 | ||
| 127 | static inline void svc_xprt_get(struct svc_xprt *xprt) | 128 | static inline void svc_xprt_get(struct svc_xprt *xprt) |
diff --git a/include/linux/sunrpc/svcauth.h b/include/linux/sunrpc/svcauth.h index 25d333c1b571..548790e9113b 100644 --- a/include/linux/sunrpc/svcauth.h +++ b/include/linux/sunrpc/svcauth.h | |||
| @@ -135,6 +135,9 @@ extern void svcauth_unix_purge(void); | |||
| 135 | extern void svcauth_unix_info_release(struct svc_xprt *xpt); | 135 | extern void svcauth_unix_info_release(struct svc_xprt *xpt); |
| 136 | extern int svcauth_unix_set_client(struct svc_rqst *rqstp); | 136 | extern int svcauth_unix_set_client(struct svc_rqst *rqstp); |
| 137 | 137 | ||
| 138 | extern int unix_gid_cache_create(struct net *net); | ||
| 139 | extern void unix_gid_cache_destroy(struct net *net); | ||
| 140 | |||
| 138 | static inline unsigned long hash_str(char *name, int bits) | 141 | static inline unsigned long hash_str(char *name, int bits) |
| 139 | { | 142 | { |
| 140 | unsigned long hash = 0; | 143 | unsigned long hash = 0; |
diff --git a/include/linux/sunrpc/svcauth_gss.h b/include/linux/sunrpc/svcauth_gss.h index 83bbee3f089c..7c32daa025eb 100644 --- a/include/linux/sunrpc/svcauth_gss.h +++ b/include/linux/sunrpc/svcauth_gss.h | |||
| @@ -18,6 +18,8 @@ | |||
| 18 | 18 | ||
| 19 | int gss_svc_init(void); | 19 | int gss_svc_init(void); |
| 20 | void gss_svc_shutdown(void); | 20 | void gss_svc_shutdown(void); |
| 21 | int gss_svc_init_net(struct net *net); | ||
| 22 | void gss_svc_shutdown_net(struct net *net); | ||
| 21 | int svcauth_gss_register_pseudoflavor(u32 pseudoflavor, char * name); | 23 | int svcauth_gss_register_pseudoflavor(u32 pseudoflavor, char * name); |
| 22 | u32 svcauth_gss_flavor(struct auth_domain *dom); | 24 | u32 svcauth_gss_flavor(struct auth_domain *dom); |
| 23 | char *svc_gss_principal(struct svc_rqst *); | 25 | char *svc_gss_principal(struct svc_rqst *); |
diff --git a/include/linux/sunrpc/svcsock.h b/include/linux/sunrpc/svcsock.h index c84e9741cb2a..cb4ac69e1f33 100644 --- a/include/linux/sunrpc/svcsock.h +++ b/include/linux/sunrpc/svcsock.h | |||
| @@ -34,7 +34,7 @@ struct svc_sock { | |||
| 34 | /* | 34 | /* |
| 35 | * Function prototypes. | 35 | * Function prototypes. |
| 36 | */ | 36 | */ |
| 37 | void svc_close_all(struct svc_serv *); | 37 | void svc_close_net(struct svc_serv *, struct net *); |
| 38 | int svc_recv(struct svc_rqst *, long); | 38 | int svc_recv(struct svc_rqst *, long); |
| 39 | int svc_send(struct svc_rqst *); | 39 | int svc_send(struct svc_rqst *); |
| 40 | void svc_drop(struct svc_rqst *); | 40 | void svc_drop(struct svc_rqst *); |
diff --git a/include/linux/sunrpc/xprt.h b/include/linux/sunrpc/xprt.h index 15518a152ac3..77d278defa70 100644 --- a/include/linux/sunrpc/xprt.h +++ b/include/linux/sunrpc/xprt.h | |||
| @@ -21,8 +21,8 @@ | |||
| 21 | 21 | ||
| 22 | #define RPC_MIN_SLOT_TABLE (2U) | 22 | #define RPC_MIN_SLOT_TABLE (2U) |
| 23 | #define RPC_DEF_SLOT_TABLE (16U) | 23 | #define RPC_DEF_SLOT_TABLE (16U) |
| 24 | #define RPC_MAX_SLOT_TABLE (128U) | ||
| 25 | #define RPC_MAX_SLOT_TABLE_LIMIT (65536U) | 24 | #define RPC_MAX_SLOT_TABLE_LIMIT (65536U) |
| 25 | #define RPC_MAX_SLOT_TABLE RPC_MAX_SLOT_TABLE_LIMIT | ||
| 26 | 26 | ||
| 27 | /* | 27 | /* |
| 28 | * This describes a timeout strategy | 28 | * This describes a timeout strategy |
| @@ -219,13 +219,17 @@ struct rpc_xprt { | |||
| 219 | connect_time, /* jiffies waiting for connect */ | 219 | connect_time, /* jiffies waiting for connect */ |
| 220 | sends, /* how many complete requests */ | 220 | sends, /* how many complete requests */ |
| 221 | recvs, /* how many complete requests */ | 221 | recvs, /* how many complete requests */ |
| 222 | bad_xids; /* lookup_rqst didn't find XID */ | 222 | bad_xids, /* lookup_rqst didn't find XID */ |
| 223 | max_slots; /* max rpc_slots used */ | ||
| 223 | 224 | ||
| 224 | unsigned long long req_u, /* average requests on the wire */ | 225 | unsigned long long req_u, /* average requests on the wire */ |
| 225 | bklog_u; /* backlog queue utilization */ | 226 | bklog_u, /* backlog queue utilization */ |
| 227 | sending_u, /* send q utilization */ | ||
| 228 | pending_u; /* pend q utilization */ | ||
| 226 | } stat; | 229 | } stat; |
| 227 | 230 | ||
| 228 | struct net *xprt_net; | 231 | struct net *xprt_net; |
| 232 | const char *servername; | ||
| 229 | const char *address_strings[RPC_DISPLAY_MAX]; | 233 | const char *address_strings[RPC_DISPLAY_MAX]; |
| 230 | }; | 234 | }; |
| 231 | 235 | ||
| @@ -255,6 +259,7 @@ struct xprt_create { | |||
| 255 | struct sockaddr * srcaddr; /* optional local address */ | 259 | struct sockaddr * srcaddr; /* optional local address */ |
| 256 | struct sockaddr * dstaddr; /* remote peer address */ | 260 | struct sockaddr * dstaddr; /* remote peer address */ |
| 257 | size_t addrlen; | 261 | size_t addrlen; |
| 262 | const char *servername; | ||
| 258 | struct svc_xprt *bc_xprt; /* NFSv4.1 backchannel */ | 263 | struct svc_xprt *bc_xprt; /* NFSv4.1 backchannel */ |
| 259 | }; | 264 | }; |
| 260 | 265 | ||
diff --git a/include/linux/sunrpc/xprtsock.h b/include/linux/sunrpc/xprtsock.h index 3f14a02e9cc0..1ad36cc25b2e 100644 --- a/include/linux/sunrpc/xprtsock.h +++ b/include/linux/sunrpc/xprtsock.h | |||
| @@ -12,18 +12,6 @@ | |||
| 12 | int init_socket_xprt(void); | 12 | int init_socket_xprt(void); |
| 13 | void cleanup_socket_xprt(void); | 13 | void cleanup_socket_xprt(void); |
| 14 | 14 | ||
| 15 | /* | ||
| 16 | * RPC slot table sizes for UDP, TCP transports | ||
| 17 | */ | ||
| 18 | extern unsigned int xprt_udp_slot_table_entries; | ||
| 19 | extern unsigned int xprt_tcp_slot_table_entries; | ||
| 20 | |||
| 21 | /* | ||
| 22 | * Parameters for choosing a free port | ||
| 23 | */ | ||
| 24 | extern unsigned int xprt_min_resvport; | ||
| 25 | extern unsigned int xprt_max_resvport; | ||
| 26 | |||
| 27 | #define RPC_MIN_RESVPORT (1U) | 15 | #define RPC_MIN_RESVPORT (1U) |
| 28 | #define RPC_MAX_RESVPORT (65535U) | 16 | #define RPC_MAX_RESVPORT (65535U) |
| 29 | #define RPC_DEF_MIN_RESVPORT (665U) | 17 | #define RPC_DEF_MIN_RESVPORT (665U) |
diff --git a/include/linux/sunserialcore.h b/include/linux/sunserialcore.h new file mode 100644 index 000000000000..68e7430bb0fe --- /dev/null +++ b/include/linux/sunserialcore.h | |||
| @@ -0,0 +1,33 @@ | |||
| 1 | /* sunserialcore.h | ||
| 2 | * | ||
| 3 | * Generic SUN serial/kbd/ms layer. Based entirely | ||
| 4 | * upon drivers/sbus/char/sunserial.h which is: | ||
| 5 | * | ||
| 6 | * Copyright (C) 1997 Eddie C. Dost (ecd@skynet.be) | ||
| 7 | * | ||
| 8 | * Port to new UART layer is: | ||
| 9 | * | ||
| 10 | * Copyright (C) 2002 David S. Miller (davem@redhat.com) | ||
| 11 | */ | ||
| 12 | |||
| 13 | #ifndef _SERIAL_SUN_H | ||
| 14 | #define _SERIAL_SUN_H | ||
| 15 | |||
| 16 | /* Serial keyboard defines for L1-A processing... */ | ||
| 17 | #define SUNKBD_RESET 0xff | ||
| 18 | #define SUNKBD_L1 0x01 | ||
| 19 | #define SUNKBD_UP 0x80 | ||
| 20 | #define SUNKBD_A 0x4d | ||
| 21 | |||
| 22 | extern unsigned int suncore_mouse_baud_cflag_next(unsigned int, int *); | ||
| 23 | extern int suncore_mouse_baud_detection(unsigned char, int); | ||
| 24 | |||
| 25 | extern int sunserial_register_minors(struct uart_driver *, int); | ||
| 26 | extern void sunserial_unregister_minors(struct uart_driver *, int); | ||
| 27 | |||
| 28 | extern int sunserial_console_match(struct console *, struct device_node *, | ||
| 29 | struct uart_driver *, int, bool); | ||
| 30 | extern void sunserial_console_termios(struct console *, | ||
| 31 | struct device_node *); | ||
| 32 | |||
| 33 | #endif /* !(_SERIAL_SUN_H) */ | ||
diff --git a/include/linux/suspend.h b/include/linux/suspend.h index 91784a4f8608..ac1c114c499d 100644 --- a/include/linux/suspend.h +++ b/include/linux/suspend.h | |||
| @@ -42,8 +42,10 @@ enum suspend_stat_step { | |||
| 42 | SUSPEND_FREEZE = 1, | 42 | SUSPEND_FREEZE = 1, |
| 43 | SUSPEND_PREPARE, | 43 | SUSPEND_PREPARE, |
| 44 | SUSPEND_SUSPEND, | 44 | SUSPEND_SUSPEND, |
| 45 | SUSPEND_SUSPEND_LATE, | ||
| 45 | SUSPEND_SUSPEND_NOIRQ, | 46 | SUSPEND_SUSPEND_NOIRQ, |
| 46 | SUSPEND_RESUME_NOIRQ, | 47 | SUSPEND_RESUME_NOIRQ, |
| 48 | SUSPEND_RESUME_EARLY, | ||
| 47 | SUSPEND_RESUME | 49 | SUSPEND_RESUME |
| 48 | }; | 50 | }; |
| 49 | 51 | ||
| @@ -53,8 +55,10 @@ struct suspend_stats { | |||
| 53 | int failed_freeze; | 55 | int failed_freeze; |
| 54 | int failed_prepare; | 56 | int failed_prepare; |
| 55 | int failed_suspend; | 57 | int failed_suspend; |
| 58 | int failed_suspend_late; | ||
| 56 | int failed_suspend_noirq; | 59 | int failed_suspend_noirq; |
| 57 | int failed_resume; | 60 | int failed_resume; |
| 61 | int failed_resume_early; | ||
| 58 | int failed_resume_noirq; | 62 | int failed_resume_noirq; |
| 59 | #define REC_FAILED_NUM 2 | 63 | #define REC_FAILED_NUM 2 |
| 60 | int last_failed_dev; | 64 | int last_failed_dev; |
diff --git a/include/linux/swap.h b/include/linux/swap.h index 3e60228e7299..b86b5c20617d 100644 --- a/include/linux/swap.h +++ b/include/linux/swap.h | |||
| @@ -223,6 +223,7 @@ extern void lru_add_page_tail(struct zone* zone, | |||
| 223 | extern void activate_page(struct page *); | 223 | extern void activate_page(struct page *); |
| 224 | extern void mark_page_accessed(struct page *); | 224 | extern void mark_page_accessed(struct page *); |
| 225 | extern void lru_add_drain(void); | 225 | extern void lru_add_drain(void); |
| 226 | extern void lru_add_drain_cpu(int cpu); | ||
| 226 | extern int lru_add_drain_all(void); | 227 | extern int lru_add_drain_all(void); |
| 227 | extern void rotate_reclaimable_page(struct page *page); | 228 | extern void rotate_reclaimable_page(struct page *page); |
| 228 | extern void deactivate_page(struct page *page); | 229 | extern void deactivate_page(struct page *page); |
| @@ -329,7 +330,6 @@ extern long total_swap_pages; | |||
| 329 | extern void si_swapinfo(struct sysinfo *); | 330 | extern void si_swapinfo(struct sysinfo *); |
| 330 | extern swp_entry_t get_swap_page(void); | 331 | extern swp_entry_t get_swap_page(void); |
| 331 | extern swp_entry_t get_swap_page_of_type(int); | 332 | extern swp_entry_t get_swap_page_of_type(int); |
| 332 | extern int valid_swaphandles(swp_entry_t, unsigned long *); | ||
| 333 | extern int add_swap_count_continuation(swp_entry_t, gfp_t); | 333 | extern int add_swap_count_continuation(swp_entry_t, gfp_t); |
| 334 | extern void swap_shmem_alloc(swp_entry_t); | 334 | extern void swap_shmem_alloc(swp_entry_t); |
| 335 | extern int swap_duplicate(swp_entry_t); | 335 | extern int swap_duplicate(swp_entry_t); |
diff --git a/include/linux/swapops.h b/include/linux/swapops.h index 2189d3ffc85d..792d16d9cbc7 100644 --- a/include/linux/swapops.h +++ b/include/linux/swapops.h | |||
| @@ -2,6 +2,7 @@ | |||
| 2 | #define _LINUX_SWAPOPS_H | 2 | #define _LINUX_SWAPOPS_H |
| 3 | 3 | ||
| 4 | #include <linux/radix-tree.h> | 4 | #include <linux/radix-tree.h> |
| 5 | #include <linux/bug.h> | ||
| 5 | 6 | ||
| 6 | /* | 7 | /* |
| 7 | * swapcache pages are stored in the swapper_space radix tree. We want to | 8 | * swapcache pages are stored in the swapper_space radix tree. We want to |
diff --git a/include/linux/sys_soc.h b/include/linux/sys_soc.h new file mode 100644 index 000000000000..2739ccb69571 --- /dev/null +++ b/include/linux/sys_soc.h | |||
| @@ -0,0 +1,37 @@ | |||
| 1 | /* | ||
| 2 | * Copyright (C) ST-Ericsson SA 2011 | ||
| 3 | * Author: Lee Jones <lee.jones@linaro.org> for ST-Ericsson. | ||
| 4 | * License terms: GNU General Public License (GPL), version 2 | ||
| 5 | */ | ||
| 6 | #ifndef __SOC_BUS_H | ||
| 7 | #define __SOC_BUS_H | ||
| 8 | |||
| 9 | #include <linux/device.h> | ||
| 10 | |||
| 11 | struct soc_device_attribute { | ||
| 12 | const char *machine; | ||
| 13 | const char *family; | ||
| 14 | const char *revision; | ||
| 15 | const char *soc_id; | ||
| 16 | }; | ||
| 17 | |||
| 18 | /** | ||
| 19 | * soc_device_register - register SoC as a device | ||
| 20 | * @soc_plat_dev_attr: Attributes passed from platform to be attributed to a SoC | ||
| 21 | */ | ||
| 22 | struct soc_device *soc_device_register( | ||
| 23 | struct soc_device_attribute *soc_plat_dev_attr); | ||
| 24 | |||
| 25 | /** | ||
| 26 | * soc_device_unregister - unregister SoC device | ||
| 27 | * @dev: SoC device to be unregistered | ||
| 28 | */ | ||
| 29 | void soc_device_unregister(struct soc_device *soc_dev); | ||
| 30 | |||
| 31 | /** | ||
| 32 | * soc_device_to_device - helper function to fetch struct device | ||
| 33 | * @soc: Previously registered SoC device container | ||
| 34 | */ | ||
| 35 | struct device *soc_device_to_device(struct soc_device *soc); | ||
| 36 | |||
| 37 | #endif /* __SOC_BUS_H */ | ||
diff --git a/include/linux/syscalls.h b/include/linux/syscalls.h index 8ec1153ff57b..3de3acb84a95 100644 --- a/include/linux/syscalls.h +++ b/include/linux/syscalls.h | |||
| @@ -68,6 +68,7 @@ struct file_handle; | |||
| 68 | #include <linux/aio_abi.h> | 68 | #include <linux/aio_abi.h> |
| 69 | #include <linux/capability.h> | 69 | #include <linux/capability.h> |
| 70 | #include <linux/list.h> | 70 | #include <linux/list.h> |
| 71 | #include <linux/bug.h> | ||
| 71 | #include <linux/sem.h> | 72 | #include <linux/sem.h> |
| 72 | #include <asm/siginfo.h> | 73 | #include <asm/siginfo.h> |
| 73 | #include <asm/signal.h> | 74 | #include <asm/signal.h> |
diff --git a/include/linux/sysctl.h b/include/linux/sysctl.h index bb9127dd814b..c34b4c82b0dc 100644 --- a/include/linux/sysctl.h +++ b/include/linux/sysctl.h | |||
| @@ -932,34 +932,14 @@ enum | |||
| 932 | #include <linux/list.h> | 932 | #include <linux/list.h> |
| 933 | #include <linux/rcupdate.h> | 933 | #include <linux/rcupdate.h> |
| 934 | #include <linux/wait.h> | 934 | #include <linux/wait.h> |
| 935 | #include <linux/rbtree.h> | ||
| 935 | 936 | ||
| 936 | /* For the /proc/sys support */ | 937 | /* For the /proc/sys support */ |
| 937 | struct ctl_table; | 938 | struct ctl_table; |
| 938 | struct nsproxy; | 939 | struct nsproxy; |
| 939 | struct ctl_table_root; | 940 | struct ctl_table_root; |
| 940 | |||
| 941 | struct ctl_table_set { | ||
| 942 | struct list_head list; | ||
| 943 | struct ctl_table_set *parent; | ||
| 944 | int (*is_seen)(struct ctl_table_set *); | ||
| 945 | }; | ||
| 946 | |||
| 947 | extern void setup_sysctl_set(struct ctl_table_set *p, | ||
| 948 | struct ctl_table_set *parent, | ||
| 949 | int (*is_seen)(struct ctl_table_set *)); | ||
| 950 | |||
| 951 | struct ctl_table_header; | 941 | struct ctl_table_header; |
| 952 | 942 | struct ctl_dir; | |
| 953 | extern void sysctl_head_get(struct ctl_table_header *); | ||
| 954 | extern void sysctl_head_put(struct ctl_table_header *); | ||
| 955 | extern int sysctl_is_seen(struct ctl_table_header *); | ||
| 956 | extern struct ctl_table_header *sysctl_head_grab(struct ctl_table_header *); | ||
| 957 | extern struct ctl_table_header *sysctl_head_next(struct ctl_table_header *prev); | ||
| 958 | extern struct ctl_table_header *__sysctl_head_next(struct nsproxy *namespaces, | ||
| 959 | struct ctl_table_header *prev); | ||
| 960 | extern void sysctl_head_finish(struct ctl_table_header *prev); | ||
| 961 | extern int sysctl_perm(struct ctl_table_root *root, | ||
| 962 | struct ctl_table *table, int op); | ||
| 963 | 943 | ||
| 964 | typedef struct ctl_table ctl_table; | 944 | typedef struct ctl_table ctl_table; |
| 965 | 945 | ||
| @@ -1023,8 +1003,6 @@ static inline void *proc_sys_poll_event(struct ctl_table_poll *poll) | |||
| 1023 | return (void *)(unsigned long)atomic_read(&poll->event); | 1003 | return (void *)(unsigned long)atomic_read(&poll->event); |
| 1024 | } | 1004 | } |
| 1025 | 1005 | ||
| 1026 | void proc_sys_poll_notify(struct ctl_table_poll *poll); | ||
| 1027 | |||
| 1028 | #define __CTL_TABLE_POLL_INITIALIZER(name) { \ | 1006 | #define __CTL_TABLE_POLL_INITIALIZER(name) { \ |
| 1029 | .event = ATOMIC_INIT(0), \ | 1007 | .event = ATOMIC_INIT(0), \ |
| 1030 | .wait = __WAIT_QUEUE_HEAD_INITIALIZER(name.wait) } | 1008 | .wait = __WAIT_QUEUE_HEAD_INITIALIZER(name.wait) } |
| @@ -1039,21 +1017,16 @@ struct ctl_table | |||
| 1039 | void *data; | 1017 | void *data; |
| 1040 | int maxlen; | 1018 | int maxlen; |
| 1041 | umode_t mode; | 1019 | umode_t mode; |
| 1042 | struct ctl_table *child; | 1020 | struct ctl_table *child; /* Deprecated */ |
| 1043 | struct ctl_table *parent; /* Automatically set */ | ||
| 1044 | proc_handler *proc_handler; /* Callback for text formatting */ | 1021 | proc_handler *proc_handler; /* Callback for text formatting */ |
| 1045 | struct ctl_table_poll *poll; | 1022 | struct ctl_table_poll *poll; |
| 1046 | void *extra1; | 1023 | void *extra1; |
| 1047 | void *extra2; | 1024 | void *extra2; |
| 1048 | }; | 1025 | }; |
| 1049 | 1026 | ||
| 1050 | struct ctl_table_root { | 1027 | struct ctl_node { |
| 1051 | struct list_head root_list; | 1028 | struct rb_node node; |
| 1052 | struct ctl_table_set default_set; | 1029 | struct ctl_table_header *header; |
| 1053 | struct ctl_table_set *(*lookup)(struct ctl_table_root *root, | ||
| 1054 | struct nsproxy *namespaces); | ||
| 1055 | int (*permissions)(struct ctl_table_root *root, | ||
| 1056 | struct nsproxy *namespaces, struct ctl_table *table); | ||
| 1057 | }; | 1030 | }; |
| 1058 | 1031 | ||
| 1059 | /* struct ctl_table_header is used to maintain dynamic lists of | 1032 | /* struct ctl_table_header is used to maintain dynamic lists of |
| @@ -1063,9 +1036,9 @@ struct ctl_table_header | |||
| 1063 | union { | 1036 | union { |
| 1064 | struct { | 1037 | struct { |
| 1065 | struct ctl_table *ctl_table; | 1038 | struct ctl_table *ctl_table; |
| 1066 | struct list_head ctl_entry; | ||
| 1067 | int used; | 1039 | int used; |
| 1068 | int count; | 1040 | int count; |
| 1041 | int nreg; | ||
| 1069 | }; | 1042 | }; |
| 1070 | struct rcu_head rcu; | 1043 | struct rcu_head rcu; |
| 1071 | }; | 1044 | }; |
| @@ -1073,9 +1046,27 @@ struct ctl_table_header | |||
| 1073 | struct ctl_table *ctl_table_arg; | 1046 | struct ctl_table *ctl_table_arg; |
| 1074 | struct ctl_table_root *root; | 1047 | struct ctl_table_root *root; |
| 1075 | struct ctl_table_set *set; | 1048 | struct ctl_table_set *set; |
| 1076 | struct ctl_table *attached_by; | 1049 | struct ctl_dir *parent; |
| 1077 | struct ctl_table *attached_to; | 1050 | struct ctl_node *node; |
| 1078 | struct ctl_table_header *parent; | 1051 | }; |
| 1052 | |||
| 1053 | struct ctl_dir { | ||
| 1054 | /* Header must be at the start of ctl_dir */ | ||
| 1055 | struct ctl_table_header header; | ||
| 1056 | struct rb_root root; | ||
| 1057 | }; | ||
| 1058 | |||
| 1059 | struct ctl_table_set { | ||
| 1060 | int (*is_seen)(struct ctl_table_set *); | ||
| 1061 | struct ctl_dir dir; | ||
| 1062 | }; | ||
| 1063 | |||
| 1064 | struct ctl_table_root { | ||
| 1065 | struct ctl_table_set default_set; | ||
| 1066 | struct ctl_table_set *(*lookup)(struct ctl_table_root *root, | ||
| 1067 | struct nsproxy *namespaces); | ||
| 1068 | int (*permissions)(struct ctl_table_root *root, | ||
| 1069 | struct nsproxy *namespaces, struct ctl_table *table); | ||
| 1079 | }; | 1070 | }; |
| 1080 | 1071 | ||
| 1081 | /* struct ctl_path describes where in the hierarchy a table is added */ | 1072 | /* struct ctl_path describes where in the hierarchy a table is added */ |
| @@ -1083,16 +1074,53 @@ struct ctl_path { | |||
| 1083 | const char *procname; | 1074 | const char *procname; |
| 1084 | }; | 1075 | }; |
| 1085 | 1076 | ||
| 1077 | #ifdef CONFIG_SYSCTL | ||
| 1078 | |||
| 1079 | void proc_sys_poll_notify(struct ctl_table_poll *poll); | ||
| 1080 | |||
| 1081 | extern void setup_sysctl_set(struct ctl_table_set *p, | ||
| 1082 | struct ctl_table_root *root, | ||
| 1083 | int (*is_seen)(struct ctl_table_set *)); | ||
| 1084 | extern void retire_sysctl_set(struct ctl_table_set *set); | ||
| 1085 | |||
| 1086 | void register_sysctl_root(struct ctl_table_root *root); | 1086 | void register_sysctl_root(struct ctl_table_root *root); |
| 1087 | struct ctl_table_header *__register_sysctl_table( | ||
| 1088 | struct ctl_table_set *set, | ||
| 1089 | const char *path, struct ctl_table *table); | ||
| 1087 | struct ctl_table_header *__register_sysctl_paths( | 1090 | struct ctl_table_header *__register_sysctl_paths( |
| 1088 | struct ctl_table_root *root, struct nsproxy *namespaces, | 1091 | struct ctl_table_set *set, |
| 1089 | const struct ctl_path *path, struct ctl_table *table); | 1092 | const struct ctl_path *path, struct ctl_table *table); |
| 1093 | struct ctl_table_header *register_sysctl(const char *path, struct ctl_table *table); | ||
| 1090 | struct ctl_table_header *register_sysctl_table(struct ctl_table * table); | 1094 | struct ctl_table_header *register_sysctl_table(struct ctl_table * table); |
| 1091 | struct ctl_table_header *register_sysctl_paths(const struct ctl_path *path, | 1095 | struct ctl_table_header *register_sysctl_paths(const struct ctl_path *path, |
| 1092 | struct ctl_table *table); | 1096 | struct ctl_table *table); |
| 1093 | 1097 | ||
| 1094 | void unregister_sysctl_table(struct ctl_table_header * table); | 1098 | void unregister_sysctl_table(struct ctl_table_header * table); |
| 1095 | int sysctl_check_table(struct nsproxy *namespaces, struct ctl_table *table); | 1099 | |
| 1100 | extern int sysctl_init(void); | ||
| 1101 | #else /* CONFIG_SYSCTL */ | ||
| 1102 | static inline struct ctl_table_header *register_sysctl_table(struct ctl_table * table) | ||
| 1103 | { | ||
| 1104 | return NULL; | ||
| 1105 | } | ||
| 1106 | |||
| 1107 | static inline struct ctl_table_header *register_sysctl_paths( | ||
| 1108 | const struct ctl_path *path, struct ctl_table *table) | ||
| 1109 | { | ||
| 1110 | return NULL; | ||
| 1111 | } | ||
| 1112 | |||
| 1113 | static inline void unregister_sysctl_table(struct ctl_table_header * table) | ||
| 1114 | { | ||
| 1115 | } | ||
| 1116 | |||
| 1117 | static inline void setup_sysctl_set(struct ctl_table_set *p, | ||
| 1118 | struct ctl_table_root *root, | ||
| 1119 | int (*is_seen)(struct ctl_table_set *)) | ||
| 1120 | { | ||
| 1121 | } | ||
| 1122 | |||
| 1123 | #endif /* CONFIG_SYSCTL */ | ||
| 1096 | 1124 | ||
| 1097 | #endif /* __KERNEL__ */ | 1125 | #endif /* __KERNEL__ */ |
| 1098 | 1126 | ||
diff --git a/include/linux/tcp.h b/include/linux/tcp.h index 3c7ffdb40dc6..b6c62d294380 100644 --- a/include/linux/tcp.h +++ b/include/linux/tcp.h | |||
| @@ -464,7 +464,7 @@ struct tcp_sock { | |||
| 464 | const struct tcp_sock_af_ops *af_specific; | 464 | const struct tcp_sock_af_ops *af_specific; |
| 465 | 465 | ||
| 466 | /* TCP MD5 Signature Option information */ | 466 | /* TCP MD5 Signature Option information */ |
| 467 | struct tcp_md5sig_info *md5sig_info; | 467 | struct tcp_md5sig_info __rcu *md5sig_info; |
| 468 | #endif | 468 | #endif |
| 469 | 469 | ||
| 470 | /* When the cookie options are generated and exchanged, then this | 470 | /* When the cookie options are generated and exchanged, then this |
| @@ -487,8 +487,7 @@ struct tcp_timewait_sock { | |||
| 487 | u32 tw_ts_recent; | 487 | u32 tw_ts_recent; |
| 488 | long tw_ts_recent_stamp; | 488 | long tw_ts_recent_stamp; |
| 489 | #ifdef CONFIG_TCP_MD5SIG | 489 | #ifdef CONFIG_TCP_MD5SIG |
| 490 | u16 tw_md5_keylen; | 490 | struct tcp_md5sig_key *tw_md5_key; |
| 491 | u8 tw_md5_key[TCP_MD5SIG_MAXKEYLEN]; | ||
| 492 | #endif | 491 | #endif |
| 493 | /* Few sockets in timewait have cookies; in that case, then this | 492 | /* Few sockets in timewait have cookies; in that case, then this |
| 494 | * object holds a reference to them (tw_cookie_values->kref). | 493 | * object holds a reference to them (tw_cookie_values->kref). |
diff --git a/include/linux/timex.h b/include/linux/timex.h index aa60fe7b6ed6..b75e1864ed19 100644 --- a/include/linux/timex.h +++ b/include/linux/timex.h | |||
| @@ -234,23 +234,9 @@ struct timex { | |||
| 234 | extern unsigned long tick_usec; /* USER_HZ period (usec) */ | 234 | extern unsigned long tick_usec; /* USER_HZ period (usec) */ |
| 235 | extern unsigned long tick_nsec; /* ACTHZ period (nsec) */ | 235 | extern unsigned long tick_nsec; /* ACTHZ period (nsec) */ |
| 236 | 236 | ||
| 237 | /* | ||
| 238 | * phase-lock loop variables | ||
| 239 | */ | ||
| 240 | extern int time_status; /* clock synchronization status bits */ | ||
| 241 | |||
| 242 | extern void ntp_init(void); | 237 | extern void ntp_init(void); |
| 243 | extern void ntp_clear(void); | 238 | extern void ntp_clear(void); |
| 244 | 239 | ||
| 245 | /** | ||
| 246 | * ntp_synced - Returns 1 if the NTP status is not UNSYNC | ||
| 247 | * | ||
| 248 | */ | ||
| 249 | static inline int ntp_synced(void) | ||
| 250 | { | ||
| 251 | return !(time_status & STA_UNSYNC); | ||
| 252 | } | ||
| 253 | |||
| 254 | /* Required to safely shift negative values */ | 240 | /* Required to safely shift negative values */ |
| 255 | #define shift_right(x, s) ({ \ | 241 | #define shift_right(x, s) ({ \ |
| 256 | __typeof__(x) __x = (x); \ | 242 | __typeof__(x) __x = (x); \ |
| @@ -264,10 +250,9 @@ static inline int ntp_synced(void) | |||
| 264 | #define NTP_INTERVAL_LENGTH (NSEC_PER_SEC/NTP_INTERVAL_FREQ) | 250 | #define NTP_INTERVAL_LENGTH (NSEC_PER_SEC/NTP_INTERVAL_FREQ) |
| 265 | 251 | ||
| 266 | /* Returns how long ticks are at present, in ns / 2^NTP_SCALE_SHIFT. */ | 252 | /* Returns how long ticks are at present, in ns / 2^NTP_SCALE_SHIFT. */ |
| 267 | extern u64 tick_length; | 253 | extern u64 ntp_tick_length(void); |
| 268 | 254 | ||
| 269 | extern void second_overflow(void); | 255 | extern void second_overflow(void); |
| 270 | extern void update_ntp_one_tick(void); | ||
| 271 | extern int do_adjtimex(struct timex *); | 256 | extern int do_adjtimex(struct timex *); |
| 272 | extern void hardpps(const struct timespec *, const struct timespec *); | 257 | extern void hardpps(const struct timespec *, const struct timespec *); |
| 273 | 258 | ||
diff --git a/include/linux/trace_seq.h b/include/linux/trace_seq.h index 7dadc3df0c77..a32d86ec8bf2 100644 --- a/include/linux/trace_seq.h +++ b/include/linux/trace_seq.h | |||
| @@ -44,7 +44,7 @@ extern int trace_seq_putmem(struct trace_seq *s, const void *mem, size_t len); | |||
| 44 | extern int trace_seq_putmem_hex(struct trace_seq *s, const void *mem, | 44 | extern int trace_seq_putmem_hex(struct trace_seq *s, const void *mem, |
| 45 | size_t len); | 45 | size_t len); |
| 46 | extern void *trace_seq_reserve(struct trace_seq *s, size_t len); | 46 | extern void *trace_seq_reserve(struct trace_seq *s, size_t len); |
| 47 | extern int trace_seq_path(struct trace_seq *s, struct path *path); | 47 | extern int trace_seq_path(struct trace_seq *s, const struct path *path); |
| 48 | 48 | ||
| 49 | #else /* CONFIG_TRACING */ | 49 | #else /* CONFIG_TRACING */ |
| 50 | static inline int trace_seq_printf(struct trace_seq *s, const char *fmt, ...) | 50 | static inline int trace_seq_printf(struct trace_seq *s, const char *fmt, ...) |
| @@ -88,7 +88,7 @@ static inline void *trace_seq_reserve(struct trace_seq *s, size_t len) | |||
| 88 | { | 88 | { |
| 89 | return NULL; | 89 | return NULL; |
| 90 | } | 90 | } |
| 91 | static inline int trace_seq_path(struct trace_seq *s, struct path *path) | 91 | static inline int trace_seq_path(struct trace_seq *s, const struct path *path) |
| 92 | { | 92 | { |
| 93 | return 0; | 93 | return 0; |
| 94 | } | 94 | } |
diff --git a/include/linux/tracehook.h b/include/linux/tracehook.h index a71a2927a6a0..51bd91d911c3 100644 --- a/include/linux/tracehook.h +++ b/include/linux/tracehook.h | |||
| @@ -54,12 +54,12 @@ struct linux_binprm; | |||
| 54 | /* | 54 | /* |
| 55 | * ptrace report for syscall entry and exit looks identical. | 55 | * ptrace report for syscall entry and exit looks identical. |
| 56 | */ | 56 | */ |
| 57 | static inline void ptrace_report_syscall(struct pt_regs *regs) | 57 | static inline int ptrace_report_syscall(struct pt_regs *regs) |
| 58 | { | 58 | { |
| 59 | int ptrace = current->ptrace; | 59 | int ptrace = current->ptrace; |
| 60 | 60 | ||
| 61 | if (!(ptrace & PT_PTRACED)) | 61 | if (!(ptrace & PT_PTRACED)) |
| 62 | return; | 62 | return 0; |
| 63 | 63 | ||
| 64 | ptrace_notify(SIGTRAP | ((ptrace & PT_TRACESYSGOOD) ? 0x80 : 0)); | 64 | ptrace_notify(SIGTRAP | ((ptrace & PT_TRACESYSGOOD) ? 0x80 : 0)); |
| 65 | 65 | ||
| @@ -72,6 +72,8 @@ static inline void ptrace_report_syscall(struct pt_regs *regs) | |||
| 72 | send_sig(current->exit_code, current, 1); | 72 | send_sig(current->exit_code, current, 1); |
| 73 | current->exit_code = 0; | 73 | current->exit_code = 0; |
| 74 | } | 74 | } |
| 75 | |||
| 76 | return fatal_signal_pending(current); | ||
| 75 | } | 77 | } |
| 76 | 78 | ||
| 77 | /** | 79 | /** |
| @@ -96,8 +98,7 @@ static inline void ptrace_report_syscall(struct pt_regs *regs) | |||
| 96 | static inline __must_check int tracehook_report_syscall_entry( | 98 | static inline __must_check int tracehook_report_syscall_entry( |
| 97 | struct pt_regs *regs) | 99 | struct pt_regs *regs) |
| 98 | { | 100 | { |
| 99 | ptrace_report_syscall(regs); | 101 | return ptrace_report_syscall(regs); |
| 100 | return 0; | ||
| 101 | } | 102 | } |
| 102 | 103 | ||
| 103 | /** | 104 | /** |
diff --git a/include/linux/transport_class.h b/include/linux/transport_class.h index 9ae8da3e6407..11087cdd4ad3 100644 --- a/include/linux/transport_class.h +++ b/include/linux/transport_class.h | |||
| @@ -10,6 +10,7 @@ | |||
| 10 | #define _TRANSPORT_CLASS_H_ | 10 | #define _TRANSPORT_CLASS_H_ |
| 11 | 11 | ||
| 12 | #include <linux/device.h> | 12 | #include <linux/device.h> |
| 13 | #include <linux/bug.h> | ||
| 13 | #include <linux/attribute_container.h> | 14 | #include <linux/attribute_container.h> |
| 14 | 15 | ||
| 15 | struct transport_container; | 16 | struct transport_container; |
diff --git a/include/linux/tty.h b/include/linux/tty.h index 5dbb3cb05a82..a91ff403b3bf 100644 --- a/include/linux/tty.h +++ b/include/linux/tty.h | |||
| @@ -52,6 +52,7 @@ | |||
| 52 | * hardcoded at present.) | 52 | * hardcoded at present.) |
| 53 | */ | 53 | */ |
| 54 | #define NR_UNIX98_PTY_DEFAULT 4096 /* Default maximum for Unix98 ptys */ | 54 | #define NR_UNIX98_PTY_DEFAULT 4096 /* Default maximum for Unix98 ptys */ |
| 55 | #define NR_UNIX98_PTY_RESERVE 1024 /* Default reserve for main devpts */ | ||
| 55 | #define NR_UNIX98_PTY_MAX (1 << MINORBITS) /* Absolute limit */ | 56 | #define NR_UNIX98_PTY_MAX (1 << MINORBITS) /* Absolute limit */ |
| 56 | 57 | ||
| 57 | /* | 58 | /* |
| @@ -480,10 +481,11 @@ extern void free_tty_struct(struct tty_struct *tty); | |||
| 480 | extern void initialize_tty_struct(struct tty_struct *tty, | 481 | extern void initialize_tty_struct(struct tty_struct *tty, |
| 481 | struct tty_driver *driver, int idx); | 482 | struct tty_driver *driver, int idx); |
| 482 | extern void deinitialize_tty_struct(struct tty_struct *tty); | 483 | extern void deinitialize_tty_struct(struct tty_struct *tty); |
| 483 | extern struct tty_struct *tty_init_dev(struct tty_driver *driver, int idx, | 484 | extern struct tty_struct *tty_init_dev(struct tty_driver *driver, int idx); |
| 484 | int first_ok); | ||
| 485 | extern int tty_release(struct inode *inode, struct file *filp); | 485 | extern int tty_release(struct inode *inode, struct file *filp); |
| 486 | extern int tty_init_termios(struct tty_struct *tty); | 486 | extern int tty_init_termios(struct tty_struct *tty); |
| 487 | extern int tty_standard_install(struct tty_driver *driver, | ||
| 488 | struct tty_struct *tty); | ||
| 487 | 489 | ||
| 488 | extern struct tty_struct *tty_pair_get_tty(struct tty_struct *tty); | 490 | extern struct tty_struct *tty_pair_get_tty(struct tty_struct *tty); |
| 489 | extern struct tty_struct *tty_pair_get_pty(struct tty_struct *tty); | 491 | extern struct tty_struct *tty_pair_get_pty(struct tty_struct *tty); |
diff --git a/include/linux/tty_driver.h b/include/linux/tty_driver.h index 5cf685086dd3..6e6dbb7447b6 100644 --- a/include/linux/tty_driver.h +++ b/include/linux/tty_driver.h | |||
| @@ -50,6 +50,8 @@ | |||
| 50 | * Note that tty_shutdown() is not called if ops->shutdown is defined. | 50 | * Note that tty_shutdown() is not called if ops->shutdown is defined. |
| 51 | * This means one is responsible to take care of calling ops->remove (e.g. | 51 | * This means one is responsible to take care of calling ops->remove (e.g. |
| 52 | * via tty_driver_remove_tty) and releasing tty->termios. | 52 | * via tty_driver_remove_tty) and releasing tty->termios. |
| 53 | * Note that this hook may be called from *all* the contexts where one | ||
| 54 | * uses tty refcounting (e.g. tty_port_tty_get). | ||
| 53 | * | 55 | * |
| 54 | * | 56 | * |
| 55 | * void (*cleanup)(struct tty_struct * tty); | 57 | * void (*cleanup)(struct tty_struct * tty); |
| @@ -234,6 +236,7 @@ | |||
| 234 | * if provided (otherwise EINVAL will be returned). | 236 | * if provided (otherwise EINVAL will be returned). |
| 235 | */ | 237 | */ |
| 236 | 238 | ||
| 239 | #include <linux/export.h> | ||
| 237 | #include <linux/fs.h> | 240 | #include <linux/fs.h> |
| 238 | #include <linux/list.h> | 241 | #include <linux/list.h> |
| 239 | #include <linux/cdev.h> | 242 | #include <linux/cdev.h> |
| @@ -298,7 +301,6 @@ struct tty_driver { | |||
| 298 | int name_base; /* offset of printed name */ | 301 | int name_base; /* offset of printed name */ |
| 299 | int major; /* major device number */ | 302 | int major; /* major device number */ |
| 300 | int minor_start; /* start of minor device number */ | 303 | int minor_start; /* start of minor device number */ |
| 301 | int minor_num; /* number of *possible* devices */ | ||
| 302 | int num; /* number of devices allocated */ | 304 | int num; /* number of devices allocated */ |
| 303 | short type; /* type of tty driver */ | 305 | short type; /* type of tty driver */ |
| 304 | short subtype; /* subtype of tty driver */ | 306 | short subtype; /* subtype of tty driver */ |
| @@ -324,7 +326,7 @@ struct tty_driver { | |||
| 324 | 326 | ||
| 325 | extern struct list_head tty_drivers; | 327 | extern struct list_head tty_drivers; |
| 326 | 328 | ||
| 327 | extern struct tty_driver *alloc_tty_driver(int lines); | 329 | extern struct tty_driver *__alloc_tty_driver(int lines, struct module *owner); |
| 328 | extern void put_tty_driver(struct tty_driver *driver); | 330 | extern void put_tty_driver(struct tty_driver *driver); |
| 329 | extern void tty_set_operations(struct tty_driver *driver, | 331 | extern void tty_set_operations(struct tty_driver *driver, |
| 330 | const struct tty_operations *op); | 332 | const struct tty_operations *op); |
| @@ -332,6 +334,8 @@ extern struct tty_driver *tty_find_polling_driver(char *name, int *line); | |||
| 332 | 334 | ||
| 333 | extern void tty_driver_kref_put(struct tty_driver *driver); | 335 | extern void tty_driver_kref_put(struct tty_driver *driver); |
| 334 | 336 | ||
| 337 | #define alloc_tty_driver(lines) __alloc_tty_driver(lines, THIS_MODULE) | ||
| 338 | |||
| 335 | static inline struct tty_driver *tty_driver_kref_get(struct tty_driver *d) | 339 | static inline struct tty_driver *tty_driver_kref_get(struct tty_driver *d) |
| 336 | { | 340 | { |
| 337 | kref_get(&d->kref); | 341 | kref_get(&d->kref); |
diff --git a/include/linux/usb.h b/include/linux/usb.h index 69d845739bc2..73b68d1f2cb0 100644 --- a/include/linux/usb.h +++ b/include/linux/usb.h | |||
| @@ -376,6 +376,12 @@ struct usb_bus { | |||
| 376 | 376 | ||
| 377 | struct usb_tt; | 377 | struct usb_tt; |
| 378 | 378 | ||
| 379 | enum usb_device_removable { | ||
| 380 | USB_DEVICE_REMOVABLE_UNKNOWN = 0, | ||
| 381 | USB_DEVICE_REMOVABLE, | ||
| 382 | USB_DEVICE_FIXED, | ||
| 383 | }; | ||
| 384 | |||
| 379 | /** | 385 | /** |
| 380 | * struct usb_device - kernel's representation of a USB device | 386 | * struct usb_device - kernel's representation of a USB device |
| 381 | * @devnum: device number; address on a USB bus | 387 | * @devnum: device number; address on a USB bus |
| @@ -432,6 +438,7 @@ struct usb_tt; | |||
| 432 | * @wusb_dev: if this is a Wireless USB device, link to the WUSB | 438 | * @wusb_dev: if this is a Wireless USB device, link to the WUSB |
| 433 | * specific data for the device. | 439 | * specific data for the device. |
| 434 | * @slot_id: Slot ID assigned by xHCI | 440 | * @slot_id: Slot ID assigned by xHCI |
| 441 | * @removable: Device can be physically removed from this port | ||
| 435 | * | 442 | * |
| 436 | * Notes: | 443 | * Notes: |
| 437 | * Usbcore drivers should not set usbdev->state directly. Instead use | 444 | * Usbcore drivers should not set usbdev->state directly. Instead use |
| @@ -494,7 +501,7 @@ struct usb_device { | |||
| 494 | #endif | 501 | #endif |
| 495 | 502 | ||
| 496 | int maxchild; | 503 | int maxchild; |
| 497 | struct usb_device *children[USB_MAXCHILDREN]; | 504 | struct usb_device **children; |
| 498 | 505 | ||
| 499 | u32 quirks; | 506 | u32 quirks; |
| 500 | atomic_t urbnum; | 507 | atomic_t urbnum; |
| @@ -509,6 +516,7 @@ struct usb_device { | |||
| 509 | #endif | 516 | #endif |
| 510 | struct wusb_dev *wusb_dev; | 517 | struct wusb_dev *wusb_dev; |
| 511 | int slot_id; | 518 | int slot_id; |
| 519 | enum usb_device_removable removable; | ||
| 512 | }; | 520 | }; |
| 513 | #define to_usb_device(d) container_of(d, struct usb_device, dev) | 521 | #define to_usb_device(d) container_of(d, struct usb_device, dev) |
| 514 | 522 | ||
diff --git a/include/linux/usb/audio-v2.h b/include/linux/usb/audio-v2.h index 964cb603f7c7..ed13053153f4 100644 --- a/include/linux/usb/audio-v2.h +++ b/include/linux/usb/audio-v2.h | |||
| @@ -43,6 +43,27 @@ static inline bool uac2_control_is_writeable(u32 bmControls, u8 control) | |||
| 43 | return (bmControls >> (control * 2)) & 0x2; | 43 | return (bmControls >> (control * 2)) & 0x2; |
| 44 | } | 44 | } |
| 45 | 45 | ||
| 46 | /* 4.7.2 Class-Specific AC Interface Descriptor */ | ||
| 47 | struct uac2_ac_header_descriptor { | ||
| 48 | __u8 bLength; /* 9 */ | ||
| 49 | __u8 bDescriptorType; /* USB_DT_CS_INTERFACE */ | ||
| 50 | __u8 bDescriptorSubtype; /* UAC_MS_HEADER */ | ||
| 51 | __le16 bcdADC; /* 0x0200 */ | ||
| 52 | __u8 bCategory; | ||
| 53 | __le16 wTotalLength; /* includes Unit and Terminal desc. */ | ||
| 54 | __u8 bmControls; | ||
| 55 | } __packed; | ||
| 56 | |||
| 57 | /* 2.3.1.6 Type I Format Type Descriptor (Frmts20 final.pdf)*/ | ||
| 58 | struct uac2_format_type_i_descriptor { | ||
| 59 | __u8 bLength; /* in bytes: 6 */ | ||
| 60 | __u8 bDescriptorType; /* USB_DT_CS_INTERFACE */ | ||
| 61 | __u8 bDescriptorSubtype; /* FORMAT_TYPE */ | ||
| 62 | __u8 bFormatType; /* FORMAT_TYPE_1 */ | ||
| 63 | __u8 bSubslotSize; /* {1,2,3,4} */ | ||
| 64 | __u8 bBitResolution; | ||
| 65 | } __packed; | ||
| 66 | |||
| 46 | /* 4.7.2.1 Clock Source Descriptor */ | 67 | /* 4.7.2.1 Clock Source Descriptor */ |
| 47 | 68 | ||
| 48 | struct uac_clock_source_descriptor { | 69 | struct uac_clock_source_descriptor { |
diff --git a/include/linux/usb/cdc-wdm.h b/include/linux/usb/cdc-wdm.h new file mode 100644 index 000000000000..719c332620fa --- /dev/null +++ b/include/linux/usb/cdc-wdm.h | |||
| @@ -0,0 +1,19 @@ | |||
| 1 | /* | ||
| 2 | * USB CDC Device Management subdriver | ||
| 3 | * | ||
| 4 | * Copyright (c) 2012 Bjørn Mork <bjorn@mork.no> | ||
| 5 | * | ||
| 6 | * This program is free software; you can redistribute it and/or | ||
| 7 | * modify it under the terms of the GNU General Public License | ||
| 8 | * version 2 as published by the Free Software Foundation. | ||
| 9 | */ | ||
| 10 | |||
| 11 | #ifndef __LINUX_USB_CDC_WDM_H | ||
| 12 | #define __LINUX_USB_CDC_WDM_H | ||
| 13 | |||
| 14 | extern struct usb_driver *usb_cdc_wdm_register(struct usb_interface *intf, | ||
| 15 | struct usb_endpoint_descriptor *ep, | ||
| 16 | int bufsize, | ||
| 17 | int (*manage_power)(struct usb_interface *, int)); | ||
| 18 | |||
| 19 | #endif /* __LINUX_USB_CDC_WDM_H */ | ||
diff --git a/include/linux/usb/ch11.h b/include/linux/usb/ch11.h index 0b83acd3360a..f1d26b6067f1 100644 --- a/include/linux/usb/ch11.h +++ b/include/linux/usb/ch11.h | |||
| @@ -76,6 +76,11 @@ | |||
| 76 | #define USB_PORT_FEAT_C_BH_PORT_RESET 29 | 76 | #define USB_PORT_FEAT_C_BH_PORT_RESET 29 |
| 77 | #define USB_PORT_FEAT_FORCE_LINKPM_ACCEPT 30 | 77 | #define USB_PORT_FEAT_FORCE_LINKPM_ACCEPT 30 |
| 78 | 78 | ||
| 79 | /* USB 3.0 hub remote wake mask bits, see table 10-14 */ | ||
| 80 | #define USB_PORT_FEAT_REMOTE_WAKE_CONNECT (1 << 8) | ||
| 81 | #define USB_PORT_FEAT_REMOTE_WAKE_DISCONNECT (1 << 9) | ||
| 82 | #define USB_PORT_FEAT_REMOTE_WAKE_OVER_CURRENT (1 << 10) | ||
| 83 | |||
| 79 | /* | 84 | /* |
| 80 | * Hub Status and Hub Change results | 85 | * Hub Status and Hub Change results |
| 81 | * See USB 2.0 spec Table 11-19 and Table 11-20 | 86 | * See USB 2.0 spec Table 11-19 and Table 11-20 |
diff --git a/include/linux/usb/ch9.h b/include/linux/usb/ch9.h index 3b6f628880f8..af21f3115919 100644 --- a/include/linux/usb/ch9.h +++ b/include/linux/usb/ch9.h | |||
| @@ -789,6 +789,11 @@ struct usb_ext_cap_descriptor { /* Link Power Management */ | |||
| 789 | __u8 bDevCapabilityType; | 789 | __u8 bDevCapabilityType; |
| 790 | __le32 bmAttributes; | 790 | __le32 bmAttributes; |
| 791 | #define USB_LPM_SUPPORT (1 << 1) /* supports LPM */ | 791 | #define USB_LPM_SUPPORT (1 << 1) /* supports LPM */ |
| 792 | #define USB_BESL_SUPPORT (1 << 2) /* supports BESL */ | ||
| 793 | #define USB_BESL_BASELINE_VALID (1 << 3) /* Baseline BESL valid*/ | ||
| 794 | #define USB_BESL_DEEP_VALID (1 << 4) /* Deep BESL valid */ | ||
| 795 | #define USB_GET_BESL_BASELINE(p) (((p) & (0xf << 8)) >> 8) | ||
| 796 | #define USB_GET_BESL_DEEP(p) (((p) & (0xf << 12)) >> 12) | ||
| 792 | } __attribute__((packed)); | 797 | } __attribute__((packed)); |
| 793 | 798 | ||
| 794 | #define USB_DT_USB_EXT_CAP_SIZE 7 | 799 | #define USB_DT_USB_EXT_CAP_SIZE 7 |
diff --git a/include/linux/usb/ehci_pdriver.h b/include/linux/usb/ehci_pdriver.h new file mode 100644 index 000000000000..1894f42fe3f7 --- /dev/null +++ b/include/linux/usb/ehci_pdriver.h | |||
| @@ -0,0 +1,46 @@ | |||
| 1 | /* | ||
| 2 | * Copyright (C) 2012 Hauke Mehrtens <hauke@hauke-m.de> | ||
| 3 | * | ||
| 4 | * This program is free software; you can redistribute it and/or modify it | ||
| 5 | * under the terms of the GNU General Public License as published by the | ||
| 6 | * Free Software Foundation; either version 2 of the License, or (at your | ||
| 7 | * option) any later version. | ||
| 8 | * | ||
| 9 | * This program is distributed in the hope that it will be useful, but | ||
| 10 | * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY | ||
| 11 | * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | ||
| 12 | * for more details. | ||
| 13 | * | ||
| 14 | * You should have received a copy of the GNU General Public License | ||
| 15 | * along with this program; if not, write to the Free Software Foundation, | ||
| 16 | * Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | ||
| 17 | */ | ||
| 18 | |||
| 19 | #ifndef __USB_CORE_EHCI_PDRIVER_H | ||
| 20 | #define __USB_CORE_EHCI_PDRIVER_H | ||
| 21 | |||
| 22 | /** | ||
| 23 | * struct usb_ehci_pdata - platform_data for generic ehci driver | ||
| 24 | * | ||
| 25 | * @caps_offset: offset of the EHCI Capability Registers to the start of | ||
| 26 | * the io memory region provided to the driver. | ||
| 27 | * @has_tt: set to 1 if TT is integrated in root hub. | ||
| 28 | * @port_power_on: set to 1 if the controller needs a power up after | ||
| 29 | * initialization. | ||
| 30 | * @port_power_off: set to 1 if the controller needs to be powered down | ||
| 31 | * after initialization. | ||
| 32 | * | ||
| 33 | * These are general configuration options for the EHCI controller. All of | ||
| 34 | * these options are activating more or less workarounds for some hardware. | ||
| 35 | */ | ||
| 36 | struct usb_ehci_pdata { | ||
| 37 | int caps_offset; | ||
| 38 | unsigned has_tt:1; | ||
| 39 | unsigned has_synopsys_hc_bug:1; | ||
| 40 | unsigned big_endian_desc:1; | ||
| 41 | unsigned big_endian_mmio:1; | ||
| 42 | unsigned port_power_on:1; | ||
| 43 | unsigned port_power_off:1; | ||
| 44 | }; | ||
| 45 | |||
| 46 | #endif /* __USB_CORE_EHCI_PDRIVER_H */ | ||
diff --git a/include/linux/usb/gadget.h b/include/linux/usb/gadget.h index da653b5c7134..9517466ababb 100644 --- a/include/linux/usb/gadget.h +++ b/include/linux/usb/gadget.h | |||
| @@ -950,6 +950,16 @@ static inline void usb_free_descriptors(struct usb_descriptor_header **v) | |||
| 950 | 950 | ||
| 951 | /*-------------------------------------------------------------------------*/ | 951 | /*-------------------------------------------------------------------------*/ |
| 952 | 952 | ||
| 953 | /* utility to simplify map/unmap of usb_requests to/from DMA */ | ||
| 954 | |||
| 955 | extern int usb_gadget_map_request(struct usb_gadget *gadget, | ||
| 956 | struct usb_request *req, int is_in); | ||
| 957 | |||
| 958 | extern void usb_gadget_unmap_request(struct usb_gadget *gadget, | ||
| 959 | struct usb_request *req, int is_in); | ||
| 960 | |||
| 961 | /*-------------------------------------------------------------------------*/ | ||
| 962 | |||
| 953 | /* utility wrapping a simple endpoint selection policy */ | 963 | /* utility wrapping a simple endpoint selection policy */ |
| 954 | 964 | ||
| 955 | extern struct usb_ep *usb_ep_autoconfig(struct usb_gadget *, | 965 | extern struct usb_ep *usb_ep_autoconfig(struct usb_gadget *, |
diff --git a/include/linux/usb/hcd.h b/include/linux/usb/hcd.h index b2f62f3a32af..5de415707c23 100644 --- a/include/linux/usb/hcd.h +++ b/include/linux/usb/hcd.h | |||
| @@ -127,7 +127,7 @@ struct usb_hcd { | |||
| 127 | unsigned authorized_default:1; | 127 | unsigned authorized_default:1; |
| 128 | unsigned has_tt:1; /* Integrated TT in root hub */ | 128 | unsigned has_tt:1; /* Integrated TT in root hub */ |
| 129 | 129 | ||
| 130 | int irq; /* irq allocated */ | 130 | unsigned int irq; /* irq allocated */ |
| 131 | void __iomem *regs; /* device memory/io */ | 131 | void __iomem *regs; /* device memory/io */ |
| 132 | u64 rsrc_start; /* memory/io resource start */ | 132 | u64 rsrc_start; /* memory/io resource start */ |
| 133 | u64 rsrc_len; /* memory/io resource length */ | 133 | u64 rsrc_len; /* memory/io resource length */ |
| @@ -412,6 +412,8 @@ extern irqreturn_t usb_hcd_irq(int irq, void *__hcd); | |||
| 412 | 412 | ||
| 413 | extern void usb_hc_died(struct usb_hcd *hcd); | 413 | extern void usb_hc_died(struct usb_hcd *hcd); |
| 414 | extern void usb_hcd_poll_rh_status(struct usb_hcd *hcd); | 414 | extern void usb_hcd_poll_rh_status(struct usb_hcd *hcd); |
| 415 | extern void usb_wakeup_notification(struct usb_device *hdev, | ||
| 416 | unsigned int portnum); | ||
| 415 | 417 | ||
| 416 | /* The D0/D1 toggle bits ... USE WITH CAUTION (they're almost hcd-internal) */ | 418 | /* The D0/D1 toggle bits ... USE WITH CAUTION (they're almost hcd-internal) */ |
| 417 | #define usb_gettoggle(dev, ep, out) (((dev)->toggle[out] >> (ep)) & 1) | 419 | #define usb_gettoggle(dev, ep, out) (((dev)->toggle[out] >> (ep)) & 1) |
diff --git a/include/linux/usb/intel_mid_otg.h b/include/linux/usb/intel_mid_otg.h index a0ccf795f362..756cf5543ffd 100644 --- a/include/linux/usb/intel_mid_otg.h +++ b/include/linux/usb/intel_mid_otg.h | |||
| @@ -104,11 +104,11 @@ struct iotg_ulpi_access_ops { | |||
| 104 | /* | 104 | /* |
| 105 | * the Intel MID (Langwell/Penwell) otg transceiver driver needs to interact | 105 | * the Intel MID (Langwell/Penwell) otg transceiver driver needs to interact |
| 106 | * with device and host drivers to implement the USB OTG related feature. More | 106 | * with device and host drivers to implement the USB OTG related feature. More |
| 107 | * function members are added based on otg_transceiver data structure for this | 107 | * function members are added based on usb_phy data structure for this |
| 108 | * purpose. | 108 | * purpose. |
| 109 | */ | 109 | */ |
| 110 | struct intel_mid_otg_xceiv { | 110 | struct intel_mid_otg_xceiv { |
| 111 | struct otg_transceiver otg; | 111 | struct usb_phy otg; |
| 112 | struct otg_hsm hsm; | 112 | struct otg_hsm hsm; |
| 113 | 113 | ||
| 114 | /* base address */ | 114 | /* base address */ |
| @@ -147,7 +147,7 @@ struct intel_mid_otg_xceiv { | |||
| 147 | 147 | ||
| 148 | }; | 148 | }; |
| 149 | static inline | 149 | static inline |
| 150 | struct intel_mid_otg_xceiv *otg_to_mid_xceiv(struct otg_transceiver *otg) | 150 | struct intel_mid_otg_xceiv *otg_to_mid_xceiv(struct usb_phy *otg) |
| 151 | { | 151 | { |
| 152 | return container_of(otg, struct intel_mid_otg_xceiv, otg); | 152 | return container_of(otg, struct intel_mid_otg_xceiv, otg); |
| 153 | } | 153 | } |
diff --git a/include/linux/usb/msm_hsusb.h b/include/linux/usb/msm_hsusb.h index 00311fe9d0df..22a396c13f3a 100644 --- a/include/linux/usb/msm_hsusb.h +++ b/include/linux/usb/msm_hsusb.h | |||
| @@ -160,7 +160,7 @@ struct msm_otg_platform_data { | |||
| 160 | * detection process. | 160 | * detection process. |
| 161 | */ | 161 | */ |
| 162 | struct msm_otg { | 162 | struct msm_otg { |
| 163 | struct otg_transceiver otg; | 163 | struct usb_phy phy; |
| 164 | struct msm_otg_platform_data *pdata; | 164 | struct msm_otg_platform_data *pdata; |
| 165 | int irq; | 165 | int irq; |
| 166 | struct clk *clk; | 166 | struct clk *clk; |
diff --git a/include/linux/usb/ohci_pdriver.h b/include/linux/usb/ohci_pdriver.h new file mode 100644 index 000000000000..2808f2a9cce8 --- /dev/null +++ b/include/linux/usb/ohci_pdriver.h | |||
| @@ -0,0 +1,38 @@ | |||
| 1 | /* | ||
| 2 | * Copyright (C) 2012 Hauke Mehrtens <hauke@hauke-m.de> | ||
| 3 | * | ||
| 4 | * This program is free software; you can redistribute it and/or modify it | ||
| 5 | * under the terms of the GNU General Public License as published by the | ||
| 6 | * Free Software Foundation; either version 2 of the License, or (at your | ||
| 7 | * option) any later version. | ||
| 8 | * | ||
| 9 | * This program is distributed in the hope that it will be useful, but | ||
| 10 | * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY | ||
| 11 | * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | ||
| 12 | * for more details. | ||
| 13 | * | ||
| 14 | * You should have received a copy of the GNU General Public License | ||
| 15 | * along with this program; if not, write to the Free Software Foundation, | ||
| 16 | * Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | ||
| 17 | */ | ||
| 18 | |||
| 19 | #ifndef __USB_CORE_OHCI_PDRIVER_H | ||
| 20 | #define __USB_CORE_OHCI_PDRIVER_H | ||
| 21 | |||
| 22 | /** | ||
| 23 | * struct usb_ohci_pdata - platform_data for generic ohci driver | ||
| 24 | * | ||
| 25 | * @big_endian_desc: BE descriptors | ||
| 26 | * @big_endian_mmio: BE registers | ||
| 27 | * @no_big_frame_no: no big endian frame_no shift | ||
| 28 | * | ||
| 29 | * These are general configuration options for the OHCI controller. All of | ||
| 30 | * these options are activating more or less workarounds for some hardware. | ||
| 31 | */ | ||
| 32 | struct usb_ohci_pdata { | ||
| 33 | unsigned big_endian_desc:1; | ||
| 34 | unsigned big_endian_mmio:1; | ||
| 35 | unsigned no_big_frame_no:1; | ||
| 36 | }; | ||
| 37 | |||
| 38 | #endif /* __USB_CORE_OHCI_PDRIVER_H */ | ||
diff --git a/include/linux/usb/otg.h b/include/linux/usb/otg.h index d87f44f5b04e..f67810f8f21b 100644 --- a/include/linux/usb/otg.h +++ b/include/linux/usb/otg.h | |||
| @@ -35,7 +35,7 @@ enum usb_otg_state { | |||
| 35 | OTG_STATE_A_VBUS_ERR, | 35 | OTG_STATE_A_VBUS_ERR, |
| 36 | }; | 36 | }; |
| 37 | 37 | ||
| 38 | enum usb_xceiv_events { | 38 | enum usb_phy_events { |
| 39 | USB_EVENT_NONE, /* no events or cable disconnected */ | 39 | USB_EVENT_NONE, /* no events or cable disconnected */ |
| 40 | USB_EVENT_VBUS, /* vbus valid event */ | 40 | USB_EVENT_VBUS, /* vbus valid event */ |
| 41 | USB_EVENT_ID, /* id was grounded */ | 41 | USB_EVENT_ID, /* id was grounded */ |
| @@ -43,14 +43,39 @@ enum usb_xceiv_events { | |||
| 43 | USB_EVENT_ENUMERATED, /* gadget driver enumerated */ | 43 | USB_EVENT_ENUMERATED, /* gadget driver enumerated */ |
| 44 | }; | 44 | }; |
| 45 | 45 | ||
| 46 | struct otg_transceiver; | 46 | struct usb_phy; |
| 47 | 47 | ||
| 48 | /* for transceivers connected thru an ULPI interface, the user must | 48 | /* for transceivers connected thru an ULPI interface, the user must |
| 49 | * provide access ops | 49 | * provide access ops |
| 50 | */ | 50 | */ |
| 51 | struct otg_io_access_ops { | 51 | struct usb_phy_io_ops { |
| 52 | int (*read)(struct otg_transceiver *otg, u32 reg); | 52 | int (*read)(struct usb_phy *x, u32 reg); |
| 53 | int (*write)(struct otg_transceiver *otg, u32 val, u32 reg); | 53 | int (*write)(struct usb_phy *x, u32 val, u32 reg); |
| 54 | }; | ||
| 55 | |||
| 56 | struct usb_otg { | ||
| 57 | u8 default_a; | ||
| 58 | |||
| 59 | struct usb_phy *phy; | ||
| 60 | struct usb_bus *host; | ||
| 61 | struct usb_gadget *gadget; | ||
| 62 | |||
| 63 | /* bind/unbind the host controller */ | ||
| 64 | int (*set_host)(struct usb_otg *otg, struct usb_bus *host); | ||
| 65 | |||
| 66 | /* bind/unbind the peripheral controller */ | ||
| 67 | int (*set_peripheral)(struct usb_otg *otg, | ||
| 68 | struct usb_gadget *gadget); | ||
| 69 | |||
| 70 | /* effective for A-peripheral, ignored for B devices */ | ||
| 71 | int (*set_vbus)(struct usb_otg *otg, bool enabled); | ||
| 72 | |||
| 73 | /* for B devices only: start session with A-Host */ | ||
| 74 | int (*start_srp)(struct usb_otg *otg); | ||
| 75 | |||
| 76 | /* start or continue HNP role switch */ | ||
| 77 | int (*start_hnp)(struct usb_otg *otg); | ||
| 78 | |||
| 54 | }; | 79 | }; |
| 55 | 80 | ||
| 56 | /* | 81 | /* |
| @@ -59,22 +84,20 @@ struct otg_io_access_ops { | |||
| 59 | * moment, using the transceiver, ID signal, HNP and sometimes static | 84 | * moment, using the transceiver, ID signal, HNP and sometimes static |
| 60 | * configuration information (including "board isn't wired for otg"). | 85 | * configuration information (including "board isn't wired for otg"). |
| 61 | */ | 86 | */ |
| 62 | struct otg_transceiver { | 87 | struct usb_phy { |
| 63 | struct device *dev; | 88 | struct device *dev; |
| 64 | const char *label; | 89 | const char *label; |
| 65 | unsigned int flags; | 90 | unsigned int flags; |
| 66 | 91 | ||
| 67 | u8 default_a; | ||
| 68 | enum usb_otg_state state; | 92 | enum usb_otg_state state; |
| 69 | enum usb_xceiv_events last_event; | 93 | enum usb_phy_events last_event; |
| 70 | 94 | ||
| 71 | struct usb_bus *host; | 95 | struct usb_otg *otg; |
| 72 | struct usb_gadget *gadget; | ||
| 73 | 96 | ||
| 74 | struct otg_io_access_ops *io_ops; | 97 | struct usb_phy_io_ops *io_ops; |
| 75 | void __iomem *io_priv; | 98 | void __iomem *io_priv; |
| 76 | 99 | ||
| 77 | /* for notification of usb_xceiv_events */ | 100 | /* for notification of usb_phy_events */ |
| 78 | struct atomic_notifier_head notifier; | 101 | struct atomic_notifier_head notifier; |
| 79 | 102 | ||
| 80 | /* to pass extra port status to the root hub */ | 103 | /* to pass extra port status to the root hub */ |
| @@ -82,40 +105,22 @@ struct otg_transceiver { | |||
| 82 | u16 port_change; | 105 | u16 port_change; |
| 83 | 106 | ||
| 84 | /* initialize/shutdown the OTG controller */ | 107 | /* initialize/shutdown the OTG controller */ |
| 85 | int (*init)(struct otg_transceiver *otg); | 108 | int (*init)(struct usb_phy *x); |
| 86 | void (*shutdown)(struct otg_transceiver *otg); | 109 | void (*shutdown)(struct usb_phy *x); |
| 87 | |||
| 88 | /* bind/unbind the host controller */ | ||
| 89 | int (*set_host)(struct otg_transceiver *otg, | ||
| 90 | struct usb_bus *host); | ||
| 91 | |||
| 92 | /* bind/unbind the peripheral controller */ | ||
| 93 | int (*set_peripheral)(struct otg_transceiver *otg, | ||
| 94 | struct usb_gadget *gadget); | ||
| 95 | 110 | ||
| 96 | /* effective for B devices, ignored for A-peripheral */ | 111 | /* effective for B devices, ignored for A-peripheral */ |
| 97 | int (*set_power)(struct otg_transceiver *otg, | 112 | int (*set_power)(struct usb_phy *x, |
| 98 | unsigned mA); | 113 | unsigned mA); |
| 99 | 114 | ||
| 100 | /* effective for A-peripheral, ignored for B devices */ | ||
| 101 | int (*set_vbus)(struct otg_transceiver *otg, | ||
| 102 | bool enabled); | ||
| 103 | |||
| 104 | /* for non-OTG B devices: set transceiver into suspend mode */ | 115 | /* for non-OTG B devices: set transceiver into suspend mode */ |
| 105 | int (*set_suspend)(struct otg_transceiver *otg, | 116 | int (*set_suspend)(struct usb_phy *x, |
| 106 | int suspend); | 117 | int suspend); |
| 107 | 118 | ||
| 108 | /* for B devices only: start session with A-Host */ | ||
| 109 | int (*start_srp)(struct otg_transceiver *otg); | ||
| 110 | |||
| 111 | /* start or continue HNP role switch */ | ||
| 112 | int (*start_hnp)(struct otg_transceiver *otg); | ||
| 113 | |||
| 114 | }; | 119 | }; |
| 115 | 120 | ||
| 116 | 121 | ||
| 117 | /* for board-specific init logic */ | 122 | /* for board-specific init logic */ |
| 118 | extern int otg_set_transceiver(struct otg_transceiver *); | 123 | extern int usb_set_transceiver(struct usb_phy *); |
| 119 | 124 | ||
| 120 | #if defined(CONFIG_NOP_USB_XCEIV) || (defined(CONFIG_NOP_USB_XCEIV_MODULE) && defined(MODULE)) | 125 | #if defined(CONFIG_NOP_USB_XCEIV) || (defined(CONFIG_NOP_USB_XCEIV_MODULE) && defined(MODULE)) |
| 121 | /* sometimes transceivers are accessed only through e.g. ULPI */ | 126 | /* sometimes transceivers are accessed only through e.g. ULPI */ |
| @@ -132,50 +137,50 @@ static inline void usb_nop_xceiv_unregister(void) | |||
| 132 | #endif | 137 | #endif |
| 133 | 138 | ||
| 134 | /* helpers for direct access thru low-level io interface */ | 139 | /* helpers for direct access thru low-level io interface */ |
| 135 | static inline int otg_io_read(struct otg_transceiver *otg, u32 reg) | 140 | static inline int usb_phy_io_read(struct usb_phy *x, u32 reg) |
| 136 | { | 141 | { |
| 137 | if (otg->io_ops && otg->io_ops->read) | 142 | if (x->io_ops && x->io_ops->read) |
| 138 | return otg->io_ops->read(otg, reg); | 143 | return x->io_ops->read(x, reg); |
| 139 | 144 | ||
| 140 | return -EINVAL; | 145 | return -EINVAL; |
| 141 | } | 146 | } |
| 142 | 147 | ||
| 143 | static inline int otg_io_write(struct otg_transceiver *otg, u32 val, u32 reg) | 148 | static inline int usb_phy_io_write(struct usb_phy *x, u32 val, u32 reg) |
| 144 | { | 149 | { |
| 145 | if (otg->io_ops && otg->io_ops->write) | 150 | if (x->io_ops && x->io_ops->write) |
| 146 | return otg->io_ops->write(otg, val, reg); | 151 | return x->io_ops->write(x, val, reg); |
| 147 | 152 | ||
| 148 | return -EINVAL; | 153 | return -EINVAL; |
| 149 | } | 154 | } |
| 150 | 155 | ||
| 151 | static inline int | 156 | static inline int |
| 152 | otg_init(struct otg_transceiver *otg) | 157 | usb_phy_init(struct usb_phy *x) |
| 153 | { | 158 | { |
| 154 | if (otg->init) | 159 | if (x->init) |
| 155 | return otg->init(otg); | 160 | return x->init(x); |
| 156 | 161 | ||
| 157 | return 0; | 162 | return 0; |
| 158 | } | 163 | } |
| 159 | 164 | ||
| 160 | static inline void | 165 | static inline void |
| 161 | otg_shutdown(struct otg_transceiver *otg) | 166 | usb_phy_shutdown(struct usb_phy *x) |
| 162 | { | 167 | { |
| 163 | if (otg->shutdown) | 168 | if (x->shutdown) |
| 164 | otg->shutdown(otg); | 169 | x->shutdown(x); |
| 165 | } | 170 | } |
| 166 | 171 | ||
| 167 | /* for usb host and peripheral controller drivers */ | 172 | /* for usb host and peripheral controller drivers */ |
| 168 | #ifdef CONFIG_USB_OTG_UTILS | 173 | #ifdef CONFIG_USB_OTG_UTILS |
| 169 | extern struct otg_transceiver *otg_get_transceiver(void); | 174 | extern struct usb_phy *usb_get_transceiver(void); |
| 170 | extern void otg_put_transceiver(struct otg_transceiver *); | 175 | extern void usb_put_transceiver(struct usb_phy *); |
| 171 | extern const char *otg_state_string(enum usb_otg_state state); | 176 | extern const char *otg_state_string(enum usb_otg_state state); |
| 172 | #else | 177 | #else |
| 173 | static inline struct otg_transceiver *otg_get_transceiver(void) | 178 | static inline struct usb_phy *usb_get_transceiver(void) |
| 174 | { | 179 | { |
| 175 | return NULL; | 180 | return NULL; |
| 176 | } | 181 | } |
| 177 | 182 | ||
| 178 | static inline void otg_put_transceiver(struct otg_transceiver *x) | 183 | static inline void usb_put_transceiver(struct usb_phy *x) |
| 179 | { | 184 | { |
| 180 | } | 185 | } |
| 181 | 186 | ||
| @@ -187,67 +192,84 @@ static inline const char *otg_state_string(enum usb_otg_state state) | |||
| 187 | 192 | ||
| 188 | /* Context: can sleep */ | 193 | /* Context: can sleep */ |
| 189 | static inline int | 194 | static inline int |
| 190 | otg_start_hnp(struct otg_transceiver *otg) | 195 | otg_start_hnp(struct usb_otg *otg) |
| 191 | { | 196 | { |
| 192 | return otg->start_hnp(otg); | 197 | if (otg && otg->start_hnp) |
| 198 | return otg->start_hnp(otg); | ||
| 199 | |||
| 200 | return -ENOTSUPP; | ||
| 193 | } | 201 | } |
| 194 | 202 | ||
| 195 | /* Context: can sleep */ | 203 | /* Context: can sleep */ |
| 196 | static inline int | 204 | static inline int |
| 197 | otg_set_vbus(struct otg_transceiver *otg, bool enabled) | 205 | otg_set_vbus(struct usb_otg *otg, bool enabled) |
| 198 | { | 206 | { |
| 199 | return otg->set_vbus(otg, enabled); | 207 | if (otg && otg->set_vbus) |
| 208 | return otg->set_vbus(otg, enabled); | ||
| 209 | |||
| 210 | return -ENOTSUPP; | ||
| 200 | } | 211 | } |
| 201 | 212 | ||
| 202 | /* for HCDs */ | 213 | /* for HCDs */ |
| 203 | static inline int | 214 | static inline int |
| 204 | otg_set_host(struct otg_transceiver *otg, struct usb_bus *host) | 215 | otg_set_host(struct usb_otg *otg, struct usb_bus *host) |
| 205 | { | 216 | { |
| 206 | return otg->set_host(otg, host); | 217 | if (otg && otg->set_host) |
| 218 | return otg->set_host(otg, host); | ||
| 219 | |||
| 220 | return -ENOTSUPP; | ||
| 207 | } | 221 | } |
| 208 | 222 | ||
| 209 | /* for usb peripheral controller drivers */ | 223 | /* for usb peripheral controller drivers */ |
| 210 | 224 | ||
| 211 | /* Context: can sleep */ | 225 | /* Context: can sleep */ |
| 212 | static inline int | 226 | static inline int |
| 213 | otg_set_peripheral(struct otg_transceiver *otg, struct usb_gadget *periph) | 227 | otg_set_peripheral(struct usb_otg *otg, struct usb_gadget *periph) |
| 214 | { | 228 | { |
| 215 | return otg->set_peripheral(otg, periph); | 229 | if (otg && otg->set_peripheral) |
| 230 | return otg->set_peripheral(otg, periph); | ||
| 231 | |||
| 232 | return -ENOTSUPP; | ||
| 216 | } | 233 | } |
| 217 | 234 | ||
| 218 | static inline int | 235 | static inline int |
| 219 | otg_set_power(struct otg_transceiver *otg, unsigned mA) | 236 | usb_phy_set_power(struct usb_phy *x, unsigned mA) |
| 220 | { | 237 | { |
| 221 | return otg->set_power(otg, mA); | 238 | if (x && x->set_power) |
| 239 | return x->set_power(x, mA); | ||
| 240 | return 0; | ||
| 222 | } | 241 | } |
| 223 | 242 | ||
| 224 | /* Context: can sleep */ | 243 | /* Context: can sleep */ |
| 225 | static inline int | 244 | static inline int |
| 226 | otg_set_suspend(struct otg_transceiver *otg, int suspend) | 245 | usb_phy_set_suspend(struct usb_phy *x, int suspend) |
| 227 | { | 246 | { |
| 228 | if (otg->set_suspend != NULL) | 247 | if (x->set_suspend != NULL) |
| 229 | return otg->set_suspend(otg, suspend); | 248 | return x->set_suspend(x, suspend); |
| 230 | else | 249 | else |
| 231 | return 0; | 250 | return 0; |
| 232 | } | 251 | } |
| 233 | 252 | ||
| 234 | static inline int | 253 | static inline int |
| 235 | otg_start_srp(struct otg_transceiver *otg) | 254 | otg_start_srp(struct usb_otg *otg) |
| 236 | { | 255 | { |
| 237 | return otg->start_srp(otg); | 256 | if (otg && otg->start_srp) |
| 257 | return otg->start_srp(otg); | ||
| 258 | |||
| 259 | return -ENOTSUPP; | ||
| 238 | } | 260 | } |
| 239 | 261 | ||
| 240 | /* notifiers */ | 262 | /* notifiers */ |
| 241 | static inline int | 263 | static inline int |
| 242 | otg_register_notifier(struct otg_transceiver *otg, struct notifier_block *nb) | 264 | usb_register_notifier(struct usb_phy *x, struct notifier_block *nb) |
| 243 | { | 265 | { |
| 244 | return atomic_notifier_chain_register(&otg->notifier, nb); | 266 | return atomic_notifier_chain_register(&x->notifier, nb); |
| 245 | } | 267 | } |
| 246 | 268 | ||
| 247 | static inline void | 269 | static inline void |
| 248 | otg_unregister_notifier(struct otg_transceiver *otg, struct notifier_block *nb) | 270 | usb_unregister_notifier(struct usb_phy *x, struct notifier_block *nb) |
| 249 | { | 271 | { |
| 250 | atomic_notifier_chain_unregister(&otg->notifier, nb); | 272 | atomic_notifier_chain_unregister(&x->notifier, nb); |
| 251 | } | 273 | } |
| 252 | 274 | ||
| 253 | /* for OTG controller drivers (and maybe other stuff) */ | 275 | /* for OTG controller drivers (and maybe other stuff) */ |
diff --git a/include/linux/usb/renesas_usbhs.h b/include/linux/usb/renesas_usbhs.h index 0d3f98879256..547e59cc00ea 100644 --- a/include/linux/usb/renesas_usbhs.h +++ b/include/linux/usb/renesas_usbhs.h | |||
| @@ -149,6 +149,7 @@ struct renesas_usbhs_driver_param { | |||
| 149 | * option: | 149 | * option: |
| 150 | */ | 150 | */ |
| 151 | u32 has_otg:1; /* for controlling PWEN/EXTLP */ | 151 | u32 has_otg:1; /* for controlling PWEN/EXTLP */ |
| 152 | u32 has_sudmac:1; /* for SUDMAC */ | ||
| 152 | }; | 153 | }; |
| 153 | 154 | ||
| 154 | /* | 155 | /* |
diff --git a/include/linux/usb/serial.h b/include/linux/usb/serial.h index 4267a9c717ba..fbb666b1b670 100644 --- a/include/linux/usb/serial.h +++ b/include/linux/usb/serial.h | |||
| @@ -300,8 +300,10 @@ struct usb_serial_driver { | |||
| 300 | #define to_usb_serial_driver(d) \ | 300 | #define to_usb_serial_driver(d) \ |
| 301 | container_of(d, struct usb_serial_driver, driver) | 301 | container_of(d, struct usb_serial_driver, driver) |
| 302 | 302 | ||
| 303 | extern int usb_serial_register(struct usb_serial_driver *driver); | 303 | extern int usb_serial_register_drivers(struct usb_driver *udriver, |
| 304 | extern void usb_serial_deregister(struct usb_serial_driver *driver); | 304 | struct usb_serial_driver * const serial_drivers[]); |
| 305 | extern void usb_serial_deregister_drivers(struct usb_driver *udriver, | ||
| 306 | struct usb_serial_driver * const serial_drivers[]); | ||
| 305 | extern void usb_serial_port_softint(struct usb_serial_port *port); | 307 | extern void usb_serial_port_softint(struct usb_serial_port *port); |
| 306 | 308 | ||
| 307 | extern int usb_serial_probe(struct usb_interface *iface, | 309 | extern int usb_serial_probe(struct usb_interface *iface, |
| @@ -389,5 +391,35 @@ do { \ | |||
| 389 | printk(KERN_DEBUG "%s: " format "\n", __FILE__, ##arg); \ | 391 | printk(KERN_DEBUG "%s: " format "\n", __FILE__, ##arg); \ |
| 390 | } while (0) | 392 | } while (0) |
| 391 | 393 | ||
| 394 | /* | ||
| 395 | * Macro for reporting errors in write path to avoid inifinite loop | ||
| 396 | * when port is used as a console. | ||
| 397 | */ | ||
| 398 | #define dev_err_console(usport, fmt, ...) \ | ||
| 399 | do { \ | ||
| 400 | static bool __print_once; \ | ||
| 401 | struct usb_serial_port *__port = (usport); \ | ||
| 402 | \ | ||
| 403 | if (!__port->port.console || !__print_once) { \ | ||
| 404 | __print_once = true; \ | ||
| 405 | dev_err(&__port->dev, fmt, ##__VA_ARGS__); \ | ||
| 406 | } \ | ||
| 407 | } while (0) | ||
| 408 | |||
| 409 | /* | ||
| 410 | * module_usb_serial_driver() - Helper macro for registering a USB Serial driver | ||
| 411 | * @__usb_driver: usb_driver struct to register | ||
| 412 | * @__serial_drivers: list of usb_serial drivers to register | ||
| 413 | * | ||
| 414 | * Helper macro for USB serial drivers which do not do anything special | ||
| 415 | * in module init/exit. This eliminates a lot of boilerplate. Each | ||
| 416 | * module may only use this macro once, and calling it replaces | ||
| 417 | * module_init() and module_exit() | ||
| 418 | * | ||
| 419 | */ | ||
| 420 | #define module_usb_serial_driver(__usb_driver, __serial_drivers) \ | ||
| 421 | module_driver(__usb_driver, usb_serial_register_drivers, \ | ||
| 422 | usb_serial_deregister_drivers, __serial_drivers) | ||
| 423 | |||
| 392 | #endif /* __LINUX_USB_SERIAL_H */ | 424 | #endif /* __LINUX_USB_SERIAL_H */ |
| 393 | 425 | ||
diff --git a/include/linux/usb/storage.h b/include/linux/usb/storage.h index d7fc910f1dc4..cb33fff2ba0b 100644 --- a/include/linux/usb/storage.h +++ b/include/linux/usb/storage.h | |||
| @@ -45,4 +45,42 @@ | |||
| 45 | 45 | ||
| 46 | #define USB_PR_DEVICE 0xff /* Use device's value */ | 46 | #define USB_PR_DEVICE 0xff /* Use device's value */ |
| 47 | 47 | ||
| 48 | /* | ||
| 49 | * Bulk only data structures | ||
| 50 | */ | ||
| 51 | |||
| 52 | /* command block wrapper */ | ||
| 53 | struct bulk_cb_wrap { | ||
| 54 | __le32 Signature; /* contains 'USBC' */ | ||
| 55 | __u32 Tag; /* unique per command id */ | ||
| 56 | __le32 DataTransferLength; /* size of data */ | ||
| 57 | __u8 Flags; /* direction in bit 0 */ | ||
| 58 | __u8 Lun; /* LUN normally 0 */ | ||
| 59 | __u8 Length; /* of of the CDB */ | ||
| 60 | __u8 CDB[16]; /* max command */ | ||
| 61 | }; | ||
| 62 | |||
| 63 | #define US_BULK_CB_WRAP_LEN 31 | ||
| 64 | #define US_BULK_CB_SIGN 0x43425355 /*spells out USBC */ | ||
| 65 | #define US_BULK_FLAG_IN (1 << 7) | ||
| 66 | #define US_BULK_FLAG_OUT 0 | ||
| 67 | |||
| 68 | /* command status wrapper */ | ||
| 69 | struct bulk_cs_wrap { | ||
| 70 | __le32 Signature; /* should = 'USBS' */ | ||
| 71 | __u32 Tag; /* same as original command */ | ||
| 72 | __le32 Residue; /* amount not transferred */ | ||
| 73 | __u8 Status; /* see below */ | ||
| 74 | }; | ||
| 75 | |||
| 76 | #define US_BULK_CS_WRAP_LEN 13 | ||
| 77 | #define US_BULK_CS_SIGN 0x53425355 /* spells out 'USBS' */ | ||
| 78 | #define US_BULK_STAT_OK 0 | ||
| 79 | #define US_BULK_STAT_FAIL 1 | ||
| 80 | #define US_BULK_STAT_PHASE 2 | ||
| 81 | |||
| 82 | /* bulk-only class specific requests */ | ||
| 83 | #define US_BULK_RESET_REQUEST 0xff | ||
| 84 | #define US_BULK_GET_MAX_LUN 0xfe | ||
| 85 | |||
| 48 | #endif | 86 | #endif |
diff --git a/include/linux/usb/uas.h b/include/linux/usb/uas.h new file mode 100644 index 000000000000..9a988e413694 --- /dev/null +++ b/include/linux/usb/uas.h | |||
| @@ -0,0 +1,69 @@ | |||
| 1 | #ifndef __USB_UAS_H__ | ||
| 2 | #define __USB_UAS_H__ | ||
| 3 | |||
| 4 | #include <scsi/scsi.h> | ||
| 5 | #include <scsi/scsi_cmnd.h> | ||
| 6 | |||
| 7 | /* Common header for all IUs */ | ||
| 8 | struct iu { | ||
| 9 | __u8 iu_id; | ||
| 10 | __u8 rsvd1; | ||
| 11 | __be16 tag; | ||
| 12 | }; | ||
| 13 | |||
| 14 | enum { | ||
| 15 | IU_ID_COMMAND = 0x01, | ||
| 16 | IU_ID_STATUS = 0x03, | ||
| 17 | IU_ID_RESPONSE = 0x04, | ||
| 18 | IU_ID_TASK_MGMT = 0x05, | ||
| 19 | IU_ID_READ_READY = 0x06, | ||
| 20 | IU_ID_WRITE_READY = 0x07, | ||
| 21 | }; | ||
| 22 | |||
| 23 | struct command_iu { | ||
| 24 | __u8 iu_id; | ||
| 25 | __u8 rsvd1; | ||
| 26 | __be16 tag; | ||
| 27 | __u8 prio_attr; | ||
| 28 | __u8 rsvd5; | ||
| 29 | __u8 len; | ||
| 30 | __u8 rsvd7; | ||
| 31 | struct scsi_lun lun; | ||
| 32 | __u8 cdb[16]; /* XXX: Overflow-checking tools may misunderstand */ | ||
| 33 | }; | ||
| 34 | |||
| 35 | /* | ||
| 36 | * Also used for the Read Ready and Write Ready IUs since they have the | ||
| 37 | * same first four bytes | ||
| 38 | */ | ||
| 39 | struct sense_iu { | ||
| 40 | __u8 iu_id; | ||
| 41 | __u8 rsvd1; | ||
| 42 | __be16 tag; | ||
| 43 | __be16 status_qual; | ||
| 44 | __u8 status; | ||
| 45 | __u8 rsvd7[7]; | ||
| 46 | __be16 len; | ||
| 47 | __u8 sense[SCSI_SENSE_BUFFERSIZE]; | ||
| 48 | }; | ||
| 49 | |||
| 50 | struct usb_pipe_usage_descriptor { | ||
| 51 | __u8 bLength; | ||
| 52 | __u8 bDescriptorType; | ||
| 53 | |||
| 54 | __u8 bPipeID; | ||
| 55 | __u8 Reserved; | ||
| 56 | } __attribute__((__packed__)); | ||
| 57 | |||
| 58 | enum { | ||
| 59 | CMD_PIPE_ID = 1, | ||
| 60 | STATUS_PIPE_ID = 2, | ||
| 61 | DATA_IN_PIPE_ID = 3, | ||
| 62 | DATA_OUT_PIPE_ID = 4, | ||
| 63 | |||
| 64 | UAS_SIMPLE_TAG = 0, | ||
| 65 | UAS_HEAD_TAG = 1, | ||
| 66 | UAS_ORDERED_TAG = 2, | ||
| 67 | UAS_ACA = 4, | ||
| 68 | }; | ||
| 69 | #endif | ||
diff --git a/include/linux/usb/ulpi.h b/include/linux/usb/ulpi.h index 9595796d62ed..6f033a415ecb 100644 --- a/include/linux/usb/ulpi.h +++ b/include/linux/usb/ulpi.h | |||
| @@ -181,12 +181,12 @@ | |||
| 181 | 181 | ||
| 182 | /*-------------------------------------------------------------------------*/ | 182 | /*-------------------------------------------------------------------------*/ |
| 183 | 183 | ||
| 184 | struct otg_transceiver *otg_ulpi_create(struct otg_io_access_ops *ops, | 184 | struct usb_phy *otg_ulpi_create(struct usb_phy_io_ops *ops, |
| 185 | unsigned int flags); | 185 | unsigned int flags); |
| 186 | 186 | ||
| 187 | #ifdef CONFIG_USB_ULPI_VIEWPORT | 187 | #ifdef CONFIG_USB_ULPI_VIEWPORT |
| 188 | /* access ops for controllers with a viewport register */ | 188 | /* access ops for controllers with a viewport register */ |
| 189 | extern struct otg_io_access_ops ulpi_viewport_access_ops; | 189 | extern struct usb_phy_io_ops ulpi_viewport_access_ops; |
| 190 | #endif | 190 | #endif |
| 191 | 191 | ||
| 192 | #endif /* __LINUX_USB_ULPI_H */ | 192 | #endif /* __LINUX_USB_ULPI_H */ |
diff --git a/include/linux/videodev2.h b/include/linux/videodev2.h index 5e11f8a1f867..c9c9a4680cc5 100644 --- a/include/linux/videodev2.h +++ b/include/linux/videodev2.h | |||
| @@ -235,16 +235,25 @@ struct v4l2_fract { | |||
| 235 | __u32 denominator; | 235 | __u32 denominator; |
| 236 | }; | 236 | }; |
| 237 | 237 | ||
| 238 | /* | 238 | /** |
| 239 | * D R I V E R C A P A B I L I T I E S | 239 | * struct v4l2_capability - Describes V4L2 device caps returned by VIDIOC_QUERYCAP |
| 240 | */ | 240 | * |
| 241 | * @driver: name of the driver module (e.g. "bttv") | ||
| 242 | * @card: name of the card (e.g. "Hauppauge WinTV") | ||
| 243 | * @bus_info: name of the bus (e.g. "PCI:" + pci_name(pci_dev) ) | ||
| 244 | * @version: KERNEL_VERSION | ||
| 245 | * @capabilities: capabilities of the physical device as a whole | ||
| 246 | * @device_caps: capabilities accessed via this particular device (node) | ||
| 247 | * @reserved: reserved fields for future extensions | ||
| 248 | */ | ||
| 241 | struct v4l2_capability { | 249 | struct v4l2_capability { |
| 242 | __u8 driver[16]; /* i.e. "bttv" */ | 250 | __u8 driver[16]; |
| 243 | __u8 card[32]; /* i.e. "Hauppauge WinTV" */ | 251 | __u8 card[32]; |
| 244 | __u8 bus_info[32]; /* "PCI:" + pci_name(pci_dev) */ | 252 | __u8 bus_info[32]; |
| 245 | __u32 version; /* should use KERNEL_VERSION() */ | 253 | __u32 version; |
| 246 | __u32 capabilities; /* Device capabilities */ | 254 | __u32 capabilities; |
| 247 | __u32 reserved[4]; | 255 | __u32 device_caps; |
| 256 | __u32 reserved[3]; | ||
| 248 | }; | 257 | }; |
| 249 | 258 | ||
| 250 | /* Values for 'capabilities' field */ | 259 | /* Values for 'capabilities' field */ |
| @@ -274,6 +283,8 @@ struct v4l2_capability { | |||
| 274 | #define V4L2_CAP_ASYNCIO 0x02000000 /* async I/O */ | 283 | #define V4L2_CAP_ASYNCIO 0x02000000 /* async I/O */ |
| 275 | #define V4L2_CAP_STREAMING 0x04000000 /* streaming I/O ioctls */ | 284 | #define V4L2_CAP_STREAMING 0x04000000 /* streaming I/O ioctls */ |
| 276 | 285 | ||
| 286 | #define V4L2_CAP_DEVICE_CAPS 0x80000000 /* sets device capabilities field */ | ||
| 287 | |||
| 277 | /* | 288 | /* |
| 278 | * V I D E O I M A G E F O R M A T | 289 | * V I D E O I M A G E F O R M A T |
| 279 | */ | 290 | */ |
| @@ -751,20 +762,20 @@ struct v4l2_crop { | |||
| 751 | 762 | ||
| 752 | /* Selection targets */ | 763 | /* Selection targets */ |
| 753 | 764 | ||
| 754 | /* current cropping area */ | 765 | /* Current cropping area */ |
| 755 | #define V4L2_SEL_TGT_CROP_ACTIVE 0 | 766 | #define V4L2_SEL_TGT_CROP_ACTIVE 0x0000 |
| 756 | /* default cropping area */ | 767 | /* Default cropping area */ |
| 757 | #define V4L2_SEL_TGT_CROP_DEFAULT 1 | 768 | #define V4L2_SEL_TGT_CROP_DEFAULT 0x0001 |
| 758 | /* cropping bounds */ | 769 | /* Cropping bounds */ |
| 759 | #define V4L2_SEL_TGT_CROP_BOUNDS 2 | 770 | #define V4L2_SEL_TGT_CROP_BOUNDS 0x0002 |
| 760 | /* current composing area */ | 771 | /* Current composing area */ |
| 761 | #define V4L2_SEL_TGT_COMPOSE_ACTIVE 256 | 772 | #define V4L2_SEL_TGT_COMPOSE_ACTIVE 0x0100 |
| 762 | /* default composing area */ | 773 | /* Default composing area */ |
| 763 | #define V4L2_SEL_TGT_COMPOSE_DEFAULT 257 | 774 | #define V4L2_SEL_TGT_COMPOSE_DEFAULT 0x0101 |
| 764 | /* composing bounds */ | 775 | /* Composing bounds */ |
| 765 | #define V4L2_SEL_TGT_COMPOSE_BOUNDS 258 | 776 | #define V4L2_SEL_TGT_COMPOSE_BOUNDS 0x0102 |
| 766 | /* current composing area plus all padding pixels */ | 777 | /* Current composing area plus all padding pixels */ |
| 767 | #define V4L2_SEL_TGT_COMPOSE_PADDED 259 | 778 | #define V4L2_SEL_TGT_COMPOSE_PADDED 0x0103 |
| 768 | 779 | ||
| 769 | /** | 780 | /** |
| 770 | * struct v4l2_selection - selection info | 781 | * struct v4l2_selection - selection info |
| @@ -774,7 +785,7 @@ struct v4l2_crop { | |||
| 774 | * @r: coordinates of selection window | 785 | * @r: coordinates of selection window |
| 775 | * @reserved: for future use, rounds structure size to 64 bytes, set to zero | 786 | * @reserved: for future use, rounds structure size to 64 bytes, set to zero |
| 776 | * | 787 | * |
| 777 | * Hardware may use multiple helper window to process a video stream. | 788 | * Hardware may use multiple helper windows to process a video stream. |
| 778 | * The structure is used to exchange this selection areas between | 789 | * The structure is used to exchange this selection areas between |
| 779 | * an application and a driver. | 790 | * an application and a driver. |
| 780 | */ | 791 | */ |
| @@ -1125,6 +1136,7 @@ struct v4l2_ext_controls { | |||
| 1125 | #define V4L2_CTRL_CLASS_CAMERA 0x009a0000 /* Camera class controls */ | 1136 | #define V4L2_CTRL_CLASS_CAMERA 0x009a0000 /* Camera class controls */ |
| 1126 | #define V4L2_CTRL_CLASS_FM_TX 0x009b0000 /* FM Modulator control class */ | 1137 | #define V4L2_CTRL_CLASS_FM_TX 0x009b0000 /* FM Modulator control class */ |
| 1127 | #define V4L2_CTRL_CLASS_FLASH 0x009c0000 /* Camera flash controls */ | 1138 | #define V4L2_CTRL_CLASS_FLASH 0x009c0000 /* Camera flash controls */ |
| 1139 | #define V4L2_CTRL_CLASS_JPEG 0x009d0000 /* JPEG-compression controls */ | ||
| 1128 | 1140 | ||
| 1129 | #define V4L2_CTRL_ID_MASK (0x0fffffff) | 1141 | #define V4L2_CTRL_ID_MASK (0x0fffffff) |
| 1130 | #define V4L2_CTRL_ID2CLASS(id) ((id) & 0x0fff0000UL) | 1142 | #define V4L2_CTRL_ID2CLASS(id) ((id) & 0x0fff0000UL) |
| @@ -1396,6 +1408,16 @@ enum v4l2_mpeg_audio_ac3_bitrate { | |||
| 1396 | V4L2_MPEG_AUDIO_AC3_BITRATE_576K = 17, | 1408 | V4L2_MPEG_AUDIO_AC3_BITRATE_576K = 17, |
| 1397 | V4L2_MPEG_AUDIO_AC3_BITRATE_640K = 18, | 1409 | V4L2_MPEG_AUDIO_AC3_BITRATE_640K = 18, |
| 1398 | }; | 1410 | }; |
| 1411 | #define V4L2_CID_MPEG_AUDIO_DEC_PLAYBACK (V4L2_CID_MPEG_BASE+112) | ||
| 1412 | enum v4l2_mpeg_audio_dec_playback { | ||
| 1413 | V4L2_MPEG_AUDIO_DEC_PLAYBACK_AUTO = 0, | ||
| 1414 | V4L2_MPEG_AUDIO_DEC_PLAYBACK_STEREO = 1, | ||
| 1415 | V4L2_MPEG_AUDIO_DEC_PLAYBACK_LEFT = 2, | ||
| 1416 | V4L2_MPEG_AUDIO_DEC_PLAYBACK_RIGHT = 3, | ||
| 1417 | V4L2_MPEG_AUDIO_DEC_PLAYBACK_MONO = 4, | ||
| 1418 | V4L2_MPEG_AUDIO_DEC_PLAYBACK_SWAPPED_STEREO = 5, | ||
| 1419 | }; | ||
| 1420 | #define V4L2_CID_MPEG_AUDIO_DEC_MULTILINGUAL_PLAYBACK (V4L2_CID_MPEG_BASE+113) | ||
| 1399 | 1421 | ||
| 1400 | /* MPEG video controls specific to multiplexed streams */ | 1422 | /* MPEG video controls specific to multiplexed streams */ |
| 1401 | #define V4L2_CID_MPEG_VIDEO_ENCODING (V4L2_CID_MPEG_BASE+200) | 1423 | #define V4L2_CID_MPEG_VIDEO_ENCODING (V4L2_CID_MPEG_BASE+200) |
| @@ -1446,6 +1468,9 @@ enum v4l2_mpeg_video_multi_slice_mode { | |||
| 1446 | V4L2_MPEG_VIDEO_MULTI_SICE_MODE_MAX_BYTES = 2, | 1468 | V4L2_MPEG_VIDEO_MULTI_SICE_MODE_MAX_BYTES = 2, |
| 1447 | }; | 1469 | }; |
| 1448 | #define V4L2_CID_MPEG_VIDEO_VBV_SIZE (V4L2_CID_MPEG_BASE+222) | 1470 | #define V4L2_CID_MPEG_VIDEO_VBV_SIZE (V4L2_CID_MPEG_BASE+222) |
| 1471 | #define V4L2_CID_MPEG_VIDEO_DEC_PTS (V4L2_CID_MPEG_BASE+223) | ||
| 1472 | #define V4L2_CID_MPEG_VIDEO_DEC_FRAME (V4L2_CID_MPEG_BASE+224) | ||
| 1473 | |||
| 1449 | #define V4L2_CID_MPEG_VIDEO_H263_I_FRAME_QP (V4L2_CID_MPEG_BASE+300) | 1474 | #define V4L2_CID_MPEG_VIDEO_H263_I_FRAME_QP (V4L2_CID_MPEG_BASE+300) |
| 1450 | #define V4L2_CID_MPEG_VIDEO_H263_P_FRAME_QP (V4L2_CID_MPEG_BASE+301) | 1475 | #define V4L2_CID_MPEG_VIDEO_H263_P_FRAME_QP (V4L2_CID_MPEG_BASE+301) |
| 1451 | #define V4L2_CID_MPEG_VIDEO_H263_B_FRAME_QP (V4L2_CID_MPEG_BASE+302) | 1476 | #define V4L2_CID_MPEG_VIDEO_H263_B_FRAME_QP (V4L2_CID_MPEG_BASE+302) |
| @@ -1734,6 +1759,29 @@ enum v4l2_flash_strobe_source { | |||
| 1734 | #define V4L2_CID_FLASH_CHARGE (V4L2_CID_FLASH_CLASS_BASE + 11) | 1759 | #define V4L2_CID_FLASH_CHARGE (V4L2_CID_FLASH_CLASS_BASE + 11) |
| 1735 | #define V4L2_CID_FLASH_READY (V4L2_CID_FLASH_CLASS_BASE + 12) | 1760 | #define V4L2_CID_FLASH_READY (V4L2_CID_FLASH_CLASS_BASE + 12) |
| 1736 | 1761 | ||
| 1762 | /* JPEG-class control IDs defined by V4L2 */ | ||
| 1763 | #define V4L2_CID_JPEG_CLASS_BASE (V4L2_CTRL_CLASS_JPEG | 0x900) | ||
| 1764 | #define V4L2_CID_JPEG_CLASS (V4L2_CTRL_CLASS_JPEG | 1) | ||
| 1765 | |||
| 1766 | #define V4L2_CID_JPEG_CHROMA_SUBSAMPLING (V4L2_CID_JPEG_CLASS_BASE + 1) | ||
| 1767 | enum v4l2_jpeg_chroma_subsampling { | ||
| 1768 | V4L2_JPEG_CHROMA_SUBSAMPLING_444 = 0, | ||
| 1769 | V4L2_JPEG_CHROMA_SUBSAMPLING_422 = 1, | ||
| 1770 | V4L2_JPEG_CHROMA_SUBSAMPLING_420 = 2, | ||
| 1771 | V4L2_JPEG_CHROMA_SUBSAMPLING_411 = 3, | ||
| 1772 | V4L2_JPEG_CHROMA_SUBSAMPLING_410 = 4, | ||
| 1773 | V4L2_JPEG_CHROMA_SUBSAMPLING_GRAY = 5, | ||
| 1774 | }; | ||
| 1775 | #define V4L2_CID_JPEG_RESTART_INTERVAL (V4L2_CID_JPEG_CLASS_BASE + 2) | ||
| 1776 | #define V4L2_CID_JPEG_COMPRESSION_QUALITY (V4L2_CID_JPEG_CLASS_BASE + 3) | ||
| 1777 | |||
| 1778 | #define V4L2_CID_JPEG_ACTIVE_MARKER (V4L2_CID_JPEG_CLASS_BASE + 4) | ||
| 1779 | #define V4L2_JPEG_ACTIVE_MARKER_APP0 (1 << 0) | ||
| 1780 | #define V4L2_JPEG_ACTIVE_MARKER_APP1 (1 << 1) | ||
| 1781 | #define V4L2_JPEG_ACTIVE_MARKER_COM (1 << 16) | ||
| 1782 | #define V4L2_JPEG_ACTIVE_MARKER_DQT (1 << 17) | ||
| 1783 | #define V4L2_JPEG_ACTIVE_MARKER_DHT (1 << 18) | ||
| 1784 | |||
| 1737 | /* | 1785 | /* |
| 1738 | * T U N I N G | 1786 | * T U N I N G |
| 1739 | */ | 1787 | */ |
| @@ -1897,6 +1945,54 @@ struct v4l2_encoder_cmd { | |||
| 1897 | }; | 1945 | }; |
| 1898 | }; | 1946 | }; |
| 1899 | 1947 | ||
| 1948 | /* Decoder commands */ | ||
| 1949 | #define V4L2_DEC_CMD_START (0) | ||
| 1950 | #define V4L2_DEC_CMD_STOP (1) | ||
| 1951 | #define V4L2_DEC_CMD_PAUSE (2) | ||
| 1952 | #define V4L2_DEC_CMD_RESUME (3) | ||
| 1953 | |||
| 1954 | /* Flags for V4L2_DEC_CMD_START */ | ||
| 1955 | #define V4L2_DEC_CMD_START_MUTE_AUDIO (1 << 0) | ||
| 1956 | |||
| 1957 | /* Flags for V4L2_DEC_CMD_PAUSE */ | ||
| 1958 | #define V4L2_DEC_CMD_PAUSE_TO_BLACK (1 << 0) | ||
| 1959 | |||
| 1960 | /* Flags for V4L2_DEC_CMD_STOP */ | ||
| 1961 | #define V4L2_DEC_CMD_STOP_TO_BLACK (1 << 0) | ||
| 1962 | #define V4L2_DEC_CMD_STOP_IMMEDIATELY (1 << 1) | ||
| 1963 | |||
| 1964 | /* Play format requirements (returned by the driver): */ | ||
| 1965 | |||
| 1966 | /* The decoder has no special format requirements */ | ||
| 1967 | #define V4L2_DEC_START_FMT_NONE (0) | ||
| 1968 | /* The decoder requires full GOPs */ | ||
| 1969 | #define V4L2_DEC_START_FMT_GOP (1) | ||
| 1970 | |||
| 1971 | /* The structure must be zeroed before use by the application | ||
| 1972 | This ensures it can be extended safely in the future. */ | ||
| 1973 | struct v4l2_decoder_cmd { | ||
| 1974 | __u32 cmd; | ||
| 1975 | __u32 flags; | ||
| 1976 | union { | ||
| 1977 | struct { | ||
| 1978 | __u64 pts; | ||
| 1979 | } stop; | ||
| 1980 | |||
| 1981 | struct { | ||
| 1982 | /* 0 or 1000 specifies normal speed, | ||
| 1983 | 1 specifies forward single stepping, | ||
| 1984 | -1 specifies backward single stepping, | ||
| 1985 | >1: playback at speed/1000 of the normal speed, | ||
| 1986 | <-1: reverse playback at (-speed/1000) of the normal speed. */ | ||
| 1987 | __s32 speed; | ||
| 1988 | __u32 format; | ||
| 1989 | } start; | ||
| 1990 | |||
| 1991 | struct { | ||
| 1992 | __u32 data[16]; | ||
| 1993 | } raw; | ||
| 1994 | }; | ||
| 1995 | }; | ||
| 1900 | #endif | 1996 | #endif |
| 1901 | 1997 | ||
| 1902 | 1998 | ||
| @@ -2307,6 +2403,11 @@ struct v4l2_create_buffers { | |||
| 2307 | #define VIDIOC_G_SELECTION _IOWR('V', 94, struct v4l2_selection) | 2403 | #define VIDIOC_G_SELECTION _IOWR('V', 94, struct v4l2_selection) |
| 2308 | #define VIDIOC_S_SELECTION _IOWR('V', 95, struct v4l2_selection) | 2404 | #define VIDIOC_S_SELECTION _IOWR('V', 95, struct v4l2_selection) |
| 2309 | 2405 | ||
| 2406 | /* Experimental, these two ioctls may change over the next couple of kernel | ||
| 2407 | versions. */ | ||
| 2408 | #define VIDIOC_DECODER_CMD _IOWR('V', 96, struct v4l2_decoder_cmd) | ||
| 2409 | #define VIDIOC_TRY_DECODER_CMD _IOWR('V', 97, struct v4l2_decoder_cmd) | ||
| 2410 | |||
| 2310 | /* Reminder: when adding new ioctls please add support for them to | 2411 | /* Reminder: when adding new ioctls please add support for them to |
| 2311 | drivers/media/video/v4l2-compat-ioctl32.c as well! */ | 2412 | drivers/media/video/v4l2-compat-ioctl32.c as well! */ |
| 2312 | 2413 | ||
diff --git a/include/linux/virtio_config.h b/include/linux/virtio_config.h index 5206d6541da5..7323a3390206 100644 --- a/include/linux/virtio_config.h +++ b/include/linux/virtio_config.h | |||
| @@ -53,6 +53,7 @@ | |||
| 53 | 53 | ||
| 54 | #ifdef __KERNEL__ | 54 | #ifdef __KERNEL__ |
| 55 | #include <linux/err.h> | 55 | #include <linux/err.h> |
| 56 | #include <linux/bug.h> | ||
| 56 | #include <linux/virtio.h> | 57 | #include <linux/virtio.h> |
| 57 | 58 | ||
| 58 | /** | 59 | /** |
diff --git a/include/linux/virtio_ids.h b/include/linux/virtio_ids.h index 85bb0bb66ffc..c5d8455c68c0 100644 --- a/include/linux/virtio_ids.h +++ b/include/linux/virtio_ids.h | |||
| @@ -34,6 +34,7 @@ | |||
| 34 | #define VIRTIO_ID_CONSOLE 3 /* virtio console */ | 34 | #define VIRTIO_ID_CONSOLE 3 /* virtio console */ |
| 35 | #define VIRTIO_ID_RNG 4 /* virtio ring */ | 35 | #define VIRTIO_ID_RNG 4 /* virtio ring */ |
| 36 | #define VIRTIO_ID_BALLOON 5 /* virtio balloon */ | 36 | #define VIRTIO_ID_BALLOON 5 /* virtio balloon */ |
| 37 | #define VIRTIO_ID_SCSI 8 /* virtio scsi */ | ||
| 37 | #define VIRTIO_ID_9P 9 /* 9p virtio console */ | 38 | #define VIRTIO_ID_9P 9 /* 9p virtio console */ |
| 38 | 39 | ||
| 39 | #endif /* _LINUX_VIRTIO_IDS_H */ | 40 | #endif /* _LINUX_VIRTIO_IDS_H */ |
diff --git a/include/linux/virtio_scsi.h b/include/linux/virtio_scsi.h new file mode 100644 index 000000000000..8ddeafdc0546 --- /dev/null +++ b/include/linux/virtio_scsi.h | |||
| @@ -0,0 +1,114 @@ | |||
| 1 | #ifndef _LINUX_VIRTIO_SCSI_H | ||
| 2 | #define _LINUX_VIRTIO_SCSI_H | ||
| 3 | /* This header is BSD licensed so anyone can use the definitions to implement | ||
| 4 | * compatible drivers/servers. */ | ||
| 5 | |||
| 6 | #define VIRTIO_SCSI_CDB_SIZE 32 | ||
| 7 | #define VIRTIO_SCSI_SENSE_SIZE 96 | ||
| 8 | |||
| 9 | /* SCSI command request, followed by data-out */ | ||
| 10 | struct virtio_scsi_cmd_req { | ||
| 11 | u8 lun[8]; /* Logical Unit Number */ | ||
| 12 | u64 tag; /* Command identifier */ | ||
| 13 | u8 task_attr; /* Task attribute */ | ||
| 14 | u8 prio; | ||
| 15 | u8 crn; | ||
| 16 | u8 cdb[VIRTIO_SCSI_CDB_SIZE]; | ||
| 17 | } __packed; | ||
| 18 | |||
| 19 | /* Response, followed by sense data and data-in */ | ||
| 20 | struct virtio_scsi_cmd_resp { | ||
| 21 | u32 sense_len; /* Sense data length */ | ||
| 22 | u32 resid; /* Residual bytes in data buffer */ | ||
| 23 | u16 status_qualifier; /* Status qualifier */ | ||
| 24 | u8 status; /* Command completion status */ | ||
| 25 | u8 response; /* Response values */ | ||
| 26 | u8 sense[VIRTIO_SCSI_SENSE_SIZE]; | ||
| 27 | } __packed; | ||
| 28 | |||
| 29 | /* Task Management Request */ | ||
| 30 | struct virtio_scsi_ctrl_tmf_req { | ||
| 31 | u32 type; | ||
| 32 | u32 subtype; | ||
| 33 | u8 lun[8]; | ||
| 34 | u64 tag; | ||
| 35 | } __packed; | ||
| 36 | |||
| 37 | struct virtio_scsi_ctrl_tmf_resp { | ||
| 38 | u8 response; | ||
| 39 | } __packed; | ||
| 40 | |||
| 41 | /* Asynchronous notification query/subscription */ | ||
| 42 | struct virtio_scsi_ctrl_an_req { | ||
| 43 | u32 type; | ||
| 44 | u8 lun[8]; | ||
| 45 | u32 event_requested; | ||
| 46 | } __packed; | ||
| 47 | |||
| 48 | struct virtio_scsi_ctrl_an_resp { | ||
| 49 | u32 event_actual; | ||
| 50 | u8 response; | ||
| 51 | } __packed; | ||
| 52 | |||
| 53 | struct virtio_scsi_event { | ||
| 54 | u32 event; | ||
| 55 | u8 lun[8]; | ||
| 56 | u32 reason; | ||
| 57 | } __packed; | ||
| 58 | |||
| 59 | struct virtio_scsi_config { | ||
| 60 | u32 num_queues; | ||
| 61 | u32 seg_max; | ||
| 62 | u32 max_sectors; | ||
| 63 | u32 cmd_per_lun; | ||
| 64 | u32 event_info_size; | ||
| 65 | u32 sense_size; | ||
| 66 | u32 cdb_size; | ||
| 67 | u16 max_channel; | ||
| 68 | u16 max_target; | ||
| 69 | u32 max_lun; | ||
| 70 | } __packed; | ||
| 71 | |||
| 72 | /* Response codes */ | ||
| 73 | #define VIRTIO_SCSI_S_OK 0 | ||
| 74 | #define VIRTIO_SCSI_S_OVERRUN 1 | ||
| 75 | #define VIRTIO_SCSI_S_ABORTED 2 | ||
| 76 | #define VIRTIO_SCSI_S_BAD_TARGET 3 | ||
| 77 | #define VIRTIO_SCSI_S_RESET 4 | ||
| 78 | #define VIRTIO_SCSI_S_BUSY 5 | ||
| 79 | #define VIRTIO_SCSI_S_TRANSPORT_FAILURE 6 | ||
| 80 | #define VIRTIO_SCSI_S_TARGET_FAILURE 7 | ||
| 81 | #define VIRTIO_SCSI_S_NEXUS_FAILURE 8 | ||
| 82 | #define VIRTIO_SCSI_S_FAILURE 9 | ||
| 83 | #define VIRTIO_SCSI_S_FUNCTION_SUCCEEDED 10 | ||
| 84 | #define VIRTIO_SCSI_S_FUNCTION_REJECTED 11 | ||
| 85 | #define VIRTIO_SCSI_S_INCORRECT_LUN 12 | ||
| 86 | |||
| 87 | /* Controlq type codes. */ | ||
| 88 | #define VIRTIO_SCSI_T_TMF 0 | ||
| 89 | #define VIRTIO_SCSI_T_AN_QUERY 1 | ||
| 90 | #define VIRTIO_SCSI_T_AN_SUBSCRIBE 2 | ||
| 91 | |||
| 92 | /* Valid TMF subtypes. */ | ||
| 93 | #define VIRTIO_SCSI_T_TMF_ABORT_TASK 0 | ||
| 94 | #define VIRTIO_SCSI_T_TMF_ABORT_TASK_SET 1 | ||
| 95 | #define VIRTIO_SCSI_T_TMF_CLEAR_ACA 2 | ||
| 96 | #define VIRTIO_SCSI_T_TMF_CLEAR_TASK_SET 3 | ||
| 97 | #define VIRTIO_SCSI_T_TMF_I_T_NEXUS_RESET 4 | ||
| 98 | #define VIRTIO_SCSI_T_TMF_LOGICAL_UNIT_RESET 5 | ||
| 99 | #define VIRTIO_SCSI_T_TMF_QUERY_TASK 6 | ||
| 100 | #define VIRTIO_SCSI_T_TMF_QUERY_TASK_SET 7 | ||
| 101 | |||
| 102 | /* Events. */ | ||
| 103 | #define VIRTIO_SCSI_T_EVENTS_MISSED 0x80000000 | ||
| 104 | #define VIRTIO_SCSI_T_NO_EVENT 0 | ||
| 105 | #define VIRTIO_SCSI_T_TRANSPORT_RESET 1 | ||
| 106 | #define VIRTIO_SCSI_T_ASYNC_NOTIFY 2 | ||
| 107 | |||
| 108 | #define VIRTIO_SCSI_S_SIMPLE 0 | ||
| 109 | #define VIRTIO_SCSI_S_ORDERED 1 | ||
| 110 | #define VIRTIO_SCSI_S_HEAD 2 | ||
| 111 | #define VIRTIO_SCSI_S_ACA 3 | ||
| 112 | |||
| 113 | |||
| 114 | #endif /* _LINUX_VIRTIO_SCSI_H */ | ||
diff --git a/include/linux/vt_kern.h b/include/linux/vt_kern.h index c2164fad0083..e33d77f15bda 100644 --- a/include/linux/vt_kern.h +++ b/include/linux/vt_kern.h | |||
| @@ -167,4 +167,30 @@ extern int unregister_vt_notifier(struct notifier_block *nb); | |||
| 167 | 167 | ||
| 168 | extern void hide_boot_cursor(bool hide); | 168 | extern void hide_boot_cursor(bool hide); |
| 169 | 169 | ||
| 170 | /* keyboard provided interfaces */ | ||
| 171 | extern int vt_do_diacrit(unsigned int cmd, void __user *up, int eperm); | ||
| 172 | extern int vt_do_kdskbmode(int console, unsigned int arg); | ||
| 173 | extern int vt_do_kdskbmeta(int console, unsigned int arg); | ||
| 174 | extern int vt_do_kbkeycode_ioctl(int cmd, struct kbkeycode __user *user_kbkc, | ||
| 175 | int perm); | ||
| 176 | extern int vt_do_kdsk_ioctl(int cmd, struct kbentry __user *user_kbe, | ||
| 177 | int perm, int console); | ||
| 178 | extern int vt_do_kdgkb_ioctl(int cmd, struct kbsentry __user *user_kdgkb, | ||
| 179 | int perm); | ||
| 180 | extern int vt_do_kdskled(int console, int cmd, unsigned long arg, int perm); | ||
| 181 | extern int vt_do_kdgkbmode(int console); | ||
| 182 | extern int vt_do_kdgkbmeta(int console); | ||
| 183 | extern void vt_reset_unicode(int console); | ||
| 184 | extern int vt_get_shift_state(void); | ||
| 185 | extern void vt_reset_keyboard(int console); | ||
| 186 | extern int vt_get_leds(int console, int flag); | ||
| 187 | extern int vt_get_kbd_mode_bit(int console, int bit); | ||
| 188 | extern void vt_set_kbd_mode_bit(int console, int bit); | ||
| 189 | extern void vt_clr_kbd_mode_bit(int console, int bit); | ||
| 190 | extern void vt_set_led_state(int console, int leds); | ||
| 191 | extern void vt_set_led_state(int console, int leds); | ||
| 192 | extern void vt_kbd_con_start(int console); | ||
| 193 | extern void vt_kbd_con_stop(int console); | ||
| 194 | |||
| 195 | |||
| 170 | #endif /* _VT_KERN_H */ | 196 | #endif /* _VT_KERN_H */ |
diff --git a/include/linux/wait.h b/include/linux/wait.h index a9ce45e8501c..7d9a9e990ce6 100644 --- a/include/linux/wait.h +++ b/include/linux/wait.h | |||
| @@ -157,7 +157,7 @@ void __wake_up(wait_queue_head_t *q, unsigned int mode, int nr, void *key); | |||
| 157 | void __wake_up_locked_key(wait_queue_head_t *q, unsigned int mode, void *key); | 157 | void __wake_up_locked_key(wait_queue_head_t *q, unsigned int mode, void *key); |
| 158 | void __wake_up_sync_key(wait_queue_head_t *q, unsigned int mode, int nr, | 158 | void __wake_up_sync_key(wait_queue_head_t *q, unsigned int mode, int nr, |
| 159 | void *key); | 159 | void *key); |
| 160 | void __wake_up_locked(wait_queue_head_t *q, unsigned int mode); | 160 | void __wake_up_locked(wait_queue_head_t *q, unsigned int mode, int nr); |
| 161 | void __wake_up_sync(wait_queue_head_t *q, unsigned int mode, int nr); | 161 | void __wake_up_sync(wait_queue_head_t *q, unsigned int mode, int nr); |
| 162 | void __wake_up_bit(wait_queue_head_t *, void *, int); | 162 | void __wake_up_bit(wait_queue_head_t *, void *, int); |
| 163 | int __wait_on_bit(wait_queue_head_t *, struct wait_bit_queue *, int (*)(void *), unsigned); | 163 | int __wait_on_bit(wait_queue_head_t *, struct wait_bit_queue *, int (*)(void *), unsigned); |
| @@ -170,7 +170,8 @@ wait_queue_head_t *bit_waitqueue(void *, int); | |||
| 170 | #define wake_up(x) __wake_up(x, TASK_NORMAL, 1, NULL) | 170 | #define wake_up(x) __wake_up(x, TASK_NORMAL, 1, NULL) |
| 171 | #define wake_up_nr(x, nr) __wake_up(x, TASK_NORMAL, nr, NULL) | 171 | #define wake_up_nr(x, nr) __wake_up(x, TASK_NORMAL, nr, NULL) |
| 172 | #define wake_up_all(x) __wake_up(x, TASK_NORMAL, 0, NULL) | 172 | #define wake_up_all(x) __wake_up(x, TASK_NORMAL, 0, NULL) |
| 173 | #define wake_up_locked(x) __wake_up_locked((x), TASK_NORMAL) | 173 | #define wake_up_locked(x) __wake_up_locked((x), TASK_NORMAL, 1) |
| 174 | #define wake_up_all_locked(x) __wake_up_locked((x), TASK_NORMAL, 0) | ||
| 174 | 175 | ||
| 175 | #define wake_up_interruptible(x) __wake_up(x, TASK_INTERRUPTIBLE, 1, NULL) | 176 | #define wake_up_interruptible(x) __wake_up(x, TASK_INTERRUPTIBLE, 1, NULL) |
| 176 | #define wake_up_interruptible_nr(x, nr) __wake_up(x, TASK_INTERRUPTIBLE, nr, NULL) | 177 | #define wake_up_interruptible_nr(x, nr) __wake_up(x, TASK_INTERRUPTIBLE, nr, NULL) |
diff --git a/include/linux/wimax/debug.h b/include/linux/wimax/debug.h index 57031b4d12f2..aaf24ba12c4d 100644 --- a/include/linux/wimax/debug.h +++ b/include/linux/wimax/debug.h | |||
| @@ -154,9 +154,9 @@ | |||
| 154 | #define __debug__h__ | 154 | #define __debug__h__ |
| 155 | 155 | ||
| 156 | #include <linux/types.h> | 156 | #include <linux/types.h> |
| 157 | #include <linux/device.h> | ||
| 158 | #include <linux/slab.h> | 157 | #include <linux/slab.h> |
| 159 | 158 | ||
| 159 | struct device; | ||
| 160 | 160 | ||
| 161 | /* Backend stuff */ | 161 | /* Backend stuff */ |
| 162 | 162 | ||
diff --git a/include/linux/workqueue.h b/include/linux/workqueue.h index eb8b9f15f2e0..af155450cabb 100644 --- a/include/linux/workqueue.h +++ b/include/linux/workqueue.h | |||
| @@ -289,12 +289,16 @@ enum { | |||
| 289 | * | 289 | * |
| 290 | * system_freezable_wq is equivalent to system_wq except that it's | 290 | * system_freezable_wq is equivalent to system_wq except that it's |
| 291 | * freezable. | 291 | * freezable. |
| 292 | * | ||
| 293 | * system_nrt_freezable_wq is equivalent to system_nrt_wq except that | ||
| 294 | * it's freezable. | ||
| 292 | */ | 295 | */ |
| 293 | extern struct workqueue_struct *system_wq; | 296 | extern struct workqueue_struct *system_wq; |
| 294 | extern struct workqueue_struct *system_long_wq; | 297 | extern struct workqueue_struct *system_long_wq; |
| 295 | extern struct workqueue_struct *system_nrt_wq; | 298 | extern struct workqueue_struct *system_nrt_wq; |
| 296 | extern struct workqueue_struct *system_unbound_wq; | 299 | extern struct workqueue_struct *system_unbound_wq; |
| 297 | extern struct workqueue_struct *system_freezable_wq; | 300 | extern struct workqueue_struct *system_freezable_wq; |
| 301 | extern struct workqueue_struct *system_nrt_freezable_wq; | ||
| 298 | 302 | ||
| 299 | extern struct workqueue_struct * | 303 | extern struct workqueue_struct * |
| 300 | __alloc_workqueue_key(const char *fmt, unsigned int flags, int max_active, | 304 | __alloc_workqueue_key(const char *fmt, unsigned int flags, int max_active, |
diff --git a/include/linux/writeback.h b/include/linux/writeback.h index 995b8bf630ac..a2b84f598e2b 100644 --- a/include/linux/writeback.h +++ b/include/linux/writeback.h | |||
| @@ -64,7 +64,7 @@ struct writeback_control { | |||
| 64 | long pages_skipped; /* Pages which were not written */ | 64 | long pages_skipped; /* Pages which were not written */ |
| 65 | 65 | ||
| 66 | /* | 66 | /* |
| 67 | * For a_ops->writepages(): is start or end are non-zero then this is | 67 | * For a_ops->writepages(): if start or end are non-zero then this is |
| 68 | * a hint that the filesystem need only write out the pages inside that | 68 | * a hint that the filesystem need only write out the pages inside that |
| 69 | * byterange. The byte at `end' is included in the writeout request. | 69 | * byterange. The byte at `end' is included in the writeout request. |
| 70 | */ | 70 | */ |
