Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Merge branch 'gic-fasteoi' of git://linux-arm.org/linux-2.6-wd into devel-stable

+1951 -1585
+2 -2
Documentation/flexible-arrays.txt
··· 66 66 entering atomic context, using: 67 67 68 68 int flex_array_prealloc(struct flex_array *array, unsigned int start, 69 - unsigned int end, gfp_t flags); 69 + unsigned int nr_elements, gfp_t flags); 70 70 71 71 This function will ensure that memory for the elements indexed in the range 72 - defined by start and end has been allocated. Thereafter, a 72 + defined by start and nr_elements has been allocated. Thereafter, a 73 73 flex_array_put() call on an element in that range is guaranteed not to 74 74 block. 75 75
+1 -1
Makefile
··· 1 1 VERSION = 2 2 2 PATCHLEVEL = 6 3 3 SUBLEVEL = 39 4 - EXTRAVERSION = -rc5 4 + EXTRAVERSION = -rc7 5 5 NAME = Flesh-Eating Bats with Fangs 6 6 7 7 # *DOCUMENTATION*
+45 -39
arch/arm/common/gic.c
··· 49 49 * Default make them NULL. 50 50 */ 51 51 struct irq_chip gic_arch_extn = { 52 - .irq_ack = NULL, 52 + .irq_eoi = NULL, 53 53 .irq_mask = NULL, 54 54 .irq_unmask = NULL, 55 55 .irq_retrigger = NULL, ··· 84 84 /* 85 85 * Routines to acknowledge, disable and enable interrupts 86 86 */ 87 - static void gic_ack_irq(struct irq_data *d) 88 - { 89 - spin_lock(&irq_controller_lock); 90 - if (gic_arch_extn.irq_ack) 91 - gic_arch_extn.irq_ack(d); 92 - writel(gic_irq(d), gic_cpu_base(d) + GIC_CPU_EOI); 93 - spin_unlock(&irq_controller_lock); 94 - } 95 - 96 87 static void gic_mask_irq(struct irq_data *d) 97 88 { 98 89 u32 mask = 1 << (d->irq % 32); 99 90 100 91 spin_lock(&irq_controller_lock); 101 - writel(mask, gic_dist_base(d) + GIC_DIST_ENABLE_CLEAR + (gic_irq(d) / 32) * 4); 92 + writel_relaxed(mask, gic_dist_base(d) + GIC_DIST_ENABLE_CLEAR + (gic_irq(d) / 32) * 4); 102 93 if (gic_arch_extn.irq_mask) 103 94 gic_arch_extn.irq_mask(d); 104 95 spin_unlock(&irq_controller_lock); ··· 102 111 spin_lock(&irq_controller_lock); 103 112 if (gic_arch_extn.irq_unmask) 104 113 gic_arch_extn.irq_unmask(d); 105 - writel(mask, gic_dist_base(d) + GIC_DIST_ENABLE_SET + (gic_irq(d) / 32) * 4); 114 + writel_relaxed(mask, gic_dist_base(d) + GIC_DIST_ENABLE_SET + (gic_irq(d) / 32) * 4); 106 115 spin_unlock(&irq_controller_lock); 116 + } 117 + 118 + static void gic_eoi_irq(struct irq_data *d) 119 + { 120 + if (gic_arch_extn.irq_eoi) { 121 + spin_lock(&irq_controller_lock); 122 + gic_arch_extn.irq_eoi(d); 123 + spin_unlock(&irq_controller_lock); 124 + } 125 + 126 + writel_relaxed(gic_irq(d), gic_cpu_base(d) + GIC_CPU_EOI); 107 127 } 108 128 109 129 static int gic_set_type(struct irq_data *d, unsigned int type) ··· 140 138 if (gic_arch_extn.irq_set_type) 141 139 gic_arch_extn.irq_set_type(d, type); 142 140 143 - val = readl(base + GIC_DIST_CONFIG + confoff); 141 + val = readl_relaxed(base + GIC_DIST_CONFIG + confoff); 144 142 if (type == IRQ_TYPE_LEVEL_HIGH) 145 143 val &= ~confmask; 146 144 else if (type == IRQ_TYPE_EDGE_RISING) ··· 150 148 * As recommended by the spec, disable the interrupt before changing 151 149 * the configuration 152 150 */ 153 - if (readl(base + GIC_DIST_ENABLE_SET + enableoff) & enablemask) { 154 - writel(enablemask, base + GIC_DIST_ENABLE_CLEAR + enableoff); 151 + if (readl_relaxed(base + GIC_DIST_ENABLE_SET + enableoff) & enablemask) { 152 + writel_relaxed(enablemask, base + GIC_DIST_ENABLE_CLEAR + enableoff); 155 153 enabled = true; 156 154 } 157 155 158 - writel(val, base + GIC_DIST_CONFIG + confoff); 156 + writel_relaxed(val, base + GIC_DIST_CONFIG + confoff); 159 157 160 158 if (enabled) 161 - writel(enablemask, base + GIC_DIST_ENABLE_SET + enableoff); 159 + writel_relaxed(enablemask, base + GIC_DIST_ENABLE_SET + enableoff); 162 160 163 161 spin_unlock(&irq_controller_lock); 164 162 ··· 190 188 191 189 spin_lock(&irq_controller_lock); 192 190 d->node = cpu; 193 - val = readl(reg) & ~mask; 194 - writel(val | bit, reg); 191 + val = readl_relaxed(reg) & ~mask; 192 + writel_relaxed(val | bit, reg); 195 193 spin_unlock(&irq_controller_lock); 196 194 197 195 return 0; ··· 220 218 unsigned int cascade_irq, gic_irq; 221 219 unsigned long status; 222 220 223 - /* primary controller ack'ing */ 224 - chip->irq_ack(&desc->irq_data); 221 + chained_irq_enter(chip, desc); 225 222 226 223 spin_lock(&irq_controller_lock); 227 - status = readl(chip_data->cpu_base + GIC_CPU_INTACK); 224 + status = readl_relaxed(chip_data->cpu_base + GIC_CPU_INTACK); 228 225 spin_unlock(&irq_controller_lock); 229 226 230 227 gic_irq = (status & 0x3ff); ··· 237 236 generic_handle_irq(cascade_irq); 238 237 239 238 out: 240 - /* primary controller unmasking */ 241 - chip->irq_unmask(&desc->irq_data); 239 + chained_irq_exit(chip, desc); 242 240 } 243 241 244 242 static struct irq_chip gic_chip = { 245 243 .name = "GIC", 246 - .irq_ack = gic_ack_irq, 247 244 .irq_mask = gic_mask_irq, 248 245 .irq_unmask = gic_unmask_irq, 246 + .irq_eoi = gic_eoi_irq, 249 247 .irq_set_type = gic_set_type, 250 248 .irq_retrigger = gic_retrigger, 251 249 #ifdef CONFIG_SMP ··· 272 272 cpumask |= cpumask << 8; 273 273 cpumask |= cpumask << 16; 274 274 275 - writel(0, base + GIC_DIST_CTRL); 275 + writel_relaxed(0, base + GIC_DIST_CTRL); 276 276 277 277 /* 278 278 * Find out how many interrupts are supported. 279 279 * The GIC only supports up to 1020 interrupt sources. 280 280 */ 281 - gic_irqs = readl(base + GIC_DIST_CTR) & 0x1f; 281 + gic_irqs = readl_relaxed(base + GIC_DIST_CTR) & 0x1f; 282 282 gic_irqs = (gic_irqs + 1) * 32; 283 283 if (gic_irqs > 1020) 284 284 gic_irqs = 1020; ··· 287 287 * Set all global interrupts to be level triggered, active low. 288 288 */ 289 289 for (i = 32; i < gic_irqs; i += 16) 290 - writel(0, base + GIC_DIST_CONFIG + i * 4 / 16); 290 + writel_relaxed(0, base + GIC_DIST_CONFIG + i * 4 / 16); 291 291 292 292 /* 293 293 * Set all global interrupts to this CPU only. 294 294 */ 295 295 for (i = 32; i < gic_irqs; i += 4) 296 - writel(cpumask, base + GIC_DIST_TARGET + i * 4 / 4); 296 + writel_relaxed(cpumask, base + GIC_DIST_TARGET + i * 4 / 4); 297 297 298 298 /* 299 299 * Set priority on all global interrupts. 300 300 */ 301 301 for (i = 32; i < gic_irqs; i += 4) 302 - writel(0xa0a0a0a0, base + GIC_DIST_PRI + i * 4 / 4); 302 + writel_relaxed(0xa0a0a0a0, base + GIC_DIST_PRI + i * 4 / 4); 303 303 304 304 /* 305 305 * Disable all interrupts. Leave the PPI and SGIs alone 306 306 * as these enables are banked registers. 307 307 */ 308 308 for (i = 32; i < gic_irqs; i += 32) 309 - writel(0xffffffff, base + GIC_DIST_ENABLE_CLEAR + i * 4 / 32); 309 + writel_relaxed(0xffffffff, base + GIC_DIST_ENABLE_CLEAR + i * 4 / 32); 310 310 311 311 /* 312 312 * Limit number of interrupts registered to the platform maximum ··· 319 319 * Setup the Linux IRQ subsystem. 320 320 */ 321 321 for (i = irq_start; i < irq_limit; i++) { 322 - irq_set_chip_and_handler(i, &gic_chip, handle_level_irq); 322 + irq_set_chip_and_handler(i, &gic_chip, handle_fasteoi_irq); 323 323 irq_set_chip_data(i, gic); 324 324 set_irq_flags(i, IRQF_VALID | IRQF_PROBE); 325 325 } 326 326 327 - writel(1, base + GIC_DIST_CTRL); 327 + writel_relaxed(1, base + GIC_DIST_CTRL); 328 328 } 329 329 330 330 static void __cpuinit gic_cpu_init(struct gic_chip_data *gic) ··· 337 337 * Deal with the banked PPI and SGI interrupts - disable all 338 338 * PPI interrupts, ensure all SGI interrupts are enabled. 339 339 */ 340 - writel(0xffff0000, dist_base + GIC_DIST_ENABLE_CLEAR); 341 - writel(0x0000ffff, dist_base + GIC_DIST_ENABLE_SET); 340 + writel_relaxed(0xffff0000, dist_base + GIC_DIST_ENABLE_CLEAR); 341 + writel_relaxed(0x0000ffff, dist_base + GIC_DIST_ENABLE_SET); 342 342 343 343 /* 344 344 * Set priority on PPI and SGI interrupts 345 345 */ 346 346 for (i = 0; i < 32; i += 4) 347 - writel(0xa0a0a0a0, dist_base + GIC_DIST_PRI + i * 4 / 4); 347 + writel_relaxed(0xa0a0a0a0, dist_base + GIC_DIST_PRI + i * 4 / 4); 348 348 349 - writel(0xf0, base + GIC_CPU_PRIMASK); 350 - writel(1, base + GIC_CPU_CTRL); 349 + writel_relaxed(0xf0, base + GIC_CPU_PRIMASK); 350 + writel_relaxed(1, base + GIC_CPU_CTRL); 351 351 } 352 352 353 353 void __init gic_init(unsigned int gic_nr, unsigned int irq_start, ··· 391 391 { 392 392 unsigned long map = *cpus_addr(*mask); 393 393 394 + /* 395 + * Ensure that stores to Normal memory are visible to the 396 + * other CPUs before issuing the IPI. 397 + */ 398 + dsb(); 399 + 394 400 /* this always happens on GIC0 */ 395 - writel(map << 16 | irq, gic_data[0].dist_base + GIC_DIST_SOFTINT); 401 + writel_relaxed(map << 16 | irq, gic_data[0].dist_base + GIC_DIST_SOFTINT); 396 402 } 397 403 #endif
+48
arch/arm/configs/at91x40_defconfig
··· 1 + CONFIG_EXPERIMENTAL=y 2 + CONFIG_LOG_BUF_SHIFT=14 3 + CONFIG_EMBEDDED=y 4 + # CONFIG_HOTPLUG is not set 5 + # CONFIG_ELF_CORE is not set 6 + # CONFIG_FUTEX is not set 7 + # CONFIG_TIMERFD is not set 8 + # CONFIG_VM_EVENT_COUNTERS is not set 9 + # CONFIG_COMPAT_BRK is not set 10 + CONFIG_SLAB=y 11 + # CONFIG_LBDAF is not set 12 + # CONFIG_BLK_DEV_BSG is not set 13 + # CONFIG_IOSCHED_DEADLINE is not set 14 + # CONFIG_IOSCHED_CFQ is not set 15 + # CONFIG_MMU is not set 16 + CONFIG_ARCH_AT91=y 17 + CONFIG_ARCH_AT91X40=y 18 + CONFIG_MACH_AT91EB01=y 19 + CONFIG_AT91_EARLY_USART0=y 20 + CONFIG_CPU_ARM7TDMI=y 21 + CONFIG_SET_MEM_PARAM=y 22 + CONFIG_DRAM_BASE=0x01000000 23 + CONFIG_DRAM_SIZE=0x00400000 24 + CONFIG_FLASH_MEM_BASE=0x01400000 25 + CONFIG_PROCESSOR_ID=0x14000040 26 + CONFIG_ZBOOT_ROM_TEXT=0x0 27 + CONFIG_ZBOOT_ROM_BSS=0x0 28 + CONFIG_BINFMT_FLAT=y 29 + # CONFIG_SUSPEND is not set 30 + # CONFIG_FW_LOADER is not set 31 + CONFIG_MTD=y 32 + CONFIG_MTD_PARTITIONS=y 33 + CONFIG_MTD_CHAR=y 34 + CONFIG_MTD_BLOCK=y 35 + CONFIG_MTD_RAM=y 36 + CONFIG_MTD_ROM=y 37 + CONFIG_BLK_DEV_RAM=y 38 + # CONFIG_INPUT is not set 39 + # CONFIG_SERIO is not set 40 + # CONFIG_VT is not set 41 + # CONFIG_DEVKMEM is not set 42 + # CONFIG_HW_RANDOM is not set 43 + # CONFIG_HWMON is not set 44 + # CONFIG_USB_SUPPORT is not set 45 + CONFIG_EXT2_FS=y 46 + # CONFIG_DNOTIFY is not set 47 + CONFIG_ROMFS_FS=y 48 + # CONFIG_ENABLE_MUST_CHECK is not set
+8
arch/arm/kernel/ptrace.c
··· 767 767 768 768 #ifdef CONFIG_HAVE_HW_BREAKPOINT 769 769 case PTRACE_GETHBPREGS: 770 + if (ptrace_get_breakpoints(child) < 0) 771 + return -ESRCH; 772 + 770 773 ret = ptrace_gethbpregs(child, addr, 771 774 (unsigned long __user *)data); 775 + ptrace_put_breakpoints(child); 772 776 break; 773 777 case PTRACE_SETHBPREGS: 778 + if (ptrace_get_breakpoints(child) < 0) 779 + return -ESRCH; 780 + 774 781 ret = ptrace_sethbpregs(child, addr, 775 782 (unsigned long __user *)data); 783 + ptrace_put_breakpoints(child); 776 784 break; 777 785 #endif 778 786
+1
arch/arm/mach-at91/Kconfig
··· 83 83 select CPU_ARM926T 84 84 select GENERIC_CLOCKEVENTS 85 85 select HAVE_FB_ATMEL 86 + select HAVE_NET_MACB 86 87 87 88 config ARCH_AT572D940HF 88 89 bool "AT572D940HF"
+6 -1
arch/arm/mach-at91/board-eb01.c
··· 30 30 #include <mach/board.h> 31 31 #include "generic.h" 32 32 33 + static void __init at91eb01_init_irq(void) 34 + { 35 + at91x40_init_interrupts(NULL); 36 + } 37 + 33 38 static void __init at91eb01_map_io(void) 34 39 { 35 40 at91x40_initialize(40000000); ··· 43 38 MACHINE_START(AT91EB01, "Atmel AT91 EB01") 44 39 /* Maintainer: Greg Ungerer <gerg@snapgear.com> */ 45 40 .timer = &at91x40_timer, 46 - .init_irq = at91x40_init_interrupts, 41 + .init_irq = at91eb01_init_irq, 47 42 .map_io = at91eb01_map_io, 48 43 MACHINE_END 49 44
+28
arch/arm/mach-at91/include/mach/cpu.h
··· 27 27 #define ARCH_ID_AT91SAM9G45 0x819b05a0 28 28 #define ARCH_ID_AT91SAM9G45MRL 0x819b05a2 /* aka 9G45-ES2 & non ES lots */ 29 29 #define ARCH_ID_AT91SAM9G45ES 0x819b05a1 /* 9G45-ES (Engineering Sample) */ 30 + #define ARCH_ID_AT91SAM9X5 0x819a05a0 30 31 #define ARCH_ID_AT91CAP9 0x039A03A0 31 32 32 33 #define ARCH_ID_AT91SAM9XE128 0x329973a0 ··· 55 54 #define ARCH_EXID_AT91SAM9M10 0x00000002 56 55 #define ARCH_EXID_AT91SAM9G46 0x00000003 57 56 #define ARCH_EXID_AT91SAM9G45 0x00000004 57 + 58 + #define ARCH_EXID_AT91SAM9G15 0x00000000 59 + #define ARCH_EXID_AT91SAM9G35 0x00000001 60 + #define ARCH_EXID_AT91SAM9X35 0x00000002 61 + #define ARCH_EXID_AT91SAM9G25 0x00000003 62 + #define ARCH_EXID_AT91SAM9X25 0x00000004 58 63 59 64 static inline unsigned long at91_exid_identify(void) 60 65 { ··· 148 141 #define cpu_is_at91sam9m10() (0) 149 142 #define cpu_is_at91sam9g46() (0) 150 143 #define cpu_is_at91sam9m11() (0) 144 + #endif 145 + 146 + #ifdef CONFIG_ARCH_AT91SAM9X5 147 + #define cpu_is_at91sam9x5() (at91_cpu_identify() == ARCH_ID_AT91SAM9X5) 148 + #define cpu_is_at91sam9g15() (cpu_is_at91sam9x5() && \ 149 + (at91_exid_identify() == ARCH_EXID_AT91SAM9G15)) 150 + #define cpu_is_at91sam9g35() (cpu_is_at91sam9x5() && \ 151 + (at91_exid_identify() == ARCH_EXID_AT91SAM9G35)) 152 + #define cpu_is_at91sam9x35() (cpu_is_at91sam9x5() && \ 153 + (at91_exid_identify() == ARCH_EXID_AT91SAM9X35)) 154 + #define cpu_is_at91sam9g25() (cpu_is_at91sam9x5() && \ 155 + (at91_exid_identify() == ARCH_EXID_AT91SAM9G25)) 156 + #define cpu_is_at91sam9x25() (cpu_is_at91sam9x5() && \ 157 + (at91_exid_identify() == ARCH_EXID_AT91SAM9X25)) 158 + #else 159 + #define cpu_is_at91sam9x5() (0) 160 + #define cpu_is_at91sam9g15() (0) 161 + #define cpu_is_at91sam9g35() (0) 162 + #define cpu_is_at91sam9x35() (0) 163 + #define cpu_is_at91sam9g25() (0) 164 + #define cpu_is_at91sam9x25() (0) 151 165 #endif 152 166 153 167 #ifdef CONFIG_ARCH_AT91CAP9
+2 -4
arch/arm/mach-exynos4/irq-combiner.c
··· 59 59 unsigned int cascade_irq, combiner_irq; 60 60 unsigned long status; 61 61 62 - /* primary controller ack'ing */ 63 - chip->irq_ack(&desc->irq_data); 62 + chained_irq_enter(chip, desc); 64 63 65 64 spin_lock(&irq_controller_lock); 66 65 status = __raw_readl(chip_data->base + COMBINER_INT_STATUS); ··· 78 79 generic_handle_irq(cascade_irq); 79 80 80 81 out: 81 - /* primary controller unmasking */ 82 - chip->irq_unmask(&desc->irq_data); 82 + chained_irq_exit(chip, desc); 83 83 } 84 84 85 85 static struct irq_chip combiner_chip = {
+8 -2
arch/arm/mach-msm/gpio-v2.c
··· 27 27 #include <linux/module.h> 28 28 #include <linux/platform_device.h> 29 29 #include <linux/spinlock.h> 30 + 31 + #include <asm/mach/irq.h> 32 + 30 33 #include <mach/msm_iomap.h> 31 34 #include "gpiomux.h" 32 35 ··· 312 309 */ 313 310 static void msm_summary_irq_handler(unsigned int irq, struct irq_desc *desc) 314 311 { 315 - struct irq_data *data = irq_desc_get_irq_data(desc); 316 312 unsigned long i; 313 + struct irq_chip *chip = irq_desc_get_chip(desc); 314 + 315 + chained_irq_enter(chip, desc); 317 316 318 317 for (i = find_first_bit(msm_gpio.enabled_irqs, NR_GPIO_IRQS); 319 318 i < NR_GPIO_IRQS; ··· 324 319 generic_handle_irq(msm_gpio_to_irq(&msm_gpio.gpio_chip, 325 320 i)); 326 321 } 327 - data->chip->irq_ack(data); 322 + 323 + chained_irq_exit(chip, desc); 328 324 } 329 325 330 326 static int msm_gpio_irq_set_wake(struct irq_data *d, unsigned int on)
+1 -1
arch/arm/mach-tegra/Makefile
··· 1 1 obj-y += common.o 2 2 obj-y += devices.o 3 3 obj-y += io.o 4 - obj-y += irq.o legacy_irq.o 4 + obj-y += irq.o 5 5 obj-y += clock.o 6 6 obj-y += timer.o 7 7 obj-y += gpio.o
+6 -3
arch/arm/mach-tegra/gpio.c
··· 24 24 #include <linux/io.h> 25 25 #include <linux/gpio.h> 26 26 27 + #include <asm/mach/irq.h> 28 + 27 29 #include <mach/iomap.h> 28 30 #include <mach/suspend.h> 29 31 ··· 223 221 int port; 224 222 int pin; 225 223 int unmasked = 0; 224 + struct irq_chip *chip = irq_desc_get_chip(desc); 226 225 227 - desc->irq_data.chip->irq_ack(&desc->irq_data); 226 + chained_irq_enter(chip, desc); 228 227 229 228 bank = irq_get_handler_data(irq); 230 229 ··· 244 241 */ 245 242 if (lvl & (0x100 << pin)) { 246 243 unmasked = 1; 247 - desc->irq_data.chip->irq_unmask(&desc->irq_data); 244 + chained_irq_exit(chip, desc); 248 245 } 249 246 250 247 generic_handle_irq(gpio_to_irq(gpio + pin)); ··· 252 249 } 253 250 254 251 if (!unmasked) 255 - desc->irq_data.chip->irq_unmask(&desc->irq_data); 252 + chained_irq_exit(chip, desc); 256 253 257 254 } 258 255
-35
arch/arm/mach-tegra/include/mach/legacy_irq.h
··· 1 - /* 2 - * arch/arm/mach-tegra/include/mach/legacy_irq.h 3 - * 4 - * Copyright (C) 2010 Google, Inc. 5 - * Author: Colin Cross <ccross@android.com> 6 - * 7 - * This software is licensed under the terms of the GNU General Public 8 - * License version 2, as published by the Free Software Foundation, and 9 - * may be copied, distributed, and modified under those terms. 10 - * 11 - * This program is distributed in the hope that it will be useful, 12 - * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 - * GNU General Public License for more details. 15 - * 16 - */ 17 - 18 - #ifndef _ARCH_ARM_MACH_TEGRA_LEGARY_IRQ_H 19 - #define _ARCH_ARM_MACH_TEGRA_LEGARY_IRQ_H 20 - 21 - void tegra_legacy_mask_irq(unsigned int irq); 22 - void tegra_legacy_unmask_irq(unsigned int irq); 23 - void tegra_legacy_select_fiq(unsigned int irq, bool fiq); 24 - void tegra_legacy_force_irq_set(unsigned int irq); 25 - void tegra_legacy_force_irq_clr(unsigned int irq); 26 - int tegra_legacy_force_irq_status(unsigned int irq); 27 - void tegra_legacy_select_fiq(unsigned int irq, bool fiq); 28 - unsigned long tegra_legacy_vfiq(int nr); 29 - unsigned long tegra_legacy_class(int nr); 30 - int tegra_legacy_irq_set_wake(int irq, int enable); 31 - void tegra_legacy_irq_set_lp1_wake_mask(void); 32 - void tegra_legacy_irq_restore_mask(void); 33 - void tegra_init_legacy_irq(void); 34 - 35 - #endif
+72 -98
arch/arm/mach-tegra/irq.c
··· 1 1 /* 2 - * Copyright (C) 2010 Google, Inc. 2 + * Copyright (C) 2011 Google, Inc. 3 3 * 4 4 * Author: 5 - * Colin Cross <ccross@google.com> 5 + * Colin Cross <ccross@android.com> 6 6 * 7 7 * Copyright (C) 2010, NVIDIA Corporation 8 8 * ··· 18 18 */ 19 19 20 20 #include <linux/kernel.h> 21 - #include <linux/delay.h> 22 - #include <linux/init.h> 23 21 #include <linux/interrupt.h> 24 22 #include <linux/irq.h> 25 23 #include <linux/io.h> ··· 25 27 #include <asm/hardware/gic.h> 26 28 27 29 #include <mach/iomap.h> 28 - #include <mach/legacy_irq.h> 29 - #include <mach/suspend.h> 30 30 31 31 #include "board.h" 32 32 33 - #define PMC_CTRL 0x0 34 - #define PMC_CTRL_LATCH_WAKEUPS (1 << 5) 35 - #define PMC_WAKE_MASK 0xc 36 - #define PMC_WAKE_LEVEL 0x10 37 - #define PMC_WAKE_STATUS 0x14 38 - #define PMC_SW_WAKE_STATUS 0x18 39 - #define PMC_DPD_SAMPLE 0x20 33 + #define INT_SYS_NR (INT_GPIO_BASE - INT_PRI_BASE) 34 + #define INT_SYS_SZ (INT_SEC_BASE - INT_PRI_BASE) 35 + #define PPI_NR ((INT_SYS_NR+INT_SYS_SZ-1)/INT_SYS_SZ) 40 36 41 - static void __iomem *pmc = IO_ADDRESS(TEGRA_PMC_BASE); 37 + #define ICTLR_CPU_IEP_VFIQ 0x08 38 + #define ICTLR_CPU_IEP_FIR 0x14 39 + #define ICTLR_CPU_IEP_FIR_SET 0x18 40 + #define ICTLR_CPU_IEP_FIR_CLR 0x1c 42 41 43 - static u32 tegra_lp0_wake_enb; 44 - static u32 tegra_lp0_wake_level; 45 - static u32 tegra_lp0_wake_level_any; 42 + #define ICTLR_CPU_IER 0x20 43 + #define ICTLR_CPU_IER_SET 0x24 44 + #define ICTLR_CPU_IER_CLR 0x28 45 + #define ICTLR_CPU_IEP_CLASS 0x2C 46 46 47 - static void (*tegra_gic_mask_irq)(struct irq_data *d); 48 - static void (*tegra_gic_unmask_irq)(struct irq_data *d); 49 - static void (*tegra_gic_ack_irq)(struct irq_data *d); 47 + #define ICTLR_COP_IER 0x30 48 + #define ICTLR_COP_IER_SET 0x34 49 + #define ICTLR_COP_IER_CLR 0x38 50 + #define ICTLR_COP_IEP_CLASS 0x3c 50 51 51 - /* ensures that sufficient time is passed for a register write to 52 - * serialize into the 32KHz domain */ 53 - static void pmc_32kwritel(u32 val, unsigned long offs) 52 + #define NUM_ICTLRS 4 53 + #define FIRST_LEGACY_IRQ 32 54 + 55 + static void __iomem *ictlr_reg_base[] = { 56 + IO_ADDRESS(TEGRA_PRIMARY_ICTLR_BASE), 57 + IO_ADDRESS(TEGRA_SECONDARY_ICTLR_BASE), 58 + IO_ADDRESS(TEGRA_TERTIARY_ICTLR_BASE), 59 + IO_ADDRESS(TEGRA_QUATERNARY_ICTLR_BASE), 60 + }; 61 + 62 + static inline void tegra_irq_write_mask(unsigned int irq, unsigned long reg) 54 63 { 55 - writel(val, pmc + offs); 56 - udelay(130); 57 - } 64 + void __iomem *base; 65 + u32 mask; 58 66 59 - int tegra_set_lp1_wake(int irq, int enable) 60 - { 61 - return tegra_legacy_irq_set_wake(irq, enable); 62 - } 67 + BUG_ON(irq < FIRST_LEGACY_IRQ || 68 + irq >= FIRST_LEGACY_IRQ + NUM_ICTLRS * 32); 63 69 64 - void tegra_set_lp0_wake_pads(u32 wake_enb, u32 wake_level, u32 wake_any) 65 - { 66 - u32 temp; 67 - u32 status; 68 - u32 lvl; 70 + base = ictlr_reg_base[(irq - FIRST_LEGACY_IRQ) / 32]; 71 + mask = BIT((irq - FIRST_LEGACY_IRQ) % 32); 69 72 70 - wake_level &= wake_enb; 71 - wake_any &= wake_enb; 72 - 73 - wake_level |= (tegra_lp0_wake_level & tegra_lp0_wake_enb); 74 - wake_any |= (tegra_lp0_wake_level_any & tegra_lp0_wake_enb); 75 - 76 - wake_enb |= tegra_lp0_wake_enb; 77 - 78 - pmc_32kwritel(0, PMC_SW_WAKE_STATUS); 79 - temp = readl(pmc + PMC_CTRL); 80 - temp |= PMC_CTRL_LATCH_WAKEUPS; 81 - pmc_32kwritel(temp, PMC_CTRL); 82 - temp &= ~PMC_CTRL_LATCH_WAKEUPS; 83 - pmc_32kwritel(temp, PMC_CTRL); 84 - status = readl(pmc + PMC_SW_WAKE_STATUS); 85 - lvl = readl(pmc + PMC_WAKE_LEVEL); 86 - 87 - /* flip the wakeup trigger for any-edge triggered pads 88 - * which are currently asserting as wakeups */ 89 - lvl ^= status; 90 - lvl &= wake_any; 91 - 92 - wake_level |= lvl; 93 - 94 - writel(wake_level, pmc + PMC_WAKE_LEVEL); 95 - /* Enable DPD sample to trigger sampling pads data and direction 96 - * in which pad will be driven during lp0 mode*/ 97 - writel(0x1, pmc + PMC_DPD_SAMPLE); 98 - 99 - writel(wake_enb, pmc + PMC_WAKE_MASK); 73 + __raw_writel(mask, base + reg); 100 74 } 101 75 102 76 static void tegra_mask(struct irq_data *d) 103 77 { 104 - tegra_gic_mask_irq(d); 105 - tegra_legacy_mask_irq(d->irq); 78 + if (d->irq < FIRST_LEGACY_IRQ) 79 + return; 80 + 81 + tegra_irq_write_mask(d->irq, ICTLR_CPU_IER_CLR); 106 82 } 107 83 108 84 static void tegra_unmask(struct irq_data *d) 109 85 { 110 - tegra_gic_unmask_irq(d); 111 - tegra_legacy_unmask_irq(d->irq); 86 + if (d->irq < FIRST_LEGACY_IRQ) 87 + return; 88 + 89 + tegra_irq_write_mask(d->irq, ICTLR_CPU_IER_SET); 112 90 } 113 91 114 92 static void tegra_ack(struct irq_data *d) 115 93 { 116 - tegra_legacy_force_irq_clr(d->irq); 117 - tegra_gic_ack_irq(d); 94 + if (d->irq < FIRST_LEGACY_IRQ) 95 + return; 96 + 97 + tegra_irq_write_mask(d->irq, ICTLR_CPU_IEP_FIR_CLR); 98 + } 99 + 100 + static void tegra_eoi(struct irq_data *d) 101 + { 102 + if (d->irq < FIRST_LEGACY_IRQ) 103 + return; 104 + 105 + tegra_irq_write_mask(d->irq, ICTLR_CPU_IEP_FIR_CLR); 118 106 } 119 107 120 108 static int tegra_retrigger(struct irq_data *d) 121 109 { 122 - tegra_legacy_force_irq_set(d->irq); 110 + if (d->irq < FIRST_LEGACY_IRQ) 111 + return 0; 112 + 113 + tegra_irq_write_mask(d->irq, ICTLR_CPU_IEP_FIR_SET); 114 + 123 115 return 1; 124 116 } 125 117 126 - static struct irq_chip tegra_irq = { 127 - .name = "PPI", 128 - .irq_ack = tegra_ack, 129 - .irq_mask = tegra_mask, 130 - .irq_unmask = tegra_unmask, 131 - .irq_retrigger = tegra_retrigger, 132 - }; 133 - 134 118 void __init tegra_init_irq(void) 135 119 { 136 - struct irq_chip *gic; 137 - unsigned int i; 138 - int irq; 120 + int i; 139 121 140 - tegra_init_legacy_irq(); 122 + for (i = 0; i < NUM_ICTLRS; i++) { 123 + void __iomem *ictlr = ictlr_reg_base[i]; 124 + writel(~0, ictlr + ICTLR_CPU_IER_CLR); 125 + writel(0, ictlr + ICTLR_CPU_IEP_CLASS); 126 + } 127 + 128 + gic_arch_extn.irq_ack = tegra_ack; 129 + gic_arch_extn.irq_eoi = tegra_eoi; 130 + gic_arch_extn.irq_mask = tegra_mask; 131 + gic_arch_extn.irq_unmask = tegra_unmask; 132 + gic_arch_extn.irq_retrigger = tegra_retrigger; 141 133 142 134 gic_init(0, 29, IO_ADDRESS(TEGRA_ARM_INT_DIST_BASE), 143 135 IO_ADDRESS(TEGRA_ARM_PERIF_BASE + 0x100)); 144 - 145 - gic = irq_get_chip(29); 146 - tegra_gic_unmask_irq = gic->irq_unmask; 147 - tegra_gic_mask_irq = gic->irq_mask; 148 - tegra_gic_ack_irq = gic->irq_ack; 149 - #ifdef CONFIG_SMP 150 - tegra_irq.irq_set_affinity = gic->irq_set_affinity; 151 - #endif 152 - 153 - for (i = 0; i < INT_MAIN_NR; i++) { 154 - irq = INT_PRI_BASE + i; 155 - irq_set_chip_and_handler(irq, &tegra_irq, handle_level_irq); 156 - set_irq_flags(irq, IRQF_VALID); 157 - } 158 136 }
-215
arch/arm/mach-tegra/legacy_irq.c
··· 1 - /* 2 - * arch/arm/mach-tegra/legacy_irq.c 3 - * 4 - * Copyright (C) 2010 Google, Inc. 5 - * Author: Colin Cross <ccross@android.com> 6 - * 7 - * This software is licensed under the terms of the GNU General Public 8 - * License version 2, as published by the Free Software Foundation, and 9 - * may be copied, distributed, and modified under those terms. 10 - * 11 - * This program is distributed in the hope that it will be useful, 12 - * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 - * GNU General Public License for more details. 15 - * 16 - */ 17 - 18 - #include <linux/io.h> 19 - #include <linux/kernel.h> 20 - #include <mach/iomap.h> 21 - #include <mach/irqs.h> 22 - #include <mach/legacy_irq.h> 23 - 24 - #define INT_SYS_NR (INT_GPIO_BASE - INT_PRI_BASE) 25 - #define INT_SYS_SZ (INT_SEC_BASE - INT_PRI_BASE) 26 - #define PPI_NR ((INT_SYS_NR+INT_SYS_SZ-1)/INT_SYS_SZ) 27 - 28 - #define ICTLR_CPU_IEP_VFIQ 0x08 29 - #define ICTLR_CPU_IEP_FIR 0x14 30 - #define ICTLR_CPU_IEP_FIR_SET 0x18 31 - #define ICTLR_CPU_IEP_FIR_CLR 0x1c 32 - 33 - #define ICTLR_CPU_IER 0x20 34 - #define ICTLR_CPU_IER_SET 0x24 35 - #define ICTLR_CPU_IER_CLR 0x28 36 - #define ICTLR_CPU_IEP_CLASS 0x2C 37 - 38 - #define ICTLR_COP_IER 0x30 39 - #define ICTLR_COP_IER_SET 0x34 40 - #define ICTLR_COP_IER_CLR 0x38 41 - #define ICTLR_COP_IEP_CLASS 0x3c 42 - 43 - #define NUM_ICTLRS 4 44 - 45 - static void __iomem *ictlr_reg_base[] = { 46 - IO_ADDRESS(TEGRA_PRIMARY_ICTLR_BASE), 47 - IO_ADDRESS(TEGRA_SECONDARY_ICTLR_BASE), 48 - IO_ADDRESS(TEGRA_TERTIARY_ICTLR_BASE), 49 - IO_ADDRESS(TEGRA_QUATERNARY_ICTLR_BASE), 50 - }; 51 - 52 - static u32 tegra_legacy_wake_mask[4]; 53 - static u32 tegra_legacy_saved_mask[4]; 54 - 55 - /* When going into deep sleep, the CPU is powered down, taking the GIC with it 56 - In order to wake, the wake interrupts need to be enabled in the legacy 57 - interrupt controller. */ 58 - void tegra_legacy_unmask_irq(unsigned int irq) 59 - { 60 - void __iomem *base; 61 - pr_debug("%s: %d\n", __func__, irq); 62 - 63 - irq -= 32; 64 - base = ictlr_reg_base[irq>>5]; 65 - writel(1 << (irq & 31), base + ICTLR_CPU_IER_SET); 66 - } 67 - 68 - void tegra_legacy_mask_irq(unsigned int irq) 69 - { 70 - void __iomem *base; 71 - pr_debug("%s: %d\n", __func__, irq); 72 - 73 - irq -= 32; 74 - base = ictlr_reg_base[irq>>5]; 75 - writel(1 << (irq & 31), base + ICTLR_CPU_IER_CLR); 76 - } 77 - 78 - void tegra_legacy_force_irq_set(unsigned int irq) 79 - { 80 - void __iomem *base; 81 - pr_debug("%s: %d\n", __func__, irq); 82 - 83 - irq -= 32; 84 - base = ictlr_reg_base[irq>>5]; 85 - writel(1 << (irq & 31), base + ICTLR_CPU_IEP_FIR_SET); 86 - } 87 - 88 - void tegra_legacy_force_irq_clr(unsigned int irq) 89 - { 90 - void __iomem *base; 91 - pr_debug("%s: %d\n", __func__, irq); 92 - 93 - irq -= 32; 94 - base = ictlr_reg_base[irq>>5]; 95 - writel(1 << (irq & 31), base + ICTLR_CPU_IEP_FIR_CLR); 96 - } 97 - 98 - int tegra_legacy_force_irq_status(unsigned int irq) 99 - { 100 - void __iomem *base; 101 - pr_debug("%s: %d\n", __func__, irq); 102 - 103 - irq -= 32; 104 - base = ictlr_reg_base[irq>>5]; 105 - return !!(readl(base + ICTLR_CPU_IEP_FIR) & (1 << (irq & 31))); 106 - } 107 - 108 - void tegra_legacy_select_fiq(unsigned int irq, bool fiq) 109 - { 110 - void __iomem *base; 111 - pr_debug("%s: %d\n", __func__, irq); 112 - 113 - irq -= 32; 114 - base = ictlr_reg_base[irq>>5]; 115 - writel(fiq << (irq & 31), base + ICTLR_CPU_IEP_CLASS); 116 - } 117 - 118 - unsigned long tegra_legacy_vfiq(int nr) 119 - { 120 - void __iomem *base; 121 - base = ictlr_reg_base[nr]; 122 - return readl(base + ICTLR_CPU_IEP_VFIQ); 123 - } 124 - 125 - unsigned long tegra_legacy_class(int nr) 126 - { 127 - void __iomem *base; 128 - base = ictlr_reg_base[nr]; 129 - return readl(base + ICTLR_CPU_IEP_CLASS); 130 - } 131 - 132 - int tegra_legacy_irq_set_wake(int irq, int enable) 133 - { 134 - irq -= 32; 135 - if (enable) 136 - tegra_legacy_wake_mask[irq >> 5] |= 1 << (irq & 31); 137 - else 138 - tegra_legacy_wake_mask[irq >> 5] &= ~(1 << (irq & 31)); 139 - 140 - return 0; 141 - } 142 - 143 - void tegra_legacy_irq_set_lp1_wake_mask(void) 144 - { 145 - void __iomem *base; 146 - int i; 147 - 148 - for (i = 0; i < NUM_ICTLRS; i++) { 149 - base = ictlr_reg_base[i]; 150 - tegra_legacy_saved_mask[i] = readl(base + ICTLR_CPU_IER); 151 - writel(tegra_legacy_wake_mask[i], base + ICTLR_CPU_IER); 152 - } 153 - } 154 - 155 - void tegra_legacy_irq_restore_mask(void) 156 - { 157 - void __iomem *base; 158 - int i; 159 - 160 - for (i = 0; i < NUM_ICTLRS; i++) { 161 - base = ictlr_reg_base[i]; 162 - writel(tegra_legacy_saved_mask[i], base + ICTLR_CPU_IER); 163 - } 164 - } 165 - 166 - void tegra_init_legacy_irq(void) 167 - { 168 - int i; 169 - 170 - for (i = 0; i < NUM_ICTLRS; i++) { 171 - void __iomem *ictlr = ictlr_reg_base[i]; 172 - writel(~0, ictlr + ICTLR_CPU_IER_CLR); 173 - writel(0, ictlr + ICTLR_CPU_IEP_CLASS); 174 - } 175 - } 176 - 177 - #ifdef CONFIG_PM 178 - static u32 cop_ier[NUM_ICTLRS]; 179 - static u32 cpu_ier[NUM_ICTLRS]; 180 - static u32 cpu_iep[NUM_ICTLRS]; 181 - 182 - void tegra_irq_suspend(void) 183 - { 184 - unsigned long flags; 185 - int i; 186 - 187 - local_irq_save(flags); 188 - for (i = 0; i < NUM_ICTLRS; i++) { 189 - void __iomem *ictlr = ictlr_reg_base[i]; 190 - cpu_ier[i] = readl(ictlr + ICTLR_CPU_IER); 191 - cpu_iep[i] = readl(ictlr + ICTLR_CPU_IEP_CLASS); 192 - cop_ier[i] = readl(ictlr + ICTLR_COP_IER); 193 - writel(~0, ictlr + ICTLR_COP_IER_CLR); 194 - } 195 - local_irq_restore(flags); 196 - } 197 - 198 - void tegra_irq_resume(void) 199 - { 200 - unsigned long flags; 201 - int i; 202 - 203 - local_irq_save(flags); 204 - for (i = 0; i < NUM_ICTLRS; i++) { 205 - void __iomem *ictlr = ictlr_reg_base[i]; 206 - writel(cpu_iep[i], ictlr + ICTLR_CPU_IEP_CLASS); 207 - writel(~0ul, ictlr + ICTLR_CPU_IER_CLR); 208 - writel(cpu_ier[i], ictlr + ICTLR_CPU_IER_SET); 209 - writel(0, ictlr + ICTLR_COP_IEP_CLASS); 210 - writel(~0ul, ictlr + ICTLR_COP_IER_CLR); 211 - writel(cop_ier[i], ictlr + ICTLR_COP_IER_SET); 212 - } 213 - local_irq_restore(flags); 214 - } 215 - #endif
+4 -8
arch/arm/plat-nomadik/gpio.c
··· 23 23 #include <linux/irq.h> 24 24 #include <linux/slab.h> 25 25 26 + #include <asm/mach/irq.h> 27 + 26 28 #include <plat/pincfg.h> 27 29 #include <mach/hardware.h> 28 30 #include <mach/gpio.h> ··· 683 681 struct irq_chip *host_chip = irq_get_chip(irq); 684 682 unsigned int first_irq; 685 683 686 - if (host_chip->irq_mask_ack) 687 - host_chip->irq_mask_ack(&desc->irq_data); 688 - else { 689 - host_chip->irq_mask(&desc->irq_data); 690 - if (host_chip->irq_ack) 691 - host_chip->irq_ack(&desc->irq_data); 692 - } 684 + chained_irq_enter(host_chip, desc); 693 685 694 686 nmk_chip = irq_get_handler_data(irq); 695 687 first_irq = NOMADIK_GPIO_TO_IRQ(nmk_chip->chip.base); ··· 694 698 status &= ~BIT(bit); 695 699 } 696 700 697 - host_chip->irq_unmask(&desc->irq_data); 701 + chained_irq_exit(host_chip, desc); 698 702 } 699 703 700 704 static void nmk_gpio_irq_handler(unsigned int irq, struct irq_desc *desc)
+4 -3
arch/arm/plat-omap/gpio.c
··· 1137 1137 struct gpio_bank *bank; 1138 1138 u32 retrigger = 0; 1139 1139 int unmasked = 0; 1140 + struct irq_chip *chip = irq_desc_get_chip(desc); 1140 1141 1141 - desc->irq_data.chip->irq_ack(&desc->irq_data); 1142 + chained_irq_enter(chip, desc); 1142 1143 1143 1144 bank = irq_get_handler_data(irq); 1144 1145 #ifdef CONFIG_ARCH_OMAP1 ··· 1196 1195 configured, we could unmask GPIO bank interrupt immediately */ 1197 1196 if (!level_mask && !unmasked) { 1198 1197 unmasked = 1; 1199 - desc->irq_data.chip->irq_unmask(&desc->irq_data); 1198 + chained_irq_exit(chip, desc); 1200 1199 } 1201 1200 1202 1201 isr |= retrigger; ··· 1232 1231 interrupt */ 1233 1232 exit: 1234 1233 if (!unmasked) 1235 - desc->irq_data.chip->irq_unmask(&desc->irq_data); 1234 + chained_irq_exit(chip, desc); 1236 1235 } 1237 1236 1238 1237 static void gpio_irq_shutdown(struct irq_data *d)
+11 -1
arch/powerpc/kernel/ptrace.c
··· 933 933 if (data && !(data & DABR_TRANSLATION)) 934 934 return -EIO; 935 935 #ifdef CONFIG_HAVE_HW_BREAKPOINT 936 + if (ptrace_get_breakpoints(task) < 0) 937 + return -ESRCH; 938 + 936 939 bp = thread->ptrace_bps[0]; 937 940 if ((!data) || !(data & (DABR_DATA_WRITE | DABR_DATA_READ))) { 938 941 if (bp) { 939 942 unregister_hw_breakpoint(bp); 940 943 thread->ptrace_bps[0] = NULL; 941 944 } 945 + ptrace_put_breakpoints(task); 942 946 return 0; 943 947 } 944 948 if (bp) { ··· 952 948 (DABR_DATA_WRITE | DABR_DATA_READ), 953 949 &attr.bp_type); 954 950 ret = modify_user_hw_breakpoint(bp, &attr); 955 - if (ret) 951 + if (ret) { 952 + ptrace_put_breakpoints(task); 956 953 return ret; 954 + } 957 955 thread->ptrace_bps[0] = bp; 956 + ptrace_put_breakpoints(task); 958 957 thread->dabr = data; 959 958 return 0; 960 959 } ··· 972 965 ptrace_triggered, task); 973 966 if (IS_ERR(bp)) { 974 967 thread->ptrace_bps[0] = NULL; 968 + ptrace_put_breakpoints(task); 975 969 return PTR_ERR(bp); 976 970 } 971 + 972 + ptrace_put_breakpoints(task); 977 973 978 974 #endif /* CONFIG_HAVE_HW_BREAKPOINT */ 979 975
+4
arch/sh/kernel/ptrace_32.c
··· 117 117 118 118 set_tsk_thread_flag(child, TIF_SINGLESTEP); 119 119 120 + if (ptrace_get_breakpoints(child) < 0) 121 + return; 122 + 120 123 set_single_step(child, pc); 124 + ptrace_put_breakpoints(child); 121 125 } 122 126 123 127 void user_disable_single_step(struct task_struct *child)
+1 -1
arch/x86/kernel/cpu/amd.c
··· 698 698 */ 699 699 700 700 const int amd_erratum_400[] = 701 - AMD_OSVW_ERRATUM(1, AMD_MODEL_RANGE(0xf, 0x41, 0x2, 0xff, 0xf), 701 + AMD_OSVW_ERRATUM(1, AMD_MODEL_RANGE(0x0f, 0x4, 0x2, 0xff, 0xf), 702 702 AMD_MODEL_RANGE(0x10, 0x2, 0x1, 0xff, 0xf)); 703 703 EXPORT_SYMBOL_GPL(amd_erratum_400); 704 704
+52 -35
arch/x86/kernel/cpu/perf_event_intel.c
··· 184 184 }, 185 185 }, 186 186 [ C(LL ) ] = { 187 - /* 188 - * TBD: Need Off-core Response Performance Monitoring support 189 - */ 190 187 [ C(OP_READ) ] = { 191 - /* OFFCORE_RESPONSE_0.ANY_DATA.LOCAL_CACHE */ 188 + /* OFFCORE_RESPONSE.ANY_DATA.LOCAL_CACHE */ 192 189 [ C(RESULT_ACCESS) ] = 0x01b7, 193 - /* OFFCORE_RESPONSE_1.ANY_DATA.ANY_LLC_MISS */ 194 - [ C(RESULT_MISS) ] = 0x01bb, 190 + /* OFFCORE_RESPONSE.ANY_DATA.ANY_LLC_MISS */ 191 + [ C(RESULT_MISS) ] = 0x01b7, 195 192 }, 196 193 [ C(OP_WRITE) ] = { 197 - /* OFFCORE_RESPONSE_0.ANY_RFO.LOCAL_CACHE */ 194 + /* OFFCORE_RESPONSE.ANY_RFO.LOCAL_CACHE */ 198 195 [ C(RESULT_ACCESS) ] = 0x01b7, 199 - /* OFFCORE_RESPONSE_1.ANY_RFO.ANY_LLC_MISS */ 200 - [ C(RESULT_MISS) ] = 0x01bb, 196 + /* OFFCORE_RESPONSE.ANY_RFO.ANY_LLC_MISS */ 197 + [ C(RESULT_MISS) ] = 0x01b7, 201 198 }, 202 199 [ C(OP_PREFETCH) ] = { 203 - /* OFFCORE_RESPONSE_0.PREFETCH.LOCAL_CACHE */ 200 + /* OFFCORE_RESPONSE.PREFETCH.LOCAL_CACHE */ 204 201 [ C(RESULT_ACCESS) ] = 0x01b7, 205 - /* OFFCORE_RESPONSE_1.PREFETCH.ANY_LLC_MISS */ 206 - [ C(RESULT_MISS) ] = 0x01bb, 202 + /* OFFCORE_RESPONSE.PREFETCH.ANY_LLC_MISS */ 203 + [ C(RESULT_MISS) ] = 0x01b7, 207 204 }, 208 205 }, 209 206 [ C(DTLB) ] = { ··· 282 285 }, 283 286 [ C(LL ) ] = { 284 287 [ C(OP_READ) ] = { 285 - /* OFFCORE_RESPONSE_0.ANY_DATA.LOCAL_CACHE */ 288 + /* OFFCORE_RESPONSE.ANY_DATA.LOCAL_CACHE */ 286 289 [ C(RESULT_ACCESS) ] = 0x01b7, 287 - /* OFFCORE_RESPONSE_1.ANY_DATA.ANY_LLC_MISS */ 288 - [ C(RESULT_MISS) ] = 0x01bb, 290 + /* OFFCORE_RESPONSE.ANY_DATA.ANY_LLC_MISS */ 291 + [ C(RESULT_MISS) ] = 0x01b7, 289 292 }, 290 293 /* 291 294 * Use RFO, not WRITEBACK, because a write miss would typically occur 292 295 * on RFO. 293 296 */ 294 297 [ C(OP_WRITE) ] = { 295 - /* OFFCORE_RESPONSE_1.ANY_RFO.LOCAL_CACHE */ 296 - [ C(RESULT_ACCESS) ] = 0x01bb, 297 - /* OFFCORE_RESPONSE_0.ANY_RFO.ANY_LLC_MISS */ 298 + /* OFFCORE_RESPONSE.ANY_RFO.LOCAL_CACHE */ 299 + [ C(RESULT_ACCESS) ] = 0x01b7, 300 + /* OFFCORE_RESPONSE.ANY_RFO.ANY_LLC_MISS */ 298 301 [ C(RESULT_MISS) ] = 0x01b7, 299 302 }, 300 303 [ C(OP_PREFETCH) ] = { 301 - /* OFFCORE_RESPONSE_0.PREFETCH.LOCAL_CACHE */ 304 + /* OFFCORE_RESPONSE.PREFETCH.LOCAL_CACHE */ 302 305 [ C(RESULT_ACCESS) ] = 0x01b7, 303 - /* OFFCORE_RESPONSE_1.PREFETCH.ANY_LLC_MISS */ 304 - [ C(RESULT_MISS) ] = 0x01bb, 306 + /* OFFCORE_RESPONSE.PREFETCH.ANY_LLC_MISS */ 307 + [ C(RESULT_MISS) ] = 0x01b7, 305 308 }, 306 309 }, 307 310 [ C(DTLB) ] = { ··· 349 352 }; 350 353 351 354 /* 352 - * OFFCORE_RESPONSE MSR bits (subset), See IA32 SDM Vol 3 30.6.1.3 355 + * Nehalem/Westmere MSR_OFFCORE_RESPONSE bits; 356 + * See IA32 SDM Vol 3B 30.6.1.3 353 357 */ 354 358 355 - #define DMND_DATA_RD (1 << 0) 356 - #define DMND_RFO (1 << 1) 357 - #define DMND_WB (1 << 3) 358 - #define PF_DATA_RD (1 << 4) 359 - #define PF_DATA_RFO (1 << 5) 360 - #define RESP_UNCORE_HIT (1 << 8) 361 - #define RESP_MISS (0xf600) /* non uncore hit */ 359 + #define NHM_DMND_DATA_RD (1 << 0) 360 + #define NHM_DMND_RFO (1 << 1) 361 + #define NHM_DMND_IFETCH (1 << 2) 362 + #define NHM_DMND_WB (1 << 3) 363 + #define NHM_PF_DATA_RD (1 << 4) 364 + #define NHM_PF_DATA_RFO (1 << 5) 365 + #define NHM_PF_IFETCH (1 << 6) 366 + #define NHM_OFFCORE_OTHER (1 << 7) 367 + #define NHM_UNCORE_HIT (1 << 8) 368 + #define NHM_OTHER_CORE_HIT_SNP (1 << 9) 369 + #define NHM_OTHER_CORE_HITM (1 << 10) 370 + /* reserved */ 371 + #define NHM_REMOTE_CACHE_FWD (1 << 12) 372 + #define NHM_REMOTE_DRAM (1 << 13) 373 + #define NHM_LOCAL_DRAM (1 << 14) 374 + #define NHM_NON_DRAM (1 << 15) 375 + 376 + #define NHM_ALL_DRAM (NHM_REMOTE_DRAM|NHM_LOCAL_DRAM) 377 + 378 + #define NHM_DMND_READ (NHM_DMND_DATA_RD) 379 + #define NHM_DMND_WRITE (NHM_DMND_RFO|NHM_DMND_WB) 380 + #define NHM_DMND_PREFETCH (NHM_PF_DATA_RD|NHM_PF_DATA_RFO) 381 + 382 + #define NHM_L3_HIT (NHM_UNCORE_HIT|NHM_OTHER_CORE_HIT_SNP|NHM_OTHER_CORE_HITM) 383 + #define NHM_L3_MISS (NHM_NON_DRAM|NHM_ALL_DRAM|NHM_REMOTE_CACHE_FWD) 384 + #define NHM_L3_ACCESS (NHM_L3_HIT|NHM_L3_MISS) 362 385 363 386 static __initconst const u64 nehalem_hw_cache_extra_regs 364 387 [PERF_COUNT_HW_CACHE_MAX] ··· 387 370 { 388 371 [ C(LL ) ] = { 389 372 [ C(OP_READ) ] = { 390 - [ C(RESULT_ACCESS) ] = DMND_DATA_RD|RESP_UNCORE_HIT, 391 - [ C(RESULT_MISS) ] = DMND_DATA_RD|RESP_MISS, 373 + [ C(RESULT_ACCESS) ] = NHM_DMND_READ|NHM_L3_ACCESS, 374 + [ C(RESULT_MISS) ] = NHM_DMND_READ|NHM_L3_MISS, 392 375 }, 393 376 [ C(OP_WRITE) ] = { 394 - [ C(RESULT_ACCESS) ] = DMND_RFO|DMND_WB|RESP_UNCORE_HIT, 395 - [ C(RESULT_MISS) ] = DMND_RFO|DMND_WB|RESP_MISS, 377 + [ C(RESULT_ACCESS) ] = NHM_DMND_WRITE|NHM_L3_ACCESS, 378 + [ C(RESULT_MISS) ] = NHM_DMND_WRITE|NHM_L3_MISS, 396 379 }, 397 380 [ C(OP_PREFETCH) ] = { 398 - [ C(RESULT_ACCESS) ] = PF_DATA_RD|PF_DATA_RFO|RESP_UNCORE_HIT, 399 - [ C(RESULT_MISS) ] = PF_DATA_RD|PF_DATA_RFO|RESP_MISS, 381 + [ C(RESULT_ACCESS) ] = NHM_DMND_PREFETCH|NHM_L3_ACCESS, 382 + [ C(RESULT_MISS) ] = NHM_DMND_PREFETCH|NHM_L3_MISS, 400 383 }, 401 384 } 402 385 };
+26 -10
arch/x86/kernel/ptrace.c
··· 608 608 unsigned len, type; 609 609 struct perf_event *bp; 610 610 611 + if (ptrace_get_breakpoints(tsk) < 0) 612 + return -ESRCH; 613 + 611 614 data &= ~DR_CONTROL_RESERVED; 612 615 old_dr7 = ptrace_get_dr7(thread->ptrace_bps); 613 616 restore: ··· 658 655 } 659 656 goto restore; 660 657 } 658 + 659 + ptrace_put_breakpoints(tsk); 660 + 661 661 return ((orig_ret < 0) ? orig_ret : rc); 662 662 } 663 663 ··· 674 668 675 669 if (n < HBP_NUM) { 676 670 struct perf_event *bp; 671 + 672 + if (ptrace_get_breakpoints(tsk) < 0) 673 + return -ESRCH; 674 + 677 675 bp = thread->ptrace_bps[n]; 678 676 if (!bp) 679 - return 0; 680 - val = bp->hw.info.address; 677 + val = 0; 678 + else 679 + val = bp->hw.info.address; 680 + 681 + ptrace_put_breakpoints(tsk); 681 682 } else if (n == 6) { 682 683 val = thread->debugreg6; 683 684 } else if (n == 7) { ··· 699 686 struct perf_event *bp; 700 687 struct thread_struct *t = &tsk->thread; 701 688 struct perf_event_attr attr; 689 + int err = 0; 690 + 691 + if (ptrace_get_breakpoints(tsk) < 0) 692 + return -ESRCH; 702 693 703 694 if (!t->ptrace_bps[nr]) { 704 695 ptrace_breakpoint_init(&attr); ··· 726 709 * writing for the user. And anyway this is the previous 727 710 * behaviour. 728 711 */ 729 - if (IS_ERR(bp)) 730 - return PTR_ERR(bp); 712 + if (IS_ERR(bp)) { 713 + err = PTR_ERR(bp); 714 + goto put; 715 + } 731 716 732 717 t->ptrace_bps[nr] = bp; 733 718 } else { 734 - int err; 735 - 736 719 bp = t->ptrace_bps[nr]; 737 720 738 721 attr = bp->attr; 739 722 attr.bp_addr = addr; 740 723 err = modify_user_hw_breakpoint(bp, &attr); 741 - if (err) 742 - return err; 743 724 } 744 725 745 - 746 - return 0; 726 + put: 727 + ptrace_put_breakpoints(tsk); 728 + return err; 747 729 } 748 730 749 731 /*
+6 -6
arch/x86/kernel/reboot_32.S
··· 21 21 /* Get our own relocated address */ 22 22 call 1f 23 23 1: popl %ebx 24 - subl $1b, %ebx 24 + subl $(1b - r_base), %ebx 25 25 26 26 /* Compute the equivalent real-mode segment */ 27 27 movl %ebx, %ecx 28 28 shrl $4, %ecx 29 29 30 30 /* Patch post-real-mode segment jump */ 31 - movw dispatch_table(%ebx,%eax,2),%ax 32 - movw %ax, 101f(%ebx) 33 - movw %cx, 102f(%ebx) 31 + movw (dispatch_table - r_base)(%ebx,%eax,2),%ax 32 + movw %ax, (101f - r_base)(%ebx) 33 + movw %cx, (102f - r_base)(%ebx) 34 34 35 35 /* Set up the IDT for real mode. */ 36 - lidtl machine_real_restart_idt(%ebx) 36 + lidtl (machine_real_restart_idt - r_base)(%ebx) 37 37 38 38 /* 39 39 * Set up a GDT from which we can load segment descriptors for real 40 40 * mode. The GDT is not used in real mode; it is just needed here to 41 41 * prepare the descriptors. 42 42 */ 43 - lgdtl machine_real_restart_gdt(%ebx) 43 + lgdtl (machine_real_restart_gdt - r_base)(%ebx) 44 44 45 45 /* 46 46 * Load the data segment registers with 16-bit compatible values
+1 -1
arch/x86/mm/numa_64.c
··· 306 306 bi->end = min(bi->end, high); 307 307 308 308 /* and there's no empty block */ 309 - if (bi->start == bi->end) { 309 + if (bi->start >= bi->end) { 310 310 numa_remove_memblk_from(i--, mi); 311 311 continue; 312 312 }
+124 -1
arch/x86/xen/mmu.c
··· 1463 1463 return ret; 1464 1464 } 1465 1465 1466 + #ifdef CONFIG_X86_64 1467 + static __initdata u64 __last_pgt_set_rw = 0; 1468 + static __initdata u64 __pgt_buf_start = 0; 1469 + static __initdata u64 __pgt_buf_end = 0; 1470 + static __initdata u64 __pgt_buf_top = 0; 1471 + /* 1472 + * As a consequence of the commit: 1473 + * 1474 + * commit 4b239f458c229de044d6905c2b0f9fe16ed9e01e 1475 + * Author: Yinghai Lu <yinghai@kernel.org> 1476 + * Date: Fri Dec 17 16:58:28 2010 -0800 1477 + * 1478 + * x86-64, mm: Put early page table high 1479 + * 1480 + * at some point init_memory_mapping is going to reach the pagetable pages 1481 + * area and map those pages too (mapping them as normal memory that falls 1482 + * in the range of addresses passed to init_memory_mapping as argument). 1483 + * Some of those pages are already pagetable pages (they are in the range 1484 + * pgt_buf_start-pgt_buf_end) therefore they are going to be mapped RO and 1485 + * everything is fine. 1486 + * Some of these pages are not pagetable pages yet (they fall in the range 1487 + * pgt_buf_end-pgt_buf_top; for example the page at pgt_buf_end) so they 1488 + * are going to be mapped RW. When these pages become pagetable pages and 1489 + * are hooked into the pagetable, xen will find that the guest has already 1490 + * a RW mapping of them somewhere and fail the operation. 1491 + * The reason Xen requires pagetables to be RO is that the hypervisor needs 1492 + * to verify that the pagetables are valid before using them. The validation 1493 + * operations are called "pinning". 1494 + * 1495 + * In order to fix the issue we mark all the pages in the entire range 1496 + * pgt_buf_start-pgt_buf_top as RO, however when the pagetable allocation 1497 + * is completed only the range pgt_buf_start-pgt_buf_end is reserved by 1498 + * init_memory_mapping. Hence the kernel is going to crash as soon as one 1499 + * of the pages in the range pgt_buf_end-pgt_buf_top is reused (b/c those 1500 + * ranges are RO). 1501 + * 1502 + * For this reason, 'mark_rw_past_pgt' is introduced which is called _after_ 1503 + * the init_memory_mapping has completed (in a perfect world we would 1504 + * call this function from init_memory_mapping, but lets ignore that). 1505 + * 1506 + * Because we are called _after_ init_memory_mapping the pgt_buf_[start, 1507 + * end,top] have all changed to new values (b/c init_memory_mapping 1508 + * is called and setting up another new page-table). Hence, the first time 1509 + * we enter this function, we save away the pgt_buf_start value and update 1510 + * the pgt_buf_[end,top]. 1511 + * 1512 + * When we detect that the "old" pgt_buf_start through pgt_buf_end 1513 + * PFNs have been reserved (so memblock_x86_reserve_range has been called), 1514 + * we immediately set out to RW the "old" pgt_buf_end through pgt_buf_top. 1515 + * 1516 + * And then we update those "old" pgt_buf_[end|top] with the new ones 1517 + * so that we can redo this on the next pagetable. 1518 + */ 1519 + static __init void mark_rw_past_pgt(void) { 1520 + 1521 + if (pgt_buf_end > pgt_buf_start) { 1522 + u64 addr, size; 1523 + 1524 + /* Save it away. */ 1525 + if (!__pgt_buf_start) { 1526 + __pgt_buf_start = pgt_buf_start; 1527 + __pgt_buf_end = pgt_buf_end; 1528 + __pgt_buf_top = pgt_buf_top; 1529 + return; 1530 + } 1531 + /* If we get the range that starts at __pgt_buf_end that means 1532 + * the range is reserved, and that in 'init_memory_mapping' 1533 + * the 'memblock_x86_reserve_range' has been called with the 1534 + * outdated __pgt_buf_start, __pgt_buf_end (the "new" 1535 + * pgt_buf_[start|end|top] refer now to a new pagetable. 1536 + * Note: we are called _after_ the pgt_buf_[..] have been 1537 + * updated.*/ 1538 + 1539 + addr = memblock_x86_find_in_range_size(PFN_PHYS(__pgt_buf_start), 1540 + &size, PAGE_SIZE); 1541 + 1542 + /* Still not reserved, meaning 'memblock_x86_reserve_range' 1543 + * hasn't been called yet. Update the _end and _top.*/ 1544 + if (addr == PFN_PHYS(__pgt_buf_start)) { 1545 + __pgt_buf_end = pgt_buf_end; 1546 + __pgt_buf_top = pgt_buf_top; 1547 + return; 1548 + } 1549 + 1550 + /* OK, the area is reserved, meaning it is time for us to 1551 + * set RW for the old end->top PFNs. */ 1552 + 1553 + /* ..unless we had already done this. */ 1554 + if (__pgt_buf_end == __last_pgt_set_rw) 1555 + return; 1556 + 1557 + addr = PFN_PHYS(__pgt_buf_end); 1558 + 1559 + /* set as RW the rest */ 1560 + printk(KERN_DEBUG "xen: setting RW the range %llx - %llx\n", 1561 + PFN_PHYS(__pgt_buf_end), PFN_PHYS(__pgt_buf_top)); 1562 + 1563 + while (addr < PFN_PHYS(__pgt_buf_top)) { 1564 + make_lowmem_page_readwrite(__va(addr)); 1565 + addr += PAGE_SIZE; 1566 + } 1567 + /* And update everything so that we are ready for the next 1568 + * pagetable (the one created for regions past 4GB) */ 1569 + __last_pgt_set_rw = __pgt_buf_end; 1570 + __pgt_buf_start = pgt_buf_start; 1571 + __pgt_buf_end = pgt_buf_end; 1572 + __pgt_buf_top = pgt_buf_top; 1573 + } 1574 + return; 1575 + } 1576 + #else 1577 + static __init void mark_rw_past_pgt(void) { } 1578 + #endif 1466 1579 static void xen_pgd_free(struct mm_struct *mm, pgd_t *pgd) 1467 1580 { 1468 1581 #ifdef CONFIG_X86_64 ··· 1602 1489 unsigned long pfn = pte_pfn(pte); 1603 1490 1604 1491 /* 1492 + * A bit of optimization. We do not need to call the workaround 1493 + * when xen_set_pte_init is called with a PTE with 0 as PFN. 1494 + * That is b/c the pagetable at that point are just being populated 1495 + * with empty values and we can save some cycles by not calling 1496 + * the 'memblock' code.*/ 1497 + if (pfn) 1498 + mark_rw_past_pgt(); 1499 + /* 1605 1500 * If the new pfn is within the range of the newly allocated 1606 1501 * kernel pagetable, and it isn't being mapped into an 1607 1502 * early_ioremap fixmap slot as a freshly allocated page, make sure 1608 1503 * it is RO. 1609 1504 */ 1610 1505 if (((!is_early_ioremap_ptep(ptep) && 1611 - pfn >= pgt_buf_start && pfn < pgt_buf_end)) || 1506 + pfn >= pgt_buf_start && pfn < pgt_buf_top)) || 1612 1507 (is_early_ioremap_ptep(ptep) && pfn != (pgt_buf_end - 1))) 1613 1508 pte = pte_wrprotect(pte); 1614 1509 ··· 2118 1997 2119 1998 static __init void xen_post_allocator_init(void) 2120 1999 { 2000 + mark_rw_past_pgt(); 2001 + 2121 2002 #ifdef CONFIG_XEN_DEBUG 2122 2003 pv_mmu_ops.make_pte = PV_CALLEE_SAVE(xen_make_pte_debug); 2123 2004 #endif
+2 -2
drivers/block/rbd.c
··· 777 777 ops, 778 778 false, 779 779 GFP_NOIO, pages, bio); 780 - if (IS_ERR(req)) { 780 + if (!req) { 781 781 up_read(&header->snap_rwsem); 782 - ret = PTR_ERR(req); 782 + ret = -ENOMEM; 783 783 goto done_pages; 784 784 } 785 785
+27 -16
drivers/firewire/ohci.c
··· 2199 2199 { 2200 2200 struct fw_ohci *ohci; 2201 2201 unsigned long flags; 2202 - int ret = -EBUSY; 2203 2202 __be32 *next_config_rom; 2204 2203 dma_addr_t uninitialized_var(next_config_rom_bus); 2205 2204 ··· 2239 2240 2240 2241 spin_lock_irqsave(&ohci->lock, flags); 2241 2242 2243 + /* 2244 + * If there is not an already pending config_rom update, 2245 + * push our new allocation into the ohci->next_config_rom 2246 + * and then mark the local variable as null so that we 2247 + * won't deallocate the new buffer. 2248 + * 2249 + * OTOH, if there is a pending config_rom update, just 2250 + * use that buffer with the new config_rom data, and 2251 + * let this routine free the unused DMA allocation. 2252 + */ 2253 + 2242 2254 if (ohci->next_config_rom == NULL) { 2243 2255 ohci->next_config_rom = next_config_rom; 2244 2256 ohci->next_config_rom_bus = next_config_rom_bus; 2245 - 2246 - copy_config_rom(ohci->next_config_rom, config_rom, length); 2247 - 2248 - ohci->next_header = config_rom[0]; 2249 - ohci->next_config_rom[0] = 0; 2250 - 2251 - reg_write(ohci, OHCI1394_ConfigROMmap, 2252 - ohci->next_config_rom_bus); 2253 - ret = 0; 2257 + next_config_rom = NULL; 2254 2258 } 2255 2259 2260 + copy_config_rom(ohci->next_config_rom, config_rom, length); 2261 + 2262 + ohci->next_header = config_rom[0]; 2263 + ohci->next_config_rom[0] = 0; 2264 + 2265 + reg_write(ohci, OHCI1394_ConfigROMmap, ohci->next_config_rom_bus); 2266 + 2256 2267 spin_unlock_irqrestore(&ohci->lock, flags); 2268 + 2269 + /* If we didn't use the DMA allocation, delete it. */ 2270 + if (next_config_rom != NULL) 2271 + dma_free_coherent(ohci->card.device, CONFIG_ROM_SIZE, 2272 + next_config_rom, next_config_rom_bus); 2257 2273 2258 2274 /* 2259 2275 * Now initiate a bus reset to have the changes take ··· 2277 2263 * controller could need to access it before the bus reset 2278 2264 * takes effect. 2279 2265 */ 2280 - if (ret == 0) 2281 - fw_schedule_bus_reset(&ohci->card, true, true); 2282 - else 2283 - dma_free_coherent(ohci->card.device, CONFIG_ROM_SIZE, 2284 - next_config_rom, next_config_rom_bus); 2285 2266 2286 - return ret; 2267 + fw_schedule_bus_reset(&ohci->card, true, true); 2268 + 2269 + return 0; 2287 2270 } 2288 2271 2289 2272 static void ohci_send_request(struct fw_card *card, struct fw_packet *packet)
+23
drivers/gpu/drm/drm_irq.c
··· 932 932 933 933 void drm_vblank_off(struct drm_device *dev, int crtc) 934 934 { 935 + struct drm_pending_vblank_event *e, *t; 936 + struct timeval now; 935 937 unsigned long irqflags; 938 + unsigned int seq; 936 939 937 940 spin_lock_irqsave(&dev->vbl_lock, irqflags); 938 941 vblank_disable_and_save(dev, crtc); 939 942 DRM_WAKEUP(&dev->vbl_queue[crtc]); 943 + 944 + /* Send any queued vblank events, lest the natives grow disquiet */ 945 + seq = drm_vblank_count_and_time(dev, crtc, &now); 946 + list_for_each_entry_safe(e, t, &dev->vblank_event_list, base.link) { 947 + if (e->pipe != crtc) 948 + continue; 949 + DRM_DEBUG("Sending premature vblank event on disable: \ 950 + wanted %d, current %d\n", 951 + e->event.sequence, seq); 952 + 953 + e->event.sequence = seq; 954 + e->event.tv_sec = now.tv_sec; 955 + e->event.tv_usec = now.tv_usec; 956 + drm_vblank_put(dev, e->pipe); 957 + list_move_tail(&e->base.link, &e->base.file_priv->event_list); 958 + wake_up_interruptible(&e->base.file_priv->event_wait); 959 + trace_drm_vblank_event_delivered(e->base.pid, e->pipe, 960 + e->event.sequence); 961 + } 962 + 940 963 spin_unlock_irqrestore(&dev->vbl_lock, irqflags); 941 964 } 942 965 EXPORT_SYMBOL(drm_vblank_off);
+3 -3
drivers/gpu/drm/drm_mm.c
··· 431 431 void drm_mm_replace_node(struct drm_mm_node *old, struct drm_mm_node *new) 432 432 { 433 433 list_replace(&old->node_list, &new->node_list); 434 - list_replace(&old->node_list, &new->hole_stack); 434 + list_replace(&old->hole_stack, &new->hole_stack); 435 435 new->hole_follows = old->hole_follows; 436 436 new->mm = old->mm; 437 437 new->start = old->start; ··· 699 699 entry->size); 700 700 total_used += entry->size; 701 701 if (entry->hole_follows) { 702 - hole_start = drm_mm_hole_node_start(&mm->head_node); 703 - hole_end = drm_mm_hole_node_end(&mm->head_node); 702 + hole_start = drm_mm_hole_node_start(entry); 703 + hole_end = drm_mm_hole_node_end(entry); 704 704 hole_size = hole_end - hole_start; 705 705 seq_printf(m, "0x%08lx-0x%08lx: 0x%08lx: free\n", 706 706 hole_start, hole_end, hole_size);
+5 -5
drivers/gpu/drm/i915/intel_display.c
··· 5154 5154 5155 5155 I915_WRITE(DSPCNTR(plane), dspcntr); 5156 5156 POSTING_READ(DSPCNTR(plane)); 5157 - if (!HAS_PCH_SPLIT(dev)) 5158 - intel_enable_plane(dev_priv, plane, pipe); 5159 5157 5160 5158 ret = intel_pipe_set_base(crtc, x, y, old_fb); 5161 5159 ··· 5603 5605 intel_clock_t clock; 5604 5606 5605 5607 if ((dpll & DISPLAY_RATE_SELECT_FPA1) == 0) 5606 - fp = FP0(pipe); 5608 + fp = I915_READ(FP0(pipe)); 5607 5609 else 5608 - fp = FP1(pipe); 5610 + fp = I915_READ(FP1(pipe)); 5609 5611 5610 5612 clock.m1 = (fp & FP_M1_DIV_MASK) >> FP_M1_DIV_SHIFT; 5611 5613 if (IS_PINEVIEW(dev)) { ··· 6577 6579 return ERR_PTR(-ENOENT); 6578 6580 6579 6581 intel_fb = kzalloc(sizeof(*intel_fb), GFP_KERNEL); 6580 - if (!intel_fb) 6582 + if (!intel_fb) { 6583 + drm_gem_object_unreference_unlocked(&obj->base); 6581 6584 return ERR_PTR(-ENOMEM); 6585 + } 6582 6586 6583 6587 ret = intel_framebuffer_init(dev, intel_fb, mode_cmd, obj); 6584 6588 if (ret) {
+15 -2
drivers/gpu/drm/i915/intel_dp.c
··· 1470 1470 1471 1471 if (!HAS_PCH_CPT(dev) && 1472 1472 I915_READ(intel_dp->output_reg) & DP_PIPEB_SELECT) { 1473 - struct intel_crtc *intel_crtc = to_intel_crtc(intel_dp->base.base.crtc); 1473 + struct drm_crtc *crtc = intel_dp->base.base.crtc; 1474 + 1474 1475 /* Hardware workaround: leaving our transcoder select 1475 1476 * set to transcoder B while it's off will prevent the 1476 1477 * corresponding HDMI output on transcoder A. ··· 1486 1485 /* Changes to enable or select take place the vblank 1487 1486 * after being written. 1488 1487 */ 1489 - intel_wait_for_vblank(dev, intel_crtc->pipe); 1488 + if (crtc == NULL) { 1489 + /* We can arrive here never having been attached 1490 + * to a CRTC, for instance, due to inheriting 1491 + * random state from the BIOS. 1492 + * 1493 + * If the pipe is not running, play safe and 1494 + * wait for the clocks to stabilise before 1495 + * continuing. 1496 + */ 1497 + POSTING_READ(intel_dp->output_reg); 1498 + msleep(50); 1499 + } else 1500 + intel_wait_for_vblank(dev, to_intel_crtc(crtc)->pipe); 1490 1501 } 1491 1502 1492 1503 I915_WRITE(intel_dp->output_reg, DP & ~DP_PORT_EN);
+3
drivers/gpu/drm/i915/intel_lvds.c
··· 539 539 struct drm_device *dev = dev_priv->dev; 540 540 struct drm_connector *connector = dev_priv->int_lvds_connector; 541 541 542 + if (dev->switch_power_state != DRM_SWITCH_POWER_ON) 543 + return NOTIFY_OK; 544 + 542 545 /* 543 546 * check and update the status of LVDS connector after receiving 544 547 * the LID nofication event.
-2
drivers/gpu/drm/nouveau/nouveau_mem.c
··· 152 152 { 153 153 struct drm_nouveau_private *dev_priv = dev->dev_private; 154 154 155 - nouveau_bo_ref(NULL, &dev_priv->vga_ram); 156 - 157 155 ttm_bo_device_release(&dev_priv->ttm.bdev); 158 156 159 157 nouveau_ttm_global_release(dev_priv);
+5
drivers/gpu/drm/nouveau/nouveau_state.c
··· 768 768 engine->mc.takedown(dev); 769 769 engine->display.late_takedown(dev); 770 770 771 + if (dev_priv->vga_ram) { 772 + nouveau_bo_unpin(dev_priv->vga_ram); 773 + nouveau_bo_ref(NULL, &dev_priv->vga_ram); 774 + } 775 + 771 776 mutex_lock(&dev->struct_mutex); 772 777 ttm_bo_clean_mm(&dev_priv->ttm.bdev, TTM_PL_VRAM); 773 778 ttm_bo_clean_mm(&dev_priv->ttm.bdev, TTM_PL_TT);
+9 -8
drivers/gpu/drm/radeon/evergreen.c
··· 862 862 SYSTEM_ACCESS_MODE_NOT_IN_SYS | 863 863 SYSTEM_APERTURE_UNMAPPED_ACCESS_PASS_THRU | 864 864 EFFECTIVE_L1_TLB_SIZE(5) | EFFECTIVE_L1_QUEUE_SIZE(5); 865 - WREG32(MC_VM_MD_L1_TLB0_CNTL, tmp); 866 - WREG32(MC_VM_MD_L1_TLB1_CNTL, tmp); 867 - WREG32(MC_VM_MD_L1_TLB2_CNTL, tmp); 865 + if (rdev->flags & RADEON_IS_IGP) { 866 + WREG32(FUS_MC_VM_MD_L1_TLB0_CNTL, tmp); 867 + WREG32(FUS_MC_VM_MD_L1_TLB1_CNTL, tmp); 868 + WREG32(FUS_MC_VM_MD_L1_TLB2_CNTL, tmp); 869 + } else { 870 + WREG32(MC_VM_MD_L1_TLB0_CNTL, tmp); 871 + WREG32(MC_VM_MD_L1_TLB1_CNTL, tmp); 872 + WREG32(MC_VM_MD_L1_TLB2_CNTL, tmp); 873 + } 868 874 WREG32(MC_VM_MB_L1_TLB0_CNTL, tmp); 869 875 WREG32(MC_VM_MB_L1_TLB1_CNTL, tmp); 870 876 WREG32(MC_VM_MB_L1_TLB2_CNTL, tmp); ··· 2928 2922 evergreen_blit_fini(rdev); 2929 2923 rdev->asic->copy = NULL; 2930 2924 dev_warn(rdev->dev, "failed blitter (%d) falling back to memcpy\n", r); 2931 - } 2932 - /* XXX: ontario has problems blitting to gart at the moment */ 2933 - if (rdev->family == CHIP_PALM) { 2934 - rdev->asic->copy = NULL; 2935 - radeon_ttm_set_active_vram_size(rdev, rdev->mc.visible_vram_size); 2936 2925 } 2937 2926 2938 2927 /* allocate wb buffer */
+5
drivers/gpu/drm/radeon/evergreend.h
··· 221 221 #define MC_VM_MD_L1_TLB0_CNTL 0x2654 222 222 #define MC_VM_MD_L1_TLB1_CNTL 0x2658 223 223 #define MC_VM_MD_L1_TLB2_CNTL 0x265C 224 + 225 + #define FUS_MC_VM_MD_L1_TLB0_CNTL 0x265C 226 + #define FUS_MC_VM_MD_L1_TLB1_CNTL 0x2660 227 + #define FUS_MC_VM_MD_L1_TLB2_CNTL 0x2664 228 + 224 229 #define MC_VM_SYSTEM_APERTURE_DEFAULT_ADDR 0x203C 225 230 #define MC_VM_SYSTEM_APERTURE_HIGH_ADDR 0x2038 226 231 #define MC_VM_SYSTEM_APERTURE_LOW_ADDR 0x2034
+5 -4
drivers/gpu/drm/radeon/radeon_atombios.c
··· 431 431 } 432 432 } 433 433 434 - /* Acer laptop (Acer TravelMate 5730G) has an HDMI port 434 + /* Acer laptop (Acer TravelMate 5730/5730G) has an HDMI port 435 435 * on the laptop and a DVI port on the docking station and 436 436 * both share the same encoder, hpd pin, and ddc line. 437 437 * So while the bios table is technically correct, ··· 440 440 * with different crtcs which isn't possible on the hardware 441 441 * side and leaves no crtcs for LVDS or VGA. 442 442 */ 443 - if ((dev->pdev->device == 0x95c4) && 443 + if (((dev->pdev->device == 0x95c4) || (dev->pdev->device == 0x9591)) && 444 444 (dev->pdev->subsystem_vendor == 0x1025) && 445 445 (dev->pdev->subsystem_device == 0x013c)) { 446 446 if ((*connector_type == DRM_MODE_CONNECTOR_DVII) && ··· 1599 1599 memcpy((u8 *)edid, (u8 *)&fake_edid_record->ucFakeEDIDString[0], 1600 1600 fake_edid_record->ucFakeEDIDLength); 1601 1601 1602 - if (drm_edid_is_valid(edid)) 1602 + if (drm_edid_is_valid(edid)) { 1603 1603 rdev->mode_info.bios_hardcoded_edid = edid; 1604 - else 1604 + rdev->mode_info.bios_hardcoded_edid_size = edid_size; 1605 + } else 1605 1606 kfree(edid); 1606 1607 } 1607 1608 }
+27 -2
drivers/gpu/drm/radeon/radeon_atpx_handler.c
··· 15 15 #define ATPX_VERSION 0 16 16 #define ATPX_GPU_PWR 2 17 17 #define ATPX_MUX_SELECT 3 18 + #define ATPX_I2C_MUX_SELECT 4 19 + #define ATPX_SWITCH_START 5 20 + #define ATPX_SWITCH_END 6 18 21 19 22 #define ATPX_INTEGRATED 0 20 23 #define ATPX_DISCRETE 1 ··· 152 149 return radeon_atpx_execute(handle, ATPX_MUX_SELECT, mux_id); 153 150 } 154 151 152 + static int radeon_atpx_switch_i2c_mux(acpi_handle handle, int mux_id) 153 + { 154 + return radeon_atpx_execute(handle, ATPX_I2C_MUX_SELECT, mux_id); 155 + } 156 + 157 + static int radeon_atpx_switch_start(acpi_handle handle, int gpu_id) 158 + { 159 + return radeon_atpx_execute(handle, ATPX_SWITCH_START, gpu_id); 160 + } 161 + 162 + static int radeon_atpx_switch_end(acpi_handle handle, int gpu_id) 163 + { 164 + return radeon_atpx_execute(handle, ATPX_SWITCH_END, gpu_id); 165 + } 155 166 156 167 static int radeon_atpx_switchto(enum vga_switcheroo_client_id id) 157 168 { 169 + int gpu_id; 170 + 158 171 if (id == VGA_SWITCHEROO_IGD) 159 - radeon_atpx_switch_mux(radeon_atpx_priv.atpx_handle, 0); 172 + gpu_id = ATPX_INTEGRATED; 160 173 else 161 - radeon_atpx_switch_mux(radeon_atpx_priv.atpx_handle, 1); 174 + gpu_id = ATPX_DISCRETE; 175 + 176 + radeon_atpx_switch_start(radeon_atpx_priv.atpx_handle, gpu_id); 177 + radeon_atpx_switch_mux(radeon_atpx_priv.atpx_handle, gpu_id); 178 + radeon_atpx_switch_i2c_mux(radeon_atpx_priv.atpx_handle, gpu_id); 179 + radeon_atpx_switch_end(radeon_atpx_priv.atpx_handle, gpu_id); 180 + 162 181 return 0; 163 182 } 164 183
+3 -3
drivers/gpu/drm/radeon/radeon_cursor.c
··· 167 167 return -EINVAL; 168 168 } 169 169 170 - radeon_crtc->cursor_width = width; 171 - radeon_crtc->cursor_height = height; 172 - 173 170 obj = drm_gem_object_lookup(crtc->dev, file_priv, handle); 174 171 if (!obj) { 175 172 DRM_ERROR("Cannot find cursor object %x for crtc %d\n", handle, radeon_crtc->crtc_id); ··· 176 179 ret = radeon_gem_object_pin(obj, RADEON_GEM_DOMAIN_VRAM, &gpu_addr); 177 180 if (ret) 178 181 goto fail; 182 + 183 + radeon_crtc->cursor_width = width; 184 + radeon_crtc->cursor_height = height; 179 185 180 186 radeon_lock_cursor(crtc, true); 181 187 /* XXX only 27 bit offset for legacy cursor */
+3
drivers/gpu/drm/radeon/radeon_kms.c
··· 234 234 return -EINVAL; 235 235 } 236 236 break; 237 + case RADEON_INFO_FUSION_GART_WORKING: 238 + value = 1; 239 + break; 237 240 default: 238 241 DRM_DEBUG_KMS("Invalid request %d\n", info->request); 239 242 return -EINVAL;
+64 -11
drivers/input/touchscreen/wm831x-ts.c
··· 68 68 unsigned int pd_irq; 69 69 bool pressure; 70 70 bool pen_down; 71 + struct work_struct pd_data_work; 71 72 }; 73 + 74 + static void wm831x_pd_data_work(struct work_struct *work) 75 + { 76 + struct wm831x_ts *wm831x_ts = 77 + container_of(work, struct wm831x_ts, pd_data_work); 78 + 79 + if (wm831x_ts->pen_down) { 80 + enable_irq(wm831x_ts->data_irq); 81 + dev_dbg(wm831x_ts->wm831x->dev, "IRQ PD->DATA done\n"); 82 + } else { 83 + enable_irq(wm831x_ts->pd_irq); 84 + dev_dbg(wm831x_ts->wm831x->dev, "IRQ DATA->PD done\n"); 85 + } 86 + } 72 87 73 88 static irqreturn_t wm831x_ts_data_irq(int irq, void *irq_data) 74 89 { ··· 125 110 } 126 111 127 112 if (!wm831x_ts->pen_down) { 113 + /* Switch from data to pen down */ 114 + dev_dbg(wm831x->dev, "IRQ DATA->PD\n"); 115 + 128 116 disable_irq_nosync(wm831x_ts->data_irq); 129 117 130 118 /* Don't need data any more */ ··· 146 128 ABS_PRESSURE, 0); 147 129 148 130 input_report_key(wm831x_ts->input_dev, BTN_TOUCH, 0); 131 + 132 + schedule_work(&wm831x_ts->pd_data_work); 133 + } else { 134 + input_report_key(wm831x_ts->input_dev, BTN_TOUCH, 1); 149 135 } 150 136 151 137 input_sync(wm831x_ts->input_dev); ··· 163 141 struct wm831x *wm831x = wm831x_ts->wm831x; 164 142 int ena = 0; 165 143 144 + if (wm831x_ts->pen_down) 145 + return IRQ_HANDLED; 146 + 147 + disable_irq_nosync(wm831x_ts->pd_irq); 148 + 166 149 /* Start collecting data */ 167 150 if (wm831x_ts->pressure) 168 151 ena |= WM831X_TCH_Z_ENA; ··· 176 149 WM831X_TCH_X_ENA | WM831X_TCH_Y_ENA | WM831X_TCH_Z_ENA, 177 150 WM831X_TCH_X_ENA | WM831X_TCH_Y_ENA | ena); 178 151 179 - input_report_key(wm831x_ts->input_dev, BTN_TOUCH, 1); 180 - input_sync(wm831x_ts->input_dev); 181 - 182 152 wm831x_set_bits(wm831x, WM831X_INTERRUPT_STATUS_1, 183 153 WM831X_TCHPD_EINT, WM831X_TCHPD_EINT); 184 154 185 155 wm831x_ts->pen_down = true; 186 - enable_irq(wm831x_ts->data_irq); 156 + 157 + /* Switch from pen down to data */ 158 + dev_dbg(wm831x->dev, "IRQ PD->DATA\n"); 159 + schedule_work(&wm831x_ts->pd_data_work); 187 160 188 161 return IRQ_HANDLED; 189 162 } ··· 209 182 struct wm831x_ts *wm831x_ts = input_get_drvdata(idev); 210 183 struct wm831x *wm831x = wm831x_ts->wm831x; 211 184 185 + /* Shut the controller down, disabling all other functionality too */ 212 186 wm831x_set_bits(wm831x, WM831X_TOUCH_CONTROL_1, 213 - WM831X_TCH_ENA | WM831X_TCH_CVT_ENA | 214 - WM831X_TCH_X_ENA | WM831X_TCH_Y_ENA | 215 - WM831X_TCH_Z_ENA, 0); 187 + WM831X_TCH_ENA | WM831X_TCH_X_ENA | 188 + WM831X_TCH_Y_ENA | WM831X_TCH_Z_ENA, 0); 216 189 217 - if (wm831x_ts->pen_down) 190 + /* Make sure any pending IRQs are done, the above will prevent 191 + * new ones firing. 192 + */ 193 + synchronize_irq(wm831x_ts->data_irq); 194 + synchronize_irq(wm831x_ts->pd_irq); 195 + 196 + /* Make sure the IRQ completion work is quiesced */ 197 + flush_work_sync(&wm831x_ts->pd_data_work); 198 + 199 + /* If we ended up with the pen down then make sure we revert back 200 + * to pen detection state for the next time we start up. 201 + */ 202 + if (wm831x_ts->pen_down) { 218 203 disable_irq(wm831x_ts->data_irq); 204 + enable_irq(wm831x_ts->pd_irq); 205 + wm831x_ts->pen_down = false; 206 + } 219 207 } 220 208 221 209 static __devinit int wm831x_ts_probe(struct platform_device *pdev) ··· 240 198 struct wm831x_pdata *core_pdata = dev_get_platdata(pdev->dev.parent); 241 199 struct wm831x_touch_pdata *pdata = NULL; 242 200 struct input_dev *input_dev; 243 - int error; 201 + int error, irqf; 244 202 245 203 if (core_pdata) 246 204 pdata = core_pdata->touch; ··· 254 212 255 213 wm831x_ts->wm831x = wm831x; 256 214 wm831x_ts->input_dev = input_dev; 215 + INIT_WORK(&wm831x_ts->pd_data_work, wm831x_pd_data_work); 257 216 258 217 /* 259 218 * If we have a direct IRQ use it, otherwise use the interrupt ··· 313 270 wm831x_set_bits(wm831x, WM831X_TOUCH_CONTROL_1, 314 271 WM831X_TCH_RATE_MASK, 6); 315 272 273 + if (pdata && pdata->data_irqf) 274 + irqf = pdata->data_irqf; 275 + else 276 + irqf = IRQF_TRIGGER_HIGH; 277 + 316 278 error = request_threaded_irq(wm831x_ts->data_irq, 317 279 NULL, wm831x_ts_data_irq, 318 - IRQF_ONESHOT, 280 + irqf | IRQF_ONESHOT, 319 281 "Touchscreen data", wm831x_ts); 320 282 if (error) { 321 283 dev_err(&pdev->dev, "Failed to request data IRQ %d: %d\n", ··· 329 281 } 330 282 disable_irq(wm831x_ts->data_irq); 331 283 284 + if (pdata && pdata->pd_irqf) 285 + irqf = pdata->pd_irqf; 286 + else 287 + irqf = IRQF_TRIGGER_HIGH; 288 + 332 289 error = request_threaded_irq(wm831x_ts->pd_irq, 333 290 NULL, wm831x_ts_pen_down_irq, 334 - IRQF_ONESHOT, 291 + irqf | IRQF_ONESHOT, 335 292 "Touchscreen pen down", wm831x_ts); 336 293 if (error) { 337 294 dev_err(&pdev->dev, "Failed to request pen down IRQ %d: %d\n",
+2
drivers/media/dvb/dvb-usb/Kconfig
··· 356 356 select DVB_TDA826X if !DVB_FE_CUSTOMISE 357 357 select DVB_STV0288 if !DVB_FE_CUSTOMISE 358 358 select DVB_IX2505V if !DVB_FE_CUSTOMISE 359 + select DVB_STV0299 if !DVB_FE_CUSTOMISE 360 + select DVB_PLL if !DVB_FE_CUSTOMISE 359 361 help 360 362 Say Y here to support the LME DM04/QQBOX DVB-S USB2.0 . 361 363
+1
drivers/media/dvb/ngene/ngene-core.c
··· 1520 1520 if (dev->ci.en && (io & NGENE_IO_TSOUT)) { 1521 1521 dvb_ca_en50221_init(adapter, dev->ci.en, 0, 1); 1522 1522 set_transfer(chan, 1); 1523 + chan->dev->channel[2].DataFormatFlags = DF_SWAP32; 1523 1524 set_transfer(&chan->dev->channel[2], 1); 1524 1525 dvb_register_device(adapter, &chan->ci_dev, 1525 1526 &ngene_dvbdev_ci, (void *) chan,
+1 -1
drivers/media/radio/saa7706h.c
··· 376 376 v4l_info(client, "chip found @ 0x%02x (%s)\n", 377 377 client->addr << 1, client->adapter->name); 378 378 379 - state = kmalloc(sizeof(struct saa7706h_state), GFP_KERNEL); 379 + state = kzalloc(sizeof(struct saa7706h_state), GFP_KERNEL); 380 380 if (state == NULL) 381 381 return -ENOMEM; 382 382 sd = &state->sd;
+1 -1
drivers/media/radio/tef6862.c
··· 176 176 v4l_info(client, "chip found @ 0x%02x (%s)\n", 177 177 client->addr << 1, client->adapter->name); 178 178 179 - state = kmalloc(sizeof(struct tef6862_state), GFP_KERNEL); 179 + state = kzalloc(sizeof(struct tef6862_state), GFP_KERNEL); 180 180 if (state == NULL) 181 181 return -ENOMEM; 182 182 state->freq = TEF6862_LO_FREQ;
+27 -4
drivers/media/rc/imon.c
··· 46 46 #define MOD_AUTHOR "Jarod Wilson <jarod@wilsonet.com>" 47 47 #define MOD_DESC "Driver for SoundGraph iMON MultiMedia IR/Display" 48 48 #define MOD_NAME "imon" 49 - #define MOD_VERSION "0.9.2" 49 + #define MOD_VERSION "0.9.3" 50 50 51 51 #define DISPLAY_MINOR_BASE 144 52 52 #define DEVICE_NAME "lcd%d" ··· 460 460 } 461 461 462 462 /** 463 - * Sends a packet to the device -- this function must be called 464 - * with ictx->lock held. 463 + * Sends a packet to the device -- this function must be called with 464 + * ictx->lock held, or its unlock/lock sequence while waiting for tx 465 + * to complete can/will lead to a deadlock. 465 466 */ 466 467 static int send_packet(struct imon_context *ictx) 467 468 { ··· 992 991 * the iMON remotes, and those used by the Windows MCE remotes (which is 993 992 * really just RC-6), but only one or the other at a time, as the signals 994 993 * are decoded onboard the receiver. 994 + * 995 + * This function gets called two different ways, one way is from 996 + * rc_register_device, for initial protocol selection/setup, and the other is 997 + * via a userspace-initiated protocol change request, either by direct sysfs 998 + * prodding or by something like ir-keytable. In the rc_register_device case, 999 + * the imon context lock is already held, but when initiated from userspace, 1000 + * it is not, so we must acquire it prior to calling send_packet, which 1001 + * requires that the lock is held. 995 1002 */ 996 1003 static int imon_ir_change_protocol(struct rc_dev *rc, u64 rc_type) 997 1004 { 998 1005 int retval; 999 1006 struct imon_context *ictx = rc->priv; 1000 1007 struct device *dev = ictx->dev; 1008 + bool unlock = false; 1001 1009 unsigned char ir_proto_packet[] = { 1002 1010 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x86 }; 1003 1011 ··· 1039 1029 1040 1030 memcpy(ictx->usb_tx_buf, &ir_proto_packet, sizeof(ir_proto_packet)); 1041 1031 1032 + if (!mutex_is_locked(&ictx->lock)) { 1033 + unlock = true; 1034 + mutex_lock(&ictx->lock); 1035 + } 1036 + 1042 1037 retval = send_packet(ictx); 1043 1038 if (retval) 1044 1039 goto out; ··· 1052 1037 ictx->pad_mouse = false; 1053 1038 1054 1039 out: 1040 + if (unlock) 1041 + mutex_unlock(&ictx->lock); 1042 + 1055 1043 return retval; 1056 1044 } 1057 1045 ··· 2152 2134 goto rdev_setup_failed; 2153 2135 } 2154 2136 2137 + mutex_unlock(&ictx->lock); 2155 2138 return ictx; 2156 2139 2157 2140 rdev_setup_failed: ··· 2224 2205 goto urb_submit_failed; 2225 2206 } 2226 2207 2208 + mutex_unlock(&ictx->lock); 2227 2209 return ictx; 2228 2210 2229 2211 urb_submit_failed: ··· 2319 2299 usb_set_intfdata(interface, ictx); 2320 2300 2321 2301 if (ifnum == 0) { 2302 + mutex_lock(&ictx->lock); 2303 + 2322 2304 if (product == 0xffdc && ictx->rf_device) { 2323 2305 sysfs_err = sysfs_create_group(&interface->dev.kobj, 2324 2306 &imon_rf_attr_group); ··· 2331 2309 2332 2310 if (ictx->display_supported) 2333 2311 imon_init_display(ictx, interface); 2312 + 2313 + mutex_unlock(&ictx->lock); 2334 2314 } 2335 2315 2336 2316 dev_info(dev, "iMON device (%04x:%04x, intf%d) on " 2337 2317 "usb<%d:%d> initialized\n", vendor, product, ifnum, 2338 2318 usbdev->bus->busnum, usbdev->devnum); 2339 2319 2340 - mutex_unlock(&ictx->lock); 2341 2320 mutex_unlock(&driver_lock); 2342 2321 2343 2322 return 0;
+1
drivers/media/rc/ite-cir.c
··· 36 36 #include <linux/io.h> 37 37 #include <linux/interrupt.h> 38 38 #include <linux/sched.h> 39 + #include <linux/delay.h> 39 40 #include <linux/slab.h> 40 41 #include <linux/input.h> 41 42 #include <linux/bitops.h>
+2
drivers/media/rc/mceusb.c
··· 220 220 { USB_DEVICE(VENDOR_PHILIPS, 0x206c) }, 221 221 /* Philips/Spinel plus IR transceiver for ASUS */ 222 222 { USB_DEVICE(VENDOR_PHILIPS, 0x2088) }, 223 + /* Philips IR transceiver (Dell branded) */ 224 + { USB_DEVICE(VENDOR_PHILIPS, 0x2093) }, 223 225 /* Realtek MCE IR Receiver and card reader */ 224 226 { USB_DEVICE(VENDOR_REALTEK, 0x0161), 225 227 .driver_info = MULTIFUNCTION },
+3 -1
drivers/media/rc/rc-main.c
··· 707 707 { 708 708 struct rc_dev *rdev = input_get_drvdata(idev); 709 709 710 - rdev->close(rdev); 710 + if (rdev) 711 + rdev->close(rdev); 711 712 } 712 713 713 714 /* class for /sys/class/rc */ ··· 734 733 { RC_TYPE_SONY, "sony" }, 735 734 { RC_TYPE_RC5_SZ, "rc-5-sz" }, 736 735 { RC_TYPE_LIRC, "lirc" }, 736 + { RC_TYPE_OTHER, "other" }, 737 737 }; 738 738 739 739 #define PROTO_NONE "none"
+1 -1
drivers/media/video/m52790.c
··· 174 174 v4l_info(client, "chip found @ 0x%x (%s)\n", 175 175 client->addr << 1, client->adapter->name); 176 176 177 - state = kmalloc(sizeof(struct m52790_state), GFP_KERNEL); 177 + state = kzalloc(sizeof(struct m52790_state), GFP_KERNEL); 178 178 if (state == NULL) 179 179 return -ENOMEM; 180 180
+1 -1
drivers/media/video/tda9840.c
··· 171 171 v4l_info(client, "chip found @ 0x%x (%s)\n", 172 172 client->addr << 1, client->adapter->name); 173 173 174 - sd = kmalloc(sizeof(struct v4l2_subdev), GFP_KERNEL); 174 + sd = kzalloc(sizeof(struct v4l2_subdev), GFP_KERNEL); 175 175 if (sd == NULL) 176 176 return -ENOMEM; 177 177 v4l2_i2c_subdev_init(sd, client, &tda9840_ops);
+1 -1
drivers/media/video/tea6415c.c
··· 152 152 153 153 v4l_info(client, "chip found @ 0x%x (%s)\n", 154 154 client->addr << 1, client->adapter->name); 155 - sd = kmalloc(sizeof(struct v4l2_subdev), GFP_KERNEL); 155 + sd = kzalloc(sizeof(struct v4l2_subdev), GFP_KERNEL); 156 156 if (sd == NULL) 157 157 return -ENOMEM; 158 158 v4l2_i2c_subdev_init(sd, client, &tea6415c_ops);
+1 -1
drivers/media/video/tea6420.c
··· 125 125 v4l_info(client, "chip found @ 0x%x (%s)\n", 126 126 client->addr << 1, client->adapter->name); 127 127 128 - sd = kmalloc(sizeof(struct v4l2_subdev), GFP_KERNEL); 128 + sd = kzalloc(sizeof(struct v4l2_subdev), GFP_KERNEL); 129 129 if (sd == NULL) 130 130 return -ENOMEM; 131 131 v4l2_i2c_subdev_init(sd, client, &tea6420_ops);
+1 -1
drivers/media/video/upd64031a.c
··· 230 230 v4l_info(client, "chip found @ 0x%x (%s)\n", 231 231 client->addr << 1, client->adapter->name); 232 232 233 - state = kmalloc(sizeof(struct upd64031a_state), GFP_KERNEL); 233 + state = kzalloc(sizeof(struct upd64031a_state), GFP_KERNEL); 234 234 if (state == NULL) 235 235 return -ENOMEM; 236 236 sd = &state->sd;
+1 -1
drivers/media/video/upd64083.c
··· 202 202 v4l_info(client, "chip found @ 0x%x (%s)\n", 203 203 client->addr << 1, client->adapter->name); 204 204 205 - state = kmalloc(sizeof(struct upd64083_state), GFP_KERNEL); 205 + state = kzalloc(sizeof(struct upd64083_state), GFP_KERNEL); 206 206 if (state == NULL) 207 207 return -ENOMEM; 208 208 sd = &state->sd;
+3 -6
drivers/mfd/omap-usb-host.c
··· 25 25 #include <linux/dma-mapping.h> 26 26 #include <linux/spinlock.h> 27 27 #include <linux/gpio.h> 28 - #include <linux/regulator/consumer.h> 29 28 #include <plat/usb.h> 30 29 31 30 #define USBHS_DRIVER_NAME "usbhs-omap" ··· 699 700 dev_dbg(dev, "starting TI HSUSB Controller\n"); 700 701 if (!pdata) { 701 702 dev_dbg(dev, "missing platform_data\n"); 702 - ret = -ENODEV; 703 - goto end_enable; 703 + return -ENODEV; 704 704 } 705 705 706 706 spin_lock_irqsave(&omap->lock, flags); ··· 913 915 914 916 end_count: 915 917 omap->count++; 916 - goto end_enable; 918 + spin_unlock_irqrestore(&omap->lock, flags); 919 + return 0; 917 920 918 921 err_tll: 919 922 if (pdata->ehci_data->phy_reset) { ··· 930 931 clk_disable(omap->usbhost_fs_fck); 931 932 clk_disable(omap->usbhost_hs_fck); 932 933 clk_disable(omap->usbhost_ick); 933 - 934 - end_enable: 935 934 spin_unlock_irqrestore(&omap->lock, flags); 936 935 return ret; 937 936 }
+1
drivers/mmc/core/bus.c
··· 284 284 type = "SD-combo"; 285 285 if (mmc_card_blockaddr(card)) 286 286 type = "SDHC-combo"; 287 + break; 287 288 default: 288 289 type = "?"; 289 290 break;
+4 -5
drivers/mmc/core/host.c
··· 94 94 spin_unlock_irqrestore(&host->clk_lock, flags); 95 95 return; 96 96 } 97 - mutex_lock(&host->clk_gate_mutex); 97 + mmc_claim_host(host); 98 98 spin_lock_irqsave(&host->clk_lock, flags); 99 99 if (!host->clk_requests) { 100 100 spin_unlock_irqrestore(&host->clk_lock, flags); ··· 104 104 pr_debug("%s: gated MCI clock\n", mmc_hostname(host)); 105 105 } 106 106 spin_unlock_irqrestore(&host->clk_lock, flags); 107 - mutex_unlock(&host->clk_gate_mutex); 107 + mmc_release_host(host); 108 108 } 109 109 110 110 /* ··· 130 130 { 131 131 unsigned long flags; 132 132 133 - mutex_lock(&host->clk_gate_mutex); 133 + mmc_claim_host(host); 134 134 spin_lock_irqsave(&host->clk_lock, flags); 135 135 if (host->clk_gated) { 136 136 spin_unlock_irqrestore(&host->clk_lock, flags); ··· 140 140 } 141 141 host->clk_requests++; 142 142 spin_unlock_irqrestore(&host->clk_lock, flags); 143 - mutex_unlock(&host->clk_gate_mutex); 143 + mmc_release_host(host); 144 144 } 145 145 146 146 /** ··· 215 215 host->clk_gated = false; 216 216 INIT_WORK(&host->clk_gate_work, mmc_host_clk_gate_work); 217 217 spin_lock_init(&host->clk_lock); 218 - mutex_init(&host->clk_gate_mutex); 219 218 } 220 219 221 220 /**
+1 -1
drivers/mmc/host/omap.c
··· 832 832 return IRQ_HANDLED; 833 833 } 834 834 835 - if (end_command) 835 + if (end_command && host->cmd) 836 836 mmc_omap_cmd_done(host, host->cmd); 837 837 if (host->data != NULL) { 838 838 if (transfer_error)
+1
drivers/mmc/host/sdhci-pci.c
··· 957 957 host->ioaddr = pci_ioremap_bar(pdev, bar); 958 958 if (!host->ioaddr) { 959 959 dev_err(&pdev->dev, "failed to remap registers\n"); 960 + ret = -ENOMEM; 960 961 goto release; 961 962 } 962 963
+8 -1
drivers/mmc/host/sdhci.c
··· 1334 1334 1335 1335 host = (struct sdhci_host*)param; 1336 1336 1337 + /* 1338 + * If this tasklet gets rescheduled while running, it will 1339 + * be run again afterwards but without any active request. 1340 + */ 1341 + if (!host->mrq) 1342 + return; 1343 + 1337 1344 spin_lock_irqsave(&host->lock, flags); 1338 1345 1339 1346 del_timer(&host->timer); ··· 1352 1345 * upon error conditions. 1353 1346 */ 1354 1347 if (!(host->flags & SDHCI_DEVICE_DEAD) && 1355 - (mrq->cmd->error || 1348 + ((mrq->cmd && mrq->cmd->error) || 1356 1349 (mrq->data && (mrq->data->error || 1357 1350 (mrq->data->stop && mrq->data->stop->error))) || 1358 1351 (host->quirks & SDHCI_QUIRK_RESET_AFTER_REQUEST))) {
+5 -5
drivers/mmc/host/tmio_mmc_pio.c
··· 728 728 tmio_mmc_set_clock(host, ios->clock); 729 729 730 730 /* Power sequence - OFF -> UP -> ON */ 731 - if (ios->power_mode == MMC_POWER_OFF || !ios->clock) { 731 + if (ios->power_mode == MMC_POWER_UP) { 732 + /* power up SD bus */ 733 + if (host->set_pwr) 734 + host->set_pwr(host->pdev, 1); 735 + } else if (ios->power_mode == MMC_POWER_OFF || !ios->clock) { 732 736 /* power down SD bus */ 733 737 if (ios->power_mode == MMC_POWER_OFF && host->set_pwr) 734 738 host->set_pwr(host->pdev, 0); 735 739 tmio_mmc_clk_stop(host); 736 - } else if (ios->power_mode == MMC_POWER_UP) { 737 - /* power up SD bus */ 738 - if (host->set_pwr) 739 - host->set_pwr(host->pdev, 1); 740 740 } else { 741 741 /* start bus clock */ 742 742 tmio_mmc_clk_start(host);
+41 -16
drivers/platform/x86/eeepc-laptop.c
··· 585 585 return true; 586 586 } 587 587 588 - static void eeepc_rfkill_hotplug(struct eeepc_laptop *eeepc) 588 + static void eeepc_rfkill_hotplug(struct eeepc_laptop *eeepc, acpi_handle handle) 589 589 { 590 + struct pci_dev *port; 590 591 struct pci_dev *dev; 591 592 struct pci_bus *bus; 592 593 bool blocked = eeepc_wlan_rfkill_blocked(eeepc); ··· 600 599 mutex_lock(&eeepc->hotplug_lock); 601 600 602 601 if (eeepc->hotplug_slot) { 603 - bus = pci_find_bus(0, 1); 602 + port = acpi_get_pci_dev(handle); 603 + if (!port) { 604 + pr_warning("Unable to find port\n"); 605 + goto out_unlock; 606 + } 607 + 608 + bus = port->subordinate; 609 + 604 610 if (!bus) { 605 - pr_warning("Unable to find PCI bus 1?\n"); 611 + pr_warning("Unable to find PCI bus?\n"); 606 612 goto out_unlock; 607 613 } 608 614 ··· 617 609 pr_err("Unable to read PCI config space?\n"); 618 610 goto out_unlock; 619 611 } 612 + 620 613 absent = (l == 0xffffffff); 621 614 622 615 if (blocked != absent) { ··· 656 647 mutex_unlock(&eeepc->hotplug_lock); 657 648 } 658 649 650 + static void eeepc_rfkill_hotplug_update(struct eeepc_laptop *eeepc, char *node) 651 + { 652 + acpi_status status = AE_OK; 653 + acpi_handle handle; 654 + 655 + status = acpi_get_handle(NULL, node, &handle); 656 + 657 + if (ACPI_SUCCESS(status)) 658 + eeepc_rfkill_hotplug(eeepc, handle); 659 + } 660 + 659 661 static void eeepc_rfkill_notify(acpi_handle handle, u32 event, void *data) 660 662 { 661 663 struct eeepc_laptop *eeepc = data; ··· 674 654 if (event != ACPI_NOTIFY_BUS_CHECK) 675 655 return; 676 656 677 - eeepc_rfkill_hotplug(eeepc); 657 + eeepc_rfkill_hotplug(eeepc, handle); 678 658 } 679 659 680 660 static int eeepc_register_rfkill_notifier(struct eeepc_laptop *eeepc, ··· 692 672 eeepc); 693 673 if (ACPI_FAILURE(status)) 694 674 pr_warning("Failed to register notify on %s\n", node); 675 + /* 676 + * Refresh pci hotplug in case the rfkill state was 677 + * changed during setup. 678 + */ 679 + eeepc_rfkill_hotplug(eeepc, handle); 695 680 } else 696 681 return -ENODEV; 697 682 ··· 718 693 if (ACPI_FAILURE(status)) 719 694 pr_err("Error removing rfkill notify handler %s\n", 720 695 node); 696 + /* 697 + * Refresh pci hotplug in case the rfkill 698 + * state was changed after 699 + * eeepc_unregister_rfkill_notifier() 700 + */ 701 + eeepc_rfkill_hotplug(eeepc, handle); 721 702 } 722 703 } 723 704 ··· 847 816 rfkill_destroy(eeepc->wlan_rfkill); 848 817 eeepc->wlan_rfkill = NULL; 849 818 } 850 - /* 851 - * Refresh pci hotplug in case the rfkill state was changed after 852 - * eeepc_unregister_rfkill_notifier() 853 - */ 854 - eeepc_rfkill_hotplug(eeepc); 819 + 855 820 if (eeepc->hotplug_slot) 856 821 pci_hp_deregister(eeepc->hotplug_slot); 857 822 ··· 916 889 eeepc_register_rfkill_notifier(eeepc, "\\_SB.PCI0.P0P5"); 917 890 eeepc_register_rfkill_notifier(eeepc, "\\_SB.PCI0.P0P6"); 918 891 eeepc_register_rfkill_notifier(eeepc, "\\_SB.PCI0.P0P7"); 919 - /* 920 - * Refresh pci hotplug in case the rfkill state was changed during 921 - * setup. 922 - */ 923 - eeepc_rfkill_hotplug(eeepc); 924 892 925 893 exit: 926 894 if (result && result != -ENODEV) ··· 950 928 struct eeepc_laptop *eeepc = dev_get_drvdata(device); 951 929 952 930 /* Refresh both wlan rfkill state and pci hotplug */ 953 - if (eeepc->wlan_rfkill) 954 - eeepc_rfkill_hotplug(eeepc); 931 + if (eeepc->wlan_rfkill) { 932 + eeepc_rfkill_hotplug_update(eeepc, "\\_SB.PCI0.P0P5"); 933 + eeepc_rfkill_hotplug_update(eeepc, "\\_SB.PCI0.P0P6"); 934 + eeepc_rfkill_hotplug_update(eeepc, "\\_SB.PCI0.P0P7"); 935 + } 955 936 956 937 if (eeepc->bluetooth_rfkill) 957 938 rfkill_set_sw_state(eeepc->bluetooth_rfkill,
+105 -25
drivers/platform/x86/sony-laptop.c
··· 934 934 /* 935 935 * Backlight device 936 936 */ 937 + struct sony_backlight_props { 938 + struct backlight_device *dev; 939 + int handle; 940 + u8 offset; 941 + u8 maxlvl; 942 + }; 943 + struct sony_backlight_props sony_bl_props; 944 + 937 945 static int sony_backlight_update_status(struct backlight_device *bd) 938 946 { 939 947 return acpi_callsetfunc(sony_nc_acpi_handle, "SBRT", ··· 962 954 { 963 955 int result; 964 956 int *handle = (int *)bl_get_data(bd); 957 + struct sony_backlight_props *sdev = 958 + (struct sony_backlight_props *)bl_get_data(bd); 965 959 966 - sony_call_snc_handle(*handle, 0x0200, &result); 960 + sony_call_snc_handle(sdev->handle, 0x0200, &result); 967 961 968 - return result & 0xff; 962 + return (result & 0xff) - sdev->offset; 969 963 } 970 964 971 965 static int sony_nc_update_status_ng(struct backlight_device *bd) 972 966 { 973 967 int value, result; 974 968 int *handle = (int *)bl_get_data(bd); 969 + struct sony_backlight_props *sdev = 970 + (struct sony_backlight_props *)bl_get_data(bd); 975 971 976 - value = bd->props.brightness; 977 - sony_call_snc_handle(*handle, 0x0100 | (value << 16), &result); 972 + value = bd->props.brightness + sdev->offset; 973 + if (sony_call_snc_handle(sdev->handle, 0x0100 | (value << 16), &result)) 974 + return -EIO; 978 975 979 - return sony_nc_get_brightness_ng(bd); 976 + return value; 980 977 } 981 978 982 979 static const struct backlight_ops sony_backlight_ops = { ··· 994 981 .update_status = sony_nc_update_status_ng, 995 982 .get_brightness = sony_nc_get_brightness_ng, 996 983 }; 997 - static int backlight_ng_handle; 998 - static struct backlight_device *sony_backlight_device; 999 984 1000 985 /* 1001 986 * New SNC-only Vaios event mapping to driver known keys ··· 1560 1549 &ignore); 1561 1550 } 1562 1551 1552 + static void sony_nc_backlight_ng_read_limits(int handle, 1553 + struct sony_backlight_props *props) 1554 + { 1555 + int offset; 1556 + acpi_status status; 1557 + u8 brlvl, i; 1558 + u8 min = 0xff, max = 0x00; 1559 + struct acpi_object_list params; 1560 + union acpi_object in_obj; 1561 + union acpi_object *lvl_enum; 1562 + struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL }; 1563 + 1564 + props->handle = handle; 1565 + props->offset = 0; 1566 + props->maxlvl = 0xff; 1567 + 1568 + offset = sony_find_snc_handle(handle); 1569 + if (offset < 0) 1570 + return; 1571 + 1572 + /* try to read the boundaries from ACPI tables, if we fail the above 1573 + * defaults should be reasonable 1574 + */ 1575 + params.count = 1; 1576 + params.pointer = &in_obj; 1577 + in_obj.type = ACPI_TYPE_INTEGER; 1578 + in_obj.integer.value = offset; 1579 + status = acpi_evaluate_object(sony_nc_acpi_handle, "SN06", &params, 1580 + &buffer); 1581 + if (ACPI_FAILURE(status)) 1582 + return; 1583 + 1584 + lvl_enum = (union acpi_object *) buffer.pointer; 1585 + if (!lvl_enum) { 1586 + pr_err("No SN06 return object."); 1587 + return; 1588 + } 1589 + if (lvl_enum->type != ACPI_TYPE_BUFFER) { 1590 + pr_err("Invalid SN06 return object 0x%.2x\n", 1591 + lvl_enum->type); 1592 + goto out_invalid; 1593 + } 1594 + 1595 + /* the buffer lists brightness levels available, brightness levels are 1596 + * from 0 to 8 in the array, other values are used by ALS control. 1597 + */ 1598 + for (i = 0; i < 9 && i < lvl_enum->buffer.length; i++) { 1599 + 1600 + brlvl = *(lvl_enum->buffer.pointer + i); 1601 + dprintk("Brightness level: %d\n", brlvl); 1602 + 1603 + if (!brlvl) 1604 + break; 1605 + 1606 + if (brlvl > max) 1607 + max = brlvl; 1608 + if (brlvl < min) 1609 + min = brlvl; 1610 + } 1611 + props->offset = min; 1612 + props->maxlvl = max; 1613 + dprintk("Brightness levels: min=%d max=%d\n", props->offset, 1614 + props->maxlvl); 1615 + 1616 + out_invalid: 1617 + kfree(buffer.pointer); 1618 + return; 1619 + } 1620 + 1563 1621 static void sony_nc_backlight_setup(void) 1564 1622 { 1565 1623 acpi_handle unused; ··· 1637 1557 struct backlight_properties props; 1638 1558 1639 1559 if (sony_find_snc_handle(0x12f) != -1) { 1640 - backlight_ng_handle = 0x12f; 1641 1560 ops = &sony_backlight_ng_ops; 1642 - max_brightness = 0xff; 1561 + sony_nc_backlight_ng_read_limits(0x12f, &sony_bl_props); 1562 + max_brightness = sony_bl_props.maxlvl - sony_bl_props.offset; 1643 1563 1644 1564 } else if (sony_find_snc_handle(0x137) != -1) { 1645 - backlight_ng_handle = 0x137; 1646 1565 ops = &sony_backlight_ng_ops; 1647 - max_brightness = 0xff; 1566 + sony_nc_backlight_ng_read_limits(0x137, &sony_bl_props); 1567 + max_brightness = sony_bl_props.maxlvl - sony_bl_props.offset; 1648 1568 1649 1569 } else if (ACPI_SUCCESS(acpi_get_handle(sony_nc_acpi_handle, "GBRT", 1650 1570 &unused))) { ··· 1657 1577 memset(&props, 0, sizeof(struct backlight_properties)); 1658 1578 props.type = BACKLIGHT_PLATFORM; 1659 1579 props.max_brightness = max_brightness; 1660 - sony_backlight_device = backlight_device_register("sony", NULL, 1661 - &backlight_ng_handle, 1662 - ops, &props); 1580 + sony_bl_props.dev = backlight_device_register("sony", NULL, 1581 + &sony_bl_props, 1582 + ops, &props); 1663 1583 1664 - if (IS_ERR(sony_backlight_device)) { 1665 - pr_warning(DRV_PFX "unable to register backlight device\n"); 1666 - sony_backlight_device = NULL; 1584 + if (IS_ERR(sony_bl_props.dev)) { 1585 + pr_warn(DRV_PFX "unable to register backlight device\n"); 1586 + sony_bl_props.dev = NULL; 1667 1587 } else 1668 - sony_backlight_device->props.brightness = 1669 - ops->get_brightness(sony_backlight_device); 1588 + sony_bl_props.dev->props.brightness = 1589 + ops->get_brightness(sony_bl_props.dev); 1670 1590 } 1671 1591 1672 1592 static void sony_nc_backlight_cleanup(void) 1673 1593 { 1674 - if (sony_backlight_device) 1675 - backlight_device_unregister(sony_backlight_device); 1594 + if (sony_bl_props.dev) 1595 + backlight_device_unregister(sony_bl_props.dev); 1676 1596 } 1677 1597 1678 1598 static int sony_nc_add(struct acpi_device *device) ··· 2670 2590 mutex_lock(&spic_dev.lock); 2671 2591 switch (cmd) { 2672 2592 case SONYPI_IOCGBRT: 2673 - if (sony_backlight_device == NULL) { 2593 + if (sony_bl_props.dev == NULL) { 2674 2594 ret = -EIO; 2675 2595 break; 2676 2596 } ··· 2683 2603 ret = -EFAULT; 2684 2604 break; 2685 2605 case SONYPI_IOCSBRT: 2686 - if (sony_backlight_device == NULL) { 2606 + if (sony_bl_props.dev == NULL) { 2687 2607 ret = -EIO; 2688 2608 break; 2689 2609 } ··· 2697 2617 break; 2698 2618 } 2699 2619 /* sync the backlight device status */ 2700 - sony_backlight_device->props.brightness = 2701 - sony_backlight_get_brightness(sony_backlight_device); 2620 + sony_bl_props.dev->props.brightness = 2621 + sony_backlight_get_brightness(sony_bl_props.dev); 2702 2622 break; 2703 2623 case SONYPI_IOCGBAT1CAP: 2704 2624 if (ec_read16(SONYPI_BAT1_FULL, &val16)) {
+4 -2
drivers/platform/x86/thinkpad_acpi.c
··· 128 128 }; 129 129 130 130 /* ACPI HIDs */ 131 - #define TPACPI_ACPI_HKEY_HID "IBM0068" 131 + #define TPACPI_ACPI_IBM_HKEY_HID "IBM0068" 132 + #define TPACPI_ACPI_LENOVO_HKEY_HID "LEN0068" 132 133 #define TPACPI_ACPI_EC_HID "PNP0C09" 133 134 134 135 /* Input IDs */ ··· 3880 3879 } 3881 3880 3882 3881 static const struct acpi_device_id ibm_htk_device_ids[] = { 3883 - {TPACPI_ACPI_HKEY_HID, 0}, 3882 + {TPACPI_ACPI_IBM_HKEY_HID, 0}, 3883 + {TPACPI_ACPI_LENOVO_HKEY_HID, 0}, 3884 3884 {"", 0}, 3885 3885 }; 3886 3886
+6 -1
drivers/scsi/scsi_lib.c
··· 400 400 static void scsi_run_queue(struct request_queue *q) 401 401 { 402 402 struct scsi_device *sdev = q->queuedata; 403 - struct Scsi_Host *shost = sdev->host; 403 + struct Scsi_Host *shost; 404 404 LIST_HEAD(starved_list); 405 405 unsigned long flags; 406 406 407 + /* if the device is dead, sdev will be NULL, so no queue to run */ 408 + if (!sdev) 409 + return; 410 + 411 + shost = sdev->host; 407 412 if (scsi_target(sdev)->single_lun) 408 413 scsi_single_lun_run(sdev); 409 414
-4
drivers/staging/ft1000/ft1000-pcmcia/ft1000_hw.c
··· 2288 2288 free_netdev(dev); 2289 2289 return NULL; 2290 2290 } 2291 - 2292 - EXPORT_SYMBOL(init_ft1000_card); 2293 - EXPORT_SYMBOL(stop_ft1000_card); 2294 - EXPORT_SYMBOL(flarion_ft1000_cnt);
-3
drivers/staging/ft1000/ft1000-pcmcia/ft1000_proc.c
··· 214 214 remove_proc_entry(FT1000_PROC, init_net.proc_net); 215 215 unregister_netdevice_notifier(&ft1000_netdev_notifier); 216 216 } 217 - 218 - EXPORT_SYMBOL(ft1000InitProc); 219 - EXPORT_SYMBOL(ft1000CleanupProc);
+1 -1
drivers/staging/gma500/Kconfig
··· 1 1 config DRM_PSB 2 2 tristate "Intel GMA500 KMS Framebuffer" 3 - depends on DRM && PCI 3 + depends on DRM && PCI && X86 4 4 select FB_CFB_COPYAREA 5 5 select FB_CFB_FILLRECT 6 6 select FB_CFB_IMAGEBLIT
+1
drivers/staging/intel_sst/intelmid_v1_control.c
··· 28 28 #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt 29 29 30 30 #include <linux/pci.h> 31 + #include <linux/delay.h> 31 32 #include <linux/file.h> 32 33 #include <asm/mrst.h> 33 34 #include <sound/pcm.h>
+1
drivers/staging/intel_sst/intelmid_v2_control.c
··· 29 29 #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt 30 30 31 31 #include <linux/pci.h> 32 + #include <linux/delay.h> 32 33 #include <linux/file.h> 33 34 #include "intel_sst.h" 34 35 #include "intelmid_snd_control.h"
+1
drivers/staging/olpc_dcon/olpc_dcon_xo_1.c
··· 12 12 */ 13 13 #include <linux/cs5535.h> 14 14 #include <linux/gpio.h> 15 + #include <linux/delay.h> 15 16 #include <asm/olpc.h> 16 17 17 18 #include "olpc_dcon.h"
+1 -1
drivers/staging/rts_pstor/debug.h
··· 28 28 29 29 #define RTSX_STOR "rts_pstor: " 30 30 31 - #if CONFIG_RTS_PSTOR_DEBUG 31 + #ifdef CONFIG_RTS_PSTOR_DEBUG 32 32 #define RTSX_DEBUGP(x...) printk(KERN_DEBUG RTSX_STOR x) 33 33 #define RTSX_DEBUGPN(x...) printk(KERN_DEBUG x) 34 34 #define RTSX_DEBUGPX(x...) printk(x)
+1
drivers/staging/rts_pstor/ms.c
··· 23 23 #include <linux/blkdev.h> 24 24 #include <linux/kthread.h> 25 25 #include <linux/sched.h> 26 + #include <linux/vmalloc.h> 26 27 27 28 #include "rtsx.h" 28 29 #include "rtsx_transport.h"
+3 -2
drivers/staging/rts_pstor/rtsx_chip.c
··· 24 24 #include <linux/kthread.h> 25 25 #include <linux/sched.h> 26 26 #include <linux/workqueue.h> 27 + #include <linux/vmalloc.h> 27 28 28 29 #include "rtsx.h" 29 30 #include "rtsx_transport.h" ··· 1312 1311 1313 1312 #ifdef SUPPORT_OCP 1314 1313 if (CHECK_LUN_MODE(chip, SD_MS_2LUN)) { 1315 - #if CONFIG_RTS_PSTOR_DEBUG 1314 + #ifdef CONFIG_RTS_PSTOR_DEBUG 1316 1315 if (chip->ocp_stat & (SD_OC_NOW | SD_OC_EVER | MS_OC_NOW | MS_OC_EVER)) { 1317 1316 RTSX_DEBUGP("Over current, OCPSTAT is 0x%x\n", chip->ocp_stat); 1318 1317 } 1319 - #endif 1318 + #endif 1320 1319 1321 1320 if (chip->ocp_stat & (SD_OC_NOW | SD_OC_EVER)) { 1322 1321 if (chip->card_exist & SD_CARD) {
+1
drivers/staging/rts_pstor/rtsx_scsi.c
··· 23 23 #include <linux/blkdev.h> 24 24 #include <linux/kthread.h> 25 25 #include <linux/sched.h> 26 + #include <linux/vmalloc.h> 26 27 27 28 #include "rtsx.h" 28 29 #include "rtsx_transport.h"
+2 -2
drivers/staging/rts_pstor/sd.c
··· 909 909 RTSX_WRITE_REG(chip, SD_VPCLK0_CTL, PHASE_NOT_RESET, PHASE_NOT_RESET); 910 910 RTSX_WRITE_REG(chip, CLK_CTL, CHANGE_CLK, 0); 911 911 } else { 912 - #if CONFIG_RTS_PSTOR_DEBUG 912 + #ifdef CONFIG_RTS_PSTOR_DEBUG 913 913 rtsx_read_register(chip, SD_VP_CTL, &val); 914 914 RTSX_DEBUGP("SD_VP_CTL: 0x%x\n", val); 915 915 rtsx_read_register(chip, SD_DCMPS_CTL, &val); ··· 958 958 return STATUS_SUCCESS; 959 959 960 960 Fail: 961 - #if CONFIG_RTS_PSTOR_DEBUG 961 + #ifdef CONFIG_RTS_PSTOR_DEBUG 962 962 rtsx_read_register(chip, SD_VP_CTL, &val); 963 963 RTSX_DEBUGP("SD_VP_CTL: 0x%x\n", val); 964 964 rtsx_read_register(chip, SD_DCMPS_CTL, &val);
+1 -1
drivers/staging/rts_pstor/trace.h
··· 82 82 #define TRACE_GOTO(chip, label) goto label 83 83 #endif 84 84 85 - #if CONFIG_RTS_PSTOR_DEBUG 85 + #ifdef CONFIG_RTS_PSTOR_DEBUG 86 86 static inline void rtsx_dump(u8 *buf, int buf_len) 87 87 { 88 88 int i;
+1
drivers/staging/rts_pstor/xd.c
··· 23 23 #include <linux/blkdev.h> 24 24 #include <linux/kthread.h> 25 25 #include <linux/sched.h> 26 + #include <linux/vmalloc.h> 26 27 27 28 #include "rtsx.h" 28 29 #include "rtsx_transport.h"
+1
drivers/staging/solo6x10/Kconfig
··· 2 2 tristate "Softlogic 6x10 MPEG codec cards" 3 3 depends on PCI && VIDEO_DEV && SND && I2C 4 4 select VIDEOBUF_DMA_SG 5 + select SND_PCM 5 6 ---help--- 6 7 This driver supports the Softlogic based MPEG-4 and h.264 codec 7 8 codec cards.
+5 -6
drivers/staging/usbip/vhci_hcd.c
··· 876 876 } 877 877 878 878 /* kill threads related to this sdev, if v.c. exists */ 879 - kthread_stop(vdev->ud.tcp_rx); 880 - kthread_stop(vdev->ud.tcp_tx); 879 + if (vdev->ud.tcp_rx) 880 + kthread_stop(vdev->ud.tcp_rx); 881 + if (vdev->ud.tcp_tx) 882 + kthread_stop(vdev->ud.tcp_tx); 881 883 882 884 usbip_uinfo("stop threads\n"); 883 885 ··· 950 948 static void vhci_device_init(struct vhci_device *vdev) 951 949 { 952 950 memset(vdev, 0, sizeof(*vdev)); 953 - 954 - vdev->ud.tcp_rx = kthread_create(vhci_rx_loop, &vdev->ud, "vhci_rx"); 955 - vdev->ud.tcp_tx = kthread_create(vhci_tx_loop, &vdev->ud, "vhci_tx"); 956 951 957 952 vdev->ud.side = USBIP_VHCI; 958 953 vdev->ud.status = VDEV_ST_NULL; ··· 1138 1139 usbip_uerr("create hcd failed\n"); 1139 1140 return -ENOMEM; 1140 1141 } 1141 - 1142 + hcd->has_tt = 1; 1142 1143 1143 1144 /* this is private data for vhci_hcd */ 1144 1145 the_controller = hcd_to_vhci(hcd);
+4 -3
drivers/staging/usbip/vhci_sysfs.c
··· 21 21 #include "vhci.h" 22 22 23 23 #include <linux/in.h> 24 + #include <linux/kthread.h> 24 25 25 26 /* TODO: refine locking ?*/ 26 27 ··· 221 220 vdev->ud.tcp_socket = socket; 222 221 vdev->ud.status = VDEV_ST_NOTASSIGNED; 223 222 224 - wake_up_process(vdev->ud.tcp_rx); 225 - wake_up_process(vdev->ud.tcp_tx); 226 - 227 223 spin_unlock(&vdev->ud.lock); 228 224 spin_unlock(&the_controller->lock); 229 225 /* end the lock */ 226 + 227 + vdev->ud.tcp_rx = kthread_run(vhci_rx_loop, &vdev->ud, "vhci_rx"); 228 + vdev->ud.tcp_tx = kthread_run(vhci_tx_loop, &vdev->ud, "vhci_tx"); 230 229 231 230 rh_port_connect(rhport, speed); 232 231
+1 -1
drivers/staging/wlan-ng/cfg80211.c
··· 273 273 } 274 274 275 275 int prism2_set_default_key(struct wiphy *wiphy, struct net_device *dev, 276 - u8 key_index) 276 + u8 key_index, bool unicast, bool multicast) 277 277 { 278 278 wlandevice_t *wlandev = dev->ml_priv; 279 279
+20
drivers/usb/host/ehci-omap.c
··· 40 40 #include <linux/slab.h> 41 41 #include <linux/usb/ulpi.h> 42 42 #include <plat/usb.h> 43 + #include <linux/regulator/consumer.h> 43 44 44 45 /* EHCI Register Set */ 45 46 #define EHCI_INSNREG04 (0xA0) ··· 119 118 struct ehci_hcd *omap_ehci; 120 119 int ret = -ENODEV; 121 120 int irq; 121 + int i; 122 + char supply[7]; 122 123 123 124 if (usb_disabled()) 124 125 return -ENODEV; ··· 160 157 hcd->rsrc_start = res->start; 161 158 hcd->rsrc_len = resource_size(res); 162 159 hcd->regs = regs; 160 + 161 + /* get ehci regulator and enable */ 162 + for (i = 0 ; i < OMAP3_HS_USB_PORTS ; i++) { 163 + if (pdata->port_mode[i] != OMAP_EHCI_PORT_MODE_PHY) { 164 + pdata->regulator[i] = NULL; 165 + continue; 166 + } 167 + snprintf(supply, sizeof(supply), "hsusb%d", i); 168 + pdata->regulator[i] = regulator_get(dev, supply); 169 + if (IS_ERR(pdata->regulator[i])) { 170 + pdata->regulator[i] = NULL; 171 + dev_dbg(dev, 172 + "failed to get ehci port%d regulator\n", i); 173 + } else { 174 + regulator_enable(pdata->regulator[i]); 175 + } 176 + } 163 177 164 178 ret = omap_usbhs_enable(dev); 165 179 if (ret) {
+1
drivers/usb/host/isp1760-hcd.c
··· 1633 1633 ints[i].qh = NULL; 1634 1634 ints[i].qtd = NULL; 1635 1635 1636 + urb->status = status; 1636 1637 isp1760_urb_done(hcd, urb); 1637 1638 if (qtd) 1638 1639 pe(hcd, qh, qtd);
+17 -2
drivers/usb/host/xhci-hub.c
··· 777 777 if (t1 != t2) 778 778 xhci_writel(xhci, t2, port_array[port_index]); 779 779 780 - if (DEV_HIGHSPEED(t1)) { 780 + if (hcd->speed != HCD_USB3) { 781 781 /* enable remote wake up for USB 2.0 */ 782 782 u32 __iomem *addr; 783 783 u32 tmp; ··· 866 866 temp |= PORT_LINK_STROBE | XDEV_U0; 867 867 xhci_writel(xhci, temp, port_array[port_index]); 868 868 } 869 + /* wait for the port to enter U0 and report port link 870 + * state change. 871 + */ 872 + spin_unlock_irqrestore(&xhci->lock, flags); 873 + msleep(20); 874 + spin_lock_irqsave(&xhci->lock, flags); 875 + 876 + /* Clear PLC */ 877 + temp = xhci_readl(xhci, port_array[port_index]); 878 + if (temp & PORT_PLC) { 879 + temp = xhci_port_state_to_neutral(temp); 880 + temp |= PORT_PLC; 881 + xhci_writel(xhci, temp, port_array[port_index]); 882 + } 883 + 869 884 slot_id = xhci_find_slot_id_by_port(hcd, 870 885 xhci, port_index + 1); 871 886 if (slot_id) ··· 888 873 } else 889 874 xhci_writel(xhci, temp, port_array[port_index]); 890 875 891 - if (DEV_HIGHSPEED(temp)) { 876 + if (hcd->speed != HCD_USB3) { 892 877 /* disable remote wake up for USB 2.0 */ 893 878 u32 __iomem *addr; 894 879 u32 tmp;
+2 -4
drivers/usb/musb/musb_gadget.c
··· 1887 1887 otg_set_vbus(musb->xceiv, 1); 1888 1888 1889 1889 hcd->self.uses_pio_for_control = 1; 1890 - 1891 - if (musb->xceiv->last_event == USB_EVENT_NONE) 1892 - pm_runtime_put(musb->controller); 1893 - 1894 1890 } 1891 + if (musb->xceiv->last_event == USB_EVENT_NONE) 1892 + pm_runtime_put(musb->controller); 1895 1893 1896 1894 return 0; 1897 1895
+1 -1
drivers/usb/musb/omap2430.c
··· 270 270 DBG(4, "VBUS Disconnect\n"); 271 271 272 272 #ifdef CONFIG_USB_GADGET_MUSB_HDRC 273 - if (is_otg_enabled(musb)) 273 + if (is_otg_enabled(musb) || is_peripheral_enabled(musb)) 274 274 if (musb->gadget_driver) 275 275 #endif 276 276 {
+7
fs/ceph/addr.c
··· 775 775 ci->i_truncate_seq, 776 776 ci->i_truncate_size, 777 777 &inode->i_mtime, true, 1, 0); 778 + 779 + if (!req) { 780 + rc = -ENOMEM; 781 + unlock_page(page); 782 + break; 783 + } 784 + 778 785 max_pages = req->r_num_pages; 779 786 780 787 alloc_page_vec(fsc, req);
+7 -7
fs/ceph/caps.c
··· 1331 1331 } 1332 1332 1333 1333 /* 1334 - * Mark caps dirty. If inode is newly dirty, add to the global dirty 1335 - * list. 1334 + * Mark caps dirty. If inode is newly dirty, return the dirty flags. 1335 + * Caller is then responsible for calling __mark_inode_dirty with the 1336 + * returned flags value. 1336 1337 */ 1337 - void __ceph_mark_dirty_caps(struct ceph_inode_info *ci, int mask) 1338 + int __ceph_mark_dirty_caps(struct ceph_inode_info *ci, int mask) 1338 1339 { 1339 1340 struct ceph_mds_client *mdsc = 1340 1341 ceph_sb_to_client(ci->vfs_inode.i_sb)->mdsc; ··· 1358 1357 list_add(&ci->i_dirty_item, &mdsc->cap_dirty); 1359 1358 spin_unlock(&mdsc->cap_dirty_lock); 1360 1359 if (ci->i_flushing_caps == 0) { 1361 - igrab(inode); 1360 + ihold(inode); 1362 1361 dirty |= I_DIRTY_SYNC; 1363 1362 } 1364 1363 } ··· 1366 1365 if (((was | ci->i_flushing_caps) & CEPH_CAP_FILE_BUFFER) && 1367 1366 (mask & CEPH_CAP_FILE_BUFFER)) 1368 1367 dirty |= I_DIRTY_DATASYNC; 1369 - if (dirty) 1370 - __mark_inode_dirty(inode, dirty); 1371 1368 __cap_delay_requeue(mdsc, ci); 1369 + return dirty; 1372 1370 } 1373 1371 1374 1372 /* ··· 1991 1991 ci->i_wr_ref++; 1992 1992 if (got & CEPH_CAP_FILE_BUFFER) { 1993 1993 if (ci->i_wrbuffer_ref == 0) 1994 - igrab(&ci->vfs_inode); 1994 + ihold(&ci->vfs_inode); 1995 1995 ci->i_wrbuffer_ref++; 1996 1996 dout("__take_cap_refs %p wrbuffer %d -> %d (?)\n", 1997 1997 &ci->vfs_inode, ci->i_wrbuffer_ref-1, ci->i_wrbuffer_ref);
+4 -1
fs/ceph/file.c
··· 734 734 } 735 735 } 736 736 if (ret >= 0) { 737 + int dirty; 737 738 spin_lock(&inode->i_lock); 738 - __ceph_mark_dirty_caps(ci, CEPH_CAP_FILE_WR); 739 + dirty = __ceph_mark_dirty_caps(ci, CEPH_CAP_FILE_WR); 739 740 spin_unlock(&inode->i_lock); 741 + if (dirty) 742 + __mark_inode_dirty(inode, dirty); 740 743 } 741 744 742 745 out:
+5 -1
fs/ceph/inode.c
··· 1567 1567 int release = 0, dirtied = 0; 1568 1568 int mask = 0; 1569 1569 int err = 0; 1570 + int inode_dirty_flags = 0; 1570 1571 1571 1572 if (ceph_snap(inode) != CEPH_NOSNAP) 1572 1573 return -EROFS; ··· 1726 1725 dout("setattr %p ATTR_FILE ... hrm!\n", inode); 1727 1726 1728 1727 if (dirtied) { 1729 - __ceph_mark_dirty_caps(ci, dirtied); 1728 + inode_dirty_flags = __ceph_mark_dirty_caps(ci, dirtied); 1730 1729 inode->i_ctime = CURRENT_TIME; 1731 1730 } 1732 1731 1733 1732 release &= issued; 1734 1733 spin_unlock(&inode->i_lock); 1734 + 1735 + if (inode_dirty_flags) 1736 + __mark_inode_dirty(inode, inode_dirty_flags); 1735 1737 1736 1738 if (mask) { 1737 1739 req->r_inode = igrab(inode);
+1 -1
fs/ceph/super.h
··· 506 506 { 507 507 return ci->i_dirty_caps | ci->i_flushing_caps; 508 508 } 509 - extern void __ceph_mark_dirty_caps(struct ceph_inode_info *ci, int mask); 509 + extern int __ceph_mark_dirty_caps(struct ceph_inode_info *ci, int mask); 510 510 511 511 extern int ceph_caps_revoking(struct ceph_inode_info *ci, int mask); 512 512 extern int __ceph_caps_used(struct ceph_inode_info *ci);
+8 -4
fs/ceph/xattr.c
··· 703 703 struct ceph_inode_xattr *xattr = NULL; 704 704 int issued; 705 705 int required_blob_size; 706 + int dirty; 706 707 707 708 if (ceph_snap(inode) != CEPH_NOSNAP) 708 709 return -EROFS; ··· 764 763 dout("setxattr %p issued %s\n", inode, ceph_cap_string(issued)); 765 764 err = __set_xattr(ci, newname, name_len, newval, 766 765 val_len, 1, 1, 1, &xattr); 767 - __ceph_mark_dirty_caps(ci, CEPH_CAP_XATTR_EXCL); 766 + dirty = __ceph_mark_dirty_caps(ci, CEPH_CAP_XATTR_EXCL); 768 767 ci->i_xattrs.dirty = true; 769 768 inode->i_ctime = CURRENT_TIME; 770 769 spin_unlock(&inode->i_lock); 771 - 770 + if (dirty) 771 + __mark_inode_dirty(inode, dirty); 772 772 return err; 773 773 774 774 do_sync: ··· 812 810 struct ceph_vxattr_cb *vxattrs = ceph_inode_vxattrs(inode); 813 811 int issued; 814 812 int err; 813 + int dirty; 815 814 816 815 if (ceph_snap(inode) != CEPH_NOSNAP) 817 816 return -EROFS; ··· 836 833 goto do_sync; 837 834 838 835 err = __remove_xattr_by_name(ceph_inode(inode), name); 839 - __ceph_mark_dirty_caps(ci, CEPH_CAP_XATTR_EXCL); 836 + dirty = __ceph_mark_dirty_caps(ci, CEPH_CAP_XATTR_EXCL); 840 837 ci->i_xattrs.dirty = true; 841 838 inode->i_ctime = CURRENT_TIME; 842 839 843 840 spin_unlock(&inode->i_lock); 844 - 841 + if (dirty) 842 + __mark_inode_dirty(inode, dirty); 845 843 return err; 846 844 do_sync: 847 845 spin_unlock(&inode->i_lock);
+68 -54
fs/cifs/connect.c
··· 274 274 char *data_area_of_target; 275 275 char *data_area_of_buf2; 276 276 int remaining; 277 - __u16 byte_count, total_data_size, total_in_buf, total_in_buf2; 277 + unsigned int byte_count, total_in_buf; 278 + __u16 total_data_size, total_in_buf2; 278 279 279 280 total_data_size = get_unaligned_le16(&pSMBt->t2_rsp.TotalDataCount); 280 281 ··· 288 287 remaining = total_data_size - total_in_buf; 289 288 290 289 if (remaining < 0) 291 - return -EINVAL; 290 + return -EPROTO; 292 291 293 292 if (remaining == 0) /* nothing to do, ignore */ 294 293 return 0; ··· 309 308 data_area_of_target += total_in_buf; 310 309 311 310 /* copy second buffer into end of first buffer */ 312 - memcpy(data_area_of_target, data_area_of_buf2, total_in_buf2); 313 311 total_in_buf += total_in_buf2; 312 + /* is the result too big for the field? */ 313 + if (total_in_buf > USHRT_MAX) 314 + return -EPROTO; 314 315 put_unaligned_le16(total_in_buf, &pSMBt->t2_rsp.DataCount); 316 + 317 + /* fix up the BCC */ 315 318 byte_count = get_bcc_le(pTargetSMB); 316 319 byte_count += total_in_buf2; 320 + /* is the result too big for the field? */ 321 + if (byte_count > USHRT_MAX) 322 + return -EPROTO; 317 323 put_bcc_le(byte_count, pTargetSMB); 318 324 319 325 byte_count = pTargetSMB->smb_buf_length; 320 326 byte_count += total_in_buf2; 321 - 322 - /* BB also add check that we are not beyond maximum buffer size */ 323 - 327 + /* don't allow buffer to overflow */ 328 + if (byte_count > CIFSMaxBufSize) 329 + return -ENOBUFS; 324 330 pTargetSMB->smb_buf_length = byte_count; 331 + 332 + memcpy(data_area_of_target, data_area_of_buf2, total_in_buf2); 325 333 326 334 if (remaining == total_in_buf2) { 327 335 cFYI(1, "found the last secondary response"); ··· 617 607 list_for_each_safe(tmp, tmp2, &server->pending_mid_q) { 618 608 mid_entry = list_entry(tmp, struct mid_q_entry, qhead); 619 609 620 - if ((mid_entry->mid == smb_buffer->Mid) && 621 - (mid_entry->midState == MID_REQUEST_SUBMITTED) && 622 - (mid_entry->command == smb_buffer->Command)) { 623 - if (length == 0 && 624 - check2ndT2(smb_buffer, server->maxBuf) > 0) { 625 - /* We have a multipart transact2 resp */ 626 - isMultiRsp = true; 627 - if (mid_entry->resp_buf) { 628 - /* merge response - fix up 1st*/ 629 - if (coalesce_t2(smb_buffer, 630 - mid_entry->resp_buf)) { 631 - mid_entry->multiRsp = 632 - true; 633 - break; 634 - } else { 635 - /* all parts received */ 636 - mid_entry->multiEnd = 637 - true; 638 - goto multi_t2_fnd; 639 - } 610 + if (mid_entry->mid != smb_buffer->Mid || 611 + mid_entry->midState != MID_REQUEST_SUBMITTED || 612 + mid_entry->command != smb_buffer->Command) { 613 + mid_entry = NULL; 614 + continue; 615 + } 616 + 617 + if (length == 0 && 618 + check2ndT2(smb_buffer, server->maxBuf) > 0) { 619 + /* We have a multipart transact2 resp */ 620 + isMultiRsp = true; 621 + if (mid_entry->resp_buf) { 622 + /* merge response - fix up 1st*/ 623 + length = coalesce_t2(smb_buffer, 624 + mid_entry->resp_buf); 625 + if (length > 0) { 626 + length = 0; 627 + mid_entry->multiRsp = true; 628 + break; 640 629 } else { 641 - if (!isLargeBuf) { 642 - cERROR(1, "1st trans2 resp needs bigbuf"); 643 - /* BB maybe we can fix this up, switch 644 - to already allocated large buffer? */ 645 - } else { 646 - /* Have first buffer */ 647 - mid_entry->resp_buf = 648 - smb_buffer; 649 - mid_entry->largeBuf = 650 - true; 651 - bigbuf = NULL; 652 - } 630 + /* all parts received or 631 + * packet is malformed 632 + */ 633 + mid_entry->multiEnd = true; 634 + goto multi_t2_fnd; 653 635 } 654 - break; 636 + } else { 637 + if (!isLargeBuf) { 638 + /* 639 + * FIXME: switch to already 640 + * allocated largebuf? 641 + */ 642 + cERROR(1, "1st trans2 resp " 643 + "needs bigbuf"); 644 + } else { 645 + /* Have first buffer */ 646 + mid_entry->resp_buf = 647 + smb_buffer; 648 + mid_entry->largeBuf = true; 649 + bigbuf = NULL; 650 + } 655 651 } 656 - mid_entry->resp_buf = smb_buffer; 657 - mid_entry->largeBuf = isLargeBuf; 658 - multi_t2_fnd: 659 - if (length == 0) 660 - mid_entry->midState = 661 - MID_RESPONSE_RECEIVED; 662 - else 663 - mid_entry->midState = 664 - MID_RESPONSE_MALFORMED; 665 - #ifdef CONFIG_CIFS_STATS2 666 - mid_entry->when_received = jiffies; 667 - #endif 668 - list_del_init(&mid_entry->qhead); 669 - mid_entry->callback(mid_entry); 670 652 break; 671 653 } 672 - mid_entry = NULL; 654 + mid_entry->resp_buf = smb_buffer; 655 + mid_entry->largeBuf = isLargeBuf; 656 + multi_t2_fnd: 657 + if (length == 0) 658 + mid_entry->midState = MID_RESPONSE_RECEIVED; 659 + else 660 + mid_entry->midState = MID_RESPONSE_MALFORMED; 661 + #ifdef CONFIG_CIFS_STATS2 662 + mid_entry->when_received = jiffies; 663 + #endif 664 + list_del_init(&mid_entry->qhead); 665 + mid_entry->callback(mid_entry); 666 + break; 673 667 } 674 668 spin_unlock(&GlobalMid_Lock); 675 669
+4 -15
fs/cifs/sess.c
··· 276 276 } 277 277 278 278 static void 279 - decode_unicode_ssetup(char **pbcc_area, __u16 bleft, struct cifsSesInfo *ses, 279 + decode_unicode_ssetup(char **pbcc_area, int bleft, struct cifsSesInfo *ses, 280 280 const struct nls_table *nls_cp) 281 281 { 282 282 int len; 283 283 char *data = *pbcc_area; 284 284 285 285 cFYI(1, "bleft %d", bleft); 286 - 287 - /* 288 - * Windows servers do not always double null terminate their final 289 - * Unicode string. Check to see if there are an uneven number of bytes 290 - * left. If so, then add an extra NULL pad byte to the end of the 291 - * response. 292 - * 293 - * See section 2.7.2 in "Implementing CIFS" for details 294 - */ 295 - if (bleft % 2) { 296 - data[bleft] = 0; 297 - ++bleft; 298 - } 299 286 300 287 kfree(ses->serverOS); 301 288 ses->serverOS = cifs_strndup_from_ucs(data, bleft, true, nls_cp); ··· 916 929 } 917 930 918 931 /* BB check if Unicode and decode strings */ 919 - if (smb_buf->Flags2 & SMBFLG2_UNICODE) { 932 + if (bytes_remaining == 0) { 933 + /* no string area to decode, do nothing */ 934 + } else if (smb_buf->Flags2 & SMBFLG2_UNICODE) { 920 935 /* unicode string area must be word-aligned */ 921 936 if (((unsigned long) bcc_ptr - (unsigned long) smb_buf) % 2) { 922 937 ++bcc_ptr;
-1
fs/hpfs/Kconfig
··· 1 1 config HPFS_FS 2 2 tristate "OS/2 HPFS file system support" 3 3 depends on BLOCK 4 - depends on BROKEN || !PREEMPT 5 4 help 6 5 OS/2 is IBM's operating system for PC's, the same as Warp, and HPFS 7 6 is the file system used for organizing files on OS/2 hard disk
+43 -75
fs/hpfs/alloc.c
··· 8 8 9 9 #include "hpfs_fn.h" 10 10 11 - static int hpfs_alloc_if_possible_nolock(struct super_block *s, secno sec); 12 - 13 11 /* 14 12 * Check if a sector is allocated in bitmap 15 13 * This is really slow. Turned on only if chk==2 ··· 16 18 static int chk_if_allocated(struct super_block *s, secno sec, char *msg) 17 19 { 18 20 struct quad_buffer_head qbh; 19 - unsigned *bmp; 21 + u32 *bmp; 20 22 if (!(bmp = hpfs_map_bitmap(s, sec >> 14, &qbh, "chk"))) goto fail; 21 - if ((bmp[(sec & 0x3fff) >> 5] >> (sec & 0x1f)) & 1) { 23 + if ((cpu_to_le32(bmp[(sec & 0x3fff) >> 5]) >> (sec & 0x1f)) & 1) { 22 24 hpfs_error(s, "sector '%s' - %08x not allocated in bitmap", msg, sec); 23 25 goto fail1; 24 26 } ··· 26 28 if (sec >= hpfs_sb(s)->sb_dirband_start && sec < hpfs_sb(s)->sb_dirband_start + hpfs_sb(s)->sb_dirband_size) { 27 29 unsigned ssec = (sec - hpfs_sb(s)->sb_dirband_start) / 4; 28 30 if (!(bmp = hpfs_map_dnode_bitmap(s, &qbh))) goto fail; 29 - if ((bmp[ssec >> 5] >> (ssec & 0x1f)) & 1) { 31 + if ((le32_to_cpu(bmp[ssec >> 5]) >> (ssec & 0x1f)) & 1) { 30 32 hpfs_error(s, "sector '%s' - %08x not allocated in directory bitmap", msg, sec); 31 33 goto fail1; 32 34 } ··· 73 75 hpfs_error(s, "Bad allocation size: %d", n); 74 76 return 0; 75 77 } 76 - lock_super(s); 77 78 if (bs != ~0x3fff) { 78 79 if (!(bmp = hpfs_map_bitmap(s, near >> 14, &qbh, "aib"))) goto uls; 79 80 } else { ··· 82 85 ret = bs + nr; 83 86 goto rt; 84 87 } 85 - /*if (!tstbits(bmp, nr + n, n + forward)) { 86 - ret = bs + nr + n; 87 - goto rt; 88 - }*/ 89 88 q = nr + n; b = 0; 90 89 while ((a = tstbits(bmp, q, n + forward)) != 0) { 91 90 q += a; ··· 98 105 goto rt; 99 106 } 100 107 nr >>= 5; 101 - /*for (i = nr + 1; i != nr; i++, i &= 0x1ff) {*/ 108 + /*for (i = nr + 1; i != nr; i++, i &= 0x1ff) */ 102 109 i = nr; 103 110 do { 104 - if (!bmp[i]) goto cont; 105 - if (n + forward >= 0x3f && bmp[i] != -1) goto cont; 111 + if (!le32_to_cpu(bmp[i])) goto cont; 112 + if (n + forward >= 0x3f && le32_to_cpu(bmp[i]) != 0xffffffff) goto cont; 106 113 q = i<<5; 107 114 if (i > 0) { 108 - unsigned k = bmp[i-1]; 115 + unsigned k = le32_to_cpu(bmp[i-1]); 109 116 while (k & 0x80000000) { 110 117 q--; k <<= 1; 111 118 } ··· 125 132 } while (i != nr); 126 133 rt: 127 134 if (ret) { 128 - if (hpfs_sb(s)->sb_chk && ((ret >> 14) != (bs >> 14) || (bmp[(ret & 0x3fff) >> 5] | ~(((1 << n) - 1) << (ret & 0x1f))) != 0xffffffff)) { 135 + if (hpfs_sb(s)->sb_chk && ((ret >> 14) != (bs >> 14) || (le32_to_cpu(bmp[(ret & 0x3fff) >> 5]) | ~(((1 << n) - 1) << (ret & 0x1f))) != 0xffffffff)) { 129 136 hpfs_error(s, "Allocation doesn't work! Wanted %d, allocated at %08x", n, ret); 130 137 ret = 0; 131 138 goto b; 132 139 } 133 - bmp[(ret & 0x3fff) >> 5] &= ~(((1 << n) - 1) << (ret & 0x1f)); 140 + bmp[(ret & 0x3fff) >> 5] &= cpu_to_le32(~(((1 << n) - 1) << (ret & 0x1f))); 134 141 hpfs_mark_4buffers_dirty(&qbh); 135 142 } 136 143 b: 137 144 hpfs_brelse4(&qbh); 138 145 uls: 139 - unlock_super(s); 140 146 return ret; 141 147 } 142 148 ··· 147 155 * sectors 148 156 */ 149 157 150 - secno hpfs_alloc_sector(struct super_block *s, secno near, unsigned n, int forward, int lock) 158 + secno hpfs_alloc_sector(struct super_block *s, secno near, unsigned n, int forward) 151 159 { 152 160 secno sec; 153 161 int i; ··· 159 167 forward = -forward; 160 168 f_p = 1; 161 169 } 162 - if (lock) hpfs_lock_creation(s); 163 170 n_bmps = (sbi->sb_fs_size + 0x4000 - 1) >> 14; 164 171 if (near && near < sbi->sb_fs_size) { 165 172 if ((sec = alloc_in_bmp(s, near, n, f_p ? forward : forward/4))) goto ret; ··· 205 214 ret: 206 215 if (sec && f_p) { 207 216 for (i = 0; i < forward; i++) { 208 - if (!hpfs_alloc_if_possible_nolock(s, sec + i + 1)) { 217 + if (!hpfs_alloc_if_possible(s, sec + i + 1)) { 209 218 hpfs_error(s, "Prealloc doesn't work! Wanted %d, allocated at %08x, can't allocate %d", forward, sec, i); 210 219 sec = 0; 211 220 break; 212 221 } 213 222 } 214 223 } 215 - if (lock) hpfs_unlock_creation(s); 216 224 return sec; 217 225 } 218 226 219 - static secno alloc_in_dirband(struct super_block *s, secno near, int lock) 227 + static secno alloc_in_dirband(struct super_block *s, secno near) 220 228 { 221 229 unsigned nr = near; 222 230 secno sec; ··· 226 236 nr = sbi->sb_dirband_start + sbi->sb_dirband_size - 4; 227 237 nr -= sbi->sb_dirband_start; 228 238 nr >>= 2; 229 - if (lock) hpfs_lock_creation(s); 230 239 sec = alloc_in_bmp(s, (~0x3fff) | nr, 1, 0); 231 - if (lock) hpfs_unlock_creation(s); 232 240 if (!sec) return 0; 233 241 return ((sec & 0x3fff) << 2) + sbi->sb_dirband_start; 234 242 } 235 243 236 244 /* Alloc sector if it's free */ 237 245 238 - static int hpfs_alloc_if_possible_nolock(struct super_block *s, secno sec) 246 + int hpfs_alloc_if_possible(struct super_block *s, secno sec) 239 247 { 240 248 struct quad_buffer_head qbh; 241 - unsigned *bmp; 242 - lock_super(s); 249 + u32 *bmp; 243 250 if (!(bmp = hpfs_map_bitmap(s, sec >> 14, &qbh, "aip"))) goto end; 244 - if (bmp[(sec & 0x3fff) >> 5] & (1 << (sec & 0x1f))) { 245 - bmp[(sec & 0x3fff) >> 5] &= ~(1 << (sec & 0x1f)); 251 + if (le32_to_cpu(bmp[(sec & 0x3fff) >> 5]) & (1 << (sec & 0x1f))) { 252 + bmp[(sec & 0x3fff) >> 5] &= cpu_to_le32(~(1 << (sec & 0x1f))); 246 253 hpfs_mark_4buffers_dirty(&qbh); 247 254 hpfs_brelse4(&qbh); 248 - unlock_super(s); 249 255 return 1; 250 256 } 251 257 hpfs_brelse4(&qbh); 252 258 end: 253 - unlock_super(s); 254 259 return 0; 255 - } 256 - 257 - int hpfs_alloc_if_possible(struct super_block *s, secno sec) 258 - { 259 - int r; 260 - hpfs_lock_creation(s); 261 - r = hpfs_alloc_if_possible_nolock(s, sec); 262 - hpfs_unlock_creation(s); 263 - return r; 264 260 } 265 261 266 262 /* Free sectors in bitmaps */ ··· 254 278 void hpfs_free_sectors(struct super_block *s, secno sec, unsigned n) 255 279 { 256 280 struct quad_buffer_head qbh; 257 - unsigned *bmp; 281 + u32 *bmp; 258 282 struct hpfs_sb_info *sbi = hpfs_sb(s); 259 283 /*printk("2 - ");*/ 260 284 if (!n) return; ··· 262 286 hpfs_error(s, "Trying to free reserved sector %08x", sec); 263 287 return; 264 288 } 265 - lock_super(s); 266 289 sbi->sb_max_fwd_alloc += n > 0xffff ? 0xffff : n; 267 290 if (sbi->sb_max_fwd_alloc > 0xffffff) sbi->sb_max_fwd_alloc = 0xffffff; 268 291 new_map: 269 292 if (!(bmp = hpfs_map_bitmap(s, sec >> 14, &qbh, "free"))) { 270 - unlock_super(s); 271 293 return; 272 294 } 273 295 new_tst: 274 - if ((bmp[(sec & 0x3fff) >> 5] >> (sec & 0x1f) & 1)) { 296 + if ((le32_to_cpu(bmp[(sec & 0x3fff) >> 5]) >> (sec & 0x1f) & 1)) { 275 297 hpfs_error(s, "sector %08x not allocated", sec); 276 298 hpfs_brelse4(&qbh); 277 - unlock_super(s); 278 299 return; 279 300 } 280 - bmp[(sec & 0x3fff) >> 5] |= 1 << (sec & 0x1f); 301 + bmp[(sec & 0x3fff) >> 5] |= cpu_to_le32(1 << (sec & 0x1f)); 281 302 if (!--n) { 282 303 hpfs_mark_4buffers_dirty(&qbh); 283 304 hpfs_brelse4(&qbh); 284 - unlock_super(s); 285 305 return; 286 306 } 287 307 if (!(++sec & 0x3fff)) { ··· 299 327 int n_bmps = (hpfs_sb(s)->sb_fs_size + 0x4000 - 1) >> 14; 300 328 int b = hpfs_sb(s)->sb_c_bitmap & 0x0fffffff; 301 329 int i, j; 302 - unsigned *bmp; 330 + u32 *bmp; 303 331 struct quad_buffer_head qbh; 304 332 if ((bmp = hpfs_map_dnode_bitmap(s, &qbh))) { 305 333 for (j = 0; j < 512; j++) { 306 334 unsigned k; 307 - if (!bmp[j]) continue; 308 - for (k = bmp[j]; k; k >>= 1) if (k & 1) if (!--n) { 335 + if (!le32_to_cpu(bmp[j])) continue; 336 + for (k = le32_to_cpu(bmp[j]); k; k >>= 1) if (k & 1) if (!--n) { 309 337 hpfs_brelse4(&qbh); 310 338 return 0; 311 339 } ··· 324 352 chk_bmp: 325 353 if (bmp) { 326 354 for (j = 0; j < 512; j++) { 327 - unsigned k; 328 - if (!bmp[j]) continue; 355 + u32 k; 356 + if (!le32_to_cpu(bmp[j])) continue; 329 357 for (k = 0xf; k; k <<= 4) 330 - if ((bmp[j] & k) == k) { 358 + if ((le32_to_cpu(bmp[j]) & k) == k) { 331 359 if (!--n) { 332 360 hpfs_brelse4(&qbh); 333 361 return 0; ··· 351 379 hpfs_free_sectors(s, dno, 4); 352 380 } else { 353 381 struct quad_buffer_head qbh; 354 - unsigned *bmp; 382 + u32 *bmp; 355 383 unsigned ssec = (dno - hpfs_sb(s)->sb_dirband_start) / 4; 356 - lock_super(s); 357 384 if (!(bmp = hpfs_map_dnode_bitmap(s, &qbh))) { 358 - unlock_super(s); 359 385 return; 360 386 } 361 - bmp[ssec >> 5] |= 1 << (ssec & 0x1f); 387 + bmp[ssec >> 5] |= cpu_to_le32(1 << (ssec & 0x1f)); 362 388 hpfs_mark_4buffers_dirty(&qbh); 363 389 hpfs_brelse4(&qbh); 364 - unlock_super(s); 365 390 } 366 391 } 367 392 368 393 struct dnode *hpfs_alloc_dnode(struct super_block *s, secno near, 369 - dnode_secno *dno, struct quad_buffer_head *qbh, 370 - int lock) 394 + dnode_secno *dno, struct quad_buffer_head *qbh) 371 395 { 372 396 struct dnode *d; 373 397 if (hpfs_count_one_bitmap(s, hpfs_sb(s)->sb_dmap) > FREE_DNODES_ADD) { 374 - if (!(*dno = alloc_in_dirband(s, near, lock))) 375 - if (!(*dno = hpfs_alloc_sector(s, near, 4, 0, lock))) return NULL; 398 + if (!(*dno = alloc_in_dirband(s, near))) 399 + if (!(*dno = hpfs_alloc_sector(s, near, 4, 0))) return NULL; 376 400 } else { 377 - if (!(*dno = hpfs_alloc_sector(s, near, 4, 0, lock))) 378 - if (!(*dno = alloc_in_dirband(s, near, lock))) return NULL; 401 + if (!(*dno = hpfs_alloc_sector(s, near, 4, 0))) 402 + if (!(*dno = alloc_in_dirband(s, near))) return NULL; 379 403 } 380 404 if (!(d = hpfs_get_4sectors(s, *dno, qbh))) { 381 405 hpfs_free_dnode(s, *dno); 382 406 return NULL; 383 407 } 384 408 memset(d, 0, 2048); 385 - d->magic = DNODE_MAGIC; 386 - d->first_free = 52; 409 + d->magic = cpu_to_le32(DNODE_MAGIC); 410 + d->first_free = cpu_to_le32(52); 387 411 d->dirent[0] = 32; 388 412 d->dirent[2] = 8; 389 413 d->dirent[30] = 1; 390 414 d->dirent[31] = 255; 391 - d->self = *dno; 415 + d->self = cpu_to_le32(*dno); 392 416 return d; 393 417 } 394 418 ··· 392 424 struct buffer_head **bh) 393 425 { 394 426 struct fnode *f; 395 - if (!(*fno = hpfs_alloc_sector(s, near, 1, FNODE_ALLOC_FWD, 1))) return NULL; 427 + if (!(*fno = hpfs_alloc_sector(s, near, 1, FNODE_ALLOC_FWD))) return NULL; 396 428 if (!(f = hpfs_get_sector(s, *fno, bh))) { 397 429 hpfs_free_sectors(s, *fno, 1); 398 430 return NULL; 399 431 } 400 432 memset(f, 0, 512); 401 - f->magic = FNODE_MAGIC; 402 - f->ea_offs = 0xc4; 433 + f->magic = cpu_to_le32(FNODE_MAGIC); 434 + f->ea_offs = cpu_to_le16(0xc4); 403 435 f->btree.n_free_nodes = 8; 404 - f->btree.first_free = 8; 436 + f->btree.first_free = cpu_to_le16(8); 405 437 return f; 406 438 } 407 439 ··· 409 441 struct buffer_head **bh) 410 442 { 411 443 struct anode *a; 412 - if (!(*ano = hpfs_alloc_sector(s, near, 1, ANODE_ALLOC_FWD, 1))) return NULL; 444 + if (!(*ano = hpfs_alloc_sector(s, near, 1, ANODE_ALLOC_FWD))) return NULL; 413 445 if (!(a = hpfs_get_sector(s, *ano, bh))) { 414 446 hpfs_free_sectors(s, *ano, 1); 415 447 return NULL; 416 448 } 417 449 memset(a, 0, 512); 418 - a->magic = ANODE_MAGIC; 419 - a->self = *ano; 450 + a->magic = cpu_to_le32(ANODE_MAGIC); 451 + a->self = cpu_to_le32(*ano); 420 452 a->btree.n_free_nodes = 40; 421 453 a->btree.n_used_nodes = 0; 422 - a->btree.first_free = 8; 454 + a->btree.first_free = cpu_to_le16(8); 423 455 return a; 424 456 }
+69 -69
fs/hpfs/anode.c
··· 22 22 if (hpfs_sb(s)->sb_chk) if (hpfs_stop_cycles(s, a, &c1, &c2, "hpfs_bplus_lookup")) return -1; 23 23 if (btree->internal) { 24 24 for (i = 0; i < btree->n_used_nodes; i++) 25 - if (btree->u.internal[i].file_secno > sec) { 26 - a = btree->u.internal[i].down; 25 + if (le32_to_cpu(btree->u.internal[i].file_secno) > sec) { 26 + a = le32_to_cpu(btree->u.internal[i].down); 27 27 brelse(bh); 28 28 if (!(anode = hpfs_map_anode(s, a, &bh))) return -1; 29 29 btree = &anode->btree; ··· 34 34 return -1; 35 35 } 36 36 for (i = 0; i < btree->n_used_nodes; i++) 37 - if (btree->u.external[i].file_secno <= sec && 38 - btree->u.external[i].file_secno + btree->u.external[i].length > sec) { 39 - a = btree->u.external[i].disk_secno + sec - btree->u.external[i].file_secno; 37 + if (le32_to_cpu(btree->u.external[i].file_secno) <= sec && 38 + le32_to_cpu(btree->u.external[i].file_secno) + le32_to_cpu(btree->u.external[i].length) > sec) { 39 + a = le32_to_cpu(btree->u.external[i].disk_secno) + sec - le32_to_cpu(btree->u.external[i].file_secno); 40 40 if (hpfs_sb(s)->sb_chk) if (hpfs_chk_sectors(s, a, 1, "data")) { 41 41 brelse(bh); 42 42 return -1; 43 43 } 44 44 if (inode) { 45 45 struct hpfs_inode_info *hpfs_inode = hpfs_i(inode); 46 - hpfs_inode->i_file_sec = btree->u.external[i].file_secno; 47 - hpfs_inode->i_disk_sec = btree->u.external[i].disk_secno; 48 - hpfs_inode->i_n_secs = btree->u.external[i].length; 46 + hpfs_inode->i_file_sec = le32_to_cpu(btree->u.external[i].file_secno); 47 + hpfs_inode->i_disk_sec = le32_to_cpu(btree->u.external[i].disk_secno); 48 + hpfs_inode->i_n_secs = le32_to_cpu(btree->u.external[i].length); 49 49 } 50 50 brelse(bh); 51 51 return a; ··· 83 83 return -1; 84 84 } 85 85 if (btree->internal) { 86 - a = btree->u.internal[n].down; 87 - btree->u.internal[n].file_secno = -1; 86 + a = le32_to_cpu(btree->u.internal[n].down); 87 + btree->u.internal[n].file_secno = cpu_to_le32(-1); 88 88 mark_buffer_dirty(bh); 89 89 brelse(bh); 90 90 if (hpfs_sb(s)->sb_chk) ··· 94 94 goto go_down; 95 95 } 96 96 if (n >= 0) { 97 - if (btree->u.external[n].file_secno + btree->u.external[n].length != fsecno) { 97 + if (le32_to_cpu(btree->u.external[n].file_secno) + le32_to_cpu(btree->u.external[n].length) != fsecno) { 98 98 hpfs_error(s, "allocated size %08x, trying to add sector %08x, %cnode %08x", 99 - btree->u.external[n].file_secno + btree->u.external[n].length, fsecno, 99 + le32_to_cpu(btree->u.external[n].file_secno) + le32_to_cpu(btree->u.external[n].length), fsecno, 100 100 fnod?'f':'a', node); 101 101 brelse(bh); 102 102 return -1; 103 103 } 104 - if (hpfs_alloc_if_possible(s, se = btree->u.external[n].disk_secno + btree->u.external[n].length)) { 105 - btree->u.external[n].length++; 104 + if (hpfs_alloc_if_possible(s, se = le32_to_cpu(btree->u.external[n].disk_secno) + le32_to_cpu(btree->u.external[n].length))) { 105 + btree->u.external[n].length = cpu_to_le32(le32_to_cpu(btree->u.external[n].length) + 1); 106 106 mark_buffer_dirty(bh); 107 107 brelse(bh); 108 108 return se; ··· 115 115 } 116 116 se = !fnod ? node : (node + 16384) & ~16383; 117 117 } 118 - if (!(se = hpfs_alloc_sector(s, se, 1, fsecno*ALLOC_M>ALLOC_FWD_MAX ? ALLOC_FWD_MAX : fsecno*ALLOC_M<ALLOC_FWD_MIN ? ALLOC_FWD_MIN : fsecno*ALLOC_M, 1))) { 118 + if (!(se = hpfs_alloc_sector(s, se, 1, fsecno*ALLOC_M>ALLOC_FWD_MAX ? ALLOC_FWD_MAX : fsecno*ALLOC_M<ALLOC_FWD_MIN ? ALLOC_FWD_MIN : fsecno*ALLOC_M))) { 119 119 brelse(bh); 120 120 return -1; 121 121 } 122 - fs = n < 0 ? 0 : btree->u.external[n].file_secno + btree->u.external[n].length; 122 + fs = n < 0 ? 0 : le32_to_cpu(btree->u.external[n].file_secno) + le32_to_cpu(btree->u.external[n].length); 123 123 if (!btree->n_free_nodes) { 124 - up = a != node ? anode->up : -1; 124 + up = a != node ? le32_to_cpu(anode->up) : -1; 125 125 if (!(anode = hpfs_alloc_anode(s, a, &na, &bh1))) { 126 126 brelse(bh); 127 127 hpfs_free_sectors(s, se, 1); 128 128 return -1; 129 129 } 130 130 if (a == node && fnod) { 131 - anode->up = node; 131 + anode->up = cpu_to_le32(node); 132 132 anode->btree.fnode_parent = 1; 133 133 anode->btree.n_used_nodes = btree->n_used_nodes; 134 134 anode->btree.first_free = btree->first_free; ··· 137 137 btree->internal = 1; 138 138 btree->n_free_nodes = 11; 139 139 btree->n_used_nodes = 1; 140 - btree->first_free = (char *)&(btree->u.internal[1]) - (char *)btree; 141 - btree->u.internal[0].file_secno = -1; 142 - btree->u.internal[0].down = na; 140 + btree->first_free = cpu_to_le16((char *)&(btree->u.internal[1]) - (char *)btree); 141 + btree->u.internal[0].file_secno = cpu_to_le32(-1); 142 + btree->u.internal[0].down = cpu_to_le32(na); 143 143 mark_buffer_dirty(bh); 144 144 } else if (!(ranode = hpfs_alloc_anode(s, /*a*/0, &ra, &bh2))) { 145 145 brelse(bh); ··· 153 153 btree = &anode->btree; 154 154 } 155 155 btree->n_free_nodes--; n = btree->n_used_nodes++; 156 - btree->first_free += 12; 157 - btree->u.external[n].disk_secno = se; 158 - btree->u.external[n].file_secno = fs; 159 - btree->u.external[n].length = 1; 156 + btree->first_free = cpu_to_le16(le16_to_cpu(btree->first_free) + 12); 157 + btree->u.external[n].disk_secno = cpu_to_le32(se); 158 + btree->u.external[n].file_secno = cpu_to_le32(fs); 159 + btree->u.external[n].length = cpu_to_le32(1); 160 160 mark_buffer_dirty(bh); 161 161 brelse(bh); 162 162 if ((a == node && fnod) || na == -1) return se; 163 163 c2 = 0; 164 - while (up != -1) { 164 + while (up != (anode_secno)-1) { 165 165 struct anode *new_anode; 166 166 if (hpfs_sb(s)->sb_chk) 167 167 if (hpfs_stop_cycles(s, up, &c1, &c2, "hpfs_add_sector_to_btree #2")) return -1; ··· 174 174 } 175 175 if (btree->n_free_nodes) { 176 176 btree->n_free_nodes--; n = btree->n_used_nodes++; 177 - btree->first_free += 8; 178 - btree->u.internal[n].file_secno = -1; 179 - btree->u.internal[n].down = na; 180 - btree->u.internal[n-1].file_secno = fs; 177 + btree->first_free = cpu_to_le16(le16_to_cpu(btree->first_free) + 8); 178 + btree->u.internal[n].file_secno = cpu_to_le32(-1); 179 + btree->u.internal[n].down = cpu_to_le32(na); 180 + btree->u.internal[n-1].file_secno = cpu_to_le32(fs); 181 181 mark_buffer_dirty(bh); 182 182 brelse(bh); 183 183 brelse(bh2); 184 184 hpfs_free_sectors(s, ra, 1); 185 185 if ((anode = hpfs_map_anode(s, na, &bh))) { 186 - anode->up = up; 186 + anode->up = cpu_to_le32(up); 187 187 anode->btree.fnode_parent = up == node && fnod; 188 188 mark_buffer_dirty(bh); 189 189 brelse(bh); 190 190 } 191 191 return se; 192 192 } 193 - up = up != node ? anode->up : -1; 194 - btree->u.internal[btree->n_used_nodes - 1].file_secno = /*fs*/-1; 193 + up = up != node ? le32_to_cpu(anode->up) : -1; 194 + btree->u.internal[btree->n_used_nodes - 1].file_secno = cpu_to_le32(/*fs*/-1); 195 195 mark_buffer_dirty(bh); 196 196 brelse(bh); 197 197 a = na; 198 198 if ((new_anode = hpfs_alloc_anode(s, a, &na, &bh))) { 199 199 anode = new_anode; 200 - /*anode->up = up != -1 ? up : ra;*/ 200 + /*anode->up = cpu_to_le32(up != -1 ? up : ra);*/ 201 201 anode->btree.internal = 1; 202 202 anode->btree.n_used_nodes = 1; 203 203 anode->btree.n_free_nodes = 59; 204 - anode->btree.first_free = 16; 205 - anode->btree.u.internal[0].down = a; 206 - anode->btree.u.internal[0].file_secno = -1; 204 + anode->btree.first_free = cpu_to_le16(16); 205 + anode->btree.u.internal[0].down = cpu_to_le32(a); 206 + anode->btree.u.internal[0].file_secno = cpu_to_le32(-1); 207 207 mark_buffer_dirty(bh); 208 208 brelse(bh); 209 209 if ((anode = hpfs_map_anode(s, a, &bh))) { 210 - anode->up = na; 210 + anode->up = cpu_to_le32(na); 211 211 mark_buffer_dirty(bh); 212 212 brelse(bh); 213 213 } 214 214 } else na = a; 215 215 } 216 216 if ((anode = hpfs_map_anode(s, na, &bh))) { 217 - anode->up = node; 217 + anode->up = cpu_to_le32(node); 218 218 if (fnod) anode->btree.fnode_parent = 1; 219 219 mark_buffer_dirty(bh); 220 220 brelse(bh); ··· 232 232 } 233 233 btree = &fnode->btree; 234 234 } 235 - ranode->up = node; 236 - memcpy(&ranode->btree, btree, btree->first_free); 235 + ranode->up = cpu_to_le32(node); 236 + memcpy(&ranode->btree, btree, le16_to_cpu(btree->first_free)); 237 237 if (fnod) ranode->btree.fnode_parent = 1; 238 238 ranode->btree.n_free_nodes = (ranode->btree.internal ? 60 : 40) - ranode->btree.n_used_nodes; 239 239 if (ranode->btree.internal) for (n = 0; n < ranode->btree.n_used_nodes; n++) { 240 240 struct anode *unode; 241 - if ((unode = hpfs_map_anode(s, ranode->u.internal[n].down, &bh1))) { 242 - unode->up = ra; 241 + if ((unode = hpfs_map_anode(s, le32_to_cpu(ranode->u.internal[n].down), &bh1))) { 242 + unode->up = cpu_to_le32(ra); 243 243 unode->btree.fnode_parent = 0; 244 244 mark_buffer_dirty(bh1); 245 245 brelse(bh1); ··· 248 248 btree->internal = 1; 249 249 btree->n_free_nodes = fnod ? 10 : 58; 250 250 btree->n_used_nodes = 2; 251 - btree->first_free = (char *)&btree->u.internal[2] - (char *)btree; 252 - btree->u.internal[0].file_secno = fs; 253 - btree->u.internal[0].down = ra; 254 - btree->u.internal[1].file_secno = -1; 255 - btree->u.internal[1].down = na; 251 + btree->first_free = cpu_to_le16((char *)&btree->u.internal[2] - (char *)btree); 252 + btree->u.internal[0].file_secno = cpu_to_le32(fs); 253 + btree->u.internal[0].down = cpu_to_le32(ra); 254 + btree->u.internal[1].file_secno = cpu_to_le32(-1); 255 + btree->u.internal[1].down = cpu_to_le32(na); 256 256 mark_buffer_dirty(bh); 257 257 brelse(bh); 258 258 mark_buffer_dirty(bh2); ··· 279 279 go_down: 280 280 d2 = 0; 281 281 while (btree1->internal) { 282 - ano = btree1->u.internal[pos].down; 282 + ano = le32_to_cpu(btree1->u.internal[pos].down); 283 283 if (level) brelse(bh); 284 284 if (hpfs_sb(s)->sb_chk) 285 285 if (hpfs_stop_cycles(s, ano, &d1, &d2, "hpfs_remove_btree #1")) ··· 290 290 pos = 0; 291 291 } 292 292 for (i = 0; i < btree1->n_used_nodes; i++) 293 - hpfs_free_sectors(s, btree1->u.external[i].disk_secno, btree1->u.external[i].length); 293 + hpfs_free_sectors(s, le32_to_cpu(btree1->u.external[i].disk_secno), le32_to_cpu(btree1->u.external[i].length)); 294 294 go_up: 295 295 if (!level) return; 296 296 brelse(bh); ··· 298 298 if (hpfs_stop_cycles(s, ano, &c1, &c2, "hpfs_remove_btree #2")) return; 299 299 hpfs_free_sectors(s, ano, 1); 300 300 oano = ano; 301 - ano = anode->up; 301 + ano = le32_to_cpu(anode->up); 302 302 if (--level) { 303 303 if (!(anode = hpfs_map_anode(s, ano, &bh))) return; 304 304 btree1 = &anode->btree; 305 305 } else btree1 = btree; 306 306 for (i = 0; i < btree1->n_used_nodes; i++) { 307 - if (btree1->u.internal[i].down == oano) { 307 + if (le32_to_cpu(btree1->u.internal[i].down) == oano) { 308 308 if ((pos = i + 1) < btree1->n_used_nodes) 309 309 goto go_down; 310 310 else ··· 411 411 if (fno) { 412 412 btree->n_free_nodes = 8; 413 413 btree->n_used_nodes = 0; 414 - btree->first_free = 8; 414 + btree->first_free = cpu_to_le16(8); 415 415 btree->internal = 0; 416 416 mark_buffer_dirty(bh); 417 417 } else hpfs_free_sectors(s, f, 1); ··· 421 421 while (btree->internal) { 422 422 nodes = btree->n_used_nodes + btree->n_free_nodes; 423 423 for (i = 0; i < btree->n_used_nodes; i++) 424 - if (btree->u.internal[i].file_secno >= secs) goto f; 424 + if (le32_to_cpu(btree->u.internal[i].file_secno) >= secs) goto f; 425 425 brelse(bh); 426 426 hpfs_error(s, "internal btree %08x doesn't end with -1", node); 427 427 return; 428 428 f: 429 429 for (j = i + 1; j < btree->n_used_nodes; j++) 430 - hpfs_ea_remove(s, btree->u.internal[j].down, 1, 0); 430 + hpfs_ea_remove(s, le32_to_cpu(btree->u.internal[j].down), 1, 0); 431 431 btree->n_used_nodes = i + 1; 432 432 btree->n_free_nodes = nodes - btree->n_used_nodes; 433 - btree->first_free = 8 + 8 * btree->n_used_nodes; 433 + btree->first_free = cpu_to_le16(8 + 8 * btree->n_used_nodes); 434 434 mark_buffer_dirty(bh); 435 - if (btree->u.internal[i].file_secno == secs) { 435 + if (btree->u.internal[i].file_secno == cpu_to_le32(secs)) { 436 436 brelse(bh); 437 437 return; 438 438 } 439 - node = btree->u.internal[i].down; 439 + node = le32_to_cpu(btree->u.internal[i].down); 440 440 brelse(bh); 441 441 if (hpfs_sb(s)->sb_chk) 442 442 if (hpfs_stop_cycles(s, node, &c1, &c2, "hpfs_truncate_btree")) ··· 446 446 } 447 447 nodes = btree->n_used_nodes + btree->n_free_nodes; 448 448 for (i = 0; i < btree->n_used_nodes; i++) 449 - if (btree->u.external[i].file_secno + btree->u.external[i].length >= secs) goto ff; 449 + if (le32_to_cpu(btree->u.external[i].file_secno) + le32_to_cpu(btree->u.external[i].length) >= secs) goto ff; 450 450 brelse(bh); 451 451 return; 452 452 ff: 453 - if (secs <= btree->u.external[i].file_secno) { 453 + if (secs <= le32_to_cpu(btree->u.external[i].file_secno)) { 454 454 hpfs_error(s, "there is an allocation error in file %08x, sector %08x", f, secs); 455 455 if (i) i--; 456 456 } 457 - else if (btree->u.external[i].file_secno + btree->u.external[i].length > secs) { 458 - hpfs_free_sectors(s, btree->u.external[i].disk_secno + secs - 459 - btree->u.external[i].file_secno, btree->u.external[i].length 460 - - secs + btree->u.external[i].file_secno); /* I hope gcc optimizes this :-) */ 461 - btree->u.external[i].length = secs - btree->u.external[i].file_secno; 457 + else if (le32_to_cpu(btree->u.external[i].file_secno) + le32_to_cpu(btree->u.external[i].length) > secs) { 458 + hpfs_free_sectors(s, le32_to_cpu(btree->u.external[i].disk_secno) + secs - 459 + le32_to_cpu(btree->u.external[i].file_secno), le32_to_cpu(btree->u.external[i].length) 460 + - secs + le32_to_cpu(btree->u.external[i].file_secno)); /* I hope gcc optimizes this :-) */ 461 + btree->u.external[i].length = cpu_to_le32(secs - le32_to_cpu(btree->u.external[i].file_secno)); 462 462 } 463 463 for (j = i + 1; j < btree->n_used_nodes; j++) 464 - hpfs_free_sectors(s, btree->u.external[j].disk_secno, btree->u.external[j].length); 464 + hpfs_free_sectors(s, le32_to_cpu(btree->u.external[j].disk_secno), le32_to_cpu(btree->u.external[j].length)); 465 465 btree->n_used_nodes = i + 1; 466 466 btree->n_free_nodes = nodes - btree->n_used_nodes; 467 - btree->first_free = 8 + 12 * btree->n_used_nodes; 467 + btree->first_free = cpu_to_le16(8 + 12 * btree->n_used_nodes); 468 468 mark_buffer_dirty(bh); 469 469 brelse(bh); 470 470 } ··· 480 480 struct extended_attribute *ea_end; 481 481 if (!(fnode = hpfs_map_fnode(s, fno, &bh))) return; 482 482 if (!fnode->dirflag) hpfs_remove_btree(s, &fnode->btree); 483 - else hpfs_remove_dtree(s, fnode->u.external[0].disk_secno); 483 + else hpfs_remove_dtree(s, le32_to_cpu(fnode->u.external[0].disk_secno)); 484 484 ea_end = fnode_end_ea(fnode); 485 485 for (ea = fnode_ea(fnode); ea < ea_end; ea = next_ea(ea)) 486 486 if (ea->indirect) 487 487 hpfs_ea_remove(s, ea_sec(ea), ea->anode, ea_len(ea)); 488 - hpfs_ea_ext_remove(s, fnode->ea_secno, fnode->ea_anode, fnode->ea_size_l); 488 + hpfs_ea_ext_remove(s, le32_to_cpu(fnode->ea_secno), fnode->ea_anode, le32_to_cpu(fnode->ea_size_l)); 489 489 brelse(bh); 490 490 hpfs_free_sectors(s, fno, 1); 491 491 }
+8 -16
fs/hpfs/buffer.c
··· 9 9 #include <linux/slab.h> 10 10 #include "hpfs_fn.h" 11 11 12 - void hpfs_lock_creation(struct super_block *s) 13 - { 14 - #ifdef DEBUG_LOCKS 15 - printk("lock creation\n"); 16 - #endif 17 - mutex_lock(&hpfs_sb(s)->hpfs_creation_de); 18 - } 19 - 20 - void hpfs_unlock_creation(struct super_block *s) 21 - { 22 - #ifdef DEBUG_LOCKS 23 - printk("unlock creation\n"); 24 - #endif 25 - mutex_unlock(&hpfs_sb(s)->hpfs_creation_de); 26 - } 27 - 28 12 /* Map a sector into a buffer and return pointers to it and to the buffer. */ 29 13 30 14 void *hpfs_map_sector(struct super_block *s, unsigned secno, struct buffer_head **bhp, 31 15 int ahead) 32 16 { 33 17 struct buffer_head *bh; 18 + 19 + hpfs_lock_assert(s); 34 20 35 21 cond_resched(); 36 22 ··· 35 49 { 36 50 struct buffer_head *bh; 37 51 /*return hpfs_map_sector(s, secno, bhp, 0);*/ 52 + 53 + hpfs_lock_assert(s); 38 54 39 55 cond_resched(); 40 56 ··· 57 69 { 58 70 struct buffer_head *bh; 59 71 char *data; 72 + 73 + hpfs_lock_assert(s); 60 74 61 75 cond_resched(); 62 76 ··· 114 124 struct quad_buffer_head *qbh) 115 125 { 116 126 cond_resched(); 127 + 128 + hpfs_lock_assert(s); 117 129 118 130 if (secno & 3) { 119 131 printk("HPFS: hpfs_get_4sectors: unaligned read\n");
+10 -12
fs/hpfs/dir.c
··· 88 88 hpfs_error(inode->i_sb, "not a directory, fnode %08lx", 89 89 (unsigned long)inode->i_ino); 90 90 } 91 - if (hpfs_inode->i_dno != fno->u.external[0].disk_secno) { 91 + if (hpfs_inode->i_dno != le32_to_cpu(fno->u.external[0].disk_secno)) { 92 92 e = 1; 93 - hpfs_error(inode->i_sb, "corrupted inode: i_dno == %08x, fnode -> dnode == %08x", hpfs_inode->i_dno, fno->u.external[0].disk_secno); 93 + hpfs_error(inode->i_sb, "corrupted inode: i_dno == %08x, fnode -> dnode == %08x", hpfs_inode->i_dno, le32_to_cpu(fno->u.external[0].disk_secno)); 94 94 } 95 95 brelse(bh); 96 96 if (e) { ··· 156 156 goto again; 157 157 } 158 158 tempname = hpfs_translate_name(inode->i_sb, de->name, de->namelen, lc, de->not_8x3); 159 - if (filldir(dirent, tempname, de->namelen, old_pos, de->fnode, DT_UNKNOWN) < 0) { 159 + if (filldir(dirent, tempname, de->namelen, old_pos, le32_to_cpu(de->fnode), DT_UNKNOWN) < 0) { 160 160 filp->f_pos = old_pos; 161 161 if (tempname != de->name) kfree(tempname); 162 162 hpfs_brelse4(&qbh); ··· 221 221 * Get inode number, what we're after. 222 222 */ 223 223 224 - ino = de->fnode; 224 + ino = le32_to_cpu(de->fnode); 225 225 226 226 /* 227 227 * Go find or make an inode. ··· 236 236 hpfs_init_inode(result); 237 237 if (de->directory) 238 238 hpfs_read_inode(result); 239 - else if (de->ea_size && hpfs_sb(dir->i_sb)->sb_eas) 239 + else if (le32_to_cpu(de->ea_size) && hpfs_sb(dir->i_sb)->sb_eas) 240 240 hpfs_read_inode(result); 241 241 else { 242 242 result->i_mode |= S_IFREG; ··· 250 250 hpfs_result = hpfs_i(result); 251 251 if (!de->directory) hpfs_result->i_parent_dir = dir->i_ino; 252 252 253 - hpfs_decide_conv(result, name, len); 254 - 255 253 if (de->has_acl || de->has_xtd_perm) if (!(dir->i_sb->s_flags & MS_RDONLY)) { 256 254 hpfs_error(result->i_sb, "ACLs or XPERM found. This is probably HPFS386. This driver doesn't support it now. Send me some info on these structures"); 257 255 goto bail1; ··· 261 263 */ 262 264 263 265 if (!result->i_ctime.tv_sec) { 264 - if (!(result->i_ctime.tv_sec = local_to_gmt(dir->i_sb, de->creation_date))) 266 + if (!(result->i_ctime.tv_sec = local_to_gmt(dir->i_sb, le32_to_cpu(de->creation_date)))) 265 267 result->i_ctime.tv_sec = 1; 266 268 result->i_ctime.tv_nsec = 0; 267 - result->i_mtime.tv_sec = local_to_gmt(dir->i_sb, de->write_date); 269 + result->i_mtime.tv_sec = local_to_gmt(dir->i_sb, le32_to_cpu(de->write_date)); 268 270 result->i_mtime.tv_nsec = 0; 269 - result->i_atime.tv_sec = local_to_gmt(dir->i_sb, de->read_date); 271 + result->i_atime.tv_sec = local_to_gmt(dir->i_sb, le32_to_cpu(de->read_date)); 270 272 result->i_atime.tv_nsec = 0; 271 - hpfs_result->i_ea_size = de->ea_size; 273 + hpfs_result->i_ea_size = le32_to_cpu(de->ea_size); 272 274 if (!hpfs_result->i_ea_mode && de->read_only) 273 275 result->i_mode &= ~0222; 274 276 if (!de->directory) { 275 277 if (result->i_size == -1) { 276 - result->i_size = de->file_size; 278 + result->i_size = le32_to_cpu(de->file_size); 277 279 result->i_data.a_ops = &hpfs_aops; 278 280 hpfs_i(result)->mmu_private = result->i_size; 279 281 /*
+84 -90
fs/hpfs/dnode.c
··· 14 14 struct hpfs_dirent *de_end = dnode_end_de(d); 15 15 int i = 1; 16 16 for (de = dnode_first_de(d); de < de_end; de = de_next_de(de)) { 17 - if (de == fde) return ((loff_t) d->self << 4) | (loff_t)i; 17 + if (de == fde) return ((loff_t) le32_to_cpu(d->self) << 4) | (loff_t)i; 18 18 i++; 19 19 } 20 20 printk("HPFS: get_pos: not_found\n"); 21 - return ((loff_t)d->self << 4) | (loff_t)1; 21 + return ((loff_t)le32_to_cpu(d->self) << 4) | (loff_t)1; 22 22 } 23 23 24 24 void hpfs_add_pos(struct inode *inode, loff_t *pos) ··· 130 130 { 131 131 struct hpfs_dirent *de; 132 132 if (!(de = dnode_last_de(d))) { 133 - hpfs_error(s, "set_last_pointer: empty dnode %08x", d->self); 133 + hpfs_error(s, "set_last_pointer: empty dnode %08x", le32_to_cpu(d->self)); 134 134 return; 135 135 } 136 136 if (hpfs_sb(s)->sb_chk) { 137 137 if (de->down) { 138 138 hpfs_error(s, "set_last_pointer: dnode %08x has already last pointer %08x", 139 - d->self, de_down_pointer(de)); 139 + le32_to_cpu(d->self), de_down_pointer(de)); 140 140 return; 141 141 } 142 - if (de->length != 32) { 143 - hpfs_error(s, "set_last_pointer: bad last dirent in dnode %08x", d->self); 142 + if (le16_to_cpu(de->length) != 32) { 143 + hpfs_error(s, "set_last_pointer: bad last dirent in dnode %08x", le32_to_cpu(d->self)); 144 144 return; 145 145 } 146 146 } 147 147 if (ptr) { 148 - if ((d->first_free += 4) > 2048) { 149 - hpfs_error(s,"set_last_pointer: too long dnode %08x", d->self); 150 - d->first_free -= 4; 148 + d->first_free = cpu_to_le32(le32_to_cpu(d->first_free) + 4); 149 + if (le32_to_cpu(d->first_free) > 2048) { 150 + hpfs_error(s, "set_last_pointer: too long dnode %08x", le32_to_cpu(d->self)); 151 + d->first_free = cpu_to_le32(le32_to_cpu(d->first_free) - 4); 151 152 return; 152 153 } 153 - de->length = 36; 154 + de->length = cpu_to_le16(36); 154 155 de->down = 1; 155 - *(dnode_secno *)((char *)de + 32) = ptr; 156 + *(dnode_secno *)((char *)de + 32) = cpu_to_le32(ptr); 156 157 } 157 158 } 158 159 ··· 169 168 for (de = dnode_first_de(d); de < de_end; de = de_next_de(de)) { 170 169 int c = hpfs_compare_names(s, name, namelen, de->name, de->namelen, de->last); 171 170 if (!c) { 172 - hpfs_error(s, "name (%c,%d) already exists in dnode %08x", *name, namelen, d->self); 171 + hpfs_error(s, "name (%c,%d) already exists in dnode %08x", *name, namelen, le32_to_cpu(d->self)); 173 172 return NULL; 174 173 } 175 174 if (c < 0) break; ··· 177 176 memmove((char *)de + d_size, de, (char *)de_end - (char *)de); 178 177 memset(de, 0, d_size); 179 178 if (down_ptr) { 180 - *(int *)((char *)de + d_size - 4) = down_ptr; 179 + *(dnode_secno *)((char *)de + d_size - 4) = cpu_to_le32(down_ptr); 181 180 de->down = 1; 182 181 } 183 - de->length = d_size; 184 - if (down_ptr) de->down = 1; 182 + de->length = cpu_to_le16(d_size); 185 183 de->not_8x3 = hpfs_is_name_long(name, namelen); 186 184 de->namelen = namelen; 187 185 memcpy(de->name, name, namelen); 188 - d->first_free += d_size; 186 + d->first_free = cpu_to_le32(le32_to_cpu(d->first_free) + d_size); 189 187 return de; 190 188 } 191 189 ··· 194 194 struct hpfs_dirent *de) 195 195 { 196 196 if (de->last) { 197 - hpfs_error(s, "attempt to delete last dirent in dnode %08x", d->self); 197 + hpfs_error(s, "attempt to delete last dirent in dnode %08x", le32_to_cpu(d->self)); 198 198 return; 199 199 } 200 - d->first_free -= de->length; 201 - memmove(de, de_next_de(de), d->first_free + (char *)d - (char *)de); 200 + d->first_free = cpu_to_le32(le32_to_cpu(d->first_free) - le16_to_cpu(de->length)); 201 + memmove(de, de_next_de(de), le32_to_cpu(d->first_free) + (char *)d - (char *)de); 202 202 } 203 203 204 204 static void fix_up_ptrs(struct super_block *s, struct dnode *d) 205 205 { 206 206 struct hpfs_dirent *de; 207 207 struct hpfs_dirent *de_end = dnode_end_de(d); 208 - dnode_secno dno = d->self; 208 + dnode_secno dno = le32_to_cpu(d->self); 209 209 for (de = dnode_first_de(d); de < de_end; de = de_next_de(de)) 210 210 if (de->down) { 211 211 struct quad_buffer_head qbh; 212 212 struct dnode *dd; 213 213 if ((dd = hpfs_map_dnode(s, de_down_pointer(de), &qbh))) { 214 - if (dd->up != dno || dd->root_dnode) { 215 - dd->up = dno; 214 + if (le32_to_cpu(dd->up) != dno || dd->root_dnode) { 215 + dd->up = cpu_to_le32(dno); 216 216 dd->root_dnode = 0; 217 217 hpfs_mark_4buffers_dirty(&qbh); 218 218 } ··· 262 262 kfree(nname); 263 263 return 1; 264 264 } 265 - if (d->first_free + de_size(namelen, down_ptr) <= 2048) { 265 + if (le32_to_cpu(d->first_free) + de_size(namelen, down_ptr) <= 2048) { 266 266 loff_t t; 267 267 copy_de(de=hpfs_add_de(i->i_sb, d, name, namelen, down_ptr), new_de); 268 268 t = get_pos(d, de); ··· 286 286 kfree(nname); 287 287 return 1; 288 288 } 289 - memcpy(nd, d, d->first_free); 289 + memcpy(nd, d, le32_to_cpu(d->first_free)); 290 290 copy_de(de = hpfs_add_de(i->i_sb, nd, name, namelen, down_ptr), new_de); 291 291 for_all_poss(i, hpfs_pos_ins, get_pos(nd, de), 1); 292 292 h = ((char *)dnode_last_de(nd) - (char *)nd) / 2 + 10; 293 - if (!(ad = hpfs_alloc_dnode(i->i_sb, d->up, &adno, &qbh1, 0))) { 293 + if (!(ad = hpfs_alloc_dnode(i->i_sb, le32_to_cpu(d->up), &adno, &qbh1))) { 294 294 hpfs_error(i->i_sb, "unable to alloc dnode - dnode tree will be corrupted"); 295 295 hpfs_brelse4(&qbh); 296 296 kfree(nd); ··· 313 313 down_ptr = adno; 314 314 set_last_pointer(i->i_sb, ad, de->down ? de_down_pointer(de) : 0); 315 315 de = de_next_de(de); 316 - memmove((char *)nd + 20, de, nd->first_free + (char *)nd - (char *)de); 317 - nd->first_free -= (char *)de - (char *)nd - 20; 318 - memcpy(d, nd, nd->first_free); 316 + memmove((char *)nd + 20, de, le32_to_cpu(nd->first_free) + (char *)nd - (char *)de); 317 + nd->first_free = cpu_to_le32(le32_to_cpu(nd->first_free) - ((char *)de - (char *)nd - 20)); 318 + memcpy(d, nd, le32_to_cpu(nd->first_free)); 319 319 for_all_poss(i, hpfs_pos_del, (loff_t)dno << 4, pos); 320 320 fix_up_ptrs(i->i_sb, ad); 321 321 if (!d->root_dnode) { 322 - dno = ad->up = d->up; 322 + ad->up = d->up; 323 + dno = le32_to_cpu(ad->up); 323 324 hpfs_mark_4buffers_dirty(&qbh); 324 325 hpfs_brelse4(&qbh); 325 326 hpfs_mark_4buffers_dirty(&qbh1); 326 327 hpfs_brelse4(&qbh1); 327 328 goto go_up; 328 329 } 329 - if (!(rd = hpfs_alloc_dnode(i->i_sb, d->up, &rdno, &qbh2, 0))) { 330 + if (!(rd = hpfs_alloc_dnode(i->i_sb, le32_to_cpu(d->up), &rdno, &qbh2))) { 330 331 hpfs_error(i->i_sb, "unable to alloc dnode - dnode tree will be corrupted"); 331 332 hpfs_brelse4(&qbh); 332 333 hpfs_brelse4(&qbh1); ··· 339 338 i->i_blocks += 4; 340 339 rd->root_dnode = 1; 341 340 rd->up = d->up; 342 - if (!(fnode = hpfs_map_fnode(i->i_sb, d->up, &bh))) { 341 + if (!(fnode = hpfs_map_fnode(i->i_sb, le32_to_cpu(d->up), &bh))) { 343 342 hpfs_free_dnode(i->i_sb, rdno); 344 343 hpfs_brelse4(&qbh); 345 344 hpfs_brelse4(&qbh1); ··· 348 347 kfree(nname); 349 348 return 1; 350 349 } 351 - fnode->u.external[0].disk_secno = rdno; 350 + fnode->u.external[0].disk_secno = cpu_to_le32(rdno); 352 351 mark_buffer_dirty(bh); 353 352 brelse(bh); 354 - d->up = ad->up = hpfs_i(i)->i_dno = rdno; 353 + hpfs_i(i)->i_dno = rdno; 354 + d->up = ad->up = cpu_to_le32(rdno); 355 355 d->root_dnode = ad->root_dnode = 0; 356 356 hpfs_mark_4buffers_dirty(&qbh); 357 357 hpfs_brelse4(&qbh); ··· 375 373 376 374 int hpfs_add_dirent(struct inode *i, 377 375 const unsigned char *name, unsigned namelen, 378 - struct hpfs_dirent *new_de, int cdepth) 376 + struct hpfs_dirent *new_de) 379 377 { 380 378 struct hpfs_inode_info *hpfs_inode = hpfs_i(i); 381 379 struct dnode *d; ··· 405 403 } 406 404 } 407 405 hpfs_brelse4(&qbh); 408 - if (!cdepth) hpfs_lock_creation(i->i_sb); 409 406 if (hpfs_check_free_dnodes(i->i_sb, FREE_DNODES_ADD)) { 410 407 c = 1; 411 408 goto ret; ··· 412 411 i->i_version++; 413 412 c = hpfs_add_to_dnode(i, dno, name, namelen, new_de, 0); 414 413 ret: 415 - if (!cdepth) hpfs_unlock_creation(i->i_sb); 416 414 return c; 417 415 } 418 416 ··· 437 437 return 0; 438 438 if (!(dnode = hpfs_map_dnode(i->i_sb, dno, &qbh))) return 0; 439 439 if (hpfs_sb(i->i_sb)->sb_chk) { 440 - if (dnode->up != chk_up) { 440 + if (le32_to_cpu(dnode->up) != chk_up) { 441 441 hpfs_error(i->i_sb, "move_to_top: up pointer from %08x should be %08x, is %08x", 442 - dno, chk_up, dnode->up); 442 + dno, chk_up, le32_to_cpu(dnode->up)); 443 443 hpfs_brelse4(&qbh); 444 444 return 0; 445 445 } ··· 455 455 hpfs_brelse4(&qbh); 456 456 } 457 457 while (!(de = dnode_pre_last_de(dnode))) { 458 - dnode_secno up = dnode->up; 458 + dnode_secno up = le32_to_cpu(dnode->up); 459 459 hpfs_brelse4(&qbh); 460 460 hpfs_free_dnode(i->i_sb, dno); 461 461 i->i_size -= 2048; ··· 474 474 hpfs_brelse4(&qbh); 475 475 return 0; 476 476 } 477 - dnode->first_free -= 4; 478 - de->length -= 4; 477 + dnode->first_free = cpu_to_le32(le32_to_cpu(dnode->first_free) - 4); 478 + de->length = cpu_to_le16(le16_to_cpu(de->length) - 4); 479 479 de->down = 0; 480 480 hpfs_mark_4buffers_dirty(&qbh); 481 481 dno = up; ··· 483 483 t = get_pos(dnode, de); 484 484 for_all_poss(i, hpfs_pos_subst, t, 4); 485 485 for_all_poss(i, hpfs_pos_subst, t + 1, 5); 486 - if (!(nde = kmalloc(de->length, GFP_NOFS))) { 486 + if (!(nde = kmalloc(le16_to_cpu(de->length), GFP_NOFS))) { 487 487 hpfs_error(i->i_sb, "out of memory for dirent - directory will be corrupted"); 488 488 hpfs_brelse4(&qbh); 489 489 return 0; 490 490 } 491 - memcpy(nde, de, de->length); 491 + memcpy(nde, de, le16_to_cpu(de->length)); 492 492 ddno = de->down ? de_down_pointer(de) : 0; 493 493 hpfs_delete_de(i->i_sb, dnode, de); 494 494 set_last_pointer(i->i_sb, dnode, ddno); ··· 517 517 try_it_again: 518 518 if (hpfs_stop_cycles(i->i_sb, dno, &c1, &c2, "delete_empty_dnode")) return; 519 519 if (!(dnode = hpfs_map_dnode(i->i_sb, dno, &qbh))) return; 520 - if (dnode->first_free > 56) goto end; 521 - if (dnode->first_free == 52 || dnode->first_free == 56) { 520 + if (le32_to_cpu(dnode->first_free) > 56) goto end; 521 + if (le32_to_cpu(dnode->first_free) == 52 || le32_to_cpu(dnode->first_free) == 56) { 522 522 struct hpfs_dirent *de_end; 523 523 int root = dnode->root_dnode; 524 - up = dnode->up; 524 + up = le32_to_cpu(dnode->up); 525 525 de = dnode_first_de(dnode); 526 526 down = de->down ? de_down_pointer(de) : 0; 527 527 if (hpfs_sb(i->i_sb)->sb_chk) if (root && !down) { ··· 545 545 return; 546 546 } 547 547 if ((d1 = hpfs_map_dnode(i->i_sb, down, &qbh1))) { 548 - d1->up = up; 548 + d1->up = cpu_to_le32(up); 549 549 d1->root_dnode = 1; 550 550 hpfs_mark_4buffers_dirty(&qbh1); 551 551 hpfs_brelse4(&qbh1); 552 552 } 553 553 if ((fnode = hpfs_map_fnode(i->i_sb, up, &bh))) { 554 - fnode->u.external[0].disk_secno = down; 554 + fnode->u.external[0].disk_secno = cpu_to_le32(down); 555 555 mark_buffer_dirty(bh); 556 556 brelse(bh); 557 557 } ··· 570 570 for_all_poss(i, hpfs_pos_subst, ((loff_t)dno << 4) | 1, ((loff_t)up << 4) | p); 571 571 if (!down) { 572 572 de->down = 0; 573 - de->length -= 4; 574 - dnode->first_free -= 4; 573 + de->length = cpu_to_le16(le16_to_cpu(de->length) - 4); 574 + dnode->first_free = cpu_to_le32(le32_to_cpu(dnode->first_free) - 4); 575 575 memmove(de_next_de(de), (char *)de_next_de(de) + 4, 576 - (char *)dnode + dnode->first_free - (char *)de_next_de(de)); 576 + (char *)dnode + le32_to_cpu(dnode->first_free) - (char *)de_next_de(de)); 577 577 } else { 578 578 struct dnode *d1; 579 579 struct quad_buffer_head qbh1; 580 - *(dnode_secno *) ((void *) de + de->length - 4) = down; 580 + *(dnode_secno *) ((void *) de + le16_to_cpu(de->length) - 4) = down; 581 581 if ((d1 = hpfs_map_dnode(i->i_sb, down, &qbh1))) { 582 - d1->up = up; 582 + d1->up = cpu_to_le32(up); 583 583 hpfs_mark_4buffers_dirty(&qbh1); 584 584 hpfs_brelse4(&qbh1); 585 585 } 586 586 } 587 587 } else { 588 - hpfs_error(i->i_sb, "delete_empty_dnode: dnode %08x, first_free == %03x", dno, dnode->first_free); 588 + hpfs_error(i->i_sb, "delete_empty_dnode: dnode %08x, first_free == %03x", dno, le32_to_cpu(dnode->first_free)); 589 589 goto end; 590 590 } 591 591 ··· 596 596 struct quad_buffer_head qbh1; 597 597 if (!de_next->down) goto endm; 598 598 ndown = de_down_pointer(de_next); 599 - if (!(de_cp = kmalloc(de->length, GFP_NOFS))) { 599 + if (!(de_cp = kmalloc(le16_to_cpu(de->length), GFP_NOFS))) { 600 600 printk("HPFS: out of memory for dtree balancing\n"); 601 601 goto endm; 602 602 } 603 - memcpy(de_cp, de, de->length); 603 + memcpy(de_cp, de, le16_to_cpu(de->length)); 604 604 hpfs_delete_de(i->i_sb, dnode, de); 605 605 hpfs_mark_4buffers_dirty(&qbh); 606 606 hpfs_brelse4(&qbh); 607 607 for_all_poss(i, hpfs_pos_subst, ((loff_t)up << 4) | p, 4); 608 608 for_all_poss(i, hpfs_pos_del, ((loff_t)up << 4) | p, 1); 609 609 if (de_cp->down) if ((d1 = hpfs_map_dnode(i->i_sb, de_down_pointer(de_cp), &qbh1))) { 610 - d1->up = ndown; 610 + d1->up = cpu_to_le32(ndown); 611 611 hpfs_mark_4buffers_dirty(&qbh1); 612 612 hpfs_brelse4(&qbh1); 613 613 } ··· 635 635 struct hpfs_dirent *del = dnode_last_de(d1); 636 636 dlp = del->down ? de_down_pointer(del) : 0; 637 637 if (!dlp && down) { 638 - if (d1->first_free > 2044) { 638 + if (le32_to_cpu(d1->first_free) > 2044) { 639 639 if (hpfs_sb(i->i_sb)->sb_chk >= 2) { 640 640 printk("HPFS: warning: unbalanced dnode tree, see hpfs.txt 4 more info\n"); 641 641 printk("HPFS: warning: terminating balancing operation\n"); ··· 647 647 printk("HPFS: warning: unbalanced dnode tree, see hpfs.txt 4 more info\n"); 648 648 printk("HPFS: warning: goin'on\n"); 649 649 } 650 - del->length += 4; 650 + del->length = cpu_to_le16(le16_to_cpu(del->length) + 4); 651 651 del->down = 1; 652 - d1->first_free += 4; 652 + d1->first_free = cpu_to_le32(le32_to_cpu(d1->first_free) + 4); 653 653 } 654 654 if (dlp && !down) { 655 - del->length -= 4; 655 + del->length = cpu_to_le16(le16_to_cpu(del->length) - 4); 656 656 del->down = 0; 657 - d1->first_free -= 4; 657 + d1->first_free = cpu_to_le32(le32_to_cpu(d1->first_free) - 4); 658 658 } else if (down) 659 - *(dnode_secno *) ((void *) del + del->length - 4) = down; 659 + *(dnode_secno *) ((void *) del + le16_to_cpu(del->length) - 4) = cpu_to_le32(down); 660 660 } else goto endm; 661 - if (!(de_cp = kmalloc(de_prev->length, GFP_NOFS))) { 661 + if (!(de_cp = kmalloc(le16_to_cpu(de_prev->length), GFP_NOFS))) { 662 662 printk("HPFS: out of memory for dtree balancing\n"); 663 663 hpfs_brelse4(&qbh1); 664 664 goto endm; 665 665 } 666 666 hpfs_mark_4buffers_dirty(&qbh1); 667 667 hpfs_brelse4(&qbh1); 668 - memcpy(de_cp, de_prev, de_prev->length); 668 + memcpy(de_cp, de_prev, le16_to_cpu(de_prev->length)); 669 669 hpfs_delete_de(i->i_sb, dnode, de_prev); 670 670 if (!de_prev->down) { 671 - de_prev->length += 4; 671 + de_prev->length = cpu_to_le16(le16_to_cpu(de_prev->length) + 4); 672 672 de_prev->down = 1; 673 - dnode->first_free += 4; 673 + dnode->first_free = cpu_to_le32(le32_to_cpu(dnode->first_free) + 4); 674 674 } 675 - *(dnode_secno *) ((void *) de_prev + de_prev->length - 4) = ndown; 675 + *(dnode_secno *) ((void *) de_prev + le16_to_cpu(de_prev->length) - 4) = cpu_to_le32(ndown); 676 676 hpfs_mark_4buffers_dirty(&qbh); 677 677 hpfs_brelse4(&qbh); 678 678 for_all_poss(i, hpfs_pos_subst, ((loff_t)up << 4) | (p - 1), 4); 679 679 for_all_poss(i, hpfs_pos_subst, ((loff_t)up << 4) | p, ((loff_t)up << 4) | (p - 1)); 680 680 if (down) if ((d1 = hpfs_map_dnode(i->i_sb, de_down_pointer(de), &qbh1))) { 681 - d1->up = ndown; 681 + d1->up = cpu_to_le32(ndown); 682 682 hpfs_mark_4buffers_dirty(&qbh1); 683 683 hpfs_brelse4(&qbh1); 684 684 } ··· 701 701 { 702 702 struct dnode *dnode = qbh->data; 703 703 dnode_secno down = 0; 704 - int lock = 0; 705 704 loff_t t; 706 705 if (de->first || de->last) { 707 706 hpfs_error(i->i_sb, "hpfs_remove_dirent: attempt to delete first or last dirent in dnode %08x", dno); ··· 709 710 } 710 711 if (de->down) down = de_down_pointer(de); 711 712 if (depth && (de->down || (de == dnode_first_de(dnode) && de_next_de(de)->last))) { 712 - lock = 1; 713 - hpfs_lock_creation(i->i_sb); 714 713 if (hpfs_check_free_dnodes(i->i_sb, FREE_DNODES_DEL)) { 715 714 hpfs_brelse4(qbh); 716 - hpfs_unlock_creation(i->i_sb); 717 715 return 2; 718 716 } 719 717 } ··· 723 727 dnode_secno a = move_to_top(i, down, dno); 724 728 for_all_poss(i, hpfs_pos_subst, 5, t); 725 729 if (a) delete_empty_dnode(i, a); 726 - if (lock) hpfs_unlock_creation(i->i_sb); 727 730 return !a; 728 731 } 729 732 delete_empty_dnode(i, dno); 730 - if (lock) hpfs_unlock_creation(i->i_sb); 731 733 return 0; 732 734 } 733 735 ··· 745 751 ptr = 0; 746 752 go_up: 747 753 if (!(dnode = hpfs_map_dnode(s, dno, &qbh))) return; 748 - if (hpfs_sb(s)->sb_chk) if (odno && odno != -1 && dnode->up != odno) 749 - hpfs_error(s, "hpfs_count_dnodes: bad up pointer; dnode %08x, down %08x points to %08x", odno, dno, dnode->up); 754 + if (hpfs_sb(s)->sb_chk) if (odno && odno != -1 && le32_to_cpu(dnode->up) != odno) 755 + hpfs_error(s, "hpfs_count_dnodes: bad up pointer; dnode %08x, down %08x points to %08x", odno, dno, le32_to_cpu(dnode->up)); 750 756 de = dnode_first_de(dnode); 751 757 if (ptr) while(1) { 752 758 if (de->down) if (de_down_pointer(de) == ptr) goto process_de; ··· 770 776 if (!de->first && !de->last && n_items) (*n_items)++; 771 777 if ((de = de_next_de(de)) < dnode_end_de(dnode)) goto next_de; 772 778 ptr = dno; 773 - dno = dnode->up; 779 + dno = le32_to_cpu(dnode->up); 774 780 if (dnode->root_dnode) { 775 781 hpfs_brelse4(&qbh); 776 782 return; ··· 818 824 return d; 819 825 if (!(de = map_nth_dirent(s, d, 1, &qbh, NULL))) return dno; 820 826 if (hpfs_sb(s)->sb_chk) 821 - if (up && ((struct dnode *)qbh.data)->up != up) 822 - hpfs_error(s, "hpfs_de_as_down_as_possible: bad up pointer; dnode %08x, down %08x points to %08x", up, d, ((struct dnode *)qbh.data)->up); 827 + if (up && le32_to_cpu(((struct dnode *)qbh.data)->up) != up) 828 + hpfs_error(s, "hpfs_de_as_down_as_possible: bad up pointer; dnode %08x, down %08x points to %08x", up, d, le32_to_cpu(((struct dnode *)qbh.data)->up)); 823 829 if (!de->down) { 824 830 hpfs_brelse4(&qbh); 825 831 return d; ··· 868 874 /* Going up */ 869 875 if (dnode->root_dnode) goto bail; 870 876 871 - if (!(up_dnode = hpfs_map_dnode(inode->i_sb, dnode->up, &qbh0))) 877 + if (!(up_dnode = hpfs_map_dnode(inode->i_sb, le32_to_cpu(dnode->up), &qbh0))) 872 878 goto bail; 873 879 874 880 end_up_de = dnode_end_de(up_dnode); ··· 876 882 for (up_de = dnode_first_de(up_dnode); up_de < end_up_de; 877 883 up_de = de_next_de(up_de)) { 878 884 if (!(++c & 077)) hpfs_error(inode->i_sb, 879 - "map_pos_dirent: pos crossed dnode boundary; dnode = %08x", dnode->up); 885 + "map_pos_dirent: pos crossed dnode boundary; dnode = %08x", le32_to_cpu(dnode->up)); 880 886 if (up_de->down && de_down_pointer(up_de) == dno) { 881 - *posp = ((loff_t) dnode->up << 4) + c; 887 + *posp = ((loff_t) le32_to_cpu(dnode->up) << 4) + c; 882 888 hpfs_brelse4(&qbh0); 883 889 return de; 884 890 } 885 891 } 886 892 887 893 hpfs_error(inode->i_sb, "map_pos_dirent: pointer to dnode %08x not found in parent dnode %08x", 888 - dno, dnode->up); 894 + dno, le32_to_cpu(dnode->up)); 889 895 hpfs_brelse4(&qbh0); 890 896 891 897 bail: ··· 1011 1017 /*name2[15] = 0xff;*/ 1012 1018 name1len = 15; name2len = 256; 1013 1019 } 1014 - if (!(upf = hpfs_map_fnode(s, f->up, &bh))) { 1020 + if (!(upf = hpfs_map_fnode(s, le32_to_cpu(f->up), &bh))) { 1015 1021 kfree(name2); 1016 1022 return NULL; 1017 1023 } 1018 1024 if (!upf->dirflag) { 1019 1025 brelse(bh); 1020 - hpfs_error(s, "fnode %08x has non-directory parent %08x", fno, f->up); 1026 + hpfs_error(s, "fnode %08x has non-directory parent %08x", fno, le32_to_cpu(f->up)); 1021 1027 kfree(name2); 1022 1028 return NULL; 1023 1029 } 1024 - dno = upf->u.external[0].disk_secno; 1030 + dno = le32_to_cpu(upf->u.external[0].disk_secno); 1025 1031 brelse(bh); 1026 1032 go_down: 1027 1033 downd = 0; ··· 1043 1049 return NULL; 1044 1050 } 1045 1051 next_de: 1046 - if (de->fnode == fno) { 1052 + if (le32_to_cpu(de->fnode) == fno) { 1047 1053 kfree(name2); 1048 1054 return de; 1049 1055 } ··· 1059 1065 goto go_down; 1060 1066 } 1061 1067 f: 1062 - if (de->fnode == fno) { 1068 + if (le32_to_cpu(de->fnode) == fno) { 1063 1069 kfree(name2); 1064 1070 return de; 1065 1071 } ··· 1068 1074 if ((de = de_next_de(de)) < de_end) goto next_de; 1069 1075 if (d->root_dnode) goto not_found; 1070 1076 downd = dno; 1071 - dno = d->up; 1077 + dno = le32_to_cpu(d->up); 1072 1078 hpfs_brelse4(qbh); 1073 1079 if (hpfs_sb(s)->sb_chk) 1074 1080 if (hpfs_stop_cycles(s, downd, &d1, &d2, "map_fnode_dirent #2")) {
+69 -67
fs/hpfs/ea.c
··· 24 24 } 25 25 if (hpfs_ea_read(s, a, ano, pos, 4, ex)) return; 26 26 if (ea->indirect) { 27 - if (ea->valuelen != 8) { 27 + if (ea_valuelen(ea) != 8) { 28 28 hpfs_error(s, "ea->indirect set while ea->valuelen!=8, %s %08x, pos %08x", 29 29 ano ? "anode" : "sectors", a, pos); 30 30 return; ··· 33 33 return; 34 34 hpfs_ea_remove(s, ea_sec(ea), ea->anode, ea_len(ea)); 35 35 } 36 - pos += ea->namelen + ea->valuelen + 5; 36 + pos += ea->namelen + ea_valuelen(ea) + 5; 37 37 } 38 38 if (!ano) hpfs_free_sectors(s, a, (len+511) >> 9); 39 39 else { ··· 76 76 unsigned pos; 77 77 int ano, len; 78 78 secno a; 79 + char ex[4 + 255 + 1 + 8]; 79 80 struct extended_attribute *ea; 80 81 struct extended_attribute *ea_end = fnode_end_ea(fnode); 81 82 for (ea = fnode_ea(fnode); ea < ea_end; ea = next_ea(ea)) 82 83 if (!strcmp(ea->name, key)) { 83 84 if (ea->indirect) 84 85 goto indirect; 85 - if (ea->valuelen >= size) 86 + if (ea_valuelen(ea) >= size) 86 87 return -EINVAL; 87 - memcpy(buf, ea_data(ea), ea->valuelen); 88 - buf[ea->valuelen] = 0; 88 + memcpy(buf, ea_data(ea), ea_valuelen(ea)); 89 + buf[ea_valuelen(ea)] = 0; 89 90 return 0; 90 91 } 91 - a = fnode->ea_secno; 92 - len = fnode->ea_size_l; 92 + a = le32_to_cpu(fnode->ea_secno); 93 + len = le32_to_cpu(fnode->ea_size_l); 93 94 ano = fnode->ea_anode; 94 95 pos = 0; 95 96 while (pos < len) { 96 - char ex[4 + 255 + 1 + 8]; 97 97 ea = (struct extended_attribute *)ex; 98 98 if (pos + 4 > len) { 99 99 hpfs_error(s, "EAs don't end correctly, %s %08x, len %08x", ··· 106 106 if (!strcmp(ea->name, key)) { 107 107 if (ea->indirect) 108 108 goto indirect; 109 - if (ea->valuelen >= size) 109 + if (ea_valuelen(ea) >= size) 110 110 return -EINVAL; 111 - if (hpfs_ea_read(s, a, ano, pos + 4 + ea->namelen + 1, ea->valuelen, buf)) 111 + if (hpfs_ea_read(s, a, ano, pos + 4 + ea->namelen + 1, ea_valuelen(ea), buf)) 112 112 return -EIO; 113 - buf[ea->valuelen] = 0; 113 + buf[ea_valuelen(ea)] = 0; 114 114 return 0; 115 115 } 116 - pos += ea->namelen + ea->valuelen + 5; 116 + pos += ea->namelen + ea_valuelen(ea) + 5; 117 117 } 118 118 return -ENOENT; 119 119 indirect: ··· 138 138 if (!strcmp(ea->name, key)) { 139 139 if (ea->indirect) 140 140 return get_indirect_ea(s, ea->anode, ea_sec(ea), *size = ea_len(ea)); 141 - if (!(ret = kmalloc((*size = ea->valuelen) + 1, GFP_NOFS))) { 141 + if (!(ret = kmalloc((*size = ea_valuelen(ea)) + 1, GFP_NOFS))) { 142 142 printk("HPFS: out of memory for EA\n"); 143 143 return NULL; 144 144 } 145 - memcpy(ret, ea_data(ea), ea->valuelen); 146 - ret[ea->valuelen] = 0; 145 + memcpy(ret, ea_data(ea), ea_valuelen(ea)); 146 + ret[ea_valuelen(ea)] = 0; 147 147 return ret; 148 148 } 149 - a = fnode->ea_secno; 150 - len = fnode->ea_size_l; 149 + a = le32_to_cpu(fnode->ea_secno); 150 + len = le32_to_cpu(fnode->ea_size_l); 151 151 ano = fnode->ea_anode; 152 152 pos = 0; 153 153 while (pos < len) { ··· 164 164 if (!strcmp(ea->name, key)) { 165 165 if (ea->indirect) 166 166 return get_indirect_ea(s, ea->anode, ea_sec(ea), *size = ea_len(ea)); 167 - if (!(ret = kmalloc((*size = ea->valuelen) + 1, GFP_NOFS))) { 167 + if (!(ret = kmalloc((*size = ea_valuelen(ea)) + 1, GFP_NOFS))) { 168 168 printk("HPFS: out of memory for EA\n"); 169 169 return NULL; 170 170 } 171 - if (hpfs_ea_read(s, a, ano, pos + 4 + ea->namelen + 1, ea->valuelen, ret)) { 171 + if (hpfs_ea_read(s, a, ano, pos + 4 + ea->namelen + 1, ea_valuelen(ea), ret)) { 172 172 kfree(ret); 173 173 return NULL; 174 174 } 175 - ret[ea->valuelen] = 0; 175 + ret[ea_valuelen(ea)] = 0; 176 176 return ret; 177 177 } 178 - pos += ea->namelen + ea->valuelen + 5; 178 + pos += ea->namelen + ea_valuelen(ea) + 5; 179 179 } 180 180 return NULL; 181 181 } ··· 202 202 if (ea->indirect) { 203 203 if (ea_len(ea) == size) 204 204 set_indirect_ea(s, ea->anode, ea_sec(ea), data, size); 205 - } else if (ea->valuelen == size) { 205 + } else if (ea_valuelen(ea) == size) { 206 206 memcpy(ea_data(ea), data, size); 207 207 } 208 208 return; 209 209 } 210 - a = fnode->ea_secno; 211 - len = fnode->ea_size_l; 210 + a = le32_to_cpu(fnode->ea_secno); 211 + len = le32_to_cpu(fnode->ea_size_l); 212 212 ano = fnode->ea_anode; 213 213 pos = 0; 214 214 while (pos < len) { ··· 228 228 set_indirect_ea(s, ea->anode, ea_sec(ea), data, size); 229 229 } 230 230 else { 231 - if (ea->valuelen == size) 231 + if (ea_valuelen(ea) == size) 232 232 hpfs_ea_write(s, a, ano, pos + 4 + ea->namelen + 1, size, data); 233 233 } 234 234 return; 235 235 } 236 - pos += ea->namelen + ea->valuelen + 5; 236 + pos += ea->namelen + ea_valuelen(ea) + 5; 237 237 } 238 - if (!fnode->ea_offs) { 239 - /*if (fnode->ea_size_s) { 238 + if (!le16_to_cpu(fnode->ea_offs)) { 239 + /*if (le16_to_cpu(fnode->ea_size_s)) { 240 240 hpfs_error(s, "fnode %08x: ea_size_s == %03x, ea_offs == 0", 241 - inode->i_ino, fnode->ea_size_s); 241 + inode->i_ino, le16_to_cpu(fnode->ea_size_s)); 242 242 return; 243 243 }*/ 244 - fnode->ea_offs = 0xc4; 244 + fnode->ea_offs = cpu_to_le16(0xc4); 245 245 } 246 - if (fnode->ea_offs < 0xc4 || fnode->ea_offs + fnode->acl_size_s + fnode->ea_size_s > 0x200) { 246 + if (le16_to_cpu(fnode->ea_offs) < 0xc4 || le16_to_cpu(fnode->ea_offs) + le16_to_cpu(fnode->acl_size_s) + le16_to_cpu(fnode->ea_size_s) > 0x200) { 247 247 hpfs_error(s, "fnode %08lx: ea_offs == %03x, ea_size_s == %03x", 248 248 (unsigned long)inode->i_ino, 249 - fnode->ea_offs, fnode->ea_size_s); 249 + le32_to_cpu(fnode->ea_offs), le16_to_cpu(fnode->ea_size_s)); 250 250 return; 251 251 } 252 - if ((fnode->ea_size_s || !fnode->ea_size_l) && 253 - fnode->ea_offs + fnode->acl_size_s + fnode->ea_size_s + strlen(key) + size + 5 <= 0x200) { 252 + if ((le16_to_cpu(fnode->ea_size_s) || !le32_to_cpu(fnode->ea_size_l)) && 253 + le16_to_cpu(fnode->ea_offs) + le16_to_cpu(fnode->acl_size_s) + le16_to_cpu(fnode->ea_size_s) + strlen(key) + size + 5 <= 0x200) { 254 254 ea = fnode_end_ea(fnode); 255 255 *(char *)ea = 0; 256 256 ea->namelen = strlen(key); 257 - ea->valuelen = size; 257 + ea->valuelen_lo = size; 258 + ea->valuelen_hi = size >> 8; 258 259 strcpy(ea->name, key); 259 260 memcpy(ea_data(ea), data, size); 260 - fnode->ea_size_s += strlen(key) + size + 5; 261 + fnode->ea_size_s = cpu_to_le16(le16_to_cpu(fnode->ea_size_s) + strlen(key) + size + 5); 261 262 goto ret; 262 263 } 263 264 /* Most the code here is 99.9993422% unused. I hope there are no bugs. 264 265 But what .. HPFS.IFS has also bugs in ea management. */ 265 - if (fnode->ea_size_s && !fnode->ea_size_l) { 266 + if (le16_to_cpu(fnode->ea_size_s) && !le32_to_cpu(fnode->ea_size_l)) { 266 267 secno n; 267 268 struct buffer_head *bh; 268 269 char *data; 269 - if (!(n = hpfs_alloc_sector(s, fno, 1, 0, 1))) return; 270 + if (!(n = hpfs_alloc_sector(s, fno, 1, 0))) return; 270 271 if (!(data = hpfs_get_sector(s, n, &bh))) { 271 272 hpfs_free_sectors(s, n, 1); 272 273 return; 273 274 } 274 - memcpy(data, fnode_ea(fnode), fnode->ea_size_s); 275 - fnode->ea_size_l = fnode->ea_size_s; 276 - fnode->ea_size_s = 0; 277 - fnode->ea_secno = n; 278 - fnode->ea_anode = 0; 275 + memcpy(data, fnode_ea(fnode), le16_to_cpu(fnode->ea_size_s)); 276 + fnode->ea_size_l = cpu_to_le32(le16_to_cpu(fnode->ea_size_s)); 277 + fnode->ea_size_s = cpu_to_le16(0); 278 + fnode->ea_secno = cpu_to_le32(n); 279 + fnode->ea_anode = cpu_to_le32(0); 279 280 mark_buffer_dirty(bh); 280 281 brelse(bh); 281 282 } 282 - pos = fnode->ea_size_l + 5 + strlen(key) + size; 283 - len = (fnode->ea_size_l + 511) >> 9; 283 + pos = le32_to_cpu(fnode->ea_size_l) + 5 + strlen(key) + size; 284 + len = (le32_to_cpu(fnode->ea_size_l) + 511) >> 9; 284 285 if (pos >= 30000) goto bail; 285 286 while (((pos + 511) >> 9) > len) { 286 287 if (!len) { 287 - if (!(fnode->ea_secno = hpfs_alloc_sector(s, fno, 1, 0, 1))) 288 - goto bail; 288 + secno q = hpfs_alloc_sector(s, fno, 1, 0); 289 + if (!q) goto bail; 290 + fnode->ea_secno = cpu_to_le32(q); 289 291 fnode->ea_anode = 0; 290 292 len++; 291 293 } else if (!fnode->ea_anode) { 292 - if (hpfs_alloc_if_possible(s, fnode->ea_secno + len)) { 294 + if (hpfs_alloc_if_possible(s, le32_to_cpu(fnode->ea_secno) + len)) { 293 295 len++; 294 296 } else { 295 297 /* Aargh... don't know how to create ea anodes :-( */ ··· 300 298 anode_secno a_s; 301 299 if (!(anode = hpfs_alloc_anode(s, fno, &a_s, &bh))) 302 300 goto bail; 303 - anode->up = fno; 301 + anode->up = cpu_to_le32(fno); 304 302 anode->btree.fnode_parent = 1; 305 303 anode->btree.n_free_nodes--; 306 304 anode->btree.n_used_nodes++; 307 - anode->btree.first_free += 12; 308 - anode->u.external[0].disk_secno = fnode->ea_secno; 309 - anode->u.external[0].file_secno = 0; 310 - anode->u.external[0].length = len; 305 + anode->btree.first_free = cpu_to_le16(le16_to_cpu(anode->btree.first_free) + 12); 306 + anode->u.external[0].disk_secno = cpu_to_le32(le32_to_cpu(fnode->ea_secno)); 307 + anode->u.external[0].file_secno = cpu_to_le32(0); 308 + anode->u.external[0].length = cpu_to_le32(len); 311 309 mark_buffer_dirty(bh); 312 310 brelse(bh); 313 311 fnode->ea_anode = 1; 314 - fnode->ea_secno = a_s;*/ 312 + fnode->ea_secno = cpu_to_le32(a_s);*/ 315 313 secno new_sec; 316 314 int i; 317 - if (!(new_sec = hpfs_alloc_sector(s, fno, 1, 1 - ((pos + 511) >> 9), 1))) 315 + if (!(new_sec = hpfs_alloc_sector(s, fno, 1, 1 - ((pos + 511) >> 9)))) 318 316 goto bail; 319 317 for (i = 0; i < len; i++) { 320 318 struct buffer_head *bh1, *bh2; 321 319 void *b1, *b2; 322 - if (!(b1 = hpfs_map_sector(s, fnode->ea_secno + i, &bh1, len - i - 1))) { 320 + if (!(b1 = hpfs_map_sector(s, le32_to_cpu(fnode->ea_secno) + i, &bh1, len - i - 1))) { 323 321 hpfs_free_sectors(s, new_sec, (pos + 511) >> 9); 324 322 goto bail; 325 323 } ··· 333 331 mark_buffer_dirty(bh2); 334 332 brelse(bh2); 335 333 } 336 - hpfs_free_sectors(s, fnode->ea_secno, len); 337 - fnode->ea_secno = new_sec; 334 + hpfs_free_sectors(s, le32_to_cpu(fnode->ea_secno), len); 335 + fnode->ea_secno = cpu_to_le32(new_sec); 338 336 len = (pos + 511) >> 9; 339 337 } 340 338 } 341 339 if (fnode->ea_anode) { 342 - if (hpfs_add_sector_to_btree(s, fnode->ea_secno, 340 + if (hpfs_add_sector_to_btree(s, le32_to_cpu(fnode->ea_secno), 343 341 0, len) != -1) { 344 342 len++; 345 343 } else { ··· 351 349 h[1] = strlen(key); 352 350 h[2] = size & 0xff; 353 351 h[3] = size >> 8; 354 - if (hpfs_ea_write(s, fnode->ea_secno, fnode->ea_anode, fnode->ea_size_l, 4, h)) goto bail; 355 - if (hpfs_ea_write(s, fnode->ea_secno, fnode->ea_anode, fnode->ea_size_l + 4, h[1] + 1, key)) goto bail; 356 - if (hpfs_ea_write(s, fnode->ea_secno, fnode->ea_anode, fnode->ea_size_l + 5 + h[1], size, data)) goto bail; 357 - fnode->ea_size_l = pos; 352 + if (hpfs_ea_write(s, le32_to_cpu(fnode->ea_secno), fnode->ea_anode, le32_to_cpu(fnode->ea_size_l), 4, h)) goto bail; 353 + if (hpfs_ea_write(s, le32_to_cpu(fnode->ea_secno), fnode->ea_anode, le32_to_cpu(fnode->ea_size_l) + 4, h[1] + 1, key)) goto bail; 354 + if (hpfs_ea_write(s, le32_to_cpu(fnode->ea_secno), fnode->ea_anode, le32_to_cpu(fnode->ea_size_l) + 5 + h[1], size, data)) goto bail; 355 + fnode->ea_size_l = cpu_to_le32(pos); 358 356 ret: 359 357 hpfs_i(inode)->i_ea_size += 5 + strlen(key) + size; 360 358 return; 361 359 bail: 362 - if (fnode->ea_secno) 363 - if (fnode->ea_anode) hpfs_truncate_btree(s, fnode->ea_secno, 1, (fnode->ea_size_l + 511) >> 9); 364 - else hpfs_free_sectors(s, fnode->ea_secno + ((fnode->ea_size_l + 511) >> 9), len - ((fnode->ea_size_l + 511) >> 9)); 365 - else fnode->ea_secno = fnode->ea_size_l = 0; 360 + if (le32_to_cpu(fnode->ea_secno)) 361 + if (fnode->ea_anode) hpfs_truncate_btree(s, le32_to_cpu(fnode->ea_secno), 1, (le32_to_cpu(fnode->ea_size_l) + 511) >> 9); 362 + else hpfs_free_sectors(s, le32_to_cpu(fnode->ea_secno) + ((le32_to_cpu(fnode->ea_size_l) + 511) >> 9), len - ((le32_to_cpu(fnode->ea_size_l) + 511) >> 9)); 363 + else fnode->ea_secno = fnode->ea_size_l = cpu_to_le32(0); 366 364 } 367 365
+21 -10
fs/hpfs/file.c
··· 20 20 21 21 int hpfs_file_fsync(struct file *file, int datasync) 22 22 { 23 - /*return file_fsync(file, datasync);*/ 24 - return 0; /* Don't fsync :-) */ 23 + struct inode *inode = file->f_mapping->host; 24 + return sync_blockdev(inode->i_sb->s_bdev); 25 25 } 26 26 27 27 /* ··· 48 48 static void hpfs_truncate(struct inode *i) 49 49 { 50 50 if (IS_IMMUTABLE(i)) return /*-EPERM*/; 51 - hpfs_lock(i->i_sb); 51 + hpfs_lock_assert(i->i_sb); 52 + 52 53 hpfs_i(i)->i_n_secs = 0; 53 54 i->i_blocks = 1 + ((i->i_size + 511) >> 9); 54 55 hpfs_i(i)->mmu_private = i->i_size; 55 56 hpfs_truncate_btree(i->i_sb, i->i_ino, 1, ((i->i_size + 511) >> 9)); 56 57 hpfs_write_inode(i); 57 58 hpfs_i(i)->i_n_secs = 0; 58 - hpfs_unlock(i->i_sb); 59 59 } 60 60 61 61 static int hpfs_get_block(struct inode *inode, sector_t iblock, struct buffer_head *bh_result, int create) 62 62 { 63 + int r; 63 64 secno s; 65 + hpfs_lock(inode->i_sb); 64 66 s = hpfs_bmap(inode, iblock); 65 67 if (s) { 66 68 map_bh(bh_result, inode->i_sb, s); 67 - return 0; 69 + goto ret_0; 68 70 } 69 - if (!create) return 0; 71 + if (!create) goto ret_0; 70 72 if (iblock<<9 != hpfs_i(inode)->mmu_private) { 71 73 BUG(); 72 - return -EIO; 74 + r = -EIO; 75 + goto ret_r; 73 76 } 74 77 if ((s = hpfs_add_sector_to_btree(inode->i_sb, inode->i_ino, 1, inode->i_blocks - 1)) == -1) { 75 78 hpfs_truncate_btree(inode->i_sb, inode->i_ino, 1, inode->i_blocks - 1); 76 - return -ENOSPC; 79 + r = -ENOSPC; 80 + goto ret_r; 77 81 } 78 82 inode->i_blocks++; 79 83 hpfs_i(inode)->mmu_private += 512; 80 84 set_buffer_new(bh_result); 81 85 map_bh(bh_result, inode->i_sb, s); 82 - return 0; 86 + ret_0: 87 + r = 0; 88 + ret_r: 89 + hpfs_unlock(inode->i_sb); 90 + return r; 83 91 } 84 92 85 93 static int hpfs_writepage(struct page *page, struct writeback_control *wbc) ··· 138 130 ssize_t retval; 139 131 140 132 retval = do_sync_write(file, buf, count, ppos); 141 - if (retval > 0) 133 + if (retval > 0) { 134 + hpfs_lock(file->f_path.dentry->d_sb); 142 135 hpfs_i(file->f_path.dentry->d_inode)->i_dirty = 1; 136 + hpfs_unlock(file->f_path.dentry->d_sb); 137 + } 143 138 return retval; 144 139 } 145 140
+255 -180
fs/hpfs/hpfs.h
··· 19 19 For definitive information on HPFS, ask somebody else -- this is guesswork. 20 20 There are certain to be many mistakes. */ 21 21 22 + #if !defined(__LITTLE_ENDIAN) && !defined(__BIG_ENDIAN) 23 + #error unknown endian 24 + #endif 25 + 22 26 /* Notation */ 23 27 24 - typedef unsigned secno; /* sector number, partition relative */ 28 + typedef u32 secno; /* sector number, partition relative */ 25 29 26 30 typedef secno dnode_secno; /* sector number of a dnode */ 27 31 typedef secno fnode_secno; /* sector number of an fnode */ ··· 42 38 43 39 struct hpfs_boot_block 44 40 { 45 - unsigned char jmp[3]; 46 - unsigned char oem_id[8]; 47 - unsigned char bytes_per_sector[2]; /* 512 */ 48 - unsigned char sectors_per_cluster; 49 - unsigned char n_reserved_sectors[2]; 50 - unsigned char n_fats; 51 - unsigned char n_rootdir_entries[2]; 52 - unsigned char n_sectors_s[2]; 53 - unsigned char media_byte; 54 - unsigned short sectors_per_fat; 55 - unsigned short sectors_per_track; 56 - unsigned short heads_per_cyl; 57 - unsigned int n_hidden_sectors; 58 - unsigned int n_sectors_l; /* size of partition */ 59 - unsigned char drive_number; 60 - unsigned char mbz; 61 - unsigned char sig_28h; /* 28h */ 62 - unsigned char vol_serno[4]; 63 - unsigned char vol_label[11]; 64 - unsigned char sig_hpfs[8]; /* "HPFS " */ 65 - unsigned char pad[448]; 66 - unsigned short magic; /* aa55 */ 41 + u8 jmp[3]; 42 + u8 oem_id[8]; 43 + u8 bytes_per_sector[2]; /* 512 */ 44 + u8 sectors_per_cluster; 45 + u8 n_reserved_sectors[2]; 46 + u8 n_fats; 47 + u8 n_rootdir_entries[2]; 48 + u8 n_sectors_s[2]; 49 + u8 media_byte; 50 + u16 sectors_per_fat; 51 + u16 sectors_per_track; 52 + u16 heads_per_cyl; 53 + u32 n_hidden_sectors; 54 + u32 n_sectors_l; /* size of partition */ 55 + u8 drive_number; 56 + u8 mbz; 57 + u8 sig_28h; /* 28h */ 58 + u8 vol_serno[4]; 59 + u8 vol_label[11]; 60 + u8 sig_hpfs[8]; /* "HPFS " */ 61 + u8 pad[448]; 62 + u16 magic; /* aa55 */ 67 63 }; 68 64 69 65 ··· 75 71 76 72 struct hpfs_super_block 77 73 { 78 - unsigned magic; /* f995 e849 */ 79 - unsigned magic1; /* fa53 e9c5, more magic? */ 80 - /*unsigned huh202;*/ /* ?? 202 = N. of B. in 1.00390625 S.*/ 81 - char version; /* version of a filesystem usually 2 */ 82 - char funcversion; /* functional version - oldest version 74 + u32 magic; /* f995 e849 */ 75 + u32 magic1; /* fa53 e9c5, more magic? */ 76 + u8 version; /* version of a filesystem usually 2 */ 77 + u8 funcversion; /* functional version - oldest version 83 78 of filesystem that can understand 84 79 this disk */ 85 - unsigned short int zero; /* 0 */ 80 + u16 zero; /* 0 */ 86 81 fnode_secno root; /* fnode of root directory */ 87 82 secno n_sectors; /* size of filesystem */ 88 - unsigned n_badblocks; /* number of bad blocks */ 83 + u32 n_badblocks; /* number of bad blocks */ 89 84 secno bitmaps; /* pointers to free space bit maps */ 90 - unsigned zero1; /* 0 */ 85 + u32 zero1; /* 0 */ 91 86 secno badblocks; /* bad block list */ 92 - unsigned zero3; /* 0 */ 87 + u32 zero3; /* 0 */ 93 88 time32_t last_chkdsk; /* date last checked, 0 if never */ 94 - /*unsigned zero4;*/ /* 0 */ 95 - time32_t last_optimize; /* date last optimized, 0 if never */ 89 + time32_t last_optimize; /* date last optimized, 0 if never */ 96 90 secno n_dir_band; /* number of sectors in dir band */ 97 91 secno dir_band_start; /* first sector in dir band */ 98 92 secno dir_band_end; /* last sector in dir band */ 99 93 secno dir_band_bitmap; /* free space map, 1 dnode per bit */ 100 - char volume_name[32]; /* not used */ 94 + u8 volume_name[32]; /* not used */ 101 95 secno user_id_table; /* 8 preallocated sectors - user id */ 102 - unsigned zero6[103]; /* 0 */ 96 + u32 zero6[103]; /* 0 */ 103 97 }; 104 98 105 99 ··· 109 107 110 108 struct hpfs_spare_block 111 109 { 112 - unsigned magic; /* f991 1849 */ 113 - unsigned magic1; /* fa52 29c5, more magic? */ 110 + u32 magic; /* f991 1849 */ 111 + u32 magic1; /* fa52 29c5, more magic? */ 114 112 115 - unsigned dirty: 1; /* 0 clean, 1 "improperly stopped" */ 116 - /*unsigned flag1234: 4;*/ /* unknown flags */ 117 - unsigned sparedir_used: 1; /* spare dirblks used */ 118 - unsigned hotfixes_used: 1; /* hotfixes used */ 119 - unsigned bad_sector: 1; /* bad sector, corrupted disk (???) */ 120 - unsigned bad_bitmap: 1; /* bad bitmap */ 121 - unsigned fast: 1; /* partition was fast formatted */ 122 - unsigned old_wrote: 1; /* old version wrote to partion */ 123 - unsigned old_wrote_1: 1; /* old version wrote to partion (?) */ 124 - unsigned install_dasd_limits: 1; /* HPFS386 flags */ 125 - unsigned resynch_dasd_limits: 1; 126 - unsigned dasd_limits_operational: 1; 127 - unsigned multimedia_active: 1; 128 - unsigned dce_acls_active: 1; 129 - unsigned dasd_limits_dirty: 1; 130 - unsigned flag67: 2; 131 - unsigned char mm_contlgulty; 132 - unsigned char unused; 113 + #ifdef __LITTLE_ENDIAN 114 + u8 dirty: 1; /* 0 clean, 1 "improperly stopped" */ 115 + u8 sparedir_used: 1; /* spare dirblks used */ 116 + u8 hotfixes_used: 1; /* hotfixes used */ 117 + u8 bad_sector: 1; /* bad sector, corrupted disk (???) */ 118 + u8 bad_bitmap: 1; /* bad bitmap */ 119 + u8 fast: 1; /* partition was fast formatted */ 120 + u8 old_wrote: 1; /* old version wrote to partion */ 121 + u8 old_wrote_1: 1; /* old version wrote to partion (?) */ 122 + #else 123 + u8 old_wrote_1: 1; /* old version wrote to partion (?) */ 124 + u8 old_wrote: 1; /* old version wrote to partion */ 125 + u8 fast: 1; /* partition was fast formatted */ 126 + u8 bad_bitmap: 1; /* bad bitmap */ 127 + u8 bad_sector: 1; /* bad sector, corrupted disk (???) */ 128 + u8 hotfixes_used: 1; /* hotfixes used */ 129 + u8 sparedir_used: 1; /* spare dirblks used */ 130 + u8 dirty: 1; /* 0 clean, 1 "improperly stopped" */ 131 + #endif 132 + 133 + #ifdef __LITTLE_ENDIAN 134 + u8 install_dasd_limits: 1; /* HPFS386 flags */ 135 + u8 resynch_dasd_limits: 1; 136 + u8 dasd_limits_operational: 1; 137 + u8 multimedia_active: 1; 138 + u8 dce_acls_active: 1; 139 + u8 dasd_limits_dirty: 1; 140 + u8 flag67: 2; 141 + #else 142 + u8 flag67: 2; 143 + u8 dasd_limits_dirty: 1; 144 + u8 dce_acls_active: 1; 145 + u8 multimedia_active: 1; 146 + u8 dasd_limits_operational: 1; 147 + u8 resynch_dasd_limits: 1; 148 + u8 install_dasd_limits: 1; /* HPFS386 flags */ 149 + #endif 150 + 151 + u8 mm_contlgulty; 152 + u8 unused; 133 153 134 154 secno hotfix_map; /* info about remapped bad sectors */ 135 - unsigned n_spares_used; /* number of hotfixes */ 136 - unsigned n_spares; /* number of spares in hotfix map */ 137 - unsigned n_dnode_spares_free; /* spare dnodes unused */ 138 - unsigned n_dnode_spares; /* length of spare_dnodes[] list, 155 + u32 n_spares_used; /* number of hotfixes */ 156 + u32 n_spares; /* number of spares in hotfix map */ 157 + u32 n_dnode_spares_free; /* spare dnodes unused */ 158 + u32 n_dnode_spares; /* length of spare_dnodes[] list, 139 159 follows in this block*/ 140 160 secno code_page_dir; /* code page directory block */ 141 - unsigned n_code_pages; /* number of code pages */ 142 - /*unsigned large_numbers[2];*/ /* ?? */ 143 - unsigned super_crc; /* on HPFS386 and LAN Server this is 161 + u32 n_code_pages; /* number of code pages */ 162 + u32 super_crc; /* on HPFS386 and LAN Server this is 144 163 checksum of superblock, on normal 145 164 OS/2 unused */ 146 - unsigned spare_crc; /* on HPFS386 checksum of spareblock */ 147 - unsigned zero1[15]; /* unused */ 165 + u32 spare_crc; /* on HPFS386 checksum of spareblock */ 166 + u32 zero1[15]; /* unused */ 148 167 dnode_secno spare_dnodes[100]; /* emergency free dnode list */ 149 - unsigned zero2[1]; /* room for more? */ 168 + u32 zero2[1]; /* room for more? */ 150 169 }; 151 170 152 171 /* The bad block list is 4 sectors long. The first word must be zero, ··· 202 179 203 180 struct code_page_directory 204 181 { 205 - unsigned magic; /* 4945 21f7 */ 206 - unsigned n_code_pages; /* number of pointers following */ 207 - unsigned zero1[2]; 182 + u32 magic; /* 4945 21f7 */ 183 + u32 n_code_pages; /* number of pointers following */ 184 + u32 zero1[2]; 208 185 struct { 209 - unsigned short ix; /* index */ 210 - unsigned short code_page_number; /* code page number */ 211 - unsigned bounds; /* matches corresponding word 186 + u16 ix; /* index */ 187 + u16 code_page_number; /* code page number */ 188 + u32 bounds; /* matches corresponding word 212 189 in data block */ 213 190 secno code_page_data; /* sector number of a code_page_data 214 191 containing c.p. array */ 215 - unsigned short index; /* index in c.p. array in that sector*/ 216 - unsigned short unknown; /* some unknown value; usually 0; 192 + u16 index; /* index in c.p. array in that sector*/ 193 + u16 unknown; /* some unknown value; usually 0; 217 194 2 in Japanese version */ 218 195 } array[31]; /* unknown length */ 219 196 }; ··· 224 201 225 202 struct code_page_data 226 203 { 227 - unsigned magic; /* 8945 21f7 */ 228 - unsigned n_used; /* # elements used in c_p_data[] */ 229 - unsigned bounds[3]; /* looks a bit like 204 + u32 magic; /* 8945 21f7 */ 205 + u32 n_used; /* # elements used in c_p_data[] */ 206 + u32 bounds[3]; /* looks a bit like 230 207 (beg1,end1), (beg2,end2) 231 208 one byte each */ 232 - unsigned short offs[3]; /* offsets from start of sector 209 + u16 offs[3]; /* offsets from start of sector 233 210 to start of c_p_data[ix] */ 234 211 struct { 235 - unsigned short ix; /* index */ 236 - unsigned short code_page_number; /* code page number */ 237 - unsigned short unknown; /* the same as in cp directory */ 238 - unsigned char map[128]; /* upcase table for chars 80..ff */ 239 - unsigned short zero2; 212 + u16 ix; /* index */ 213 + u16 code_page_number; /* code page number */ 214 + u16 unknown; /* the same as in cp directory */ 215 + u8 map[128]; /* upcase table for chars 80..ff */ 216 + u16 zero2; 240 217 } code_page[3]; 241 - unsigned char incognita[78]; 218 + u8 incognita[78]; 242 219 }; 243 220 244 221 ··· 278 255 #define DNODE_MAGIC 0x77e40aae 279 256 280 257 struct dnode { 281 - unsigned magic; /* 77e4 0aae */ 282 - unsigned first_free; /* offset from start of dnode to 258 + u32 magic; /* 77e4 0aae */ 259 + u32 first_free; /* offset from start of dnode to 283 260 first free dir entry */ 284 - unsigned root_dnode:1; /* Is it root dnode? */ 285 - unsigned increment_me:31; /* some kind of activity counter? 286 - Neither HPFS.IFS nor CHKDSK cares 261 + #ifdef __LITTLE_ENDIAN 262 + u8 root_dnode: 1; /* Is it root dnode? */ 263 + u8 increment_me: 7; /* some kind of activity counter? */ 264 + /* Neither HPFS.IFS nor CHKDSK cares 287 265 if you change this word */ 266 + #else 267 + u8 increment_me: 7; /* some kind of activity counter? */ 268 + /* Neither HPFS.IFS nor CHKDSK cares 269 + if you change this word */ 270 + u8 root_dnode: 1; /* Is it root dnode? */ 271 + #endif 272 + u8 increment_me2[3]; 288 273 secno up; /* (root dnode) directory's fnode 289 274 (nonroot) parent dnode */ 290 275 dnode_secno self; /* pointer to this dnode */ 291 - unsigned char dirent[2028]; /* one or more dirents */ 276 + u8 dirent[2028]; /* one or more dirents */ 292 277 }; 293 278 294 279 struct hpfs_dirent { 295 - unsigned short length; /* offset to next dirent */ 296 - unsigned first: 1; /* set on phony ^A^A (".") entry */ 297 - unsigned has_acl: 1; 298 - unsigned down: 1; /* down pointer present (after name) */ 299 - unsigned last: 1; /* set on phony \377 entry */ 300 - unsigned has_ea: 1; /* entry has EA */ 301 - unsigned has_xtd_perm: 1; /* has extended perm list (???) */ 302 - unsigned has_explicit_acl: 1; 303 - unsigned has_needea: 1; /* ?? some EA has NEEDEA set 280 + u16 length; /* offset to next dirent */ 281 + 282 + #ifdef __LITTLE_ENDIAN 283 + u8 first: 1; /* set on phony ^A^A (".") entry */ 284 + u8 has_acl: 1; 285 + u8 down: 1; /* down pointer present (after name) */ 286 + u8 last: 1; /* set on phony \377 entry */ 287 + u8 has_ea: 1; /* entry has EA */ 288 + u8 has_xtd_perm: 1; /* has extended perm list (???) */ 289 + u8 has_explicit_acl: 1; 290 + u8 has_needea: 1; /* ?? some EA has NEEDEA set 304 291 I have no idea why this is 305 292 interesting in a dir entry */ 306 - unsigned read_only: 1; /* dos attrib */ 307 - unsigned hidden: 1; /* dos attrib */ 308 - unsigned system: 1; /* dos attrib */ 309 - unsigned flag11: 1; /* would be volume label dos attrib */ 310 - unsigned directory: 1; /* dos attrib */ 311 - unsigned archive: 1; /* dos attrib */ 312 - unsigned not_8x3: 1; /* name is not 8.3 */ 313 - unsigned flag15: 1; 293 + #else 294 + u8 has_needea: 1; /* ?? some EA has NEEDEA set 295 + I have no idea why this is 296 + interesting in a dir entry */ 297 + u8 has_explicit_acl: 1; 298 + u8 has_xtd_perm: 1; /* has extended perm list (???) */ 299 + u8 has_ea: 1; /* entry has EA */ 300 + u8 last: 1; /* set on phony \377 entry */ 301 + u8 down: 1; /* down pointer present (after name) */ 302 + u8 has_acl: 1; 303 + u8 first: 1; /* set on phony ^A^A (".") entry */ 304 + #endif 305 + 306 + #ifdef __LITTLE_ENDIAN 307 + u8 read_only: 1; /* dos attrib */ 308 + u8 hidden: 1; /* dos attrib */ 309 + u8 system: 1; /* dos attrib */ 310 + u8 flag11: 1; /* would be volume label dos attrib */ 311 + u8 directory: 1; /* dos attrib */ 312 + u8 archive: 1; /* dos attrib */ 313 + u8 not_8x3: 1; /* name is not 8.3 */ 314 + u8 flag15: 1; 315 + #else 316 + u8 flag15: 1; 317 + u8 not_8x3: 1; /* name is not 8.3 */ 318 + u8 archive: 1; /* dos attrib */ 319 + u8 directory: 1; /* dos attrib */ 320 + u8 flag11: 1; /* would be volume label dos attrib */ 321 + u8 system: 1; /* dos attrib */ 322 + u8 hidden: 1; /* dos attrib */ 323 + u8 read_only: 1; /* dos attrib */ 324 + #endif 325 + 314 326 fnode_secno fnode; /* fnode giving allocation info */ 315 327 time32_t write_date; /* mtime */ 316 - unsigned file_size; /* file length, bytes */ 328 + u32 file_size; /* file length, bytes */ 317 329 time32_t read_date; /* atime */ 318 330 time32_t creation_date; /* ctime */ 319 - unsigned ea_size; /* total EA length, bytes */ 320 - unsigned char no_of_acls : 3; /* number of ACL's */ 321 - unsigned char reserver : 5; 322 - unsigned char ix; /* code page index (of filename), see 331 + u32 ea_size; /* total EA length, bytes */ 332 + u8 no_of_acls; /* number of ACL's (low 3 bits) */ 333 + u8 ix; /* code page index (of filename), see 323 334 struct code_page_data */ 324 - unsigned char namelen, name[1]; /* file name */ 335 + u8 namelen, name[1]; /* file name */ 325 336 /* dnode_secno down; btree down pointer, if present, 326 337 follows name on next word boundary, or maybe it 327 338 precedes next dirent, which is on a word boundary. */ ··· 375 318 376 319 struct bplus_leaf_node 377 320 { 378 - unsigned file_secno; /* first file sector in extent */ 379 - unsigned length; /* length, sectors */ 321 + u32 file_secno; /* first file sector in extent */ 322 + u32 length; /* length, sectors */ 380 323 secno disk_secno; /* first corresponding disk sector */ 381 324 }; 382 325 383 326 struct bplus_internal_node 384 327 { 385 - unsigned file_secno; /* subtree maps sectors < this */ 328 + u32 file_secno; /* subtree maps sectors < this */ 386 329 anode_secno down; /* pointer to subtree */ 387 330 }; 388 331 389 332 struct bplus_header 390 333 { 391 - unsigned hbff: 1; /* high bit of first free entry offset */ 392 - unsigned flag1: 1; 393 - unsigned flag2: 1; 394 - unsigned flag3: 1; 395 - unsigned flag4: 1; 396 - unsigned fnode_parent: 1; /* ? we're pointed to by an fnode, 334 + #ifdef __LITTLE_ENDIAN 335 + u8 hbff: 1; /* high bit of first free entry offset */ 336 + u8 flag1234: 4; 337 + u8 fnode_parent: 1; /* ? we're pointed to by an fnode, 397 338 the data btree or some ea or the 398 339 main ea bootage pointer ea_secno */ 399 340 /* also can get set in fnodes, which 400 341 may be a chkdsk glitch or may mean 401 342 this bit is irrelevant in fnodes, 402 343 or this interpretation is all wet */ 403 - unsigned binary_search: 1; /* suggest binary search (unused) */ 404 - unsigned internal: 1; /* 1 -> (internal) tree of anodes 344 + u8 binary_search: 1; /* suggest binary search (unused) */ 345 + u8 internal: 1; /* 1 -> (internal) tree of anodes 405 346 0 -> (leaf) list of extents */ 406 - unsigned char fill[3]; 407 - unsigned char n_free_nodes; /* free nodes in following array */ 408 - unsigned char n_used_nodes; /* used nodes in following array */ 409 - unsigned short first_free; /* offset from start of header to 347 + #else 348 + u8 internal: 1; /* 1 -> (internal) tree of anodes 349 + 0 -> (leaf) list of extents */ 350 + u8 binary_search: 1; /* suggest binary search (unused) */ 351 + u8 fnode_parent: 1; /* ? we're pointed to by an fnode, 352 + the data btree or some ea or the 353 + main ea bootage pointer ea_secno */ 354 + /* also can get set in fnodes, which 355 + may be a chkdsk glitch or may mean 356 + this bit is irrelevant in fnodes, 357 + or this interpretation is all wet */ 358 + u8 flag1234: 4; 359 + u8 hbff: 1; /* high bit of first free entry offset */ 360 + #endif 361 + u8 fill[3]; 362 + u8 n_free_nodes; /* free nodes in following array */ 363 + u8 n_used_nodes; /* used nodes in following array */ 364 + u16 first_free; /* offset from start of header to 410 365 first free node in array */ 411 366 union { 412 367 struct bplus_internal_node internal[0]; /* (internal) 2-word entries giving ··· 438 369 439 370 struct fnode 440 371 { 441 - unsigned magic; /* f7e4 0aae */ 442 - unsigned zero1[2]; /* read history */ 443 - unsigned char len, name[15]; /* true length, truncated name */ 372 + u32 magic; /* f7e4 0aae */ 373 + u32 zero1[2]; /* read history */ 374 + u8 len, name[15]; /* true length, truncated name */ 444 375 fnode_secno up; /* pointer to file's directory fnode */ 445 - /*unsigned zero2[3];*/ 446 376 secno acl_size_l; 447 377 secno acl_secno; 448 - unsigned short acl_size_s; 449 - char acl_anode; 450 - char zero2; /* history bit count */ 451 - unsigned ea_size_l; /* length of disk-resident ea's */ 378 + u16 acl_size_s; 379 + u8 acl_anode; 380 + u8 zero2; /* history bit count */ 381 + u32 ea_size_l; /* length of disk-resident ea's */ 452 382 secno ea_secno; /* first sector of disk-resident ea's*/ 453 - unsigned short ea_size_s; /* length of fnode-resident ea's */ 383 + u16 ea_size_s; /* length of fnode-resident ea's */ 454 384 455 - unsigned flag0: 1; 456 - unsigned ea_anode: 1; /* 1 -> ea_secno is an anode */ 457 - unsigned flag2: 1; 458 - unsigned flag3: 1; 459 - unsigned flag4: 1; 460 - unsigned flag5: 1; 461 - unsigned flag6: 1; 462 - unsigned flag7: 1; 463 - unsigned dirflag: 1; /* 1 -> directory. first & only extent 385 + #ifdef __LITTLE_ENDIAN 386 + u8 flag0: 1; 387 + u8 ea_anode: 1; /* 1 -> ea_secno is an anode */ 388 + u8 flag234567: 6; 389 + #else 390 + u8 flag234567: 6; 391 + u8 ea_anode: 1; /* 1 -> ea_secno is an anode */ 392 + u8 flag0: 1; 393 + #endif 394 + 395 + #ifdef __LITTLE_ENDIAN 396 + u8 dirflag: 1; /* 1 -> directory. first & only extent 464 397 points to dnode. */ 465 - unsigned flag9: 1; 466 - unsigned flag10: 1; 467 - unsigned flag11: 1; 468 - unsigned flag12: 1; 469 - unsigned flag13: 1; 470 - unsigned flag14: 1; 471 - unsigned flag15: 1; 398 + u8 flag9012345: 7; 399 + #else 400 + u8 flag9012345: 7; 401 + u8 dirflag: 1; /* 1 -> directory. first & only extent 402 + points to dnode. */ 403 + #endif 472 404 473 405 struct bplus_header btree; /* b+ tree, 8 extents or 12 subtrees */ 474 406 union { ··· 477 407 struct bplus_internal_node internal[12]; 478 408 } u; 479 409 480 - unsigned file_size; /* file length, bytes */ 481 - unsigned n_needea; /* number of EA's with NEEDEA set */ 482 - char user_id[16]; /* unused */ 483 - unsigned short ea_offs; /* offset from start of fnode 410 + u32 file_size; /* file length, bytes */ 411 + u32 n_needea; /* number of EA's with NEEDEA set */ 412 + u8 user_id[16]; /* unused */ 413 + u16 ea_offs; /* offset from start of fnode 484 414 to first fnode-resident ea */ 485 - char dasd_limit_treshhold; 486 - char dasd_limit_delta; 487 - unsigned dasd_limit; 488 - unsigned dasd_usage; 489 - /*unsigned zero5[2];*/ 490 - unsigned char ea[316]; /* zero or more EA's, packed together 415 + u8 dasd_limit_treshhold; 416 + u8 dasd_limit_delta; 417 + u32 dasd_limit; 418 + u32 dasd_usage; 419 + u8 ea[316]; /* zero or more EA's, packed together 491 420 with no alignment padding. 492 421 (Do not use this name, get here 493 422 via fnode + ea_offs. I think.) */ ··· 499 430 500 431 struct anode 501 432 { 502 - unsigned magic; /* 37e4 0aae */ 433 + u32 magic; /* 37e4 0aae */ 503 434 anode_secno self; /* pointer to this anode */ 504 435 secno up; /* parent anode or fnode */ 505 436 ··· 509 440 struct bplus_internal_node internal[60]; 510 441 } u; 511 442 512 - unsigned fill[3]; /* unused */ 443 + u32 fill[3]; /* unused */ 513 444 }; 514 445 515 446 ··· 530 461 531 462 struct extended_attribute 532 463 { 533 - unsigned indirect: 1; /* 1 -> value gives sector number 464 + #ifdef __LITTLE_ENDIAN 465 + u8 indirect: 1; /* 1 -> value gives sector number 534 466 where real value starts */ 535 - unsigned anode: 1; /* 1 -> sector is an anode 467 + u8 anode: 1; /* 1 -> sector is an anode 536 468 that points to fragmented value */ 537 - unsigned flag2: 1; 538 - unsigned flag3: 1; 539 - unsigned flag4: 1; 540 - unsigned flag5: 1; 541 - unsigned flag6: 1; 542 - unsigned needea: 1; /* required ea */ 543 - unsigned char namelen; /* length of name, bytes */ 544 - unsigned short valuelen; /* length of value, bytes */ 545 - unsigned char name[0]; 469 + u8 flag23456: 5; 470 + u8 needea: 1; /* required ea */ 471 + #else 472 + u8 needea: 1; /* required ea */ 473 + u8 flag23456: 5; 474 + u8 anode: 1; /* 1 -> sector is an anode 475 + that points to fragmented value */ 476 + u8 indirect: 1; /* 1 -> value gives sector number 477 + where real value starts */ 478 + #endif 479 + u8 namelen; /* length of name, bytes */ 480 + u8 valuelen_lo; /* length of value, bytes */ 481 + u8 valuelen_hi; /* length of value, bytes */ 482 + u8 name[0]; 546 483 /* 547 - unsigned char name[namelen]; ascii attrib name 548 - unsigned char nul; terminating '\0', not counted 549 - unsigned char value[valuelen]; value, arbitrary 484 + u8 name[namelen]; ascii attrib name 485 + u8 nul; terminating '\0', not counted 486 + u8 value[valuelen]; value, arbitrary 550 487 if this.indirect, valuelen is 8 and the value is 551 - unsigned length; real length of value, bytes 488 + u32 length; real length of value, bytes 552 489 secno secno; sector address where it starts 553 490 if this.anode, the above sector number is the root of an anode tree 554 491 which points to the value.
+37 -43
fs/hpfs/hpfs_fn.h
··· 13 13 #include <linux/pagemap.h> 14 14 #include <linux/buffer_head.h> 15 15 #include <linux/slab.h> 16 + #include <asm/unaligned.h> 16 17 17 18 #include "hpfs.h" 18 19 ··· 52 51 unsigned i_disk_sec; /* (files) minimalist cache of alloc info */ 53 52 unsigned i_n_secs; /* (files) minimalist cache of alloc info */ 54 53 unsigned i_ea_size; /* size of extended attributes */ 55 - unsigned i_conv : 2; /* (files) crlf->newline hackery */ 56 54 unsigned i_ea_mode : 1; /* file's permission is stored in ea */ 57 55 unsigned i_ea_uid : 1; /* file's uid is stored in ea */ 58 56 unsigned i_ea_gid : 1; /* file's gid is stored in ea */ 59 57 unsigned i_dirty : 1; 60 - struct mutex i_mutex; 61 - struct mutex i_parent_mutex; 62 58 loff_t **i_rddir_off; 63 59 struct inode vfs_inode; 64 60 }; 65 61 66 62 struct hpfs_sb_info { 63 + struct mutex hpfs_mutex; /* global hpfs lock */ 67 64 ino_t sb_root; /* inode number of root dir */ 68 65 unsigned sb_fs_size; /* file system size, sectors */ 69 66 unsigned sb_bitmaps; /* sector number of bitmap list */ ··· 73 74 uid_t sb_uid; /* uid from mount options */ 74 75 gid_t sb_gid; /* gid from mount options */ 75 76 umode_t sb_mode; /* mode from mount options */ 76 - unsigned sb_conv : 2; /* crlf->newline hackery */ 77 77 unsigned sb_eas : 2; /* eas: 0-ignore, 1-ro, 2-rw */ 78 78 unsigned sb_err : 2; /* on errs: 0-cont, 1-ro, 2-panic */ 79 79 unsigned sb_chk : 2; /* checks: 0-no, 1-normal, 2-strict */ ··· 85 87 unsigned *sb_bmp_dir; /* main bitmap directory */ 86 88 unsigned sb_c_bitmap; /* current bitmap */ 87 89 unsigned sb_max_fwd_alloc; /* max forwad allocation */ 88 - struct mutex hpfs_creation_de; /* when creating dirents, nobody else 89 - can alloc blocks */ 90 - /*unsigned sb_mounting : 1;*/ 91 90 int sb_timeshift; 92 91 }; 93 - 94 - /* 95 - * conv= options 96 - */ 97 - 98 - #define CONV_BINARY 0 /* no conversion */ 99 - #define CONV_TEXT 1 /* crlf->newline */ 100 - #define CONV_AUTO 2 /* decide based on file contents */ 101 92 102 93 /* Four 512-byte buffers and the 2k block obtained by concatenating them */ 103 94 ··· 100 113 static inline dnode_secno de_down_pointer (struct hpfs_dirent *de) 101 114 { 102 115 CHKCOND(de->down,("HPFS: de_down_pointer: !de->down\n")); 103 - return *(dnode_secno *) ((void *) de + de->length - 4); 116 + return le32_to_cpu(*(dnode_secno *) ((void *) de + le16_to_cpu(de->length) - 4)); 104 117 } 105 118 106 119 /* The first dir entry in a dnode */ ··· 114 127 115 128 static inline struct hpfs_dirent *dnode_end_de (struct dnode *dnode) 116 129 { 117 - CHKCOND(dnode->first_free>=0x14 && dnode->first_free<=0xa00,("HPFS: dnode_end_de: dnode->first_free = %d\n",(int)dnode->first_free)); 118 - return (void *) dnode + dnode->first_free; 130 + CHKCOND(le32_to_cpu(dnode->first_free)>=0x14 && le32_to_cpu(dnode->first_free)<=0xa00,("HPFS: dnode_end_de: dnode->first_free = %x\n",(unsigned)le32_to_cpu(dnode->first_free))); 131 + return (void *) dnode + le32_to_cpu(dnode->first_free); 119 132 } 120 133 121 134 /* The dir entry after dir entry de */ 122 135 123 136 static inline struct hpfs_dirent *de_next_de (struct hpfs_dirent *de) 124 137 { 125 - CHKCOND(de->length>=0x20 && de->length<0x800,("HPFS: de_next_de: de->length = %d\n",(int)de->length)); 126 - return (void *) de + de->length; 138 + CHKCOND(le16_to_cpu(de->length)>=0x20 && le16_to_cpu(de->length)<0x800,("HPFS: de_next_de: de->length = %x\n",(unsigned)le16_to_cpu(de->length))); 139 + return (void *) de + le16_to_cpu(de->length); 127 140 } 128 141 129 142 static inline struct extended_attribute *fnode_ea(struct fnode *fnode) 130 143 { 131 - return (struct extended_attribute *)((char *)fnode + fnode->ea_offs + fnode->acl_size_s); 144 + return (struct extended_attribute *)((char *)fnode + le16_to_cpu(fnode->ea_offs) + le16_to_cpu(fnode->acl_size_s)); 132 145 } 133 146 134 147 static inline struct extended_attribute *fnode_end_ea(struct fnode *fnode) 135 148 { 136 - return (struct extended_attribute *)((char *)fnode + fnode->ea_offs + fnode->acl_size_s + fnode->ea_size_s); 149 + return (struct extended_attribute *)((char *)fnode + le16_to_cpu(fnode->ea_offs) + le16_to_cpu(fnode->acl_size_s) + le16_to_cpu(fnode->ea_size_s)); 150 + } 151 + 152 + static unsigned ea_valuelen(struct extended_attribute *ea) 153 + { 154 + return ea->valuelen_lo + 256 * ea->valuelen_hi; 137 155 } 138 156 139 157 static inline struct extended_attribute *next_ea(struct extended_attribute *ea) 140 158 { 141 - return (struct extended_attribute *)((char *)ea + 5 + ea->namelen + ea->valuelen); 159 + return (struct extended_attribute *)((char *)ea + 5 + ea->namelen + ea_valuelen(ea)); 142 160 } 143 161 144 162 static inline secno ea_sec(struct extended_attribute *ea) 145 163 { 146 - return *(secno *)((char *)ea + 9 + ea->namelen); 164 + return le32_to_cpu(get_unaligned((secno *)((char *)ea + 9 + ea->namelen))); 147 165 } 148 166 149 167 static inline secno ea_len(struct extended_attribute *ea) 150 168 { 151 - return *(secno *)((char *)ea + 5 + ea->namelen); 169 + return le32_to_cpu(get_unaligned((secno *)((char *)ea + 5 + ea->namelen))); 152 170 } 153 171 154 172 static inline char *ea_data(struct extended_attribute *ea) ··· 178 186 dst->not_8x3 = n; 179 187 } 180 188 181 - static inline unsigned tstbits(unsigned *bmp, unsigned b, unsigned n) 189 + static inline unsigned tstbits(u32 *bmp, unsigned b, unsigned n) 182 190 { 183 191 int i; 184 192 if ((b >= 0x4000) || (b + n - 1 >= 0x4000)) return n; 185 - if (!((bmp[(b & 0x3fff) >> 5] >> (b & 0x1f)) & 1)) return 1; 193 + if (!((le32_to_cpu(bmp[(b & 0x3fff) >> 5]) >> (b & 0x1f)) & 1)) return 1; 186 194 for (i = 1; i < n; i++) 187 - if (/*b+i < 0x4000 &&*/ !((bmp[((b+i) & 0x3fff) >> 5] >> ((b+i) & 0x1f)) & 1)) 195 + if (!((le32_to_cpu(bmp[((b+i) & 0x3fff) >> 5]) >> ((b+i) & 0x1f)) & 1)) 188 196 return i + 1; 189 197 return 0; 190 198 } ··· 192 200 /* alloc.c */ 193 201 194 202 int hpfs_chk_sectors(struct super_block *, secno, int, char *); 195 - secno hpfs_alloc_sector(struct super_block *, secno, unsigned, int, int); 203 + secno hpfs_alloc_sector(struct super_block *, secno, unsigned, int); 196 204 int hpfs_alloc_if_possible(struct super_block *, secno); 197 205 void hpfs_free_sectors(struct super_block *, secno, unsigned); 198 206 int hpfs_check_free_dnodes(struct super_block *, int); 199 207 void hpfs_free_dnode(struct super_block *, secno); 200 - struct dnode *hpfs_alloc_dnode(struct super_block *, secno, dnode_secno *, struct quad_buffer_head *, int); 208 + struct dnode *hpfs_alloc_dnode(struct super_block *, secno, dnode_secno *, struct quad_buffer_head *); 201 209 struct fnode *hpfs_alloc_fnode(struct super_block *, secno, fnode_secno *, struct buffer_head **); 202 210 struct anode *hpfs_alloc_anode(struct super_block *, secno, anode_secno *, struct buffer_head **); 203 211 ··· 214 222 215 223 /* buffer.c */ 216 224 217 - void hpfs_lock_creation(struct super_block *); 218 - void hpfs_unlock_creation(struct super_block *); 219 225 void *hpfs_map_sector(struct super_block *, unsigned, struct buffer_head **, int); 220 226 void *hpfs_get_sector(struct super_block *, unsigned, struct buffer_head **); 221 227 void *hpfs_map_4sectors(struct super_block *, unsigned, struct quad_buffer_head *, int); ··· 237 247 struct hpfs_dirent *hpfs_add_de(struct super_block *, struct dnode *, 238 248 const unsigned char *, unsigned, secno); 239 249 int hpfs_add_dirent(struct inode *, const unsigned char *, unsigned, 240 - struct hpfs_dirent *, int); 250 + struct hpfs_dirent *); 241 251 int hpfs_remove_dirent(struct inode *, dnode_secno, struct hpfs_dirent *, struct quad_buffer_head *, int); 242 252 void hpfs_count_dnodes(struct super_block *, dnode_secno, int *, int *, int *); 243 253 dnode_secno hpfs_de_as_down_as_possible(struct super_block *, dnode_secno dno); ··· 293 303 const unsigned char *, unsigned, int); 294 304 int hpfs_is_name_long(const unsigned char *, unsigned); 295 305 void hpfs_adjust_length(const unsigned char *, unsigned *); 296 - void hpfs_decide_conv(struct inode *, const unsigned char *, unsigned); 297 306 298 307 /* namei.c */ 299 308 ··· 335 346 /* 336 347 * Locking: 337 348 * 338 - * hpfs_lock() is a leftover from the big kernel lock. 339 - * Right now, these functions are empty and only left 340 - * for documentation purposes. The file system no longer 341 - * works on SMP systems, so the lock is not needed 342 - * any more. 349 + * hpfs_lock() locks the whole filesystem. It must be taken 350 + * on any method called by the VFS. 343 351 * 344 - * If someone is interested in making it work again, this 345 - * would be the place to start by adding a per-superblock 346 - * mutex and fixing all the bugs and performance issues 347 - * caused by that. 352 + * We don't do any per-file locking anymore, it is hard to 353 + * review and HPFS is not performance-sensitive anyway. 348 354 */ 349 355 static inline void hpfs_lock(struct super_block *s) 350 356 { 357 + struct hpfs_sb_info *sbi = hpfs_sb(s); 358 + mutex_lock(&sbi->hpfs_mutex); 351 359 } 352 360 353 361 static inline void hpfs_unlock(struct super_block *s) 354 362 { 363 + struct hpfs_sb_info *sbi = hpfs_sb(s); 364 + mutex_unlock(&sbi->hpfs_mutex); 365 + } 366 + 367 + static inline void hpfs_lock_assert(struct super_block *s) 368 + { 369 + struct hpfs_sb_info *sbi = hpfs_sb(s); 370 + WARN_ON(!mutex_is_locked(&sbi->hpfs_mutex)); 355 371 }
+21 -26
fs/hpfs/inode.c
··· 17 17 i->i_uid = hpfs_sb(sb)->sb_uid; 18 18 i->i_gid = hpfs_sb(sb)->sb_gid; 19 19 i->i_mode = hpfs_sb(sb)->sb_mode; 20 - hpfs_inode->i_conv = hpfs_sb(sb)->sb_conv; 21 20 i->i_size = -1; 22 21 i->i_blocks = -1; 23 22 ··· 115 116 i->i_mode |= S_IFDIR; 116 117 i->i_op = &hpfs_dir_iops; 117 118 i->i_fop = &hpfs_dir_ops; 118 - hpfs_inode->i_parent_dir = fnode->up; 119 - hpfs_inode->i_dno = fnode->u.external[0].disk_secno; 119 + hpfs_inode->i_parent_dir = le32_to_cpu(fnode->up); 120 + hpfs_inode->i_dno = le32_to_cpu(fnode->u.external[0].disk_secno); 120 121 if (hpfs_sb(sb)->sb_chk >= 2) { 121 122 struct buffer_head *bh0; 122 123 if (hpfs_map_fnode(sb, hpfs_inode->i_parent_dir, &bh0)) brelse(bh0); ··· 132 133 i->i_op = &hpfs_file_iops; 133 134 i->i_fop = &hpfs_file_ops; 134 135 i->i_nlink = 1; 135 - i->i_size = fnode->file_size; 136 + i->i_size = le32_to_cpu(fnode->file_size); 136 137 i->i_blocks = ((i->i_size + 511) >> 9) + 1; 137 138 i->i_data.a_ops = &hpfs_aops; 138 139 hpfs_i(i)->mmu_private = i->i_size; ··· 143 144 static void hpfs_write_inode_ea(struct inode *i, struct fnode *fnode) 144 145 { 145 146 struct hpfs_inode_info *hpfs_inode = hpfs_i(i); 146 - /*if (fnode->acl_size_l || fnode->acl_size_s) { 147 + /*if (le32_to_cpu(fnode->acl_size_l) || le16_to_cpu(fnode->acl_size_s)) { 147 148 Some unknown structures like ACL may be in fnode, 148 149 we'd better not overwrite them 149 150 hpfs_error(i->i_sb, "fnode %08x has some unknown HPFS386 stuctures", i->i_ino); ··· 186 187 kfree(hpfs_inode->i_rddir_off); 187 188 hpfs_inode->i_rddir_off = NULL; 188 189 } 189 - mutex_lock(&hpfs_inode->i_parent_mutex); 190 190 if (!i->i_nlink) { 191 - mutex_unlock(&hpfs_inode->i_parent_mutex); 192 191 return; 193 192 } 194 193 parent = iget_locked(i->i_sb, hpfs_inode->i_parent_dir); ··· 197 200 hpfs_read_inode(parent); 198 201 unlock_new_inode(parent); 199 202 } 200 - mutex_lock(&hpfs_inode->i_mutex); 201 203 hpfs_write_inode_nolock(i); 202 - mutex_unlock(&hpfs_inode->i_mutex); 203 204 iput(parent); 204 - } else { 205 - mark_inode_dirty(i); 206 205 } 207 - mutex_unlock(&hpfs_inode->i_parent_mutex); 208 206 } 209 207 210 208 void hpfs_write_inode_nolock(struct inode *i) ··· 218 226 } 219 227 } else de = NULL; 220 228 if (S_ISREG(i->i_mode)) { 221 - fnode->file_size = i->i_size; 222 - if (de) de->file_size = i->i_size; 229 + fnode->file_size = cpu_to_le32(i->i_size); 230 + if (de) de->file_size = cpu_to_le32(i->i_size); 223 231 } else if (S_ISDIR(i->i_mode)) { 224 - fnode->file_size = 0; 225 - if (de) de->file_size = 0; 232 + fnode->file_size = cpu_to_le32(0); 233 + if (de) de->file_size = cpu_to_le32(0); 226 234 } 227 235 hpfs_write_inode_ea(i, fnode); 228 236 if (de) { 229 - de->write_date = gmt_to_local(i->i_sb, i->i_mtime.tv_sec); 230 - de->read_date = gmt_to_local(i->i_sb, i->i_atime.tv_sec); 231 - de->creation_date = gmt_to_local(i->i_sb, i->i_ctime.tv_sec); 237 + de->write_date = cpu_to_le32(gmt_to_local(i->i_sb, i->i_mtime.tv_sec)); 238 + de->read_date = cpu_to_le32(gmt_to_local(i->i_sb, i->i_atime.tv_sec)); 239 + de->creation_date = cpu_to_le32(gmt_to_local(i->i_sb, i->i_ctime.tv_sec)); 232 240 de->read_only = !(i->i_mode & 0222); 233 - de->ea_size = hpfs_inode->i_ea_size; 241 + de->ea_size = cpu_to_le32(hpfs_inode->i_ea_size); 234 242 hpfs_mark_4buffers_dirty(&qbh); 235 243 hpfs_brelse4(&qbh); 236 244 } 237 245 if (S_ISDIR(i->i_mode)) { 238 246 if ((de = map_dirent(i, hpfs_inode->i_dno, "\001\001", 2, NULL, &qbh))) { 239 - de->write_date = gmt_to_local(i->i_sb, i->i_mtime.tv_sec); 240 - de->read_date = gmt_to_local(i->i_sb, i->i_atime.tv_sec); 241 - de->creation_date = gmt_to_local(i->i_sb, i->i_ctime.tv_sec); 247 + de->write_date = cpu_to_le32(gmt_to_local(i->i_sb, i->i_mtime.tv_sec)); 248 + de->read_date = cpu_to_le32(gmt_to_local(i->i_sb, i->i_atime.tv_sec)); 249 + de->creation_date = cpu_to_le32(gmt_to_local(i->i_sb, i->i_ctime.tv_sec)); 242 250 de->read_only = !(i->i_mode & 0222); 243 - de->ea_size = /*hpfs_inode->i_ea_size*/0; 244 - de->file_size = 0; 251 + de->ea_size = cpu_to_le32(/*hpfs_inode->i_ea_size*/0); 252 + de->file_size = cpu_to_le32(0); 245 253 hpfs_mark_4buffers_dirty(&qbh); 246 254 hpfs_brelse4(&qbh); 247 255 } else ··· 261 269 hpfs_lock(inode->i_sb); 262 270 if (inode->i_ino == hpfs_sb(inode->i_sb)->sb_root) 263 271 goto out_unlock; 272 + if ((attr->ia_valid & ATTR_UID) && attr->ia_uid >= 0x10000) 273 + goto out_unlock; 274 + if ((attr->ia_valid & ATTR_GID) && attr->ia_gid >= 0x10000) 275 + goto out_unlock; 264 276 if ((attr->ia_valid & ATTR_SIZE) && attr->ia_size > inode->i_size) 265 277 goto out_unlock; 266 278 ··· 280 284 } 281 285 282 286 setattr_copy(inode, attr); 283 - mark_inode_dirty(inode); 284 287 285 288 hpfs_write_inode(inode); 286 289
+30 -26
fs/hpfs/map.c
··· 21 21 hpfs_error(s, "hpfs_map_bitmap called with bad parameter: %08x at %s", bmp_block, id); 22 22 return NULL; 23 23 } 24 - sec = hpfs_sb(s)->sb_bmp_dir[bmp_block]; 24 + sec = le32_to_cpu(hpfs_sb(s)->sb_bmp_dir[bmp_block]); 25 25 if (!sec || sec > hpfs_sb(s)->sb_fs_size-4) { 26 26 hpfs_error(s, "invalid bitmap block pointer %08x -> %08x at %s", bmp_block, sec, id); 27 27 return NULL; ··· 46 46 struct code_page_data *cpd; 47 47 struct code_page_directory *cp = hpfs_map_sector(s, cps, &bh, 0); 48 48 if (!cp) return NULL; 49 - if (cp->magic != CP_DIR_MAGIC) { 50 - printk("HPFS: Code page directory magic doesn't match (magic = %08x)\n", cp->magic); 49 + if (le32_to_cpu(cp->magic) != CP_DIR_MAGIC) { 50 + printk("HPFS: Code page directory magic doesn't match (magic = %08x)\n", le32_to_cpu(cp->magic)); 51 51 brelse(bh); 52 52 return NULL; 53 53 } 54 - if (!cp->n_code_pages) { 54 + if (!le32_to_cpu(cp->n_code_pages)) { 55 55 printk("HPFS: n_code_pages == 0\n"); 56 56 brelse(bh); 57 57 return NULL; 58 58 } 59 - cpds = cp->array[0].code_page_data; 60 - cpi = cp->array[0].index; 59 + cpds = le32_to_cpu(cp->array[0].code_page_data); 60 + cpi = le16_to_cpu(cp->array[0].index); 61 61 brelse(bh); 62 62 63 63 if (cpi >= 3) { ··· 66 66 } 67 67 68 68 if (!(cpd = hpfs_map_sector(s, cpds, &bh, 0))) return NULL; 69 - if ((unsigned)cpd->offs[cpi] > 0x178) { 69 + if (le16_to_cpu(cpd->offs[cpi]) > 0x178) { 70 70 printk("HPFS: Code page index out of sector\n"); 71 71 brelse(bh); 72 72 return NULL; 73 73 } 74 - ptr = (unsigned char *)cpd + cpd->offs[cpi] + 6; 74 + ptr = (unsigned char *)cpd + le16_to_cpu(cpd->offs[cpi]) + 6; 75 75 if (!(cp_table = kmalloc(256, GFP_KERNEL))) { 76 76 printk("HPFS: out of memory for code page table\n"); 77 77 brelse(bh); ··· 125 125 if (hpfs_sb(s)->sb_chk) { 126 126 struct extended_attribute *ea; 127 127 struct extended_attribute *ea_end; 128 - if (fnode->magic != FNODE_MAGIC) { 128 + if (le32_to_cpu(fnode->magic) != FNODE_MAGIC) { 129 129 hpfs_error(s, "bad magic on fnode %08lx", 130 130 (unsigned long)ino); 131 131 goto bail; ··· 138 138 (unsigned long)ino); 139 139 goto bail; 140 140 } 141 - if (fnode->btree.first_free != 141 + if (le16_to_cpu(fnode->btree.first_free) != 142 142 8 + fnode->btree.n_used_nodes * (fnode->btree.internal ? 8 : 12)) { 143 143 hpfs_error(s, 144 144 "bad first_free pointer in fnode %08lx", ··· 146 146 goto bail; 147 147 } 148 148 } 149 - if (fnode->ea_size_s && ((signed int)fnode->ea_offs < 0xc4 || 150 - (signed int)fnode->ea_offs + fnode->acl_size_s + fnode->ea_size_s > 0x200)) { 149 + if (le16_to_cpu(fnode->ea_size_s) && (le16_to_cpu(fnode->ea_offs) < 0xc4 || 150 + le16_to_cpu(fnode->ea_offs) + le16_to_cpu(fnode->acl_size_s) + le16_to_cpu(fnode->ea_size_s) > 0x200)) { 151 151 hpfs_error(s, 152 152 "bad EA info in fnode %08lx: ea_offs == %04x ea_size_s == %04x", 153 153 (unsigned long)ino, 154 - fnode->ea_offs, fnode->ea_size_s); 154 + le16_to_cpu(fnode->ea_offs), le16_to_cpu(fnode->ea_size_s)); 155 155 goto bail; 156 156 } 157 157 ea = fnode_ea(fnode); ··· 178 178 if (hpfs_sb(s)->sb_chk) if (hpfs_chk_sectors(s, ano, 1, "anode")) return NULL; 179 179 if ((anode = hpfs_map_sector(s, ano, bhp, ANODE_RD_AHEAD))) 180 180 if (hpfs_sb(s)->sb_chk) { 181 - if (anode->magic != ANODE_MAGIC || anode->self != ano) { 181 + if (le32_to_cpu(anode->magic) != ANODE_MAGIC) { 182 182 hpfs_error(s, "bad magic on anode %08x", ano); 183 + goto bail; 184 + } 185 + if (le32_to_cpu(anode->self) != ano) { 186 + hpfs_error(s, "self pointer invalid on anode %08x", ano); 183 187 goto bail; 184 188 } 185 189 if ((unsigned)anode->btree.n_used_nodes + (unsigned)anode->btree.n_free_nodes != ··· 191 187 hpfs_error(s, "bad number of nodes in anode %08x", ano); 192 188 goto bail; 193 189 } 194 - if (anode->btree.first_free != 190 + if (le16_to_cpu(anode->btree.first_free) != 195 191 8 + anode->btree.n_used_nodes * (anode->btree.internal ? 8 : 12)) { 196 192 hpfs_error(s, "bad first_free pointer in anode %08x", ano); 197 193 goto bail; ··· 223 219 unsigned p, pp = 0; 224 220 unsigned char *d = (unsigned char *)dnode; 225 221 int b = 0; 226 - if (dnode->magic != DNODE_MAGIC) { 222 + if (le32_to_cpu(dnode->magic) != DNODE_MAGIC) { 227 223 hpfs_error(s, "bad magic on dnode %08x", secno); 228 224 goto bail; 229 225 } 230 - if (dnode->self != secno) 231 - hpfs_error(s, "bad self pointer on dnode %08x self = %08x", secno, dnode->self); 226 + if (le32_to_cpu(dnode->self) != secno) 227 + hpfs_error(s, "bad self pointer on dnode %08x self = %08x", secno, le32_to_cpu(dnode->self)); 232 228 /* Check dirents - bad dirents would cause infinite 233 229 loops or shooting to memory */ 234 - if (dnode->first_free > 2048/* || dnode->first_free < 84*/) { 235 - hpfs_error(s, "dnode %08x has first_free == %08x", secno, dnode->first_free); 230 + if (le32_to_cpu(dnode->first_free) > 2048) { 231 + hpfs_error(s, "dnode %08x has first_free == %08x", secno, le32_to_cpu(dnode->first_free)); 236 232 goto bail; 237 233 } 238 - for (p = 20; p < dnode->first_free; p += d[p] + (d[p+1] << 8)) { 234 + for (p = 20; p < le32_to_cpu(dnode->first_free); p += d[p] + (d[p+1] << 8)) { 239 235 struct hpfs_dirent *de = (struct hpfs_dirent *)((char *)dnode + p); 240 - if (de->length > 292 || (de->length < 32) || (de->length & 3) || p + de->length > 2048) { 236 + if (le16_to_cpu(de->length) > 292 || (le16_to_cpu(de->length) < 32) || (le16_to_cpu(de->length) & 3) || p + le16_to_cpu(de->length) > 2048) { 241 237 hpfs_error(s, "bad dirent size in dnode %08x, dirent %03x, last %03x", secno, p, pp); 242 238 goto bail; 243 239 } 244 - if (((31 + de->namelen + de->down*4 + 3) & ~3) != de->length) { 245 - if (((31 + de->namelen + de->down*4 + 3) & ~3) < de->length && s->s_flags & MS_RDONLY) goto ok; 240 + if (((31 + de->namelen + de->down*4 + 3) & ~3) != le16_to_cpu(de->length)) { 241 + if (((31 + de->namelen + de->down*4 + 3) & ~3) < le16_to_cpu(de->length) && s->s_flags & MS_RDONLY) goto ok; 246 242 hpfs_error(s, "namelen does not match dirent size in dnode %08x, dirent %03x, last %03x", secno, p, pp); 247 243 goto bail; 248 244 } ··· 255 251 pp = p; 256 252 257 253 } 258 - if (p != dnode->first_free) { 254 + if (p != le32_to_cpu(dnode->first_free)) { 259 255 hpfs_error(s, "size on last dirent does not match first_free; dnode %08x", secno); 260 256 goto bail; 261 257 } ··· 281 277 if (!fnode) 282 278 return 0; 283 279 284 - dno = fnode->u.external[0].disk_secno; 280 + dno = le32_to_cpu(fnode->u.external[0].disk_secno); 285 281 brelse(bh); 286 282 return dno; 287 283 }
-33
fs/hpfs/name.c
··· 8 8 9 9 #include "hpfs_fn.h" 10 10 11 - static const char *text_postfix[]={ 12 - ".ASM", ".BAS", ".BAT", ".C", ".CC", ".CFG", ".CMD", ".CON", ".CPP", ".DEF", 13 - ".DOC", ".DPR", ".ERX", ".H", ".HPP", ".HTM", ".HTML", ".JAVA", ".LOG", ".PAS", 14 - ".RC", ".TEX", ".TXT", ".Y", ""}; 15 - 16 - static const char *text_prefix[]={ 17 - "AUTOEXEC.", "CHANGES", "COPYING", "CONFIG.", "CREDITS", "FAQ", "FILE_ID.DIZ", 18 - "MAKEFILE", "READ.ME", "README", "TERMCAP", ""}; 19 - 20 - void hpfs_decide_conv(struct inode *inode, const unsigned char *name, unsigned len) 21 - { 22 - struct hpfs_inode_info *hpfs_inode = hpfs_i(inode); 23 - int i; 24 - if (hpfs_inode->i_conv != CONV_AUTO) return; 25 - for (i = 0; *text_postfix[i]; i++) { 26 - int l = strlen(text_postfix[i]); 27 - if (l <= len) 28 - if (!hpfs_compare_names(inode->i_sb, text_postfix[i], l, name + len - l, l, 0)) 29 - goto text; 30 - } 31 - for (i = 0; *text_prefix[i]; i++) { 32 - int l = strlen(text_prefix[i]); 33 - if (l <= len) 34 - if (!hpfs_compare_names(inode->i_sb, text_prefix[i], l, name, l, 0)) 35 - goto text; 36 - } 37 - hpfs_inode->i_conv = CONV_BINARY; 38 - return; 39 - text: 40 - hpfs_inode->i_conv = CONV_TEXT; 41 - return; 42 - } 43 - 44 11 static inline int not_allowed_char(unsigned char c) 45 12 { 46 13 return c<' ' || c=='"' || c=='*' || c=='/' || c==':' || c=='<' ||
+30 -76
fs/hpfs/namei.c
··· 29 29 fnode = hpfs_alloc_fnode(dir->i_sb, hpfs_i(dir)->i_dno, &fno, &bh); 30 30 if (!fnode) 31 31 goto bail; 32 - dnode = hpfs_alloc_dnode(dir->i_sb, fno, &dno, &qbh0, 1); 32 + dnode = hpfs_alloc_dnode(dir->i_sb, fno, &dno, &qbh0); 33 33 if (!dnode) 34 34 goto bail1; 35 35 memset(&dee, 0, sizeof dee); ··· 37 37 if (!(mode & 0222)) dee.read_only = 1; 38 38 /*dee.archive = 0;*/ 39 39 dee.hidden = name[0] == '.'; 40 - dee.fnode = fno; 41 - dee.creation_date = dee.write_date = dee.read_date = gmt_to_local(dir->i_sb, get_seconds()); 40 + dee.fnode = cpu_to_le32(fno); 41 + dee.creation_date = dee.write_date = dee.read_date = cpu_to_le32(gmt_to_local(dir->i_sb, get_seconds())); 42 42 result = new_inode(dir->i_sb); 43 43 if (!result) 44 44 goto bail2; ··· 46 46 result->i_ino = fno; 47 47 hpfs_i(result)->i_parent_dir = dir->i_ino; 48 48 hpfs_i(result)->i_dno = dno; 49 - result->i_ctime.tv_sec = result->i_mtime.tv_sec = result->i_atime.tv_sec = local_to_gmt(dir->i_sb, dee.creation_date); 49 + result->i_ctime.tv_sec = result->i_mtime.tv_sec = result->i_atime.tv_sec = local_to_gmt(dir->i_sb, le32_to_cpu(dee.creation_date)); 50 50 result->i_ctime.tv_nsec = 0; 51 51 result->i_mtime.tv_nsec = 0; 52 52 result->i_atime.tv_nsec = 0; ··· 60 60 if (dee.read_only) 61 61 result->i_mode &= ~0222; 62 62 63 - mutex_lock(&hpfs_i(dir)->i_mutex); 64 - r = hpfs_add_dirent(dir, name, len, &dee, 0); 63 + r = hpfs_add_dirent(dir, name, len, &dee); 65 64 if (r == 1) 66 65 goto bail3; 67 66 if (r == -1) { ··· 69 70 } 70 71 fnode->len = len; 71 72 memcpy(fnode->name, name, len > 15 ? 15 : len); 72 - fnode->up = dir->i_ino; 73 + fnode->up = cpu_to_le32(dir->i_ino); 73 74 fnode->dirflag = 1; 74 75 fnode->btree.n_free_nodes = 7; 75 76 fnode->btree.n_used_nodes = 1; 76 - fnode->btree.first_free = 0x14; 77 - fnode->u.external[0].disk_secno = dno; 78 - fnode->u.external[0].file_secno = -1; 77 + fnode->btree.first_free = cpu_to_le16(0x14); 78 + fnode->u.external[0].disk_secno = cpu_to_le32(dno); 79 + fnode->u.external[0].file_secno = cpu_to_le32(-1); 79 80 dnode->root_dnode = 1; 80 - dnode->up = fno; 81 + dnode->up = cpu_to_le32(fno); 81 82 de = hpfs_add_de(dir->i_sb, dnode, "\001\001", 2, 0); 82 - de->creation_date = de->write_date = de->read_date = gmt_to_local(dir->i_sb, get_seconds()); 83 + de->creation_date = de->write_date = de->read_date = cpu_to_le32(gmt_to_local(dir->i_sb, get_seconds())); 83 84 if (!(mode & 0222)) de->read_only = 1; 84 85 de->first = de->directory = 1; 85 86 /*de->hidden = de->system = 0;*/ 86 - de->fnode = fno; 87 + de->fnode = cpu_to_le32(fno); 87 88 mark_buffer_dirty(bh); 88 89 brelse(bh); 89 90 hpfs_mark_4buffers_dirty(&qbh0); ··· 100 101 hpfs_write_inode_nolock(result); 101 102 } 102 103 d_instantiate(dentry, result); 103 - mutex_unlock(&hpfs_i(dir)->i_mutex); 104 104 hpfs_unlock(dir->i_sb); 105 105 return 0; 106 106 bail3: 107 - mutex_unlock(&hpfs_i(dir)->i_mutex); 108 107 iput(result); 109 108 bail2: 110 109 hpfs_brelse4(&qbh0); ··· 137 140 if (!(mode & 0222)) dee.read_only = 1; 138 141 dee.archive = 1; 139 142 dee.hidden = name[0] == '.'; 140 - dee.fnode = fno; 141 - dee.creation_date = dee.write_date = dee.read_date = gmt_to_local(dir->i_sb, get_seconds()); 143 + dee.fnode = cpu_to_le32(fno); 144 + dee.creation_date = dee.write_date = dee.read_date = cpu_to_le32(gmt_to_local(dir->i_sb, get_seconds())); 142 145 143 146 result = new_inode(dir->i_sb); 144 147 if (!result) ··· 151 154 result->i_op = &hpfs_file_iops; 152 155 result->i_fop = &hpfs_file_ops; 153 156 result->i_nlink = 1; 154 - hpfs_decide_conv(result, name, len); 155 157 hpfs_i(result)->i_parent_dir = dir->i_ino; 156 - result->i_ctime.tv_sec = result->i_mtime.tv_sec = result->i_atime.tv_sec = local_to_gmt(dir->i_sb, dee.creation_date); 158 + result->i_ctime.tv_sec = result->i_mtime.tv_sec = result->i_atime.tv_sec = local_to_gmt(dir->i_sb, le32_to_cpu(dee.creation_date)); 157 159 result->i_ctime.tv_nsec = 0; 158 160 result->i_mtime.tv_nsec = 0; 159 161 result->i_atime.tv_nsec = 0; ··· 164 168 result->i_data.a_ops = &hpfs_aops; 165 169 hpfs_i(result)->mmu_private = 0; 166 170 167 - mutex_lock(&hpfs_i(dir)->i_mutex); 168 - r = hpfs_add_dirent(dir, name, len, &dee, 0); 171 + r = hpfs_add_dirent(dir, name, len, &dee); 169 172 if (r == 1) 170 173 goto bail2; 171 174 if (r == -1) { ··· 173 178 } 174 179 fnode->len = len; 175 180 memcpy(fnode->name, name, len > 15 ? 15 : len); 176 - fnode->up = dir->i_ino; 181 + fnode->up = cpu_to_le32(dir->i_ino); 177 182 mark_buffer_dirty(bh); 178 183 brelse(bh); 179 184 ··· 188 193 hpfs_write_inode_nolock(result); 189 194 } 190 195 d_instantiate(dentry, result); 191 - mutex_unlock(&hpfs_i(dir)->i_mutex); 192 196 hpfs_unlock(dir->i_sb); 193 197 return 0; 194 198 195 199 bail2: 196 - mutex_unlock(&hpfs_i(dir)->i_mutex); 197 200 iput(result); 198 201 bail1: 199 202 brelse(bh); ··· 225 232 if (!(mode & 0222)) dee.read_only = 1; 226 233 dee.archive = 1; 227 234 dee.hidden = name[0] == '.'; 228 - dee.fnode = fno; 229 - dee.creation_date = dee.write_date = dee.read_date = gmt_to_local(dir->i_sb, get_seconds()); 235 + dee.fnode = cpu_to_le32(fno); 236 + dee.creation_date = dee.write_date = dee.read_date = cpu_to_le32(gmt_to_local(dir->i_sb, get_seconds())); 230 237 231 238 result = new_inode(dir->i_sb); 232 239 if (!result) ··· 235 242 hpfs_init_inode(result); 236 243 result->i_ino = fno; 237 244 hpfs_i(result)->i_parent_dir = dir->i_ino; 238 - result->i_ctime.tv_sec = result->i_mtime.tv_sec = result->i_atime.tv_sec = local_to_gmt(dir->i_sb, dee.creation_date); 245 + result->i_ctime.tv_sec = result->i_mtime.tv_sec = result->i_atime.tv_sec = local_to_gmt(dir->i_sb, le32_to_cpu(dee.creation_date)); 239 246 result->i_ctime.tv_nsec = 0; 240 247 result->i_mtime.tv_nsec = 0; 241 248 result->i_atime.tv_nsec = 0; ··· 247 254 result->i_blocks = 1; 248 255 init_special_inode(result, mode, rdev); 249 256 250 - mutex_lock(&hpfs_i(dir)->i_mutex); 251 - r = hpfs_add_dirent(dir, name, len, &dee, 0); 257 + r = hpfs_add_dirent(dir, name, len, &dee); 252 258 if (r == 1) 253 259 goto bail2; 254 260 if (r == -1) { ··· 256 264 } 257 265 fnode->len = len; 258 266 memcpy(fnode->name, name, len > 15 ? 15 : len); 259 - fnode->up = dir->i_ino; 267 + fnode->up = cpu_to_le32(dir->i_ino); 260 268 mark_buffer_dirty(bh); 261 269 262 270 insert_inode_hash(result); 263 271 264 272 hpfs_write_inode_nolock(result); 265 273 d_instantiate(dentry, result); 266 - mutex_unlock(&hpfs_i(dir)->i_mutex); 267 274 brelse(bh); 268 275 hpfs_unlock(dir->i_sb); 269 276 return 0; 270 277 bail2: 271 - mutex_unlock(&hpfs_i(dir)->i_mutex); 272 278 iput(result); 273 279 bail1: 274 280 brelse(bh); ··· 300 310 memset(&dee, 0, sizeof dee); 301 311 dee.archive = 1; 302 312 dee.hidden = name[0] == '.'; 303 - dee.fnode = fno; 304 - dee.creation_date = dee.write_date = dee.read_date = gmt_to_local(dir->i_sb, get_seconds()); 313 + dee.fnode = cpu_to_le32(fno); 314 + dee.creation_date = dee.write_date = dee.read_date = cpu_to_le32(gmt_to_local(dir->i_sb, get_seconds())); 305 315 306 316 result = new_inode(dir->i_sb); 307 317 if (!result) ··· 309 319 result->i_ino = fno; 310 320 hpfs_init_inode(result); 311 321 hpfs_i(result)->i_parent_dir = dir->i_ino; 312 - result->i_ctime.tv_sec = result->i_mtime.tv_sec = result->i_atime.tv_sec = local_to_gmt(dir->i_sb, dee.creation_date); 322 + result->i_ctime.tv_sec = result->i_mtime.tv_sec = result->i_atime.tv_sec = local_to_gmt(dir->i_sb, le32_to_cpu(dee.creation_date)); 313 323 result->i_ctime.tv_nsec = 0; 314 324 result->i_mtime.tv_nsec = 0; 315 325 result->i_atime.tv_nsec = 0; ··· 323 333 result->i_op = &page_symlink_inode_operations; 324 334 result->i_data.a_ops = &hpfs_symlink_aops; 325 335 326 - mutex_lock(&hpfs_i(dir)->i_mutex); 327 - r = hpfs_add_dirent(dir, name, len, &dee, 0); 336 + r = hpfs_add_dirent(dir, name, len, &dee); 328 337 if (r == 1) 329 338 goto bail2; 330 339 if (r == -1) { ··· 332 343 } 333 344 fnode->len = len; 334 345 memcpy(fnode->name, name, len > 15 ? 15 : len); 335 - fnode->up = dir->i_ino; 346 + fnode->up = cpu_to_le32(dir->i_ino); 336 347 hpfs_set_ea(result, fnode, "SYMLINK", symlink, strlen(symlink)); 337 348 mark_buffer_dirty(bh); 338 349 brelse(bh); ··· 341 352 342 353 hpfs_write_inode_nolock(result); 343 354 d_instantiate(dentry, result); 344 - mutex_unlock(&hpfs_i(dir)->i_mutex); 345 355 hpfs_unlock(dir->i_sb); 346 356 return 0; 347 357 bail2: 348 - mutex_unlock(&hpfs_i(dir)->i_mutex); 349 358 iput(result); 350 359 bail1: 351 360 brelse(bh); ··· 361 374 struct hpfs_dirent *de; 362 375 struct inode *inode = dentry->d_inode; 363 376 dnode_secno dno; 364 - fnode_secno fno; 365 377 int r; 366 378 int rep = 0; 367 379 int err; ··· 368 382 hpfs_lock(dir->i_sb); 369 383 hpfs_adjust_length(name, &len); 370 384 again: 371 - mutex_lock(&hpfs_i(inode)->i_parent_mutex); 372 - mutex_lock(&hpfs_i(dir)->i_mutex); 373 385 err = -ENOENT; 374 386 de = map_dirent(dir, hpfs_i(dir)->i_dno, name, len, &dno, &qbh); 375 387 if (!de) ··· 381 397 if (de->directory) 382 398 goto out1; 383 399 384 - fno = de->fnode; 385 400 r = hpfs_remove_dirent(dir, dno, de, &qbh, 1); 386 401 switch (r) { 387 402 case 1: ··· 393 410 if (rep++) 394 411 break; 395 412 396 - mutex_unlock(&hpfs_i(dir)->i_mutex); 397 - mutex_unlock(&hpfs_i(inode)->i_parent_mutex); 398 413 dentry_unhash(dentry); 399 414 if (!d_unhashed(dentry)) { 400 415 dput(dentry); ··· 426 445 out1: 427 446 hpfs_brelse4(&qbh); 428 447 out: 429 - mutex_unlock(&hpfs_i(dir)->i_mutex); 430 - mutex_unlock(&hpfs_i(inode)->i_parent_mutex); 431 448 hpfs_unlock(dir->i_sb); 432 449 return err; 433 450 } ··· 438 459 struct hpfs_dirent *de; 439 460 struct inode *inode = dentry->d_inode; 440 461 dnode_secno dno; 441 - fnode_secno fno; 442 462 int n_items = 0; 443 463 int err; 444 464 int r; 445 465 446 466 hpfs_adjust_length(name, &len); 447 467 hpfs_lock(dir->i_sb); 448 - mutex_lock(&hpfs_i(inode)->i_parent_mutex); 449 - mutex_lock(&hpfs_i(dir)->i_mutex); 450 468 err = -ENOENT; 451 469 de = map_dirent(dir, hpfs_i(dir)->i_dno, name, len, &dno, &qbh); 452 470 if (!de) ··· 462 486 if (n_items) 463 487 goto out1; 464 488 465 - fno = de->fnode; 466 489 r = hpfs_remove_dirent(dir, dno, de, &qbh, 1); 467 490 switch (r) { 468 491 case 1: ··· 480 505 out1: 481 506 hpfs_brelse4(&qbh); 482 507 out: 483 - mutex_unlock(&hpfs_i(dir)->i_mutex); 484 - mutex_unlock(&hpfs_i(inode)->i_parent_mutex); 485 508 hpfs_unlock(dir->i_sb); 486 509 return err; 487 510 } ··· 541 568 542 569 hpfs_lock(i->i_sb); 543 570 /* order doesn't matter, due to VFS exclusion */ 544 - mutex_lock(&hpfs_i(i)->i_parent_mutex); 545 - if (new_inode) 546 - mutex_lock(&hpfs_i(new_inode)->i_parent_mutex); 547 - mutex_lock(&hpfs_i(old_dir)->i_mutex); 548 - if (new_dir != old_dir) 549 - mutex_lock(&hpfs_i(new_dir)->i_mutex); 550 571 551 572 /* Erm? Moving over the empty non-busy directory is perfectly legal */ 552 573 if (new_inode && S_ISDIR(new_inode->i_mode)) { ··· 577 610 578 611 if (new_dir == old_dir) hpfs_brelse4(&qbh); 579 612 580 - hpfs_lock_creation(i->i_sb); 581 - if ((r = hpfs_add_dirent(new_dir, new_name, new_len, &de, 1))) { 582 - hpfs_unlock_creation(i->i_sb); 613 + if ((r = hpfs_add_dirent(new_dir, new_name, new_len, &de))) { 583 614 if (r == -1) hpfs_error(new_dir->i_sb, "hpfs_rename: dirent already exists!"); 584 615 err = r == 1 ? -ENOSPC : -EFSERROR; 585 616 if (new_dir != old_dir) hpfs_brelse4(&qbh); ··· 586 621 587 622 if (new_dir == old_dir) 588 623 if (!(dep = map_dirent(old_dir, hpfs_i(old_dir)->i_dno, old_name, old_len, &dno, &qbh))) { 589 - hpfs_unlock_creation(i->i_sb); 590 624 hpfs_error(i->i_sb, "lookup succeeded but map dirent failed at #2"); 591 625 err = -ENOENT; 592 626 goto end1; 593 627 } 594 628 595 629 if ((r = hpfs_remove_dirent(old_dir, dno, dep, &qbh, 0))) { 596 - hpfs_unlock_creation(i->i_sb); 597 630 hpfs_error(i->i_sb, "hpfs_rename: could not remove dirent"); 598 631 err = r == 2 ? -ENOSPC : -EFSERROR; 599 632 goto end1; 600 633 } 601 - hpfs_unlock_creation(i->i_sb); 602 - 634 + 603 635 end: 604 636 hpfs_i(i)->i_parent_dir = new_dir->i_ino; 605 637 if (S_ISDIR(i->i_mode)) { ··· 604 642 drop_nlink(old_dir); 605 643 } 606 644 if ((fnode = hpfs_map_fnode(i->i_sb, i->i_ino, &bh))) { 607 - fnode->up = new_dir->i_ino; 645 + fnode->up = cpu_to_le32(new_dir->i_ino); 608 646 fnode->len = new_len; 609 647 memcpy(fnode->name, new_name, new_len>15?15:new_len); 610 648 if (new_len < 15) memset(&fnode->name[new_len], 0, 15 - new_len); 611 649 mark_buffer_dirty(bh); 612 650 brelse(bh); 613 651 } 614 - hpfs_i(i)->i_conv = hpfs_sb(i->i_sb)->sb_conv; 615 - hpfs_decide_conv(i, new_name, new_len); 616 652 end1: 617 - if (old_dir != new_dir) 618 - mutex_unlock(&hpfs_i(new_dir)->i_mutex); 619 - mutex_unlock(&hpfs_i(old_dir)->i_mutex); 620 - mutex_unlock(&hpfs_i(i)->i_parent_mutex); 621 - if (new_inode) 622 - mutex_unlock(&hpfs_i(new_inode)->i_parent_mutex); 623 653 hpfs_unlock(i->i_sb); 624 654 return err; 625 655 }
+51 -67
fs/hpfs/super.c
··· 18 18 19 19 /* Mark the filesystem dirty, so that chkdsk checks it when os/2 booted */ 20 20 21 - static void mark_dirty(struct super_block *s) 21 + static void mark_dirty(struct super_block *s, int remount) 22 22 { 23 - if (hpfs_sb(s)->sb_chkdsk && !(s->s_flags & MS_RDONLY)) { 23 + if (hpfs_sb(s)->sb_chkdsk && (remount || !(s->s_flags & MS_RDONLY))) { 24 24 struct buffer_head *bh; 25 25 struct hpfs_spare_block *sb; 26 26 if ((sb = hpfs_map_sector(s, 17, &bh, 0))) { 27 27 sb->dirty = 1; 28 28 sb->old_wrote = 0; 29 29 mark_buffer_dirty(bh); 30 + sync_dirty_buffer(bh); 30 31 brelse(bh); 31 32 } 32 33 } ··· 41 40 struct buffer_head *bh; 42 41 struct hpfs_spare_block *sb; 43 42 if (s->s_flags & MS_RDONLY) return; 43 + sync_blockdev(s->s_bdev); 44 44 if ((sb = hpfs_map_sector(s, 17, &bh, 0))) { 45 45 sb->dirty = hpfs_sb(s)->sb_chkdsk > 1 - hpfs_sb(s)->sb_was_error; 46 46 sb->old_wrote = hpfs_sb(s)->sb_chkdsk >= 2 && !hpfs_sb(s)->sb_was_error; 47 47 mark_buffer_dirty(bh); 48 + sync_dirty_buffer(bh); 48 49 brelse(bh); 49 50 } 50 51 } ··· 66 63 if (!hpfs_sb(s)->sb_was_error) { 67 64 if (hpfs_sb(s)->sb_err == 2) { 68 65 printk("; crashing the system because you wanted it\n"); 69 - mark_dirty(s); 66 + mark_dirty(s, 0); 70 67 panic("HPFS panic"); 71 68 } else if (hpfs_sb(s)->sb_err == 1) { 72 69 if (s->s_flags & MS_RDONLY) printk("; already mounted read-only\n"); 73 70 else { 74 71 printk("; remounting read-only\n"); 75 - mark_dirty(s); 72 + mark_dirty(s, 0); 76 73 s->s_flags |= MS_RDONLY; 77 74 } 78 75 } else if (s->s_flags & MS_RDONLY) printk("; going on - but anything won't be destroyed because it's read-only\n"); ··· 105 102 { 106 103 struct hpfs_sb_info *sbi = hpfs_sb(s); 107 104 105 + hpfs_lock(s); 106 + unmark_dirty(s); 107 + hpfs_unlock(s); 108 + 108 109 kfree(sbi->sb_cp_table); 109 110 kfree(sbi->sb_bmp_dir); 110 - unmark_dirty(s); 111 111 s->s_fs_info = NULL; 112 112 kfree(sbi); 113 113 } ··· 135 129 n_bands = (hpfs_sb(s)->sb_fs_size + 0x3fff) >> 14; 136 130 count = 0; 137 131 for (n = 0; n < n_bands; n++) 138 - count += hpfs_count_one_bitmap(s, hpfs_sb(s)->sb_bmp_dir[n]); 132 + count += hpfs_count_one_bitmap(s, le32_to_cpu(hpfs_sb(s)->sb_bmp_dir[n])); 139 133 return count; 140 134 } 141 135 ··· 194 188 { 195 189 struct hpfs_inode_info *ei = (struct hpfs_inode_info *) foo; 196 190 197 - mutex_init(&ei->i_mutex); 198 - mutex_init(&ei->i_parent_mutex); 199 191 inode_init_once(&ei->vfs_inode); 200 192 } 201 193 ··· 222 218 223 219 enum { 224 220 Opt_help, Opt_uid, Opt_gid, Opt_umask, Opt_case_lower, Opt_case_asis, 225 - Opt_conv_binary, Opt_conv_text, Opt_conv_auto, 226 221 Opt_check_none, Opt_check_normal, Opt_check_strict, 227 222 Opt_err_cont, Opt_err_ro, Opt_err_panic, 228 223 Opt_eas_no, Opt_eas_ro, Opt_eas_rw, ··· 236 233 {Opt_umask, "umask=%o"}, 237 234 {Opt_case_lower, "case=lower"}, 238 235 {Opt_case_asis, "case=asis"}, 239 - {Opt_conv_binary, "conv=binary"}, 240 - {Opt_conv_text, "conv=text"}, 241 - {Opt_conv_auto, "conv=auto"}, 242 236 {Opt_check_none, "check=none"}, 243 237 {Opt_check_normal, "check=normal"}, 244 238 {Opt_check_strict, "check=strict"}, ··· 253 253 }; 254 254 255 255 static int parse_opts(char *opts, uid_t *uid, gid_t *gid, umode_t *umask, 256 - int *lowercase, int *conv, int *eas, int *chk, int *errs, 256 + int *lowercase, int *eas, int *chk, int *errs, 257 257 int *chkdsk, int *timeshift) 258 258 { 259 259 char *p; ··· 294 294 break; 295 295 case Opt_case_asis: 296 296 *lowercase = 0; 297 - break; 298 - case Opt_conv_binary: 299 - *conv = CONV_BINARY; 300 - break; 301 - case Opt_conv_text: 302 - *conv = CONV_TEXT; 303 - break; 304 - case Opt_conv_auto: 305 - *conv = CONV_AUTO; 306 297 break; 307 298 case Opt_check_none: 308 299 *chk = 0; ··· 361 370 umask=xxx set mode of files that don't have mode specified in eas\n\ 362 371 case=lower lowercase all files\n\ 363 372 case=asis do not lowercase files (default)\n\ 364 - conv=binary do not convert CR/LF -> LF (default)\n\ 365 - conv=auto convert only files with known text extensions\n\ 366 - conv=text convert all files\n\ 367 373 check=none no fs checks - kernel may crash on corrupted filesystem\n\ 368 374 check=normal do some checks - it should not crash (default)\n\ 369 375 check=strict do extra time-consuming checks, used for debugging\n\ ··· 382 394 uid_t uid; 383 395 gid_t gid; 384 396 umode_t umask; 385 - int lowercase, conv, eas, chk, errs, chkdsk, timeshift; 397 + int lowercase, eas, chk, errs, chkdsk, timeshift; 386 398 int o; 387 399 struct hpfs_sb_info *sbi = hpfs_sb(s); 388 400 char *new_opts = kstrdup(data, GFP_KERNEL); ··· 393 405 lock_super(s); 394 406 uid = sbi->sb_uid; gid = sbi->sb_gid; 395 407 umask = 0777 & ~sbi->sb_mode; 396 - lowercase = sbi->sb_lowercase; conv = sbi->sb_conv; 408 + lowercase = sbi->sb_lowercase; 397 409 eas = sbi->sb_eas; chk = sbi->sb_chk; chkdsk = sbi->sb_chkdsk; 398 410 errs = sbi->sb_err; timeshift = sbi->sb_timeshift; 399 411 400 - if (!(o = parse_opts(data, &uid, &gid, &umask, &lowercase, &conv, 412 + if (!(o = parse_opts(data, &uid, &gid, &umask, &lowercase, 401 413 &eas, &chk, &errs, &chkdsk, &timeshift))) { 402 414 printk("HPFS: bad mount options.\n"); 403 415 goto out_err; ··· 415 427 416 428 sbi->sb_uid = uid; sbi->sb_gid = gid; 417 429 sbi->sb_mode = 0777 & ~umask; 418 - sbi->sb_lowercase = lowercase; sbi->sb_conv = conv; 430 + sbi->sb_lowercase = lowercase; 419 431 sbi->sb_eas = eas; sbi->sb_chk = chk; sbi->sb_chkdsk = chkdsk; 420 432 sbi->sb_err = errs; sbi->sb_timeshift = timeshift; 421 433 422 - if (!(*flags & MS_RDONLY)) mark_dirty(s); 434 + if (!(*flags & MS_RDONLY)) mark_dirty(s, 1); 423 435 424 436 replace_mount_options(s, new_opts); 425 437 ··· 459 471 uid_t uid; 460 472 gid_t gid; 461 473 umode_t umask; 462 - int lowercase, conv, eas, chk, errs, chkdsk, timeshift; 474 + int lowercase, eas, chk, errs, chkdsk, timeshift; 463 475 464 476 dnode_secno root_dno; 465 477 struct hpfs_dirent *de = NULL; 466 478 struct quad_buffer_head qbh; 467 479 468 480 int o; 469 - 470 - if (num_possible_cpus() > 1) { 471 - printk(KERN_ERR "HPFS is not SMP safe\n"); 472 - return -EINVAL; 473 - } 474 481 475 482 save_mount_options(s, options); 476 483 ··· 478 495 sbi->sb_bmp_dir = NULL; 479 496 sbi->sb_cp_table = NULL; 480 497 481 - mutex_init(&sbi->hpfs_creation_de); 498 + mutex_init(&sbi->hpfs_mutex); 499 + hpfs_lock(s); 482 500 483 501 uid = current_uid(); 484 502 gid = current_gid(); 485 503 umask = current_umask(); 486 504 lowercase = 0; 487 - conv = CONV_BINARY; 488 505 eas = 2; 489 506 chk = 1; 490 507 errs = 1; 491 508 chkdsk = 1; 492 509 timeshift = 0; 493 510 494 - if (!(o = parse_opts(options, &uid, &gid, &umask, &lowercase, &conv, 511 + if (!(o = parse_opts(options, &uid, &gid, &umask, &lowercase, 495 512 &eas, &chk, &errs, &chkdsk, &timeshift))) { 496 513 printk("HPFS: bad mount options.\n"); 497 514 goto bail0; ··· 509 526 if (!(spareblock = hpfs_map_sector(s, 17, &bh2, 0))) goto bail3; 510 527 511 528 /* Check magics */ 512 - if (/*bootblock->magic != BB_MAGIC 513 - ||*/ superblock->magic != SB_MAGIC 514 - || spareblock->magic != SP_MAGIC) { 529 + if (/*le16_to_cpu(bootblock->magic) != BB_MAGIC 530 + ||*/ le32_to_cpu(superblock->magic) != SB_MAGIC 531 + || le32_to_cpu(spareblock->magic) != SP_MAGIC) { 515 532 if (!silent) printk("HPFS: Bad magic ... probably not HPFS\n"); 516 533 goto bail4; 517 534 } ··· 532 549 s->s_op = &hpfs_sops; 533 550 s->s_d_op = &hpfs_dentry_operations; 534 551 535 - sbi->sb_root = superblock->root; 536 - sbi->sb_fs_size = superblock->n_sectors; 537 - sbi->sb_bitmaps = superblock->bitmaps; 538 - sbi->sb_dirband_start = superblock->dir_band_start; 539 - sbi->sb_dirband_size = superblock->n_dir_band; 540 - sbi->sb_dmap = superblock->dir_band_bitmap; 552 + sbi->sb_root = le32_to_cpu(superblock->root); 553 + sbi->sb_fs_size = le32_to_cpu(superblock->n_sectors); 554 + sbi->sb_bitmaps = le32_to_cpu(superblock->bitmaps); 555 + sbi->sb_dirband_start = le32_to_cpu(superblock->dir_band_start); 556 + sbi->sb_dirband_size = le32_to_cpu(superblock->n_dir_band); 557 + sbi->sb_dmap = le32_to_cpu(superblock->dir_band_bitmap); 541 558 sbi->sb_uid = uid; 542 559 sbi->sb_gid = gid; 543 560 sbi->sb_mode = 0777 & ~umask; 544 561 sbi->sb_n_free = -1; 545 562 sbi->sb_n_free_dnodes = -1; 546 563 sbi->sb_lowercase = lowercase; 547 - sbi->sb_conv = conv; 548 564 sbi->sb_eas = eas; 549 565 sbi->sb_chk = chk; 550 566 sbi->sb_chkdsk = chkdsk; ··· 555 573 sbi->sb_max_fwd_alloc = 0xffffff; 556 574 557 575 /* Load bitmap directory */ 558 - if (!(sbi->sb_bmp_dir = hpfs_load_bitmap_directory(s, superblock->bitmaps))) 576 + if (!(sbi->sb_bmp_dir = hpfs_load_bitmap_directory(s, le32_to_cpu(superblock->bitmaps)))) 559 577 goto bail4; 560 578 561 579 /* Check for general fs errors*/ ··· 573 591 mark_buffer_dirty(bh2); 574 592 } 575 593 576 - if (spareblock->hotfixes_used || spareblock->n_spares_used) { 594 + if (le32_to_cpu(spareblock->hotfixes_used) || le32_to_cpu(spareblock->n_spares_used)) { 577 595 if (errs >= 2) { 578 596 printk("HPFS: Hotfixes not supported here, try chkdsk\n"); 579 - mark_dirty(s); 597 + mark_dirty(s, 0); 580 598 goto bail4; 581 599 } 582 600 hpfs_error(s, "hotfixes not supported here, try chkdsk"); 583 601 if (errs == 0) printk("HPFS: Proceeding, but your filesystem will be probably corrupted by this driver...\n"); 584 602 else printk("HPFS: This driver may read bad files or crash when operating on disk with hotfixes.\n"); 585 603 } 586 - if (spareblock->n_dnode_spares != spareblock->n_dnode_spares_free) { 604 + if (le32_to_cpu(spareblock->n_dnode_spares) != le32_to_cpu(spareblock->n_dnode_spares_free)) { 587 605 if (errs >= 2) { 588 606 printk("HPFS: Spare dnodes used, try chkdsk\n"); 589 - mark_dirty(s); 607 + mark_dirty(s, 0); 590 608 goto bail4; 591 609 } 592 610 hpfs_error(s, "warning: spare dnodes used, try chkdsk"); ··· 594 612 } 595 613 if (chk) { 596 614 unsigned a; 597 - if (superblock->dir_band_end - superblock->dir_band_start + 1 != superblock->n_dir_band || 598 - superblock->dir_band_end < superblock->dir_band_start || superblock->n_dir_band > 0x4000) { 615 + if (le32_to_cpu(superblock->dir_band_end) - le32_to_cpu(superblock->dir_band_start) + 1 != le32_to_cpu(superblock->n_dir_band) || 616 + le32_to_cpu(superblock->dir_band_end) < le32_to_cpu(superblock->dir_band_start) || le32_to_cpu(superblock->n_dir_band) > 0x4000) { 599 617 hpfs_error(s, "dir band size mismatch: dir_band_start==%08x, dir_band_end==%08x, n_dir_band==%08x", 600 - superblock->dir_band_start, superblock->dir_band_end, superblock->n_dir_band); 618 + le32_to_cpu(superblock->dir_band_start), le32_to_cpu(superblock->dir_band_end), le32_to_cpu(superblock->n_dir_band)); 601 619 goto bail4; 602 620 } 603 621 a = sbi->sb_dirband_size; 604 622 sbi->sb_dirband_size = 0; 605 - if (hpfs_chk_sectors(s, superblock->dir_band_start, superblock->n_dir_band, "dir_band") || 606 - hpfs_chk_sectors(s, superblock->dir_band_bitmap, 4, "dir_band_bitmap") || 607 - hpfs_chk_sectors(s, superblock->bitmaps, 4, "bitmaps")) { 608 - mark_dirty(s); 623 + if (hpfs_chk_sectors(s, le32_to_cpu(superblock->dir_band_start), le32_to_cpu(superblock->n_dir_band), "dir_band") || 624 + hpfs_chk_sectors(s, le32_to_cpu(superblock->dir_band_bitmap), 4, "dir_band_bitmap") || 625 + hpfs_chk_sectors(s, le32_to_cpu(superblock->bitmaps), 4, "bitmaps")) { 626 + mark_dirty(s, 0); 609 627 goto bail4; 610 628 } 611 629 sbi->sb_dirband_size = a; 612 630 } else printk("HPFS: You really don't want any checks? You are crazy...\n"); 613 631 614 632 /* Load code page table */ 615 - if (spareblock->n_code_pages) 616 - if (!(sbi->sb_cp_table = hpfs_load_code_page(s, spareblock->code_page_dir))) 633 + if (le32_to_cpu(spareblock->n_code_pages)) 634 + if (!(sbi->sb_cp_table = hpfs_load_code_page(s, le32_to_cpu(spareblock->code_page_dir)))) 617 635 printk("HPFS: Warning: code page support is disabled\n"); 618 636 619 637 brelse(bh2); ··· 642 660 if (!de) 643 661 hpfs_error(s, "unable to find root dir"); 644 662 else { 645 - root->i_atime.tv_sec = local_to_gmt(s, de->read_date); 663 + root->i_atime.tv_sec = local_to_gmt(s, le32_to_cpu(de->read_date)); 646 664 root->i_atime.tv_nsec = 0; 647 - root->i_mtime.tv_sec = local_to_gmt(s, de->write_date); 665 + root->i_mtime.tv_sec = local_to_gmt(s, le32_to_cpu(de->write_date)); 648 666 root->i_mtime.tv_nsec = 0; 649 - root->i_ctime.tv_sec = local_to_gmt(s, de->creation_date); 667 + root->i_ctime.tv_sec = local_to_gmt(s, le32_to_cpu(de->creation_date)); 650 668 root->i_ctime.tv_nsec = 0; 651 - hpfs_i(root)->i_ea_size = de->ea_size; 669 + hpfs_i(root)->i_ea_size = le16_to_cpu(de->ea_size); 652 670 hpfs_i(root)->i_parent_dir = root->i_ino; 653 671 if (root->i_size == -1) 654 672 root->i_size = 2048; ··· 656 674 root->i_blocks = 5; 657 675 hpfs_brelse4(&qbh); 658 676 } 677 + hpfs_unlock(s); 659 678 return 0; 660 679 661 680 bail4: brelse(bh2); ··· 664 681 bail2: brelse(bh0); 665 682 bail1: 666 683 bail0: 684 + hpfs_unlock(s); 667 685 kfree(sbi->sb_bmp_dir); 668 686 kfree(sbi->sb_cp_table); 669 687 s->s_fs_info = NULL;
+4 -4
fs/logfs/super.c
··· 480 480 !read_only) 481 481 return -EIO; 482 482 483 - mutex_init(&super->s_dirop_mutex); 484 - mutex_init(&super->s_object_alias_mutex); 485 - INIT_LIST_HEAD(&super->s_freeing_list); 486 - 487 483 ret = logfs_init_rw(sb); 488 484 if (ret) 489 485 return ret; ··· 596 600 super = kzalloc(sizeof(*super), GFP_KERNEL); 597 601 if (!super) 598 602 return ERR_PTR(-ENOMEM); 603 + 604 + mutex_init(&super->s_dirop_mutex); 605 + mutex_init(&super->s_object_alias_mutex); 606 + INIT_LIST_HEAD(&super->s_freeing_list); 599 607 600 608 if (!devname) 601 609 err = logfs_get_sb_bdev(super, type, devname);
+6
fs/partitions/efi.c
··· 348 348 goto fail; 349 349 } 350 350 351 + /* Check that sizeof_partition_entry has the correct value */ 352 + if (le32_to_cpu((*gpt)->sizeof_partition_entry) != sizeof(gpt_entry)) { 353 + pr_debug("GUID Partitition Entry Size check failed.\n"); 354 + goto fail; 355 + } 356 + 351 357 if (!(*ptes = alloc_read_gpt_entries(state, *gpt))) 352 358 goto fail; 353 359
+7 -5
fs/proc/task_mmu.c
··· 214 214 int flags = vma->vm_flags; 215 215 unsigned long ino = 0; 216 216 unsigned long long pgoff = 0; 217 - unsigned long start; 217 + unsigned long start, end; 218 218 dev_t dev = 0; 219 219 int len; 220 220 ··· 227 227 228 228 /* We don't show the stack guard page in /proc/maps */ 229 229 start = vma->vm_start; 230 - if (vma->vm_flags & VM_GROWSDOWN) 231 - if (!vma_stack_continue(vma->vm_prev, vma->vm_start)) 232 - start += PAGE_SIZE; 230 + if (stack_guard_page_start(vma, start)) 231 + start += PAGE_SIZE; 232 + end = vma->vm_end; 233 + if (stack_guard_page_end(vma, end)) 234 + end -= PAGE_SIZE; 233 235 234 236 seq_printf(m, "%08lx-%08lx %c%c%c%c %08llx %02x:%02x %lu %n", 235 237 start, 236 - vma->vm_end, 238 + end, 237 239 flags & VM_READ ? 'r' : '-', 238 240 flags & VM_WRITE ? 'w' : '-', 239 241 flags & VM_EXEC ? 'x' : '-',
+1 -1
include/drm/drm_mm.h
··· 86 86 } 87 87 #define drm_mm_for_each_node(entry, mm) list_for_each_entry(entry, \ 88 88 &(mm)->head_node.node_list, \ 89 - node_list); 89 + node_list) 90 90 #define drm_mm_for_each_scanned_node_reverse(entry, n, mm) \ 91 91 for (entry = (mm)->prev_scanned_node, \ 92 92 next = entry ? list_entry(entry->node_list.next, \
+5
include/drm/drm_pciids.h
··· 155 155 {0x1002, 0x6719, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_CAYMAN|RADEON_NEW_MEMMAP}, \ 156 156 {0x1002, 0x671c, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_CAYMAN|RADEON_NEW_MEMMAP}, \ 157 157 {0x1002, 0x671d, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_CAYMAN|RADEON_NEW_MEMMAP}, \ 158 + {0x1002, 0x671f, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_CAYMAN|RADEON_NEW_MEMMAP}, \ 158 159 {0x1002, 0x6720, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_BARTS|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \ 159 160 {0x1002, 0x6721, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_BARTS|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \ 160 161 {0x1002, 0x6722, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_BARTS|RADEON_NEW_MEMMAP}, \ ··· 168 167 {0x1002, 0x6729, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_BARTS|RADEON_NEW_MEMMAP}, \ 169 168 {0x1002, 0x6738, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_BARTS|RADEON_NEW_MEMMAP}, \ 170 169 {0x1002, 0x6739, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_BARTS|RADEON_NEW_MEMMAP}, \ 170 + {0x1002, 0x673e, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_BARTS|RADEON_NEW_MEMMAP}, \ 171 171 {0x1002, 0x6740, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_TURKS|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \ 172 172 {0x1002, 0x6741, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_TURKS|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \ 173 173 {0x1002, 0x6742, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_TURKS|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \ ··· 201 199 {0x1002, 0x688D, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_CYPRESS|RADEON_NEW_MEMMAP}, \ 202 200 {0x1002, 0x6898, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_CYPRESS|RADEON_NEW_MEMMAP}, \ 203 201 {0x1002, 0x6899, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_CYPRESS|RADEON_NEW_MEMMAP}, \ 202 + {0x1002, 0x689b, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_CYPRESS|RADEON_NEW_MEMMAP}, \ 204 203 {0x1002, 0x689c, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_HEMLOCK|RADEON_NEW_MEMMAP}, \ 205 204 {0x1002, 0x689d, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_HEMLOCK|RADEON_NEW_MEMMAP}, \ 206 205 {0x1002, 0x689e, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_CYPRESS|RADEON_NEW_MEMMAP}, \ ··· 212 209 {0x1002, 0x68b0, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_JUNIPER|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \ 213 210 {0x1002, 0x68b8, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_JUNIPER|RADEON_NEW_MEMMAP}, \ 214 211 {0x1002, 0x68b9, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_JUNIPER|RADEON_NEW_MEMMAP}, \ 212 + {0x1002, 0x68ba, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_JUNIPER|RADEON_NEW_MEMMAP}, \ 215 213 {0x1002, 0x68be, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_JUNIPER|RADEON_NEW_MEMMAP}, \ 214 + {0x1002, 0x68bf, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_JUNIPER|RADEON_NEW_MEMMAP}, \ 216 215 {0x1002, 0x68c0, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_REDWOOD|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \ 217 216 {0x1002, 0x68c1, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_REDWOOD|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \ 218 217 {0x1002, 0x68c7, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_REDWOOD|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
+1
include/drm/radeon_drm.h
··· 910 910 #define RADEON_INFO_CLOCK_CRYSTAL_FREQ 0x09 /* clock crystal frequency */ 911 911 #define RADEON_INFO_NUM_BACKENDS 0x0a /* DB/backends for r600+ - need for OQ */ 912 912 #define RADEON_INFO_NUM_TILE_PIPES 0x0b /* tile pipes for r600+ */ 913 + #define RADEON_INFO_FUSION_GART_WORKING 0x0c /* fusion writes to GTT were broken before this */ 913 914 914 915 struct drm_radeon_info { 915 916 uint32_t request;
+1 -1
include/linux/flex_array.h
··· 61 61 struct flex_array *flex_array_alloc(int element_size, unsigned int total, 62 62 gfp_t flags); 63 63 int flex_array_prealloc(struct flex_array *fa, unsigned int start, 64 - unsigned int end, gfp_t flags); 64 + unsigned int nr_elements, gfp_t flags); 65 65 void flex_array_free(struct flex_array *fa); 66 66 void flex_array_free_parts(struct flex_array *fa); 67 67 int flex_array_put(struct flex_array *fa, unsigned int element_nr, void *src,
+1
include/linux/ftrace_event.h
··· 37 37 unsigned char flags; 38 38 unsigned char preempt_count; 39 39 int pid; 40 + int padding; 40 41 }; 41 42 42 43 #define FTRACE_MAX_EVENT \
+2
include/linux/mfd/wm831x/pdata.h
··· 81 81 int rpu; /** Pen down sensitivity resistor divider */ 82 82 int pressure; /** Report pressure (boolean) */ 83 83 unsigned int data_irq; /** Touch data ready IRQ */ 84 + int data_irqf; /** IRQ flags for data ready IRQ */ 84 85 unsigned int pd_irq; /** Touch pendown detect IRQ */ 86 + int pd_irqf; /** IRQ flags for pen down IRQ */ 85 87 }; 86 88 87 89 enum wm831x_watchdog_action {
+23 -1
include/linux/mm.h
··· 1011 1011 int clear_page_dirty_for_io(struct page *page); 1012 1012 1013 1013 /* Is the vma a continuation of the stack vma above it? */ 1014 - static inline int vma_stack_continue(struct vm_area_struct *vma, unsigned long addr) 1014 + static inline int vma_growsdown(struct vm_area_struct *vma, unsigned long addr) 1015 1015 { 1016 1016 return vma && (vma->vm_end == addr) && (vma->vm_flags & VM_GROWSDOWN); 1017 + } 1018 + 1019 + static inline int stack_guard_page_start(struct vm_area_struct *vma, 1020 + unsigned long addr) 1021 + { 1022 + return (vma->vm_flags & VM_GROWSDOWN) && 1023 + (vma->vm_start == addr) && 1024 + !vma_growsdown(vma->vm_prev, addr); 1025 + } 1026 + 1027 + /* Is the vma a continuation of the stack vma below it? */ 1028 + static inline int vma_growsup(struct vm_area_struct *vma, unsigned long addr) 1029 + { 1030 + return vma && (vma->vm_start == addr) && (vma->vm_flags & VM_GROWSUP); 1031 + } 1032 + 1033 + static inline int stack_guard_page_end(struct vm_area_struct *vma, 1034 + unsigned long addr) 1035 + { 1036 + return (vma->vm_flags & VM_GROWSUP) && 1037 + (vma->vm_end == addr) && 1038 + !vma_growsup(vma->vm_next, addr); 1017 1039 } 1018 1040 1019 1041 extern unsigned long move_page_tables(struct vm_area_struct *vma,
-1
include/linux/mmc/host.h
··· 183 183 struct work_struct clk_gate_work; /* delayed clock gate */ 184 184 unsigned int clk_old; /* old clock value cache */ 185 185 spinlock_t clk_lock; /* lock for clk fields */ 186 - struct mutex clk_gate_mutex; /* mutex for clock gating */ 187 186 #endif 188 187 189 188 /* host specific block data */
+1 -1
include/linux/percpu.h
··· 948 948 irqsafe_generic_cpu_cmpxchg_double(pcp1, pcp2, oval1, oval2, nval1, nval2) 949 949 # endif 950 950 # define irqsafe_cpu_cmpxchg_double(pcp1, pcp2, oval1, oval2, nval1, nval2) \ 951 - __pcpu_double_call_return_int(irqsafe_cpu_cmpxchg_double_, (pcp1), (pcp2), (oval1), (oval2), (nval1), (nval2)) 951 + __pcpu_double_call_return_bool(irqsafe_cpu_cmpxchg_double_, (pcp1), (pcp2), (oval1), (oval2), (nval1), (nval2)) 952 952 #endif 953 953 954 954 #endif /* __LINUX_PERCPU_H */
+12 -1
include/linux/ptrace.h
··· 189 189 child->ptrace = current->ptrace; 190 190 __ptrace_link(child, current->parent); 191 191 } 192 + 193 + #ifdef CONFIG_HAVE_HW_BREAKPOINT 194 + atomic_set(&child->ptrace_bp_refcnt, 1); 195 + #endif 192 196 } 193 197 194 198 /** ··· 354 350 unsigned long args[6], unsigned int maxargs, 355 351 unsigned long *sp, unsigned long *pc); 356 352 357 - #endif 353 + #ifdef CONFIG_HAVE_HW_BREAKPOINT 354 + extern int ptrace_get_breakpoints(struct task_struct *tsk); 355 + extern void ptrace_put_breakpoints(struct task_struct *tsk); 356 + #else 357 + static inline void ptrace_put_breakpoints(struct task_struct *tsk) { } 358 + #endif /* CONFIG_HAVE_HW_BREAKPOINT */ 359 + 360 + #endif /* __KERNEL */ 358 361 359 362 #endif
+3
include/linux/sched.h
··· 1537 1537 unsigned long memsw_nr_pages; /* uncharged mem+swap usage */ 1538 1538 } memcg_batch; 1539 1539 #endif 1540 + #ifdef CONFIG_HAVE_HW_BREAKPOINT 1541 + atomic_t ptrace_bp_refcnt; 1542 + #endif 1540 1543 }; 1541 1544 1542 1545 /* Future-safe accessor for struct task_struct's cpus_allowed. */
+1 -1
kernel/exit.c
··· 1016 1016 /* 1017 1017 * FIXME: do that only when needed, using sched_exit tracepoint 1018 1018 */ 1019 - flush_ptrace_hw_breakpoint(tsk); 1019 + ptrace_put_breakpoints(tsk); 1020 1020 1021 1021 exit_notify(tsk, group_dead); 1022 1022 #ifdef CONFIG_NUMA
+1 -1
kernel/irq/proc.c
··· 419 419 } else { 420 420 seq_printf(p, " %8s", "None"); 421 421 } 422 - #ifdef CONFIG_GENIRC_IRQ_SHOW_LEVEL 422 + #ifdef CONFIG_GENERIC_IRQ_SHOW_LEVEL 423 423 seq_printf(p, " %-8s", irqd_is_level_type(&desc->irq_data) ? "Level" : "Edge"); 424 424 #endif 425 425 if (desc->name)
+17
kernel/ptrace.c
··· 22 22 #include <linux/syscalls.h> 23 23 #include <linux/uaccess.h> 24 24 #include <linux/regset.h> 25 + #include <linux/hw_breakpoint.h> 25 26 26 27 27 28 /* ··· 880 879 return ret; 881 880 } 882 881 #endif /* CONFIG_COMPAT */ 882 + 883 + #ifdef CONFIG_HAVE_HW_BREAKPOINT 884 + int ptrace_get_breakpoints(struct task_struct *tsk) 885 + { 886 + if (atomic_inc_not_zero(&tsk->ptrace_bp_refcnt)) 887 + return 0; 888 + 889 + return -1; 890 + } 891 + 892 + void ptrace_put_breakpoints(struct task_struct *tsk) 893 + { 894 + if (atomic_dec_and_test(&tsk->ptrace_bp_refcnt)) 895 + flush_ptrace_hw_breakpoint(tsk); 896 + } 897 + #endif /* CONFIG_HAVE_HW_BREAKPOINT */
+1
kernel/trace/trace.c
··· 1110 1110 1111 1111 entry->preempt_count = pc & 0xff; 1112 1112 entry->pid = (tsk) ? tsk->pid : 0; 1113 + entry->padding = 0; 1113 1114 entry->flags = 1114 1115 #ifdef CONFIG_TRACE_IRQFLAGS_SUPPORT 1115 1116 (irqs_disabled_flags(flags) ? TRACE_FLAG_IRQS_OFF : 0) |
+1
kernel/trace/trace_events.c
··· 116 116 __common_field(unsigned char, flags); 117 117 __common_field(unsigned char, preempt_count); 118 118 __common_field(int, pid); 119 + __common_field(int, padding); 119 120 120 121 return ret; 121 122 }
+18 -6
lib/flex_array.c
··· 232 232 233 233 /** 234 234 * flex_array_prealloc - guarantee that array space exists 235 - * @fa: the flex array for which to preallocate parts 236 - * @start: index of first array element for which space is allocated 237 - * @end: index of last (inclusive) element for which space is allocated 238 - * @flags: page allocation flags 235 + * @fa: the flex array for which to preallocate parts 236 + * @start: index of first array element for which space is allocated 237 + * @nr_elements: number of elements for which space is allocated 238 + * @flags: page allocation flags 239 239 * 240 240 * This will guarantee that no future calls to flex_array_put() 241 241 * will allocate memory. It can be used if you are expecting to ··· 245 245 * Locking must be provided by the caller. 246 246 */ 247 247 int flex_array_prealloc(struct flex_array *fa, unsigned int start, 248 - unsigned int end, gfp_t flags) 248 + unsigned int nr_elements, gfp_t flags) 249 249 { 250 250 int start_part; 251 251 int end_part; 252 252 int part_nr; 253 + unsigned int end; 253 254 struct flex_array_part *part; 254 255 255 - if (start >= fa->total_nr_elements || end >= fa->total_nr_elements) 256 + if (!start && !nr_elements) 257 + return 0; 258 + if (start >= fa->total_nr_elements) 259 + return -ENOSPC; 260 + if (!nr_elements) 261 + return 0; 262 + 263 + end = start + nr_elements - 1; 264 + 265 + if (end >= fa->total_nr_elements) 256 266 return -ENOSPC; 257 267 if (elements_fit_in_base(fa)) 258 268 return 0; ··· 353 343 int part_nr; 354 344 int ret = 0; 355 345 346 + if (!fa->total_nr_elements) 347 + return 0; 356 348 if (elements_fit_in_base(fa)) 357 349 return ret; 358 350 for (part_nr = 0; part_nr < FLEX_ARRAY_NR_BASE_PTRS; part_nr++) {
+8 -11
mm/memory.c
··· 1359 1359 */ 1360 1360 mark_page_accessed(page); 1361 1361 } 1362 - if (flags & FOLL_MLOCK) { 1362 + if ((flags & FOLL_MLOCK) && (vma->vm_flags & VM_LOCKED)) { 1363 1363 /* 1364 1364 * The preliminary mapping check is mainly to avoid the 1365 1365 * pointless overhead of lock_page on the ZERO_PAGE ··· 1412 1412 1413 1413 static inline int stack_guard_page(struct vm_area_struct *vma, unsigned long addr) 1414 1414 { 1415 - return (vma->vm_flags & VM_GROWSDOWN) && 1416 - (vma->vm_start == addr) && 1417 - !vma_stack_continue(vma->vm_prev, addr); 1415 + return stack_guard_page_start(vma, addr) || 1416 + stack_guard_page_end(vma, addr+PAGE_SIZE); 1418 1417 } 1419 1418 1420 1419 /** ··· 1550 1551 continue; 1551 1552 } 1552 1553 1553 - /* 1554 - * If we don't actually want the page itself, 1555 - * and it's the stack guard page, just skip it. 1556 - */ 1557 - if (!pages && stack_guard_page(vma, start)) 1558 - goto next_page; 1559 - 1560 1554 do { 1561 1555 struct page *page; 1562 1556 unsigned int foll_flags = gup_flags; ··· 1566 1574 int ret; 1567 1575 unsigned int fault_flags = 0; 1568 1576 1577 + /* For mlock, just skip the stack guard page. */ 1578 + if (foll_flags & FOLL_MLOCK) { 1579 + if (stack_guard_page(vma, start)) 1580 + goto next_page; 1581 + } 1569 1582 if (foll_flags & FOLL_WRITE) 1570 1583 fault_flags |= FAULT_FLAG_WRITE; 1571 1584 if (nonblocking)
+1 -4
mm/mlock.c
··· 162 162 VM_BUG_ON(end > vma->vm_end); 163 163 VM_BUG_ON(!rwsem_is_locked(&mm->mmap_sem)); 164 164 165 - gup_flags = FOLL_TOUCH; 165 + gup_flags = FOLL_TOUCH | FOLL_MLOCK; 166 166 /* 167 167 * We want to touch writable mappings with a write fault in order 168 168 * to break COW, except for shared mappings because these don't COW ··· 177 177 */ 178 178 if (vma->vm_flags & (VM_READ | VM_WRITE | VM_EXEC)) 179 179 gup_flags |= FOLL_FORCE; 180 - 181 - if (vma->vm_flags & VM_LOCKED) 182 - gup_flags |= FOLL_MLOCK; 183 180 184 181 return __get_user_pages(current, mm, addr, nr_pages, gup_flags, 185 182 NULL, NULL, nonblocking);
+7 -4
mm/mmap.c
··· 1767 1767 size = address - vma->vm_start; 1768 1768 grow = (address - vma->vm_end) >> PAGE_SHIFT; 1769 1769 1770 - error = acct_stack_growth(vma, size, grow); 1771 - if (!error) { 1772 - vma->vm_end = address; 1773 - perf_event_mmap(vma); 1770 + error = -ENOMEM; 1771 + if (vma->vm_pgoff + (size >> PAGE_SHIFT) >= vma->vm_pgoff) { 1772 + error = acct_stack_growth(vma, size, grow); 1773 + if (!error) { 1774 + vma->vm_end = address; 1775 + perf_event_mmap(vma); 1776 + } 1774 1777 } 1775 1778 } 1776 1779 vma_unlock_anon_vma(vma);
+2 -2
mm/slub.c
··· 1940 1940 * Since this is without lock semantics the protection is only against 1941 1941 * code executing on this cpu *not* from access by other cpus. 1942 1942 */ 1943 - if (unlikely(!this_cpu_cmpxchg_double( 1943 + if (unlikely(!irqsafe_cpu_cmpxchg_double( 1944 1944 s->cpu_slab->freelist, s->cpu_slab->tid, 1945 1945 object, tid, 1946 1946 get_freepointer(s, object), next_tid(tid)))) { ··· 2145 2145 set_freepointer(s, object, c->freelist); 2146 2146 2147 2147 #ifdef CONFIG_CMPXCHG_LOCAL 2148 - if (unlikely(!this_cpu_cmpxchg_double( 2148 + if (unlikely(!irqsafe_cpu_cmpxchg_double( 2149 2149 s->cpu_slab->freelist, s->cpu_slab->tid, 2150 2150 c->freelist, tid, 2151 2151 object, next_tid(tid)))) {
+13 -13
net/ceph/messenger.c
··· 2267 2267 m->more_to_follow = false; 2268 2268 m->pool = NULL; 2269 2269 2270 + /* middle */ 2271 + m->middle = NULL; 2272 + 2273 + /* data */ 2274 + m->nr_pages = 0; 2275 + m->page_alignment = 0; 2276 + m->pages = NULL; 2277 + m->pagelist = NULL; 2278 + m->bio = NULL; 2279 + m->bio_iter = NULL; 2280 + m->bio_seg = 0; 2281 + m->trail = NULL; 2282 + 2270 2283 /* front */ 2271 2284 if (front_len) { 2272 2285 if (front_len > PAGE_CACHE_SIZE) { ··· 2298 2285 m->front.iov_base = NULL; 2299 2286 } 2300 2287 m->front.iov_len = front_len; 2301 - 2302 - /* middle */ 2303 - m->middle = NULL; 2304 - 2305 - /* data */ 2306 - m->nr_pages = 0; 2307 - m->page_alignment = 0; 2308 - m->pages = NULL; 2309 - m->pagelist = NULL; 2310 - m->bio = NULL; 2311 - m->bio_iter = NULL; 2312 - m->bio_seg = 0; 2313 - m->trail = NULL; 2314 2288 2315 2289 dout("ceph_msg_new %p front %d\n", m, front_len); 2316 2290 return m;
+2 -2
net/ceph/osd_client.c
··· 470 470 snapc, ops, 471 471 use_mempool, 472 472 GFP_NOFS, NULL, NULL); 473 - if (IS_ERR(req)) 474 - return req; 473 + if (!req) 474 + return NULL; 475 475 476 476 /* calculate max write size */ 477 477 calc_layout(osdc, vino, layout, off, plen, req, ops);
+2 -1
security/selinux/hooks.c
··· 1578 1578 return rc; 1579 1579 1580 1580 if (!newsid || !(sbsec->flags & SE_SBLABELSUPP)) { 1581 - rc = security_transition_sid(sid, dsec->sid, tclass, NULL, &newsid); 1581 + rc = security_transition_sid(sid, dsec->sid, tclass, 1582 + &dentry->d_name, &newsid); 1582 1583 if (rc) 1583 1584 return rc; 1584 1585 }
+3 -3
security/selinux/ss/policydb.c
··· 502 502 goto out; 503 503 504 504 rc = flex_array_prealloc(p->type_val_to_struct_array, 0, 505 - p->p_types.nprim - 1, GFP_KERNEL | __GFP_ZERO); 505 + p->p_types.nprim, GFP_KERNEL | __GFP_ZERO); 506 506 if (rc) 507 507 goto out; 508 508 ··· 519 519 goto out; 520 520 521 521 rc = flex_array_prealloc(p->sym_val_to_name[i], 522 - 0, p->symtab[i].nprim - 1, 522 + 0, p->symtab[i].nprim, 523 523 GFP_KERNEL | __GFP_ZERO); 524 524 if (rc) 525 525 goto out; ··· 2375 2375 goto bad; 2376 2376 2377 2377 /* preallocate so we don't have to worry about the put ever failing */ 2378 - rc = flex_array_prealloc(p->type_attr_map_array, 0, p->p_types.nprim - 1, 2378 + rc = flex_array_prealloc(p->type_attr_map_array, 0, p->p_types.nprim, 2379 2379 GFP_KERNEL | __GFP_ZERO); 2380 2380 if (rc) 2381 2381 goto bad;
+12 -7
sound/soc/davinci/davinci-mcasp.c
··· 434 434 mcasp_set_bits(base + DAVINCI_MCASP_ACLKRCTL_REG, ACLKRE); 435 435 mcasp_set_bits(base + DAVINCI_MCASP_RXFMCTL_REG, AFSRE); 436 436 437 - mcasp_set_bits(base + DAVINCI_MCASP_PDIR_REG, (0x7 << 26)); 437 + mcasp_set_bits(base + DAVINCI_MCASP_PDIR_REG, 438 + ACLKX | AHCLKX | AFSX); 438 439 break; 439 440 case SND_SOC_DAIFMT_CBM_CFS: 440 441 /* codec is clock master and frame slave */ 441 - mcasp_set_bits(base + DAVINCI_MCASP_ACLKXCTL_REG, ACLKXE); 442 + mcasp_clr_bits(base + DAVINCI_MCASP_ACLKXCTL_REG, ACLKXE); 442 443 mcasp_set_bits(base + DAVINCI_MCASP_TXFMCTL_REG, AFSXE); 443 444 444 - mcasp_set_bits(base + DAVINCI_MCASP_ACLKRCTL_REG, ACLKRE); 445 + mcasp_clr_bits(base + DAVINCI_MCASP_ACLKRCTL_REG, ACLKRE); 445 446 mcasp_set_bits(base + DAVINCI_MCASP_RXFMCTL_REG, AFSRE); 446 447 447 - mcasp_set_bits(base + DAVINCI_MCASP_PDIR_REG, (0x2d << 26)); 448 + mcasp_clr_bits(base + DAVINCI_MCASP_PDIR_REG, 449 + ACLKX | ACLKR); 450 + mcasp_set_bits(base + DAVINCI_MCASP_PDIR_REG, 451 + AFSX | AFSR); 448 452 break; 449 453 case SND_SOC_DAIFMT_CBM_CFM: 450 454 /* codec is clock and frame master */ ··· 458 454 mcasp_clr_bits(base + DAVINCI_MCASP_ACLKRCTL_REG, ACLKRE); 459 455 mcasp_clr_bits(base + DAVINCI_MCASP_RXFMCTL_REG, AFSRE); 460 456 461 - mcasp_clr_bits(base + DAVINCI_MCASP_PDIR_REG, (0x3f << 26)); 457 + mcasp_clr_bits(base + DAVINCI_MCASP_PDIR_REG, 458 + ACLKX | AHCLKX | AFSX | ACLKR | AHCLKR | AFSR); 462 459 break; 463 460 464 461 default: ··· 649 644 mcasp_set_reg(dev->base + DAVINCI_MCASP_TXTDM_REG, mask); 650 645 mcasp_set_bits(dev->base + DAVINCI_MCASP_TXFMT_REG, TXORD); 651 646 652 - if ((dev->tdm_slots >= 2) || (dev->tdm_slots <= 32)) 647 + if ((dev->tdm_slots >= 2) && (dev->tdm_slots <= 32)) 653 648 mcasp_mod_bits(dev->base + DAVINCI_MCASP_TXFMCTL_REG, 654 649 FSXMOD(dev->tdm_slots), FSXMOD(0x1FF)); 655 650 else ··· 665 660 AHCLKRE); 666 661 mcasp_set_reg(dev->base + DAVINCI_MCASP_RXTDM_REG, mask); 667 662 668 - if ((dev->tdm_slots >= 2) || (dev->tdm_slots <= 32)) 663 + if ((dev->tdm_slots >= 2) && (dev->tdm_slots <= 32)) 669 664 mcasp_mod_bits(dev->base + DAVINCI_MCASP_RXFMCTL_REG, 670 665 FSRMOD(dev->tdm_slots), FSRMOD(0x1FF)); 671 666 else
+4 -4
sound/soc/samsung/goni_wm8994.c
··· 236 236 .name = "WM8994", 237 237 .stream_name = "WM8994 HiFi", 238 238 .cpu_dai_name = "samsung-i2s.0", 239 - .codec_dai_name = "wm8994-hifi", 239 + .codec_dai_name = "wm8994-aif1", 240 240 .platform_name = "samsung-audio", 241 - .codec_name = "wm8994-codec.0-0x1a", 241 + .codec_name = "wm8994-codec.0-001a", 242 242 .init = goni_wm8994_init, 243 243 .ops = &goni_hifi_ops, 244 244 }, { 245 245 .name = "WM8994 Voice", 246 246 .stream_name = "Voice", 247 247 .cpu_dai_name = "goni-voice-dai", 248 - .codec_dai_name = "wm8994-voice", 248 + .codec_dai_name = "wm8994-aif2", 249 249 .platform_name = "samsung-audio", 250 - .codec_name = "wm8994-codec.0-0x1a", 250 + .codec_name = "wm8994-codec.0-001a", 251 251 .ops = &goni_voice_ops, 252 252 }, 253 253 };
+10 -6
tools/perf/Makefile
··· 35 35 -e s/ppc.*/powerpc/ -e s/mips.*/mips/ \ 36 36 -e s/sh[234].*/sh/ ) 37 37 38 + CC = $(CROSS_COMPILE)gcc 39 + AR = $(CROSS_COMPILE)ar 40 + 38 41 # Additional ARCH settings for x86 39 42 ifeq ($(ARCH),i386) 40 43 ARCH := x86 41 44 endif 42 45 ifeq ($(ARCH),x86_64) 43 - RAW_ARCH := x86_64 44 - ARCH := x86 45 - ARCH_CFLAGS := -DARCH_X86_64 46 - ARCH_INCLUDE = ../../arch/x86/lib/memcpy_64.S 46 + ARCH := x86 47 + IS_X86_64 := $(shell echo __x86_64__ | ${CC} -E -xc - | tail -n 1) 48 + ifeq (${IS_X86_64}, 1) 49 + RAW_ARCH := x86_64 50 + ARCH_CFLAGS := -DARCH_X86_64 51 + ARCH_INCLUDE = ../../arch/x86/lib/memcpy_64.S 52 + endif 47 53 endif 48 54 49 55 # ··· 125 119 126 120 export prefix bindir sharedir sysconfdir 127 121 128 - CC = $(CROSS_COMPILE)gcc 129 - AR = $(CROSS_COMPILE)ar 130 122 RM = rm -f 131 123 MKDIR = mkdir 132 124 FIND = find