diff options
155 files changed, 1545 insertions, 3272 deletions
diff --git a/Documentation/arm/Samsung/Overview.txt b/Documentation/arm/Samsung/Overview.txt index c3094ea51aa7..658abb258cef 100644 --- a/Documentation/arm/Samsung/Overview.txt +++ b/Documentation/arm/Samsung/Overview.txt | |||
@@ -14,7 +14,6 @@ Introduction | |||
14 | - S3C24XX: See Documentation/arm/Samsung-S3C24XX/Overview.txt for full list | 14 | - S3C24XX: See Documentation/arm/Samsung-S3C24XX/Overview.txt for full list |
15 | - S3C64XX: S3C6400 and S3C6410 | 15 | - S3C64XX: S3C6400 and S3C6410 |
16 | - S5P6440 | 16 | - S5P6440 |
17 | - S5P6442 | ||
18 | - S5PC100 | 17 | - S5PC100 |
19 | - S5PC110 / S5PV210 | 18 | - S5PC110 / S5PV210 |
20 | 19 | ||
@@ -36,7 +35,6 @@ Configuration | |||
36 | unifying all the SoCs into one kernel. | 35 | unifying all the SoCs into one kernel. |
37 | 36 | ||
38 | s5p6440_defconfig - S5P6440 specific default configuration | 37 | s5p6440_defconfig - S5P6440 specific default configuration |
39 | s5p6442_defconfig - S5P6442 specific default configuration | ||
40 | s5pc100_defconfig - S5PC100 specific default configuration | 38 | s5pc100_defconfig - S5PC100 specific default configuration |
41 | s5pc110_defconfig - S5PC110 specific default configuration | 39 | s5pc110_defconfig - S5PC110 specific default configuration |
42 | s5pv210_defconfig - S5PV210 specific default configuration | 40 | s5pv210_defconfig - S5PV210 specific default configuration |
diff --git a/Documentation/flexible-arrays.txt b/Documentation/flexible-arrays.txt index cb8a3a00cc92..df904aec9904 100644 --- a/Documentation/flexible-arrays.txt +++ b/Documentation/flexible-arrays.txt | |||
@@ -66,10 +66,10 @@ trick is to ensure that any needed memory allocations are done before | |||
66 | entering atomic context, using: | 66 | entering atomic context, using: |
67 | 67 | ||
68 | int flex_array_prealloc(struct flex_array *array, unsigned int start, | 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 | This function will ensure that memory for the elements indexed in the range | 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 | flex_array_put() call on an element in that range is guaranteed not to | 73 | flex_array_put() call on an element in that range is guaranteed not to |
74 | block. | 74 | block. |
75 | 75 | ||
@@ -1,7 +1,7 @@ | |||
1 | VERSION = 2 | 1 | VERSION = 2 |
2 | PATCHLEVEL = 6 | 2 | PATCHLEVEL = 6 |
3 | SUBLEVEL = 39 | 3 | SUBLEVEL = 39 |
4 | EXTRAVERSION = -rc6 | 4 | EXTRAVERSION = -rc7 |
5 | NAME = Flesh-Eating Bats with Fangs | 5 | NAME = Flesh-Eating Bats with Fangs |
6 | 6 | ||
7 | # *DOCUMENTATION* | 7 | # *DOCUMENTATION* |
diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig index 377a7a595b08..e81c72c38fed 100644 --- a/arch/arm/Kconfig +++ b/arch/arm/Kconfig | |||
@@ -736,16 +736,6 @@ config ARCH_S5P64X0 | |||
736 | Samsung S5P64X0 CPU based systems, such as the Samsung SMDK6440, | 736 | Samsung S5P64X0 CPU based systems, such as the Samsung SMDK6440, |
737 | SMDK6450. | 737 | SMDK6450. |
738 | 738 | ||
739 | config ARCH_S5P6442 | ||
740 | bool "Samsung S5P6442" | ||
741 | select CPU_V6 | ||
742 | select GENERIC_GPIO | ||
743 | select HAVE_CLK | ||
744 | select ARCH_USES_GETTIMEOFFSET | ||
745 | select HAVE_S3C2410_WATCHDOG if WATCHDOG | ||
746 | help | ||
747 | Samsung S5P6442 CPU based systems | ||
748 | |||
749 | config ARCH_S5PC100 | 739 | config ARCH_S5PC100 |
750 | bool "Samsung S5PC100" | 740 | bool "Samsung S5PC100" |
751 | select GENERIC_GPIO | 741 | select GENERIC_GPIO |
@@ -995,8 +985,6 @@ endif | |||
995 | 985 | ||
996 | source "arch/arm/mach-s5p64x0/Kconfig" | 986 | source "arch/arm/mach-s5p64x0/Kconfig" |
997 | 987 | ||
998 | source "arch/arm/mach-s5p6442/Kconfig" | ||
999 | |||
1000 | source "arch/arm/mach-s5pc100/Kconfig" | 988 | source "arch/arm/mach-s5pc100/Kconfig" |
1001 | 989 | ||
1002 | source "arch/arm/mach-s5pv210/Kconfig" | 990 | source "arch/arm/mach-s5pv210/Kconfig" |
@@ -1424,7 +1412,7 @@ source kernel/Kconfig.preempt | |||
1424 | config HZ | 1412 | config HZ |
1425 | int | 1413 | int |
1426 | default 200 if ARCH_EBSA110 || ARCH_S3C2410 || ARCH_S5P64X0 || \ | 1414 | default 200 if ARCH_EBSA110 || ARCH_S3C2410 || ARCH_S5P64X0 || \ |
1427 | ARCH_S5P6442 || ARCH_S5PV210 || ARCH_EXYNOS4 | 1415 | ARCH_S5PV210 || ARCH_EXYNOS4 |
1428 | default OMAP_32K_TIMER_HZ if ARCH_OMAP && OMAP_32K_TIMER | 1416 | default OMAP_32K_TIMER_HZ if ARCH_OMAP && OMAP_32K_TIMER |
1429 | default AT91_TIMER_HZ if ARCH_AT91 | 1417 | default AT91_TIMER_HZ if ARCH_AT91 |
1430 | default SHMOBILE_TIMER_HZ if ARCH_SHMOBILE | 1418 | default SHMOBILE_TIMER_HZ if ARCH_SHMOBILE |
@@ -2010,7 +1998,7 @@ menu "Power management options" | |||
2010 | source "kernel/power/Kconfig" | 1998 | source "kernel/power/Kconfig" |
2011 | 1999 | ||
2012 | config ARCH_SUSPEND_POSSIBLE | 2000 | config ARCH_SUSPEND_POSSIBLE |
2013 | depends on !ARCH_S5P64X0 && !ARCH_S5P6442 | 2001 | depends on !ARCH_S5P64X0 |
2014 | depends on CPU_ARM920T || CPU_ARM926T || CPU_SA1100 || \ | 2002 | depends on CPU_ARM920T || CPU_ARM926T || CPU_SA1100 || \ |
2015 | CPU_V6 || CPU_V6K || CPU_V7 || CPU_XSC3 || CPU_XSCALE | 2003 | CPU_V6 || CPU_V6K || CPU_V7 || CPU_XSC3 || CPU_XSCALE |
2016 | def_bool y | 2004 | def_bool y |
diff --git a/arch/arm/Makefile b/arch/arm/Makefile index c7d321a3d95d..c17304bf940b 100644 --- a/arch/arm/Makefile +++ b/arch/arm/Makefile | |||
@@ -178,7 +178,6 @@ machine-$(CONFIG_ARCH_S3C2410) := s3c2410 s3c2400 s3c2412 s3c2416 s3c2440 s3c24 | |||
178 | machine-$(CONFIG_ARCH_S3C24A0) := s3c24a0 | 178 | machine-$(CONFIG_ARCH_S3C24A0) := s3c24a0 |
179 | machine-$(CONFIG_ARCH_S3C64XX) := s3c64xx | 179 | machine-$(CONFIG_ARCH_S3C64XX) := s3c64xx |
180 | machine-$(CONFIG_ARCH_S5P64X0) := s5p64x0 | 180 | machine-$(CONFIG_ARCH_S5P64X0) := s5p64x0 |
181 | machine-$(CONFIG_ARCH_S5P6442) := s5p6442 | ||
182 | machine-$(CONFIG_ARCH_S5PC100) := s5pc100 | 181 | machine-$(CONFIG_ARCH_S5PC100) := s5pc100 |
183 | machine-$(CONFIG_ARCH_S5PV210) := s5pv210 | 182 | machine-$(CONFIG_ARCH_S5PV210) := s5pv210 |
184 | machine-$(CONFIG_ARCH_EXYNOS4) := exynos4 | 183 | machine-$(CONFIG_ARCH_EXYNOS4) := exynos4 |
diff --git a/arch/arm/common/Kconfig b/arch/arm/common/Kconfig index ea5ee4d067f3..4b71766fb21d 100644 --- a/arch/arm/common/Kconfig +++ b/arch/arm/common/Kconfig | |||
@@ -7,7 +7,7 @@ config ARM_VIC | |||
7 | config ARM_VIC_NR | 7 | config ARM_VIC_NR |
8 | int | 8 | int |
9 | default 4 if ARCH_S5PV210 | 9 | default 4 if ARCH_S5PV210 |
10 | default 3 if ARCH_S5P6442 || ARCH_S5PC100 | 10 | default 3 if ARCH_S5PC100 |
11 | default 2 | 11 | default 2 |
12 | depends on ARM_VIC | 12 | depends on ARM_VIC |
13 | help | 13 | help |
diff --git a/arch/arm/configs/at91x40_defconfig b/arch/arm/configs/at91x40_defconfig new file mode 100644 index 000000000000..c55e9212fcbb --- /dev/null +++ b/arch/arm/configs/at91x40_defconfig | |||
@@ -0,0 +1,48 @@ | |||
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 | ||
diff --git a/arch/arm/configs/s5p6442_defconfig b/arch/arm/configs/s5p6442_defconfig deleted file mode 100644 index 0e92a784af66..000000000000 --- a/arch/arm/configs/s5p6442_defconfig +++ /dev/null | |||
@@ -1,65 +0,0 @@ | |||
1 | CONFIG_EXPERIMENTAL=y | ||
2 | CONFIG_SYSFS_DEPRECATED_V2=y | ||
3 | CONFIG_BLK_DEV_INITRD=y | ||
4 | CONFIG_KALLSYMS_ALL=y | ||
5 | CONFIG_MODULES=y | ||
6 | CONFIG_MODULE_UNLOAD=y | ||
7 | # CONFIG_BLK_DEV_BSG is not set | ||
8 | CONFIG_ARCH_S5P6442=y | ||
9 | CONFIG_S3C_LOWLEVEL_UART_PORT=1 | ||
10 | CONFIG_MACH_SMDK6442=y | ||
11 | CONFIG_CPU_32v6K=y | ||
12 | CONFIG_AEABI=y | ||
13 | CONFIG_CMDLINE="root=/dev/ram0 rw ramdisk=8192 initrd=0x20800000,8M console=ttySAC1,115200 init=/linuxrc" | ||
14 | CONFIG_FPE_NWFPE=y | ||
15 | CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug" | ||
16 | # CONFIG_PREVENT_FIRMWARE_BUILD is not set | ||
17 | CONFIG_BLK_DEV_LOOP=y | ||
18 | CONFIG_BLK_DEV_RAM=y | ||
19 | CONFIG_BLK_DEV_RAM_SIZE=8192 | ||
20 | # CONFIG_MISC_DEVICES is not set | ||
21 | CONFIG_SCSI=y | ||
22 | CONFIG_BLK_DEV_SD=y | ||
23 | CONFIG_CHR_DEV_SG=y | ||
24 | CONFIG_INPUT_EVDEV=y | ||
25 | # CONFIG_INPUT_KEYBOARD is not set | ||
26 | # CONFIG_INPUT_MOUSE is not set | ||
27 | CONFIG_INPUT_TOUCHSCREEN=y | ||
28 | CONFIG_SERIAL_8250=y | ||
29 | CONFIG_SERIAL_8250_NR_UARTS=3 | ||
30 | CONFIG_SERIAL_SAMSUNG=y | ||
31 | CONFIG_SERIAL_SAMSUNG_CONSOLE=y | ||
32 | CONFIG_HW_RANDOM=y | ||
33 | # CONFIG_HWMON is not set | ||
34 | # CONFIG_VGA_CONSOLE is not set | ||
35 | # CONFIG_HID_SUPPORT is not set | ||
36 | # CONFIG_USB_SUPPORT is not set | ||
37 | CONFIG_EXT2_FS=y | ||
38 | CONFIG_INOTIFY=y | ||
39 | CONFIG_MSDOS_FS=y | ||
40 | CONFIG_VFAT_FS=y | ||
41 | CONFIG_TMPFS=y | ||
42 | CONFIG_TMPFS_POSIX_ACL=y | ||
43 | CONFIG_CRAMFS=y | ||
44 | CONFIG_ROMFS_FS=y | ||
45 | CONFIG_PARTITION_ADVANCED=y | ||
46 | CONFIG_BSD_DISKLABEL=y | ||
47 | CONFIG_SOLARIS_X86_PARTITION=y | ||
48 | CONFIG_NLS_CODEPAGE_437=y | ||
49 | CONFIG_NLS_ASCII=y | ||
50 | CONFIG_NLS_ISO8859_1=y | ||
51 | CONFIG_MAGIC_SYSRQ=y | ||
52 | CONFIG_DEBUG_KERNEL=y | ||
53 | CONFIG_DEBUG_RT_MUTEXES=y | ||
54 | CONFIG_DEBUG_SPINLOCK=y | ||
55 | CONFIG_DEBUG_MUTEXES=y | ||
56 | CONFIG_DEBUG_SPINLOCK_SLEEP=y | ||
57 | CONFIG_DEBUG_INFO=y | ||
58 | # CONFIG_RCU_CPU_STALL_DETECTOR is not set | ||
59 | CONFIG_SYSCTL_SYSCALL_CHECK=y | ||
60 | # CONFIG_ARM_UNWIND is not set | ||
61 | CONFIG_DEBUG_USER=y | ||
62 | CONFIG_DEBUG_ERRORS=y | ||
63 | CONFIG_DEBUG_LL=y | ||
64 | CONFIG_DEBUG_S3C_UART=1 | ||
65 | CONFIG_CRC_CCITT=y | ||
diff --git a/arch/arm/kernel/ptrace.c b/arch/arm/kernel/ptrace.c index 2bf27f364d09..8182f45ca493 100644 --- a/arch/arm/kernel/ptrace.c +++ b/arch/arm/kernel/ptrace.c | |||
@@ -767,12 +767,20 @@ long arch_ptrace(struct task_struct *child, long request, | |||
767 | 767 | ||
768 | #ifdef CONFIG_HAVE_HW_BREAKPOINT | 768 | #ifdef CONFIG_HAVE_HW_BREAKPOINT |
769 | case PTRACE_GETHBPREGS: | 769 | case PTRACE_GETHBPREGS: |
770 | if (ptrace_get_breakpoints(child) < 0) | ||
771 | return -ESRCH; | ||
772 | |||
770 | ret = ptrace_gethbpregs(child, addr, | 773 | ret = ptrace_gethbpregs(child, addr, |
771 | (unsigned long __user *)data); | 774 | (unsigned long __user *)data); |
775 | ptrace_put_breakpoints(child); | ||
772 | break; | 776 | break; |
773 | case PTRACE_SETHBPREGS: | 777 | case PTRACE_SETHBPREGS: |
778 | if (ptrace_get_breakpoints(child) < 0) | ||
779 | return -ESRCH; | ||
780 | |||
774 | ret = ptrace_sethbpregs(child, addr, | 781 | ret = ptrace_sethbpregs(child, addr, |
775 | (unsigned long __user *)data); | 782 | (unsigned long __user *)data); |
783 | ptrace_put_breakpoints(child); | ||
776 | break; | 784 | break; |
777 | #endif | 785 | #endif |
778 | 786 | ||
diff --git a/arch/arm/mach-at91/Kconfig b/arch/arm/mach-at91/Kconfig index 19390231a0e9..2d299bf5d72f 100644 --- a/arch/arm/mach-at91/Kconfig +++ b/arch/arm/mach-at91/Kconfig | |||
@@ -83,6 +83,7 @@ config ARCH_AT91CAP9 | |||
83 | select CPU_ARM926T | 83 | select CPU_ARM926T |
84 | select GENERIC_CLOCKEVENTS | 84 | select GENERIC_CLOCKEVENTS |
85 | select HAVE_FB_ATMEL | 85 | select HAVE_FB_ATMEL |
86 | select HAVE_NET_MACB | ||
86 | 87 | ||
87 | config ARCH_AT572D940HF | 88 | config ARCH_AT572D940HF |
88 | bool "AT572D940HF" | 89 | bool "AT572D940HF" |
diff --git a/arch/arm/mach-at91/board-eb01.c b/arch/arm/mach-at91/board-eb01.c index 1f9d3cb64c50..d8df59a3426d 100644 --- a/arch/arm/mach-at91/board-eb01.c +++ b/arch/arm/mach-at91/board-eb01.c | |||
@@ -30,6 +30,11 @@ | |||
30 | #include <mach/board.h> | 30 | #include <mach/board.h> |
31 | #include "generic.h" | 31 | #include "generic.h" |
32 | 32 | ||
33 | static void __init at91eb01_init_irq(void) | ||
34 | { | ||
35 | at91x40_init_interrupts(NULL); | ||
36 | } | ||
37 | |||
33 | static void __init at91eb01_map_io(void) | 38 | static void __init at91eb01_map_io(void) |
34 | { | 39 | { |
35 | at91x40_initialize(40000000); | 40 | at91x40_initialize(40000000); |
@@ -38,7 +43,7 @@ static void __init at91eb01_map_io(void) | |||
38 | MACHINE_START(AT91EB01, "Atmel AT91 EB01") | 43 | MACHINE_START(AT91EB01, "Atmel AT91 EB01") |
39 | /* Maintainer: Greg Ungerer <gerg@snapgear.com> */ | 44 | /* Maintainer: Greg Ungerer <gerg@snapgear.com> */ |
40 | .timer = &at91x40_timer, | 45 | .timer = &at91x40_timer, |
41 | .init_irq = at91x40_init_interrupts, | 46 | .init_irq = at91eb01_init_irq, |
42 | .map_io = at91eb01_map_io, | 47 | .map_io = at91eb01_map_io, |
43 | MACHINE_END | 48 | MACHINE_END |
44 | 49 | ||
diff --git a/arch/arm/mach-at91/include/mach/cpu.h b/arch/arm/mach-at91/include/mach/cpu.h index 3bef931d0b1c..0700f2125305 100644 --- a/arch/arm/mach-at91/include/mach/cpu.h +++ b/arch/arm/mach-at91/include/mach/cpu.h | |||
@@ -27,6 +27,7 @@ | |||
27 | #define ARCH_ID_AT91SAM9G45 0x819b05a0 | 27 | #define ARCH_ID_AT91SAM9G45 0x819b05a0 |
28 | #define ARCH_ID_AT91SAM9G45MRL 0x819b05a2 /* aka 9G45-ES2 & non ES lots */ | 28 | #define ARCH_ID_AT91SAM9G45MRL 0x819b05a2 /* aka 9G45-ES2 & non ES lots */ |
29 | #define ARCH_ID_AT91SAM9G45ES 0x819b05a1 /* 9G45-ES (Engineering Sample) */ | 29 | #define ARCH_ID_AT91SAM9G45ES 0x819b05a1 /* 9G45-ES (Engineering Sample) */ |
30 | #define ARCH_ID_AT91SAM9X5 0x819a05a0 | ||
30 | #define ARCH_ID_AT91CAP9 0x039A03A0 | 31 | #define ARCH_ID_AT91CAP9 0x039A03A0 |
31 | 32 | ||
32 | #define ARCH_ID_AT91SAM9XE128 0x329973a0 | 33 | #define ARCH_ID_AT91SAM9XE128 0x329973a0 |
@@ -55,6 +56,12 @@ static inline unsigned long at91_cpu_fully_identify(void) | |||
55 | #define ARCH_EXID_AT91SAM9G46 0x00000003 | 56 | #define ARCH_EXID_AT91SAM9G46 0x00000003 |
56 | #define ARCH_EXID_AT91SAM9G45 0x00000004 | 57 | #define ARCH_EXID_AT91SAM9G45 0x00000004 |
57 | 58 | ||
59 | #define ARCH_EXID_AT91SAM9G15 0x00000000 | ||
60 | #define ARCH_EXID_AT91SAM9G35 0x00000001 | ||
61 | #define ARCH_EXID_AT91SAM9X35 0x00000002 | ||
62 | #define ARCH_EXID_AT91SAM9G25 0x00000003 | ||
63 | #define ARCH_EXID_AT91SAM9X25 0x00000004 | ||
64 | |||
58 | static inline unsigned long at91_exid_identify(void) | 65 | static inline unsigned long at91_exid_identify(void) |
59 | { | 66 | { |
60 | return at91_sys_read(AT91_DBGU_EXID); | 67 | return at91_sys_read(AT91_DBGU_EXID); |
@@ -143,6 +150,27 @@ static inline unsigned long at91cap9_rev_identify(void) | |||
143 | #define cpu_is_at91sam9m11() (0) | 150 | #define cpu_is_at91sam9m11() (0) |
144 | #endif | 151 | #endif |
145 | 152 | ||
153 | #ifdef CONFIG_ARCH_AT91SAM9X5 | ||
154 | #define cpu_is_at91sam9x5() (at91_cpu_identify() == ARCH_ID_AT91SAM9X5) | ||
155 | #define cpu_is_at91sam9g15() (cpu_is_at91sam9x5() && \ | ||
156 | (at91_exid_identify() == ARCH_EXID_AT91SAM9G15)) | ||
157 | #define cpu_is_at91sam9g35() (cpu_is_at91sam9x5() && \ | ||
158 | (at91_exid_identify() == ARCH_EXID_AT91SAM9G35)) | ||
159 | #define cpu_is_at91sam9x35() (cpu_is_at91sam9x5() && \ | ||
160 | (at91_exid_identify() == ARCH_EXID_AT91SAM9X35)) | ||
161 | #define cpu_is_at91sam9g25() (cpu_is_at91sam9x5() && \ | ||
162 | (at91_exid_identify() == ARCH_EXID_AT91SAM9G25)) | ||
163 | #define cpu_is_at91sam9x25() (cpu_is_at91sam9x5() && \ | ||
164 | (at91_exid_identify() == ARCH_EXID_AT91SAM9X25)) | ||
165 | #else | ||
166 | #define cpu_is_at91sam9x5() (0) | ||
167 | #define cpu_is_at91sam9g15() (0) | ||
168 | #define cpu_is_at91sam9g35() (0) | ||
169 | #define cpu_is_at91sam9x35() (0) | ||
170 | #define cpu_is_at91sam9g25() (0) | ||
171 | #define cpu_is_at91sam9x25() (0) | ||
172 | #endif | ||
173 | |||
146 | #ifdef CONFIG_ARCH_AT91CAP9 | 174 | #ifdef CONFIG_ARCH_AT91CAP9 |
147 | #define cpu_is_at91cap9() (at91_cpu_identify() == ARCH_ID_AT91CAP9) | 175 | #define cpu_is_at91cap9() (at91_cpu_identify() == ARCH_ID_AT91CAP9) |
148 | #define cpu_is_at91cap9_revB() (at91cap9_rev_identify() == ARCH_REVISION_CAP9_B) | 176 | #define cpu_is_at91cap9_revB() (at91cap9_rev_identify() == ARCH_REVISION_CAP9_B) |
diff --git a/arch/arm/mach-s5p6442/Kconfig b/arch/arm/mach-s5p6442/Kconfig deleted file mode 100644 index 33569e4007c4..000000000000 --- a/arch/arm/mach-s5p6442/Kconfig +++ /dev/null | |||
@@ -1,25 +0,0 @@ | |||
1 | # arch/arm/mach-s5p6442/Kconfig | ||
2 | # | ||
3 | # Copyright (c) 2010 Samsung Electronics Co., Ltd. | ||
4 | # http://www.samsung.com/ | ||
5 | # | ||
6 | # Licensed under GPLv2 | ||
7 | |||
8 | # Configuration options for the S5P6442 | ||
9 | |||
10 | if ARCH_S5P6442 | ||
11 | |||
12 | config CPU_S5P6442 | ||
13 | bool | ||
14 | select S3C_PL330_DMA | ||
15 | help | ||
16 | Enable S5P6442 CPU support | ||
17 | |||
18 | config MACH_SMDK6442 | ||
19 | bool "SMDK6442" | ||
20 | select CPU_S5P6442 | ||
21 | select S3C_DEV_WDT | ||
22 | help | ||
23 | Machine support for Samsung SMDK6442 | ||
24 | |||
25 | endif | ||
diff --git a/arch/arm/mach-s5p6442/Makefile b/arch/arm/mach-s5p6442/Makefile deleted file mode 100644 index 90a3d8373416..000000000000 --- a/arch/arm/mach-s5p6442/Makefile +++ /dev/null | |||
@@ -1,24 +0,0 @@ | |||
1 | # arch/arm/mach-s5p6442/Makefile | ||
2 | # | ||
3 | # Copyright (c) 2010 Samsung Electronics Co., Ltd. | ||
4 | # http://www.samsung.com/ | ||
5 | # | ||
6 | # Licensed under GPLv2 | ||
7 | |||
8 | obj-y := | ||
9 | obj-m := | ||
10 | obj-n := | ||
11 | obj- := | ||
12 | |||
13 | # Core support for S5P6442 system | ||
14 | |||
15 | obj-$(CONFIG_CPU_S5P6442) += cpu.o init.o clock.o dma.o | ||
16 | obj-$(CONFIG_CPU_S5P6442) += setup-i2c0.o | ||
17 | |||
18 | # machine support | ||
19 | |||
20 | obj-$(CONFIG_MACH_SMDK6442) += mach-smdk6442.o | ||
21 | |||
22 | # device support | ||
23 | obj-y += dev-audio.o | ||
24 | obj-$(CONFIG_S3C64XX_DEV_SPI) += dev-spi.o | ||
diff --git a/arch/arm/mach-s5p6442/Makefile.boot b/arch/arm/mach-s5p6442/Makefile.boot deleted file mode 100644 index ff90aa13bd67..000000000000 --- a/arch/arm/mach-s5p6442/Makefile.boot +++ /dev/null | |||
@@ -1,2 +0,0 @@ | |||
1 | zreladdr-y := 0x20008000 | ||
2 | params_phys-y := 0x20000100 | ||
diff --git a/arch/arm/mach-s5p6442/clock.c b/arch/arm/mach-s5p6442/clock.c deleted file mode 100644 index fbbc7bede685..000000000000 --- a/arch/arm/mach-s5p6442/clock.c +++ /dev/null | |||
@@ -1,420 +0,0 @@ | |||
1 | /* linux/arch/arm/mach-s5p6442/clock.c | ||
2 | * | ||
3 | * Copyright (c) 2010 Samsung Electronics Co., Ltd. | ||
4 | * http://www.samsung.com/ | ||
5 | * | ||
6 | * S5P6442 - Clock support | ||
7 | * | ||
8 | * This program is free software; you can redistribute it and/or modify | ||
9 | * it under the terms of the GNU General Public License version 2 as | ||
10 | * published by the Free Software Foundation. | ||
11 | */ | ||
12 | |||
13 | #include <linux/init.h> | ||
14 | #include <linux/module.h> | ||
15 | #include <linux/kernel.h> | ||
16 | #include <linux/list.h> | ||
17 | #include <linux/err.h> | ||
18 | #include <linux/clk.h> | ||
19 | #include <linux/io.h> | ||
20 | |||
21 | #include <mach/map.h> | ||
22 | |||
23 | #include <plat/cpu-freq.h> | ||
24 | #include <mach/regs-clock.h> | ||
25 | #include <plat/clock.h> | ||
26 | #include <plat/cpu.h> | ||
27 | #include <plat/pll.h> | ||
28 | #include <plat/s5p-clock.h> | ||
29 | #include <plat/clock-clksrc.h> | ||
30 | #include <plat/s5p6442.h> | ||
31 | |||
32 | static struct clksrc_clk clk_mout_apll = { | ||
33 | .clk = { | ||
34 | .name = "mout_apll", | ||
35 | .id = -1, | ||
36 | }, | ||
37 | .sources = &clk_src_apll, | ||
38 | .reg_src = { .reg = S5P_CLK_SRC0, .shift = 0, .size = 1 }, | ||
39 | }; | ||
40 | |||
41 | static struct clksrc_clk clk_mout_mpll = { | ||
42 | .clk = { | ||
43 | .name = "mout_mpll", | ||
44 | .id = -1, | ||
45 | }, | ||
46 | .sources = &clk_src_mpll, | ||
47 | .reg_src = { .reg = S5P_CLK_SRC0, .shift = 4, .size = 1 }, | ||
48 | }; | ||
49 | |||
50 | static struct clksrc_clk clk_mout_epll = { | ||
51 | .clk = { | ||
52 | .name = "mout_epll", | ||
53 | .id = -1, | ||
54 | }, | ||
55 | .sources = &clk_src_epll, | ||
56 | .reg_src = { .reg = S5P_CLK_SRC0, .shift = 8, .size = 1 }, | ||
57 | }; | ||
58 | |||
59 | /* Possible clock sources for ARM Mux */ | ||
60 | static struct clk *clk_src_arm_list[] = { | ||
61 | [1] = &clk_mout_apll.clk, | ||
62 | [2] = &clk_mout_mpll.clk, | ||
63 | }; | ||
64 | |||
65 | static struct clksrc_sources clk_src_arm = { | ||
66 | .sources = clk_src_arm_list, | ||
67 | .nr_sources = ARRAY_SIZE(clk_src_arm_list), | ||
68 | }; | ||
69 | |||
70 | static struct clksrc_clk clk_mout_arm = { | ||
71 | .clk = { | ||
72 | .name = "mout_arm", | ||
73 | .id = -1, | ||
74 | }, | ||
75 | .sources = &clk_src_arm, | ||
76 | .reg_src = { .reg = S5P_CLK_MUX_STAT0, .shift = 16, .size = 3 }, | ||
77 | }; | ||
78 | |||
79 | static struct clk clk_dout_a2m = { | ||
80 | .name = "dout_a2m", | ||
81 | .id = -1, | ||
82 | .parent = &clk_mout_apll.clk, | ||
83 | }; | ||
84 | |||
85 | /* Possible clock sources for D0 Mux */ | ||
86 | static struct clk *clk_src_d0_list[] = { | ||
87 | [1] = &clk_mout_mpll.clk, | ||
88 | [2] = &clk_dout_a2m, | ||
89 | }; | ||
90 | |||
91 | static struct clksrc_sources clk_src_d0 = { | ||
92 | .sources = clk_src_d0_list, | ||
93 | .nr_sources = ARRAY_SIZE(clk_src_d0_list), | ||
94 | }; | ||
95 | |||
96 | static struct clksrc_clk clk_mout_d0 = { | ||
97 | .clk = { | ||
98 | .name = "mout_d0", | ||
99 | .id = -1, | ||
100 | }, | ||
101 | .sources = &clk_src_d0, | ||
102 | .reg_src = { .reg = S5P_CLK_MUX_STAT0, .shift = 20, .size = 3 }, | ||
103 | }; | ||
104 | |||
105 | static struct clk clk_dout_apll = { | ||
106 | .name = "dout_apll", | ||
107 | .id = -1, | ||
108 | .parent = &clk_mout_arm.clk, | ||
109 | }; | ||
110 | |||
111 | /* Possible clock sources for D0SYNC Mux */ | ||
112 | static struct clk *clk_src_d0sync_list[] = { | ||
113 | [1] = &clk_mout_d0.clk, | ||
114 | [2] = &clk_dout_apll, | ||
115 | }; | ||
116 | |||
117 | static struct clksrc_sources clk_src_d0sync = { | ||
118 | .sources = clk_src_d0sync_list, | ||
119 | .nr_sources = ARRAY_SIZE(clk_src_d0sync_list), | ||
120 | }; | ||
121 | |||
122 | static struct clksrc_clk clk_mout_d0sync = { | ||
123 | .clk = { | ||
124 | .name = "mout_d0sync", | ||
125 | .id = -1, | ||
126 | }, | ||
127 | .sources = &clk_src_d0sync, | ||
128 | .reg_src = { .reg = S5P_CLK_MUX_STAT1, .shift = 28, .size = 3 }, | ||
129 | }; | ||
130 | |||
131 | /* Possible clock sources for D1 Mux */ | ||
132 | static struct clk *clk_src_d1_list[] = { | ||
133 | [1] = &clk_mout_mpll.clk, | ||
134 | [2] = &clk_dout_a2m, | ||
135 | }; | ||
136 | |||
137 | static struct clksrc_sources clk_src_d1 = { | ||
138 | .sources = clk_src_d1_list, | ||
139 | .nr_sources = ARRAY_SIZE(clk_src_d1_list), | ||
140 | }; | ||
141 | |||
142 | static struct clksrc_clk clk_mout_d1 = { | ||
143 | .clk = { | ||
144 | .name = "mout_d1", | ||
145 | .id = -1, | ||
146 | }, | ||
147 | .sources = &clk_src_d1, | ||
148 | .reg_src = { .reg = S5P_CLK_MUX_STAT0, .shift = 24, .size = 3 }, | ||
149 | }; | ||
150 | |||
151 | /* Possible clock sources for D1SYNC Mux */ | ||
152 | static struct clk *clk_src_d1sync_list[] = { | ||
153 | [1] = &clk_mout_d1.clk, | ||
154 | [2] = &clk_dout_apll, | ||
155 | }; | ||
156 | |||
157 | static struct clksrc_sources clk_src_d1sync = { | ||
158 | .sources = clk_src_d1sync_list, | ||
159 | .nr_sources = ARRAY_SIZE(clk_src_d1sync_list), | ||
160 | }; | ||
161 | |||
162 | static struct clksrc_clk clk_mout_d1sync = { | ||
163 | .clk = { | ||
164 | .name = "mout_d1sync", | ||
165 | .id = -1, | ||
166 | }, | ||
167 | .sources = &clk_src_d1sync, | ||
168 | .reg_src = { .reg = S5P_CLK_MUX_STAT1, .shift = 24, .size = 3 }, | ||
169 | }; | ||
170 | |||
171 | static struct clk clk_hclkd0 = { | ||
172 | .name = "hclkd0", | ||
173 | .id = -1, | ||
174 | .parent = &clk_mout_d0sync.clk, | ||
175 | }; | ||
176 | |||
177 | static struct clk clk_hclkd1 = { | ||
178 | .name = "hclkd1", | ||
179 | .id = -1, | ||
180 | .parent = &clk_mout_d1sync.clk, | ||
181 | }; | ||
182 | |||
183 | static struct clk clk_pclkd0 = { | ||
184 | .name = "pclkd0", | ||
185 | .id = -1, | ||
186 | .parent = &clk_hclkd0, | ||
187 | }; | ||
188 | |||
189 | static struct clk clk_pclkd1 = { | ||
190 | .name = "pclkd1", | ||
191 | .id = -1, | ||
192 | .parent = &clk_hclkd1, | ||
193 | }; | ||
194 | |||
195 | int s5p6442_clk_ip0_ctrl(struct clk *clk, int enable) | ||
196 | { | ||
197 | return s5p_gatectrl(S5P_CLKGATE_IP0, clk, enable); | ||
198 | } | ||
199 | |||
200 | int s5p6442_clk_ip3_ctrl(struct clk *clk, int enable) | ||
201 | { | ||
202 | return s5p_gatectrl(S5P_CLKGATE_IP3, clk, enable); | ||
203 | } | ||
204 | |||
205 | static struct clksrc_clk clksrcs[] = { | ||
206 | { | ||
207 | .clk = { | ||
208 | .name = "dout_a2m", | ||
209 | .id = -1, | ||
210 | .parent = &clk_mout_apll.clk, | ||
211 | }, | ||
212 | .sources = &clk_src_apll, | ||
213 | .reg_src = { .reg = S5P_CLK_SRC0, .shift = 0, .size = 1 }, | ||
214 | .reg_div = { .reg = S5P_CLK_DIV0, .shift = 4, .size = 3 }, | ||
215 | }, { | ||
216 | .clk = { | ||
217 | .name = "dout_apll", | ||
218 | .id = -1, | ||
219 | .parent = &clk_mout_arm.clk, | ||
220 | }, | ||
221 | .sources = &clk_src_arm, | ||
222 | .reg_src = { .reg = S5P_CLK_MUX_STAT0, .shift = 16, .size = 3 }, | ||
223 | .reg_div = { .reg = S5P_CLK_DIV0, .shift = 0, .size = 3 }, | ||
224 | }, { | ||
225 | .clk = { | ||
226 | .name = "hclkd1", | ||
227 | .id = -1, | ||
228 | .parent = &clk_mout_d1sync.clk, | ||
229 | }, | ||
230 | .sources = &clk_src_d1sync, | ||
231 | .reg_src = { .reg = S5P_CLK_MUX_STAT1, .shift = 24, .size = 3 }, | ||
232 | .reg_div = { .reg = S5P_CLK_DIV0, .shift = 24, .size = 4 }, | ||
233 | }, { | ||
234 | .clk = { | ||
235 | .name = "hclkd0", | ||
236 | .id = -1, | ||
237 | .parent = &clk_mout_d0sync.clk, | ||
238 | }, | ||
239 | .sources = &clk_src_d0sync, | ||
240 | .reg_src = { .reg = S5P_CLK_MUX_STAT1, .shift = 28, .size = 3 }, | ||
241 | .reg_div = { .reg = S5P_CLK_DIV0, .shift = 16, .size = 4 }, | ||
242 | }, { | ||
243 | .clk = { | ||
244 | .name = "pclkd0", | ||
245 | .id = -1, | ||
246 | .parent = &clk_hclkd0, | ||
247 | }, | ||
248 | .sources = &clk_src_d0sync, | ||
249 | .reg_src = { .reg = S5P_CLK_MUX_STAT1, .shift = 28, .size = 3 }, | ||
250 | .reg_div = { .reg = S5P_CLK_DIV0, .shift = 20, .size = 3 }, | ||
251 | }, { | ||
252 | .clk = { | ||
253 | .name = "pclkd1", | ||
254 | .id = -1, | ||
255 | .parent = &clk_hclkd1, | ||
256 | }, | ||
257 | .sources = &clk_src_d1sync, | ||
258 | .reg_src = { .reg = S5P_CLK_MUX_STAT1, .shift = 24, .size = 3 }, | ||
259 | .reg_div = { .reg = S5P_CLK_DIV0, .shift = 28, .size = 3 }, | ||
260 | } | ||
261 | }; | ||
262 | |||
263 | /* Clock initialisation code */ | ||
264 | static struct clksrc_clk *init_parents[] = { | ||
265 | &clk_mout_apll, | ||
266 | &clk_mout_mpll, | ||
267 | &clk_mout_epll, | ||
268 | &clk_mout_arm, | ||
269 | &clk_mout_d0, | ||
270 | &clk_mout_d0sync, | ||
271 | &clk_mout_d1, | ||
272 | &clk_mout_d1sync, | ||
273 | }; | ||
274 | |||
275 | void __init_or_cpufreq s5p6442_setup_clocks(void) | ||
276 | { | ||
277 | struct clk *pclkd0_clk; | ||
278 | struct clk *pclkd1_clk; | ||
279 | |||
280 | unsigned long xtal; | ||
281 | unsigned long arm; | ||
282 | unsigned long hclkd0 = 0; | ||
283 | unsigned long hclkd1 = 0; | ||
284 | unsigned long pclkd0 = 0; | ||
285 | unsigned long pclkd1 = 0; | ||
286 | |||
287 | unsigned long apll; | ||
288 | unsigned long mpll; | ||
289 | unsigned long epll; | ||
290 | unsigned int ptr; | ||
291 | |||
292 | printk(KERN_DEBUG "%s: registering clocks\n", __func__); | ||
293 | |||
294 | xtal = clk_get_rate(&clk_xtal); | ||
295 | |||
296 | printk(KERN_DEBUG "%s: xtal is %ld\n", __func__, xtal); | ||
297 | |||
298 | apll = s5p_get_pll45xx(xtal, __raw_readl(S5P_APLL_CON), pll_4508); | ||
299 | mpll = s5p_get_pll45xx(xtal, __raw_readl(S5P_MPLL_CON), pll_4502); | ||
300 | epll = s5p_get_pll45xx(xtal, __raw_readl(S5P_EPLL_CON), pll_4500); | ||
301 | |||
302 | printk(KERN_INFO "S5P6442: PLL settings, A=%ld, M=%ld, E=%ld", | ||
303 | apll, mpll, epll); | ||
304 | |||
305 | clk_fout_apll.rate = apll; | ||
306 | clk_fout_mpll.rate = mpll; | ||
307 | clk_fout_epll.rate = epll; | ||
308 | |||
309 | for (ptr = 0; ptr < ARRAY_SIZE(init_parents); ptr++) | ||
310 | s3c_set_clksrc(init_parents[ptr], true); | ||
311 | |||
312 | for (ptr = 0; ptr < ARRAY_SIZE(clksrcs); ptr++) | ||
313 | s3c_set_clksrc(&clksrcs[ptr], true); | ||
314 | |||
315 | arm = clk_get_rate(&clk_dout_apll); | ||
316 | hclkd0 = clk_get_rate(&clk_hclkd0); | ||
317 | hclkd1 = clk_get_rate(&clk_hclkd1); | ||
318 | |||
319 | pclkd0_clk = clk_get(NULL, "pclkd0"); | ||
320 | BUG_ON(IS_ERR(pclkd0_clk)); | ||
321 | |||
322 | pclkd0 = clk_get_rate(pclkd0_clk); | ||
323 | clk_put(pclkd0_clk); | ||
324 | |||
325 | pclkd1_clk = clk_get(NULL, "pclkd1"); | ||
326 | BUG_ON(IS_ERR(pclkd1_clk)); | ||
327 | |||
328 | pclkd1 = clk_get_rate(pclkd1_clk); | ||
329 | clk_put(pclkd1_clk); | ||
330 | |||
331 | printk(KERN_INFO "S5P6442: HCLKD0=%ld, HCLKD1=%ld, PCLKD0=%ld, PCLKD1=%ld\n", | ||
332 | hclkd0, hclkd1, pclkd0, pclkd1); | ||
333 | |||
334 | /* For backward compatibility */ | ||
335 | clk_f.rate = arm; | ||
336 | clk_h.rate = hclkd1; | ||
337 | clk_p.rate = pclkd1; | ||
338 | |||
339 | clk_pclkd0.rate = pclkd0; | ||
340 | clk_pclkd1.rate = pclkd1; | ||
341 | } | ||
342 | |||
343 | static struct clk init_clocks_off[] = { | ||
344 | { | ||
345 | .name = "pdma", | ||
346 | .id = -1, | ||
347 | .parent = &clk_pclkd1, | ||
348 | .enable = s5p6442_clk_ip0_ctrl, | ||
349 | .ctrlbit = (1 << 3), | ||
350 | }, | ||
351 | }; | ||
352 | |||
353 | static struct clk init_clocks[] = { | ||
354 | { | ||
355 | .name = "systimer", | ||
356 | .id = -1, | ||
357 | .parent = &clk_pclkd1, | ||
358 | .enable = s5p6442_clk_ip3_ctrl, | ||
359 | .ctrlbit = (1<<16), | ||
360 | }, { | ||
361 | .name = "uart", | ||
362 | .id = 0, | ||
363 | .parent = &clk_pclkd1, | ||
364 | .enable = s5p6442_clk_ip3_ctrl, | ||
365 | .ctrlbit = (1<<17), | ||
366 | }, { | ||
367 | .name = "uart", | ||
368 | .id = 1, | ||
369 | .parent = &clk_pclkd1, | ||
370 | .enable = s5p6442_clk_ip3_ctrl, | ||
371 | .ctrlbit = (1<<18), | ||
372 | }, { | ||
373 | .name = "uart", | ||
374 | .id = 2, | ||
375 | .parent = &clk_pclkd1, | ||
376 | .enable = s5p6442_clk_ip3_ctrl, | ||
377 | .ctrlbit = (1<<19), | ||
378 | }, { | ||
379 | .name = "watchdog", | ||
380 | .id = -1, | ||
381 | .parent = &clk_pclkd1, | ||
382 | .enable = s5p6442_clk_ip3_ctrl, | ||
383 | .ctrlbit = (1 << 22), | ||
384 | }, { | ||
385 | .name = "timers", | ||
386 | .id = -1, | ||
387 | .parent = &clk_pclkd1, | ||
388 | .enable = s5p6442_clk_ip3_ctrl, | ||
389 | .ctrlbit = (1<<23), | ||
390 | }, | ||
391 | }; | ||
392 | |||
393 | static struct clk *clks[] __initdata = { | ||
394 | &clk_ext, | ||
395 | &clk_epll, | ||
396 | &clk_mout_apll.clk, | ||
397 | &clk_mout_mpll.clk, | ||
398 | &clk_mout_epll.clk, | ||
399 | &clk_mout_d0.clk, | ||
400 | &clk_mout_d0sync.clk, | ||
401 | &clk_mout_d1.clk, | ||
402 | &clk_mout_d1sync.clk, | ||
403 | &clk_hclkd0, | ||
404 | &clk_pclkd0, | ||
405 | &clk_hclkd1, | ||
406 | &clk_pclkd1, | ||
407 | }; | ||
408 | |||
409 | void __init s5p6442_register_clocks(void) | ||
410 | { | ||
411 | s3c24xx_register_clocks(clks, ARRAY_SIZE(clks)); | ||
412 | |||
413 | s3c_register_clksrc(clksrcs, ARRAY_SIZE(clksrcs)); | ||
414 | s3c_register_clocks(init_clocks, ARRAY_SIZE(init_clocks)); | ||
415 | |||
416 | s3c_register_clocks(init_clocks_off, ARRAY_SIZE(init_clocks_off)); | ||
417 | s3c_disable_clocks(init_clocks_off, ARRAY_SIZE(init_clocks_off)); | ||
418 | |||
419 | s3c_pwmclk_init(); | ||
420 | } | ||
diff --git a/arch/arm/mach-s5p6442/cpu.c b/arch/arm/mach-s5p6442/cpu.c deleted file mode 100644 index 842af86bda6d..000000000000 --- a/arch/arm/mach-s5p6442/cpu.c +++ /dev/null | |||
@@ -1,143 +0,0 @@ | |||
1 | /* linux/arch/arm/mach-s5p6442/cpu.c | ||
2 | * | ||
3 | * Copyright (c) 2010 Samsung Electronics Co., Ltd. | ||
4 | * http://www.samsung.com | ||
5 | * | ||
6 | * This program is free software; you can redistribute it and/or modify | ||
7 | * it under the terms of the GNU General Public License version 2 as | ||
8 | * published by the Free Software Foundation. | ||
9 | */ | ||
10 | |||
11 | #include <linux/kernel.h> | ||
12 | #include <linux/types.h> | ||
13 | #include <linux/interrupt.h> | ||
14 | #include <linux/list.h> | ||
15 | #include <linux/timer.h> | ||
16 | #include <linux/init.h> | ||
17 | #include <linux/clk.h> | ||
18 | #include <linux/io.h> | ||
19 | #include <linux/sysdev.h> | ||
20 | #include <linux/serial_core.h> | ||
21 | #include <linux/platform_device.h> | ||
22 | #include <linux/sched.h> | ||
23 | |||
24 | #include <asm/mach/arch.h> | ||
25 | #include <asm/mach/map.h> | ||
26 | #include <asm/mach/irq.h> | ||
27 | |||
28 | #include <asm/proc-fns.h> | ||
29 | |||
30 | #include <mach/hardware.h> | ||
31 | #include <mach/map.h> | ||
32 | #include <asm/irq.h> | ||
33 | |||
34 | #include <plat/regs-serial.h> | ||
35 | #include <mach/regs-clock.h> | ||
36 | |||
37 | #include <plat/cpu.h> | ||
38 | #include <plat/devs.h> | ||
39 | #include <plat/clock.h> | ||
40 | #include <plat/s5p6442.h> | ||
41 | |||
42 | /* Initial IO mappings */ | ||
43 | |||
44 | static struct map_desc s5p6442_iodesc[] __initdata = { | ||
45 | { | ||
46 | .virtual = (unsigned long)S5P_VA_SYSTIMER, | ||
47 | .pfn = __phys_to_pfn(S5P6442_PA_SYSTIMER), | ||
48 | .length = SZ_16K, | ||
49 | .type = MT_DEVICE, | ||
50 | }, { | ||
51 | .virtual = (unsigned long)S5P_VA_GPIO, | ||
52 | .pfn = __phys_to_pfn(S5P6442_PA_GPIO), | ||
53 | .length = SZ_4K, | ||
54 | .type = MT_DEVICE, | ||
55 | }, { | ||
56 | .virtual = (unsigned long)VA_VIC0, | ||
57 | .pfn = __phys_to_pfn(S5P6442_PA_VIC0), | ||
58 | .length = SZ_16K, | ||
59 | .type = MT_DEVICE, | ||
60 | }, { | ||
61 | .virtual = (unsigned long)VA_VIC1, | ||
62 | .pfn = __phys_to_pfn(S5P6442_PA_VIC1), | ||
63 | .length = SZ_16K, | ||
64 | .type = MT_DEVICE, | ||
65 | }, { | ||
66 | .virtual = (unsigned long)VA_VIC2, | ||
67 | .pfn = __phys_to_pfn(S5P6442_PA_VIC2), | ||
68 | .length = SZ_16K, | ||
69 | .type = MT_DEVICE, | ||
70 | }, { | ||
71 | .virtual = (unsigned long)S3C_VA_UART, | ||
72 | .pfn = __phys_to_pfn(S3C_PA_UART), | ||
73 | .length = SZ_512K, | ||
74 | .type = MT_DEVICE, | ||
75 | } | ||
76 | }; | ||
77 | |||
78 | static void s5p6442_idle(void) | ||
79 | { | ||
80 | if (!need_resched()) | ||
81 | cpu_do_idle(); | ||
82 | |||
83 | local_irq_enable(); | ||
84 | } | ||
85 | |||
86 | /* | ||
87 | * s5p6442_map_io | ||
88 | * | ||
89 | * register the standard cpu IO areas | ||
90 | */ | ||
91 | |||
92 | void __init s5p6442_map_io(void) | ||
93 | { | ||
94 | iotable_init(s5p6442_iodesc, ARRAY_SIZE(s5p6442_iodesc)); | ||
95 | } | ||
96 | |||
97 | void __init s5p6442_init_clocks(int xtal) | ||
98 | { | ||
99 | printk(KERN_DEBUG "%s: initializing clocks\n", __func__); | ||
100 | |||
101 | s3c24xx_register_baseclocks(xtal); | ||
102 | s5p_register_clocks(xtal); | ||
103 | s5p6442_register_clocks(); | ||
104 | s5p6442_setup_clocks(); | ||
105 | } | ||
106 | |||
107 | void __init s5p6442_init_irq(void) | ||
108 | { | ||
109 | /* S5P6442 supports 3 VIC */ | ||
110 | u32 vic[3]; | ||
111 | |||
112 | /* VIC0, VIC1, and VIC2: some interrupt reserved */ | ||
113 | vic[0] = 0x7fefffff; | ||
114 | vic[1] = 0X7f389c81; | ||
115 | vic[2] = 0X1bbbcfff; | ||
116 | |||
117 | s5p_init_irq(vic, ARRAY_SIZE(vic)); | ||
118 | } | ||
119 | |||
120 | struct sysdev_class s5p6442_sysclass = { | ||
121 | .name = "s5p6442-core", | ||
122 | }; | ||
123 | |||
124 | static struct sys_device s5p6442_sysdev = { | ||
125 | .cls = &s5p6442_sysclass, | ||
126 | }; | ||
127 | |||
128 | static int __init s5p6442_core_init(void) | ||
129 | { | ||
130 | return sysdev_class_register(&s5p6442_sysclass); | ||
131 | } | ||
132 | |||
133 | core_initcall(s5p6442_core_init); | ||
134 | |||
135 | int __init s5p6442_init(void) | ||
136 | { | ||
137 | printk(KERN_INFO "S5P6442: Initializing architecture\n"); | ||
138 | |||
139 | /* set idle function */ | ||
140 | pm_idle = s5p6442_idle; | ||
141 | |||
142 | return sysdev_register(&s5p6442_sysdev); | ||
143 | } | ||
diff --git a/arch/arm/mach-s5p6442/dev-audio.c b/arch/arm/mach-s5p6442/dev-audio.c deleted file mode 100644 index 8719dc41fe32..000000000000 --- a/arch/arm/mach-s5p6442/dev-audio.c +++ /dev/null | |||
@@ -1,217 +0,0 @@ | |||
1 | /* linux/arch/arm/mach-s5p6442/dev-audio.c | ||
2 | * | ||
3 | * Copyright (c) 2010 Samsung Electronics Co. Ltd | ||
4 | * Jaswinder Singh <jassi.brar@samsung.com> | ||
5 | * | ||
6 | * This program is free software; you can redistribute it and/or modify | ||
7 | * it under the terms of the GNU General Public License version 2 as | ||
8 | * published by the Free Software Foundation. | ||
9 | */ | ||
10 | |||
11 | #include <linux/platform_device.h> | ||
12 | #include <linux/dma-mapping.h> | ||
13 | #include <linux/gpio.h> | ||
14 | |||
15 | #include <plat/gpio-cfg.h> | ||
16 | #include <plat/audio.h> | ||
17 | |||
18 | #include <mach/map.h> | ||
19 | #include <mach/dma.h> | ||
20 | #include <mach/irqs.h> | ||
21 | |||
22 | static int s5p6442_cfg_i2s(struct platform_device *pdev) | ||
23 | { | ||
24 | unsigned int base; | ||
25 | |||
26 | /* configure GPIO for i2s port */ | ||
27 | switch (pdev->id) { | ||
28 | case 1: | ||
29 | base = S5P6442_GPC1(0); | ||
30 | break; | ||
31 | |||
32 | case 0: | ||
33 | base = S5P6442_GPC0(0); | ||
34 | break; | ||
35 | |||
36 | default: | ||
37 | printk(KERN_ERR "Invalid Device %d\n", pdev->id); | ||
38 | return -EINVAL; | ||
39 | } | ||
40 | |||
41 | s3c_gpio_cfgpin_range(base, 5, S3C_GPIO_SFN(2)); | ||
42 | return 0; | ||
43 | } | ||
44 | |||
45 | static const char *rclksrc_v35[] = { | ||
46 | [0] = "busclk", | ||
47 | [1] = "i2sclk", | ||
48 | }; | ||
49 | |||
50 | static struct s3c_audio_pdata i2sv35_pdata = { | ||
51 | .cfg_gpio = s5p6442_cfg_i2s, | ||
52 | .type = { | ||
53 | .i2s = { | ||
54 | .quirks = QUIRK_SEC_DAI | QUIRK_NEED_RSTCLR, | ||
55 | .src_clk = rclksrc_v35, | ||
56 | }, | ||
57 | }, | ||
58 | }; | ||
59 | |||
60 | static struct resource s5p6442_iis0_resource[] = { | ||
61 | [0] = { | ||
62 | .start = S5P6442_PA_I2S0, | ||
63 | .end = S5P6442_PA_I2S0 + 0x100 - 1, | ||
64 | .flags = IORESOURCE_MEM, | ||
65 | }, | ||
66 | [1] = { | ||
67 | .start = DMACH_I2S0_TX, | ||
68 | .end = DMACH_I2S0_TX, | ||
69 | .flags = IORESOURCE_DMA, | ||
70 | }, | ||
71 | [2] = { | ||
72 | .start = DMACH_I2S0_RX, | ||
73 | .end = DMACH_I2S0_RX, | ||
74 | .flags = IORESOURCE_DMA, | ||
75 | }, | ||
76 | [3] = { | ||
77 | .start = DMACH_I2S0S_TX, | ||
78 | .end = DMACH_I2S0S_TX, | ||
79 | .flags = IORESOURCE_DMA, | ||
80 | }, | ||
81 | }; | ||
82 | |||
83 | struct platform_device s5p6442_device_iis0 = { | ||
84 | .name = "samsung-i2s", | ||
85 | .id = 0, | ||
86 | .num_resources = ARRAY_SIZE(s5p6442_iis0_resource), | ||
87 | .resource = s5p6442_iis0_resource, | ||
88 | .dev = { | ||
89 | .platform_data = &i2sv35_pdata, | ||
90 | }, | ||
91 | }; | ||
92 | |||
93 | static const char *rclksrc_v3[] = { | ||
94 | [0] = "iis", | ||
95 | [1] = "sclk_audio", | ||
96 | }; | ||
97 | |||
98 | static struct s3c_audio_pdata i2sv3_pdata = { | ||
99 | .cfg_gpio = s5p6442_cfg_i2s, | ||
100 | .type = { | ||
101 | .i2s = { | ||
102 | .src_clk = rclksrc_v3, | ||
103 | }, | ||
104 | }, | ||
105 | }; | ||
106 | |||
107 | static struct resource s5p6442_iis1_resource[] = { | ||
108 | [0] = { | ||
109 | .start = S5P6442_PA_I2S1, | ||
110 | .end = S5P6442_PA_I2S1 + 0x100 - 1, | ||
111 | .flags = IORESOURCE_MEM, | ||
112 | }, | ||
113 | [1] = { | ||
114 | .start = DMACH_I2S1_TX, | ||
115 | .end = DMACH_I2S1_TX, | ||
116 | .flags = IORESOURCE_DMA, | ||
117 | }, | ||
118 | [2] = { | ||
119 | .start = DMACH_I2S1_RX, | ||
120 | .end = DMACH_I2S1_RX, | ||
121 | .flags = IORESOURCE_DMA, | ||
122 | }, | ||
123 | }; | ||
124 | |||
125 | struct platform_device s5p6442_device_iis1 = { | ||
126 | .name = "samsung-i2s", | ||
127 | .id = 1, | ||
128 | .num_resources = ARRAY_SIZE(s5p6442_iis1_resource), | ||
129 | .resource = s5p6442_iis1_resource, | ||
130 | .dev = { | ||
131 | .platform_data = &i2sv3_pdata, | ||
132 | }, | ||
133 | }; | ||
134 | |||
135 | /* PCM Controller platform_devices */ | ||
136 | |||
137 | static int s5p6442_pcm_cfg_gpio(struct platform_device *pdev) | ||
138 | { | ||
139 | unsigned int base; | ||
140 | |||
141 | switch (pdev->id) { | ||
142 | case 0: | ||
143 | base = S5P6442_GPC0(0); | ||
144 | break; | ||
145 | |||
146 | case 1: | ||
147 | base = S5P6442_GPC1(0); | ||
148 | break; | ||
149 | |||
150 | default: | ||
151 | printk(KERN_DEBUG "Invalid PCM Controller number!"); | ||
152 | return -EINVAL; | ||
153 | } | ||
154 | |||
155 | s3c_gpio_cfgpin_range(base, 5, S3C_GPIO_SFN(3)); | ||
156 | return 0; | ||
157 | } | ||
158 | |||
159 | static struct s3c_audio_pdata s3c_pcm_pdata = { | ||
160 | .cfg_gpio = s5p6442_pcm_cfg_gpio, | ||
161 | }; | ||
162 | |||
163 | static struct resource s5p6442_pcm0_resource[] = { | ||
164 | [0] = { | ||
165 | .start = S5P6442_PA_PCM0, | ||
166 | .end = S5P6442_PA_PCM0 + 0x100 - 1, | ||
167 | .flags = IORESOURCE_MEM, | ||
168 | }, | ||
169 | [1] = { | ||
170 | .start = DMACH_PCM0_TX, | ||
171 | .end = DMACH_PCM0_TX, | ||
172 | .flags = IORESOURCE_DMA, | ||
173 | }, | ||
174 | [2] = { | ||
175 | .start = DMACH_PCM0_RX, | ||
176 | .end = DMACH_PCM0_RX, | ||
177 | .flags = IORESOURCE_DMA, | ||
178 | }, | ||
179 | }; | ||
180 | |||
181 | struct platform_device s5p6442_device_pcm0 = { | ||
182 | .name = "samsung-pcm", | ||
183 | .id = 0, | ||
184 | .num_resources = ARRAY_SIZE(s5p6442_pcm0_resource), | ||
185 | .resource = s5p6442_pcm0_resource, | ||
186 | .dev = { | ||
187 | .platform_data = &s3c_pcm_pdata, | ||
188 | }, | ||
189 | }; | ||
190 | |||
191 | static struct resource s5p6442_pcm1_resource[] = { | ||
192 | [0] = { | ||
193 | .start = S5P6442_PA_PCM1, | ||
194 | .end = S5P6442_PA_PCM1 + 0x100 - 1, | ||
195 | .flags = IORESOURCE_MEM, | ||
196 | }, | ||
197 | [1] = { | ||
198 | .start = DMACH_PCM1_TX, | ||
199 | .end = DMACH_PCM1_TX, | ||
200 | .flags = IORESOURCE_DMA, | ||
201 | }, | ||
202 | [2] = { | ||
203 | .start = DMACH_PCM1_RX, | ||
204 | .end = DMACH_PCM1_RX, | ||
205 | .flags = IORESOURCE_DMA, | ||
206 | }, | ||
207 | }; | ||
208 | |||
209 | struct platform_device s5p6442_device_pcm1 = { | ||
210 | .name = "samsung-pcm", | ||
211 | .id = 1, | ||
212 | .num_resources = ARRAY_SIZE(s5p6442_pcm1_resource), | ||
213 | .resource = s5p6442_pcm1_resource, | ||
214 | .dev = { | ||
215 | .platform_data = &s3c_pcm_pdata, | ||
216 | }, | ||
217 | }; | ||
diff --git a/arch/arm/mach-s5p6442/dev-spi.c b/arch/arm/mach-s5p6442/dev-spi.c deleted file mode 100644 index cce8c2470709..000000000000 --- a/arch/arm/mach-s5p6442/dev-spi.c +++ /dev/null | |||
@@ -1,121 +0,0 @@ | |||
1 | /* linux/arch/arm/mach-s5p6442/dev-spi.c | ||
2 | * | ||
3 | * Copyright (C) 2010 Samsung Electronics Co. Ltd. | ||
4 | * Jaswinder Singh <jassi.brar@samsung.com> | ||
5 | * | ||
6 | * This program is free software; you can redistribute it and/or modify | ||
7 | * it under the terms of the GNU General Public License version 2 as | ||
8 | * published by the Free Software Foundation. | ||
9 | */ | ||
10 | |||
11 | #include <linux/platform_device.h> | ||
12 | #include <linux/dma-mapping.h> | ||
13 | #include <linux/gpio.h> | ||
14 | |||
15 | #include <mach/dma.h> | ||
16 | #include <mach/map.h> | ||
17 | #include <mach/irqs.h> | ||
18 | #include <mach/spi-clocks.h> | ||
19 | |||
20 | #include <plat/s3c64xx-spi.h> | ||
21 | #include <plat/gpio-cfg.h> | ||
22 | |||
23 | static char *spi_src_clks[] = { | ||
24 | [S5P6442_SPI_SRCCLK_PCLK] = "pclk", | ||
25 | [S5P6442_SPI_SRCCLK_SCLK] = "spi_epll", | ||
26 | }; | ||
27 | |||
28 | /* SPI Controller platform_devices */ | ||
29 | |||
30 | /* Since we emulate multi-cs capability, we do not touch the CS. | ||
31 | * The emulated CS is toggled by board specific mechanism, as it can | ||
32 | * be either some immediate GPIO or some signal out of some other | ||
33 | * chip in between ... or some yet another way. | ||
34 | * We simply do not assume anything about CS. | ||
35 | */ | ||
36 | static int s5p6442_spi_cfg_gpio(struct platform_device *pdev) | ||
37 | { | ||
38 | switch (pdev->id) { | ||
39 | case 0: | ||
40 | s3c_gpio_cfgpin(S5P6442_GPB(0), S3C_GPIO_SFN(2)); | ||
41 | s3c_gpio_setpull(S5P6442_GPB(0), S3C_GPIO_PULL_UP); | ||
42 | s3c_gpio_cfgall_range(S5P6442_GPB(2), 2, | ||
43 | S3C_GPIO_SFN(2), S3C_GPIO_PULL_UP); | ||
44 | break; | ||
45 | |||
46 | default: | ||
47 | dev_err(&pdev->dev, "Invalid SPI Controller number!"); | ||
48 | return -EINVAL; | ||
49 | } | ||
50 | |||
51 | return 0; | ||
52 | } | ||
53 | |||
54 | static struct resource s5p6442_spi0_resource[] = { | ||
55 | [0] = { | ||
56 | .start = S5P6442_PA_SPI, | ||
57 | .end = S5P6442_PA_SPI + 0x100 - 1, | ||
58 | .flags = IORESOURCE_MEM, | ||
59 | }, | ||
60 | [1] = { | ||
61 | .start = DMACH_SPI0_TX, | ||
62 | .end = DMACH_SPI0_TX, | ||
63 | .flags = IORESOURCE_DMA, | ||
64 | }, | ||
65 | [2] = { | ||
66 | .start = DMACH_SPI0_RX, | ||
67 | .end = DMACH_SPI0_RX, | ||
68 | .flags = IORESOURCE_DMA, | ||
69 | }, | ||
70 | [3] = { | ||
71 | .start = IRQ_SPI0, | ||
72 | .end = IRQ_SPI0, | ||
73 | .flags = IORESOURCE_IRQ, | ||
74 | }, | ||
75 | }; | ||
76 | |||
77 | static struct s3c64xx_spi_info s5p6442_spi0_pdata = { | ||
78 | .cfg_gpio = s5p6442_spi_cfg_gpio, | ||
79 | .fifo_lvl_mask = 0x1ff, | ||
80 | .rx_lvl_offset = 15, | ||
81 | }; | ||
82 | |||
83 | static u64 spi_dmamask = DMA_BIT_MASK(32); | ||
84 | |||
85 | struct platform_device s5p6442_device_spi = { | ||
86 | .name = "s3c64xx-spi", | ||
87 | .id = 0, | ||
88 | .num_resources = ARRAY_SIZE(s5p6442_spi0_resource), | ||
89 | .resource = s5p6442_spi0_resource, | ||
90 | .dev = { | ||
91 | .dma_mask = &spi_dmamask, | ||
92 | .coherent_dma_mask = DMA_BIT_MASK(32), | ||
93 | .platform_data = &s5p6442_spi0_pdata, | ||
94 | }, | ||
95 | }; | ||
96 | |||
97 | void __init s5p6442_spi_set_info(int cntrlr, int src_clk_nr, int num_cs) | ||
98 | { | ||
99 | struct s3c64xx_spi_info *pd; | ||
100 | |||
101 | /* Reject invalid configuration */ | ||
102 | if (!num_cs || src_clk_nr < 0 | ||
103 | || src_clk_nr > S5P6442_SPI_SRCCLK_SCLK) { | ||
104 | printk(KERN_ERR "%s: Invalid SPI configuration\n", __func__); | ||
105 | return; | ||
106 | } | ||
107 | |||
108 | switch (cntrlr) { | ||
109 | case 0: | ||
110 | pd = &s5p6442_spi0_pdata; | ||
111 | break; | ||
112 | default: | ||
113 | printk(KERN_ERR "%s: Invalid SPI controller(%d)\n", | ||
114 | __func__, cntrlr); | ||
115 | return; | ||
116 | } | ||
117 | |||
118 | pd->num_cs = num_cs; | ||
119 | pd->src_clk_nr = src_clk_nr; | ||
120 | pd->src_clk_name = spi_src_clks[src_clk_nr]; | ||
121 | } | ||
diff --git a/arch/arm/mach-s5p6442/dma.c b/arch/arm/mach-s5p6442/dma.c deleted file mode 100644 index 7dfb13654f8a..000000000000 --- a/arch/arm/mach-s5p6442/dma.c +++ /dev/null | |||
@@ -1,105 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2010 Samsung Electronics Co. Ltd. | ||
3 | * Jaswinder Singh <jassi.brar@samsung.com> | ||
4 | * | ||
5 | * This program is free software; you can redistribute it and/or modify | ||
6 | * it under the terms of the GNU General Public License as published by | ||
7 | * the Free Software Foundation; either version 2 of the License, or | ||
8 | * (at your option) any later version. | ||
9 | * | ||
10 | * This program is distributed in the hope that it will be useful, | ||
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
13 | * GNU General Public License for more details. | ||
14 | * | ||
15 | * You should have received a copy of the GNU General Public License | ||
16 | * along with this program; if not, write to the Free Software | ||
17 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | ||
18 | */ | ||
19 | |||
20 | #include <linux/platform_device.h> | ||
21 | #include <linux/dma-mapping.h> | ||
22 | |||
23 | #include <plat/devs.h> | ||
24 | #include <plat/irqs.h> | ||
25 | |||
26 | #include <mach/map.h> | ||
27 | #include <mach/irqs.h> | ||
28 | |||
29 | #include <plat/s3c-pl330-pdata.h> | ||
30 | |||
31 | static u64 dma_dmamask = DMA_BIT_MASK(32); | ||
32 | |||
33 | static struct resource s5p6442_pdma_resource[] = { | ||
34 | [0] = { | ||
35 | .start = S5P6442_PA_PDMA, | ||
36 | .end = S5P6442_PA_PDMA + SZ_4K, | ||
37 | .flags = IORESOURCE_MEM, | ||
38 | }, | ||
39 | [1] = { | ||
40 | .start = IRQ_PDMA, | ||
41 | .end = IRQ_PDMA, | ||
42 | .flags = IORESOURCE_IRQ, | ||
43 | }, | ||
44 | }; | ||
45 | |||
46 | static struct s3c_pl330_platdata s5p6442_pdma_pdata = { | ||
47 | .peri = { | ||
48 | [0] = DMACH_UART0_RX, | ||
49 | [1] = DMACH_UART0_TX, | ||
50 | [2] = DMACH_UART1_RX, | ||
51 | [3] = DMACH_UART1_TX, | ||
52 | [4] = DMACH_UART2_RX, | ||
53 | [5] = DMACH_UART2_TX, | ||
54 | [6] = DMACH_MAX, | ||
55 | [7] = DMACH_MAX, | ||
56 | [8] = DMACH_MAX, | ||
57 | [9] = DMACH_I2S0_RX, | ||
58 | [10] = DMACH_I2S0_TX, | ||
59 | [11] = DMACH_I2S0S_TX, | ||
60 | [12] = DMACH_I2S1_RX, | ||
61 | [13] = DMACH_I2S1_TX, | ||
62 | [14] = DMACH_MAX, | ||
63 | [15] = DMACH_MAX, | ||
64 | [16] = DMACH_SPI0_RX, | ||
65 | [17] = DMACH_SPI0_TX, | ||
66 | [18] = DMACH_MAX, | ||
67 | [19] = DMACH_MAX, | ||
68 | [20] = DMACH_PCM0_RX, | ||
69 | [21] = DMACH_PCM0_TX, | ||
70 | [22] = DMACH_PCM1_RX, | ||
71 | [23] = DMACH_PCM1_TX, | ||
72 | [24] = DMACH_MAX, | ||
73 | [25] = DMACH_MAX, | ||
74 | [26] = DMACH_MAX, | ||
75 | [27] = DMACH_MSM_REQ0, | ||
76 | [28] = DMACH_MSM_REQ1, | ||
77 | [29] = DMACH_MSM_REQ2, | ||
78 | [30] = DMACH_MSM_REQ3, | ||
79 | [31] = DMACH_MAX, | ||
80 | }, | ||
81 | }; | ||
82 | |||
83 | static struct platform_device s5p6442_device_pdma = { | ||
84 | .name = "s3c-pl330", | ||
85 | .id = -1, | ||
86 | .num_resources = ARRAY_SIZE(s5p6442_pdma_resource), | ||
87 | .resource = s5p6442_pdma_resource, | ||
88 | .dev = { | ||
89 | .dma_mask = &dma_dmamask, | ||
90 | .coherent_dma_mask = DMA_BIT_MASK(32), | ||
91 | .platform_data = &s5p6442_pdma_pdata, | ||
92 | }, | ||
93 | }; | ||
94 | |||
95 | static struct platform_device *s5p6442_dmacs[] __initdata = { | ||
96 | &s5p6442_device_pdma, | ||
97 | }; | ||
98 | |||
99 | static int __init s5p6442_dma_init(void) | ||
100 | { | ||
101 | platform_add_devices(s5p6442_dmacs, ARRAY_SIZE(s5p6442_dmacs)); | ||
102 | |||
103 | return 0; | ||
104 | } | ||
105 | arch_initcall(s5p6442_dma_init); | ||
diff --git a/arch/arm/mach-s5p6442/include/mach/debug-macro.S b/arch/arm/mach-s5p6442/include/mach/debug-macro.S deleted file mode 100644 index e2213205d780..000000000000 --- a/arch/arm/mach-s5p6442/include/mach/debug-macro.S +++ /dev/null | |||
@@ -1,35 +0,0 @@ | |||
1 | /* linux/arch/arm/mach-s5p6442/include/mach/debug-macro.S | ||
2 | * | ||
3 | * Copyright (c) 2010 Samsung Electronics Co., Ltd. | ||
4 | * http://www.samsung.com/ | ||
5 | * | ||
6 | * Based on arch/arm/mach-s3c6400/include/mach/debug-macro.S | ||
7 | * | ||
8 | * This program is free software; you can redistribute it and/or modify | ||
9 | * it under the terms of the GNU General Public License version 2 as | ||
10 | * published by the Free Software Foundation. | ||
11 | */ | ||
12 | |||
13 | /* pull in the relevant register and map files. */ | ||
14 | |||
15 | #include <mach/map.h> | ||
16 | #include <plat/regs-serial.h> | ||
17 | |||
18 | .macro addruart, rp, rv | ||
19 | ldr \rp, = S3C_PA_UART | ||
20 | ldr \rv, = S3C_VA_UART | ||
21 | #if CONFIG_DEBUG_S3C_UART != 0 | ||
22 | add \rp, \rp, #(0x400 * CONFIG_DEBUG_S3C_UART) | ||
23 | add \rv, \rv, #(0x400 * CONFIG_DEBUG_S3C_UART) | ||
24 | #endif | ||
25 | .endm | ||
26 | |||
27 | #define fifo_full fifo_full_s5pv210 | ||
28 | #define fifo_level fifo_level_s5pv210 | ||
29 | |||
30 | /* include the reset of the code which will do the work, we're only | ||
31 | * compiling for a single cpu processor type so the default of s3c2440 | ||
32 | * will be fine with us. | ||
33 | */ | ||
34 | |||
35 | #include <plat/debug-macro.S> | ||
diff --git a/arch/arm/mach-s5p6442/include/mach/dma.h b/arch/arm/mach-s5p6442/include/mach/dma.h deleted file mode 100644 index 81209eb1409b..000000000000 --- a/arch/arm/mach-s5p6442/include/mach/dma.h +++ /dev/null | |||
@@ -1,26 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2010 Samsung Electronics Co. Ltd. | ||
3 | * Jaswinder Singh <jassi.brar@samsung.com> | ||
4 | * | ||
5 | * This program is free software; you can redistribute it and/or modify | ||
6 | * it under the terms of the GNU General Public License as published by | ||
7 | * the Free Software Foundation; either version 2 of the License, or | ||
8 | * (at your option) any later version. | ||
9 | * | ||
10 | * This program is distributed in the hope that it will be useful, | ||
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
13 | * GNU General Public License for more details. | ||
14 | * | ||
15 | * You should have received a copy of the GNU General Public License | ||
16 | * along with this program; if not, write to the Free Software | ||
17 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | ||
18 | */ | ||
19 | |||
20 | #ifndef __MACH_DMA_H | ||
21 | #define __MACH_DMA_H | ||
22 | |||
23 | /* This platform uses the common S3C DMA API driver for PL330 */ | ||
24 | #include <plat/s3c-dma-pl330.h> | ||
25 | |||
26 | #endif /* __MACH_DMA_H */ | ||
diff --git a/arch/arm/mach-s5p6442/include/mach/entry-macro.S b/arch/arm/mach-s5p6442/include/mach/entry-macro.S deleted file mode 100644 index 6d574edbf1ae..000000000000 --- a/arch/arm/mach-s5p6442/include/mach/entry-macro.S +++ /dev/null | |||
@@ -1,48 +0,0 @@ | |||
1 | /* linux/arch/arm/mach-s5p6442/include/mach/entry-macro.S | ||
2 | * | ||
3 | * Copyright (c) 2010 Samsung Electronics Co., Ltd. | ||
4 | * http://www.samsung.com/ | ||
5 | * | ||
6 | * Low-level IRQ helper macros for the Samsung S5P6442 | ||
7 | * | ||
8 | * This program is free software; you can redistribute it and/or modify | ||
9 | * it under the terms of the GNU General Public License version 2 as | ||
10 | * published by the Free Software Foundation. | ||
11 | */ | ||
12 | |||
13 | #include <asm/hardware/vic.h> | ||
14 | #include <mach/map.h> | ||
15 | #include <plat/irqs.h> | ||
16 | |||
17 | .macro disable_fiq | ||
18 | .endm | ||
19 | |||
20 | .macro get_irqnr_preamble, base, tmp | ||
21 | ldr \base, =VA_VIC0 | ||
22 | .endm | ||
23 | |||
24 | .macro arch_ret_to_user, tmp1, tmp2 | ||
25 | .endm | ||
26 | |||
27 | .macro get_irqnr_and_base, irqnr, irqstat, base, tmp | ||
28 | |||
29 | @ check the vic0 | ||
30 | mov \irqnr, # S5P_IRQ_OFFSET + 31 | ||
31 | ldr \irqstat, [ \base, # VIC_IRQ_STATUS ] | ||
32 | teq \irqstat, #0 | ||
33 | |||
34 | @ otherwise try vic1 | ||
35 | addeq \tmp, \base, #(VA_VIC1 - VA_VIC0) | ||
36 | addeq \irqnr, \irqnr, #32 | ||
37 | ldreq \irqstat, [ \tmp, # VIC_IRQ_STATUS ] | ||
38 | teqeq \irqstat, #0 | ||
39 | |||
40 | @ otherwise try vic2 | ||
41 | addeq \tmp, \base, #(VA_VIC2 - VA_VIC0) | ||
42 | addeq \irqnr, \irqnr, #32 | ||
43 | ldreq \irqstat, [ \tmp, # VIC_IRQ_STATUS ] | ||
44 | teqeq \irqstat, #0 | ||
45 | |||
46 | clzne \irqstat, \irqstat | ||
47 | subne \irqnr, \irqnr, \irqstat | ||
48 | .endm | ||
diff --git a/arch/arm/mach-s5p6442/include/mach/gpio.h b/arch/arm/mach-s5p6442/include/mach/gpio.h deleted file mode 100644 index b8715df2fdab..000000000000 --- a/arch/arm/mach-s5p6442/include/mach/gpio.h +++ /dev/null | |||
@@ -1,123 +0,0 @@ | |||
1 | /* linux/arch/arm/mach-s5p6442/include/mach/gpio.h | ||
2 | * | ||
3 | * Copyright (c) 2010 Samsung Electronics Co., Ltd. | ||
4 | * http://www.samsung.com/ | ||
5 | * | ||
6 | * S5P6442 - GPIO lib support | ||
7 | * | ||
8 | * This program is free software; you can redistribute it and/or modify | ||
9 | * it under the terms of the GNU General Public License version 2 as | ||
10 | * published by the Free Software Foundation. | ||
11 | */ | ||
12 | |||
13 | #ifndef __ASM_ARCH_GPIO_H | ||
14 | #define __ASM_ARCH_GPIO_H __FILE__ | ||
15 | |||
16 | #define gpio_get_value __gpio_get_value | ||
17 | #define gpio_set_value __gpio_set_value | ||
18 | #define gpio_cansleep __gpio_cansleep | ||
19 | #define gpio_to_irq __gpio_to_irq | ||
20 | |||
21 | /* GPIO bank sizes */ | ||
22 | #define S5P6442_GPIO_A0_NR (8) | ||
23 | #define S5P6442_GPIO_A1_NR (2) | ||
24 | #define S5P6442_GPIO_B_NR (4) | ||
25 | #define S5P6442_GPIO_C0_NR (5) | ||
26 | #define S5P6442_GPIO_C1_NR (5) | ||
27 | #define S5P6442_GPIO_D0_NR (2) | ||
28 | #define S5P6442_GPIO_D1_NR (6) | ||
29 | #define S5P6442_GPIO_E0_NR (8) | ||
30 | #define S5P6442_GPIO_E1_NR (5) | ||
31 | #define S5P6442_GPIO_F0_NR (8) | ||
32 | #define S5P6442_GPIO_F1_NR (8) | ||
33 | #define S5P6442_GPIO_F2_NR (8) | ||
34 | #define S5P6442_GPIO_F3_NR (6) | ||
35 | #define S5P6442_GPIO_G0_NR (7) | ||
36 | #define S5P6442_GPIO_G1_NR (7) | ||
37 | #define S5P6442_GPIO_G2_NR (7) | ||
38 | #define S5P6442_GPIO_H0_NR (8) | ||
39 | #define S5P6442_GPIO_H1_NR (8) | ||
40 | #define S5P6442_GPIO_H2_NR (8) | ||
41 | #define S5P6442_GPIO_H3_NR (8) | ||
42 | #define S5P6442_GPIO_J0_NR (8) | ||
43 | #define S5P6442_GPIO_J1_NR (6) | ||
44 | #define S5P6442_GPIO_J2_NR (8) | ||
45 | #define S5P6442_GPIO_J3_NR (8) | ||
46 | #define S5P6442_GPIO_J4_NR (5) | ||
47 | |||
48 | /* GPIO bank numbers */ | ||
49 | |||
50 | /* CONFIG_S3C_GPIO_SPACE allows the user to select extra | ||
51 | * space for debugging purposes so that any accidental | ||
52 | * change from one gpio bank to another can be caught. | ||
53 | */ | ||
54 | |||
55 | #define S5P6442_GPIO_NEXT(__gpio) \ | ||
56 | ((__gpio##_START) + (__gpio##_NR) + CONFIG_S3C_GPIO_SPACE + 1) | ||
57 | |||
58 | enum s5p_gpio_number { | ||
59 | S5P6442_GPIO_A0_START = 0, | ||
60 | S5P6442_GPIO_A1_START = S5P6442_GPIO_NEXT(S5P6442_GPIO_A0), | ||
61 | S5P6442_GPIO_B_START = S5P6442_GPIO_NEXT(S5P6442_GPIO_A1), | ||
62 | S5P6442_GPIO_C0_START = S5P6442_GPIO_NEXT(S5P6442_GPIO_B), | ||
63 | S5P6442_GPIO_C1_START = S5P6442_GPIO_NEXT(S5P6442_GPIO_C0), | ||
64 | S5P6442_GPIO_D0_START = S5P6442_GPIO_NEXT(S5P6442_GPIO_C1), | ||
65 | S5P6442_GPIO_D1_START = S5P6442_GPIO_NEXT(S5P6442_GPIO_D0), | ||
66 | S5P6442_GPIO_E0_START = S5P6442_GPIO_NEXT(S5P6442_GPIO_D1), | ||
67 | S5P6442_GPIO_E1_START = S5P6442_GPIO_NEXT(S5P6442_GPIO_E0), | ||
68 | S5P6442_GPIO_F0_START = S5P6442_GPIO_NEXT(S5P6442_GPIO_E1), | ||
69 | S5P6442_GPIO_F1_START = S5P6442_GPIO_NEXT(S5P6442_GPIO_F0), | ||
70 | S5P6442_GPIO_F2_START = S5P6442_GPIO_NEXT(S5P6442_GPIO_F1), | ||
71 | S5P6442_GPIO_F3_START = S5P6442_GPIO_NEXT(S5P6442_GPIO_F2), | ||
72 | S5P6442_GPIO_G0_START = S5P6442_GPIO_NEXT(S5P6442_GPIO_F3), | ||
73 | S5P6442_GPIO_G1_START = S5P6442_GPIO_NEXT(S5P6442_GPIO_G0), | ||
74 | S5P6442_GPIO_G2_START = S5P6442_GPIO_NEXT(S5P6442_GPIO_G1), | ||
75 | S5P6442_GPIO_H0_START = S5P6442_GPIO_NEXT(S5P6442_GPIO_G2), | ||
76 | S5P6442_GPIO_H1_START = S5P6442_GPIO_NEXT(S5P6442_GPIO_H0), | ||
77 | S5P6442_GPIO_H2_START = S5P6442_GPIO_NEXT(S5P6442_GPIO_H1), | ||
78 | S5P6442_GPIO_H3_START = S5P6442_GPIO_NEXT(S5P6442_GPIO_H2), | ||
79 | S5P6442_GPIO_J0_START = S5P6442_GPIO_NEXT(S5P6442_GPIO_H3), | ||
80 | S5P6442_GPIO_J1_START = S5P6442_GPIO_NEXT(S5P6442_GPIO_J0), | ||
81 | S5P6442_GPIO_J2_START = S5P6442_GPIO_NEXT(S5P6442_GPIO_J1), | ||
82 | S5P6442_GPIO_J3_START = S5P6442_GPIO_NEXT(S5P6442_GPIO_J2), | ||
83 | S5P6442_GPIO_J4_START = S5P6442_GPIO_NEXT(S5P6442_GPIO_J3), | ||
84 | }; | ||
85 | |||
86 | /* S5P6442 GPIO number definitions. */ | ||
87 | #define S5P6442_GPA0(_nr) (S5P6442_GPIO_A0_START + (_nr)) | ||
88 | #define S5P6442_GPA1(_nr) (S5P6442_GPIO_A1_START + (_nr)) | ||
89 | #define S5P6442_GPB(_nr) (S5P6442_GPIO_B_START + (_nr)) | ||
90 | #define S5P6442_GPC0(_nr) (S5P6442_GPIO_C0_START + (_nr)) | ||
91 | #define S5P6442_GPC1(_nr) (S5P6442_GPIO_C1_START + (_nr)) | ||
92 | #define S5P6442_GPD0(_nr) (S5P6442_GPIO_D0_START + (_nr)) | ||
93 | #define S5P6442_GPD1(_nr) (S5P6442_GPIO_D1_START + (_nr)) | ||
94 | #define S5P6442_GPE0(_nr) (S5P6442_GPIO_E0_START + (_nr)) | ||
95 | #define S5P6442_GPE1(_nr) (S5P6442_GPIO_E1_START + (_nr)) | ||
96 | #define S5P6442_GPF0(_nr) (S5P6442_GPIO_F0_START + (_nr)) | ||
97 | #define S5P6442_GPF1(_nr) (S5P6442_GPIO_F1_START + (_nr)) | ||
98 | #define S5P6442_GPF2(_nr) (S5P6442_GPIO_F2_START + (_nr)) | ||
99 | #define S5P6442_GPF3(_nr) (S5P6442_GPIO_F3_START + (_nr)) | ||
100 | #define S5P6442_GPG0(_nr) (S5P6442_GPIO_G0_START + (_nr)) | ||
101 | #define S5P6442_GPG1(_nr) (S5P6442_GPIO_G1_START + (_nr)) | ||
102 | #define S5P6442_GPG2(_nr) (S5P6442_GPIO_G2_START + (_nr)) | ||
103 | #define S5P6442_GPH0(_nr) (S5P6442_GPIO_H0_START + (_nr)) | ||
104 | #define S5P6442_GPH1(_nr) (S5P6442_GPIO_H1_START + (_nr)) | ||
105 | #define S5P6442_GPH2(_nr) (S5P6442_GPIO_H2_START + (_nr)) | ||
106 | #define S5P6442_GPH3(_nr) (S5P6442_GPIO_H3_START + (_nr)) | ||
107 | #define S5P6442_GPJ0(_nr) (S5P6442_GPIO_J0_START + (_nr)) | ||
108 | #define S5P6442_GPJ1(_nr) (S5P6442_GPIO_J1_START + (_nr)) | ||
109 | #define S5P6442_GPJ2(_nr) (S5P6442_GPIO_J2_START + (_nr)) | ||
110 | #define S5P6442_GPJ3(_nr) (S5P6442_GPIO_J3_START + (_nr)) | ||
111 | #define S5P6442_GPJ4(_nr) (S5P6442_GPIO_J4_START + (_nr)) | ||
112 | |||
113 | /* the end of the S5P6442 specific gpios */ | ||
114 | #define S5P6442_GPIO_END (S5P6442_GPJ4(S5P6442_GPIO_J4_NR) + 1) | ||
115 | #define S3C_GPIO_END S5P6442_GPIO_END | ||
116 | |||
117 | /* define the number of gpios we need to the one after the GPJ4() range */ | ||
118 | #define ARCH_NR_GPIOS (S5P6442_GPJ4(S5P6442_GPIO_J4_NR) + \ | ||
119 | CONFIG_SAMSUNG_GPIO_EXTRA + 1) | ||
120 | |||
121 | #include <asm-generic/gpio.h> | ||
122 | |||
123 | #endif /* __ASM_ARCH_GPIO_H */ | ||
diff --git a/arch/arm/mach-s5p6442/include/mach/hardware.h b/arch/arm/mach-s5p6442/include/mach/hardware.h deleted file mode 100644 index 8cd7b67b49d4..000000000000 --- a/arch/arm/mach-s5p6442/include/mach/hardware.h +++ /dev/null | |||
@@ -1,18 +0,0 @@ | |||
1 | /* linux/arch/arm/mach-s5p6442/include/mach/hardware.h | ||
2 | * | ||
3 | * Copyright (c) 2010 Samsung Electronics Co., Ltd. | ||
4 | * http://www.samsung.com/ | ||
5 | * | ||
6 | * S5P6442 - Hardware support | ||
7 | * | ||
8 | * This program is free software; you can redistribute it and/or modify | ||
9 | * it under the terms of the GNU General Public License version 2 as | ||
10 | * published by the Free Software Foundation. | ||
11 | */ | ||
12 | |||
13 | #ifndef __ASM_ARCH_HARDWARE_H | ||
14 | #define __ASM_ARCH_HARDWARE_H __FILE__ | ||
15 | |||
16 | /* currently nothing here, placeholder */ | ||
17 | |||
18 | #endif /* __ASM_ARCH_HARDWARE_H */ | ||
diff --git a/arch/arm/mach-s5p6442/include/mach/io.h b/arch/arm/mach-s5p6442/include/mach/io.h deleted file mode 100644 index 5d2195ad0b67..000000000000 --- a/arch/arm/mach-s5p6442/include/mach/io.h +++ /dev/null | |||
@@ -1,17 +0,0 @@ | |||
1 | /* arch/arm/mach-s5p6442/include/mach/io.h | ||
2 | * | ||
3 | * Copyright 2008-2010 Ben Dooks <ben-linux@fluff.org> | ||
4 | * | ||
5 | * Default IO routines for S5P6442 | ||
6 | */ | ||
7 | |||
8 | #ifndef __ASM_ARM_ARCH_IO_H | ||
9 | #define __ASM_ARM_ARCH_IO_H | ||
10 | |||
11 | /* No current ISA/PCI bus support. */ | ||
12 | #define __io(a) __typesafe_io(a) | ||
13 | #define __mem_pci(a) (a) | ||
14 | |||
15 | #define IO_SPACE_LIMIT (0xFFFFFFFF) | ||
16 | |||
17 | #endif | ||
diff --git a/arch/arm/mach-s5p6442/include/mach/irqs.h b/arch/arm/mach-s5p6442/include/mach/irqs.h deleted file mode 100644 index 3fbc6c3ad2da..000000000000 --- a/arch/arm/mach-s5p6442/include/mach/irqs.h +++ /dev/null | |||
@@ -1,87 +0,0 @@ | |||
1 | /* linux/arch/arm/mach-s5p6442/include/mach/irqs.h | ||
2 | * | ||
3 | * Copyright (c) 2010 Samsung Electronics Co., Ltd. | ||
4 | * http://www.samsung.com/ | ||
5 | * | ||
6 | * S5P6442 - IRQ definitions | ||
7 | * | ||
8 | * This program is free software; you can redistribute it and/or modify | ||
9 | * it under the terms of the GNU General Public License version 2 as | ||
10 | * published by the Free Software Foundation. | ||
11 | */ | ||
12 | |||
13 | #ifndef __ASM_ARCH_IRQS_H | ||
14 | #define __ASM_ARCH_IRQS_H __FILE__ | ||
15 | |||
16 | #include <plat/irqs.h> | ||
17 | |||
18 | /* VIC0 */ | ||
19 | #define IRQ_EINT16_31 S5P_IRQ_VIC0(16) | ||
20 | #define IRQ_BATF S5P_IRQ_VIC0(17) | ||
21 | #define IRQ_MDMA S5P_IRQ_VIC0(18) | ||
22 | #define IRQ_PDMA S5P_IRQ_VIC0(19) | ||
23 | #define IRQ_TIMER0_VIC S5P_IRQ_VIC0(21) | ||
24 | #define IRQ_TIMER1_VIC S5P_IRQ_VIC0(22) | ||
25 | #define IRQ_TIMER2_VIC S5P_IRQ_VIC0(23) | ||
26 | #define IRQ_TIMER3_VIC S5P_IRQ_VIC0(24) | ||
27 | #define IRQ_TIMER4_VIC S5P_IRQ_VIC0(25) | ||
28 | #define IRQ_SYSTIMER S5P_IRQ_VIC0(26) | ||
29 | #define IRQ_WDT S5P_IRQ_VIC0(27) | ||
30 | #define IRQ_RTC_ALARM S5P_IRQ_VIC0(28) | ||
31 | #define IRQ_RTC_TIC S5P_IRQ_VIC0(29) | ||
32 | #define IRQ_GPIOINT S5P_IRQ_VIC0(30) | ||
33 | |||
34 | /* VIC1 */ | ||
35 | #define IRQ_PMU S5P_IRQ_VIC1(0) | ||
36 | #define IRQ_ONENAND S5P_IRQ_VIC1(7) | ||
37 | #define IRQ_UART0 S5P_IRQ_VIC1(10) | ||
38 | #define IRQ_UART1 S5P_IRQ_VIC1(11) | ||
39 | #define IRQ_UART2 S5P_IRQ_VIC1(12) | ||
40 | #define IRQ_SPI0 S5P_IRQ_VIC1(15) | ||
41 | #define IRQ_IIC S5P_IRQ_VIC1(19) | ||
42 | #define IRQ_IIC1 S5P_IRQ_VIC1(20) | ||
43 | #define IRQ_IIC2 S5P_IRQ_VIC1(21) | ||
44 | #define IRQ_OTG S5P_IRQ_VIC1(24) | ||
45 | #define IRQ_MSM S5P_IRQ_VIC1(25) | ||
46 | #define IRQ_HSMMC0 S5P_IRQ_VIC1(26) | ||
47 | #define IRQ_HSMMC1 S5P_IRQ_VIC1(27) | ||
48 | #define IRQ_HSMMC2 S5P_IRQ_VIC1(28) | ||
49 | #define IRQ_COMMRX S5P_IRQ_VIC1(29) | ||
50 | #define IRQ_COMMTX S5P_IRQ_VIC1(30) | ||
51 | |||
52 | /* VIC2 */ | ||
53 | #define IRQ_LCD0 S5P_IRQ_VIC2(0) | ||
54 | #define IRQ_LCD1 S5P_IRQ_VIC2(1) | ||
55 | #define IRQ_LCD2 S5P_IRQ_VIC2(2) | ||
56 | #define IRQ_LCD3 S5P_IRQ_VIC2(3) | ||
57 | #define IRQ_ROTATOR S5P_IRQ_VIC2(4) | ||
58 | #define IRQ_FIMC0 S5P_IRQ_VIC2(5) | ||
59 | #define IRQ_FIMC1 S5P_IRQ_VIC2(6) | ||
60 | #define IRQ_FIMC2 S5P_IRQ_VIC2(7) | ||
61 | #define IRQ_JPEG S5P_IRQ_VIC2(8) | ||
62 | #define IRQ_3D S5P_IRQ_VIC2(10) | ||
63 | #define IRQ_Mixer S5P_IRQ_VIC2(11) | ||
64 | #define IRQ_MFC S5P_IRQ_VIC2(14) | ||
65 | #define IRQ_TVENC S5P_IRQ_VIC2(15) | ||
66 | #define IRQ_I2S0 S5P_IRQ_VIC2(16) | ||
67 | #define IRQ_I2S1 S5P_IRQ_VIC2(17) | ||
68 | #define IRQ_RP S5P_IRQ_VIC2(19) | ||
69 | #define IRQ_PCM0 S5P_IRQ_VIC2(20) | ||
70 | #define IRQ_PCM1 S5P_IRQ_VIC2(21) | ||
71 | #define IRQ_ADC S5P_IRQ_VIC2(23) | ||
72 | #define IRQ_PENDN S5P_IRQ_VIC2(24) | ||
73 | #define IRQ_KEYPAD S5P_IRQ_VIC2(25) | ||
74 | #define IRQ_SSS_INT S5P_IRQ_VIC2(27) | ||
75 | #define IRQ_SSS_HASH S5P_IRQ_VIC2(28) | ||
76 | #define IRQ_VIC_END S5P_IRQ_VIC2(31) | ||
77 | |||
78 | #define S5P_IRQ_EINT_BASE (IRQ_VIC_END + 1) | ||
79 | |||
80 | #define S5P_EINT_BASE1 (S5P_IRQ_VIC0(0)) | ||
81 | #define S5P_EINT_BASE2 (S5P_IRQ_EINT_BASE) | ||
82 | |||
83 | /* Set the default NR_IRQS */ | ||
84 | |||
85 | #define NR_IRQS (IRQ_EINT(31) + 1) | ||
86 | |||
87 | #endif /* __ASM_ARCH_IRQS_H */ | ||
diff --git a/arch/arm/mach-s5p6442/include/mach/map.h b/arch/arm/mach-s5p6442/include/mach/map.h deleted file mode 100644 index 058dab4482a1..000000000000 --- a/arch/arm/mach-s5p6442/include/mach/map.h +++ /dev/null | |||
@@ -1,76 +0,0 @@ | |||
1 | /* linux/arch/arm/mach-s5p6442/include/mach/map.h | ||
2 | * | ||
3 | * Copyright (c) 2010-2011 Samsung Electronics Co., Ltd. | ||
4 | * http://www.samsung.com/ | ||
5 | * | ||
6 | * S5P6442 - Memory map definitions | ||
7 | * | ||
8 | * This program is free software; you can redistribute it and/or modify | ||
9 | * it under the terms of the GNU General Public License version 2 as | ||
10 | * published by the Free Software Foundation. | ||
11 | */ | ||
12 | |||
13 | #ifndef __ASM_ARCH_MAP_H | ||
14 | #define __ASM_ARCH_MAP_H __FILE__ | ||
15 | |||
16 | #include <plat/map-base.h> | ||
17 | #include <plat/map-s5p.h> | ||
18 | |||
19 | #define S5P6442_PA_SDRAM 0x20000000 | ||
20 | |||
21 | #define S5P6442_PA_I2S0 0xC0B00000 | ||
22 | #define S5P6442_PA_I2S1 0xF2200000 | ||
23 | |||
24 | #define S5P6442_PA_CHIPID 0xE0000000 | ||
25 | |||
26 | #define S5P6442_PA_SYSCON 0xE0100000 | ||
27 | |||
28 | #define S5P6442_PA_GPIO 0xE0200000 | ||
29 | |||
30 | #define S5P6442_PA_VIC0 0xE4000000 | ||
31 | #define S5P6442_PA_VIC1 0xE4100000 | ||
32 | #define S5P6442_PA_VIC2 0xE4200000 | ||
33 | |||
34 | #define S5P6442_PA_SROMC 0xE7000000 | ||
35 | |||
36 | #define S5P6442_PA_MDMA 0xE8000000 | ||
37 | #define S5P6442_PA_PDMA 0xE9000000 | ||
38 | |||
39 | #define S5P6442_PA_TIMER 0xEA000000 | ||
40 | |||
41 | #define S5P6442_PA_SYSTIMER 0xEA100000 | ||
42 | |||
43 | #define S5P6442_PA_WATCHDOG 0xEA200000 | ||
44 | |||
45 | #define S5P6442_PA_UART 0xEC000000 | ||
46 | |||
47 | #define S5P6442_PA_IIC0 0xEC100000 | ||
48 | |||
49 | #define S5P6442_PA_SPI 0xEC300000 | ||
50 | |||
51 | #define S5P6442_PA_PCM0 0xF2400000 | ||
52 | #define S5P6442_PA_PCM1 0xF2500000 | ||
53 | |||
54 | /* Compatibiltiy Defines */ | ||
55 | |||
56 | #define S3C_PA_IIC S5P6442_PA_IIC0 | ||
57 | #define S3C_PA_WDT S5P6442_PA_WATCHDOG | ||
58 | |||
59 | #define S5P_PA_CHIPID S5P6442_PA_CHIPID | ||
60 | #define S5P_PA_SDRAM S5P6442_PA_SDRAM | ||
61 | #define S5P_PA_SROMC S5P6442_PA_SROMC | ||
62 | #define S5P_PA_SYSCON S5P6442_PA_SYSCON | ||
63 | #define S5P_PA_TIMER S5P6442_PA_TIMER | ||
64 | |||
65 | /* UART */ | ||
66 | |||
67 | #define S3C_PA_UART S5P6442_PA_UART | ||
68 | |||
69 | #define S5P_PA_UART(x) (S3C_PA_UART + ((x) * S3C_UART_OFFSET)) | ||
70 | #define S5P_PA_UART0 S5P_PA_UART(0) | ||
71 | #define S5P_PA_UART1 S5P_PA_UART(1) | ||
72 | #define S5P_PA_UART2 S5P_PA_UART(2) | ||
73 | |||
74 | #define S5P_SZ_UART SZ_256 | ||
75 | |||
76 | #endif /* __ASM_ARCH_MAP_H */ | ||
diff --git a/arch/arm/mach-s5p6442/include/mach/memory.h b/arch/arm/mach-s5p6442/include/mach/memory.h deleted file mode 100644 index cfe259dded33..000000000000 --- a/arch/arm/mach-s5p6442/include/mach/memory.h +++ /dev/null | |||
@@ -1,19 +0,0 @@ | |||
1 | /* linux/arch/arm/mach-s5p6442/include/mach/memory.h | ||
2 | * | ||
3 | * Copyright (c) 2010 Samsung Electronics Co., Ltd. | ||
4 | * http://www.samsung.com/ | ||
5 | * | ||
6 | * S5P6442 - Memory definitions | ||
7 | * | ||
8 | * This program is free software; you can redistribute it and/or modify | ||
9 | * it under the terms of the GNU General Public License version 2 as | ||
10 | * published by the Free Software Foundation. | ||
11 | */ | ||
12 | |||
13 | #ifndef __ASM_ARCH_MEMORY_H | ||
14 | #define __ASM_ARCH_MEMORY_H | ||
15 | |||
16 | #define PLAT_PHYS_OFFSET UL(0x20000000) | ||
17 | #define CONSISTENT_DMA_SIZE SZ_8M | ||
18 | |||
19 | #endif /* __ASM_ARCH_MEMORY_H */ | ||
diff --git a/arch/arm/mach-s5p6442/include/mach/pwm-clock.h b/arch/arm/mach-s5p6442/include/mach/pwm-clock.h deleted file mode 100644 index 2724b37def31..000000000000 --- a/arch/arm/mach-s5p6442/include/mach/pwm-clock.h +++ /dev/null | |||
@@ -1,70 +0,0 @@ | |||
1 | /* linux/arch/arm/mach-s5p6442/include/mach/pwm-clock.h | ||
2 | * | ||
3 | * Copyright (c) 2010 Samsung Electronics Co., Ltd. | ||
4 | * http://www.samsung.com/ | ||
5 | * | ||
6 | * Copyright 2008 Openmoko, Inc. | ||
7 | * Copyright 2008 Simtec Electronics | ||
8 | * Ben Dooks <ben@simtec.co.uk> | ||
9 | * http://armlinux.simtec.co.uk/ | ||
10 | * | ||
11 | * Based on arch/arm/mach-s3c64xx/include/mach/pwm-clock.h | ||
12 | * | ||
13 | * S5P6442 - pwm clock and timer support | ||
14 | * | ||
15 | * This program is free software; you can redistribute it and/or modify | ||
16 | * it under the terms of the GNU General Public License version 2 as | ||
17 | * published by the Free Software Foundation. | ||
18 | */ | ||
19 | |||
20 | #ifndef __ASM_ARCH_PWMCLK_H | ||
21 | #define __ASM_ARCH_PWMCLK_H __FILE__ | ||
22 | |||
23 | /** | ||
24 | * pwm_cfg_src_is_tclk() - return whether the given mux config is a tclk | ||
25 | * @tcfg: The timer TCFG1 register bits shifted down to 0. | ||
26 | * | ||
27 | * Return true if the given configuration from TCFG1 is a TCLK instead | ||
28 | * any of the TDIV clocks. | ||
29 | */ | ||
30 | static inline int pwm_cfg_src_is_tclk(unsigned long tcfg) | ||
31 | { | ||
32 | return tcfg == S3C64XX_TCFG1_MUX_TCLK; | ||
33 | } | ||
34 | |||
35 | /** | ||
36 | * tcfg_to_divisor() - convert tcfg1 setting to a divisor | ||
37 | * @tcfg1: The tcfg1 setting, shifted down. | ||
38 | * | ||
39 | * Get the divisor value for the given tcfg1 setting. We assume the | ||
40 | * caller has already checked to see if this is not a TCLK source. | ||
41 | */ | ||
42 | static inline unsigned long tcfg_to_divisor(unsigned long tcfg1) | ||
43 | { | ||
44 | return 1 << tcfg1; | ||
45 | } | ||
46 | |||
47 | /** | ||
48 | * pwm_tdiv_has_div1() - does the tdiv setting have a /1 | ||
49 | * | ||
50 | * Return true if we have a /1 in the tdiv setting. | ||
51 | */ | ||
52 | static inline unsigned int pwm_tdiv_has_div1(void) | ||
53 | { | ||
54 | return 1; | ||
55 | } | ||
56 | |||
57 | /** | ||
58 | * pwm_tdiv_div_bits() - calculate TCFG1 divisor value. | ||
59 | * @div: The divisor to calculate the bit information for. | ||
60 | * | ||
61 | * Turn a divisor into the necessary bit field for TCFG1. | ||
62 | */ | ||
63 | static inline unsigned long pwm_tdiv_div_bits(unsigned int div) | ||
64 | { | ||
65 | return ilog2(div); | ||
66 | } | ||
67 | |||
68 | #define S3C_TCFG1_MUX_TCLK S3C64XX_TCFG1_MUX_TCLK | ||
69 | |||
70 | #endif /* __ASM_ARCH_PWMCLK_H */ | ||
diff --git a/arch/arm/mach-s5p6442/include/mach/regs-clock.h b/arch/arm/mach-s5p6442/include/mach/regs-clock.h deleted file mode 100644 index 00828a336991..000000000000 --- a/arch/arm/mach-s5p6442/include/mach/regs-clock.h +++ /dev/null | |||
@@ -1,104 +0,0 @@ | |||
1 | /* linux/arch/arm/mach-s5p6442/include/mach/regs-clock.h | ||
2 | * | ||
3 | * Copyright (c) 2010 Samsung Electronics Co., Ltd. | ||
4 | * http://www.samsung.com/ | ||
5 | * | ||
6 | * S5P6442 - Clock register definitions | ||
7 | * | ||
8 | * This program is free software; you can redistribute it and/or modify | ||
9 | * it under the terms of the GNU General Public License version 2 as | ||
10 | * published by the Free Software Foundation. | ||
11 | */ | ||
12 | |||
13 | #ifndef __ASM_ARCH_REGS_CLOCK_H | ||
14 | #define __ASM_ARCH_REGS_CLOCK_H __FILE__ | ||
15 | |||
16 | #include <mach/map.h> | ||
17 | |||
18 | #define S5P_CLKREG(x) (S3C_VA_SYS + (x)) | ||
19 | |||
20 | #define S5P_APLL_LOCK S5P_CLKREG(0x00) | ||
21 | #define S5P_MPLL_LOCK S5P_CLKREG(0x08) | ||
22 | #define S5P_EPLL_LOCK S5P_CLKREG(0x10) | ||
23 | #define S5P_VPLL_LOCK S5P_CLKREG(0x20) | ||
24 | |||
25 | #define S5P_APLL_CON S5P_CLKREG(0x100) | ||
26 | #define S5P_MPLL_CON S5P_CLKREG(0x108) | ||
27 | #define S5P_EPLL_CON S5P_CLKREG(0x110) | ||
28 | #define S5P_VPLL_CON S5P_CLKREG(0x120) | ||
29 | |||
30 | #define S5P_CLK_SRC0 S5P_CLKREG(0x200) | ||
31 | #define S5P_CLK_SRC1 S5P_CLKREG(0x204) | ||
32 | #define S5P_CLK_SRC2 S5P_CLKREG(0x208) | ||
33 | #define S5P_CLK_SRC3 S5P_CLKREG(0x20C) | ||
34 | #define S5P_CLK_SRC4 S5P_CLKREG(0x210) | ||
35 | #define S5P_CLK_SRC5 S5P_CLKREG(0x214) | ||
36 | #define S5P_CLK_SRC6 S5P_CLKREG(0x218) | ||
37 | |||
38 | #define S5P_CLK_SRC_MASK0 S5P_CLKREG(0x280) | ||
39 | #define S5P_CLK_SRC_MASK1 S5P_CLKREG(0x284) | ||
40 | |||
41 | #define S5P_CLK_DIV0 S5P_CLKREG(0x300) | ||
42 | #define S5P_CLK_DIV1 S5P_CLKREG(0x304) | ||
43 | #define S5P_CLK_DIV2 S5P_CLKREG(0x308) | ||
44 | #define S5P_CLK_DIV3 S5P_CLKREG(0x30C) | ||
45 | #define S5P_CLK_DIV4 S5P_CLKREG(0x310) | ||
46 | #define S5P_CLK_DIV5 S5P_CLKREG(0x314) | ||
47 | #define S5P_CLK_DIV6 S5P_CLKREG(0x318) | ||
48 | |||
49 | #define S5P_CLKGATE_IP0 S5P_CLKREG(0x460) | ||
50 | #define S5P_CLKGATE_IP3 S5P_CLKREG(0x46C) | ||
51 | |||
52 | /* CLK_OUT */ | ||
53 | #define S5P_CLK_OUT_SHIFT (12) | ||
54 | #define S5P_CLK_OUT_MASK (0x1F << S5P_CLK_OUT_SHIFT) | ||
55 | #define S5P_CLK_OUT S5P_CLKREG(0x500) | ||
56 | |||
57 | #define S5P_CLK_DIV_STAT0 S5P_CLKREG(0x1000) | ||
58 | #define S5P_CLK_DIV_STAT1 S5P_CLKREG(0x1004) | ||
59 | |||
60 | #define S5P_CLK_MUX_STAT0 S5P_CLKREG(0x1100) | ||
61 | #define S5P_CLK_MUX_STAT1 S5P_CLKREG(0x1104) | ||
62 | |||
63 | #define S5P_MDNIE_SEL S5P_CLKREG(0x7008) | ||
64 | |||
65 | /* Register Bit definition */ | ||
66 | #define S5P_EPLL_EN (1<<31) | ||
67 | #define S5P_EPLL_MASK 0xffffffff | ||
68 | #define S5P_EPLLVAL(_m, _p, _s) ((_m) << 16 | ((_p) << 8) | ((_s))) | ||
69 | |||
70 | /* CLKDIV0 */ | ||
71 | #define S5P_CLKDIV0_APLL_SHIFT (0) | ||
72 | #define S5P_CLKDIV0_APLL_MASK (0x7 << S5P_CLKDIV0_APLL_SHIFT) | ||
73 | #define S5P_CLKDIV0_A2M_SHIFT (4) | ||
74 | #define S5P_CLKDIV0_A2M_MASK (0x7 << S5P_CLKDIV0_A2M_SHIFT) | ||
75 | #define S5P_CLKDIV0_D0CLK_SHIFT (16) | ||
76 | #define S5P_CLKDIV0_D0CLK_MASK (0xF << S5P_CLKDIV0_D0CLK_SHIFT) | ||
77 | #define S5P_CLKDIV0_P0CLK_SHIFT (20) | ||
78 | #define S5P_CLKDIV0_P0CLK_MASK (0x7 << S5P_CLKDIV0_P0CLK_SHIFT) | ||
79 | #define S5P_CLKDIV0_D1CLK_SHIFT (24) | ||
80 | #define S5P_CLKDIV0_D1CLK_MASK (0xF << S5P_CLKDIV0_D1CLK_SHIFT) | ||
81 | #define S5P_CLKDIV0_P1CLK_SHIFT (28) | ||
82 | #define S5P_CLKDIV0_P1CLK_MASK (0x7 << S5P_CLKDIV0_P1CLK_SHIFT) | ||
83 | |||
84 | /* Clock MUX status Registers */ | ||
85 | #define S5P_CLK_MUX_STAT0_APLL_SHIFT (0) | ||
86 | #define S5P_CLK_MUX_STAT0_APLL_MASK (0x7 << S5P_CLK_MUX_STAT0_APLL_SHIFT) | ||
87 | #define S5P_CLK_MUX_STAT0_MPLL_SHIFT (4) | ||
88 | #define S5P_CLK_MUX_STAT0_MPLL_MASK (0x7 << S5P_CLK_MUX_STAT0_MPLL_SHIFT) | ||
89 | #define S5P_CLK_MUX_STAT0_EPLL_SHIFT (8) | ||
90 | #define S5P_CLK_MUX_STAT0_EPLL_MASK (0x7 << S5P_CLK_MUX_STAT0_EPLL_SHIFT) | ||
91 | #define S5P_CLK_MUX_STAT0_VPLL_SHIFT (12) | ||
92 | #define S5P_CLK_MUX_STAT0_VPLL_MASK (0x7 << S5P_CLK_MUX_STAT0_VPLL_SHIFT) | ||
93 | #define S5P_CLK_MUX_STAT0_MUXARM_SHIFT (16) | ||
94 | #define S5P_CLK_MUX_STAT0_MUXARM_MASK (0x7 << S5P_CLK_MUX_STAT0_MUXARM_SHIFT) | ||
95 | #define S5P_CLK_MUX_STAT0_MUXD0_SHIFT (20) | ||
96 | #define S5P_CLK_MUX_STAT0_MUXD0_MASK (0x7 << S5P_CLK_MUX_STAT0_MUXD0_SHIFT) | ||
97 | #define S5P_CLK_MUX_STAT0_MUXD1_SHIFT (24) | ||
98 | #define S5P_CLK_MUX_STAT0_MUXD1_MASK (0x7 << S5P_CLK_MUX_STAT0_MUXD1_SHIFT) | ||
99 | #define S5P_CLK_MUX_STAT1_D1SYNC_SHIFT (24) | ||
100 | #define S5P_CLK_MUX_STAT1_D1SYNC_MASK (0x7 << S5P_CLK_MUX_STAT1_D1SYNC_SHIFT) | ||
101 | #define S5P_CLK_MUX_STAT1_D0SYNC_SHIFT (28) | ||
102 | #define S5P_CLK_MUX_STAT1_D0SYNC_MASK (0x7 << S5P_CLK_MUX_STAT1_D0SYNC_SHIFT) | ||
103 | |||
104 | #endif /* __ASM_ARCH_REGS_CLOCK_H */ | ||
diff --git a/arch/arm/mach-s5p6442/include/mach/regs-irq.h b/arch/arm/mach-s5p6442/include/mach/regs-irq.h deleted file mode 100644 index 73782b52a83b..000000000000 --- a/arch/arm/mach-s5p6442/include/mach/regs-irq.h +++ /dev/null | |||
@@ -1,19 +0,0 @@ | |||
1 | /* linux/arch/arm/mach-s5p6442/include/mach/regs-irq.h | ||
2 | * | ||
3 | * Copyright (c) 2010 Samsung Electronics Co., Ltd. | ||
4 | * http://www.samsung.com/ | ||
5 | * | ||
6 | * S5P6442 - IRQ register definitions | ||
7 | * | ||
8 | * This program is free software; you can redistribute it and/or modify | ||
9 | * it under the terms of the GNU General Public License version 2 as | ||
10 | * published by the Free Software Foundation. | ||
11 | */ | ||
12 | |||
13 | #ifndef __ASM_ARCH_REGS_IRQ_H | ||
14 | #define __ASM_ARCH_REGS_IRQ_H __FILE__ | ||
15 | |||
16 | #include <asm/hardware/vic.h> | ||
17 | #include <mach/map.h> | ||
18 | |||
19 | #endif /* __ASM_ARCH_REGS_IRQ_H */ | ||
diff --git a/arch/arm/mach-s5p6442/include/mach/spi-clocks.h b/arch/arm/mach-s5p6442/include/mach/spi-clocks.h deleted file mode 100644 index 7fd88205a97c..000000000000 --- a/arch/arm/mach-s5p6442/include/mach/spi-clocks.h +++ /dev/null | |||
@@ -1,17 +0,0 @@ | |||
1 | /* linux/arch/arm/mach-s5p6442/include/mach/spi-clocks.h | ||
2 | * | ||
3 | * Copyright (C) 2010 Samsung Electronics Co. Ltd. | ||
4 | * Jaswinder Singh <jassi.brar@samsung.com> | ||
5 | * | ||
6 | * This program is free software; you can redistribute it and/or modify | ||
7 | * it under the terms of the GNU General Public License version 2 as | ||
8 | * published by the Free Software Foundation. | ||
9 | */ | ||
10 | |||
11 | #ifndef __S5P6442_PLAT_SPI_CLKS_H | ||
12 | #define __S5P6442_PLAT_SPI_CLKS_H __FILE__ | ||
13 | |||
14 | #define S5P6442_SPI_SRCCLK_PCLK 0 | ||
15 | #define S5P6442_SPI_SRCCLK_SCLK 1 | ||
16 | |||
17 | #endif /* __S5P6442_PLAT_SPI_CLKS_H */ | ||
diff --git a/arch/arm/mach-s5p6442/include/mach/system.h b/arch/arm/mach-s5p6442/include/mach/system.h deleted file mode 100644 index c30c1cc1b97e..000000000000 --- a/arch/arm/mach-s5p6442/include/mach/system.h +++ /dev/null | |||
@@ -1,23 +0,0 @@ | |||
1 | /* linux/arch/arm/mach-s5p6442/include/mach/system.h | ||
2 | * | ||
3 | * Copyright (c) 2010 Samsung Electronics Co., Ltd. | ||
4 | * http://www.samsung.com/ | ||
5 | * | ||
6 | * S5P6442 - system support header | ||
7 | * | ||
8 | * This program is free software; you can redistribute it and/or modify | ||
9 | * it under the terms of the GNU General Public License version 2 as | ||
10 | * published by the Free Software Foundation. | ||
11 | */ | ||
12 | |||
13 | #ifndef __ASM_ARCH_SYSTEM_H | ||
14 | #define __ASM_ARCH_SYSTEM_H __FILE__ | ||
15 | |||
16 | #include <plat/system-reset.h> | ||
17 | |||
18 | static void arch_idle(void) | ||
19 | { | ||
20 | /* nothing here yet */ | ||
21 | } | ||
22 | |||
23 | #endif /* __ASM_ARCH_SYSTEM_H */ | ||
diff --git a/arch/arm/mach-s5p6442/include/mach/tick.h b/arch/arm/mach-s5p6442/include/mach/tick.h deleted file mode 100644 index e1d4cabf8297..000000000000 --- a/arch/arm/mach-s5p6442/include/mach/tick.h +++ /dev/null | |||
@@ -1,26 +0,0 @@ | |||
1 | /* linux/arch/arm/mach-s5p6442/include/mach/tick.h | ||
2 | * | ||
3 | * Copyright (c) 2010 Samsung Electronics Co., Ltd. | ||
4 | * http://www.samsung.com/ | ||
5 | * | ||
6 | * Based on arch/arm/mach-s3c6400/include/mach/tick.h | ||
7 | * | ||
8 | * S5P6442 - Timer tick support definitions | ||
9 | * | ||
10 | * This program is free software; you can redistribute it and/or modify | ||
11 | * it under the terms of the GNU General Public License version 2 as | ||
12 | * published by the Free Software Foundation. | ||
13 | */ | ||
14 | |||
15 | #ifndef __ASM_ARCH_TICK_H | ||
16 | #define __ASM_ARCH_TICK_H __FILE__ | ||
17 | |||
18 | static inline u32 s3c24xx_ostimer_pending(void) | ||
19 | { | ||
20 | u32 pend = __raw_readl(VA_VIC0 + VIC_RAW_STATUS); | ||
21 | return pend & (1 << (IRQ_TIMER4_VIC - S5P_IRQ_VIC0(0))); | ||
22 | } | ||
23 | |||
24 | #define TICK_MAX (0xffffffff) | ||
25 | |||
26 | #endif /* __ASM_ARCH_TICK_H */ | ||
diff --git a/arch/arm/mach-s5p6442/include/mach/timex.h b/arch/arm/mach-s5p6442/include/mach/timex.h deleted file mode 100644 index ff8f2fcadeb7..000000000000 --- a/arch/arm/mach-s5p6442/include/mach/timex.h +++ /dev/null | |||
@@ -1,24 +0,0 @@ | |||
1 | /* arch/arm/mach-s5p6442/include/mach/timex.h | ||
2 | * | ||
3 | * Copyright (c) 2003-2010 Simtec Electronics | ||
4 | * Ben Dooks <ben@simtec.co.uk> | ||
5 | * | ||
6 | * S5P6442 - time parameters | ||
7 | * | ||
8 | * This program is free software; you can redistribute it and/or modify | ||
9 | * it under the terms of the GNU General Public License version 2 as | ||
10 | * published by the Free Software Foundation. | ||
11 | */ | ||
12 | |||
13 | #ifndef __ASM_ARCH_TIMEX_H | ||
14 | #define __ASM_ARCH_TIMEX_H | ||
15 | |||
16 | /* CLOCK_TICK_RATE needs to be evaluatable by the cpp, so making it | ||
17 | * a variable is useless. It seems as long as we make our timers an | ||
18 | * exact multiple of HZ, any value that makes a 1->1 correspondence | ||
19 | * for the time conversion functions to/from jiffies is acceptable. | ||
20 | */ | ||
21 | |||
22 | #define CLOCK_TICK_RATE 12000000 | ||
23 | |||
24 | #endif /* __ASM_ARCH_TIMEX_H */ | ||
diff --git a/arch/arm/mach-s5p6442/include/mach/uncompress.h b/arch/arm/mach-s5p6442/include/mach/uncompress.h deleted file mode 100644 index 5ac7cbeeb987..000000000000 --- a/arch/arm/mach-s5p6442/include/mach/uncompress.h +++ /dev/null | |||
@@ -1,24 +0,0 @@ | |||
1 | /* linux/arch/arm/mach-s5p6442/include/mach/uncompress.h | ||
2 | * | ||
3 | * Copyright (c) 2010 Samsung Electronics Co., Ltd. | ||
4 | * http://www.samsung.com/ | ||
5 | * | ||
6 | * S5P6442 - uncompress code | ||
7 | * | ||
8 | * This program is free software; you can redistribute it and/or modify | ||
9 | * it under the terms of the GNU General Public License version 2 as | ||
10 | * published by the Free Software Foundation. | ||
11 | */ | ||
12 | |||
13 | #ifndef __ASM_ARCH_UNCOMPRESS_H | ||
14 | #define __ASM_ARCH_UNCOMPRESS_H | ||
15 | |||
16 | #include <mach/map.h> | ||
17 | #include <plat/uncompress.h> | ||
18 | |||
19 | static void arch_detect_cpu(void) | ||
20 | { | ||
21 | /* we do not need to do any cpu detection here at the moment. */ | ||
22 | } | ||
23 | |||
24 | #endif /* __ASM_ARCH_UNCOMPRESS_H */ | ||
diff --git a/arch/arm/mach-s5p6442/include/mach/vmalloc.h b/arch/arm/mach-s5p6442/include/mach/vmalloc.h deleted file mode 100644 index 4aa55e55ac47..000000000000 --- a/arch/arm/mach-s5p6442/include/mach/vmalloc.h +++ /dev/null | |||
@@ -1,17 +0,0 @@ | |||
1 | /* arch/arm/mach-s5p6442/include/mach/vmalloc.h | ||
2 | * | ||
3 | * Copyright 2010 Ben Dooks <ben-linux@fluff.org> | ||
4 | * | ||
5 | * This program is free software; you can redistribute it and/or modify | ||
6 | * it under the terms of the GNU General Public License version 2 as | ||
7 | * published by the Free Software Foundation. | ||
8 | * | ||
9 | * S5P6442 vmalloc definition | ||
10 | */ | ||
11 | |||
12 | #ifndef __ASM_ARCH_VMALLOC_H | ||
13 | #define __ASM_ARCH_VMALLOC_H | ||
14 | |||
15 | #define VMALLOC_END 0xF6000000UL | ||
16 | |||
17 | #endif /* __ASM_ARCH_VMALLOC_H */ | ||
diff --git a/arch/arm/mach-s5p6442/init.c b/arch/arm/mach-s5p6442/init.c deleted file mode 100644 index 1874bdb71e1d..000000000000 --- a/arch/arm/mach-s5p6442/init.c +++ /dev/null | |||
@@ -1,44 +0,0 @@ | |||
1 | /* linux/arch/arm/mach-s5p6442/s5p6442-init.c | ||
2 | * | ||
3 | * Copyright (c) 2010 Samsung Electronics Co., Ltd. | ||
4 | * http://www.samsung.com/ | ||
5 | * | ||
6 | * This program is free software; you can redistribute it and/or modify | ||
7 | * it under the terms of the GNU General Public License version 2 as | ||
8 | * published by the Free Software Foundation. | ||
9 | */ | ||
10 | |||
11 | #include <linux/kernel.h> | ||
12 | #include <linux/types.h> | ||
13 | #include <linux/init.h> | ||
14 | #include <linux/serial_core.h> | ||
15 | |||
16 | #include <plat/cpu.h> | ||
17 | #include <plat/devs.h> | ||
18 | #include <plat/s5p6442.h> | ||
19 | #include <plat/regs-serial.h> | ||
20 | |||
21 | static struct s3c24xx_uart_clksrc s5p6442_serial_clocks[] = { | ||
22 | [0] = { | ||
23 | .name = "pclk", | ||
24 | .divisor = 1, | ||
25 | .min_baud = 0, | ||
26 | .max_baud = 0, | ||
27 | }, | ||
28 | }; | ||
29 | |||
30 | /* uart registration process */ | ||
31 | void __init s5p6442_common_init_uarts(struct s3c2410_uartcfg *cfg, int no) | ||
32 | { | ||
33 | struct s3c2410_uartcfg *tcfg = cfg; | ||
34 | u32 ucnt; | ||
35 | |||
36 | for (ucnt = 0; ucnt < no; ucnt++, tcfg++) { | ||
37 | if (!tcfg->clocks) { | ||
38 | tcfg->clocks = s5p6442_serial_clocks; | ||
39 | tcfg->clocks_size = ARRAY_SIZE(s5p6442_serial_clocks); | ||
40 | } | ||
41 | } | ||
42 | |||
43 | s3c24xx_init_uartdevs("s5pv210-uart", s5p_uart_resources, cfg, no); | ||
44 | } | ||
diff --git a/arch/arm/mach-s5p6442/mach-smdk6442.c b/arch/arm/mach-s5p6442/mach-smdk6442.c deleted file mode 100644 index eaf6b9c489ff..000000000000 --- a/arch/arm/mach-s5p6442/mach-smdk6442.c +++ /dev/null | |||
@@ -1,102 +0,0 @@ | |||
1 | /* linux/arch/arm/mach-s5p6442/mach-smdk6442.c | ||
2 | * | ||
3 | * Copyright (c) 2010 Samsung Electronics Co., Ltd. | ||
4 | * http://www.samsung.com/ | ||
5 | * | ||
6 | * This program is free software; you can redistribute it and/or modify | ||
7 | * it under the terms of the GNU General Public License version 2 as | ||
8 | * published by the Free Software Foundation. | ||
9 | */ | ||
10 | |||
11 | #include <linux/kernel.h> | ||
12 | #include <linux/types.h> | ||
13 | #include <linux/init.h> | ||
14 | #include <linux/serial_core.h> | ||
15 | #include <linux/i2c.h> | ||
16 | |||
17 | #include <asm/mach/arch.h> | ||
18 | #include <asm/mach/map.h> | ||
19 | #include <asm/setup.h> | ||
20 | #include <asm/mach-types.h> | ||
21 | |||
22 | #include <mach/map.h> | ||
23 | #include <mach/regs-clock.h> | ||
24 | |||
25 | #include <plat/regs-serial.h> | ||
26 | #include <plat/s5p6442.h> | ||
27 | #include <plat/devs.h> | ||
28 | #include <plat/cpu.h> | ||
29 | #include <plat/iic.h> | ||
30 | |||
31 | /* Following are default values for UCON, ULCON and UFCON UART registers */ | ||
32 | #define SMDK6442_UCON_DEFAULT (S3C2410_UCON_TXILEVEL | \ | ||
33 | S3C2410_UCON_RXILEVEL | \ | ||
34 | S3C2410_UCON_TXIRQMODE | \ | ||
35 | S3C2410_UCON_RXIRQMODE | \ | ||
36 | S3C2410_UCON_RXFIFO_TOI | \ | ||
37 | S3C2443_UCON_RXERR_IRQEN) | ||
38 | |||
39 | #define SMDK6442_ULCON_DEFAULT S3C2410_LCON_CS8 | ||
40 | |||
41 | #define SMDK6442_UFCON_DEFAULT (S3C2410_UFCON_FIFOMODE | \ | ||
42 | S5PV210_UFCON_TXTRIG4 | \ | ||
43 | S5PV210_UFCON_RXTRIG4) | ||
44 | |||
45 | static struct s3c2410_uartcfg smdk6442_uartcfgs[] __initdata = { | ||
46 | [0] = { | ||
47 | .hwport = 0, | ||
48 | .flags = 0, | ||
49 | .ucon = SMDK6442_UCON_DEFAULT, | ||
50 | .ulcon = SMDK6442_ULCON_DEFAULT, | ||
51 | .ufcon = SMDK6442_UFCON_DEFAULT, | ||
52 | }, | ||
53 | [1] = { | ||
54 | .hwport = 1, | ||
55 | .flags = 0, | ||
56 | .ucon = SMDK6442_UCON_DEFAULT, | ||
57 | .ulcon = SMDK6442_ULCON_DEFAULT, | ||
58 | .ufcon = SMDK6442_UFCON_DEFAULT, | ||
59 | }, | ||
60 | [2] = { | ||
61 | .hwport = 2, | ||
62 | .flags = 0, | ||
63 | .ucon = SMDK6442_UCON_DEFAULT, | ||
64 | .ulcon = SMDK6442_ULCON_DEFAULT, | ||
65 | .ufcon = SMDK6442_UFCON_DEFAULT, | ||
66 | }, | ||
67 | }; | ||
68 | |||
69 | static struct platform_device *smdk6442_devices[] __initdata = { | ||
70 | &s3c_device_i2c0, | ||
71 | &samsung_asoc_dma, | ||
72 | &s5p6442_device_iis0, | ||
73 | &s3c_device_wdt, | ||
74 | }; | ||
75 | |||
76 | static struct i2c_board_info smdk6442_i2c_devs0[] __initdata = { | ||
77 | { I2C_BOARD_INFO("wm8580", 0x1b), }, | ||
78 | }; | ||
79 | |||
80 | static void __init smdk6442_map_io(void) | ||
81 | { | ||
82 | s5p_init_io(NULL, 0, S5P_VA_CHIPID); | ||
83 | s3c24xx_init_clocks(12000000); | ||
84 | s3c24xx_init_uarts(smdk6442_uartcfgs, ARRAY_SIZE(smdk6442_uartcfgs)); | ||
85 | } | ||
86 | |||
87 | static void __init smdk6442_machine_init(void) | ||
88 | { | ||
89 | s3c_i2c0_set_platdata(NULL); | ||
90 | i2c_register_board_info(0, smdk6442_i2c_devs0, | ||
91 | ARRAY_SIZE(smdk6442_i2c_devs0)); | ||
92 | platform_add_devices(smdk6442_devices, ARRAY_SIZE(smdk6442_devices)); | ||
93 | } | ||
94 | |||
95 | MACHINE_START(SMDK6442, "SMDK6442") | ||
96 | /* Maintainer: Kukjin Kim <kgene.kim@samsung.com> */ | ||
97 | .boot_params = S5P_PA_SDRAM + 0x100, | ||
98 | .init_irq = s5p6442_init_irq, | ||
99 | .map_io = smdk6442_map_io, | ||
100 | .init_machine = smdk6442_machine_init, | ||
101 | .timer = &s3c24xx_timer, | ||
102 | MACHINE_END | ||
diff --git a/arch/arm/mach-s5p6442/setup-i2c0.c b/arch/arm/mach-s5p6442/setup-i2c0.c deleted file mode 100644 index aad85656b0cc..000000000000 --- a/arch/arm/mach-s5p6442/setup-i2c0.c +++ /dev/null | |||
@@ -1,28 +0,0 @@ | |||
1 | /* linux/arch/arm/mach-s5p6442/setup-i2c0.c | ||
2 | * | ||
3 | * Copyright (c) 2009 Samsung Electronics Co., Ltd. | ||
4 | * http://www.samsung.com/ | ||
5 | * | ||
6 | * I2C0 GPIO configuration. | ||
7 | * | ||
8 | * Based on plat-s3c64xx/setup-i2c0.c | ||
9 | * | ||
10 | * This program is free software; you can redistribute it and/or modify | ||
11 | * it under the terms of the GNU General Public License version 2 as | ||
12 | * published by the Free Software Foundation. | ||
13 | */ | ||
14 | |||
15 | #include <linux/kernel.h> | ||
16 | #include <linux/types.h> | ||
17 | #include <linux/gpio.h> | ||
18 | |||
19 | struct platform_device; /* don't need the contents */ | ||
20 | |||
21 | #include <plat/gpio-cfg.h> | ||
22 | #include <plat/iic.h> | ||
23 | |||
24 | void s3c_i2c0_cfg_gpio(struct platform_device *dev) | ||
25 | { | ||
26 | s3c_gpio_cfgall_range(S5P6442_GPD1(0), 2, | ||
27 | S3C_GPIO_SFN(2), S3C_GPIO_PULL_UP); | ||
28 | } | ||
diff --git a/arch/arm/plat-s5p/Kconfig b/arch/arm/plat-s5p/Kconfig index 849229716586..5878bd9fbad3 100644 --- a/arch/arm/plat-s5p/Kconfig +++ b/arch/arm/plat-s5p/Kconfig | |||
@@ -7,7 +7,7 @@ | |||
7 | 7 | ||
8 | config PLAT_S5P | 8 | config PLAT_S5P |
9 | bool | 9 | bool |
10 | depends on (ARCH_S5P64X0 || ARCH_S5P6442 || ARCH_S5PC100 || ARCH_S5PV210 || ARCH_EXYNOS4) | 10 | depends on (ARCH_S5P64X0 || ARCH_S5PC100 || ARCH_S5PV210 || ARCH_EXYNOS4) |
11 | default y | 11 | default y |
12 | select ARM_VIC if !ARCH_EXYNOS4 | 12 | select ARM_VIC if !ARCH_EXYNOS4 |
13 | select ARM_GIC if ARCH_EXYNOS4 | 13 | select ARM_GIC if ARCH_EXYNOS4 |
diff --git a/arch/arm/plat-s5p/cpu.c b/arch/arm/plat-s5p/cpu.c index 5cf5e721e6ca..bbc2aa7449ca 100644 --- a/arch/arm/plat-s5p/cpu.c +++ b/arch/arm/plat-s5p/cpu.c | |||
@@ -21,7 +21,6 @@ | |||
21 | 21 | ||
22 | #include <plat/cpu.h> | 22 | #include <plat/cpu.h> |
23 | #include <plat/s5p6440.h> | 23 | #include <plat/s5p6440.h> |
24 | #include <plat/s5p6442.h> | ||
25 | #include <plat/s5p6450.h> | 24 | #include <plat/s5p6450.h> |
26 | #include <plat/s5pc100.h> | 25 | #include <plat/s5pc100.h> |
27 | #include <plat/s5pv210.h> | 26 | #include <plat/s5pv210.h> |
@@ -30,7 +29,6 @@ | |||
30 | /* table of supported CPUs */ | 29 | /* table of supported CPUs */ |
31 | 30 | ||
32 | static const char name_s5p6440[] = "S5P6440"; | 31 | static const char name_s5p6440[] = "S5P6440"; |
33 | static const char name_s5p6442[] = "S5P6442"; | ||
34 | static const char name_s5p6450[] = "S5P6450"; | 32 | static const char name_s5p6450[] = "S5P6450"; |
35 | static const char name_s5pc100[] = "S5PC100"; | 33 | static const char name_s5pc100[] = "S5PC100"; |
36 | static const char name_s5pv210[] = "S5PV210/S5PC110"; | 34 | static const char name_s5pv210[] = "S5PV210/S5PC110"; |
@@ -46,14 +44,6 @@ static struct cpu_table cpu_ids[] __initdata = { | |||
46 | .init = s5p64x0_init, | 44 | .init = s5p64x0_init, |
47 | .name = name_s5p6440, | 45 | .name = name_s5p6440, |
48 | }, { | 46 | }, { |
49 | .idcode = 0x36442000, | ||
50 | .idmask = 0xfffff000, | ||
51 | .map_io = s5p6442_map_io, | ||
52 | .init_clocks = s5p6442_init_clocks, | ||
53 | .init_uarts = s5p6442_init_uarts, | ||
54 | .init = s5p6442_init, | ||
55 | .name = name_s5p6442, | ||
56 | }, { | ||
57 | .idcode = 0x36450000, | 47 | .idcode = 0x36450000, |
58 | .idmask = 0xfffff000, | 48 | .idmask = 0xfffff000, |
59 | .map_io = s5p6450_map_io, | 49 | .map_io = s5p6450_map_io, |
diff --git a/arch/arm/plat-s5p/include/plat/s5p6442.h b/arch/arm/plat-s5p/include/plat/s5p6442.h deleted file mode 100644 index 7b8801349c94..000000000000 --- a/arch/arm/plat-s5p/include/plat/s5p6442.h +++ /dev/null | |||
@@ -1,33 +0,0 @@ | |||
1 | /* arch/arm/plat-s5p/include/plat/s5p6442.h | ||
2 | * | ||
3 | * Copyright (c) 2010 Samsung Electronics Co., Ltd. | ||
4 | * http://www.samsung.com/ | ||
5 | * | ||
6 | * Header file for s5p6442 cpu support | ||
7 | * | ||
8 | * This program is free software; you can redistribute it and/or modify | ||
9 | * it under the terms of the GNU General Public License version 2 as | ||
10 | * published by the Free Software Foundation. | ||
11 | */ | ||
12 | |||
13 | /* Common init code for S5P6442 related SoCs */ | ||
14 | |||
15 | extern void s5p6442_common_init_uarts(struct s3c2410_uartcfg *cfg, int no); | ||
16 | extern void s5p6442_register_clocks(void); | ||
17 | extern void s5p6442_setup_clocks(void); | ||
18 | |||
19 | #ifdef CONFIG_CPU_S5P6442 | ||
20 | |||
21 | extern int s5p6442_init(void); | ||
22 | extern void s5p6442_init_irq(void); | ||
23 | extern void s5p6442_map_io(void); | ||
24 | extern void s5p6442_init_clocks(int xtal); | ||
25 | |||
26 | #define s5p6442_init_uarts s5p6442_common_init_uarts | ||
27 | |||
28 | #else | ||
29 | #define s5p6442_init_clocks NULL | ||
30 | #define s5p6442_init_uarts NULL | ||
31 | #define s5p6442_map_io NULL | ||
32 | #define s5p6442_init NULL | ||
33 | #endif | ||
diff --git a/arch/arm/plat-samsung/include/plat/cpu.h b/arch/arm/plat-samsung/include/plat/cpu.h index cedfff51c82b..6ff205b7e4ae 100644 --- a/arch/arm/plat-samsung/include/plat/cpu.h +++ b/arch/arm/plat-samsung/include/plat/cpu.h | |||
@@ -80,7 +80,6 @@ extern struct sysdev_class s3c2443_sysclass; | |||
80 | extern struct sysdev_class s3c6410_sysclass; | 80 | extern struct sysdev_class s3c6410_sysclass; |
81 | extern struct sysdev_class s3c64xx_sysclass; | 81 | extern struct sysdev_class s3c64xx_sysclass; |
82 | extern struct sysdev_class s5p64x0_sysclass; | 82 | extern struct sysdev_class s5p64x0_sysclass; |
83 | extern struct sysdev_class s5p6442_sysclass; | ||
84 | extern struct sysdev_class s5pv210_sysclass; | 83 | extern struct sysdev_class s5pv210_sysclass; |
85 | extern struct sysdev_class exynos4_sysclass; | 84 | extern struct sysdev_class exynos4_sysclass; |
86 | 85 | ||
diff --git a/arch/arm/plat-samsung/include/plat/debug-macro.S b/arch/arm/plat-samsung/include/plat/debug-macro.S index dc6efd90e8ff..207e275362a8 100644 --- a/arch/arm/plat-samsung/include/plat/debug-macro.S +++ b/arch/arm/plat-samsung/include/plat/debug-macro.S | |||
@@ -11,7 +11,7 @@ | |||
11 | 11 | ||
12 | #include <plat/regs-serial.h> | 12 | #include <plat/regs-serial.h> |
13 | 13 | ||
14 | /* The S5PV210/S5PC110 and S5P6442 implementations are as belows. */ | 14 | /* The S5PV210/S5PC110 implementations are as belows. */ |
15 | 15 | ||
16 | .macro fifo_level_s5pv210 rd, rx | 16 | .macro fifo_level_s5pv210 rd, rx |
17 | ldr \rd, [ \rx, # S3C2410_UFSTAT ] | 17 | ldr \rd, [ \rx, # S3C2410_UFSTAT ] |
diff --git a/arch/arm/plat-samsung/include/plat/devs.h b/arch/arm/plat-samsung/include/plat/devs.h index f0da6b70fba4..d64adf16d533 100644 --- a/arch/arm/plat-samsung/include/plat/devs.h +++ b/arch/arm/plat-samsung/include/plat/devs.h | |||
@@ -110,12 +110,6 @@ extern struct platform_device exynos4_device_spdif; | |||
110 | extern struct platform_device exynos4_device_pd[]; | 110 | extern struct platform_device exynos4_device_pd[]; |
111 | extern struct platform_device exynos4_device_ahci; | 111 | extern struct platform_device exynos4_device_ahci; |
112 | 112 | ||
113 | extern struct platform_device s5p6442_device_pcm0; | ||
114 | extern struct platform_device s5p6442_device_pcm1; | ||
115 | extern struct platform_device s5p6442_device_iis0; | ||
116 | extern struct platform_device s5p6442_device_iis1; | ||
117 | extern struct platform_device s5p6442_device_spi; | ||
118 | |||
119 | extern struct platform_device s5p6440_device_pcm; | 113 | extern struct platform_device s5p6440_device_pcm; |
120 | extern struct platform_device s5p6440_device_iis; | 114 | extern struct platform_device s5p6440_device_iis; |
121 | 115 | ||
diff --git a/arch/arm/plat-samsung/include/plat/regs-serial.h b/arch/arm/plat-samsung/include/plat/regs-serial.h index 788837e99cb3..c151c5f94a87 100644 --- a/arch/arm/plat-samsung/include/plat/regs-serial.h +++ b/arch/arm/plat-samsung/include/plat/regs-serial.h | |||
@@ -194,7 +194,7 @@ | |||
194 | #define S3C64XX_UINTSP 0x34 | 194 | #define S3C64XX_UINTSP 0x34 |
195 | #define S3C64XX_UINTM 0x38 | 195 | #define S3C64XX_UINTM 0x38 |
196 | 196 | ||
197 | /* Following are specific to S5PV210 and S5P6442 */ | 197 | /* Following are specific to S5PV210 */ |
198 | #define S5PV210_UCON_CLKMASK (1<<10) | 198 | #define S5PV210_UCON_CLKMASK (1<<10) |
199 | #define S5PV210_UCON_PCLK (0<<10) | 199 | #define S5PV210_UCON_PCLK (0<<10) |
200 | #define S5PV210_UCON_UCLK (1<<10) | 200 | #define S5PV210_UCON_UCLK (1<<10) |
diff --git a/arch/arm/plat-samsung/include/plat/s3c64xx-spi.h b/arch/arm/plat-samsung/include/plat/s3c64xx-spi.h index ff1a561b326e..0ffe34a21554 100644 --- a/arch/arm/plat-samsung/include/plat/s3c64xx-spi.h +++ b/arch/arm/plat-samsung/include/plat/s3c64xx-spi.h | |||
@@ -69,6 +69,5 @@ extern void s3c64xx_spi_set_info(int cntrlr, int src_clk_nr, int num_cs); | |||
69 | extern void s5pc100_spi_set_info(int cntrlr, int src_clk_nr, int num_cs); | 69 | extern void s5pc100_spi_set_info(int cntrlr, int src_clk_nr, int num_cs); |
70 | extern void s5pv210_spi_set_info(int cntrlr, int src_clk_nr, int num_cs); | 70 | extern void s5pv210_spi_set_info(int cntrlr, int src_clk_nr, int num_cs); |
71 | extern void s5p64x0_spi_set_info(int cntrlr, int src_clk_nr, int num_cs); | 71 | extern void s5p64x0_spi_set_info(int cntrlr, int src_clk_nr, int num_cs); |
72 | extern void s5p6442_spi_set_info(int cntrlr, int src_clk_nr, int num_cs); | ||
73 | 72 | ||
74 | #endif /* __S3C64XX_PLAT_SPI_H */ | 73 | #endif /* __S3C64XX_PLAT_SPI_H */ |
diff --git a/arch/powerpc/kernel/ptrace.c b/arch/powerpc/kernel/ptrace.c index 55613e33e263..a6ae1cfad86c 100644 --- a/arch/powerpc/kernel/ptrace.c +++ b/arch/powerpc/kernel/ptrace.c | |||
@@ -933,12 +933,16 @@ int ptrace_set_debugreg(struct task_struct *task, unsigned long addr, | |||
933 | if (data && !(data & DABR_TRANSLATION)) | 933 | if (data && !(data & DABR_TRANSLATION)) |
934 | return -EIO; | 934 | return -EIO; |
935 | #ifdef CONFIG_HAVE_HW_BREAKPOINT | 935 | #ifdef CONFIG_HAVE_HW_BREAKPOINT |
936 | if (ptrace_get_breakpoints(task) < 0) | ||
937 | return -ESRCH; | ||
938 | |||
936 | bp = thread->ptrace_bps[0]; | 939 | bp = thread->ptrace_bps[0]; |
937 | if ((!data) || !(data & (DABR_DATA_WRITE | DABR_DATA_READ))) { | 940 | if ((!data) || !(data & (DABR_DATA_WRITE | DABR_DATA_READ))) { |
938 | if (bp) { | 941 | if (bp) { |
939 | unregister_hw_breakpoint(bp); | 942 | unregister_hw_breakpoint(bp); |
940 | thread->ptrace_bps[0] = NULL; | 943 | thread->ptrace_bps[0] = NULL; |
941 | } | 944 | } |
945 | ptrace_put_breakpoints(task); | ||
942 | return 0; | 946 | return 0; |
943 | } | 947 | } |
944 | if (bp) { | 948 | if (bp) { |
@@ -948,9 +952,12 @@ int ptrace_set_debugreg(struct task_struct *task, unsigned long addr, | |||
948 | (DABR_DATA_WRITE | DABR_DATA_READ), | 952 | (DABR_DATA_WRITE | DABR_DATA_READ), |
949 | &attr.bp_type); | 953 | &attr.bp_type); |
950 | ret = modify_user_hw_breakpoint(bp, &attr); | 954 | ret = modify_user_hw_breakpoint(bp, &attr); |
951 | if (ret) | 955 | if (ret) { |
956 | ptrace_put_breakpoints(task); | ||
952 | return ret; | 957 | return ret; |
958 | } | ||
953 | thread->ptrace_bps[0] = bp; | 959 | thread->ptrace_bps[0] = bp; |
960 | ptrace_put_breakpoints(task); | ||
954 | thread->dabr = data; | 961 | thread->dabr = data; |
955 | return 0; | 962 | return 0; |
956 | } | 963 | } |
@@ -965,9 +972,12 @@ int ptrace_set_debugreg(struct task_struct *task, unsigned long addr, | |||
965 | ptrace_triggered, task); | 972 | ptrace_triggered, task); |
966 | if (IS_ERR(bp)) { | 973 | if (IS_ERR(bp)) { |
967 | thread->ptrace_bps[0] = NULL; | 974 | thread->ptrace_bps[0] = NULL; |
975 | ptrace_put_breakpoints(task); | ||
968 | return PTR_ERR(bp); | 976 | return PTR_ERR(bp); |
969 | } | 977 | } |
970 | 978 | ||
979 | ptrace_put_breakpoints(task); | ||
980 | |||
971 | #endif /* CONFIG_HAVE_HW_BREAKPOINT */ | 981 | #endif /* CONFIG_HAVE_HW_BREAKPOINT */ |
972 | 982 | ||
973 | /* Move contents to the DABR register */ | 983 | /* Move contents to the DABR register */ |
diff --git a/arch/sh/kernel/ptrace_32.c b/arch/sh/kernel/ptrace_32.c index 2130ca674e9b..3d7b209b2178 100644 --- a/arch/sh/kernel/ptrace_32.c +++ b/arch/sh/kernel/ptrace_32.c | |||
@@ -117,7 +117,11 @@ void user_enable_single_step(struct task_struct *child) | |||
117 | 117 | ||
118 | set_tsk_thread_flag(child, TIF_SINGLESTEP); | 118 | set_tsk_thread_flag(child, TIF_SINGLESTEP); |
119 | 119 | ||
120 | if (ptrace_get_breakpoints(child) < 0) | ||
121 | return; | ||
122 | |||
120 | set_single_step(child, pc); | 123 | set_single_step(child, pc); |
124 | ptrace_put_breakpoints(child); | ||
121 | } | 125 | } |
122 | 126 | ||
123 | void user_disable_single_step(struct task_struct *child) | 127 | void user_disable_single_step(struct task_struct *child) |
diff --git a/arch/x86/kernel/cpu/perf_event_intel.c b/arch/x86/kernel/cpu/perf_event_intel.c index e61539b07d2c..447a28de6f09 100644 --- a/arch/x86/kernel/cpu/perf_event_intel.c +++ b/arch/x86/kernel/cpu/perf_event_intel.c | |||
@@ -184,26 +184,23 @@ static __initconst const u64 snb_hw_cache_event_ids | |||
184 | }, | 184 | }, |
185 | }, | 185 | }, |
186 | [ C(LL ) ] = { | 186 | [ C(LL ) ] = { |
187 | /* | ||
188 | * TBD: Need Off-core Response Performance Monitoring support | ||
189 | */ | ||
190 | [ C(OP_READ) ] = { | 187 | [ C(OP_READ) ] = { |
191 | /* OFFCORE_RESPONSE_0.ANY_DATA.LOCAL_CACHE */ | 188 | /* OFFCORE_RESPONSE.ANY_DATA.LOCAL_CACHE */ |
192 | [ C(RESULT_ACCESS) ] = 0x01b7, | 189 | [ C(RESULT_ACCESS) ] = 0x01b7, |
193 | /* OFFCORE_RESPONSE_1.ANY_DATA.ANY_LLC_MISS */ | 190 | /* OFFCORE_RESPONSE.ANY_DATA.ANY_LLC_MISS */ |
194 | [ C(RESULT_MISS) ] = 0x01bb, | 191 | [ C(RESULT_MISS) ] = 0x01b7, |
195 | }, | 192 | }, |
196 | [ C(OP_WRITE) ] = { | 193 | [ C(OP_WRITE) ] = { |
197 | /* OFFCORE_RESPONSE_0.ANY_RFO.LOCAL_CACHE */ | 194 | /* OFFCORE_RESPONSE.ANY_RFO.LOCAL_CACHE */ |
198 | [ C(RESULT_ACCESS) ] = 0x01b7, | 195 | [ C(RESULT_ACCESS) ] = 0x01b7, |
199 | /* OFFCORE_RESPONSE_1.ANY_RFO.ANY_LLC_MISS */ | 196 | /* OFFCORE_RESPONSE.ANY_RFO.ANY_LLC_MISS */ |
200 | [ C(RESULT_MISS) ] = 0x01bb, | 197 | [ C(RESULT_MISS) ] = 0x01b7, |
201 | }, | 198 | }, |
202 | [ C(OP_PREFETCH) ] = { | 199 | [ C(OP_PREFETCH) ] = { |
203 | /* OFFCORE_RESPONSE_0.PREFETCH.LOCAL_CACHE */ | 200 | /* OFFCORE_RESPONSE.PREFETCH.LOCAL_CACHE */ |
204 | [ C(RESULT_ACCESS) ] = 0x01b7, | 201 | [ C(RESULT_ACCESS) ] = 0x01b7, |
205 | /* OFFCORE_RESPONSE_1.PREFETCH.ANY_LLC_MISS */ | 202 | /* OFFCORE_RESPONSE.PREFETCH.ANY_LLC_MISS */ |
206 | [ C(RESULT_MISS) ] = 0x01bb, | 203 | [ C(RESULT_MISS) ] = 0x01b7, |
207 | }, | 204 | }, |
208 | }, | 205 | }, |
209 | [ C(DTLB) ] = { | 206 | [ C(DTLB) ] = { |
@@ -285,26 +282,26 @@ static __initconst const u64 westmere_hw_cache_event_ids | |||
285 | }, | 282 | }, |
286 | [ C(LL ) ] = { | 283 | [ C(LL ) ] = { |
287 | [ C(OP_READ) ] = { | 284 | [ C(OP_READ) ] = { |
288 | /* OFFCORE_RESPONSE_0.ANY_DATA.LOCAL_CACHE */ | 285 | /* OFFCORE_RESPONSE.ANY_DATA.LOCAL_CACHE */ |
289 | [ C(RESULT_ACCESS) ] = 0x01b7, | 286 | [ C(RESULT_ACCESS) ] = 0x01b7, |
290 | /* OFFCORE_RESPONSE_1.ANY_DATA.ANY_LLC_MISS */ | 287 | /* OFFCORE_RESPONSE.ANY_DATA.ANY_LLC_MISS */ |
291 | [ C(RESULT_MISS) ] = 0x01bb, | 288 | [ C(RESULT_MISS) ] = 0x01b7, |
292 | }, | 289 | }, |
293 | /* | 290 | /* |
294 | * Use RFO, not WRITEBACK, because a write miss would typically occur | 291 | * Use RFO, not WRITEBACK, because a write miss would typically occur |
295 | * on RFO. | 292 | * on RFO. |
296 | */ | 293 | */ |
297 | [ C(OP_WRITE) ] = { | 294 | [ C(OP_WRITE) ] = { |
298 | /* OFFCORE_RESPONSE_1.ANY_RFO.LOCAL_CACHE */ | 295 | /* OFFCORE_RESPONSE.ANY_RFO.LOCAL_CACHE */ |
299 | [ C(RESULT_ACCESS) ] = 0x01bb, | 296 | [ C(RESULT_ACCESS) ] = 0x01b7, |
300 | /* OFFCORE_RESPONSE_0.ANY_RFO.ANY_LLC_MISS */ | 297 | /* OFFCORE_RESPONSE.ANY_RFO.ANY_LLC_MISS */ |
301 | [ C(RESULT_MISS) ] = 0x01b7, | 298 | [ C(RESULT_MISS) ] = 0x01b7, |
302 | }, | 299 | }, |
303 | [ C(OP_PREFETCH) ] = { | 300 | [ C(OP_PREFETCH) ] = { |
304 | /* OFFCORE_RESPONSE_0.PREFETCH.LOCAL_CACHE */ | 301 | /* OFFCORE_RESPONSE.PREFETCH.LOCAL_CACHE */ |
305 | [ C(RESULT_ACCESS) ] = 0x01b7, | 302 | [ C(RESULT_ACCESS) ] = 0x01b7, |
306 | /* OFFCORE_RESPONSE_1.PREFETCH.ANY_LLC_MISS */ | 303 | /* OFFCORE_RESPONSE.PREFETCH.ANY_LLC_MISS */ |
307 | [ C(RESULT_MISS) ] = 0x01bb, | 304 | [ C(RESULT_MISS) ] = 0x01b7, |
308 | }, | 305 | }, |
309 | }, | 306 | }, |
310 | [ C(DTLB) ] = { | 307 | [ C(DTLB) ] = { |
@@ -352,16 +349,36 @@ static __initconst const u64 westmere_hw_cache_event_ids | |||
352 | }; | 349 | }; |
353 | 350 | ||
354 | /* | 351 | /* |
355 | * OFFCORE_RESPONSE MSR bits (subset), See IA32 SDM Vol 3 30.6.1.3 | 352 | * Nehalem/Westmere MSR_OFFCORE_RESPONSE bits; |
353 | * See IA32 SDM Vol 3B 30.6.1.3 | ||
356 | */ | 354 | */ |
357 | 355 | ||
358 | #define DMND_DATA_RD (1 << 0) | 356 | #define NHM_DMND_DATA_RD (1 << 0) |
359 | #define DMND_RFO (1 << 1) | 357 | #define NHM_DMND_RFO (1 << 1) |
360 | #define DMND_WB (1 << 3) | 358 | #define NHM_DMND_IFETCH (1 << 2) |
361 | #define PF_DATA_RD (1 << 4) | 359 | #define NHM_DMND_WB (1 << 3) |
362 | #define PF_DATA_RFO (1 << 5) | 360 | #define NHM_PF_DATA_RD (1 << 4) |
363 | #define RESP_UNCORE_HIT (1 << 8) | 361 | #define NHM_PF_DATA_RFO (1 << 5) |
364 | #define RESP_MISS (0xf600) /* non uncore hit */ | 362 | #define NHM_PF_IFETCH (1 << 6) |
363 | #define NHM_OFFCORE_OTHER (1 << 7) | ||
364 | #define NHM_UNCORE_HIT (1 << 8) | ||
365 | #define NHM_OTHER_CORE_HIT_SNP (1 << 9) | ||
366 | #define NHM_OTHER_CORE_HITM (1 << 10) | ||
367 | /* reserved */ | ||
368 | #define NHM_REMOTE_CACHE_FWD (1 << 12) | ||
369 | #define NHM_REMOTE_DRAM (1 << 13) | ||
370 | #define NHM_LOCAL_DRAM (1 << 14) | ||
371 | #define NHM_NON_DRAM (1 << 15) | ||
372 | |||
373 | #define NHM_ALL_DRAM (NHM_REMOTE_DRAM|NHM_LOCAL_DRAM) | ||
374 | |||
375 | #define NHM_DMND_READ (NHM_DMND_DATA_RD) | ||
376 | #define NHM_DMND_WRITE (NHM_DMND_RFO|NHM_DMND_WB) | ||
377 | #define NHM_DMND_PREFETCH (NHM_PF_DATA_RD|NHM_PF_DATA_RFO) | ||
378 | |||
379 | #define NHM_L3_HIT (NHM_UNCORE_HIT|NHM_OTHER_CORE_HIT_SNP|NHM_OTHER_CORE_HITM) | ||
380 | #define NHM_L3_MISS (NHM_NON_DRAM|NHM_ALL_DRAM|NHM_REMOTE_CACHE_FWD) | ||
381 | #define NHM_L3_ACCESS (NHM_L3_HIT|NHM_L3_MISS) | ||
365 | 382 | ||
366 | static __initconst const u64 nehalem_hw_cache_extra_regs | 383 | static __initconst const u64 nehalem_hw_cache_extra_regs |
367 | [PERF_COUNT_HW_CACHE_MAX] | 384 | [PERF_COUNT_HW_CACHE_MAX] |
@@ -370,16 +387,16 @@ static __initconst const u64 nehalem_hw_cache_extra_regs | |||
370 | { | 387 | { |
371 | [ C(LL ) ] = { | 388 | [ C(LL ) ] = { |
372 | [ C(OP_READ) ] = { | 389 | [ C(OP_READ) ] = { |
373 | [ C(RESULT_ACCESS) ] = DMND_DATA_RD|RESP_UNCORE_HIT, | 390 | [ C(RESULT_ACCESS) ] = NHM_DMND_READ|NHM_L3_ACCESS, |
374 | [ C(RESULT_MISS) ] = DMND_DATA_RD|RESP_MISS, | 391 | [ C(RESULT_MISS) ] = NHM_DMND_READ|NHM_L3_MISS, |
375 | }, | 392 | }, |
376 | [ C(OP_WRITE) ] = { | 393 | [ C(OP_WRITE) ] = { |
377 | [ C(RESULT_ACCESS) ] = DMND_RFO|DMND_WB|RESP_UNCORE_HIT, | 394 | [ C(RESULT_ACCESS) ] = NHM_DMND_WRITE|NHM_L3_ACCESS, |
378 | [ C(RESULT_MISS) ] = DMND_RFO|DMND_WB|RESP_MISS, | 395 | [ C(RESULT_MISS) ] = NHM_DMND_WRITE|NHM_L3_MISS, |
379 | }, | 396 | }, |
380 | [ C(OP_PREFETCH) ] = { | 397 | [ C(OP_PREFETCH) ] = { |
381 | [ C(RESULT_ACCESS) ] = PF_DATA_RD|PF_DATA_RFO|RESP_UNCORE_HIT, | 398 | [ C(RESULT_ACCESS) ] = NHM_DMND_PREFETCH|NHM_L3_ACCESS, |
382 | [ C(RESULT_MISS) ] = PF_DATA_RD|PF_DATA_RFO|RESP_MISS, | 399 | [ C(RESULT_MISS) ] = NHM_DMND_PREFETCH|NHM_L3_MISS, |
383 | }, | 400 | }, |
384 | } | 401 | } |
385 | }; | 402 | }; |
diff --git a/arch/x86/kernel/ptrace.c b/arch/x86/kernel/ptrace.c index 45892dc4b72a..f65e5b521dbd 100644 --- a/arch/x86/kernel/ptrace.c +++ b/arch/x86/kernel/ptrace.c | |||
@@ -608,6 +608,9 @@ static int ptrace_write_dr7(struct task_struct *tsk, unsigned long data) | |||
608 | unsigned len, type; | 608 | unsigned len, type; |
609 | struct perf_event *bp; | 609 | struct perf_event *bp; |
610 | 610 | ||
611 | if (ptrace_get_breakpoints(tsk) < 0) | ||
612 | return -ESRCH; | ||
613 | |||
611 | data &= ~DR_CONTROL_RESERVED; | 614 | data &= ~DR_CONTROL_RESERVED; |
612 | old_dr7 = ptrace_get_dr7(thread->ptrace_bps); | 615 | old_dr7 = ptrace_get_dr7(thread->ptrace_bps); |
613 | restore: | 616 | restore: |
@@ -655,6 +658,9 @@ restore: | |||
655 | } | 658 | } |
656 | goto restore; | 659 | goto restore; |
657 | } | 660 | } |
661 | |||
662 | ptrace_put_breakpoints(tsk); | ||
663 | |||
658 | return ((orig_ret < 0) ? orig_ret : rc); | 664 | return ((orig_ret < 0) ? orig_ret : rc); |
659 | } | 665 | } |
660 | 666 | ||
@@ -668,10 +674,17 @@ static unsigned long ptrace_get_debugreg(struct task_struct *tsk, int n) | |||
668 | 674 | ||
669 | if (n < HBP_NUM) { | 675 | if (n < HBP_NUM) { |
670 | struct perf_event *bp; | 676 | struct perf_event *bp; |
677 | |||
678 | if (ptrace_get_breakpoints(tsk) < 0) | ||
679 | return -ESRCH; | ||
680 | |||
671 | bp = thread->ptrace_bps[n]; | 681 | bp = thread->ptrace_bps[n]; |
672 | if (!bp) | 682 | if (!bp) |
673 | return 0; | 683 | val = 0; |
674 | val = bp->hw.info.address; | 684 | else |
685 | val = bp->hw.info.address; | ||
686 | |||
687 | ptrace_put_breakpoints(tsk); | ||
675 | } else if (n == 6) { | 688 | } else if (n == 6) { |
676 | val = thread->debugreg6; | 689 | val = thread->debugreg6; |
677 | } else if (n == 7) { | 690 | } else if (n == 7) { |
@@ -686,6 +699,10 @@ static int ptrace_set_breakpoint_addr(struct task_struct *tsk, int nr, | |||
686 | struct perf_event *bp; | 699 | struct perf_event *bp; |
687 | struct thread_struct *t = &tsk->thread; | 700 | struct thread_struct *t = &tsk->thread; |
688 | struct perf_event_attr attr; | 701 | struct perf_event_attr attr; |
702 | int err = 0; | ||
703 | |||
704 | if (ptrace_get_breakpoints(tsk) < 0) | ||
705 | return -ESRCH; | ||
689 | 706 | ||
690 | if (!t->ptrace_bps[nr]) { | 707 | if (!t->ptrace_bps[nr]) { |
691 | ptrace_breakpoint_init(&attr); | 708 | ptrace_breakpoint_init(&attr); |
@@ -709,24 +726,23 @@ static int ptrace_set_breakpoint_addr(struct task_struct *tsk, int nr, | |||
709 | * writing for the user. And anyway this is the previous | 726 | * writing for the user. And anyway this is the previous |
710 | * behaviour. | 727 | * behaviour. |
711 | */ | 728 | */ |
712 | if (IS_ERR(bp)) | 729 | if (IS_ERR(bp)) { |
713 | return PTR_ERR(bp); | 730 | err = PTR_ERR(bp); |
731 | goto put; | ||
732 | } | ||
714 | 733 | ||
715 | t->ptrace_bps[nr] = bp; | 734 | t->ptrace_bps[nr] = bp; |
716 | } else { | 735 | } else { |
717 | int err; | ||
718 | |||
719 | bp = t->ptrace_bps[nr]; | 736 | bp = t->ptrace_bps[nr]; |
720 | 737 | ||
721 | attr = bp->attr; | 738 | attr = bp->attr; |
722 | attr.bp_addr = addr; | 739 | attr.bp_addr = addr; |
723 | err = modify_user_hw_breakpoint(bp, &attr); | 740 | err = modify_user_hw_breakpoint(bp, &attr); |
724 | if (err) | ||
725 | return err; | ||
726 | } | 741 | } |
727 | 742 | ||
728 | 743 | put: | |
729 | return 0; | 744 | ptrace_put_breakpoints(tsk); |
745 | return err; | ||
730 | } | 746 | } |
731 | 747 | ||
732 | /* | 748 | /* |
diff --git a/drivers/block/rbd.c b/drivers/block/rbd.c index 16dc3645291c..3e904717c1c0 100644 --- a/drivers/block/rbd.c +++ b/drivers/block/rbd.c | |||
@@ -777,9 +777,9 @@ static int rbd_do_request(struct request *rq, | |||
777 | ops, | 777 | ops, |
778 | false, | 778 | false, |
779 | GFP_NOIO, pages, bio); | 779 | GFP_NOIO, pages, bio); |
780 | if (IS_ERR(req)) { | 780 | if (!req) { |
781 | up_read(&header->snap_rwsem); | 781 | up_read(&header->snap_rwsem); |
782 | ret = PTR_ERR(req); | 782 | ret = -ENOMEM; |
783 | goto done_pages; | 783 | goto done_pages; |
784 | } | 784 | } |
785 | 785 | ||
diff --git a/drivers/firewire/ohci.c b/drivers/firewire/ohci.c index f903d7b6f34a..23d1468ad253 100644 --- a/drivers/firewire/ohci.c +++ b/drivers/firewire/ohci.c | |||
@@ -2199,7 +2199,6 @@ static int ohci_set_config_rom(struct fw_card *card, | |||
2199 | { | 2199 | { |
2200 | struct fw_ohci *ohci; | 2200 | struct fw_ohci *ohci; |
2201 | unsigned long flags; | 2201 | unsigned long flags; |
2202 | int ret = -EBUSY; | ||
2203 | __be32 *next_config_rom; | 2202 | __be32 *next_config_rom; |
2204 | dma_addr_t uninitialized_var(next_config_rom_bus); | 2203 | dma_addr_t uninitialized_var(next_config_rom_bus); |
2205 | 2204 | ||
@@ -2240,22 +2239,37 @@ static int ohci_set_config_rom(struct fw_card *card, | |||
2240 | 2239 | ||
2241 | spin_lock_irqsave(&ohci->lock, flags); | 2240 | spin_lock_irqsave(&ohci->lock, flags); |
2242 | 2241 | ||
2242 | /* | ||
2243 | * If there is not an already pending config_rom update, | ||
2244 | * push our new allocation into the ohci->next_config_rom | ||
2245 | * and then mark the local variable as null so that we | ||
2246 | * won't deallocate the new buffer. | ||
2247 | * | ||
2248 | * OTOH, if there is a pending config_rom update, just | ||
2249 | * use that buffer with the new config_rom data, and | ||
2250 | * let this routine free the unused DMA allocation. | ||
2251 | */ | ||
2252 | |||
2243 | if (ohci->next_config_rom == NULL) { | 2253 | if (ohci->next_config_rom == NULL) { |
2244 | ohci->next_config_rom = next_config_rom; | 2254 | ohci->next_config_rom = next_config_rom; |
2245 | ohci->next_config_rom_bus = next_config_rom_bus; | 2255 | ohci->next_config_rom_bus = next_config_rom_bus; |
2256 | next_config_rom = NULL; | ||
2257 | } | ||
2246 | 2258 | ||
2247 | copy_config_rom(ohci->next_config_rom, config_rom, length); | 2259 | copy_config_rom(ohci->next_config_rom, config_rom, length); |
2248 | 2260 | ||
2249 | ohci->next_header = config_rom[0]; | 2261 | ohci->next_header = config_rom[0]; |
2250 | ohci->next_config_rom[0] = 0; | 2262 | ohci->next_config_rom[0] = 0; |
2251 | 2263 | ||
2252 | reg_write(ohci, OHCI1394_ConfigROMmap, | 2264 | reg_write(ohci, OHCI1394_ConfigROMmap, ohci->next_config_rom_bus); |
2253 | ohci->next_config_rom_bus); | ||
2254 | ret = 0; | ||
2255 | } | ||
2256 | 2265 | ||
2257 | spin_unlock_irqrestore(&ohci->lock, flags); | 2266 | spin_unlock_irqrestore(&ohci->lock, flags); |
2258 | 2267 | ||
2268 | /* If we didn't use the DMA allocation, delete it. */ | ||
2269 | if (next_config_rom != NULL) | ||
2270 | dma_free_coherent(ohci->card.device, CONFIG_ROM_SIZE, | ||
2271 | next_config_rom, next_config_rom_bus); | ||
2272 | |||
2259 | /* | 2273 | /* |
2260 | * Now initiate a bus reset to have the changes take | 2274 | * Now initiate a bus reset to have the changes take |
2261 | * effect. We clean up the old config rom memory and DMA | 2275 | * effect. We clean up the old config rom memory and DMA |
@@ -2263,13 +2277,10 @@ static int ohci_set_config_rom(struct fw_card *card, | |||
2263 | * controller could need to access it before the bus reset | 2277 | * controller could need to access it before the bus reset |
2264 | * takes effect. | 2278 | * takes effect. |
2265 | */ | 2279 | */ |
2266 | if (ret == 0) | ||
2267 | fw_schedule_bus_reset(&ohci->card, true, true); | ||
2268 | else | ||
2269 | dma_free_coherent(ohci->card.device, CONFIG_ROM_SIZE, | ||
2270 | next_config_rom, next_config_rom_bus); | ||
2271 | 2280 | ||
2272 | return ret; | 2281 | fw_schedule_bus_reset(&ohci->card, true, true); |
2282 | |||
2283 | return 0; | ||
2273 | } | 2284 | } |
2274 | 2285 | ||
2275 | static void ohci_send_request(struct fw_card *card, struct fw_packet *packet) | 2286 | static void ohci_send_request(struct fw_card *card, struct fw_packet *packet) |
diff --git a/drivers/gpu/drm/drm_mm.c b/drivers/gpu/drm/drm_mm.c index 5d00b0fc0d91..959186cbf328 100644 --- a/drivers/gpu/drm/drm_mm.c +++ b/drivers/gpu/drm/drm_mm.c | |||
@@ -431,7 +431,7 @@ EXPORT_SYMBOL(drm_mm_search_free_in_range); | |||
431 | void drm_mm_replace_node(struct drm_mm_node *old, struct drm_mm_node *new) | 431 | void drm_mm_replace_node(struct drm_mm_node *old, struct drm_mm_node *new) |
432 | { | 432 | { |
433 | list_replace(&old->node_list, &new->node_list); | 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 | new->hole_follows = old->hole_follows; | 435 | new->hole_follows = old->hole_follows; |
436 | new->mm = old->mm; | 436 | new->mm = old->mm; |
437 | new->start = old->start; | 437 | new->start = old->start; |
@@ -699,8 +699,8 @@ int drm_mm_dump_table(struct seq_file *m, struct drm_mm *mm) | |||
699 | entry->size); | 699 | entry->size); |
700 | total_used += entry->size; | 700 | total_used += entry->size; |
701 | if (entry->hole_follows) { | 701 | if (entry->hole_follows) { |
702 | hole_start = drm_mm_hole_node_start(&mm->head_node); | 702 | hole_start = drm_mm_hole_node_start(entry); |
703 | hole_end = drm_mm_hole_node_end(&mm->head_node); | 703 | hole_end = drm_mm_hole_node_end(entry); |
704 | hole_size = hole_end - hole_start; | 704 | hole_size = hole_end - hole_start; |
705 | seq_printf(m, "0x%08lx-0x%08lx: 0x%08lx: free\n", | 705 | seq_printf(m, "0x%08lx-0x%08lx: 0x%08lx: free\n", |
706 | hole_start, hole_end, hole_size); | 706 | hole_start, hole_end, hole_size); |
diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c index e522c702b04e..373c2a005ec1 100644 --- a/drivers/gpu/drm/i915/intel_display.c +++ b/drivers/gpu/drm/i915/intel_display.c | |||
@@ -5154,8 +5154,6 @@ static int intel_crtc_mode_set(struct drm_crtc *crtc, | |||
5154 | 5154 | ||
5155 | I915_WRITE(DSPCNTR(plane), dspcntr); | 5155 | I915_WRITE(DSPCNTR(plane), dspcntr); |
5156 | POSTING_READ(DSPCNTR(plane)); | 5156 | POSTING_READ(DSPCNTR(plane)); |
5157 | if (!HAS_PCH_SPLIT(dev)) | ||
5158 | intel_enable_plane(dev_priv, plane, pipe); | ||
5159 | 5157 | ||
5160 | ret = intel_pipe_set_base(crtc, x, y, old_fb); | 5158 | ret = intel_pipe_set_base(crtc, x, y, old_fb); |
5161 | 5159 | ||
@@ -5605,9 +5603,9 @@ static int intel_crtc_clock_get(struct drm_device *dev, struct drm_crtc *crtc) | |||
5605 | intel_clock_t clock; | 5603 | intel_clock_t clock; |
5606 | 5604 | ||
5607 | if ((dpll & DISPLAY_RATE_SELECT_FPA1) == 0) | 5605 | if ((dpll & DISPLAY_RATE_SELECT_FPA1) == 0) |
5608 | fp = FP0(pipe); | 5606 | fp = I915_READ(FP0(pipe)); |
5609 | else | 5607 | else |
5610 | fp = FP1(pipe); | 5608 | fp = I915_READ(FP1(pipe)); |
5611 | 5609 | ||
5612 | clock.m1 = (fp & FP_M1_DIV_MASK) >> FP_M1_DIV_SHIFT; | 5610 | clock.m1 = (fp & FP_M1_DIV_MASK) >> FP_M1_DIV_SHIFT; |
5613 | if (IS_PINEVIEW(dev)) { | 5611 | if (IS_PINEVIEW(dev)) { |
@@ -6579,8 +6577,10 @@ intel_user_framebuffer_create(struct drm_device *dev, | |||
6579 | return ERR_PTR(-ENOENT); | 6577 | return ERR_PTR(-ENOENT); |
6580 | 6578 | ||
6581 | intel_fb = kzalloc(sizeof(*intel_fb), GFP_KERNEL); | 6579 | intel_fb = kzalloc(sizeof(*intel_fb), GFP_KERNEL); |
6582 | if (!intel_fb) | 6580 | if (!intel_fb) { |
6581 | drm_gem_object_unreference_unlocked(&obj->base); | ||
6583 | return ERR_PTR(-ENOMEM); | 6582 | return ERR_PTR(-ENOMEM); |
6583 | } | ||
6584 | 6584 | ||
6585 | ret = intel_framebuffer_init(dev, intel_fb, mode_cmd, obj); | 6585 | ret = intel_framebuffer_init(dev, intel_fb, mode_cmd, obj); |
6586 | if (ret) { | 6586 | if (ret) { |
diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c index cb8578b7e443..a4d80314e7f8 100644 --- a/drivers/gpu/drm/i915/intel_dp.c +++ b/drivers/gpu/drm/i915/intel_dp.c | |||
@@ -1470,7 +1470,8 @@ intel_dp_link_down(struct intel_dp *intel_dp) | |||
1470 | 1470 | ||
1471 | if (!HAS_PCH_CPT(dev) && | 1471 | if (!HAS_PCH_CPT(dev) && |
1472 | I915_READ(intel_dp->output_reg) & DP_PIPEB_SELECT) { | 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 | /* Hardware workaround: leaving our transcoder select | 1475 | /* Hardware workaround: leaving our transcoder select |
1475 | * set to transcoder B while it's off will prevent the | 1476 | * set to transcoder B while it's off will prevent the |
1476 | * corresponding HDMI output on transcoder A. | 1477 | * corresponding HDMI output on transcoder A. |
@@ -1485,7 +1486,19 @@ intel_dp_link_down(struct intel_dp *intel_dp) | |||
1485 | /* Changes to enable or select take place the vblank | 1486 | /* Changes to enable or select take place the vblank |
1486 | * after being written. | 1487 | * after being written. |
1487 | */ | 1488 | */ |
1488 | intel_wait_for_vblank(dev, intel_crtc->pipe); | 1489 | if (crtc == NULL) { |
1490 | /* We can arrive here never having been attached | ||
1491 | * to a CRTC, for instance, due to inheriting | ||
1492 | * random state from the BIOS. | ||
1493 | * | ||
1494 | * If the pipe is not running, play safe and | ||
1495 | * wait for the clocks to stabilise before | ||
1496 | * continuing. | ||
1497 | */ | ||
1498 | POSTING_READ(intel_dp->output_reg); | ||
1499 | msleep(50); | ||
1500 | } else | ||
1501 | intel_wait_for_vblank(dev, to_intel_crtc(crtc)->pipe); | ||
1489 | } | 1502 | } |
1490 | 1503 | ||
1491 | I915_WRITE(intel_dp->output_reg, DP & ~DP_PORT_EN); | 1504 | I915_WRITE(intel_dp->output_reg, DP & ~DP_PORT_EN); |
diff --git a/drivers/gpu/drm/i915/intel_lvds.c b/drivers/gpu/drm/i915/intel_lvds.c index a562bd2648c7..67cb076d271b 100644 --- a/drivers/gpu/drm/i915/intel_lvds.c +++ b/drivers/gpu/drm/i915/intel_lvds.c | |||
@@ -539,6 +539,9 @@ static int intel_lid_notify(struct notifier_block *nb, unsigned long val, | |||
539 | struct drm_device *dev = dev_priv->dev; | 539 | struct drm_device *dev = dev_priv->dev; |
540 | struct drm_connector *connector = dev_priv->int_lvds_connector; | 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 | * check and update the status of LVDS connector after receiving | 546 | * check and update the status of LVDS connector after receiving |
544 | * the LID nofication event. | 547 | * the LID nofication event. |
diff --git a/drivers/gpu/drm/nouveau/nouveau_mem.c b/drivers/gpu/drm/nouveau/nouveau_mem.c index 5045f8b921d6..c3e953b08992 100644 --- a/drivers/gpu/drm/nouveau/nouveau_mem.c +++ b/drivers/gpu/drm/nouveau/nouveau_mem.c | |||
@@ -152,8 +152,6 @@ nouveau_mem_vram_fini(struct drm_device *dev) | |||
152 | { | 152 | { |
153 | struct drm_nouveau_private *dev_priv = dev->dev_private; | 153 | struct drm_nouveau_private *dev_priv = dev->dev_private; |
154 | 154 | ||
155 | nouveau_bo_ref(NULL, &dev_priv->vga_ram); | ||
156 | |||
157 | ttm_bo_device_release(&dev_priv->ttm.bdev); | 155 | ttm_bo_device_release(&dev_priv->ttm.bdev); |
158 | 156 | ||
159 | nouveau_ttm_global_release(dev_priv); | 157 | nouveau_ttm_global_release(dev_priv); |
diff --git a/drivers/gpu/drm/nouveau/nouveau_state.c b/drivers/gpu/drm/nouveau/nouveau_state.c index a30adec5beaa..915fbce89595 100644 --- a/drivers/gpu/drm/nouveau/nouveau_state.c +++ b/drivers/gpu/drm/nouveau/nouveau_state.c | |||
@@ -768,6 +768,11 @@ static void nouveau_card_takedown(struct drm_device *dev) | |||
768 | engine->mc.takedown(dev); | 768 | engine->mc.takedown(dev); |
769 | engine->display.late_takedown(dev); | 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 | mutex_lock(&dev->struct_mutex); | 776 | mutex_lock(&dev->struct_mutex); |
772 | ttm_bo_clean_mm(&dev_priv->ttm.bdev, TTM_PL_VRAM); | 777 | ttm_bo_clean_mm(&dev_priv->ttm.bdev, TTM_PL_VRAM); |
773 | ttm_bo_clean_mm(&dev_priv->ttm.bdev, TTM_PL_TT); | 778 | ttm_bo_clean_mm(&dev_priv->ttm.bdev, TTM_PL_TT); |
diff --git a/drivers/gpu/drm/radeon/radeon_atombios.c b/drivers/gpu/drm/radeon/radeon_atombios.c index f116516bfef7..dd881d035f09 100644 --- a/drivers/gpu/drm/radeon/radeon_atombios.c +++ b/drivers/gpu/drm/radeon/radeon_atombios.c | |||
@@ -431,7 +431,7 @@ static bool radeon_atom_apply_quirks(struct drm_device *dev, | |||
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 | * on the laptop and a DVI port on the docking station and | 435 | * on the laptop and a DVI port on the docking station and |
436 | * both share the same encoder, hpd pin, and ddc line. | 436 | * both share the same encoder, hpd pin, and ddc line. |
437 | * So while the bios table is technically correct, | 437 | * So while the bios table is technically correct, |
@@ -440,7 +440,7 @@ static bool radeon_atom_apply_quirks(struct drm_device *dev, | |||
440 | * with different crtcs which isn't possible on the hardware | 440 | * with different crtcs which isn't possible on the hardware |
441 | * side and leaves no crtcs for LVDS or VGA. | 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 | (dev->pdev->subsystem_vendor == 0x1025) && | 444 | (dev->pdev->subsystem_vendor == 0x1025) && |
445 | (dev->pdev->subsystem_device == 0x013c)) { | 445 | (dev->pdev->subsystem_device == 0x013c)) { |
446 | if ((*connector_type == DRM_MODE_CONNECTOR_DVII) && | 446 | if ((*connector_type == DRM_MODE_CONNECTOR_DVII) && |
diff --git a/drivers/gpu/drm/radeon/radeon_atpx_handler.c b/drivers/gpu/drm/radeon/radeon_atpx_handler.c index ed5dfe58f29c..9d95792bea3e 100644 --- a/drivers/gpu/drm/radeon/radeon_atpx_handler.c +++ b/drivers/gpu/drm/radeon/radeon_atpx_handler.c | |||
@@ -15,6 +15,9 @@ | |||
15 | #define ATPX_VERSION 0 | 15 | #define ATPX_VERSION 0 |
16 | #define ATPX_GPU_PWR 2 | 16 | #define ATPX_GPU_PWR 2 |
17 | #define ATPX_MUX_SELECT 3 | 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 | #define ATPX_INTEGRATED 0 | 22 | #define ATPX_INTEGRATED 0 |
20 | #define ATPX_DISCRETE 1 | 23 | #define ATPX_DISCRETE 1 |
@@ -149,13 +152,35 @@ static int radeon_atpx_switch_mux(acpi_handle handle, int mux_id) | |||
149 | return radeon_atpx_execute(handle, ATPX_MUX_SELECT, mux_id); | 152 | return radeon_atpx_execute(handle, ATPX_MUX_SELECT, mux_id); |
150 | } | 153 | } |
151 | 154 | ||
155 | static int radeon_atpx_switch_i2c_mux(acpi_handle handle, int mux_id) | ||
156 | { | ||
157 | return radeon_atpx_execute(handle, ATPX_I2C_MUX_SELECT, mux_id); | ||
158 | } | ||
159 | |||
160 | static int radeon_atpx_switch_start(acpi_handle handle, int gpu_id) | ||
161 | { | ||
162 | return radeon_atpx_execute(handle, ATPX_SWITCH_START, gpu_id); | ||
163 | } | ||
164 | |||
165 | static int radeon_atpx_switch_end(acpi_handle handle, int gpu_id) | ||
166 | { | ||
167 | return radeon_atpx_execute(handle, ATPX_SWITCH_END, gpu_id); | ||
168 | } | ||
152 | 169 | ||
153 | static int radeon_atpx_switchto(enum vga_switcheroo_client_id id) | 170 | static int radeon_atpx_switchto(enum vga_switcheroo_client_id id) |
154 | { | 171 | { |
172 | int gpu_id; | ||
173 | |||
155 | if (id == VGA_SWITCHEROO_IGD) | 174 | if (id == VGA_SWITCHEROO_IGD) |
156 | radeon_atpx_switch_mux(radeon_atpx_priv.atpx_handle, 0); | 175 | gpu_id = ATPX_INTEGRATED; |
157 | else | 176 | else |
158 | radeon_atpx_switch_mux(radeon_atpx_priv.atpx_handle, 1); | 177 | gpu_id = ATPX_DISCRETE; |
178 | |||
179 | radeon_atpx_switch_start(radeon_atpx_priv.atpx_handle, gpu_id); | ||
180 | radeon_atpx_switch_mux(radeon_atpx_priv.atpx_handle, gpu_id); | ||
181 | radeon_atpx_switch_i2c_mux(radeon_atpx_priv.atpx_handle, gpu_id); | ||
182 | radeon_atpx_switch_end(radeon_atpx_priv.atpx_handle, gpu_id); | ||
183 | |||
159 | return 0; | 184 | return 0; |
160 | } | 185 | } |
161 | 186 | ||
diff --git a/drivers/gpu/drm/radeon/radeon_cursor.c b/drivers/gpu/drm/radeon/radeon_cursor.c index bdf2fa1189ae..3189a7efb2e9 100644 --- a/drivers/gpu/drm/radeon/radeon_cursor.c +++ b/drivers/gpu/drm/radeon/radeon_cursor.c | |||
@@ -167,9 +167,6 @@ int radeon_crtc_cursor_set(struct drm_crtc *crtc, | |||
167 | return -EINVAL; | 167 | return -EINVAL; |
168 | } | 168 | } |
169 | 169 | ||
170 | radeon_crtc->cursor_width = width; | ||
171 | radeon_crtc->cursor_height = height; | ||
172 | |||
173 | obj = drm_gem_object_lookup(crtc->dev, file_priv, handle); | 170 | obj = drm_gem_object_lookup(crtc->dev, file_priv, handle); |
174 | if (!obj) { | 171 | if (!obj) { |
175 | DRM_ERROR("Cannot find cursor object %x for crtc %d\n", handle, radeon_crtc->crtc_id); | 172 | DRM_ERROR("Cannot find cursor object %x for crtc %d\n", handle, radeon_crtc->crtc_id); |
@@ -180,6 +177,9 @@ int radeon_crtc_cursor_set(struct drm_crtc *crtc, | |||
180 | if (ret) | 177 | if (ret) |
181 | goto fail; | 178 | goto fail; |
182 | 179 | ||
180 | radeon_crtc->cursor_width = width; | ||
181 | radeon_crtc->cursor_height = height; | ||
182 | |||
183 | radeon_lock_cursor(crtc, true); | 183 | radeon_lock_cursor(crtc, true); |
184 | /* XXX only 27 bit offset for legacy cursor */ | 184 | /* XXX only 27 bit offset for legacy cursor */ |
185 | radeon_set_cursor(crtc, obj, gpu_addr); | 185 | radeon_set_cursor(crtc, obj, gpu_addr); |
diff --git a/drivers/media/dvb/dvb-usb/Kconfig b/drivers/media/dvb/dvb-usb/Kconfig index ccbd39a38c46..c545039287ad 100644 --- a/drivers/media/dvb/dvb-usb/Kconfig +++ b/drivers/media/dvb/dvb-usb/Kconfig | |||
@@ -356,6 +356,8 @@ config DVB_USB_LME2510 | |||
356 | select DVB_TDA826X if !DVB_FE_CUSTOMISE | 356 | select DVB_TDA826X if !DVB_FE_CUSTOMISE |
357 | select DVB_STV0288 if !DVB_FE_CUSTOMISE | 357 | select DVB_STV0288 if !DVB_FE_CUSTOMISE |
358 | select DVB_IX2505V if !DVB_FE_CUSTOMISE | 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 | help | 361 | help |
360 | Say Y here to support the LME DM04/QQBOX DVB-S USB2.0 . | 362 | Say Y here to support the LME DM04/QQBOX DVB-S USB2.0 . |
361 | 363 | ||
diff --git a/drivers/media/dvb/ngene/ngene-core.c b/drivers/media/dvb/ngene/ngene-core.c index ccc2d1af49d4..6927c726ce35 100644 --- a/drivers/media/dvb/ngene/ngene-core.c +++ b/drivers/media/dvb/ngene/ngene-core.c | |||
@@ -1520,6 +1520,7 @@ static int init_channel(struct ngene_channel *chan) | |||
1520 | if (dev->ci.en && (io & NGENE_IO_TSOUT)) { | 1520 | if (dev->ci.en && (io & NGENE_IO_TSOUT)) { |
1521 | dvb_ca_en50221_init(adapter, dev->ci.en, 0, 1); | 1521 | dvb_ca_en50221_init(adapter, dev->ci.en, 0, 1); |
1522 | set_transfer(chan, 1); | 1522 | set_transfer(chan, 1); |
1523 | chan->dev->channel[2].DataFormatFlags = DF_SWAP32; | ||
1523 | set_transfer(&chan->dev->channel[2], 1); | 1524 | set_transfer(&chan->dev->channel[2], 1); |
1524 | dvb_register_device(adapter, &chan->ci_dev, | 1525 | dvb_register_device(adapter, &chan->ci_dev, |
1525 | &ngene_dvbdev_ci, (void *) chan, | 1526 | &ngene_dvbdev_ci, (void *) chan, |
diff --git a/drivers/media/radio/saa7706h.c b/drivers/media/radio/saa7706h.c index 585680ffbfb6..b1193dfc5087 100644 --- a/drivers/media/radio/saa7706h.c +++ b/drivers/media/radio/saa7706h.c | |||
@@ -376,7 +376,7 @@ static int __devinit saa7706h_probe(struct i2c_client *client, | |||
376 | v4l_info(client, "chip found @ 0x%02x (%s)\n", | 376 | v4l_info(client, "chip found @ 0x%02x (%s)\n", |
377 | client->addr << 1, client->adapter->name); | 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 | if (state == NULL) | 380 | if (state == NULL) |
381 | return -ENOMEM; | 381 | return -ENOMEM; |
382 | sd = &state->sd; | 382 | sd = &state->sd; |
diff --git a/drivers/media/radio/tef6862.c b/drivers/media/radio/tef6862.c index 7c0d77751f6e..0991e1973678 100644 --- a/drivers/media/radio/tef6862.c +++ b/drivers/media/radio/tef6862.c | |||
@@ -176,7 +176,7 @@ static int __devinit tef6862_probe(struct i2c_client *client, | |||
176 | v4l_info(client, "chip found @ 0x%02x (%s)\n", | 176 | v4l_info(client, "chip found @ 0x%02x (%s)\n", |
177 | client->addr << 1, client->adapter->name); | 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 | if (state == NULL) | 180 | if (state == NULL) |
181 | return -ENOMEM; | 181 | return -ENOMEM; |
182 | state->freq = TEF6862_LO_FREQ; | 182 | state->freq = TEF6862_LO_FREQ; |
diff --git a/drivers/media/rc/imon.c b/drivers/media/rc/imon.c index ebd68edf5b24..8fc0f081b470 100644 --- a/drivers/media/rc/imon.c +++ b/drivers/media/rc/imon.c | |||
@@ -46,7 +46,7 @@ | |||
46 | #define MOD_AUTHOR "Jarod Wilson <jarod@wilsonet.com>" | 46 | #define MOD_AUTHOR "Jarod Wilson <jarod@wilsonet.com>" |
47 | #define MOD_DESC "Driver for SoundGraph iMON MultiMedia IR/Display" | 47 | #define MOD_DESC "Driver for SoundGraph iMON MultiMedia IR/Display" |
48 | #define MOD_NAME "imon" | 48 | #define MOD_NAME "imon" |
49 | #define MOD_VERSION "0.9.2" | 49 | #define MOD_VERSION "0.9.3" |
50 | 50 | ||
51 | #define DISPLAY_MINOR_BASE 144 | 51 | #define DISPLAY_MINOR_BASE 144 |
52 | #define DEVICE_NAME "lcd%d" | 52 | #define DEVICE_NAME "lcd%d" |
@@ -460,8 +460,9 @@ static int display_close(struct inode *inode, struct file *file) | |||
460 | } | 460 | } |
461 | 461 | ||
462 | /** | 462 | /** |
463 | * Sends a packet to the device -- this function must be called | 463 | * Sends a packet to the device -- this function must be called with |
464 | * with ictx->lock held. | 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 | static int send_packet(struct imon_context *ictx) | 467 | static int send_packet(struct imon_context *ictx) |
467 | { | 468 | { |
@@ -991,12 +992,21 @@ static void imon_touch_display_timeout(unsigned long data) | |||
991 | * the iMON remotes, and those used by the Windows MCE remotes (which is | 992 | * the iMON remotes, and those used by the Windows MCE remotes (which is |
992 | * really just RC-6), but only one or the other at a time, as the signals | 993 | * really just RC-6), but only one or the other at a time, as the signals |
993 | * are decoded onboard the receiver. | 994 | * are decoded onboard the receiver. |
995 | * | ||
996 | * This function gets called two different ways, one way is from | ||
997 | * rc_register_device, for initial protocol selection/setup, and the other is | ||
998 | * via a userspace-initiated protocol change request, either by direct sysfs | ||
999 | * prodding or by something like ir-keytable. In the rc_register_device case, | ||
1000 | * the imon context lock is already held, but when initiated from userspace, | ||
1001 | * it is not, so we must acquire it prior to calling send_packet, which | ||
1002 | * requires that the lock is held. | ||
994 | */ | 1003 | */ |
995 | static int imon_ir_change_protocol(struct rc_dev *rc, u64 rc_type) | 1004 | static int imon_ir_change_protocol(struct rc_dev *rc, u64 rc_type) |
996 | { | 1005 | { |
997 | int retval; | 1006 | int retval; |
998 | struct imon_context *ictx = rc->priv; | 1007 | struct imon_context *ictx = rc->priv; |
999 | struct device *dev = ictx->dev; | 1008 | struct device *dev = ictx->dev; |
1009 | bool unlock = false; | ||
1000 | unsigned char ir_proto_packet[] = { | 1010 | unsigned char ir_proto_packet[] = { |
1001 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x86 }; | 1011 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x86 }; |
1002 | 1012 | ||
@@ -1029,6 +1039,11 @@ static int imon_ir_change_protocol(struct rc_dev *rc, u64 rc_type) | |||
1029 | 1039 | ||
1030 | memcpy(ictx->usb_tx_buf, &ir_proto_packet, sizeof(ir_proto_packet)); | 1040 | memcpy(ictx->usb_tx_buf, &ir_proto_packet, sizeof(ir_proto_packet)); |
1031 | 1041 | ||
1042 | if (!mutex_is_locked(&ictx->lock)) { | ||
1043 | unlock = true; | ||
1044 | mutex_lock(&ictx->lock); | ||
1045 | } | ||
1046 | |||
1032 | retval = send_packet(ictx); | 1047 | retval = send_packet(ictx); |
1033 | if (retval) | 1048 | if (retval) |
1034 | goto out; | 1049 | goto out; |
@@ -1037,6 +1052,9 @@ static int imon_ir_change_protocol(struct rc_dev *rc, u64 rc_type) | |||
1037 | ictx->pad_mouse = false; | 1052 | ictx->pad_mouse = false; |
1038 | 1053 | ||
1039 | out: | 1054 | out: |
1055 | if (unlock) | ||
1056 | mutex_unlock(&ictx->lock); | ||
1057 | |||
1040 | return retval; | 1058 | return retval; |
1041 | } | 1059 | } |
1042 | 1060 | ||
@@ -2134,6 +2152,7 @@ static struct imon_context *imon_init_intf0(struct usb_interface *intf) | |||
2134 | goto rdev_setup_failed; | 2152 | goto rdev_setup_failed; |
2135 | } | 2153 | } |
2136 | 2154 | ||
2155 | mutex_unlock(&ictx->lock); | ||
2137 | return ictx; | 2156 | return ictx; |
2138 | 2157 | ||
2139 | rdev_setup_failed: | 2158 | rdev_setup_failed: |
@@ -2205,6 +2224,7 @@ static struct imon_context *imon_init_intf1(struct usb_interface *intf, | |||
2205 | goto urb_submit_failed; | 2224 | goto urb_submit_failed; |
2206 | } | 2225 | } |
2207 | 2226 | ||
2227 | mutex_unlock(&ictx->lock); | ||
2208 | return ictx; | 2228 | return ictx; |
2209 | 2229 | ||
2210 | urb_submit_failed: | 2230 | urb_submit_failed: |
@@ -2299,6 +2319,8 @@ static int __devinit imon_probe(struct usb_interface *interface, | |||
2299 | usb_set_intfdata(interface, ictx); | 2319 | usb_set_intfdata(interface, ictx); |
2300 | 2320 | ||
2301 | if (ifnum == 0) { | 2321 | if (ifnum == 0) { |
2322 | mutex_lock(&ictx->lock); | ||
2323 | |||
2302 | if (product == 0xffdc && ictx->rf_device) { | 2324 | if (product == 0xffdc && ictx->rf_device) { |
2303 | sysfs_err = sysfs_create_group(&interface->dev.kobj, | 2325 | sysfs_err = sysfs_create_group(&interface->dev.kobj, |
2304 | &imon_rf_attr_group); | 2326 | &imon_rf_attr_group); |
@@ -2309,13 +2331,14 @@ static int __devinit imon_probe(struct usb_interface *interface, | |||
2309 | 2331 | ||
2310 | if (ictx->display_supported) | 2332 | if (ictx->display_supported) |
2311 | imon_init_display(ictx, interface); | 2333 | imon_init_display(ictx, interface); |
2334 | |||
2335 | mutex_unlock(&ictx->lock); | ||
2312 | } | 2336 | } |
2313 | 2337 | ||
2314 | dev_info(dev, "iMON device (%04x:%04x, intf%d) on " | 2338 | dev_info(dev, "iMON device (%04x:%04x, intf%d) on " |
2315 | "usb<%d:%d> initialized\n", vendor, product, ifnum, | 2339 | "usb<%d:%d> initialized\n", vendor, product, ifnum, |
2316 | usbdev->bus->busnum, usbdev->devnum); | 2340 | usbdev->bus->busnum, usbdev->devnum); |
2317 | 2341 | ||
2318 | mutex_unlock(&ictx->lock); | ||
2319 | mutex_unlock(&driver_lock); | 2342 | mutex_unlock(&driver_lock); |
2320 | 2343 | ||
2321 | return 0; | 2344 | return 0; |
diff --git a/drivers/media/rc/ite-cir.c b/drivers/media/rc/ite-cir.c index accaf6c9789a..43908a70bd8b 100644 --- a/drivers/media/rc/ite-cir.c +++ b/drivers/media/rc/ite-cir.c | |||
@@ -36,6 +36,7 @@ | |||
36 | #include <linux/io.h> | 36 | #include <linux/io.h> |
37 | #include <linux/interrupt.h> | 37 | #include <linux/interrupt.h> |
38 | #include <linux/sched.h> | 38 | #include <linux/sched.h> |
39 | #include <linux/delay.h> | ||
39 | #include <linux/slab.h> | 40 | #include <linux/slab.h> |
40 | #include <linux/input.h> | 41 | #include <linux/input.h> |
41 | #include <linux/bitops.h> | 42 | #include <linux/bitops.h> |
diff --git a/drivers/media/rc/mceusb.c b/drivers/media/rc/mceusb.c index 044fb7a382d6..0c273ec465c9 100644 --- a/drivers/media/rc/mceusb.c +++ b/drivers/media/rc/mceusb.c | |||
@@ -220,6 +220,8 @@ static struct usb_device_id mceusb_dev_table[] = { | |||
220 | { USB_DEVICE(VENDOR_PHILIPS, 0x206c) }, | 220 | { USB_DEVICE(VENDOR_PHILIPS, 0x206c) }, |
221 | /* Philips/Spinel plus IR transceiver for ASUS */ | 221 | /* Philips/Spinel plus IR transceiver for ASUS */ |
222 | { USB_DEVICE(VENDOR_PHILIPS, 0x2088) }, | 222 | { USB_DEVICE(VENDOR_PHILIPS, 0x2088) }, |
223 | /* Philips IR transceiver (Dell branded) */ | ||
224 | { USB_DEVICE(VENDOR_PHILIPS, 0x2093) }, | ||
223 | /* Realtek MCE IR Receiver and card reader */ | 225 | /* Realtek MCE IR Receiver and card reader */ |
224 | { USB_DEVICE(VENDOR_REALTEK, 0x0161), | 226 | { USB_DEVICE(VENDOR_REALTEK, 0x0161), |
225 | .driver_info = MULTIFUNCTION }, | 227 | .driver_info = MULTIFUNCTION }, |
diff --git a/drivers/media/rc/rc-main.c b/drivers/media/rc/rc-main.c index f53f9c68d38d..a2706648e365 100644 --- a/drivers/media/rc/rc-main.c +++ b/drivers/media/rc/rc-main.c | |||
@@ -707,7 +707,8 @@ static void ir_close(struct input_dev *idev) | |||
707 | { | 707 | { |
708 | struct rc_dev *rdev = input_get_drvdata(idev); | 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 | /* class for /sys/class/rc */ | 714 | /* class for /sys/class/rc */ |
@@ -733,6 +734,7 @@ static struct { | |||
733 | { RC_TYPE_SONY, "sony" }, | 734 | { RC_TYPE_SONY, "sony" }, |
734 | { RC_TYPE_RC5_SZ, "rc-5-sz" }, | 735 | { RC_TYPE_RC5_SZ, "rc-5-sz" }, |
735 | { RC_TYPE_LIRC, "lirc" }, | 736 | { RC_TYPE_LIRC, "lirc" }, |
737 | { RC_TYPE_OTHER, "other" }, | ||
736 | }; | 738 | }; |
737 | 739 | ||
738 | #define PROTO_NONE "none" | 740 | #define PROTO_NONE "none" |
diff --git a/drivers/media/video/m52790.c b/drivers/media/video/m52790.c index 5e1c9a81984c..303ffa7df4ac 100644 --- a/drivers/media/video/m52790.c +++ b/drivers/media/video/m52790.c | |||
@@ -174,7 +174,7 @@ static int m52790_probe(struct i2c_client *client, | |||
174 | v4l_info(client, "chip found @ 0x%x (%s)\n", | 174 | v4l_info(client, "chip found @ 0x%x (%s)\n", |
175 | client->addr << 1, client->adapter->name); | 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 | if (state == NULL) | 178 | if (state == NULL) |
179 | return -ENOMEM; | 179 | return -ENOMEM; |
180 | 180 | ||
diff --git a/drivers/media/video/tda9840.c b/drivers/media/video/tda9840.c index 5d4cf3b3d435..22fa8202d5ca 100644 --- a/drivers/media/video/tda9840.c +++ b/drivers/media/video/tda9840.c | |||
@@ -171,7 +171,7 @@ static int tda9840_probe(struct i2c_client *client, | |||
171 | v4l_info(client, "chip found @ 0x%x (%s)\n", | 171 | v4l_info(client, "chip found @ 0x%x (%s)\n", |
172 | client->addr << 1, client->adapter->name); | 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 | if (sd == NULL) | 175 | if (sd == NULL) |
176 | return -ENOMEM; | 176 | return -ENOMEM; |
177 | v4l2_i2c_subdev_init(sd, client, &tda9840_ops); | 177 | v4l2_i2c_subdev_init(sd, client, &tda9840_ops); |
diff --git a/drivers/media/video/tea6415c.c b/drivers/media/video/tea6415c.c index 19621ed523ec..827425c5b866 100644 --- a/drivers/media/video/tea6415c.c +++ b/drivers/media/video/tea6415c.c | |||
@@ -152,7 +152,7 @@ static int tea6415c_probe(struct i2c_client *client, | |||
152 | 152 | ||
153 | v4l_info(client, "chip found @ 0x%x (%s)\n", | 153 | v4l_info(client, "chip found @ 0x%x (%s)\n", |
154 | client->addr << 1, client->adapter->name); | 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 | if (sd == NULL) | 156 | if (sd == NULL) |
157 | return -ENOMEM; | 157 | return -ENOMEM; |
158 | v4l2_i2c_subdev_init(sd, client, &tea6415c_ops); | 158 | v4l2_i2c_subdev_init(sd, client, &tea6415c_ops); |
diff --git a/drivers/media/video/tea6420.c b/drivers/media/video/tea6420.c index 5ea840401f21..f350b6c24500 100644 --- a/drivers/media/video/tea6420.c +++ b/drivers/media/video/tea6420.c | |||
@@ -125,7 +125,7 @@ static int tea6420_probe(struct i2c_client *client, | |||
125 | v4l_info(client, "chip found @ 0x%x (%s)\n", | 125 | v4l_info(client, "chip found @ 0x%x (%s)\n", |
126 | client->addr << 1, client->adapter->name); | 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 | if (sd == NULL) | 129 | if (sd == NULL) |
130 | return -ENOMEM; | 130 | return -ENOMEM; |
131 | v4l2_i2c_subdev_init(sd, client, &tea6420_ops); | 131 | v4l2_i2c_subdev_init(sd, client, &tea6420_ops); |
diff --git a/drivers/media/video/upd64031a.c b/drivers/media/video/upd64031a.c index f8138c75be8b..1aab96a88203 100644 --- a/drivers/media/video/upd64031a.c +++ b/drivers/media/video/upd64031a.c | |||
@@ -230,7 +230,7 @@ static int upd64031a_probe(struct i2c_client *client, | |||
230 | v4l_info(client, "chip found @ 0x%x (%s)\n", | 230 | v4l_info(client, "chip found @ 0x%x (%s)\n", |
231 | client->addr << 1, client->adapter->name); | 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 | if (state == NULL) | 234 | if (state == NULL) |
235 | return -ENOMEM; | 235 | return -ENOMEM; |
236 | sd = &state->sd; | 236 | sd = &state->sd; |
diff --git a/drivers/media/video/upd64083.c b/drivers/media/video/upd64083.c index 28e0e6b6ca84..9bbe61700fd5 100644 --- a/drivers/media/video/upd64083.c +++ b/drivers/media/video/upd64083.c | |||
@@ -202,7 +202,7 @@ static int upd64083_probe(struct i2c_client *client, | |||
202 | v4l_info(client, "chip found @ 0x%x (%s)\n", | 202 | v4l_info(client, "chip found @ 0x%x (%s)\n", |
203 | client->addr << 1, client->adapter->name); | 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 | if (state == NULL) | 206 | if (state == NULL) |
207 | return -ENOMEM; | 207 | return -ENOMEM; |
208 | sd = &state->sd; | 208 | sd = &state->sd; |
diff --git a/drivers/mfd/omap-usb-host.c b/drivers/mfd/omap-usb-host.c index 53450f433f10..2e165117457b 100644 --- a/drivers/mfd/omap-usb-host.c +++ b/drivers/mfd/omap-usb-host.c | |||
@@ -25,7 +25,6 @@ | |||
25 | #include <linux/dma-mapping.h> | 25 | #include <linux/dma-mapping.h> |
26 | #include <linux/spinlock.h> | 26 | #include <linux/spinlock.h> |
27 | #include <linux/gpio.h> | 27 | #include <linux/gpio.h> |
28 | #include <linux/regulator/consumer.h> | ||
29 | #include <plat/usb.h> | 28 | #include <plat/usb.h> |
30 | 29 | ||
31 | #define USBHS_DRIVER_NAME "usbhs-omap" | 30 | #define USBHS_DRIVER_NAME "usbhs-omap" |
@@ -700,8 +699,7 @@ static int usbhs_enable(struct device *dev) | |||
700 | dev_dbg(dev, "starting TI HSUSB Controller\n"); | 699 | dev_dbg(dev, "starting TI HSUSB Controller\n"); |
701 | if (!pdata) { | 700 | if (!pdata) { |
702 | dev_dbg(dev, "missing platform_data\n"); | 701 | dev_dbg(dev, "missing platform_data\n"); |
703 | ret = -ENODEV; | 702 | return -ENODEV; |
704 | goto end_enable; | ||
705 | } | 703 | } |
706 | 704 | ||
707 | spin_lock_irqsave(&omap->lock, flags); | 705 | spin_lock_irqsave(&omap->lock, flags); |
@@ -915,7 +913,8 @@ static int usbhs_enable(struct device *dev) | |||
915 | 913 | ||
916 | end_count: | 914 | end_count: |
917 | omap->count++; | 915 | omap->count++; |
918 | goto end_enable; | 916 | spin_unlock_irqrestore(&omap->lock, flags); |
917 | return 0; | ||
919 | 918 | ||
920 | err_tll: | 919 | err_tll: |
921 | if (pdata->ehci_data->phy_reset) { | 920 | if (pdata->ehci_data->phy_reset) { |
@@ -931,8 +930,6 @@ err_tll: | |||
931 | clk_disable(omap->usbhost_fs_fck); | 930 | clk_disable(omap->usbhost_fs_fck); |
932 | clk_disable(omap->usbhost_hs_fck); | 931 | clk_disable(omap->usbhost_hs_fck); |
933 | clk_disable(omap->usbhost_ick); | 932 | clk_disable(omap->usbhost_ick); |
934 | |||
935 | end_enable: | ||
936 | spin_unlock_irqrestore(&omap->lock, flags); | 933 | spin_unlock_irqrestore(&omap->lock, flags); |
937 | return ret; | 934 | return ret; |
938 | } | 935 | } |
diff --git a/drivers/platform/x86/eeepc-laptop.c b/drivers/platform/x86/eeepc-laptop.c index 5f2dd386152b..2c1abf63957f 100644 --- a/drivers/platform/x86/eeepc-laptop.c +++ b/drivers/platform/x86/eeepc-laptop.c | |||
@@ -585,8 +585,9 @@ static bool eeepc_wlan_rfkill_blocked(struct eeepc_laptop *eeepc) | |||
585 | return true; | 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 | struct pci_dev *dev; | 591 | struct pci_dev *dev; |
591 | struct pci_bus *bus; | 592 | struct pci_bus *bus; |
592 | bool blocked = eeepc_wlan_rfkill_blocked(eeepc); | 593 | bool blocked = eeepc_wlan_rfkill_blocked(eeepc); |
@@ -599,9 +600,16 @@ static void eeepc_rfkill_hotplug(struct eeepc_laptop *eeepc) | |||
599 | mutex_lock(&eeepc->hotplug_lock); | 600 | mutex_lock(&eeepc->hotplug_lock); |
600 | 601 | ||
601 | if (eeepc->hotplug_slot) { | 602 | if (eeepc->hotplug_slot) { |
602 | bus = pci_find_bus(0, 1); | 603 | port = acpi_get_pci_dev(handle); |
604 | if (!port) { | ||
605 | pr_warning("Unable to find port\n"); | ||
606 | goto out_unlock; | ||
607 | } | ||
608 | |||
609 | bus = port->subordinate; | ||
610 | |||
603 | if (!bus) { | 611 | if (!bus) { |
604 | pr_warning("Unable to find PCI bus 1?\n"); | 612 | pr_warning("Unable to find PCI bus?\n"); |
605 | goto out_unlock; | 613 | goto out_unlock; |
606 | } | 614 | } |
607 | 615 | ||
@@ -609,6 +617,7 @@ static void eeepc_rfkill_hotplug(struct eeepc_laptop *eeepc) | |||
609 | pr_err("Unable to read PCI config space?\n"); | 617 | pr_err("Unable to read PCI config space?\n"); |
610 | goto out_unlock; | 618 | goto out_unlock; |
611 | } | 619 | } |
620 | |||
612 | absent = (l == 0xffffffff); | 621 | absent = (l == 0xffffffff); |
613 | 622 | ||
614 | if (blocked != absent) { | 623 | if (blocked != absent) { |
@@ -647,6 +656,17 @@ out_unlock: | |||
647 | mutex_unlock(&eeepc->hotplug_lock); | 656 | mutex_unlock(&eeepc->hotplug_lock); |
648 | } | 657 | } |
649 | 658 | ||
659 | static void eeepc_rfkill_hotplug_update(struct eeepc_laptop *eeepc, char *node) | ||
660 | { | ||
661 | acpi_status status = AE_OK; | ||
662 | acpi_handle handle; | ||
663 | |||
664 | status = acpi_get_handle(NULL, node, &handle); | ||
665 | |||
666 | if (ACPI_SUCCESS(status)) | ||
667 | eeepc_rfkill_hotplug(eeepc, handle); | ||
668 | } | ||
669 | |||
650 | static void eeepc_rfkill_notify(acpi_handle handle, u32 event, void *data) | 670 | static void eeepc_rfkill_notify(acpi_handle handle, u32 event, void *data) |
651 | { | 671 | { |
652 | struct eeepc_laptop *eeepc = data; | 672 | struct eeepc_laptop *eeepc = data; |
@@ -654,7 +674,7 @@ static void eeepc_rfkill_notify(acpi_handle handle, u32 event, void *data) | |||
654 | if (event != ACPI_NOTIFY_BUS_CHECK) | 674 | if (event != ACPI_NOTIFY_BUS_CHECK) |
655 | return; | 675 | return; |
656 | 676 | ||
657 | eeepc_rfkill_hotplug(eeepc); | 677 | eeepc_rfkill_hotplug(eeepc, handle); |
658 | } | 678 | } |
659 | 679 | ||
660 | static int eeepc_register_rfkill_notifier(struct eeepc_laptop *eeepc, | 680 | static int eeepc_register_rfkill_notifier(struct eeepc_laptop *eeepc, |
@@ -672,6 +692,11 @@ static int eeepc_register_rfkill_notifier(struct eeepc_laptop *eeepc, | |||
672 | eeepc); | 692 | eeepc); |
673 | if (ACPI_FAILURE(status)) | 693 | if (ACPI_FAILURE(status)) |
674 | pr_warning("Failed to register notify on %s\n", node); | 694 | pr_warning("Failed to register notify on %s\n", node); |
695 | /* | ||
696 | * Refresh pci hotplug in case the rfkill state was | ||
697 | * changed during setup. | ||
698 | */ | ||
699 | eeepc_rfkill_hotplug(eeepc, handle); | ||
675 | } else | 700 | } else |
676 | return -ENODEV; | 701 | return -ENODEV; |
677 | 702 | ||
@@ -693,6 +718,12 @@ static void eeepc_unregister_rfkill_notifier(struct eeepc_laptop *eeepc, | |||
693 | if (ACPI_FAILURE(status)) | 718 | if (ACPI_FAILURE(status)) |
694 | pr_err("Error removing rfkill notify handler %s\n", | 719 | pr_err("Error removing rfkill notify handler %s\n", |
695 | node); | 720 | node); |
721 | /* | ||
722 | * Refresh pci hotplug in case the rfkill | ||
723 | * state was changed after | ||
724 | * eeepc_unregister_rfkill_notifier() | ||
725 | */ | ||
726 | eeepc_rfkill_hotplug(eeepc, handle); | ||
696 | } | 727 | } |
697 | } | 728 | } |
698 | 729 | ||
@@ -816,11 +847,7 @@ static void eeepc_rfkill_exit(struct eeepc_laptop *eeepc) | |||
816 | rfkill_destroy(eeepc->wlan_rfkill); | 847 | rfkill_destroy(eeepc->wlan_rfkill); |
817 | eeepc->wlan_rfkill = NULL; | 848 | eeepc->wlan_rfkill = NULL; |
818 | } | 849 | } |
819 | /* | 850 | |
820 | * Refresh pci hotplug in case the rfkill state was changed after | ||
821 | * eeepc_unregister_rfkill_notifier() | ||
822 | */ | ||
823 | eeepc_rfkill_hotplug(eeepc); | ||
824 | if (eeepc->hotplug_slot) | 851 | if (eeepc->hotplug_slot) |
825 | pci_hp_deregister(eeepc->hotplug_slot); | 852 | pci_hp_deregister(eeepc->hotplug_slot); |
826 | 853 | ||
@@ -889,11 +916,6 @@ static int eeepc_rfkill_init(struct eeepc_laptop *eeepc) | |||
889 | eeepc_register_rfkill_notifier(eeepc, "\\_SB.PCI0.P0P5"); | 916 | eeepc_register_rfkill_notifier(eeepc, "\\_SB.PCI0.P0P5"); |
890 | eeepc_register_rfkill_notifier(eeepc, "\\_SB.PCI0.P0P6"); | 917 | eeepc_register_rfkill_notifier(eeepc, "\\_SB.PCI0.P0P6"); |
891 | eeepc_register_rfkill_notifier(eeepc, "\\_SB.PCI0.P0P7"); | 918 | eeepc_register_rfkill_notifier(eeepc, "\\_SB.PCI0.P0P7"); |
892 | /* | ||
893 | * Refresh pci hotplug in case the rfkill state was changed during | ||
894 | * setup. | ||
895 | */ | ||
896 | eeepc_rfkill_hotplug(eeepc); | ||
897 | 919 | ||
898 | exit: | 920 | exit: |
899 | if (result && result != -ENODEV) | 921 | if (result && result != -ENODEV) |
@@ -928,8 +950,11 @@ static int eeepc_hotk_restore(struct device *device) | |||
928 | struct eeepc_laptop *eeepc = dev_get_drvdata(device); | 950 | struct eeepc_laptop *eeepc = dev_get_drvdata(device); |
929 | 951 | ||
930 | /* Refresh both wlan rfkill state and pci hotplug */ | 952 | /* Refresh both wlan rfkill state and pci hotplug */ |
931 | if (eeepc->wlan_rfkill) | 953 | if (eeepc->wlan_rfkill) { |
932 | eeepc_rfkill_hotplug(eeepc); | 954 | eeepc_rfkill_hotplug_update(eeepc, "\\_SB.PCI0.P0P5"); |
955 | eeepc_rfkill_hotplug_update(eeepc, "\\_SB.PCI0.P0P6"); | ||
956 | eeepc_rfkill_hotplug_update(eeepc, "\\_SB.PCI0.P0P7"); | ||
957 | } | ||
933 | 958 | ||
934 | if (eeepc->bluetooth_rfkill) | 959 | if (eeepc->bluetooth_rfkill) |
935 | rfkill_set_sw_state(eeepc->bluetooth_rfkill, | 960 | rfkill_set_sw_state(eeepc->bluetooth_rfkill, |
diff --git a/drivers/platform/x86/sony-laptop.c b/drivers/platform/x86/sony-laptop.c index 8f709aec4da0..6fe8cd6e23b5 100644 --- a/drivers/platform/x86/sony-laptop.c +++ b/drivers/platform/x86/sony-laptop.c | |||
@@ -934,6 +934,14 @@ static ssize_t sony_nc_sysfs_store(struct device *dev, | |||
934 | /* | 934 | /* |
935 | * Backlight device | 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 | static int sony_backlight_update_status(struct backlight_device *bd) | 945 | static int sony_backlight_update_status(struct backlight_device *bd) |
938 | { | 946 | { |
939 | return acpi_callsetfunc(sony_nc_acpi_handle, "SBRT", | 947 | return acpi_callsetfunc(sony_nc_acpi_handle, "SBRT", |
@@ -954,21 +962,26 @@ static int sony_nc_get_brightness_ng(struct backlight_device *bd) | |||
954 | { | 962 | { |
955 | int result; | 963 | int result; |
956 | int *handle = (int *)bl_get_data(bd); | 964 | int *handle = (int *)bl_get_data(bd); |
965 | struct sony_backlight_props *sdev = | ||
966 | (struct sony_backlight_props *)bl_get_data(bd); | ||
957 | 967 | ||
958 | sony_call_snc_handle(*handle, 0x0200, &result); | 968 | sony_call_snc_handle(sdev->handle, 0x0200, &result); |
959 | 969 | ||
960 | return result & 0xff; | 970 | return (result & 0xff) - sdev->offset; |
961 | } | 971 | } |
962 | 972 | ||
963 | static int sony_nc_update_status_ng(struct backlight_device *bd) | 973 | static int sony_nc_update_status_ng(struct backlight_device *bd) |
964 | { | 974 | { |
965 | int value, result; | 975 | int value, result; |
966 | int *handle = (int *)bl_get_data(bd); | 976 | int *handle = (int *)bl_get_data(bd); |
977 | struct sony_backlight_props *sdev = | ||
978 | (struct sony_backlight_props *)bl_get_data(bd); | ||
967 | 979 | ||
968 | value = bd->props.brightness; | 980 | value = bd->props.brightness + sdev->offset; |
969 | sony_call_snc_handle(*handle, 0x0100 | (value << 16), &result); | 981 | if (sony_call_snc_handle(sdev->handle, 0x0100 | (value << 16), &result)) |
982 | return -EIO; | ||
970 | 983 | ||
971 | return sony_nc_get_brightness_ng(bd); | 984 | return value; |
972 | } | 985 | } |
973 | 986 | ||
974 | static const struct backlight_ops sony_backlight_ops = { | 987 | static const struct backlight_ops sony_backlight_ops = { |
@@ -981,8 +994,6 @@ static const struct backlight_ops sony_backlight_ng_ops = { | |||
981 | .update_status = sony_nc_update_status_ng, | 994 | .update_status = sony_nc_update_status_ng, |
982 | .get_brightness = sony_nc_get_brightness_ng, | 995 | .get_brightness = sony_nc_get_brightness_ng, |
983 | }; | 996 | }; |
984 | static int backlight_ng_handle; | ||
985 | static struct backlight_device *sony_backlight_device; | ||
986 | 997 | ||
987 | /* | 998 | /* |
988 | * New SNC-only Vaios event mapping to driver known keys | 999 | * New SNC-only Vaios event mapping to driver known keys |
@@ -1549,6 +1560,75 @@ static void sony_nc_kbd_backlight_resume(void) | |||
1549 | &ignore); | 1560 | &ignore); |
1550 | } | 1561 | } |
1551 | 1562 | ||
1563 | static void sony_nc_backlight_ng_read_limits(int handle, | ||
1564 | struct sony_backlight_props *props) | ||
1565 | { | ||
1566 | int offset; | ||
1567 | acpi_status status; | ||
1568 | u8 brlvl, i; | ||
1569 | u8 min = 0xff, max = 0x00; | ||
1570 | struct acpi_object_list params; | ||
1571 | union acpi_object in_obj; | ||
1572 | union acpi_object *lvl_enum; | ||
1573 | struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL }; | ||
1574 | |||
1575 | props->handle = handle; | ||
1576 | props->offset = 0; | ||
1577 | props->maxlvl = 0xff; | ||
1578 | |||
1579 | offset = sony_find_snc_handle(handle); | ||
1580 | if (offset < 0) | ||
1581 | return; | ||
1582 | |||
1583 | /* try to read the boundaries from ACPI tables, if we fail the above | ||
1584 | * defaults should be reasonable | ||
1585 | */ | ||
1586 | params.count = 1; | ||
1587 | params.pointer = &in_obj; | ||
1588 | in_obj.type = ACPI_TYPE_INTEGER; | ||
1589 | in_obj.integer.value = offset; | ||
1590 | status = acpi_evaluate_object(sony_nc_acpi_handle, "SN06", ¶ms, | ||
1591 | &buffer); | ||
1592 | if (ACPI_FAILURE(status)) | ||
1593 | return; | ||
1594 | |||
1595 | lvl_enum = (union acpi_object *) buffer.pointer; | ||
1596 | if (!lvl_enum) { | ||
1597 | pr_err("No SN06 return object."); | ||
1598 | return; | ||
1599 | } | ||
1600 | if (lvl_enum->type != ACPI_TYPE_BUFFER) { | ||
1601 | pr_err("Invalid SN06 return object 0x%.2x\n", | ||
1602 | lvl_enum->type); | ||
1603 | goto out_invalid; | ||
1604 | } | ||
1605 | |||
1606 | /* the buffer lists brightness levels available, brightness levels are | ||
1607 | * from 0 to 8 in the array, other values are used by ALS control. | ||
1608 | */ | ||
1609 | for (i = 0; i < 9 && i < lvl_enum->buffer.length; i++) { | ||
1610 | |||
1611 | brlvl = *(lvl_enum->buffer.pointer + i); | ||
1612 | dprintk("Brightness level: %d\n", brlvl); | ||
1613 | |||
1614 | if (!brlvl) | ||
1615 | break; | ||
1616 | |||
1617 | if (brlvl > max) | ||
1618 | max = brlvl; | ||
1619 | if (brlvl < min) | ||
1620 | min = brlvl; | ||
1621 | } | ||
1622 | props->offset = min; | ||
1623 | props->maxlvl = max; | ||
1624 | dprintk("Brightness levels: min=%d max=%d\n", props->offset, | ||
1625 | props->maxlvl); | ||
1626 | |||
1627 | out_invalid: | ||
1628 | kfree(buffer.pointer); | ||
1629 | return; | ||
1630 | } | ||
1631 | |||
1552 | static void sony_nc_backlight_setup(void) | 1632 | static void sony_nc_backlight_setup(void) |
1553 | { | 1633 | { |
1554 | acpi_handle unused; | 1634 | acpi_handle unused; |
@@ -1557,14 +1637,14 @@ static void sony_nc_backlight_setup(void) | |||
1557 | struct backlight_properties props; | 1637 | struct backlight_properties props; |
1558 | 1638 | ||
1559 | if (sony_find_snc_handle(0x12f) != -1) { | 1639 | if (sony_find_snc_handle(0x12f) != -1) { |
1560 | backlight_ng_handle = 0x12f; | ||
1561 | ops = &sony_backlight_ng_ops; | 1640 | ops = &sony_backlight_ng_ops; |
1562 | max_brightness = 0xff; | 1641 | sony_nc_backlight_ng_read_limits(0x12f, &sony_bl_props); |
1642 | max_brightness = sony_bl_props.maxlvl - sony_bl_props.offset; | ||
1563 | 1643 | ||
1564 | } else if (sony_find_snc_handle(0x137) != -1) { | 1644 | } else if (sony_find_snc_handle(0x137) != -1) { |
1565 | backlight_ng_handle = 0x137; | ||
1566 | ops = &sony_backlight_ng_ops; | 1645 | ops = &sony_backlight_ng_ops; |
1567 | max_brightness = 0xff; | 1646 | sony_nc_backlight_ng_read_limits(0x137, &sony_bl_props); |
1647 | max_brightness = sony_bl_props.maxlvl - sony_bl_props.offset; | ||
1568 | 1648 | ||
1569 | } else if (ACPI_SUCCESS(acpi_get_handle(sony_nc_acpi_handle, "GBRT", | 1649 | } else if (ACPI_SUCCESS(acpi_get_handle(sony_nc_acpi_handle, "GBRT", |
1570 | &unused))) { | 1650 | &unused))) { |
@@ -1577,22 +1657,22 @@ static void sony_nc_backlight_setup(void) | |||
1577 | memset(&props, 0, sizeof(struct backlight_properties)); | 1657 | memset(&props, 0, sizeof(struct backlight_properties)); |
1578 | props.type = BACKLIGHT_PLATFORM; | 1658 | props.type = BACKLIGHT_PLATFORM; |
1579 | props.max_brightness = max_brightness; | 1659 | props.max_brightness = max_brightness; |
1580 | sony_backlight_device = backlight_device_register("sony", NULL, | 1660 | sony_bl_props.dev = backlight_device_register("sony", NULL, |
1581 | &backlight_ng_handle, | 1661 | &sony_bl_props, |
1582 | ops, &props); | 1662 | ops, &props); |
1583 | 1663 | ||
1584 | if (IS_ERR(sony_backlight_device)) { | 1664 | if (IS_ERR(sony_bl_props.dev)) { |
1585 | pr_warning(DRV_PFX "unable to register backlight device\n"); | 1665 | pr_warn(DRV_PFX "unable to register backlight device\n"); |
1586 | sony_backlight_device = NULL; | 1666 | sony_bl_props.dev = NULL; |
1587 | } else | 1667 | } else |
1588 | sony_backlight_device->props.brightness = | 1668 | sony_bl_props.dev->props.brightness = |
1589 | ops->get_brightness(sony_backlight_device); | 1669 | ops->get_brightness(sony_bl_props.dev); |
1590 | } | 1670 | } |
1591 | 1671 | ||
1592 | static void sony_nc_backlight_cleanup(void) | 1672 | static void sony_nc_backlight_cleanup(void) |
1593 | { | 1673 | { |
1594 | if (sony_backlight_device) | 1674 | if (sony_bl_props.dev) |
1595 | backlight_device_unregister(sony_backlight_device); | 1675 | backlight_device_unregister(sony_bl_props.dev); |
1596 | } | 1676 | } |
1597 | 1677 | ||
1598 | static int sony_nc_add(struct acpi_device *device) | 1678 | static int sony_nc_add(struct acpi_device *device) |
@@ -2590,7 +2670,7 @@ static long sonypi_misc_ioctl(struct file *fp, unsigned int cmd, | |||
2590 | mutex_lock(&spic_dev.lock); | 2670 | mutex_lock(&spic_dev.lock); |
2591 | switch (cmd) { | 2671 | switch (cmd) { |
2592 | case SONYPI_IOCGBRT: | 2672 | case SONYPI_IOCGBRT: |
2593 | if (sony_backlight_device == NULL) { | 2673 | if (sony_bl_props.dev == NULL) { |
2594 | ret = -EIO; | 2674 | ret = -EIO; |
2595 | break; | 2675 | break; |
2596 | } | 2676 | } |
@@ -2603,7 +2683,7 @@ static long sonypi_misc_ioctl(struct file *fp, unsigned int cmd, | |||
2603 | ret = -EFAULT; | 2683 | ret = -EFAULT; |
2604 | break; | 2684 | break; |
2605 | case SONYPI_IOCSBRT: | 2685 | case SONYPI_IOCSBRT: |
2606 | if (sony_backlight_device == NULL) { | 2686 | if (sony_bl_props.dev == NULL) { |
2607 | ret = -EIO; | 2687 | ret = -EIO; |
2608 | break; | 2688 | break; |
2609 | } | 2689 | } |
@@ -2617,8 +2697,8 @@ static long sonypi_misc_ioctl(struct file *fp, unsigned int cmd, | |||
2617 | break; | 2697 | break; |
2618 | } | 2698 | } |
2619 | /* sync the backlight device status */ | 2699 | /* sync the backlight device status */ |
2620 | sony_backlight_device->props.brightness = | 2700 | sony_bl_props.dev->props.brightness = |
2621 | sony_backlight_get_brightness(sony_backlight_device); | 2701 | sony_backlight_get_brightness(sony_bl_props.dev); |
2622 | break; | 2702 | break; |
2623 | case SONYPI_IOCGBAT1CAP: | 2703 | case SONYPI_IOCGBAT1CAP: |
2624 | if (ec_read16(SONYPI_BAT1_FULL, &val16)) { | 2704 | if (ec_read16(SONYPI_BAT1_FULL, &val16)) { |
diff --git a/drivers/platform/x86/thinkpad_acpi.c b/drivers/platform/x86/thinkpad_acpi.c index efb3b6b9bcdb..562fcf0dd2b5 100644 --- a/drivers/platform/x86/thinkpad_acpi.c +++ b/drivers/platform/x86/thinkpad_acpi.c | |||
@@ -128,7 +128,8 @@ enum { | |||
128 | }; | 128 | }; |
129 | 129 | ||
130 | /* ACPI HIDs */ | 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 | #define TPACPI_ACPI_EC_HID "PNP0C09" | 133 | #define TPACPI_ACPI_EC_HID "PNP0C09" |
133 | 134 | ||
134 | /* Input IDs */ | 135 | /* Input IDs */ |
@@ -3879,7 +3880,8 @@ errexit: | |||
3879 | } | 3880 | } |
3880 | 3881 | ||
3881 | static const struct acpi_device_id ibm_htk_device_ids[] = { | 3882 | static const struct acpi_device_id ibm_htk_device_ids[] = { |
3882 | {TPACPI_ACPI_HKEY_HID, 0}, | 3883 | {TPACPI_ACPI_IBM_HKEY_HID, 0}, |
3884 | {TPACPI_ACPI_LENOVO_HKEY_HID, 0}, | ||
3883 | {"", 0}, | 3885 | {"", 0}, |
3884 | }; | 3886 | }; |
3885 | 3887 | ||
diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c index e9901b8f8443..0bac91e72370 100644 --- a/drivers/scsi/scsi_lib.c +++ b/drivers/scsi/scsi_lib.c | |||
@@ -400,10 +400,15 @@ static inline int scsi_host_is_busy(struct Scsi_Host *shost) | |||
400 | static void scsi_run_queue(struct request_queue *q) | 400 | static void scsi_run_queue(struct request_queue *q) |
401 | { | 401 | { |
402 | struct scsi_device *sdev = q->queuedata; | 402 | struct scsi_device *sdev = q->queuedata; |
403 | struct Scsi_Host *shost = sdev->host; | 403 | struct Scsi_Host *shost; |
404 | LIST_HEAD(starved_list); | 404 | LIST_HEAD(starved_list); |
405 | unsigned long flags; | 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 | if (scsi_target(sdev)->single_lun) | 412 | if (scsi_target(sdev)->single_lun) |
408 | scsi_single_lun_run(sdev); | 413 | scsi_single_lun_run(sdev); |
409 | 414 | ||
diff --git a/drivers/staging/ft1000/ft1000-pcmcia/ft1000_hw.c b/drivers/staging/ft1000/ft1000-pcmcia/ft1000_hw.c index eeb7dd43f9a8..830822f86e41 100644 --- a/drivers/staging/ft1000/ft1000-pcmcia/ft1000_hw.c +++ b/drivers/staging/ft1000/ft1000-pcmcia/ft1000_hw.c | |||
@@ -2288,7 +2288,3 @@ err_dev: | |||
2288 | free_netdev(dev); | 2288 | free_netdev(dev); |
2289 | return NULL; | 2289 | return NULL; |
2290 | } | 2290 | } |
2291 | |||
2292 | EXPORT_SYMBOL(init_ft1000_card); | ||
2293 | EXPORT_SYMBOL(stop_ft1000_card); | ||
2294 | EXPORT_SYMBOL(flarion_ft1000_cnt); | ||
diff --git a/drivers/staging/ft1000/ft1000-pcmcia/ft1000_proc.c b/drivers/staging/ft1000/ft1000-pcmcia/ft1000_proc.c index 935608e72007..bdfb1aec58df 100644 --- a/drivers/staging/ft1000/ft1000-pcmcia/ft1000_proc.c +++ b/drivers/staging/ft1000/ft1000-pcmcia/ft1000_proc.c | |||
@@ -214,6 +214,3 @@ void ft1000CleanupProc(struct net_device *dev) | |||
214 | remove_proc_entry(FT1000_PROC, init_net.proc_net); | 214 | remove_proc_entry(FT1000_PROC, init_net.proc_net); |
215 | unregister_netdevice_notifier(&ft1000_netdev_notifier); | 215 | unregister_netdevice_notifier(&ft1000_netdev_notifier); |
216 | } | 216 | } |
217 | |||
218 | EXPORT_SYMBOL(ft1000InitProc); | ||
219 | EXPORT_SYMBOL(ft1000CleanupProc); | ||
diff --git a/drivers/staging/gma500/Kconfig b/drivers/staging/gma500/Kconfig index 5501eb9b3355..ce8bedaeaac2 100644 --- a/drivers/staging/gma500/Kconfig +++ b/drivers/staging/gma500/Kconfig | |||
@@ -1,6 +1,6 @@ | |||
1 | config DRM_PSB | 1 | config DRM_PSB |
2 | tristate "Intel GMA500 KMS Framebuffer" | 2 | tristate "Intel GMA500 KMS Framebuffer" |
3 | depends on DRM && PCI | 3 | depends on DRM && PCI && X86 |
4 | select FB_CFB_COPYAREA | 4 | select FB_CFB_COPYAREA |
5 | select FB_CFB_FILLRECT | 5 | select FB_CFB_FILLRECT |
6 | select FB_CFB_IMAGEBLIT | 6 | select FB_CFB_IMAGEBLIT |
diff --git a/drivers/staging/intel_sst/intelmid_v1_control.c b/drivers/staging/intel_sst/intelmid_v1_control.c index 9cc15c1c18d4..1ea814218059 100644 --- a/drivers/staging/intel_sst/intelmid_v1_control.c +++ b/drivers/staging/intel_sst/intelmid_v1_control.c | |||
@@ -28,6 +28,7 @@ | |||
28 | #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt | 28 | #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt |
29 | 29 | ||
30 | #include <linux/pci.h> | 30 | #include <linux/pci.h> |
31 | #include <linux/delay.h> | ||
31 | #include <linux/file.h> | 32 | #include <linux/file.h> |
32 | #include <asm/mrst.h> | 33 | #include <asm/mrst.h> |
33 | #include <sound/pcm.h> | 34 | #include <sound/pcm.h> |
diff --git a/drivers/staging/intel_sst/intelmid_v2_control.c b/drivers/staging/intel_sst/intelmid_v2_control.c index 26d815a67eb8..3c6b3abff3c3 100644 --- a/drivers/staging/intel_sst/intelmid_v2_control.c +++ b/drivers/staging/intel_sst/intelmid_v2_control.c | |||
@@ -29,6 +29,7 @@ | |||
29 | #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt | 29 | #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt |
30 | 30 | ||
31 | #include <linux/pci.h> | 31 | #include <linux/pci.h> |
32 | #include <linux/delay.h> | ||
32 | #include <linux/file.h> | 33 | #include <linux/file.h> |
33 | #include "intel_sst.h" | 34 | #include "intel_sst.h" |
34 | #include "intelmid_snd_control.h" | 35 | #include "intelmid_snd_control.h" |
diff --git a/drivers/staging/olpc_dcon/olpc_dcon_xo_1.c b/drivers/staging/olpc_dcon/olpc_dcon_xo_1.c index b5d21f6497f9..22c04eabed41 100644 --- a/drivers/staging/olpc_dcon/olpc_dcon_xo_1.c +++ b/drivers/staging/olpc_dcon/olpc_dcon_xo_1.c | |||
@@ -12,6 +12,7 @@ | |||
12 | */ | 12 | */ |
13 | #include <linux/cs5535.h> | 13 | #include <linux/cs5535.h> |
14 | #include <linux/gpio.h> | 14 | #include <linux/gpio.h> |
15 | #include <linux/delay.h> | ||
15 | #include <asm/olpc.h> | 16 | #include <asm/olpc.h> |
16 | 17 | ||
17 | #include "olpc_dcon.h" | 18 | #include "olpc_dcon.h" |
diff --git a/drivers/staging/rts_pstor/debug.h b/drivers/staging/rts_pstor/debug.h index e1408b0e7ae4..ab305be96fb5 100644 --- a/drivers/staging/rts_pstor/debug.h +++ b/drivers/staging/rts_pstor/debug.h | |||
@@ -28,7 +28,7 @@ | |||
28 | 28 | ||
29 | #define RTSX_STOR "rts_pstor: " | 29 | #define RTSX_STOR "rts_pstor: " |
30 | 30 | ||
31 | #if CONFIG_RTS_PSTOR_DEBUG | 31 | #ifdef CONFIG_RTS_PSTOR_DEBUG |
32 | #define RTSX_DEBUGP(x...) printk(KERN_DEBUG RTSX_STOR x) | 32 | #define RTSX_DEBUGP(x...) printk(KERN_DEBUG RTSX_STOR x) |
33 | #define RTSX_DEBUGPN(x...) printk(KERN_DEBUG x) | 33 | #define RTSX_DEBUGPN(x...) printk(KERN_DEBUG x) |
34 | #define RTSX_DEBUGPX(x...) printk(x) | 34 | #define RTSX_DEBUGPX(x...) printk(x) |
diff --git a/drivers/staging/rts_pstor/ms.c b/drivers/staging/rts_pstor/ms.c index 810e170894f5..d89795c6a3ac 100644 --- a/drivers/staging/rts_pstor/ms.c +++ b/drivers/staging/rts_pstor/ms.c | |||
@@ -23,6 +23,7 @@ | |||
23 | #include <linux/blkdev.h> | 23 | #include <linux/blkdev.h> |
24 | #include <linux/kthread.h> | 24 | #include <linux/kthread.h> |
25 | #include <linux/sched.h> | 25 | #include <linux/sched.h> |
26 | #include <linux/vmalloc.h> | ||
26 | 27 | ||
27 | #include "rtsx.h" | 28 | #include "rtsx.h" |
28 | #include "rtsx_transport.h" | 29 | #include "rtsx_transport.h" |
diff --git a/drivers/staging/rts_pstor/rtsx_chip.c b/drivers/staging/rts_pstor/rtsx_chip.c index d2f1c715a684..4e60780ea804 100644 --- a/drivers/staging/rts_pstor/rtsx_chip.c +++ b/drivers/staging/rts_pstor/rtsx_chip.c | |||
@@ -24,6 +24,7 @@ | |||
24 | #include <linux/kthread.h> | 24 | #include <linux/kthread.h> |
25 | #include <linux/sched.h> | 25 | #include <linux/sched.h> |
26 | #include <linux/workqueue.h> | 26 | #include <linux/workqueue.h> |
27 | #include <linux/vmalloc.h> | ||
27 | 28 | ||
28 | #include "rtsx.h" | 29 | #include "rtsx.h" |
29 | #include "rtsx_transport.h" | 30 | #include "rtsx_transport.h" |
@@ -1311,11 +1312,11 @@ void rtsx_polling_func(struct rtsx_chip *chip) | |||
1311 | 1312 | ||
1312 | #ifdef SUPPORT_OCP | 1313 | #ifdef SUPPORT_OCP |
1313 | if (CHECK_LUN_MODE(chip, SD_MS_2LUN)) { | 1314 | if (CHECK_LUN_MODE(chip, SD_MS_2LUN)) { |
1314 | #if CONFIG_RTS_PSTOR_DEBUG | 1315 | #ifdef CONFIG_RTS_PSTOR_DEBUG |
1315 | if (chip->ocp_stat & (SD_OC_NOW | SD_OC_EVER | MS_OC_NOW | MS_OC_EVER)) { | 1316 | if (chip->ocp_stat & (SD_OC_NOW | SD_OC_EVER | MS_OC_NOW | MS_OC_EVER)) { |
1316 | RTSX_DEBUGP("Over current, OCPSTAT is 0x%x\n", chip->ocp_stat); | 1317 | RTSX_DEBUGP("Over current, OCPSTAT is 0x%x\n", chip->ocp_stat); |
1317 | } | 1318 | } |
1318 | #endif | 1319 | #endif |
1319 | 1320 | ||
1320 | if (chip->ocp_stat & (SD_OC_NOW | SD_OC_EVER)) { | 1321 | if (chip->ocp_stat & (SD_OC_NOW | SD_OC_EVER)) { |
1321 | if (chip->card_exist & SD_CARD) { | 1322 | if (chip->card_exist & SD_CARD) { |
diff --git a/drivers/staging/rts_pstor/rtsx_scsi.c b/drivers/staging/rts_pstor/rtsx_scsi.c index 20c2464a20f9..7de1fae443fc 100644 --- a/drivers/staging/rts_pstor/rtsx_scsi.c +++ b/drivers/staging/rts_pstor/rtsx_scsi.c | |||
@@ -23,6 +23,7 @@ | |||
23 | #include <linux/blkdev.h> | 23 | #include <linux/blkdev.h> |
24 | #include <linux/kthread.h> | 24 | #include <linux/kthread.h> |
25 | #include <linux/sched.h> | 25 | #include <linux/sched.h> |
26 | #include <linux/vmalloc.h> | ||
26 | 27 | ||
27 | #include "rtsx.h" | 28 | #include "rtsx.h" |
28 | #include "rtsx_transport.h" | 29 | #include "rtsx_transport.h" |
diff --git a/drivers/staging/rts_pstor/sd.c b/drivers/staging/rts_pstor/sd.c index 8d066bd428c4..b1277a6c7a8b 100644 --- a/drivers/staging/rts_pstor/sd.c +++ b/drivers/staging/rts_pstor/sd.c | |||
@@ -909,7 +909,7 @@ static int sd_change_phase(struct rtsx_chip *chip, u8 sample_point, u8 tune_dir) | |||
909 | RTSX_WRITE_REG(chip, SD_VPCLK0_CTL, PHASE_NOT_RESET, PHASE_NOT_RESET); | 909 | RTSX_WRITE_REG(chip, SD_VPCLK0_CTL, PHASE_NOT_RESET, PHASE_NOT_RESET); |
910 | RTSX_WRITE_REG(chip, CLK_CTL, CHANGE_CLK, 0); | 910 | RTSX_WRITE_REG(chip, CLK_CTL, CHANGE_CLK, 0); |
911 | } else { | 911 | } else { |
912 | #if CONFIG_RTS_PSTOR_DEBUG | 912 | #ifdef CONFIG_RTS_PSTOR_DEBUG |
913 | rtsx_read_register(chip, SD_VP_CTL, &val); | 913 | rtsx_read_register(chip, SD_VP_CTL, &val); |
914 | RTSX_DEBUGP("SD_VP_CTL: 0x%x\n", val); | 914 | RTSX_DEBUGP("SD_VP_CTL: 0x%x\n", val); |
915 | rtsx_read_register(chip, SD_DCMPS_CTL, &val); | 915 | rtsx_read_register(chip, SD_DCMPS_CTL, &val); |
@@ -958,7 +958,7 @@ static int sd_change_phase(struct rtsx_chip *chip, u8 sample_point, u8 tune_dir) | |||
958 | return STATUS_SUCCESS; | 958 | return STATUS_SUCCESS; |
959 | 959 | ||
960 | Fail: | 960 | Fail: |
961 | #if CONFIG_RTS_PSTOR_DEBUG | 961 | #ifdef CONFIG_RTS_PSTOR_DEBUG |
962 | rtsx_read_register(chip, SD_VP_CTL, &val); | 962 | rtsx_read_register(chip, SD_VP_CTL, &val); |
963 | RTSX_DEBUGP("SD_VP_CTL: 0x%x\n", val); | 963 | RTSX_DEBUGP("SD_VP_CTL: 0x%x\n", val); |
964 | rtsx_read_register(chip, SD_DCMPS_CTL, &val); | 964 | rtsx_read_register(chip, SD_DCMPS_CTL, &val); |
diff --git a/drivers/staging/rts_pstor/trace.h b/drivers/staging/rts_pstor/trace.h index 2c668bae6ff4..bc83b49a4eb4 100644 --- a/drivers/staging/rts_pstor/trace.h +++ b/drivers/staging/rts_pstor/trace.h | |||
@@ -82,7 +82,7 @@ do { \ | |||
82 | #define TRACE_GOTO(chip, label) goto label | 82 | #define TRACE_GOTO(chip, label) goto label |
83 | #endif | 83 | #endif |
84 | 84 | ||
85 | #if CONFIG_RTS_PSTOR_DEBUG | 85 | #ifdef CONFIG_RTS_PSTOR_DEBUG |
86 | static inline void rtsx_dump(u8 *buf, int buf_len) | 86 | static inline void rtsx_dump(u8 *buf, int buf_len) |
87 | { | 87 | { |
88 | int i; | 88 | int i; |
diff --git a/drivers/staging/rts_pstor/xd.c b/drivers/staging/rts_pstor/xd.c index 7bcd468b8f2c..9f3add1e8f59 100644 --- a/drivers/staging/rts_pstor/xd.c +++ b/drivers/staging/rts_pstor/xd.c | |||
@@ -23,6 +23,7 @@ | |||
23 | #include <linux/blkdev.h> | 23 | #include <linux/blkdev.h> |
24 | #include <linux/kthread.h> | 24 | #include <linux/kthread.h> |
25 | #include <linux/sched.h> | 25 | #include <linux/sched.h> |
26 | #include <linux/vmalloc.h> | ||
26 | 27 | ||
27 | #include "rtsx.h" | 28 | #include "rtsx.h" |
28 | #include "rtsx_transport.h" | 29 | #include "rtsx_transport.h" |
diff --git a/drivers/staging/solo6x10/Kconfig b/drivers/staging/solo6x10/Kconfig index 2cf77c940860..03dcac4ea4d0 100644 --- a/drivers/staging/solo6x10/Kconfig +++ b/drivers/staging/solo6x10/Kconfig | |||
@@ -2,6 +2,7 @@ config SOLO6X10 | |||
2 | tristate "Softlogic 6x10 MPEG codec cards" | 2 | tristate "Softlogic 6x10 MPEG codec cards" |
3 | depends on PCI && VIDEO_DEV && SND && I2C | 3 | depends on PCI && VIDEO_DEV && SND && I2C |
4 | select VIDEOBUF_DMA_SG | 4 | select VIDEOBUF_DMA_SG |
5 | select SND_PCM | ||
5 | ---help--- | 6 | ---help--- |
6 | This driver supports the Softlogic based MPEG-4 and h.264 codec | 7 | This driver supports the Softlogic based MPEG-4 and h.264 codec |
7 | codec cards. | 8 | codec cards. |
diff --git a/drivers/staging/usbip/vhci_hcd.c b/drivers/staging/usbip/vhci_hcd.c index 0f02a4b12ae4..4f4f13321f40 100644 --- a/drivers/staging/usbip/vhci_hcd.c +++ b/drivers/staging/usbip/vhci_hcd.c | |||
@@ -876,8 +876,10 @@ static void vhci_shutdown_connection(struct usbip_device *ud) | |||
876 | } | 876 | } |
877 | 877 | ||
878 | /* kill threads related to this sdev, if v.c. exists */ | 878 | /* kill threads related to this sdev, if v.c. exists */ |
879 | kthread_stop(vdev->ud.tcp_rx); | 879 | if (vdev->ud.tcp_rx) |
880 | kthread_stop(vdev->ud.tcp_tx); | 880 | kthread_stop(vdev->ud.tcp_rx); |
881 | if (vdev->ud.tcp_tx) | ||
882 | kthread_stop(vdev->ud.tcp_tx); | ||
881 | 883 | ||
882 | usbip_uinfo("stop threads\n"); | 884 | usbip_uinfo("stop threads\n"); |
883 | 885 | ||
@@ -949,9 +951,6 @@ static void vhci_device_init(struct vhci_device *vdev) | |||
949 | { | 951 | { |
950 | memset(vdev, 0, sizeof(*vdev)); | 952 | memset(vdev, 0, sizeof(*vdev)); |
951 | 953 | ||
952 | vdev->ud.tcp_rx = kthread_create(vhci_rx_loop, &vdev->ud, "vhci_rx"); | ||
953 | vdev->ud.tcp_tx = kthread_create(vhci_tx_loop, &vdev->ud, "vhci_tx"); | ||
954 | |||
955 | vdev->ud.side = USBIP_VHCI; | 954 | vdev->ud.side = USBIP_VHCI; |
956 | vdev->ud.status = VDEV_ST_NULL; | 955 | vdev->ud.status = VDEV_ST_NULL; |
957 | /* vdev->ud.lock = SPIN_LOCK_UNLOCKED; */ | 956 | /* vdev->ud.lock = SPIN_LOCK_UNLOCKED; */ |
@@ -1139,7 +1138,7 @@ static int vhci_hcd_probe(struct platform_device *pdev) | |||
1139 | usbip_uerr("create hcd failed\n"); | 1138 | usbip_uerr("create hcd failed\n"); |
1140 | return -ENOMEM; | 1139 | return -ENOMEM; |
1141 | } | 1140 | } |
1142 | 1141 | hcd->has_tt = 1; | |
1143 | 1142 | ||
1144 | /* this is private data for vhci_hcd */ | 1143 | /* this is private data for vhci_hcd */ |
1145 | the_controller = hcd_to_vhci(hcd); | 1144 | the_controller = hcd_to_vhci(hcd); |
diff --git a/drivers/staging/usbip/vhci_sysfs.c b/drivers/staging/usbip/vhci_sysfs.c index 3f2459f30415..e2dadbd5ef1e 100644 --- a/drivers/staging/usbip/vhci_sysfs.c +++ b/drivers/staging/usbip/vhci_sysfs.c | |||
@@ -21,6 +21,7 @@ | |||
21 | #include "vhci.h" | 21 | #include "vhci.h" |
22 | 22 | ||
23 | #include <linux/in.h> | 23 | #include <linux/in.h> |
24 | #include <linux/kthread.h> | ||
24 | 25 | ||
25 | /* TODO: refine locking ?*/ | 26 | /* TODO: refine locking ?*/ |
26 | 27 | ||
@@ -220,13 +221,13 @@ static ssize_t store_attach(struct device *dev, struct device_attribute *attr, | |||
220 | vdev->ud.tcp_socket = socket; | 221 | vdev->ud.tcp_socket = socket; |
221 | vdev->ud.status = VDEV_ST_NOTASSIGNED; | 222 | vdev->ud.status = VDEV_ST_NOTASSIGNED; |
222 | 223 | ||
223 | wake_up_process(vdev->ud.tcp_rx); | ||
224 | wake_up_process(vdev->ud.tcp_tx); | ||
225 | |||
226 | spin_unlock(&vdev->ud.lock); | 224 | spin_unlock(&vdev->ud.lock); |
227 | spin_unlock(&the_controller->lock); | 225 | spin_unlock(&the_controller->lock); |
228 | /* end the lock */ | 226 | /* end the lock */ |
229 | 227 | ||
228 | vdev->ud.tcp_rx = kthread_run(vhci_rx_loop, &vdev->ud, "vhci_rx"); | ||
229 | vdev->ud.tcp_tx = kthread_run(vhci_tx_loop, &vdev->ud, "vhci_tx"); | ||
230 | |||
230 | rh_port_connect(rhport, speed); | 231 | rh_port_connect(rhport, speed); |
231 | 232 | ||
232 | return count; | 233 | return count; |
diff --git a/drivers/staging/wlan-ng/cfg80211.c b/drivers/staging/wlan-ng/cfg80211.c index 6a71f52c59b1..76378397b763 100644 --- a/drivers/staging/wlan-ng/cfg80211.c +++ b/drivers/staging/wlan-ng/cfg80211.c | |||
@@ -273,7 +273,7 @@ exit: | |||
273 | } | 273 | } |
274 | 274 | ||
275 | int prism2_set_default_key(struct wiphy *wiphy, struct net_device *dev, | 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 | wlandevice_t *wlandev = dev->ml_priv; | 278 | wlandevice_t *wlandev = dev->ml_priv; |
279 | 279 | ||
diff --git a/drivers/usb/host/ehci-omap.c b/drivers/usb/host/ehci-omap.c index 7e41a95c5ceb..627f3a678759 100644 --- a/drivers/usb/host/ehci-omap.c +++ b/drivers/usb/host/ehci-omap.c | |||
@@ -40,6 +40,7 @@ | |||
40 | #include <linux/slab.h> | 40 | #include <linux/slab.h> |
41 | #include <linux/usb/ulpi.h> | 41 | #include <linux/usb/ulpi.h> |
42 | #include <plat/usb.h> | 42 | #include <plat/usb.h> |
43 | #include <linux/regulator/consumer.h> | ||
43 | 44 | ||
44 | /* EHCI Register Set */ | 45 | /* EHCI Register Set */ |
45 | #define EHCI_INSNREG04 (0xA0) | 46 | #define EHCI_INSNREG04 (0xA0) |
@@ -118,6 +119,8 @@ static int ehci_hcd_omap_probe(struct platform_device *pdev) | |||
118 | struct ehci_hcd *omap_ehci; | 119 | struct ehci_hcd *omap_ehci; |
119 | int ret = -ENODEV; | 120 | int ret = -ENODEV; |
120 | int irq; | 121 | int irq; |
122 | int i; | ||
123 | char supply[7]; | ||
121 | 124 | ||
122 | if (usb_disabled()) | 125 | if (usb_disabled()) |
123 | return -ENODEV; | 126 | return -ENODEV; |
@@ -158,6 +161,23 @@ static int ehci_hcd_omap_probe(struct platform_device *pdev) | |||
158 | hcd->rsrc_len = resource_size(res); | 161 | hcd->rsrc_len = resource_size(res); |
159 | hcd->regs = regs; | 162 | hcd->regs = regs; |
160 | 163 | ||
164 | /* get ehci regulator and enable */ | ||
165 | for (i = 0 ; i < OMAP3_HS_USB_PORTS ; i++) { | ||
166 | if (pdata->port_mode[i] != OMAP_EHCI_PORT_MODE_PHY) { | ||
167 | pdata->regulator[i] = NULL; | ||
168 | continue; | ||
169 | } | ||
170 | snprintf(supply, sizeof(supply), "hsusb%d", i); | ||
171 | pdata->regulator[i] = regulator_get(dev, supply); | ||
172 | if (IS_ERR(pdata->regulator[i])) { | ||
173 | pdata->regulator[i] = NULL; | ||
174 | dev_dbg(dev, | ||
175 | "failed to get ehci port%d regulator\n", i); | ||
176 | } else { | ||
177 | regulator_enable(pdata->regulator[i]); | ||
178 | } | ||
179 | } | ||
180 | |||
161 | ret = omap_usbhs_enable(dev); | 181 | ret = omap_usbhs_enable(dev); |
162 | if (ret) { | 182 | if (ret) { |
163 | dev_err(dev, "failed to start usbhs with err %d\n", ret); | 183 | dev_err(dev, "failed to start usbhs with err %d\n", ret); |
diff --git a/drivers/usb/host/isp1760-hcd.c b/drivers/usb/host/isp1760-hcd.c index 795345ad45e6..7b2e69aa2e98 100644 --- a/drivers/usb/host/isp1760-hcd.c +++ b/drivers/usb/host/isp1760-hcd.c | |||
@@ -1633,6 +1633,7 @@ static int isp1760_urb_dequeue(struct usb_hcd *hcd, struct urb *urb, int status) | |||
1633 | ints[i].qh = NULL; | 1633 | ints[i].qh = NULL; |
1634 | ints[i].qtd = NULL; | 1634 | ints[i].qtd = NULL; |
1635 | 1635 | ||
1636 | urb->status = status; | ||
1636 | isp1760_urb_done(hcd, urb); | 1637 | isp1760_urb_done(hcd, urb); |
1637 | if (qtd) | 1638 | if (qtd) |
1638 | pe(hcd, qh, qtd); | 1639 | pe(hcd, qh, qtd); |
diff --git a/drivers/usb/host/xhci-hub.c b/drivers/usb/host/xhci-hub.c index a78f2ebd11b7..73f75d26436c 100644 --- a/drivers/usb/host/xhci-hub.c +++ b/drivers/usb/host/xhci-hub.c | |||
@@ -777,7 +777,7 @@ int xhci_bus_suspend(struct usb_hcd *hcd) | |||
777 | if (t1 != t2) | 777 | if (t1 != t2) |
778 | xhci_writel(xhci, t2, port_array[port_index]); | 778 | xhci_writel(xhci, t2, port_array[port_index]); |
779 | 779 | ||
780 | if (DEV_HIGHSPEED(t1)) { | 780 | if (hcd->speed != HCD_USB3) { |
781 | /* enable remote wake up for USB 2.0 */ | 781 | /* enable remote wake up for USB 2.0 */ |
782 | u32 __iomem *addr; | 782 | u32 __iomem *addr; |
783 | u32 tmp; | 783 | u32 tmp; |
@@ -866,6 +866,21 @@ int xhci_bus_resume(struct usb_hcd *hcd) | |||
866 | temp |= PORT_LINK_STROBE | XDEV_U0; | 866 | temp |= PORT_LINK_STROBE | XDEV_U0; |
867 | xhci_writel(xhci, temp, port_array[port_index]); | 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 | slot_id = xhci_find_slot_id_by_port(hcd, | 884 | slot_id = xhci_find_slot_id_by_port(hcd, |
870 | xhci, port_index + 1); | 885 | xhci, port_index + 1); |
871 | if (slot_id) | 886 | if (slot_id) |
@@ -873,7 +888,7 @@ int xhci_bus_resume(struct usb_hcd *hcd) | |||
873 | } else | 888 | } else |
874 | xhci_writel(xhci, temp, port_array[port_index]); | 889 | xhci_writel(xhci, temp, port_array[port_index]); |
875 | 890 | ||
876 | if (DEV_HIGHSPEED(temp)) { | 891 | if (hcd->speed != HCD_USB3) { |
877 | /* disable remote wake up for USB 2.0 */ | 892 | /* disable remote wake up for USB 2.0 */ |
878 | u32 __iomem *addr; | 893 | u32 __iomem *addr; |
879 | u32 tmp; | 894 | u32 tmp; |
diff --git a/drivers/usb/musb/musb_gadget.c b/drivers/usb/musb/musb_gadget.c index 6dfbf9ffd7a6..f47c20197c61 100644 --- a/drivers/usb/musb/musb_gadget.c +++ b/drivers/usb/musb/musb_gadget.c | |||
@@ -1887,11 +1887,9 @@ int usb_gadget_probe_driver(struct usb_gadget_driver *driver, | |||
1887 | otg_set_vbus(musb->xceiv, 1); | 1887 | otg_set_vbus(musb->xceiv, 1); |
1888 | 1888 | ||
1889 | hcd->self.uses_pio_for_control = 1; | 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 | return 0; | 1894 | return 0; |
1897 | 1895 | ||
diff --git a/drivers/usb/musb/omap2430.c b/drivers/usb/musb/omap2430.c index 57a27fa954b4..e9e60b6e0583 100644 --- a/drivers/usb/musb/omap2430.c +++ b/drivers/usb/musb/omap2430.c | |||
@@ -270,7 +270,7 @@ static int musb_otg_notifications(struct notifier_block *nb, | |||
270 | DBG(4, "VBUS Disconnect\n"); | 270 | DBG(4, "VBUS Disconnect\n"); |
271 | 271 | ||
272 | #ifdef CONFIG_USB_GADGET_MUSB_HDRC | 272 | #ifdef CONFIG_USB_GADGET_MUSB_HDRC |
273 | if (is_otg_enabled(musb)) | 273 | if (is_otg_enabled(musb) || is_peripheral_enabled(musb)) |
274 | if (musb->gadget_driver) | 274 | if (musb->gadget_driver) |
275 | #endif | 275 | #endif |
276 | { | 276 | { |
diff --git a/fs/ceph/addr.c b/fs/ceph/addr.c index e159c529fd2b..38b8ab554924 100644 --- a/fs/ceph/addr.c +++ b/fs/ceph/addr.c | |||
@@ -775,6 +775,13 @@ get_more_pages: | |||
775 | ci->i_truncate_seq, | 775 | ci->i_truncate_seq, |
776 | ci->i_truncate_size, | 776 | ci->i_truncate_size, |
777 | &inode->i_mtime, true, 1, 0); | 777 | &inode->i_mtime, true, 1, 0); |
778 | |||
779 | if (!req) { | ||
780 | rc = -ENOMEM; | ||
781 | unlock_page(page); | ||
782 | break; | ||
783 | } | ||
784 | |||
778 | max_pages = req->r_num_pages; | 785 | max_pages = req->r_num_pages; |
779 | 786 | ||
780 | alloc_page_vec(fsc, req); | 787 | alloc_page_vec(fsc, req); |
diff --git a/fs/ceph/caps.c b/fs/ceph/caps.c index 5323c330bbf3..9fa08662a88d 100644 --- a/fs/ceph/caps.c +++ b/fs/ceph/caps.c | |||
@@ -1331,10 +1331,11 @@ static void ceph_flush_snaps(struct ceph_inode_info *ci) | |||
1331 | } | 1331 | } |
1332 | 1332 | ||
1333 | /* | 1333 | /* |
1334 | * Mark caps dirty. If inode is newly dirty, add to the global dirty | 1334 | * Mark caps dirty. If inode is newly dirty, return the dirty flags. |
1335 | * list. | 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 | struct ceph_mds_client *mdsc = | 1340 | struct ceph_mds_client *mdsc = |
1340 | ceph_sb_to_client(ci->vfs_inode.i_sb)->mdsc; | 1341 | ceph_sb_to_client(ci->vfs_inode.i_sb)->mdsc; |
@@ -1357,7 +1358,7 @@ void __ceph_mark_dirty_caps(struct ceph_inode_info *ci, int mask) | |||
1357 | list_add(&ci->i_dirty_item, &mdsc->cap_dirty); | 1358 | list_add(&ci->i_dirty_item, &mdsc->cap_dirty); |
1358 | spin_unlock(&mdsc->cap_dirty_lock); | 1359 | spin_unlock(&mdsc->cap_dirty_lock); |
1359 | if (ci->i_flushing_caps == 0) { | 1360 | if (ci->i_flushing_caps == 0) { |
1360 | igrab(inode); | 1361 | ihold(inode); |
1361 | dirty |= I_DIRTY_SYNC; | 1362 | dirty |= I_DIRTY_SYNC; |
1362 | } | 1363 | } |
1363 | } | 1364 | } |
@@ -1365,9 +1366,8 @@ void __ceph_mark_dirty_caps(struct ceph_inode_info *ci, int mask) | |||
1365 | if (((was | ci->i_flushing_caps) & CEPH_CAP_FILE_BUFFER) && | 1366 | if (((was | ci->i_flushing_caps) & CEPH_CAP_FILE_BUFFER) && |
1366 | (mask & CEPH_CAP_FILE_BUFFER)) | 1367 | (mask & CEPH_CAP_FILE_BUFFER)) |
1367 | dirty |= I_DIRTY_DATASYNC; | 1368 | dirty |= I_DIRTY_DATASYNC; |
1368 | if (dirty) | ||
1369 | __mark_inode_dirty(inode, dirty); | ||
1370 | __cap_delay_requeue(mdsc, ci); | 1369 | __cap_delay_requeue(mdsc, ci); |
1370 | return dirty; | ||
1371 | } | 1371 | } |
1372 | 1372 | ||
1373 | /* | 1373 | /* |
@@ -1991,7 +1991,7 @@ static void __take_cap_refs(struct ceph_inode_info *ci, int got) | |||
1991 | ci->i_wr_ref++; | 1991 | ci->i_wr_ref++; |
1992 | if (got & CEPH_CAP_FILE_BUFFER) { | 1992 | if (got & CEPH_CAP_FILE_BUFFER) { |
1993 | if (ci->i_wrbuffer_ref == 0) | 1993 | if (ci->i_wrbuffer_ref == 0) |
1994 | igrab(&ci->vfs_inode); | 1994 | ihold(&ci->vfs_inode); |
1995 | ci->i_wrbuffer_ref++; | 1995 | ci->i_wrbuffer_ref++; |
1996 | dout("__take_cap_refs %p wrbuffer %d -> %d (?)\n", | 1996 | dout("__take_cap_refs %p wrbuffer %d -> %d (?)\n", |
1997 | &ci->vfs_inode, ci->i_wrbuffer_ref-1, ci->i_wrbuffer_ref); | 1997 | &ci->vfs_inode, ci->i_wrbuffer_ref-1, ci->i_wrbuffer_ref); |
diff --git a/fs/ceph/file.c b/fs/ceph/file.c index 159b512d5a27..203252d88d9f 100644 --- a/fs/ceph/file.c +++ b/fs/ceph/file.c | |||
@@ -734,9 +734,12 @@ retry_snap: | |||
734 | } | 734 | } |
735 | } | 735 | } |
736 | if (ret >= 0) { | 736 | if (ret >= 0) { |
737 | int dirty; | ||
737 | spin_lock(&inode->i_lock); | 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 | spin_unlock(&inode->i_lock); | 740 | spin_unlock(&inode->i_lock); |
741 | if (dirty) | ||
742 | __mark_inode_dirty(inode, dirty); | ||
740 | } | 743 | } |
741 | 744 | ||
742 | out: | 745 | out: |
diff --git a/fs/ceph/inode.c b/fs/ceph/inode.c index b54c97da1c43..03d6dafda61f 100644 --- a/fs/ceph/inode.c +++ b/fs/ceph/inode.c | |||
@@ -1567,6 +1567,7 @@ int ceph_setattr(struct dentry *dentry, struct iattr *attr) | |||
1567 | int release = 0, dirtied = 0; | 1567 | int release = 0, dirtied = 0; |
1568 | int mask = 0; | 1568 | int mask = 0; |
1569 | int err = 0; | 1569 | int err = 0; |
1570 | int inode_dirty_flags = 0; | ||
1570 | 1571 | ||
1571 | if (ceph_snap(inode) != CEPH_NOSNAP) | 1572 | if (ceph_snap(inode) != CEPH_NOSNAP) |
1572 | return -EROFS; | 1573 | return -EROFS; |
@@ -1725,13 +1726,16 @@ int ceph_setattr(struct dentry *dentry, struct iattr *attr) | |||
1725 | dout("setattr %p ATTR_FILE ... hrm!\n", inode); | 1726 | dout("setattr %p ATTR_FILE ... hrm!\n", inode); |
1726 | 1727 | ||
1727 | if (dirtied) { | 1728 | if (dirtied) { |
1728 | __ceph_mark_dirty_caps(ci, dirtied); | 1729 | inode_dirty_flags = __ceph_mark_dirty_caps(ci, dirtied); |
1729 | inode->i_ctime = CURRENT_TIME; | 1730 | inode->i_ctime = CURRENT_TIME; |
1730 | } | 1731 | } |
1731 | 1732 | ||
1732 | release &= issued; | 1733 | release &= issued; |
1733 | spin_unlock(&inode->i_lock); | 1734 | spin_unlock(&inode->i_lock); |
1734 | 1735 | ||
1736 | if (inode_dirty_flags) | ||
1737 | __mark_inode_dirty(inode, inode_dirty_flags); | ||
1738 | |||
1735 | if (mask) { | 1739 | if (mask) { |
1736 | req->r_inode = igrab(inode); | 1740 | req->r_inode = igrab(inode); |
1737 | req->r_inode_drop = release; | 1741 | req->r_inode_drop = release; |
diff --git a/fs/ceph/super.h b/fs/ceph/super.h index 619fe719968f..b1f1b8bb1271 100644 --- a/fs/ceph/super.h +++ b/fs/ceph/super.h | |||
@@ -506,7 +506,7 @@ static inline int __ceph_caps_dirty(struct ceph_inode_info *ci) | |||
506 | { | 506 | { |
507 | return ci->i_dirty_caps | ci->i_flushing_caps; | 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 | extern int ceph_caps_revoking(struct ceph_inode_info *ci, int mask); | 511 | extern int ceph_caps_revoking(struct ceph_inode_info *ci, int mask); |
512 | extern int __ceph_caps_used(struct ceph_inode_info *ci); | 512 | extern int __ceph_caps_used(struct ceph_inode_info *ci); |
diff --git a/fs/ceph/xattr.c b/fs/ceph/xattr.c index 8c9eba6ef9df..f2b628696180 100644 --- a/fs/ceph/xattr.c +++ b/fs/ceph/xattr.c | |||
@@ -703,6 +703,7 @@ int ceph_setxattr(struct dentry *dentry, const char *name, | |||
703 | struct ceph_inode_xattr *xattr = NULL; | 703 | struct ceph_inode_xattr *xattr = NULL; |
704 | int issued; | 704 | int issued; |
705 | int required_blob_size; | 705 | int required_blob_size; |
706 | int dirty; | ||
706 | 707 | ||
707 | if (ceph_snap(inode) != CEPH_NOSNAP) | 708 | if (ceph_snap(inode) != CEPH_NOSNAP) |
708 | return -EROFS; | 709 | return -EROFS; |
@@ -763,11 +764,12 @@ retry: | |||
763 | dout("setxattr %p issued %s\n", inode, ceph_cap_string(issued)); | 764 | dout("setxattr %p issued %s\n", inode, ceph_cap_string(issued)); |
764 | err = __set_xattr(ci, newname, name_len, newval, | 765 | err = __set_xattr(ci, newname, name_len, newval, |
765 | val_len, 1, 1, 1, &xattr); | 766 | val_len, 1, 1, 1, &xattr); |
766 | __ceph_mark_dirty_caps(ci, CEPH_CAP_XATTR_EXCL); | 767 | dirty = __ceph_mark_dirty_caps(ci, CEPH_CAP_XATTR_EXCL); |
767 | ci->i_xattrs.dirty = true; | 768 | ci->i_xattrs.dirty = true; |
768 | inode->i_ctime = CURRENT_TIME; | 769 | inode->i_ctime = CURRENT_TIME; |
769 | spin_unlock(&inode->i_lock); | 770 | spin_unlock(&inode->i_lock); |
770 | 771 | if (dirty) | |
772 | __mark_inode_dirty(inode, dirty); | ||
771 | return err; | 773 | return err; |
772 | 774 | ||
773 | do_sync: | 775 | do_sync: |
@@ -810,6 +812,7 @@ int ceph_removexattr(struct dentry *dentry, const char *name) | |||
810 | struct ceph_vxattr_cb *vxattrs = ceph_inode_vxattrs(inode); | 812 | struct ceph_vxattr_cb *vxattrs = ceph_inode_vxattrs(inode); |
811 | int issued; | 813 | int issued; |
812 | int err; | 814 | int err; |
815 | int dirty; | ||
813 | 816 | ||
814 | if (ceph_snap(inode) != CEPH_NOSNAP) | 817 | if (ceph_snap(inode) != CEPH_NOSNAP) |
815 | return -EROFS; | 818 | return -EROFS; |
@@ -833,12 +836,13 @@ int ceph_removexattr(struct dentry *dentry, const char *name) | |||
833 | goto do_sync; | 836 | goto do_sync; |
834 | 837 | ||
835 | err = __remove_xattr_by_name(ceph_inode(inode), name); | 838 | err = __remove_xattr_by_name(ceph_inode(inode), name); |
836 | __ceph_mark_dirty_caps(ci, CEPH_CAP_XATTR_EXCL); | 839 | dirty = __ceph_mark_dirty_caps(ci, CEPH_CAP_XATTR_EXCL); |
837 | ci->i_xattrs.dirty = true; | 840 | ci->i_xattrs.dirty = true; |
838 | inode->i_ctime = CURRENT_TIME; | 841 | inode->i_ctime = CURRENT_TIME; |
839 | 842 | ||
840 | spin_unlock(&inode->i_lock); | 843 | spin_unlock(&inode->i_lock); |
841 | 844 | if (dirty) | |
845 | __mark_inode_dirty(inode, dirty); | ||
842 | return err; | 846 | return err; |
843 | do_sync: | 847 | do_sync: |
844 | spin_unlock(&inode->i_lock); | 848 | spin_unlock(&inode->i_lock); |
diff --git a/fs/cifs/connect.c b/fs/cifs/connect.c index 4bc862a80efa..05f1dcf7d79a 100644 --- a/fs/cifs/connect.c +++ b/fs/cifs/connect.c | |||
@@ -274,7 +274,8 @@ static int coalesce_t2(struct smb_hdr *psecond, struct smb_hdr *pTargetSMB) | |||
274 | char *data_area_of_target; | 274 | char *data_area_of_target; |
275 | char *data_area_of_buf2; | 275 | char *data_area_of_buf2; |
276 | int remaining; | 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 | total_data_size = get_unaligned_le16(&pSMBt->t2_rsp.TotalDataCount); | 280 | total_data_size = get_unaligned_le16(&pSMBt->t2_rsp.TotalDataCount); |
280 | 281 | ||
@@ -287,7 +288,7 @@ static int coalesce_t2(struct smb_hdr *psecond, struct smb_hdr *pTargetSMB) | |||
287 | remaining = total_data_size - total_in_buf; | 288 | remaining = total_data_size - total_in_buf; |
288 | 289 | ||
289 | if (remaining < 0) | 290 | if (remaining < 0) |
290 | return -EINVAL; | 291 | return -EPROTO; |
291 | 292 | ||
292 | if (remaining == 0) /* nothing to do, ignore */ | 293 | if (remaining == 0) /* nothing to do, ignore */ |
293 | return 0; | 294 | return 0; |
@@ -308,20 +309,29 @@ static int coalesce_t2(struct smb_hdr *psecond, struct smb_hdr *pTargetSMB) | |||
308 | data_area_of_target += total_in_buf; | 309 | data_area_of_target += total_in_buf; |
309 | 310 | ||
310 | /* copy second buffer into end of first buffer */ | 311 | /* copy second buffer into end of first buffer */ |
311 | memcpy(data_area_of_target, data_area_of_buf2, total_in_buf2); | ||
312 | total_in_buf += total_in_buf2; | 312 | total_in_buf += total_in_buf2; |
313 | /* is the result too big for the field? */ | ||
314 | if (total_in_buf > USHRT_MAX) | ||
315 | return -EPROTO; | ||
313 | put_unaligned_le16(total_in_buf, &pSMBt->t2_rsp.DataCount); | 316 | put_unaligned_le16(total_in_buf, &pSMBt->t2_rsp.DataCount); |
317 | |||
318 | /* fix up the BCC */ | ||
314 | byte_count = get_bcc_le(pTargetSMB); | 319 | byte_count = get_bcc_le(pTargetSMB); |
315 | byte_count += total_in_buf2; | 320 | byte_count += total_in_buf2; |
321 | /* is the result too big for the field? */ | ||
322 | if (byte_count > USHRT_MAX) | ||
323 | return -EPROTO; | ||
316 | put_bcc_le(byte_count, pTargetSMB); | 324 | put_bcc_le(byte_count, pTargetSMB); |
317 | 325 | ||
318 | byte_count = pTargetSMB->smb_buf_length; | 326 | byte_count = pTargetSMB->smb_buf_length; |
319 | byte_count += total_in_buf2; | 327 | byte_count += total_in_buf2; |
320 | 328 | /* don't allow buffer to overflow */ | |
321 | /* BB also add check that we are not beyond maximum buffer size */ | 329 | if (byte_count > CIFSMaxBufSize) |
322 | 330 | return -ENOBUFS; | |
323 | pTargetSMB->smb_buf_length = byte_count; | 331 | pTargetSMB->smb_buf_length = byte_count; |
324 | 332 | ||
333 | memcpy(data_area_of_target, data_area_of_buf2, total_in_buf2); | ||
334 | |||
325 | if (remaining == total_in_buf2) { | 335 | if (remaining == total_in_buf2) { |
326 | cFYI(1, "found the last secondary response"); | 336 | cFYI(1, "found the last secondary response"); |
327 | return 0; /* we are done */ | 337 | return 0; /* we are done */ |
@@ -607,59 +617,63 @@ incomplete_rcv: | |||
607 | list_for_each_safe(tmp, tmp2, &server->pending_mid_q) { | 617 | list_for_each_safe(tmp, tmp2, &server->pending_mid_q) { |
608 | mid_entry = list_entry(tmp, struct mid_q_entry, qhead); | 618 | mid_entry = list_entry(tmp, struct mid_q_entry, qhead); |
609 | 619 | ||
610 | if ((mid_entry->mid == smb_buffer->Mid) && | 620 | if (mid_entry->mid != smb_buffer->Mid || |
611 | (mid_entry->midState == MID_REQUEST_SUBMITTED) && | 621 | mid_entry->midState != MID_REQUEST_SUBMITTED || |
612 | (mid_entry->command == smb_buffer->Command)) { | 622 | mid_entry->command != smb_buffer->Command) { |
613 | if (length == 0 && | 623 | mid_entry = NULL; |
614 | check2ndT2(smb_buffer, server->maxBuf) > 0) { | 624 | continue; |
615 | /* We have a multipart transact2 resp */ | 625 | } |
616 | isMultiRsp = true; | 626 | |
617 | if (mid_entry->resp_buf) { | 627 | if (length == 0 && |
618 | /* merge response - fix up 1st*/ | 628 | check2ndT2(smb_buffer, server->maxBuf) > 0) { |
619 | if (coalesce_t2(smb_buffer, | 629 | /* We have a multipart transact2 resp */ |
620 | mid_entry->resp_buf)) { | 630 | isMultiRsp = true; |
621 | mid_entry->multiRsp = | 631 | if (mid_entry->resp_buf) { |
622 | true; | 632 | /* merge response - fix up 1st*/ |
623 | break; | 633 | length = coalesce_t2(smb_buffer, |
624 | } else { | 634 | mid_entry->resp_buf); |
625 | /* all parts received */ | 635 | if (length > 0) { |
626 | mid_entry->multiEnd = | 636 | length = 0; |
627 | true; | 637 | mid_entry->multiRsp = true; |
628 | goto multi_t2_fnd; | 638 | break; |
629 | } | ||
630 | } else { | 639 | } else { |
631 | if (!isLargeBuf) { | 640 | /* all parts received or |
632 | cERROR(1, "1st trans2 resp needs bigbuf"); | 641 | * packet is malformed |
633 | /* BB maybe we can fix this up, switch | 642 | */ |
634 | to already allocated large buffer? */ | 643 | mid_entry->multiEnd = true; |
635 | } else { | 644 | goto multi_t2_fnd; |
636 | /* Have first buffer */ | 645 | } |
637 | mid_entry->resp_buf = | 646 | } else { |
638 | smb_buffer; | 647 | if (!isLargeBuf) { |
639 | mid_entry->largeBuf = | 648 | /* |
640 | true; | 649 | * FIXME: switch to already |
641 | bigbuf = NULL; | 650 | * allocated largebuf? |
642 | } | 651 | */ |
652 | cERROR(1, "1st trans2 resp " | ||
653 | "needs bigbuf"); | ||
654 | } else { | ||
655 | /* Have first buffer */ | ||
656 | mid_entry->resp_buf = | ||
657 | smb_buffer; | ||
658 | mid_entry->largeBuf = true; | ||
659 | bigbuf = NULL; | ||
643 | } | 660 | } |
644 | break; | ||
645 | } | 661 | } |
646 | mid_entry->resp_buf = smb_buffer; | 662 | break; |
647 | mid_entry->largeBuf = isLargeBuf; | 663 | } |
664 | mid_entry->resp_buf = smb_buffer; | ||
665 | mid_entry->largeBuf = isLargeBuf; | ||
648 | multi_t2_fnd: | 666 | multi_t2_fnd: |
649 | if (length == 0) | 667 | if (length == 0) |
650 | mid_entry->midState = | 668 | mid_entry->midState = MID_RESPONSE_RECEIVED; |
651 | MID_RESPONSE_RECEIVED; | 669 | else |
652 | else | 670 | mid_entry->midState = MID_RESPONSE_MALFORMED; |
653 | mid_entry->midState = | ||
654 | MID_RESPONSE_MALFORMED; | ||
655 | #ifdef CONFIG_CIFS_STATS2 | 671 | #ifdef CONFIG_CIFS_STATS2 |
656 | mid_entry->when_received = jiffies; | 672 | mid_entry->when_received = jiffies; |
657 | #endif | 673 | #endif |
658 | list_del_init(&mid_entry->qhead); | 674 | list_del_init(&mid_entry->qhead); |
659 | mid_entry->callback(mid_entry); | 675 | mid_entry->callback(mid_entry); |
660 | break; | 676 | break; |
661 | } | ||
662 | mid_entry = NULL; | ||
663 | } | 677 | } |
664 | spin_unlock(&GlobalMid_Lock); | 678 | spin_unlock(&GlobalMid_Lock); |
665 | 679 | ||
diff --git a/fs/cifs/sess.c b/fs/cifs/sess.c index f6728eb6f4b9..645114ad0a10 100644 --- a/fs/cifs/sess.c +++ b/fs/cifs/sess.c | |||
@@ -276,7 +276,7 @@ static void ascii_ssetup_strings(char **pbcc_area, struct cifsSesInfo *ses, | |||
276 | } | 276 | } |
277 | 277 | ||
278 | static void | 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 | const struct nls_table *nls_cp) | 280 | const struct nls_table *nls_cp) |
281 | { | 281 | { |
282 | int len; | 282 | int len; |
@@ -284,19 +284,6 @@ decode_unicode_ssetup(char **pbcc_area, __u16 bleft, struct cifsSesInfo *ses, | |||
284 | 284 | ||
285 | cFYI(1, "bleft %d", bleft); | 285 | cFYI(1, "bleft %d", bleft); |
286 | 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 | |||
300 | kfree(ses->serverOS); | 287 | kfree(ses->serverOS); |
301 | ses->serverOS = cifs_strndup_from_ucs(data, bleft, true, nls_cp); | 288 | ses->serverOS = cifs_strndup_from_ucs(data, bleft, true, nls_cp); |
302 | cFYI(1, "serverOS=%s", ses->serverOS); | 289 | cFYI(1, "serverOS=%s", ses->serverOS); |
@@ -929,7 +916,9 @@ ssetup_ntlmssp_authenticate: | |||
929 | } | 916 | } |
930 | 917 | ||
931 | /* BB check if Unicode and decode strings */ | 918 | /* BB check if Unicode and decode strings */ |
932 | if (smb_buf->Flags2 & SMBFLG2_UNICODE) { | 919 | if (bytes_remaining == 0) { |
920 | /* no string area to decode, do nothing */ | ||
921 | } else if (smb_buf->Flags2 & SMBFLG2_UNICODE) { | ||
933 | /* unicode string area must be word-aligned */ | 922 | /* unicode string area must be word-aligned */ |
934 | if (((unsigned long) bcc_ptr - (unsigned long) smb_buf) % 2) { | 923 | if (((unsigned long) bcc_ptr - (unsigned long) smb_buf) % 2) { |
935 | ++bcc_ptr; | 924 | ++bcc_ptr; |
diff --git a/fs/hpfs/Kconfig b/fs/hpfs/Kconfig index 0c39dc3ef7d7..56bd15c5bf6c 100644 --- a/fs/hpfs/Kconfig +++ b/fs/hpfs/Kconfig | |||
@@ -1,7 +1,6 @@ | |||
1 | config HPFS_FS | 1 | config HPFS_FS |
2 | tristate "OS/2 HPFS file system support" | 2 | tristate "OS/2 HPFS file system support" |
3 | depends on BLOCK | 3 | depends on BLOCK |
4 | depends on BROKEN || !PREEMPT | ||
5 | help | 4 | help |
6 | OS/2 is IBM's operating system for PC's, the same as Warp, and HPFS | 5 | OS/2 is IBM's operating system for PC's, the same as Warp, and HPFS |
7 | is the file system used for organizing files on OS/2 hard disk | 6 | is the file system used for organizing files on OS/2 hard disk |
diff --git a/fs/hpfs/alloc.c b/fs/hpfs/alloc.c index 5503e2c28910..7a5eb2c718c8 100644 --- a/fs/hpfs/alloc.c +++ b/fs/hpfs/alloc.c | |||
@@ -8,8 +8,6 @@ | |||
8 | 8 | ||
9 | #include "hpfs_fn.h" | 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 | * Check if a sector is allocated in bitmap | 12 | * Check if a sector is allocated in bitmap |
15 | * This is really slow. Turned on only if chk==2 | 13 | * This is really slow. Turned on only if chk==2 |
@@ -18,9 +16,9 @@ static int hpfs_alloc_if_possible_nolock(struct super_block *s, secno sec); | |||
18 | static int chk_if_allocated(struct super_block *s, secno sec, char *msg) | 16 | static int chk_if_allocated(struct super_block *s, secno sec, char *msg) |
19 | { | 17 | { |
20 | struct quad_buffer_head qbh; | 18 | struct quad_buffer_head qbh; |
21 | unsigned *bmp; | 19 | u32 *bmp; |
22 | if (!(bmp = hpfs_map_bitmap(s, sec >> 14, &qbh, "chk"))) goto fail; | 20 | if (!(bmp = hpfs_map_bitmap(s, sec >> 14, &qbh, "chk"))) goto fail; |
23 | if ((bmp[(sec & 0x3fff) >> 5] >> (sec & 0x1f)) & 1) { | 21 | if ((cpu_to_le32(bmp[(sec & 0x3fff) >> 5]) >> (sec & 0x1f)) & 1) { |
24 | hpfs_error(s, "sector '%s' - %08x not allocated in bitmap", msg, sec); | 22 | hpfs_error(s, "sector '%s' - %08x not allocated in bitmap", msg, sec); |
25 | goto fail1; | 23 | goto fail1; |
26 | } | 24 | } |
@@ -28,7 +26,7 @@ static int chk_if_allocated(struct super_block *s, secno sec, char *msg) | |||
28 | if (sec >= hpfs_sb(s)->sb_dirband_start && sec < hpfs_sb(s)->sb_dirband_start + hpfs_sb(s)->sb_dirband_size) { | 26 | if (sec >= hpfs_sb(s)->sb_dirband_start && sec < hpfs_sb(s)->sb_dirband_start + hpfs_sb(s)->sb_dirband_size) { |
29 | unsigned ssec = (sec - hpfs_sb(s)->sb_dirband_start) / 4; | 27 | unsigned ssec = (sec - hpfs_sb(s)->sb_dirband_start) / 4; |
30 | if (!(bmp = hpfs_map_dnode_bitmap(s, &qbh))) goto fail; | 28 | if (!(bmp = hpfs_map_dnode_bitmap(s, &qbh))) goto fail; |
31 | if ((bmp[ssec >> 5] >> (ssec & 0x1f)) & 1) { | 29 | if ((le32_to_cpu(bmp[ssec >> 5]) >> (ssec & 0x1f)) & 1) { |
32 | hpfs_error(s, "sector '%s' - %08x not allocated in directory bitmap", msg, sec); | 30 | hpfs_error(s, "sector '%s' - %08x not allocated in directory bitmap", msg, sec); |
33 | goto fail1; | 31 | goto fail1; |
34 | } | 32 | } |
@@ -75,7 +73,6 @@ static secno alloc_in_bmp(struct super_block *s, secno near, unsigned n, unsigne | |||
75 | hpfs_error(s, "Bad allocation size: %d", n); | 73 | hpfs_error(s, "Bad allocation size: %d", n); |
76 | return 0; | 74 | return 0; |
77 | } | 75 | } |
78 | lock_super(s); | ||
79 | if (bs != ~0x3fff) { | 76 | if (bs != ~0x3fff) { |
80 | if (!(bmp = hpfs_map_bitmap(s, near >> 14, &qbh, "aib"))) goto uls; | 77 | if (!(bmp = hpfs_map_bitmap(s, near >> 14, &qbh, "aib"))) goto uls; |
81 | } else { | 78 | } else { |
@@ -85,10 +82,6 @@ static secno alloc_in_bmp(struct super_block *s, secno near, unsigned n, unsigne | |||
85 | ret = bs + nr; | 82 | ret = bs + nr; |
86 | goto rt; | 83 | goto rt; |
87 | } | 84 | } |
88 | /*if (!tstbits(bmp, nr + n, n + forward)) { | ||
89 | ret = bs + nr + n; | ||
90 | goto rt; | ||
91 | }*/ | ||
92 | q = nr + n; b = 0; | 85 | q = nr + n; b = 0; |
93 | while ((a = tstbits(bmp, q, n + forward)) != 0) { | 86 | while ((a = tstbits(bmp, q, n + forward)) != 0) { |
94 | q += a; | 87 | q += a; |
@@ -105,14 +98,14 @@ static secno alloc_in_bmp(struct super_block *s, secno near, unsigned n, unsigne | |||
105 | goto rt; | 98 | goto rt; |
106 | } | 99 | } |
107 | nr >>= 5; | 100 | nr >>= 5; |
108 | /*for (i = nr + 1; i != nr; i++, i &= 0x1ff) {*/ | 101 | /*for (i = nr + 1; i != nr; i++, i &= 0x1ff) */ |
109 | i = nr; | 102 | i = nr; |
110 | do { | 103 | do { |
111 | if (!bmp[i]) goto cont; | 104 | if (!le32_to_cpu(bmp[i])) goto cont; |
112 | if (n + forward >= 0x3f && bmp[i] != -1) goto cont; | 105 | if (n + forward >= 0x3f && le32_to_cpu(bmp[i]) != 0xffffffff) goto cont; |
113 | q = i<<5; | 106 | q = i<<5; |
114 | if (i > 0) { | 107 | if (i > 0) { |
115 | unsigned k = bmp[i-1]; | 108 | unsigned k = le32_to_cpu(bmp[i-1]); |
116 | while (k & 0x80000000) { | 109 | while (k & 0x80000000) { |
117 | q--; k <<= 1; | 110 | q--; k <<= 1; |
118 | } | 111 | } |
@@ -132,18 +125,17 @@ static secno alloc_in_bmp(struct super_block *s, secno near, unsigned n, unsigne | |||
132 | } while (i != nr); | 125 | } while (i != nr); |
133 | rt: | 126 | rt: |
134 | if (ret) { | 127 | if (ret) { |
135 | if (hpfs_sb(s)->sb_chk && ((ret >> 14) != (bs >> 14) || (bmp[(ret & 0x3fff) >> 5] | ~(((1 << n) - 1) << (ret & 0x1f))) != 0xffffffff)) { | 128 | if (hpfs_sb(s)->sb_chk && ((ret >> 14) != (bs >> 14) || (le32_to_cpu(bmp[(ret & 0x3fff) >> 5]) | ~(((1 << n) - 1) << (ret & 0x1f))) != 0xffffffff)) { |
136 | hpfs_error(s, "Allocation doesn't work! Wanted %d, allocated at %08x", n, ret); | 129 | hpfs_error(s, "Allocation doesn't work! Wanted %d, allocated at %08x", n, ret); |
137 | ret = 0; | 130 | ret = 0; |
138 | goto b; | 131 | goto b; |
139 | } | 132 | } |
140 | bmp[(ret & 0x3fff) >> 5] &= ~(((1 << n) - 1) << (ret & 0x1f)); | 133 | bmp[(ret & 0x3fff) >> 5] &= cpu_to_le32(~(((1 << n) - 1) << (ret & 0x1f))); |
141 | hpfs_mark_4buffers_dirty(&qbh); | 134 | hpfs_mark_4buffers_dirty(&qbh); |
142 | } | 135 | } |
143 | b: | 136 | b: |
144 | hpfs_brelse4(&qbh); | 137 | hpfs_brelse4(&qbh); |
145 | uls: | 138 | uls: |
146 | unlock_super(s); | ||
147 | return ret; | 139 | return ret; |
148 | } | 140 | } |
149 | 141 | ||
@@ -155,7 +147,7 @@ static secno alloc_in_bmp(struct super_block *s, secno near, unsigned n, unsigne | |||
155 | * sectors | 147 | * sectors |
156 | */ | 148 | */ |
157 | 149 | ||
158 | secno hpfs_alloc_sector(struct super_block *s, secno near, unsigned n, int forward, int lock) | 150 | secno hpfs_alloc_sector(struct super_block *s, secno near, unsigned n, int forward) |
159 | { | 151 | { |
160 | secno sec; | 152 | secno sec; |
161 | int i; | 153 | int i; |
@@ -167,7 +159,6 @@ secno hpfs_alloc_sector(struct super_block *s, secno near, unsigned n, int forwa | |||
167 | forward = -forward; | 159 | forward = -forward; |
168 | f_p = 1; | 160 | f_p = 1; |
169 | } | 161 | } |
170 | if (lock) hpfs_lock_creation(s); | ||
171 | n_bmps = (sbi->sb_fs_size + 0x4000 - 1) >> 14; | 162 | n_bmps = (sbi->sb_fs_size + 0x4000 - 1) >> 14; |
172 | if (near && near < sbi->sb_fs_size) { | 163 | if (near && near < sbi->sb_fs_size) { |
173 | if ((sec = alloc_in_bmp(s, near, n, f_p ? forward : forward/4))) goto ret; | 164 | if ((sec = alloc_in_bmp(s, near, n, f_p ? forward : forward/4))) goto ret; |
@@ -214,18 +205,17 @@ secno hpfs_alloc_sector(struct super_block *s, secno near, unsigned n, int forwa | |||
214 | ret: | 205 | ret: |
215 | if (sec && f_p) { | 206 | if (sec && f_p) { |
216 | for (i = 0; i < forward; i++) { | 207 | for (i = 0; i < forward; i++) { |
217 | if (!hpfs_alloc_if_possible_nolock(s, sec + i + 1)) { | 208 | if (!hpfs_alloc_if_possible(s, sec + i + 1)) { |
218 | hpfs_error(s, "Prealloc doesn't work! Wanted %d, allocated at %08x, can't allocate %d", forward, sec, i); | 209 | hpfs_error(s, "Prealloc doesn't work! Wanted %d, allocated at %08x, can't allocate %d", forward, sec, i); |
219 | sec = 0; | 210 | sec = 0; |
220 | break; | 211 | break; |
221 | } | 212 | } |
222 | } | 213 | } |
223 | } | 214 | } |
224 | if (lock) hpfs_unlock_creation(s); | ||
225 | return sec; | 215 | return sec; |
226 | } | 216 | } |
227 | 217 | ||
228 | static secno alloc_in_dirband(struct super_block *s, secno near, int lock) | 218 | static secno alloc_in_dirband(struct super_block *s, secno near) |
229 | { | 219 | { |
230 | unsigned nr = near; | 220 | unsigned nr = near; |
231 | secno sec; | 221 | secno sec; |
@@ -236,49 +226,35 @@ static secno alloc_in_dirband(struct super_block *s, secno near, int lock) | |||
236 | nr = sbi->sb_dirband_start + sbi->sb_dirband_size - 4; | 226 | nr = sbi->sb_dirband_start + sbi->sb_dirband_size - 4; |
237 | nr -= sbi->sb_dirband_start; | 227 | nr -= sbi->sb_dirband_start; |
238 | nr >>= 2; | 228 | nr >>= 2; |
239 | if (lock) hpfs_lock_creation(s); | ||
240 | sec = alloc_in_bmp(s, (~0x3fff) | nr, 1, 0); | 229 | sec = alloc_in_bmp(s, (~0x3fff) | nr, 1, 0); |
241 | if (lock) hpfs_unlock_creation(s); | ||
242 | if (!sec) return 0; | 230 | if (!sec) return 0; |
243 | return ((sec & 0x3fff) << 2) + sbi->sb_dirband_start; | 231 | return ((sec & 0x3fff) << 2) + sbi->sb_dirband_start; |
244 | } | 232 | } |
245 | 233 | ||
246 | /* Alloc sector if it's free */ | 234 | /* Alloc sector if it's free */ |
247 | 235 | ||
248 | static int hpfs_alloc_if_possible_nolock(struct super_block *s, secno sec) | 236 | int hpfs_alloc_if_possible(struct super_block *s, secno sec) |
249 | { | 237 | { |
250 | struct quad_buffer_head qbh; | 238 | struct quad_buffer_head qbh; |
251 | unsigned *bmp; | 239 | u32 *bmp; |
252 | lock_super(s); | ||
253 | if (!(bmp = hpfs_map_bitmap(s, sec >> 14, &qbh, "aip"))) goto end; | 240 | if (!(bmp = hpfs_map_bitmap(s, sec >> 14, &qbh, "aip"))) goto end; |
254 | if (bmp[(sec & 0x3fff) >> 5] & (1 << (sec & 0x1f))) { | 241 | if (le32_to_cpu(bmp[(sec & 0x3fff) >> 5]) & (1 << (sec & 0x1f))) { |
255 | bmp[(sec & 0x3fff) >> 5] &= ~(1 << (sec & 0x1f)); | 242 | bmp[(sec & 0x3fff) >> 5] &= cpu_to_le32(~(1 << (sec & 0x1f))); |
256 | hpfs_mark_4buffers_dirty(&qbh); | 243 | hpfs_mark_4buffers_dirty(&qbh); |
257 | hpfs_brelse4(&qbh); | 244 | hpfs_brelse4(&qbh); |
258 | unlock_super(s); | ||
259 | return 1; | 245 | return 1; |
260 | } | 246 | } |
261 | hpfs_brelse4(&qbh); | 247 | hpfs_brelse4(&qbh); |
262 | end: | 248 | end: |
263 | unlock_super(s); | ||
264 | return 0; | 249 | return 0; |
265 | } | 250 | } |
266 | 251 | ||
267 | int hpfs_alloc_if_possible(struct super_block *s, secno sec) | ||
268 | { | ||
269 | int r; | ||
270 | hpfs_lock_creation(s); | ||
271 | r = hpfs_alloc_if_possible_nolock(s, sec); | ||
272 | hpfs_unlock_creation(s); | ||
273 | return r; | ||
274 | } | ||
275 | |||
276 | /* Free sectors in bitmaps */ | 252 | /* Free sectors in bitmaps */ |
277 | 253 | ||
278 | void hpfs_free_sectors(struct super_block *s, secno sec, unsigned n) | 254 | void hpfs_free_sectors(struct super_block *s, secno sec, unsigned n) |
279 | { | 255 | { |
280 | struct quad_buffer_head qbh; | 256 | struct quad_buffer_head qbh; |
281 | unsigned *bmp; | 257 | u32 *bmp; |
282 | struct hpfs_sb_info *sbi = hpfs_sb(s); | 258 | struct hpfs_sb_info *sbi = hpfs_sb(s); |
283 | /*printk("2 - ");*/ | 259 | /*printk("2 - ");*/ |
284 | if (!n) return; | 260 | if (!n) return; |
@@ -286,26 +262,22 @@ void hpfs_free_sectors(struct super_block *s, secno sec, unsigned n) | |||
286 | hpfs_error(s, "Trying to free reserved sector %08x", sec); | 262 | hpfs_error(s, "Trying to free reserved sector %08x", sec); |
287 | return; | 263 | return; |
288 | } | 264 | } |
289 | lock_super(s); | ||
290 | sbi->sb_max_fwd_alloc += n > 0xffff ? 0xffff : n; | 265 | sbi->sb_max_fwd_alloc += n > 0xffff ? 0xffff : n; |
291 | if (sbi->sb_max_fwd_alloc > 0xffffff) sbi->sb_max_fwd_alloc = 0xffffff; | 266 | if (sbi->sb_max_fwd_alloc > 0xffffff) sbi->sb_max_fwd_alloc = 0xffffff; |
292 | new_map: | 267 | new_map: |
293 | if (!(bmp = hpfs_map_bitmap(s, sec >> 14, &qbh, "free"))) { | 268 | if (!(bmp = hpfs_map_bitmap(s, sec >> 14, &qbh, "free"))) { |
294 | unlock_super(s); | ||
295 | return; | 269 | return; |
296 | } | 270 | } |
297 | new_tst: | 271 | new_tst: |
298 | if ((bmp[(sec & 0x3fff) >> 5] >> (sec & 0x1f) & 1)) { | 272 | if ((le32_to_cpu(bmp[(sec & 0x3fff) >> 5]) >> (sec & 0x1f) & 1)) { |
299 | hpfs_error(s, "sector %08x not allocated", sec); | 273 | hpfs_error(s, "sector %08x not allocated", sec); |
300 | hpfs_brelse4(&qbh); | 274 | hpfs_brelse4(&qbh); |
301 | unlock_super(s); | ||
302 | return; | 275 | return; |
303 | } | 276 | } |
304 | bmp[(sec & 0x3fff) >> 5] |= 1 << (sec & 0x1f); | 277 | bmp[(sec & 0x3fff) >> 5] |= cpu_to_le32(1 << (sec & 0x1f)); |
305 | if (!--n) { | 278 | if (!--n) { |
306 | hpfs_mark_4buffers_dirty(&qbh); | 279 | hpfs_mark_4buffers_dirty(&qbh); |
307 | hpfs_brelse4(&qbh); | 280 | hpfs_brelse4(&qbh); |
308 | unlock_super(s); | ||
309 | return; | 281 | return; |
310 | } | 282 | } |
311 | if (!(++sec & 0x3fff)) { | 283 | if (!(++sec & 0x3fff)) { |
@@ -327,13 +299,13 @@ int hpfs_check_free_dnodes(struct super_block *s, int n) | |||
327 | int n_bmps = (hpfs_sb(s)->sb_fs_size + 0x4000 - 1) >> 14; | 299 | int n_bmps = (hpfs_sb(s)->sb_fs_size + 0x4000 - 1) >> 14; |
328 | int b = hpfs_sb(s)->sb_c_bitmap & 0x0fffffff; | 300 | int b = hpfs_sb(s)->sb_c_bitmap & 0x0fffffff; |
329 | int i, j; | 301 | int i, j; |
330 | unsigned *bmp; | 302 | u32 *bmp; |
331 | struct quad_buffer_head qbh; | 303 | struct quad_buffer_head qbh; |
332 | if ((bmp = hpfs_map_dnode_bitmap(s, &qbh))) { | 304 | if ((bmp = hpfs_map_dnode_bitmap(s, &qbh))) { |
333 | for (j = 0; j < 512; j++) { | 305 | for (j = 0; j < 512; j++) { |
334 | unsigned k; | 306 | unsigned k; |
335 | if (!bmp[j]) continue; | 307 | if (!le32_to_cpu(bmp[j])) continue; |
336 | for (k = bmp[j]; k; k >>= 1) if (k & 1) if (!--n) { | 308 | for (k = le32_to_cpu(bmp[j]); k; k >>= 1) if (k & 1) if (!--n) { |
337 | hpfs_brelse4(&qbh); | 309 | hpfs_brelse4(&qbh); |
338 | return 0; | 310 | return 0; |
339 | } | 311 | } |
@@ -352,10 +324,10 @@ int hpfs_check_free_dnodes(struct super_block *s, int n) | |||
352 | chk_bmp: | 324 | chk_bmp: |
353 | if (bmp) { | 325 | if (bmp) { |
354 | for (j = 0; j < 512; j++) { | 326 | for (j = 0; j < 512; j++) { |
355 | unsigned k; | 327 | u32 k; |
356 | if (!bmp[j]) continue; | 328 | if (!le32_to_cpu(bmp[j])) continue; |
357 | for (k = 0xf; k; k <<= 4) | 329 | for (k = 0xf; k; k <<= 4) |
358 | if ((bmp[j] & k) == k) { | 330 | if ((le32_to_cpu(bmp[j]) & k) == k) { |
359 | if (!--n) { | 331 | if (!--n) { |
360 | hpfs_brelse4(&qbh); | 332 | hpfs_brelse4(&qbh); |
361 | return 0; | 333 | return 0; |
@@ -379,44 +351,40 @@ void hpfs_free_dnode(struct super_block *s, dnode_secno dno) | |||
379 | hpfs_free_sectors(s, dno, 4); | 351 | hpfs_free_sectors(s, dno, 4); |
380 | } else { | 352 | } else { |
381 | struct quad_buffer_head qbh; | 353 | struct quad_buffer_head qbh; |
382 | unsigned *bmp; | 354 | u32 *bmp; |
383 | unsigned ssec = (dno - hpfs_sb(s)->sb_dirband_start) / 4; | 355 | unsigned ssec = (dno - hpfs_sb(s)->sb_dirband_start) / 4; |
384 | lock_super(s); | ||
385 | if (!(bmp = hpfs_map_dnode_bitmap(s, &qbh))) { | 356 | if (!(bmp = hpfs_map_dnode_bitmap(s, &qbh))) { |
386 | unlock_super(s); | ||
387 | return; | 357 | return; |
388 | } | 358 | } |
389 | bmp[ssec >> 5] |= 1 << (ssec & 0x1f); | 359 | bmp[ssec >> 5] |= cpu_to_le32(1 << (ssec & 0x1f)); |
390 | hpfs_mark_4buffers_dirty(&qbh); | 360 | hpfs_mark_4buffers_dirty(&qbh); |
391 | hpfs_brelse4(&qbh); | 361 | hpfs_brelse4(&qbh); |
392 | unlock_super(s); | ||
393 | } | 362 | } |
394 | } | 363 | } |
395 | 364 | ||
396 | struct dnode *hpfs_alloc_dnode(struct super_block *s, secno near, | 365 | struct dnode *hpfs_alloc_dnode(struct super_block *s, secno near, |
397 | dnode_secno *dno, struct quad_buffer_head *qbh, | 366 | dnode_secno *dno, struct quad_buffer_head *qbh) |
398 | int lock) | ||
399 | { | 367 | { |
400 | struct dnode *d; | 368 | struct dnode *d; |
401 | if (hpfs_count_one_bitmap(s, hpfs_sb(s)->sb_dmap) > FREE_DNODES_ADD) { | 369 | if (hpfs_count_one_bitmap(s, hpfs_sb(s)->sb_dmap) > FREE_DNODES_ADD) { |
402 | if (!(*dno = alloc_in_dirband(s, near, lock))) | 370 | if (!(*dno = alloc_in_dirband(s, near))) |
403 | if (!(*dno = hpfs_alloc_sector(s, near, 4, 0, lock))) return NULL; | 371 | if (!(*dno = hpfs_alloc_sector(s, near, 4, 0))) return NULL; |
404 | } else { | 372 | } else { |
405 | if (!(*dno = hpfs_alloc_sector(s, near, 4, 0, lock))) | 373 | if (!(*dno = hpfs_alloc_sector(s, near, 4, 0))) |
406 | if (!(*dno = alloc_in_dirband(s, near, lock))) return NULL; | 374 | if (!(*dno = alloc_in_dirband(s, near))) return NULL; |
407 | } | 375 | } |
408 | if (!(d = hpfs_get_4sectors(s, *dno, qbh))) { | 376 | if (!(d = hpfs_get_4sectors(s, *dno, qbh))) { |
409 | hpfs_free_dnode(s, *dno); | 377 | hpfs_free_dnode(s, *dno); |
410 | return NULL; | 378 | return NULL; |
411 | } | 379 | } |
412 | memset(d, 0, 2048); | 380 | memset(d, 0, 2048); |
413 | d->magic = DNODE_MAGIC; | 381 | d->magic = cpu_to_le32(DNODE_MAGIC); |
414 | d->first_free = 52; | 382 | d->first_free = cpu_to_le32(52); |
415 | d->dirent[0] = 32; | 383 | d->dirent[0] = 32; |
416 | d->dirent[2] = 8; | 384 | d->dirent[2] = 8; |
417 | d->dirent[30] = 1; | 385 | d->dirent[30] = 1; |
418 | d->dirent[31] = 255; | 386 | d->dirent[31] = 255; |
419 | d->self = *dno; | 387 | d->self = cpu_to_le32(*dno); |
420 | return d; | 388 | return d; |
421 | } | 389 | } |
422 | 390 | ||
@@ -424,16 +392,16 @@ struct fnode *hpfs_alloc_fnode(struct super_block *s, secno near, fnode_secno *f | |||
424 | struct buffer_head **bh) | 392 | struct buffer_head **bh) |
425 | { | 393 | { |
426 | struct fnode *f; | 394 | struct fnode *f; |
427 | if (!(*fno = hpfs_alloc_sector(s, near, 1, FNODE_ALLOC_FWD, 1))) return NULL; | 395 | if (!(*fno = hpfs_alloc_sector(s, near, 1, FNODE_ALLOC_FWD))) return NULL; |
428 | if (!(f = hpfs_get_sector(s, *fno, bh))) { | 396 | if (!(f = hpfs_get_sector(s, *fno, bh))) { |
429 | hpfs_free_sectors(s, *fno, 1); | 397 | hpfs_free_sectors(s, *fno, 1); |
430 | return NULL; | 398 | return NULL; |
431 | } | 399 | } |
432 | memset(f, 0, 512); | 400 | memset(f, 0, 512); |
433 | f->magic = FNODE_MAGIC; | 401 | f->magic = cpu_to_le32(FNODE_MAGIC); |
434 | f->ea_offs = 0xc4; | 402 | f->ea_offs = cpu_to_le16(0xc4); |
435 | f->btree.n_free_nodes = 8; | 403 | f->btree.n_free_nodes = 8; |
436 | f->btree.first_free = 8; | 404 | f->btree.first_free = cpu_to_le16(8); |
437 | return f; | 405 | return f; |
438 | } | 406 | } |
439 | 407 | ||
@@ -441,16 +409,16 @@ struct anode *hpfs_alloc_anode(struct super_block *s, secno near, anode_secno *a | |||
441 | struct buffer_head **bh) | 409 | struct buffer_head **bh) |
442 | { | 410 | { |
443 | struct anode *a; | 411 | struct anode *a; |
444 | if (!(*ano = hpfs_alloc_sector(s, near, 1, ANODE_ALLOC_FWD, 1))) return NULL; | 412 | if (!(*ano = hpfs_alloc_sector(s, near, 1, ANODE_ALLOC_FWD))) return NULL; |
445 | if (!(a = hpfs_get_sector(s, *ano, bh))) { | 413 | if (!(a = hpfs_get_sector(s, *ano, bh))) { |
446 | hpfs_free_sectors(s, *ano, 1); | 414 | hpfs_free_sectors(s, *ano, 1); |
447 | return NULL; | 415 | return NULL; |
448 | } | 416 | } |
449 | memset(a, 0, 512); | 417 | memset(a, 0, 512); |
450 | a->magic = ANODE_MAGIC; | 418 | a->magic = cpu_to_le32(ANODE_MAGIC); |
451 | a->self = *ano; | 419 | a->self = cpu_to_le32(*ano); |
452 | a->btree.n_free_nodes = 40; | 420 | a->btree.n_free_nodes = 40; |
453 | a->btree.n_used_nodes = 0; | 421 | a->btree.n_used_nodes = 0; |
454 | a->btree.first_free = 8; | 422 | a->btree.first_free = cpu_to_le16(8); |
455 | return a; | 423 | return a; |
456 | } | 424 | } |
diff --git a/fs/hpfs/anode.c b/fs/hpfs/anode.c index 6a2f04bf3df0..08b503e8ed29 100644 --- a/fs/hpfs/anode.c +++ b/fs/hpfs/anode.c | |||
@@ -22,8 +22,8 @@ secno hpfs_bplus_lookup(struct super_block *s, struct inode *inode, | |||
22 | if (hpfs_sb(s)->sb_chk) if (hpfs_stop_cycles(s, a, &c1, &c2, "hpfs_bplus_lookup")) return -1; | 22 | if (hpfs_sb(s)->sb_chk) if (hpfs_stop_cycles(s, a, &c1, &c2, "hpfs_bplus_lookup")) return -1; |
23 | if (btree->internal) { | 23 | if (btree->internal) { |
24 | for (i = 0; i < btree->n_used_nodes; i++) | 24 | for (i = 0; i < btree->n_used_nodes; i++) |
25 | if (btree->u.internal[i].file_secno > sec) { | 25 | if (le32_to_cpu(btree->u.internal[i].file_secno) > sec) { |
26 | a = btree->u.internal[i].down; | 26 | a = le32_to_cpu(btree->u.internal[i].down); |
27 | brelse(bh); | 27 | brelse(bh); |
28 | if (!(anode = hpfs_map_anode(s, a, &bh))) return -1; | 28 | if (!(anode = hpfs_map_anode(s, a, &bh))) return -1; |
29 | btree = &anode->btree; | 29 | btree = &anode->btree; |
@@ -34,18 +34,18 @@ secno hpfs_bplus_lookup(struct super_block *s, struct inode *inode, | |||
34 | return -1; | 34 | return -1; |
35 | } | 35 | } |
36 | for (i = 0; i < btree->n_used_nodes; i++) | 36 | for (i = 0; i < btree->n_used_nodes; i++) |
37 | if (btree->u.external[i].file_secno <= sec && | 37 | if (le32_to_cpu(btree->u.external[i].file_secno) <= sec && |
38 | btree->u.external[i].file_secno + btree->u.external[i].length > sec) { | 38 | le32_to_cpu(btree->u.external[i].file_secno) + le32_to_cpu(btree->u.external[i].length) > sec) { |
39 | a = btree->u.external[i].disk_secno + sec - btree->u.external[i].file_secno; | 39 | a = le32_to_cpu(btree->u.external[i].disk_secno) + sec - le32_to_cpu(btree->u.external[i].file_secno); |
40 | if (hpfs_sb(s)->sb_chk) if (hpfs_chk_sectors(s, a, 1, "data")) { | 40 | if (hpfs_sb(s)->sb_chk) if (hpfs_chk_sectors(s, a, 1, "data")) { |
41 | brelse(bh); | 41 | brelse(bh); |
42 | return -1; | 42 | return -1; |
43 | } | 43 | } |
44 | if (inode) { | 44 | if (inode) { |
45 | struct hpfs_inode_info *hpfs_inode = hpfs_i(inode); | 45 | struct hpfs_inode_info *hpfs_inode = hpfs_i(inode); |
46 | hpfs_inode->i_file_sec = btree->u.external[i].file_secno; | 46 | hpfs_inode->i_file_sec = le32_to_cpu(btree->u.external[i].file_secno); |
47 | hpfs_inode->i_disk_sec = btree->u.external[i].disk_secno; | 47 | hpfs_inode->i_disk_sec = le32_to_cpu(btree->u.external[i].disk_secno); |
48 | hpfs_inode->i_n_secs = btree->u.external[i].length; | 48 | hpfs_inode->i_n_secs = le32_to_cpu(btree->u.external[i].length); |
49 | } | 49 | } |
50 | brelse(bh); | 50 | brelse(bh); |
51 | return a; | 51 | return a; |
@@ -83,8 +83,8 @@ secno hpfs_add_sector_to_btree(struct super_block *s, secno node, int fnod, unsi | |||
83 | return -1; | 83 | return -1; |
84 | } | 84 | } |
85 | if (btree->internal) { | 85 | if (btree->internal) { |
86 | a = btree->u.internal[n].down; | 86 | a = le32_to_cpu(btree->u.internal[n].down); |
87 | btree->u.internal[n].file_secno = -1; | 87 | btree->u.internal[n].file_secno = cpu_to_le32(-1); |
88 | mark_buffer_dirty(bh); | 88 | mark_buffer_dirty(bh); |
89 | brelse(bh); | 89 | brelse(bh); |
90 | if (hpfs_sb(s)->sb_chk) | 90 | if (hpfs_sb(s)->sb_chk) |
@@ -94,15 +94,15 @@ secno hpfs_add_sector_to_btree(struct super_block *s, secno node, int fnod, unsi | |||
94 | goto go_down; | 94 | goto go_down; |
95 | } | 95 | } |
96 | if (n >= 0) { | 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 | hpfs_error(s, "allocated size %08x, trying to add sector %08x, %cnode %08x", | 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 | fnod?'f':'a', node); | 100 | fnod?'f':'a', node); |
101 | brelse(bh); | 101 | brelse(bh); |
102 | return -1; | 102 | return -1; |
103 | } | 103 | } |
104 | if (hpfs_alloc_if_possible(s, se = btree->u.external[n].disk_secno + 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++; | 105 | btree->u.external[n].length = cpu_to_le32(le32_to_cpu(btree->u.external[n].length) + 1); |
106 | mark_buffer_dirty(bh); | 106 | mark_buffer_dirty(bh); |
107 | brelse(bh); | 107 | brelse(bh); |
108 | return se; | 108 | return se; |
@@ -115,20 +115,20 @@ secno hpfs_add_sector_to_btree(struct super_block *s, secno node, int fnod, unsi | |||
115 | } | 115 | } |
116 | se = !fnod ? node : (node + 16384) & ~16383; | 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 | brelse(bh); | 119 | brelse(bh); |
120 | return -1; | 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 | if (!btree->n_free_nodes) { | 123 | if (!btree->n_free_nodes) { |
124 | up = a != node ? anode->up : -1; | 124 | up = a != node ? le32_to_cpu(anode->up) : -1; |
125 | if (!(anode = hpfs_alloc_anode(s, a, &na, &bh1))) { | 125 | if (!(anode = hpfs_alloc_anode(s, a, &na, &bh1))) { |
126 | brelse(bh); | 126 | brelse(bh); |
127 | hpfs_free_sectors(s, se, 1); | 127 | hpfs_free_sectors(s, se, 1); |
128 | return -1; | 128 | return -1; |
129 | } | 129 | } |
130 | if (a == node && fnod) { | 130 | if (a == node && fnod) { |
131 | anode->up = node; | 131 | anode->up = cpu_to_le32(node); |
132 | anode->btree.fnode_parent = 1; | 132 | anode->btree.fnode_parent = 1; |
133 | anode->btree.n_used_nodes = btree->n_used_nodes; | 133 | anode->btree.n_used_nodes = btree->n_used_nodes; |
134 | anode->btree.first_free = btree->first_free; | 134 | anode->btree.first_free = btree->first_free; |
@@ -137,9 +137,9 @@ secno hpfs_add_sector_to_btree(struct super_block *s, secno node, int fnod, unsi | |||
137 | btree->internal = 1; | 137 | btree->internal = 1; |
138 | btree->n_free_nodes = 11; | 138 | btree->n_free_nodes = 11; |
139 | btree->n_used_nodes = 1; | 139 | btree->n_used_nodes = 1; |
140 | btree->first_free = (char *)&(btree->u.internal[1]) - (char *)btree; | 140 | btree->first_free = cpu_to_le16((char *)&(btree->u.internal[1]) - (char *)btree); |
141 | btree->u.internal[0].file_secno = -1; | 141 | btree->u.internal[0].file_secno = cpu_to_le32(-1); |
142 | btree->u.internal[0].down = na; | 142 | btree->u.internal[0].down = cpu_to_le32(na); |
143 | mark_buffer_dirty(bh); | 143 | mark_buffer_dirty(bh); |
144 | } else if (!(ranode = hpfs_alloc_anode(s, /*a*/0, &ra, &bh2))) { | 144 | } else if (!(ranode = hpfs_alloc_anode(s, /*a*/0, &ra, &bh2))) { |
145 | brelse(bh); | 145 | brelse(bh); |
@@ -153,15 +153,15 @@ secno hpfs_add_sector_to_btree(struct super_block *s, secno node, int fnod, unsi | |||
153 | btree = &anode->btree; | 153 | btree = &anode->btree; |
154 | } | 154 | } |
155 | btree->n_free_nodes--; n = btree->n_used_nodes++; | 155 | btree->n_free_nodes--; n = btree->n_used_nodes++; |
156 | btree->first_free += 12; | 156 | btree->first_free = cpu_to_le16(le16_to_cpu(btree->first_free) + 12); |
157 | btree->u.external[n].disk_secno = se; | 157 | btree->u.external[n].disk_secno = cpu_to_le32(se); |
158 | btree->u.external[n].file_secno = fs; | 158 | btree->u.external[n].file_secno = cpu_to_le32(fs); |
159 | btree->u.external[n].length = 1; | 159 | btree->u.external[n].length = cpu_to_le32(1); |
160 | mark_buffer_dirty(bh); | 160 | mark_buffer_dirty(bh); |
161 | brelse(bh); | 161 | brelse(bh); |
162 | if ((a == node && fnod) || na == -1) return se; | 162 | if ((a == node && fnod) || na == -1) return se; |
163 | c2 = 0; | 163 | c2 = 0; |
164 | while (up != -1) { | 164 | while (up != (anode_secno)-1) { |
165 | struct anode *new_anode; | 165 | struct anode *new_anode; |
166 | if (hpfs_sb(s)->sb_chk) | 166 | if (hpfs_sb(s)->sb_chk) |
167 | if (hpfs_stop_cycles(s, up, &c1, &c2, "hpfs_add_sector_to_btree #2")) return -1; | 167 | if (hpfs_stop_cycles(s, up, &c1, &c2, "hpfs_add_sector_to_btree #2")) return -1; |
@@ -174,47 +174,47 @@ secno hpfs_add_sector_to_btree(struct super_block *s, secno node, int fnod, unsi | |||
174 | } | 174 | } |
175 | if (btree->n_free_nodes) { | 175 | if (btree->n_free_nodes) { |
176 | btree->n_free_nodes--; n = btree->n_used_nodes++; | 176 | btree->n_free_nodes--; n = btree->n_used_nodes++; |
177 | btree->first_free += 8; | 177 | btree->first_free = cpu_to_le16(le16_to_cpu(btree->first_free) + 8); |
178 | btree->u.internal[n].file_secno = -1; | 178 | btree->u.internal[n].file_secno = cpu_to_le32(-1); |
179 | btree->u.internal[n].down = na; | 179 | btree->u.internal[n].down = cpu_to_le32(na); |
180 | btree->u.internal[n-1].file_secno = fs; | 180 | btree->u.internal[n-1].file_secno = cpu_to_le32(fs); |
181 | mark_buffer_dirty(bh); | 181 | mark_buffer_dirty(bh); |
182 | brelse(bh); | 182 | brelse(bh); |
183 | brelse(bh2); | 183 | brelse(bh2); |
184 | hpfs_free_sectors(s, ra, 1); | 184 | hpfs_free_sectors(s, ra, 1); |
185 | if ((anode = hpfs_map_anode(s, na, &bh))) { | 185 | if ((anode = hpfs_map_anode(s, na, &bh))) { |
186 | anode->up = up; | 186 | anode->up = cpu_to_le32(up); |
187 | anode->btree.fnode_parent = up == node && fnod; | 187 | anode->btree.fnode_parent = up == node && fnod; |
188 | mark_buffer_dirty(bh); | 188 | mark_buffer_dirty(bh); |
189 | brelse(bh); | 189 | brelse(bh); |
190 | } | 190 | } |
191 | return se; | 191 | return se; |
192 | } | 192 | } |
193 | up = up != node ? anode->up : -1; | 193 | up = up != node ? le32_to_cpu(anode->up) : -1; |
194 | btree->u.internal[btree->n_used_nodes - 1].file_secno = /*fs*/-1; | 194 | btree->u.internal[btree->n_used_nodes - 1].file_secno = cpu_to_le32(/*fs*/-1); |
195 | mark_buffer_dirty(bh); | 195 | mark_buffer_dirty(bh); |
196 | brelse(bh); | 196 | brelse(bh); |
197 | a = na; | 197 | a = na; |
198 | if ((new_anode = hpfs_alloc_anode(s, a, &na, &bh))) { | 198 | if ((new_anode = hpfs_alloc_anode(s, a, &na, &bh))) { |
199 | anode = new_anode; | 199 | anode = new_anode; |
200 | /*anode->up = up != -1 ? up : ra;*/ | 200 | /*anode->up = cpu_to_le32(up != -1 ? up : ra);*/ |
201 | anode->btree.internal = 1; | 201 | anode->btree.internal = 1; |
202 | anode->btree.n_used_nodes = 1; | 202 | anode->btree.n_used_nodes = 1; |
203 | anode->btree.n_free_nodes = 59; | 203 | anode->btree.n_free_nodes = 59; |
204 | anode->btree.first_free = 16; | 204 | anode->btree.first_free = cpu_to_le16(16); |
205 | anode->btree.u.internal[0].down = a; | 205 | anode->btree.u.internal[0].down = cpu_to_le32(a); |
206 | anode->btree.u.internal[0].file_secno = -1; | 206 | anode->btree.u.internal[0].file_secno = cpu_to_le32(-1); |
207 | mark_buffer_dirty(bh); | 207 | mark_buffer_dirty(bh); |
208 | brelse(bh); | 208 | brelse(bh); |
209 | if ((anode = hpfs_map_anode(s, a, &bh))) { | 209 | if ((anode = hpfs_map_anode(s, a, &bh))) { |
210 | anode->up = na; | 210 | anode->up = cpu_to_le32(na); |
211 | mark_buffer_dirty(bh); | 211 | mark_buffer_dirty(bh); |
212 | brelse(bh); | 212 | brelse(bh); |
213 | } | 213 | } |
214 | } else na = a; | 214 | } else na = a; |
215 | } | 215 | } |
216 | if ((anode = hpfs_map_anode(s, na, &bh))) { | 216 | if ((anode = hpfs_map_anode(s, na, &bh))) { |
217 | anode->up = node; | 217 | anode->up = cpu_to_le32(node); |
218 | if (fnod) anode->btree.fnode_parent = 1; | 218 | if (fnod) anode->btree.fnode_parent = 1; |
219 | mark_buffer_dirty(bh); | 219 | mark_buffer_dirty(bh); |
220 | brelse(bh); | 220 | brelse(bh); |
@@ -232,14 +232,14 @@ secno hpfs_add_sector_to_btree(struct super_block *s, secno node, int fnod, unsi | |||
232 | } | 232 | } |
233 | btree = &fnode->btree; | 233 | btree = &fnode->btree; |
234 | } | 234 | } |
235 | ranode->up = node; | 235 | ranode->up = cpu_to_le32(node); |
236 | memcpy(&ranode->btree, btree, btree->first_free); | 236 | memcpy(&ranode->btree, btree, le16_to_cpu(btree->first_free)); |
237 | if (fnod) ranode->btree.fnode_parent = 1; | 237 | if (fnod) ranode->btree.fnode_parent = 1; |
238 | ranode->btree.n_free_nodes = (ranode->btree.internal ? 60 : 40) - ranode->btree.n_used_nodes; | 238 | ranode->btree.n_free_nodes = (ranode->btree.internal ? 60 : 40) - ranode->btree.n_used_nodes; |
239 | if (ranode->btree.internal) for (n = 0; n < ranode->btree.n_used_nodes; n++) { | 239 | if (ranode->btree.internal) for (n = 0; n < ranode->btree.n_used_nodes; n++) { |
240 | struct anode *unode; | 240 | struct anode *unode; |
241 | if ((unode = hpfs_map_anode(s, ranode->u.internal[n].down, &bh1))) { | 241 | if ((unode = hpfs_map_anode(s, le32_to_cpu(ranode->u.internal[n].down), &bh1))) { |
242 | unode->up = ra; | 242 | unode->up = cpu_to_le32(ra); |
243 | unode->btree.fnode_parent = 0; | 243 | unode->btree.fnode_parent = 0; |
244 | mark_buffer_dirty(bh1); | 244 | mark_buffer_dirty(bh1); |
245 | brelse(bh1); | 245 | brelse(bh1); |
@@ -248,11 +248,11 @@ secno hpfs_add_sector_to_btree(struct super_block *s, secno node, int fnod, unsi | |||
248 | btree->internal = 1; | 248 | btree->internal = 1; |
249 | btree->n_free_nodes = fnod ? 10 : 58; | 249 | btree->n_free_nodes = fnod ? 10 : 58; |
250 | btree->n_used_nodes = 2; | 250 | btree->n_used_nodes = 2; |
251 | btree->first_free = (char *)&btree->u.internal[2] - (char *)btree; | 251 | btree->first_free = cpu_to_le16((char *)&btree->u.internal[2] - (char *)btree); |
252 | btree->u.internal[0].file_secno = fs; | 252 | btree->u.internal[0].file_secno = cpu_to_le32(fs); |
253 | btree->u.internal[0].down = ra; | 253 | btree->u.internal[0].down = cpu_to_le32(ra); |
254 | btree->u.internal[1].file_secno = -1; | 254 | btree->u.internal[1].file_secno = cpu_to_le32(-1); |
255 | btree->u.internal[1].down = na; | 255 | btree->u.internal[1].down = cpu_to_le32(na); |
256 | mark_buffer_dirty(bh); | 256 | mark_buffer_dirty(bh); |
257 | brelse(bh); | 257 | brelse(bh); |
258 | mark_buffer_dirty(bh2); | 258 | mark_buffer_dirty(bh2); |
@@ -279,7 +279,7 @@ void hpfs_remove_btree(struct super_block *s, struct bplus_header *btree) | |||
279 | go_down: | 279 | go_down: |
280 | d2 = 0; | 280 | d2 = 0; |
281 | while (btree1->internal) { | 281 | while (btree1->internal) { |
282 | ano = btree1->u.internal[pos].down; | 282 | ano = le32_to_cpu(btree1->u.internal[pos].down); |
283 | if (level) brelse(bh); | 283 | if (level) brelse(bh); |
284 | if (hpfs_sb(s)->sb_chk) | 284 | if (hpfs_sb(s)->sb_chk) |
285 | if (hpfs_stop_cycles(s, ano, &d1, &d2, "hpfs_remove_btree #1")) | 285 | if (hpfs_stop_cycles(s, ano, &d1, &d2, "hpfs_remove_btree #1")) |
@@ -290,7 +290,7 @@ void hpfs_remove_btree(struct super_block *s, struct bplus_header *btree) | |||
290 | pos = 0; | 290 | pos = 0; |
291 | } | 291 | } |
292 | for (i = 0; i < btree1->n_used_nodes; i++) | 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 | go_up: | 294 | go_up: |
295 | if (!level) return; | 295 | if (!level) return; |
296 | brelse(bh); | 296 | brelse(bh); |
@@ -298,13 +298,13 @@ void hpfs_remove_btree(struct super_block *s, struct bplus_header *btree) | |||
298 | if (hpfs_stop_cycles(s, ano, &c1, &c2, "hpfs_remove_btree #2")) return; | 298 | if (hpfs_stop_cycles(s, ano, &c1, &c2, "hpfs_remove_btree #2")) return; |
299 | hpfs_free_sectors(s, ano, 1); | 299 | hpfs_free_sectors(s, ano, 1); |
300 | oano = ano; | 300 | oano = ano; |
301 | ano = anode->up; | 301 | ano = le32_to_cpu(anode->up); |
302 | if (--level) { | 302 | if (--level) { |
303 | if (!(anode = hpfs_map_anode(s, ano, &bh))) return; | 303 | if (!(anode = hpfs_map_anode(s, ano, &bh))) return; |
304 | btree1 = &anode->btree; | 304 | btree1 = &anode->btree; |
305 | } else btree1 = btree; | 305 | } else btree1 = btree; |
306 | for (i = 0; i < btree1->n_used_nodes; i++) { | 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 | if ((pos = i + 1) < btree1->n_used_nodes) | 308 | if ((pos = i + 1) < btree1->n_used_nodes) |
309 | goto go_down; | 309 | goto go_down; |
310 | else | 310 | else |
@@ -411,7 +411,7 @@ void hpfs_truncate_btree(struct super_block *s, secno f, int fno, unsigned secs) | |||
411 | if (fno) { | 411 | if (fno) { |
412 | btree->n_free_nodes = 8; | 412 | btree->n_free_nodes = 8; |
413 | btree->n_used_nodes = 0; | 413 | btree->n_used_nodes = 0; |
414 | btree->first_free = 8; | 414 | btree->first_free = cpu_to_le16(8); |
415 | btree->internal = 0; | 415 | btree->internal = 0; |
416 | mark_buffer_dirty(bh); | 416 | mark_buffer_dirty(bh); |
417 | } else hpfs_free_sectors(s, f, 1); | 417 | } else hpfs_free_sectors(s, f, 1); |
@@ -421,22 +421,22 @@ void hpfs_truncate_btree(struct super_block *s, secno f, int fno, unsigned secs) | |||
421 | while (btree->internal) { | 421 | while (btree->internal) { |
422 | nodes = btree->n_used_nodes + btree->n_free_nodes; | 422 | nodes = btree->n_used_nodes + btree->n_free_nodes; |
423 | for (i = 0; i < btree->n_used_nodes; i++) | 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 | brelse(bh); | 425 | brelse(bh); |
426 | hpfs_error(s, "internal btree %08x doesn't end with -1", node); | 426 | hpfs_error(s, "internal btree %08x doesn't end with -1", node); |
427 | return; | 427 | return; |
428 | f: | 428 | f: |
429 | for (j = i + 1; j < btree->n_used_nodes; j++) | 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 | btree->n_used_nodes = i + 1; | 431 | btree->n_used_nodes = i + 1; |
432 | btree->n_free_nodes = nodes - btree->n_used_nodes; | 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 | mark_buffer_dirty(bh); | 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 | brelse(bh); | 436 | brelse(bh); |
437 | return; | 437 | return; |
438 | } | 438 | } |
439 | node = btree->u.internal[i].down; | 439 | node = le32_to_cpu(btree->u.internal[i].down); |
440 | brelse(bh); | 440 | brelse(bh); |
441 | if (hpfs_sb(s)->sb_chk) | 441 | if (hpfs_sb(s)->sb_chk) |
442 | if (hpfs_stop_cycles(s, node, &c1, &c2, "hpfs_truncate_btree")) | 442 | if (hpfs_stop_cycles(s, node, &c1, &c2, "hpfs_truncate_btree")) |
@@ -446,25 +446,25 @@ void hpfs_truncate_btree(struct super_block *s, secno f, int fno, unsigned secs) | |||
446 | } | 446 | } |
447 | nodes = btree->n_used_nodes + btree->n_free_nodes; | 447 | nodes = btree->n_used_nodes + btree->n_free_nodes; |
448 | for (i = 0; i < btree->n_used_nodes; i++) | 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 | brelse(bh); | 450 | brelse(bh); |
451 | return; | 451 | return; |
452 | ff: | 452 | ff: |
453 | if (secs <= btree->u.external[i].file_secno) { | 453 | if (secs <= le32_to_cpu(btree->u.external[i].file_secno)) { |
454 | hpfs_error(s, "there is an allocation error in file %08x, sector %08x", f, secs); | 454 | hpfs_error(s, "there is an allocation error in file %08x, sector %08x", f, secs); |
455 | if (i) i--; | 455 | if (i) i--; |
456 | } | 456 | } |
457 | else if (btree->u.external[i].file_secno + btree->u.external[i].length > secs) { | 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, btree->u.external[i].disk_secno + secs - | 458 | hpfs_free_sectors(s, le32_to_cpu(btree->u.external[i].disk_secno) + secs - |
459 | btree->u.external[i].file_secno, btree->u.external[i].length | 459 | le32_to_cpu(btree->u.external[i].file_secno), le32_to_cpu(btree->u.external[i].length) |
460 | - secs + btree->u.external[i].file_secno); /* I hope gcc optimizes this :-) */ | 460 | - secs + le32_to_cpu(btree->u.external[i].file_secno)); /* I hope gcc optimizes this :-) */ |
461 | btree->u.external[i].length = secs - btree->u.external[i].file_secno; | 461 | btree->u.external[i].length = cpu_to_le32(secs - le32_to_cpu(btree->u.external[i].file_secno)); |
462 | } | 462 | } |
463 | for (j = i + 1; j < btree->n_used_nodes; j++) | 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 | btree->n_used_nodes = i + 1; | 465 | btree->n_used_nodes = i + 1; |
466 | btree->n_free_nodes = nodes - btree->n_used_nodes; | 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 | mark_buffer_dirty(bh); | 468 | mark_buffer_dirty(bh); |
469 | brelse(bh); | 469 | brelse(bh); |
470 | } | 470 | } |
@@ -480,12 +480,12 @@ void hpfs_remove_fnode(struct super_block *s, fnode_secno fno) | |||
480 | struct extended_attribute *ea_end; | 480 | struct extended_attribute *ea_end; |
481 | if (!(fnode = hpfs_map_fnode(s, fno, &bh))) return; | 481 | if (!(fnode = hpfs_map_fnode(s, fno, &bh))) return; |
482 | if (!fnode->dirflag) hpfs_remove_btree(s, &fnode->btree); | 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 | ea_end = fnode_end_ea(fnode); | 484 | ea_end = fnode_end_ea(fnode); |
485 | for (ea = fnode_ea(fnode); ea < ea_end; ea = next_ea(ea)) | 485 | for (ea = fnode_ea(fnode); ea < ea_end; ea = next_ea(ea)) |
486 | if (ea->indirect) | 486 | if (ea->indirect) |
487 | hpfs_ea_remove(s, ea_sec(ea), ea->anode, ea_len(ea)); | 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 | brelse(bh); | 489 | brelse(bh); |
490 | hpfs_free_sectors(s, fno, 1); | 490 | hpfs_free_sectors(s, fno, 1); |
491 | } | 491 | } |
diff --git a/fs/hpfs/buffer.c b/fs/hpfs/buffer.c index 793cb9d943d2..9ecde27d1e29 100644 --- a/fs/hpfs/buffer.c +++ b/fs/hpfs/buffer.c | |||
@@ -9,22 +9,6 @@ | |||
9 | #include <linux/slab.h> | 9 | #include <linux/slab.h> |
10 | #include "hpfs_fn.h" | 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 | /* Map a sector into a buffer and return pointers to it and to the buffer. */ | 12 | /* Map a sector into a buffer and return pointers to it and to the buffer. */ |
29 | 13 | ||
30 | void *hpfs_map_sector(struct super_block *s, unsigned secno, struct buffer_head **bhp, | 14 | void *hpfs_map_sector(struct super_block *s, unsigned secno, struct buffer_head **bhp, |
@@ -32,6 +16,8 @@ void *hpfs_map_sector(struct super_block *s, unsigned secno, struct buffer_head | |||
32 | { | 16 | { |
33 | struct buffer_head *bh; | 17 | struct buffer_head *bh; |
34 | 18 | ||
19 | hpfs_lock_assert(s); | ||
20 | |||
35 | cond_resched(); | 21 | cond_resched(); |
36 | 22 | ||
37 | *bhp = bh = sb_bread(s, secno); | 23 | *bhp = bh = sb_bread(s, secno); |
@@ -50,6 +36,8 @@ void *hpfs_get_sector(struct super_block *s, unsigned secno, struct buffer_head | |||
50 | struct buffer_head *bh; | 36 | struct buffer_head *bh; |
51 | /*return hpfs_map_sector(s, secno, bhp, 0);*/ | 37 | /*return hpfs_map_sector(s, secno, bhp, 0);*/ |
52 | 38 | ||
39 | hpfs_lock_assert(s); | ||
40 | |||
53 | cond_resched(); | 41 | cond_resched(); |
54 | 42 | ||
55 | if ((*bhp = bh = sb_getblk(s, secno)) != NULL) { | 43 | if ((*bhp = bh = sb_getblk(s, secno)) != NULL) { |
@@ -70,6 +58,8 @@ void *hpfs_map_4sectors(struct super_block *s, unsigned secno, struct quad_buffe | |||
70 | struct buffer_head *bh; | 58 | struct buffer_head *bh; |
71 | char *data; | 59 | char *data; |
72 | 60 | ||
61 | hpfs_lock_assert(s); | ||
62 | |||
73 | cond_resched(); | 63 | cond_resched(); |
74 | 64 | ||
75 | if (secno & 3) { | 65 | if (secno & 3) { |
@@ -125,6 +115,8 @@ void *hpfs_get_4sectors(struct super_block *s, unsigned secno, | |||
125 | { | 115 | { |
126 | cond_resched(); | 116 | cond_resched(); |
127 | 117 | ||
118 | hpfs_lock_assert(s); | ||
119 | |||
128 | if (secno & 3) { | 120 | if (secno & 3) { |
129 | printk("HPFS: hpfs_get_4sectors: unaligned read\n"); | 121 | printk("HPFS: hpfs_get_4sectors: unaligned read\n"); |
130 | return NULL; | 122 | return NULL; |
diff --git a/fs/hpfs/dir.c b/fs/hpfs/dir.c index b3d7c0ddb609..f46ae025bfb5 100644 --- a/fs/hpfs/dir.c +++ b/fs/hpfs/dir.c | |||
@@ -88,9 +88,9 @@ static int hpfs_readdir(struct file *filp, void *dirent, filldir_t filldir) | |||
88 | hpfs_error(inode->i_sb, "not a directory, fnode %08lx", | 88 | hpfs_error(inode->i_sb, "not a directory, fnode %08lx", |
89 | (unsigned long)inode->i_ino); | 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 | e = 1; | 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 | brelse(bh); | 95 | brelse(bh); |
96 | if (e) { | 96 | if (e) { |
@@ -156,7 +156,7 @@ static int hpfs_readdir(struct file *filp, void *dirent, filldir_t filldir) | |||
156 | goto again; | 156 | goto again; |
157 | } | 157 | } |
158 | tempname = hpfs_translate_name(inode->i_sb, de->name, de->namelen, lc, de->not_8x3); | 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 | filp->f_pos = old_pos; | 160 | filp->f_pos = old_pos; |
161 | if (tempname != de->name) kfree(tempname); | 161 | if (tempname != de->name) kfree(tempname); |
162 | hpfs_brelse4(&qbh); | 162 | hpfs_brelse4(&qbh); |
@@ -221,7 +221,7 @@ struct dentry *hpfs_lookup(struct inode *dir, struct dentry *dentry, struct name | |||
221 | * Get inode number, what we're after. | 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 | * Go find or make an inode. | 227 | * Go find or make an inode. |
@@ -236,7 +236,7 @@ struct dentry *hpfs_lookup(struct inode *dir, struct dentry *dentry, struct name | |||
236 | hpfs_init_inode(result); | 236 | hpfs_init_inode(result); |
237 | if (de->directory) | 237 | if (de->directory) |
238 | hpfs_read_inode(result); | 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 | hpfs_read_inode(result); | 240 | hpfs_read_inode(result); |
241 | else { | 241 | else { |
242 | result->i_mode |= S_IFREG; | 242 | result->i_mode |= S_IFREG; |
@@ -250,8 +250,6 @@ struct dentry *hpfs_lookup(struct inode *dir, struct dentry *dentry, struct name | |||
250 | hpfs_result = hpfs_i(result); | 250 | hpfs_result = hpfs_i(result); |
251 | if (!de->directory) hpfs_result->i_parent_dir = dir->i_ino; | 251 | if (!de->directory) hpfs_result->i_parent_dir = dir->i_ino; |
252 | 252 | ||
253 | hpfs_decide_conv(result, name, len); | ||
254 | |||
255 | if (de->has_acl || de->has_xtd_perm) if (!(dir->i_sb->s_flags & MS_RDONLY)) { | 253 | if (de->has_acl || de->has_xtd_perm) if (!(dir->i_sb->s_flags & MS_RDONLY)) { |
256 | 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"); | 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 | goto bail1; | 255 | goto bail1; |
@@ -263,19 +261,19 @@ struct dentry *hpfs_lookup(struct inode *dir, struct dentry *dentry, struct name | |||
263 | */ | 261 | */ |
264 | 262 | ||
265 | if (!result->i_ctime.tv_sec) { | 263 | if (!result->i_ctime.tv_sec) { |
266 | if (!(result->i_ctime.tv_sec = local_to_gmt(dir->i_sb, de->creation_date))) | 264 | if (!(result->i_ctime.tv_sec = local_to_gmt(dir->i_sb, le32_to_cpu(de->creation_date)))) |
267 | result->i_ctime.tv_sec = 1; | 265 | result->i_ctime.tv_sec = 1; |
268 | result->i_ctime.tv_nsec = 0; | 266 | result->i_ctime.tv_nsec = 0; |
269 | result->i_mtime.tv_sec = local_to_gmt(dir->i_sb, de->write_date); | 267 | result->i_mtime.tv_sec = local_to_gmt(dir->i_sb, le32_to_cpu(de->write_date)); |
270 | result->i_mtime.tv_nsec = 0; | 268 | result->i_mtime.tv_nsec = 0; |
271 | result->i_atime.tv_sec = local_to_gmt(dir->i_sb, de->read_date); | 269 | result->i_atime.tv_sec = local_to_gmt(dir->i_sb, le32_to_cpu(de->read_date)); |
272 | result->i_atime.tv_nsec = 0; | 270 | result->i_atime.tv_nsec = 0; |
273 | hpfs_result->i_ea_size = de->ea_size; | 271 | hpfs_result->i_ea_size = le32_to_cpu(de->ea_size); |
274 | if (!hpfs_result->i_ea_mode && de->read_only) | 272 | if (!hpfs_result->i_ea_mode && de->read_only) |
275 | result->i_mode &= ~0222; | 273 | result->i_mode &= ~0222; |
276 | if (!de->directory) { | 274 | if (!de->directory) { |
277 | if (result->i_size == -1) { | 275 | if (result->i_size == -1) { |
278 | result->i_size = de->file_size; | 276 | result->i_size = le32_to_cpu(de->file_size); |
279 | result->i_data.a_ops = &hpfs_aops; | 277 | result->i_data.a_ops = &hpfs_aops; |
280 | hpfs_i(result)->mmu_private = result->i_size; | 278 | hpfs_i(result)->mmu_private = result->i_size; |
281 | /* | 279 | /* |
diff --git a/fs/hpfs/dnode.c b/fs/hpfs/dnode.c index 9b2ffadfc8c4..1e0e2ac30fd3 100644 --- a/fs/hpfs/dnode.c +++ b/fs/hpfs/dnode.c | |||
@@ -14,11 +14,11 @@ static loff_t get_pos(struct dnode *d, struct hpfs_dirent *fde) | |||
14 | struct hpfs_dirent *de_end = dnode_end_de(d); | 14 | struct hpfs_dirent *de_end = dnode_end_de(d); |
15 | int i = 1; | 15 | int i = 1; |
16 | for (de = dnode_first_de(d); de < de_end; de = de_next_de(de)) { | 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 | i++; | 18 | i++; |
19 | } | 19 | } |
20 | printk("HPFS: get_pos: not_found\n"); | 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 | void hpfs_add_pos(struct inode *inode, loff_t *pos) | 24 | void hpfs_add_pos(struct inode *inode, loff_t *pos) |
@@ -130,29 +130,30 @@ static void set_last_pointer(struct super_block *s, struct dnode *d, dnode_secno | |||
130 | { | 130 | { |
131 | struct hpfs_dirent *de; | 131 | struct hpfs_dirent *de; |
132 | if (!(de = dnode_last_de(d))) { | 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 | return; | 134 | return; |
135 | } | 135 | } |
136 | if (hpfs_sb(s)->sb_chk) { | 136 | if (hpfs_sb(s)->sb_chk) { |
137 | if (de->down) { | 137 | if (de->down) { |
138 | hpfs_error(s, "set_last_pointer: dnode %08x has already last pointer %08x", | 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 | return; | 140 | return; |
141 | } | 141 | } |
142 | if (de->length != 32) { | 142 | if (le16_to_cpu(de->length) != 32) { |
143 | hpfs_error(s, "set_last_pointer: bad last dirent in dnode %08x", d->self); | 143 | hpfs_error(s, "set_last_pointer: bad last dirent in dnode %08x", le32_to_cpu(d->self)); |
144 | return; | 144 | return; |
145 | } | 145 | } |
146 | } | 146 | } |
147 | if (ptr) { | 147 | if (ptr) { |
148 | if ((d->first_free += 4) > 2048) { | 148 | d->first_free = cpu_to_le32(le32_to_cpu(d->first_free) + 4); |
149 | hpfs_error(s,"set_last_pointer: too long dnode %08x", d->self); | 149 | if (le32_to_cpu(d->first_free) > 2048) { |
150 | d->first_free -= 4; | 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 | return; | 152 | return; |
152 | } | 153 | } |
153 | de->length = 36; | 154 | de->length = cpu_to_le16(36); |
154 | de->down = 1; | 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 | ||
@@ -168,7 +169,7 @@ struct hpfs_dirent *hpfs_add_de(struct super_block *s, struct dnode *d, | |||
168 | for (de = dnode_first_de(d); de < de_end; de = de_next_de(de)) { | 169 | for (de = dnode_first_de(d); de < de_end; de = de_next_de(de)) { |
169 | int c = hpfs_compare_names(s, name, namelen, de->name, de->namelen, de->last); | 170 | int c = hpfs_compare_names(s, name, namelen, de->name, de->namelen, de->last); |
170 | if (!c) { | 171 | if (!c) { |
171 | hpfs_error(s, "name (%c,%d) already exists in dnode %08x", *name, namelen, d->self); | 172 | hpfs_error(s, "name (%c,%d) already exists in dnode %08x", *name, namelen, le32_to_cpu(d->self)); |
172 | return NULL; | 173 | return NULL; |
173 | } | 174 | } |
174 | if (c < 0) break; | 175 | if (c < 0) break; |
@@ -176,15 +177,14 @@ struct hpfs_dirent *hpfs_add_de(struct super_block *s, struct dnode *d, | |||
176 | memmove((char *)de + d_size, de, (char *)de_end - (char *)de); | 177 | memmove((char *)de + d_size, de, (char *)de_end - (char *)de); |
177 | memset(de, 0, d_size); | 178 | memset(de, 0, d_size); |
178 | if (down_ptr) { | 179 | if (down_ptr) { |
179 | *(int *)((char *)de + d_size - 4) = down_ptr; | 180 | *(dnode_secno *)((char *)de + d_size - 4) = cpu_to_le32(down_ptr); |
180 | de->down = 1; | 181 | de->down = 1; |
181 | } | 182 | } |
182 | de->length = d_size; | 183 | de->length = cpu_to_le16(d_size); |
183 | if (down_ptr) de->down = 1; | ||
184 | de->not_8x3 = hpfs_is_name_long(name, namelen); | 184 | de->not_8x3 = hpfs_is_name_long(name, namelen); |
185 | de->namelen = namelen; | 185 | de->namelen = namelen; |
186 | memcpy(de->name, name, namelen); | 186 | memcpy(de->name, name, namelen); |
187 | d->first_free += d_size; | 187 | d->first_free = cpu_to_le32(le32_to_cpu(d->first_free) + d_size); |
188 | return de; | 188 | return de; |
189 | } | 189 | } |
190 | 190 | ||
@@ -194,25 +194,25 @@ static void hpfs_delete_de(struct super_block *s, struct dnode *d, | |||
194 | struct hpfs_dirent *de) | 194 | struct hpfs_dirent *de) |
195 | { | 195 | { |
196 | if (de->last) { | 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 | return; | 198 | return; |
199 | } | 199 | } |
200 | d->first_free -= de->length; | 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), d->first_free + (char *)d - (char *)de); | 201 | memmove(de, de_next_de(de), le32_to_cpu(d->first_free) + (char *)d - (char *)de); |
202 | } | 202 | } |
203 | 203 | ||
204 | static void fix_up_ptrs(struct super_block *s, struct dnode *d) | 204 | static void fix_up_ptrs(struct super_block *s, struct dnode *d) |
205 | { | 205 | { |
206 | struct hpfs_dirent *de; | 206 | struct hpfs_dirent *de; |
207 | struct hpfs_dirent *de_end = dnode_end_de(d); | 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 | for (de = dnode_first_de(d); de < de_end; de = de_next_de(de)) | 209 | for (de = dnode_first_de(d); de < de_end; de = de_next_de(de)) |
210 | if (de->down) { | 210 | if (de->down) { |
211 | struct quad_buffer_head qbh; | 211 | struct quad_buffer_head qbh; |
212 | struct dnode *dd; | 212 | struct dnode *dd; |
213 | if ((dd = hpfs_map_dnode(s, de_down_pointer(de), &qbh))) { | 213 | if ((dd = hpfs_map_dnode(s, de_down_pointer(de), &qbh))) { |
214 | if (dd->up != dno || dd->root_dnode) { | 214 | if (le32_to_cpu(dd->up) != dno || dd->root_dnode) { |
215 | dd->up = dno; | 215 | dd->up = cpu_to_le32(dno); |
216 | dd->root_dnode = 0; | 216 | dd->root_dnode = 0; |
217 | hpfs_mark_4buffers_dirty(&qbh); | 217 | hpfs_mark_4buffers_dirty(&qbh); |
218 | } | 218 | } |
@@ -262,7 +262,7 @@ static int hpfs_add_to_dnode(struct inode *i, dnode_secno dno, | |||
262 | kfree(nname); | 262 | kfree(nname); |
263 | return 1; | 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 | loff_t t; | 266 | loff_t t; |
267 | copy_de(de=hpfs_add_de(i->i_sb, d, name, namelen, down_ptr), new_de); | 267 | copy_de(de=hpfs_add_de(i->i_sb, d, name, namelen, down_ptr), new_de); |
268 | t = get_pos(d, de); | 268 | t = get_pos(d, de); |
@@ -286,11 +286,11 @@ static int hpfs_add_to_dnode(struct inode *i, dnode_secno dno, | |||
286 | kfree(nname); | 286 | kfree(nname); |
287 | return 1; | 287 | return 1; |
288 | } | 288 | } |
289 | memcpy(nd, d, d->first_free); | 289 | memcpy(nd, d, le32_to_cpu(d->first_free)); |
290 | copy_de(de = hpfs_add_de(i->i_sb, nd, name, namelen, down_ptr), new_de); | 290 | copy_de(de = hpfs_add_de(i->i_sb, nd, name, namelen, down_ptr), new_de); |
291 | for_all_poss(i, hpfs_pos_ins, get_pos(nd, de), 1); | 291 | for_all_poss(i, hpfs_pos_ins, get_pos(nd, de), 1); |
292 | h = ((char *)dnode_last_de(nd) - (char *)nd) / 2 + 10; | 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 | hpfs_error(i->i_sb, "unable to alloc dnode - dnode tree will be corrupted"); | 294 | hpfs_error(i->i_sb, "unable to alloc dnode - dnode tree will be corrupted"); |
295 | hpfs_brelse4(&qbh); | 295 | hpfs_brelse4(&qbh); |
296 | kfree(nd); | 296 | kfree(nd); |
@@ -313,20 +313,21 @@ static int hpfs_add_to_dnode(struct inode *i, dnode_secno dno, | |||
313 | down_ptr = adno; | 313 | down_ptr = adno; |
314 | set_last_pointer(i->i_sb, ad, de->down ? de_down_pointer(de) : 0); | 314 | set_last_pointer(i->i_sb, ad, de->down ? de_down_pointer(de) : 0); |
315 | de = de_next_de(de); | 315 | de = de_next_de(de); |
316 | memmove((char *)nd + 20, de, nd->first_free + (char *)nd - (char *)de); | 316 | memmove((char *)nd + 20, de, le32_to_cpu(nd->first_free) + (char *)nd - (char *)de); |
317 | nd->first_free -= (char *)de - (char *)nd - 20; | 317 | nd->first_free = cpu_to_le32(le32_to_cpu(nd->first_free) - ((char *)de - (char *)nd - 20)); |
318 | memcpy(d, nd, nd->first_free); | 318 | memcpy(d, nd, le32_to_cpu(nd->first_free)); |
319 | for_all_poss(i, hpfs_pos_del, (loff_t)dno << 4, pos); | 319 | for_all_poss(i, hpfs_pos_del, (loff_t)dno << 4, pos); |
320 | fix_up_ptrs(i->i_sb, ad); | 320 | fix_up_ptrs(i->i_sb, ad); |
321 | if (!d->root_dnode) { | 321 | if (!d->root_dnode) { |
322 | dno = ad->up = d->up; | 322 | ad->up = d->up; |
323 | dno = le32_to_cpu(ad->up); | ||
323 | hpfs_mark_4buffers_dirty(&qbh); | 324 | hpfs_mark_4buffers_dirty(&qbh); |
324 | hpfs_brelse4(&qbh); | 325 | hpfs_brelse4(&qbh); |
325 | hpfs_mark_4buffers_dirty(&qbh1); | 326 | hpfs_mark_4buffers_dirty(&qbh1); |
326 | hpfs_brelse4(&qbh1); | 327 | hpfs_brelse4(&qbh1); |
327 | goto go_up; | 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 | hpfs_error(i->i_sb, "unable to alloc dnode - dnode tree will be corrupted"); | 331 | hpfs_error(i->i_sb, "unable to alloc dnode - dnode tree will be corrupted"); |
331 | hpfs_brelse4(&qbh); | 332 | hpfs_brelse4(&qbh); |
332 | hpfs_brelse4(&qbh1); | 333 | hpfs_brelse4(&qbh1); |
@@ -338,7 +339,7 @@ static int hpfs_add_to_dnode(struct inode *i, dnode_secno dno, | |||
338 | i->i_blocks += 4; | 339 | i->i_blocks += 4; |
339 | rd->root_dnode = 1; | 340 | rd->root_dnode = 1; |
340 | rd->up = d->up; | 341 | rd->up = d->up; |
341 | if (!(fnode = hpfs_map_fnode(i->i_sb, d->up, &bh))) { | 342 | if (!(fnode = hpfs_map_fnode(i->i_sb, le32_to_cpu(d->up), &bh))) { |
342 | hpfs_free_dnode(i->i_sb, rdno); | 343 | hpfs_free_dnode(i->i_sb, rdno); |
343 | hpfs_brelse4(&qbh); | 344 | hpfs_brelse4(&qbh); |
344 | hpfs_brelse4(&qbh1); | 345 | hpfs_brelse4(&qbh1); |
@@ -347,10 +348,11 @@ static int hpfs_add_to_dnode(struct inode *i, dnode_secno dno, | |||
347 | kfree(nname); | 348 | kfree(nname); |
348 | return 1; | 349 | return 1; |
349 | } | 350 | } |
350 | fnode->u.external[0].disk_secno = rdno; | 351 | fnode->u.external[0].disk_secno = cpu_to_le32(rdno); |
351 | mark_buffer_dirty(bh); | 352 | mark_buffer_dirty(bh); |
352 | brelse(bh); | 353 | brelse(bh); |
353 | d->up = ad->up = hpfs_i(i)->i_dno = rdno; | 354 | hpfs_i(i)->i_dno = rdno; |
355 | d->up = ad->up = cpu_to_le32(rdno); | ||
354 | d->root_dnode = ad->root_dnode = 0; | 356 | d->root_dnode = ad->root_dnode = 0; |
355 | hpfs_mark_4buffers_dirty(&qbh); | 357 | hpfs_mark_4buffers_dirty(&qbh); |
356 | hpfs_brelse4(&qbh); | 358 | hpfs_brelse4(&qbh); |
@@ -373,7 +375,7 @@ static int hpfs_add_to_dnode(struct inode *i, dnode_secno dno, | |||
373 | 375 | ||
374 | int hpfs_add_dirent(struct inode *i, | 376 | int hpfs_add_dirent(struct inode *i, |
375 | const unsigned char *name, unsigned namelen, | 377 | const unsigned char *name, unsigned namelen, |
376 | struct hpfs_dirent *new_de, int cdepth) | 378 | struct hpfs_dirent *new_de) |
377 | { | 379 | { |
378 | struct hpfs_inode_info *hpfs_inode = hpfs_i(i); | 380 | struct hpfs_inode_info *hpfs_inode = hpfs_i(i); |
379 | struct dnode *d; | 381 | struct dnode *d; |
@@ -403,7 +405,6 @@ int hpfs_add_dirent(struct inode *i, | |||
403 | } | 405 | } |
404 | } | 406 | } |
405 | hpfs_brelse4(&qbh); | 407 | hpfs_brelse4(&qbh); |
406 | if (!cdepth) hpfs_lock_creation(i->i_sb); | ||
407 | if (hpfs_check_free_dnodes(i->i_sb, FREE_DNODES_ADD)) { | 408 | if (hpfs_check_free_dnodes(i->i_sb, FREE_DNODES_ADD)) { |
408 | c = 1; | 409 | c = 1; |
409 | goto ret; | 410 | goto ret; |
@@ -411,7 +412,6 @@ int hpfs_add_dirent(struct inode *i, | |||
411 | i->i_version++; | 412 | i->i_version++; |
412 | c = hpfs_add_to_dnode(i, dno, name, namelen, new_de, 0); | 413 | c = hpfs_add_to_dnode(i, dno, name, namelen, new_de, 0); |
413 | ret: | 414 | ret: |
414 | if (!cdepth) hpfs_unlock_creation(i->i_sb); | ||
415 | return c; | 415 | return c; |
416 | } | 416 | } |
417 | 417 | ||
@@ -437,9 +437,9 @@ static secno move_to_top(struct inode *i, dnode_secno from, dnode_secno to) | |||
437 | return 0; | 437 | return 0; |
438 | if (!(dnode = hpfs_map_dnode(i->i_sb, dno, &qbh))) return 0; | 438 | if (!(dnode = hpfs_map_dnode(i->i_sb, dno, &qbh))) return 0; |
439 | if (hpfs_sb(i->i_sb)->sb_chk) { | 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 | hpfs_error(i->i_sb, "move_to_top: up pointer from %08x should be %08x, is %08x", | 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 | hpfs_brelse4(&qbh); | 443 | hpfs_brelse4(&qbh); |
444 | return 0; | 444 | return 0; |
445 | } | 445 | } |
@@ -455,7 +455,7 @@ static secno move_to_top(struct inode *i, dnode_secno from, dnode_secno to) | |||
455 | hpfs_brelse4(&qbh); | 455 | hpfs_brelse4(&qbh); |
456 | } | 456 | } |
457 | while (!(de = dnode_pre_last_de(dnode))) { | 457 | while (!(de = dnode_pre_last_de(dnode))) { |
458 | dnode_secno up = dnode->up; | 458 | dnode_secno up = le32_to_cpu(dnode->up); |
459 | hpfs_brelse4(&qbh); | 459 | hpfs_brelse4(&qbh); |
460 | hpfs_free_dnode(i->i_sb, dno); | 460 | hpfs_free_dnode(i->i_sb, dno); |
461 | i->i_size -= 2048; | 461 | i->i_size -= 2048; |
@@ -474,8 +474,8 @@ static secno move_to_top(struct inode *i, dnode_secno from, dnode_secno to) | |||
474 | hpfs_brelse4(&qbh); | 474 | hpfs_brelse4(&qbh); |
475 | return 0; | 475 | return 0; |
476 | } | 476 | } |
477 | dnode->first_free -= 4; | 477 | dnode->first_free = cpu_to_le32(le32_to_cpu(dnode->first_free) - 4); |
478 | de->length -= 4; | 478 | de->length = cpu_to_le16(le16_to_cpu(de->length) - 4); |
479 | de->down = 0; | 479 | de->down = 0; |
480 | hpfs_mark_4buffers_dirty(&qbh); | 480 | hpfs_mark_4buffers_dirty(&qbh); |
481 | dno = up; | 481 | dno = up; |
@@ -483,12 +483,12 @@ static secno move_to_top(struct inode *i, dnode_secno from, dnode_secno to) | |||
483 | t = get_pos(dnode, de); | 483 | t = get_pos(dnode, de); |
484 | for_all_poss(i, hpfs_pos_subst, t, 4); | 484 | for_all_poss(i, hpfs_pos_subst, t, 4); |
485 | for_all_poss(i, hpfs_pos_subst, t + 1, 5); | 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 | hpfs_error(i->i_sb, "out of memory for dirent - directory will be corrupted"); | 487 | hpfs_error(i->i_sb, "out of memory for dirent - directory will be corrupted"); |
488 | hpfs_brelse4(&qbh); | 488 | hpfs_brelse4(&qbh); |
489 | return 0; | 489 | return 0; |
490 | } | 490 | } |
491 | memcpy(nde, de, de->length); | 491 | memcpy(nde, de, le16_to_cpu(de->length)); |
492 | ddno = de->down ? de_down_pointer(de) : 0; | 492 | ddno = de->down ? de_down_pointer(de) : 0; |
493 | hpfs_delete_de(i->i_sb, dnode, de); | 493 | hpfs_delete_de(i->i_sb, dnode, de); |
494 | set_last_pointer(i->i_sb, dnode, ddno); | 494 | set_last_pointer(i->i_sb, dnode, ddno); |
@@ -517,11 +517,11 @@ static void delete_empty_dnode(struct inode *i, dnode_secno dno) | |||
517 | try_it_again: | 517 | try_it_again: |
518 | if (hpfs_stop_cycles(i->i_sb, dno, &c1, &c2, "delete_empty_dnode")) return; | 518 | if (hpfs_stop_cycles(i->i_sb, dno, &c1, &c2, "delete_empty_dnode")) return; |
519 | if (!(dnode = hpfs_map_dnode(i->i_sb, dno, &qbh))) return; | 519 | if (!(dnode = hpfs_map_dnode(i->i_sb, dno, &qbh))) return; |
520 | if (dnode->first_free > 56) goto end; | 520 | if (le32_to_cpu(dnode->first_free) > 56) goto end; |
521 | if (dnode->first_free == 52 || dnode->first_free == 56) { | 521 | if (le32_to_cpu(dnode->first_free) == 52 || le32_to_cpu(dnode->first_free) == 56) { |
522 | struct hpfs_dirent *de_end; | 522 | struct hpfs_dirent *de_end; |
523 | int root = dnode->root_dnode; | 523 | int root = dnode->root_dnode; |
524 | up = dnode->up; | 524 | up = le32_to_cpu(dnode->up); |
525 | de = dnode_first_de(dnode); | 525 | de = dnode_first_de(dnode); |
526 | down = de->down ? de_down_pointer(de) : 0; | 526 | down = de->down ? de_down_pointer(de) : 0; |
527 | if (hpfs_sb(i->i_sb)->sb_chk) if (root && !down) { | 527 | if (hpfs_sb(i->i_sb)->sb_chk) if (root && !down) { |
@@ -545,13 +545,13 @@ static void delete_empty_dnode(struct inode *i, dnode_secno dno) | |||
545 | return; | 545 | return; |
546 | } | 546 | } |
547 | if ((d1 = hpfs_map_dnode(i->i_sb, down, &qbh1))) { | 547 | if ((d1 = hpfs_map_dnode(i->i_sb, down, &qbh1))) { |
548 | d1->up = up; | 548 | d1->up = cpu_to_le32(up); |
549 | d1->root_dnode = 1; | 549 | d1->root_dnode = 1; |
550 | hpfs_mark_4buffers_dirty(&qbh1); | 550 | hpfs_mark_4buffers_dirty(&qbh1); |
551 | hpfs_brelse4(&qbh1); | 551 | hpfs_brelse4(&qbh1); |
552 | } | 552 | } |
553 | if ((fnode = hpfs_map_fnode(i->i_sb, up, &bh))) { | 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 | mark_buffer_dirty(bh); | 555 | mark_buffer_dirty(bh); |
556 | brelse(bh); | 556 | brelse(bh); |
557 | } | 557 | } |
@@ -570,22 +570,22 @@ static void delete_empty_dnode(struct inode *i, dnode_secno dno) | |||
570 | for_all_poss(i, hpfs_pos_subst, ((loff_t)dno << 4) | 1, ((loff_t)up << 4) | p); | 570 | for_all_poss(i, hpfs_pos_subst, ((loff_t)dno << 4) | 1, ((loff_t)up << 4) | p); |
571 | if (!down) { | 571 | if (!down) { |
572 | de->down = 0; | 572 | de->down = 0; |
573 | de->length -= 4; | 573 | de->length = cpu_to_le16(le16_to_cpu(de->length) - 4); |
574 | dnode->first_free -= 4; | 574 | dnode->first_free = cpu_to_le32(le32_to_cpu(dnode->first_free) - 4); |
575 | memmove(de_next_de(de), (char *)de_next_de(de) + 4, | 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 | } else { | 577 | } else { |
578 | struct dnode *d1; | 578 | struct dnode *d1; |
579 | struct quad_buffer_head qbh1; | 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 | if ((d1 = hpfs_map_dnode(i->i_sb, down, &qbh1))) { | 581 | if ((d1 = hpfs_map_dnode(i->i_sb, down, &qbh1))) { |
582 | d1->up = up; | 582 | d1->up = cpu_to_le32(up); |
583 | hpfs_mark_4buffers_dirty(&qbh1); | 583 | hpfs_mark_4buffers_dirty(&qbh1); |
584 | hpfs_brelse4(&qbh1); | 584 | hpfs_brelse4(&qbh1); |
585 | } | 585 | } |
586 | } | 586 | } |
587 | } else { | 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 | goto end; | 589 | goto end; |
590 | } | 590 | } |
591 | 591 | ||
@@ -596,18 +596,18 @@ static void delete_empty_dnode(struct inode *i, dnode_secno dno) | |||
596 | struct quad_buffer_head qbh1; | 596 | struct quad_buffer_head qbh1; |
597 | if (!de_next->down) goto endm; | 597 | if (!de_next->down) goto endm; |
598 | ndown = de_down_pointer(de_next); | 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 | printk("HPFS: out of memory for dtree balancing\n"); | 600 | printk("HPFS: out of memory for dtree balancing\n"); |
601 | goto endm; | 601 | goto endm; |
602 | } | 602 | } |
603 | memcpy(de_cp, de, de->length); | 603 | memcpy(de_cp, de, le16_to_cpu(de->length)); |
604 | hpfs_delete_de(i->i_sb, dnode, de); | 604 | hpfs_delete_de(i->i_sb, dnode, de); |
605 | hpfs_mark_4buffers_dirty(&qbh); | 605 | hpfs_mark_4buffers_dirty(&qbh); |
606 | hpfs_brelse4(&qbh); | 606 | hpfs_brelse4(&qbh); |
607 | for_all_poss(i, hpfs_pos_subst, ((loff_t)up << 4) | p, 4); | 607 | for_all_poss(i, hpfs_pos_subst, ((loff_t)up << 4) | p, 4); |
608 | for_all_poss(i, hpfs_pos_del, ((loff_t)up << 4) | p, 1); | 608 | for_all_poss(i, hpfs_pos_del, ((loff_t)up << 4) | p, 1); |
609 | if (de_cp->down) if ((d1 = hpfs_map_dnode(i->i_sb, de_down_pointer(de_cp), &qbh1))) { | 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 | hpfs_mark_4buffers_dirty(&qbh1); | 611 | hpfs_mark_4buffers_dirty(&qbh1); |
612 | hpfs_brelse4(&qbh1); | 612 | hpfs_brelse4(&qbh1); |
613 | } | 613 | } |
@@ -635,7 +635,7 @@ static void delete_empty_dnode(struct inode *i, dnode_secno dno) | |||
635 | struct hpfs_dirent *del = dnode_last_de(d1); | 635 | struct hpfs_dirent *del = dnode_last_de(d1); |
636 | dlp = del->down ? de_down_pointer(del) : 0; | 636 | dlp = del->down ? de_down_pointer(del) : 0; |
637 | if (!dlp && down) { | 637 | if (!dlp && down) { |
638 | if (d1->first_free > 2044) { | 638 | if (le32_to_cpu(d1->first_free) > 2044) { |
639 | if (hpfs_sb(i->i_sb)->sb_chk >= 2) { | 639 | if (hpfs_sb(i->i_sb)->sb_chk >= 2) { |
640 | printk("HPFS: warning: unbalanced dnode tree, see hpfs.txt 4 more info\n"); | 640 | printk("HPFS: warning: unbalanced dnode tree, see hpfs.txt 4 more info\n"); |
641 | printk("HPFS: warning: terminating balancing operation\n"); | 641 | printk("HPFS: warning: terminating balancing operation\n"); |
@@ -647,38 +647,38 @@ static void delete_empty_dnode(struct inode *i, dnode_secno dno) | |||
647 | printk("HPFS: warning: unbalanced dnode tree, see hpfs.txt 4 more info\n"); | 647 | printk("HPFS: warning: unbalanced dnode tree, see hpfs.txt 4 more info\n"); |
648 | printk("HPFS: warning: goin'on\n"); | 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 | del->down = 1; | 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 | if (dlp && !down) { | 654 | if (dlp && !down) { |
655 | del->length -= 4; | 655 | del->length = cpu_to_le16(le16_to_cpu(del->length) - 4); |
656 | del->down = 0; | 656 | del->down = 0; |
657 | d1->first_free -= 4; | 657 | d1->first_free = cpu_to_le32(le32_to_cpu(d1->first_free) - 4); |
658 | } else if (down) | 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 | } else goto endm; | 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 | printk("HPFS: out of memory for dtree balancing\n"); | 662 | printk("HPFS: out of memory for dtree balancing\n"); |
663 | hpfs_brelse4(&qbh1); | 663 | hpfs_brelse4(&qbh1); |
664 | goto endm; | 664 | goto endm; |
665 | } | 665 | } |
666 | hpfs_mark_4buffers_dirty(&qbh1); | 666 | hpfs_mark_4buffers_dirty(&qbh1); |
667 | hpfs_brelse4(&qbh1); | 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 | hpfs_delete_de(i->i_sb, dnode, de_prev); | 669 | hpfs_delete_de(i->i_sb, dnode, de_prev); |
670 | if (!de_prev->down) { | 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 | de_prev->down = 1; | 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 | hpfs_mark_4buffers_dirty(&qbh); | 676 | hpfs_mark_4buffers_dirty(&qbh); |
677 | hpfs_brelse4(&qbh); | 677 | hpfs_brelse4(&qbh); |
678 | for_all_poss(i, hpfs_pos_subst, ((loff_t)up << 4) | (p - 1), 4); | 678 | for_all_poss(i, hpfs_pos_subst, ((loff_t)up << 4) | (p - 1), 4); |
679 | for_all_poss(i, hpfs_pos_subst, ((loff_t)up << 4) | p, ((loff_t)up << 4) | (p - 1)); | 679 | for_all_poss(i, hpfs_pos_subst, ((loff_t)up << 4) | p, ((loff_t)up << 4) | (p - 1)); |
680 | if (down) if ((d1 = hpfs_map_dnode(i->i_sb, de_down_pointer(de), &qbh1))) { | 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 | hpfs_mark_4buffers_dirty(&qbh1); | 682 | hpfs_mark_4buffers_dirty(&qbh1); |
683 | hpfs_brelse4(&qbh1); | 683 | hpfs_brelse4(&qbh1); |
684 | } | 684 | } |
@@ -701,7 +701,6 @@ int hpfs_remove_dirent(struct inode *i, dnode_secno dno, struct hpfs_dirent *de, | |||
701 | { | 701 | { |
702 | struct dnode *dnode = qbh->data; | 702 | struct dnode *dnode = qbh->data; |
703 | dnode_secno down = 0; | 703 | dnode_secno down = 0; |
704 | int lock = 0; | ||
705 | loff_t t; | 704 | loff_t t; |
706 | if (de->first || de->last) { | 705 | if (de->first || de->last) { |
707 | hpfs_error(i->i_sb, "hpfs_remove_dirent: attempt to delete first or last dirent in dnode %08x", dno); | 706 | hpfs_error(i->i_sb, "hpfs_remove_dirent: attempt to delete first or last dirent in dnode %08x", dno); |
@@ -710,11 +709,8 @@ int hpfs_remove_dirent(struct inode *i, dnode_secno dno, struct hpfs_dirent *de, | |||
710 | } | 709 | } |
711 | if (de->down) down = de_down_pointer(de); | 710 | if (de->down) down = de_down_pointer(de); |
712 | if (depth && (de->down || (de == dnode_first_de(dnode) && de_next_de(de)->last))) { | 711 | if (depth && (de->down || (de == dnode_first_de(dnode) && de_next_de(de)->last))) { |
713 | lock = 1; | ||
714 | hpfs_lock_creation(i->i_sb); | ||
715 | if (hpfs_check_free_dnodes(i->i_sb, FREE_DNODES_DEL)) { | 712 | if (hpfs_check_free_dnodes(i->i_sb, FREE_DNODES_DEL)) { |
716 | hpfs_brelse4(qbh); | 713 | hpfs_brelse4(qbh); |
717 | hpfs_unlock_creation(i->i_sb); | ||
718 | return 2; | 714 | return 2; |
719 | } | 715 | } |
720 | } | 716 | } |
@@ -727,11 +723,9 @@ int hpfs_remove_dirent(struct inode *i, dnode_secno dno, struct hpfs_dirent *de, | |||
727 | dnode_secno a = move_to_top(i, down, dno); | 723 | dnode_secno a = move_to_top(i, down, dno); |
728 | for_all_poss(i, hpfs_pos_subst, 5, t); | 724 | for_all_poss(i, hpfs_pos_subst, 5, t); |
729 | if (a) delete_empty_dnode(i, a); | 725 | if (a) delete_empty_dnode(i, a); |
730 | if (lock) hpfs_unlock_creation(i->i_sb); | ||
731 | return !a; | 726 | return !a; |
732 | } | 727 | } |
733 | delete_empty_dnode(i, dno); | 728 | delete_empty_dnode(i, dno); |
734 | if (lock) hpfs_unlock_creation(i->i_sb); | ||
735 | return 0; | 729 | return 0; |
736 | } | 730 | } |
737 | 731 | ||
@@ -751,8 +745,8 @@ void hpfs_count_dnodes(struct super_block *s, dnode_secno dno, int *n_dnodes, | |||
751 | ptr = 0; | 745 | ptr = 0; |
752 | go_up: | 746 | go_up: |
753 | if (!(dnode = hpfs_map_dnode(s, dno, &qbh))) return; | 747 | if (!(dnode = hpfs_map_dnode(s, dno, &qbh))) return; |
754 | if (hpfs_sb(s)->sb_chk) if (odno && odno != -1 && dnode->up != odno) | 748 | 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, dnode->up); | 749 | hpfs_error(s, "hpfs_count_dnodes: bad up pointer; dnode %08x, down %08x points to %08x", odno, dno, le32_to_cpu(dnode->up)); |
756 | de = dnode_first_de(dnode); | 750 | de = dnode_first_de(dnode); |
757 | if (ptr) while(1) { | 751 | if (ptr) while(1) { |
758 | if (de->down) if (de_down_pointer(de) == ptr) goto process_de; | 752 | if (de->down) if (de_down_pointer(de) == ptr) goto process_de; |
@@ -776,7 +770,7 @@ void hpfs_count_dnodes(struct super_block *s, dnode_secno dno, int *n_dnodes, | |||
776 | if (!de->first && !de->last && n_items) (*n_items)++; | 770 | if (!de->first && !de->last && n_items) (*n_items)++; |
777 | if ((de = de_next_de(de)) < dnode_end_de(dnode)) goto next_de; | 771 | if ((de = de_next_de(de)) < dnode_end_de(dnode)) goto next_de; |
778 | ptr = dno; | 772 | ptr = dno; |
779 | dno = dnode->up; | 773 | dno = le32_to_cpu(dnode->up); |
780 | if (dnode->root_dnode) { | 774 | if (dnode->root_dnode) { |
781 | hpfs_brelse4(&qbh); | 775 | hpfs_brelse4(&qbh); |
782 | return; | 776 | return; |
@@ -824,8 +818,8 @@ dnode_secno hpfs_de_as_down_as_possible(struct super_block *s, dnode_secno dno) | |||
824 | return d; | 818 | return d; |
825 | if (!(de = map_nth_dirent(s, d, 1, &qbh, NULL))) return dno; | 819 | if (!(de = map_nth_dirent(s, d, 1, &qbh, NULL))) return dno; |
826 | if (hpfs_sb(s)->sb_chk) | 820 | if (hpfs_sb(s)->sb_chk) |
827 | if (up && ((struct dnode *)qbh.data)->up != up) | 821 | 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, ((struct dnode *)qbh.data)->up); | 822 | 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)); |
829 | if (!de->down) { | 823 | if (!de->down) { |
830 | hpfs_brelse4(&qbh); | 824 | hpfs_brelse4(&qbh); |
831 | return d; | 825 | return d; |
@@ -874,7 +868,7 @@ struct hpfs_dirent *map_pos_dirent(struct inode *inode, loff_t *posp, | |||
874 | /* Going up */ | 868 | /* Going up */ |
875 | if (dnode->root_dnode) goto bail; | 869 | if (dnode->root_dnode) goto bail; |
876 | 870 | ||
877 | if (!(up_dnode = hpfs_map_dnode(inode->i_sb, dnode->up, &qbh0))) | 871 | if (!(up_dnode = hpfs_map_dnode(inode->i_sb, le32_to_cpu(dnode->up), &qbh0))) |
878 | goto bail; | 872 | goto bail; |
879 | 873 | ||
880 | end_up_de = dnode_end_de(up_dnode); | 874 | end_up_de = dnode_end_de(up_dnode); |
@@ -882,16 +876,16 @@ struct hpfs_dirent *map_pos_dirent(struct inode *inode, loff_t *posp, | |||
882 | for (up_de = dnode_first_de(up_dnode); up_de < end_up_de; | 876 | for (up_de = dnode_first_de(up_dnode); up_de < end_up_de; |
883 | up_de = de_next_de(up_de)) { | 877 | up_de = de_next_de(up_de)) { |
884 | if (!(++c & 077)) hpfs_error(inode->i_sb, | 878 | if (!(++c & 077)) hpfs_error(inode->i_sb, |
885 | "map_pos_dirent: pos crossed dnode boundary; dnode = %08x", dnode->up); | 879 | "map_pos_dirent: pos crossed dnode boundary; dnode = %08x", le32_to_cpu(dnode->up)); |
886 | if (up_de->down && de_down_pointer(up_de) == dno) { | 880 | if (up_de->down && de_down_pointer(up_de) == dno) { |
887 | *posp = ((loff_t) dnode->up << 4) + c; | 881 | *posp = ((loff_t) le32_to_cpu(dnode->up) << 4) + c; |
888 | hpfs_brelse4(&qbh0); | 882 | hpfs_brelse4(&qbh0); |
889 | return de; | 883 | return de; |
890 | } | 884 | } |
891 | } | 885 | } |
892 | 886 | ||
893 | hpfs_error(inode->i_sb, "map_pos_dirent: pointer to dnode %08x not found in parent dnode %08x", | 887 | hpfs_error(inode->i_sb, "map_pos_dirent: pointer to dnode %08x not found in parent dnode %08x", |
894 | dno, dnode->up); | 888 | dno, le32_to_cpu(dnode->up)); |
895 | hpfs_brelse4(&qbh0); | 889 | hpfs_brelse4(&qbh0); |
896 | 890 | ||
897 | bail: | 891 | bail: |
@@ -1017,17 +1011,17 @@ struct hpfs_dirent *map_fnode_dirent(struct super_block *s, fnode_secno fno, | |||
1017 | /*name2[15] = 0xff;*/ | 1011 | /*name2[15] = 0xff;*/ |
1018 | name1len = 15; name2len = 256; | 1012 | name1len = 15; name2len = 256; |
1019 | } | 1013 | } |
1020 | if (!(upf = hpfs_map_fnode(s, f->up, &bh))) { | 1014 | if (!(upf = hpfs_map_fnode(s, le32_to_cpu(f->up), &bh))) { |
1021 | kfree(name2); | 1015 | kfree(name2); |
1022 | return NULL; | 1016 | return NULL; |
1023 | } | 1017 | } |
1024 | if (!upf->dirflag) { | 1018 | if (!upf->dirflag) { |
1025 | brelse(bh); | 1019 | brelse(bh); |
1026 | hpfs_error(s, "fnode %08x has non-directory parent %08x", fno, f->up); | 1020 | hpfs_error(s, "fnode %08x has non-directory parent %08x", fno, le32_to_cpu(f->up)); |
1027 | kfree(name2); | 1021 | kfree(name2); |
1028 | return NULL; | 1022 | return NULL; |
1029 | } | 1023 | } |
1030 | dno = upf->u.external[0].disk_secno; | 1024 | dno = le32_to_cpu(upf->u.external[0].disk_secno); |
1031 | brelse(bh); | 1025 | brelse(bh); |
1032 | go_down: | 1026 | go_down: |
1033 | downd = 0; | 1027 | downd = 0; |
@@ -1049,7 +1043,7 @@ struct hpfs_dirent *map_fnode_dirent(struct super_block *s, fnode_secno fno, | |||
1049 | return NULL; | 1043 | return NULL; |
1050 | } | 1044 | } |
1051 | next_de: | 1045 | next_de: |
1052 | if (de->fnode == fno) { | 1046 | if (le32_to_cpu(de->fnode) == fno) { |
1053 | kfree(name2); | 1047 | kfree(name2); |
1054 | return de; | 1048 | return de; |
1055 | } | 1049 | } |
@@ -1065,7 +1059,7 @@ struct hpfs_dirent *map_fnode_dirent(struct super_block *s, fnode_secno fno, | |||
1065 | goto go_down; | 1059 | goto go_down; |
1066 | } | 1060 | } |
1067 | f: | 1061 | f: |
1068 | if (de->fnode == fno) { | 1062 | if (le32_to_cpu(de->fnode) == fno) { |
1069 | kfree(name2); | 1063 | kfree(name2); |
1070 | return de; | 1064 | return de; |
1071 | } | 1065 | } |
@@ -1074,7 +1068,7 @@ struct hpfs_dirent *map_fnode_dirent(struct super_block *s, fnode_secno fno, | |||
1074 | if ((de = de_next_de(de)) < de_end) goto next_de; | 1068 | if ((de = de_next_de(de)) < de_end) goto next_de; |
1075 | if (d->root_dnode) goto not_found; | 1069 | if (d->root_dnode) goto not_found; |
1076 | downd = dno; | 1070 | downd = dno; |
1077 | dno = d->up; | 1071 | dno = le32_to_cpu(d->up); |
1078 | hpfs_brelse4(qbh); | 1072 | hpfs_brelse4(qbh); |
1079 | if (hpfs_sb(s)->sb_chk) | 1073 | if (hpfs_sb(s)->sb_chk) |
1080 | if (hpfs_stop_cycles(s, downd, &d1, &d2, "map_fnode_dirent #2")) { | 1074 | if (hpfs_stop_cycles(s, downd, &d1, &d2, "map_fnode_dirent #2")) { |
diff --git a/fs/hpfs/ea.c b/fs/hpfs/ea.c index 45e53d972b42..d8b84d113c89 100644 --- a/fs/hpfs/ea.c +++ b/fs/hpfs/ea.c | |||
@@ -24,7 +24,7 @@ void hpfs_ea_ext_remove(struct super_block *s, secno a, int ano, unsigned len) | |||
24 | } | 24 | } |
25 | if (hpfs_ea_read(s, a, ano, pos, 4, ex)) return; | 25 | if (hpfs_ea_read(s, a, ano, pos, 4, ex)) return; |
26 | if (ea->indirect) { | 26 | if (ea->indirect) { |
27 | if (ea->valuelen != 8) { | 27 | if (ea_valuelen(ea) != 8) { |
28 | hpfs_error(s, "ea->indirect set while ea->valuelen!=8, %s %08x, pos %08x", | 28 | hpfs_error(s, "ea->indirect set while ea->valuelen!=8, %s %08x, pos %08x", |
29 | ano ? "anode" : "sectors", a, pos); | 29 | ano ? "anode" : "sectors", a, pos); |
30 | return; | 30 | return; |
@@ -33,7 +33,7 @@ void hpfs_ea_ext_remove(struct super_block *s, secno a, int ano, unsigned len) | |||
33 | return; | 33 | return; |
34 | hpfs_ea_remove(s, ea_sec(ea), ea->anode, ea_len(ea)); | 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 | if (!ano) hpfs_free_sectors(s, a, (len+511) >> 9); | 38 | if (!ano) hpfs_free_sectors(s, a, (len+511) >> 9); |
39 | else { | 39 | else { |
@@ -76,24 +76,24 @@ int hpfs_read_ea(struct super_block *s, struct fnode *fnode, char *key, | |||
76 | unsigned pos; | 76 | unsigned pos; |
77 | int ano, len; | 77 | int ano, len; |
78 | secno a; | 78 | secno a; |
79 | char ex[4 + 255 + 1 + 8]; | ||
79 | struct extended_attribute *ea; | 80 | struct extended_attribute *ea; |
80 | struct extended_attribute *ea_end = fnode_end_ea(fnode); | 81 | struct extended_attribute *ea_end = fnode_end_ea(fnode); |
81 | for (ea = fnode_ea(fnode); ea < ea_end; ea = next_ea(ea)) | 82 | for (ea = fnode_ea(fnode); ea < ea_end; ea = next_ea(ea)) |
82 | if (!strcmp(ea->name, key)) { | 83 | if (!strcmp(ea->name, key)) { |
83 | if (ea->indirect) | 84 | if (ea->indirect) |
84 | goto indirect; | 85 | goto indirect; |
85 | if (ea->valuelen >= size) | 86 | if (ea_valuelen(ea) >= size) |
86 | return -EINVAL; | 87 | return -EINVAL; |
87 | memcpy(buf, ea_data(ea), ea->valuelen); | 88 | memcpy(buf, ea_data(ea), ea_valuelen(ea)); |
88 | buf[ea->valuelen] = 0; | 89 | buf[ea_valuelen(ea)] = 0; |
89 | return 0; | 90 | return 0; |
90 | } | 91 | } |
91 | a = fnode->ea_secno; | 92 | a = le32_to_cpu(fnode->ea_secno); |
92 | len = fnode->ea_size_l; | 93 | len = le32_to_cpu(fnode->ea_size_l); |
93 | ano = fnode->ea_anode; | 94 | ano = fnode->ea_anode; |
94 | pos = 0; | 95 | pos = 0; |
95 | while (pos < len) { | 96 | while (pos < len) { |
96 | char ex[4 + 255 + 1 + 8]; | ||
97 | ea = (struct extended_attribute *)ex; | 97 | ea = (struct extended_attribute *)ex; |
98 | if (pos + 4 > len) { | 98 | if (pos + 4 > len) { |
99 | hpfs_error(s, "EAs don't end correctly, %s %08x, len %08x", | 99 | hpfs_error(s, "EAs don't end correctly, %s %08x, len %08x", |
@@ -106,14 +106,14 @@ int hpfs_read_ea(struct super_block *s, struct fnode *fnode, char *key, | |||
106 | if (!strcmp(ea->name, key)) { | 106 | if (!strcmp(ea->name, key)) { |
107 | if (ea->indirect) | 107 | if (ea->indirect) |
108 | goto indirect; | 108 | goto indirect; |
109 | if (ea->valuelen >= size) | 109 | if (ea_valuelen(ea) >= size) |
110 | return -EINVAL; | 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 | return -EIO; | 112 | return -EIO; |
113 | buf[ea->valuelen] = 0; | 113 | buf[ea_valuelen(ea)] = 0; |
114 | return 0; | 114 | return 0; |
115 | } | 115 | } |
116 | pos += ea->namelen + ea->valuelen + 5; | 116 | pos += ea->namelen + ea_valuelen(ea) + 5; |
117 | } | 117 | } |
118 | return -ENOENT; | 118 | return -ENOENT; |
119 | indirect: | 119 | indirect: |
@@ -138,16 +138,16 @@ char *hpfs_get_ea(struct super_block *s, struct fnode *fnode, char *key, int *si | |||
138 | if (!strcmp(ea->name, key)) { | 138 | if (!strcmp(ea->name, key)) { |
139 | if (ea->indirect) | 139 | if (ea->indirect) |
140 | return get_indirect_ea(s, ea->anode, ea_sec(ea), *size = ea_len(ea)); | 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 | printk("HPFS: out of memory for EA\n"); | 142 | printk("HPFS: out of memory for EA\n"); |
143 | return NULL; | 143 | return NULL; |
144 | } | 144 | } |
145 | memcpy(ret, ea_data(ea), ea->valuelen); | 145 | memcpy(ret, ea_data(ea), ea_valuelen(ea)); |
146 | ret[ea->valuelen] = 0; | 146 | ret[ea_valuelen(ea)] = 0; |
147 | return ret; | 147 | return ret; |
148 | } | 148 | } |
149 | a = fnode->ea_secno; | 149 | a = le32_to_cpu(fnode->ea_secno); |
150 | len = fnode->ea_size_l; | 150 | len = le32_to_cpu(fnode->ea_size_l); |
151 | ano = fnode->ea_anode; | 151 | ano = fnode->ea_anode; |
152 | pos = 0; | 152 | pos = 0; |
153 | while (pos < len) { | 153 | while (pos < len) { |
@@ -164,18 +164,18 @@ char *hpfs_get_ea(struct super_block *s, struct fnode *fnode, char *key, int *si | |||
164 | if (!strcmp(ea->name, key)) { | 164 | if (!strcmp(ea->name, key)) { |
165 | if (ea->indirect) | 165 | if (ea->indirect) |
166 | return get_indirect_ea(s, ea->anode, ea_sec(ea), *size = ea_len(ea)); | 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 | printk("HPFS: out of memory for EA\n"); | 168 | printk("HPFS: out of memory for EA\n"); |
169 | return NULL; | 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 | kfree(ret); | 172 | kfree(ret); |
173 | return NULL; | 173 | return NULL; |
174 | } | 174 | } |
175 | ret[ea->valuelen] = 0; | 175 | ret[ea_valuelen(ea)] = 0; |
176 | return ret; | 176 | return ret; |
177 | } | 177 | } |
178 | pos += ea->namelen + ea->valuelen + 5; | 178 | pos += ea->namelen + ea_valuelen(ea) + 5; |
179 | } | 179 | } |
180 | return NULL; | 180 | return NULL; |
181 | } | 181 | } |
@@ -202,13 +202,13 @@ void hpfs_set_ea(struct inode *inode, struct fnode *fnode, const char *key, | |||
202 | if (ea->indirect) { | 202 | if (ea->indirect) { |
203 | if (ea_len(ea) == size) | 203 | if (ea_len(ea) == size) |
204 | set_indirect_ea(s, ea->anode, ea_sec(ea), data, size); | 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 | memcpy(ea_data(ea), data, size); | 206 | memcpy(ea_data(ea), data, size); |
207 | } | 207 | } |
208 | return; | 208 | return; |
209 | } | 209 | } |
210 | a = fnode->ea_secno; | 210 | a = le32_to_cpu(fnode->ea_secno); |
211 | len = fnode->ea_size_l; | 211 | len = le32_to_cpu(fnode->ea_size_l); |
212 | ano = fnode->ea_anode; | 212 | ano = fnode->ea_anode; |
213 | pos = 0; | 213 | pos = 0; |
214 | while (pos < len) { | 214 | while (pos < len) { |
@@ -228,68 +228,70 @@ void hpfs_set_ea(struct inode *inode, struct fnode *fnode, const char *key, | |||
228 | set_indirect_ea(s, ea->anode, ea_sec(ea), data, size); | 228 | set_indirect_ea(s, ea->anode, ea_sec(ea), data, size); |
229 | } | 229 | } |
230 | else { | 230 | else { |
231 | if (ea->valuelen == size) | 231 | if (ea_valuelen(ea) == size) |
232 | hpfs_ea_write(s, a, ano, pos + 4 + ea->namelen + 1, size, data); | 232 | hpfs_ea_write(s, a, ano, pos + 4 + ea->namelen + 1, size, data); |
233 | } | 233 | } |
234 | return; | 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) { | 238 | if (!le16_to_cpu(fnode->ea_offs)) { |
239 | /*if (fnode->ea_size_s) { | 239 | /*if (le16_to_cpu(fnode->ea_size_s)) { |
240 | hpfs_error(s, "fnode %08x: ea_size_s == %03x, ea_offs == 0", | 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 | return; | 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 | hpfs_error(s, "fnode %08lx: ea_offs == %03x, ea_size_s == %03x", | 247 | hpfs_error(s, "fnode %08lx: ea_offs == %03x, ea_size_s == %03x", |
248 | (unsigned long)inode->i_ino, | 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 | return; | 250 | return; |
251 | } | 251 | } |
252 | if ((fnode->ea_size_s || !fnode->ea_size_l) && | 252 | if ((le16_to_cpu(fnode->ea_size_s) || !le32_to_cpu(fnode->ea_size_l)) && |
253 | fnode->ea_offs + fnode->acl_size_s + fnode->ea_size_s + strlen(key) + size + 5 <= 0x200) { | 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 | ea = fnode_end_ea(fnode); | 254 | ea = fnode_end_ea(fnode); |
255 | *(char *)ea = 0; | 255 | *(char *)ea = 0; |
256 | ea->namelen = strlen(key); | 256 | ea->namelen = strlen(key); |
257 | ea->valuelen = size; | 257 | ea->valuelen_lo = size; |
258 | ea->valuelen_hi = size >> 8; | ||
258 | strcpy(ea->name, key); | 259 | strcpy(ea->name, key); |
259 | memcpy(ea_data(ea), data, size); | 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 | goto ret; | 262 | goto ret; |
262 | } | 263 | } |
263 | /* Most the code here is 99.9993422% unused. I hope there are no bugs. | 264 | /* Most the code here is 99.9993422% unused. I hope there are no bugs. |
264 | But what .. HPFS.IFS has also bugs in ea management. */ | 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 | secno n; | 267 | secno n; |
267 | struct buffer_head *bh; | 268 | struct buffer_head *bh; |
268 | char *data; | 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 | if (!(data = hpfs_get_sector(s, n, &bh))) { | 271 | if (!(data = hpfs_get_sector(s, n, &bh))) { |
271 | hpfs_free_sectors(s, n, 1); | 272 | hpfs_free_sectors(s, n, 1); |
272 | return; | 273 | return; |
273 | } | 274 | } |
274 | memcpy(data, fnode_ea(fnode), fnode->ea_size_s); | 275 | memcpy(data, fnode_ea(fnode), le16_to_cpu(fnode->ea_size_s)); |
275 | fnode->ea_size_l = fnode->ea_size_s; | 276 | fnode->ea_size_l = cpu_to_le32(le16_to_cpu(fnode->ea_size_s)); |
276 | fnode->ea_size_s = 0; | 277 | fnode->ea_size_s = cpu_to_le16(0); |
277 | fnode->ea_secno = n; | 278 | fnode->ea_secno = cpu_to_le32(n); |
278 | fnode->ea_anode = 0; | 279 | fnode->ea_anode = cpu_to_le32(0); |
279 | mark_buffer_dirty(bh); | 280 | mark_buffer_dirty(bh); |
280 | brelse(bh); | 281 | brelse(bh); |
281 | } | 282 | } |
282 | pos = fnode->ea_size_l + 5 + strlen(key) + size; | 283 | pos = le32_to_cpu(fnode->ea_size_l) + 5 + strlen(key) + size; |
283 | len = (fnode->ea_size_l + 511) >> 9; | 284 | len = (le32_to_cpu(fnode->ea_size_l) + 511) >> 9; |
284 | if (pos >= 30000) goto bail; | 285 | if (pos >= 30000) goto bail; |
285 | while (((pos + 511) >> 9) > len) { | 286 | while (((pos + 511) >> 9) > len) { |
286 | if (!len) { | 287 | if (!len) { |
287 | if (!(fnode->ea_secno = hpfs_alloc_sector(s, fno, 1, 0, 1))) | 288 | secno q = hpfs_alloc_sector(s, fno, 1, 0); |
288 | goto bail; | 289 | if (!q) goto bail; |
290 | fnode->ea_secno = cpu_to_le32(q); | ||
289 | fnode->ea_anode = 0; | 291 | fnode->ea_anode = 0; |
290 | len++; | 292 | len++; |
291 | } else if (!fnode->ea_anode) { | 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 | len++; | 295 | len++; |
294 | } else { | 296 | } else { |
295 | /* Aargh... don't know how to create ea anodes :-( */ | 297 | /* Aargh... don't know how to create ea anodes :-( */ |
@@ -298,26 +300,26 @@ void hpfs_set_ea(struct inode *inode, struct fnode *fnode, const char *key, | |||
298 | anode_secno a_s; | 300 | anode_secno a_s; |
299 | if (!(anode = hpfs_alloc_anode(s, fno, &a_s, &bh))) | 301 | if (!(anode = hpfs_alloc_anode(s, fno, &a_s, &bh))) |
300 | goto bail; | 302 | goto bail; |
301 | anode->up = fno; | 303 | anode->up = cpu_to_le32(fno); |
302 | anode->btree.fnode_parent = 1; | 304 | anode->btree.fnode_parent = 1; |
303 | anode->btree.n_free_nodes--; | 305 | anode->btree.n_free_nodes--; |
304 | anode->btree.n_used_nodes++; | 306 | anode->btree.n_used_nodes++; |
305 | anode->btree.first_free += 12; | 307 | anode->btree.first_free = cpu_to_le16(le16_to_cpu(anode->btree.first_free) + 12); |
306 | anode->u.external[0].disk_secno = fnode->ea_secno; | 308 | anode->u.external[0].disk_secno = cpu_to_le32(le32_to_cpu(fnode->ea_secno)); |
307 | anode->u.external[0].file_secno = 0; | 309 | anode->u.external[0].file_secno = cpu_to_le32(0); |
308 | anode->u.external[0].length = len; | 310 | anode->u.external[0].length = cpu_to_le32(len); |
309 | mark_buffer_dirty(bh); | 311 | mark_buffer_dirty(bh); |
310 | brelse(bh); | 312 | brelse(bh); |
311 | fnode->ea_anode = 1; | 313 | fnode->ea_anode = 1; |
312 | fnode->ea_secno = a_s;*/ | 314 | fnode->ea_secno = cpu_to_le32(a_s);*/ |
313 | secno new_sec; | 315 | secno new_sec; |
314 | int i; | 316 | int i; |
315 | if (!(new_sec = hpfs_alloc_sector(s, fno, 1, 1 - ((pos + 511) >> 9), 1))) | 317 | if (!(new_sec = hpfs_alloc_sector(s, fno, 1, 1 - ((pos + 511) >> 9)))) |
316 | goto bail; | 318 | goto bail; |
317 | for (i = 0; i < len; i++) { | 319 | for (i = 0; i < len; i++) { |
318 | struct buffer_head *bh1, *bh2; | 320 | struct buffer_head *bh1, *bh2; |
319 | void *b1, *b2; | 321 | void *b1, *b2; |
320 | if (!(b1 = hpfs_map_sector(s, fnode->ea_secno + i, &bh1, len - i - 1))) { | 322 | if (!(b1 = hpfs_map_sector(s, le32_to_cpu(fnode->ea_secno) + i, &bh1, len - i - 1))) { |
321 | hpfs_free_sectors(s, new_sec, (pos + 511) >> 9); | 323 | hpfs_free_sectors(s, new_sec, (pos + 511) >> 9); |
322 | goto bail; | 324 | goto bail; |
323 | } | 325 | } |
@@ -331,13 +333,13 @@ void hpfs_set_ea(struct inode *inode, struct fnode *fnode, const char *key, | |||
331 | mark_buffer_dirty(bh2); | 333 | mark_buffer_dirty(bh2); |
332 | brelse(bh2); | 334 | brelse(bh2); |
333 | } | 335 | } |
334 | hpfs_free_sectors(s, fnode->ea_secno, len); | 336 | hpfs_free_sectors(s, le32_to_cpu(fnode->ea_secno), len); |
335 | fnode->ea_secno = new_sec; | 337 | fnode->ea_secno = cpu_to_le32(new_sec); |
336 | len = (pos + 511) >> 9; | 338 | len = (pos + 511) >> 9; |
337 | } | 339 | } |
338 | } | 340 | } |
339 | if (fnode->ea_anode) { | 341 | if (fnode->ea_anode) { |
340 | if (hpfs_add_sector_to_btree(s, fnode->ea_secno, | 342 | if (hpfs_add_sector_to_btree(s, le32_to_cpu(fnode->ea_secno), |
341 | 0, len) != -1) { | 343 | 0, len) != -1) { |
342 | len++; | 344 | len++; |
343 | } else { | 345 | } else { |
@@ -349,17 +351,17 @@ void hpfs_set_ea(struct inode *inode, struct fnode *fnode, const char *key, | |||
349 | h[1] = strlen(key); | 351 | h[1] = strlen(key); |
350 | h[2] = size & 0xff; | 352 | h[2] = size & 0xff; |
351 | h[3] = size >> 8; | 353 | h[3] = size >> 8; |
352 | if (hpfs_ea_write(s, fnode->ea_secno, fnode->ea_anode, fnode->ea_size_l, 4, h)) goto bail; | 354 | 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, fnode->ea_secno, fnode->ea_anode, fnode->ea_size_l + 4, h[1] + 1, key)) goto bail; | 355 | 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, fnode->ea_secno, fnode->ea_anode, fnode->ea_size_l + 5 + h[1], size, data)) goto bail; | 356 | 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 = pos; | 357 | fnode->ea_size_l = cpu_to_le32(pos); |
356 | ret: | 358 | ret: |
357 | hpfs_i(inode)->i_ea_size += 5 + strlen(key) + size; | 359 | hpfs_i(inode)->i_ea_size += 5 + strlen(key) + size; |
358 | return; | 360 | return; |
359 | bail: | 361 | bail: |
360 | if (fnode->ea_secno) | 362 | if (le32_to_cpu(fnode->ea_secno)) |
361 | if (fnode->ea_anode) hpfs_truncate_btree(s, fnode->ea_secno, 1, (fnode->ea_size_l + 511) >> 9); | 363 | 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, fnode->ea_secno + ((fnode->ea_size_l + 511) >> 9), len - ((fnode->ea_size_l + 511) >> 9)); | 364 | 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 = 0; | 365 | else fnode->ea_secno = fnode->ea_size_l = cpu_to_le32(0); |
364 | } | 366 | } |
365 | 367 | ||
diff --git a/fs/hpfs/file.c b/fs/hpfs/file.c index 9b9eb6933e43..89c500ee5213 100644 --- a/fs/hpfs/file.c +++ b/fs/hpfs/file.c | |||
@@ -20,8 +20,8 @@ static int hpfs_file_release(struct inode *inode, struct file *file) | |||
20 | 20 | ||
21 | int hpfs_file_fsync(struct file *file, int datasync) | 21 | int hpfs_file_fsync(struct file *file, int datasync) |
22 | { | 22 | { |
23 | /*return file_fsync(file, datasync);*/ | 23 | struct inode *inode = file->f_mapping->host; |
24 | return 0; /* Don't fsync :-) */ | 24 | return sync_blockdev(inode->i_sb->s_bdev); |
25 | } | 25 | } |
26 | 26 | ||
27 | /* | 27 | /* |
@@ -48,38 +48,46 @@ static secno hpfs_bmap(struct inode *inode, unsigned file_secno) | |||
48 | static void hpfs_truncate(struct inode *i) | 48 | static void hpfs_truncate(struct inode *i) |
49 | { | 49 | { |
50 | if (IS_IMMUTABLE(i)) return /*-EPERM*/; | 50 | if (IS_IMMUTABLE(i)) return /*-EPERM*/; |
51 | hpfs_lock(i->i_sb); | 51 | hpfs_lock_assert(i->i_sb); |
52 | |||
52 | hpfs_i(i)->i_n_secs = 0; | 53 | hpfs_i(i)->i_n_secs = 0; |
53 | i->i_blocks = 1 + ((i->i_size + 511) >> 9); | 54 | i->i_blocks = 1 + ((i->i_size + 511) >> 9); |
54 | hpfs_i(i)->mmu_private = i->i_size; | 55 | hpfs_i(i)->mmu_private = i->i_size; |
55 | hpfs_truncate_btree(i->i_sb, i->i_ino, 1, ((i->i_size + 511) >> 9)); | 56 | hpfs_truncate_btree(i->i_sb, i->i_ino, 1, ((i->i_size + 511) >> 9)); |
56 | hpfs_write_inode(i); | 57 | hpfs_write_inode(i); |
57 | hpfs_i(i)->i_n_secs = 0; | 58 | hpfs_i(i)->i_n_secs = 0; |
58 | hpfs_unlock(i->i_sb); | ||
59 | } | 59 | } |
60 | 60 | ||
61 | static int hpfs_get_block(struct inode *inode, sector_t iblock, struct buffer_head *bh_result, int create) | 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 | secno s; | 64 | secno s; |
65 | hpfs_lock(inode->i_sb); | ||
64 | s = hpfs_bmap(inode, iblock); | 66 | s = hpfs_bmap(inode, iblock); |
65 | if (s) { | 67 | if (s) { |
66 | map_bh(bh_result, inode->i_sb, s); | 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 | if (iblock<<9 != hpfs_i(inode)->mmu_private) { | 72 | if (iblock<<9 != hpfs_i(inode)->mmu_private) { |
71 | BUG(); | 73 | BUG(); |
72 | return -EIO; | 74 | r = -EIO; |
75 | goto ret_r; | ||
73 | } | 76 | } |
74 | if ((s = hpfs_add_sector_to_btree(inode->i_sb, inode->i_ino, 1, inode->i_blocks - 1)) == -1) { | 77 | if ((s = hpfs_add_sector_to_btree(inode->i_sb, inode->i_ino, 1, inode->i_blocks - 1)) == -1) { |
75 | hpfs_truncate_btree(inode->i_sb, inode->i_ino, 1, inode->i_blocks - 1); | 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 | inode->i_blocks++; | 82 | inode->i_blocks++; |
79 | hpfs_i(inode)->mmu_private += 512; | 83 | hpfs_i(inode)->mmu_private += 512; |
80 | set_buffer_new(bh_result); | 84 | set_buffer_new(bh_result); |
81 | map_bh(bh_result, inode->i_sb, s); | 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 | static int hpfs_writepage(struct page *page, struct writeback_control *wbc) | 93 | static int hpfs_writepage(struct page *page, struct writeback_control *wbc) |
@@ -130,8 +138,11 @@ static ssize_t hpfs_file_write(struct file *file, const char __user *buf, | |||
130 | ssize_t retval; | 138 | ssize_t retval; |
131 | 139 | ||
132 | retval = do_sync_write(file, buf, count, ppos); | 140 | retval = do_sync_write(file, buf, count, ppos); |
133 | if (retval > 0) | 141 | if (retval > 0) { |
142 | hpfs_lock(file->f_path.dentry->d_sb); | ||
134 | hpfs_i(file->f_path.dentry->d_inode)->i_dirty = 1; | 143 | hpfs_i(file->f_path.dentry->d_inode)->i_dirty = 1; |
144 | hpfs_unlock(file->f_path.dentry->d_sb); | ||
145 | } | ||
135 | return retval; | 146 | return retval; |
136 | } | 147 | } |
137 | 148 | ||
diff --git a/fs/hpfs/hpfs.h b/fs/hpfs/hpfs.h index 0e84c73cd9c4..8b0650aae328 100644 --- a/fs/hpfs/hpfs.h +++ b/fs/hpfs/hpfs.h | |||
@@ -19,9 +19,13 @@ | |||
19 | For definitive information on HPFS, ask somebody else -- this is guesswork. | 19 | For definitive information on HPFS, ask somebody else -- this is guesswork. |
20 | There are certain to be many mistakes. */ | 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 | /* Notation */ | 26 | /* Notation */ |
23 | 27 | ||
24 | typedef unsigned secno; /* sector number, partition relative */ | 28 | typedef u32 secno; /* sector number, partition relative */ |
25 | 29 | ||
26 | typedef secno dnode_secno; /* sector number of a dnode */ | 30 | typedef secno dnode_secno; /* sector number of a dnode */ |
27 | typedef secno fnode_secno; /* sector number of an fnode */ | 31 | typedef secno fnode_secno; /* sector number of an fnode */ |
@@ -38,28 +42,28 @@ typedef u32 time32_t; /* 32-bit time_t type */ | |||
38 | 42 | ||
39 | struct hpfs_boot_block | 43 | struct hpfs_boot_block |
40 | { | 44 | { |
41 | unsigned char jmp[3]; | 45 | u8 jmp[3]; |
42 | unsigned char oem_id[8]; | 46 | u8 oem_id[8]; |
43 | unsigned char bytes_per_sector[2]; /* 512 */ | 47 | u8 bytes_per_sector[2]; /* 512 */ |
44 | unsigned char sectors_per_cluster; | 48 | u8 sectors_per_cluster; |
45 | unsigned char n_reserved_sectors[2]; | 49 | u8 n_reserved_sectors[2]; |
46 | unsigned char n_fats; | 50 | u8 n_fats; |
47 | unsigned char n_rootdir_entries[2]; | 51 | u8 n_rootdir_entries[2]; |
48 | unsigned char n_sectors_s[2]; | 52 | u8 n_sectors_s[2]; |
49 | unsigned char media_byte; | 53 | u8 media_byte; |
50 | unsigned short sectors_per_fat; | 54 | u16 sectors_per_fat; |
51 | unsigned short sectors_per_track; | 55 | u16 sectors_per_track; |
52 | unsigned short heads_per_cyl; | 56 | u16 heads_per_cyl; |
53 | unsigned int n_hidden_sectors; | 57 | u32 n_hidden_sectors; |
54 | unsigned int n_sectors_l; /* size of partition */ | 58 | u32 n_sectors_l; /* size of partition */ |
55 | unsigned char drive_number; | 59 | u8 drive_number; |
56 | unsigned char mbz; | 60 | u8 mbz; |
57 | unsigned char sig_28h; /* 28h */ | 61 | u8 sig_28h; /* 28h */ |
58 | unsigned char vol_serno[4]; | 62 | u8 vol_serno[4]; |
59 | unsigned char vol_label[11]; | 63 | u8 vol_label[11]; |
60 | unsigned char sig_hpfs[8]; /* "HPFS " */ | 64 | u8 sig_hpfs[8]; /* "HPFS " */ |
61 | unsigned char pad[448]; | 65 | u8 pad[448]; |
62 | unsigned short magic; /* aa55 */ | 66 | u16 magic; /* aa55 */ |
63 | }; | 67 | }; |
64 | 68 | ||
65 | 69 | ||
@@ -71,31 +75,29 @@ struct hpfs_boot_block | |||
71 | 75 | ||
72 | struct hpfs_super_block | 76 | struct hpfs_super_block |
73 | { | 77 | { |
74 | unsigned magic; /* f995 e849 */ | 78 | u32 magic; /* f995 e849 */ |
75 | unsigned magic1; /* fa53 e9c5, more magic? */ | 79 | u32 magic1; /* fa53 e9c5, more magic? */ |
76 | /*unsigned huh202;*/ /* ?? 202 = N. of B. in 1.00390625 S.*/ | 80 | u8 version; /* version of a filesystem usually 2 */ |
77 | char version; /* version of a filesystem usually 2 */ | 81 | u8 funcversion; /* functional version - oldest version |
78 | char funcversion; /* functional version - oldest version | ||
79 | of filesystem that can understand | 82 | of filesystem that can understand |
80 | this disk */ | 83 | this disk */ |
81 | unsigned short int zero; /* 0 */ | 84 | u16 zero; /* 0 */ |
82 | fnode_secno root; /* fnode of root directory */ | 85 | fnode_secno root; /* fnode of root directory */ |
83 | secno n_sectors; /* size of filesystem */ | 86 | secno n_sectors; /* size of filesystem */ |
84 | unsigned n_badblocks; /* number of bad blocks */ | 87 | u32 n_badblocks; /* number of bad blocks */ |
85 | secno bitmaps; /* pointers to free space bit maps */ | 88 | secno bitmaps; /* pointers to free space bit maps */ |
86 | unsigned zero1; /* 0 */ | 89 | u32 zero1; /* 0 */ |
87 | secno badblocks; /* bad block list */ | 90 | secno badblocks; /* bad block list */ |
88 | unsigned zero3; /* 0 */ | 91 | u32 zero3; /* 0 */ |
89 | time32_t last_chkdsk; /* date last checked, 0 if never */ | 92 | time32_t last_chkdsk; /* date last checked, 0 if never */ |
90 | /*unsigned zero4;*/ /* 0 */ | 93 | time32_t last_optimize; /* date last optimized, 0 if never */ |
91 | time32_t last_optimize; /* date last optimized, 0 if never */ | ||
92 | secno n_dir_band; /* number of sectors in dir band */ | 94 | secno n_dir_band; /* number of sectors in dir band */ |
93 | secno dir_band_start; /* first sector in dir band */ | 95 | secno dir_band_start; /* first sector in dir band */ |
94 | secno dir_band_end; /* last sector in dir band */ | 96 | secno dir_band_end; /* last sector in dir band */ |
95 | secno dir_band_bitmap; /* free space map, 1 dnode per bit */ | 97 | secno dir_band_bitmap; /* free space map, 1 dnode per bit */ |
96 | char volume_name[32]; /* not used */ | 98 | u8 volume_name[32]; /* not used */ |
97 | secno user_id_table; /* 8 preallocated sectors - user id */ | 99 | secno user_id_table; /* 8 preallocated sectors - user id */ |
98 | unsigned zero6[103]; /* 0 */ | 100 | u32 zero6[103]; /* 0 */ |
99 | }; | 101 | }; |
100 | 102 | ||
101 | 103 | ||
@@ -107,44 +109,65 @@ struct hpfs_super_block | |||
107 | 109 | ||
108 | struct hpfs_spare_block | 110 | struct hpfs_spare_block |
109 | { | 111 | { |
110 | unsigned magic; /* f991 1849 */ | 112 | u32 magic; /* f991 1849 */ |
111 | unsigned magic1; /* fa52 29c5, more magic? */ | 113 | u32 magic1; /* fa52 29c5, more magic? */ |
112 | 114 | ||
113 | unsigned dirty: 1; /* 0 clean, 1 "improperly stopped" */ | 115 | #ifdef __LITTLE_ENDIAN |
114 | /*unsigned flag1234: 4;*/ /* unknown flags */ | 116 | u8 dirty: 1; /* 0 clean, 1 "improperly stopped" */ |
115 | unsigned sparedir_used: 1; /* spare dirblks used */ | 117 | u8 sparedir_used: 1; /* spare dirblks used */ |
116 | unsigned hotfixes_used: 1; /* hotfixes used */ | 118 | u8 hotfixes_used: 1; /* hotfixes used */ |
117 | unsigned bad_sector: 1; /* bad sector, corrupted disk (???) */ | 119 | u8 bad_sector: 1; /* bad sector, corrupted disk (???) */ |
118 | unsigned bad_bitmap: 1; /* bad bitmap */ | 120 | u8 bad_bitmap: 1; /* bad bitmap */ |
119 | unsigned fast: 1; /* partition was fast formatted */ | 121 | u8 fast: 1; /* partition was fast formatted */ |
120 | unsigned old_wrote: 1; /* old version wrote to partion */ | 122 | u8 old_wrote: 1; /* old version wrote to partion */ |
121 | unsigned old_wrote_1: 1; /* old version wrote to partion (?) */ | 123 | u8 old_wrote_1: 1; /* old version wrote to partion (?) */ |
122 | unsigned install_dasd_limits: 1; /* HPFS386 flags */ | 124 | #else |
123 | unsigned resynch_dasd_limits: 1; | 125 | u8 old_wrote_1: 1; /* old version wrote to partion (?) */ |
124 | unsigned dasd_limits_operational: 1; | 126 | u8 old_wrote: 1; /* old version wrote to partion */ |
125 | unsigned multimedia_active: 1; | 127 | u8 fast: 1; /* partition was fast formatted */ |
126 | unsigned dce_acls_active: 1; | 128 | u8 bad_bitmap: 1; /* bad bitmap */ |
127 | unsigned dasd_limits_dirty: 1; | 129 | u8 bad_sector: 1; /* bad sector, corrupted disk (???) */ |
128 | unsigned flag67: 2; | 130 | u8 hotfixes_used: 1; /* hotfixes used */ |
129 | unsigned char mm_contlgulty; | 131 | u8 sparedir_used: 1; /* spare dirblks used */ |
130 | unsigned char unused; | 132 | u8 dirty: 1; /* 0 clean, 1 "improperly stopped" */ |
133 | #endif | ||
134 | |||
135 | #ifdef __LITTLE_ENDIAN | ||
136 | u8 install_dasd_limits: 1; /* HPFS386 flags */ | ||
137 | u8 resynch_dasd_limits: 1; | ||
138 | u8 dasd_limits_operational: 1; | ||
139 | u8 multimedia_active: 1; | ||
140 | u8 dce_acls_active: 1; | ||
141 | u8 dasd_limits_dirty: 1; | ||
142 | u8 flag67: 2; | ||
143 | #else | ||
144 | u8 flag67: 2; | ||
145 | u8 dasd_limits_dirty: 1; | ||
146 | u8 dce_acls_active: 1; | ||
147 | u8 multimedia_active: 1; | ||
148 | u8 dasd_limits_operational: 1; | ||
149 | u8 resynch_dasd_limits: 1; | ||
150 | u8 install_dasd_limits: 1; /* HPFS386 flags */ | ||
151 | #endif | ||
152 | |||
153 | u8 mm_contlgulty; | ||
154 | u8 unused; | ||
131 | 155 | ||
132 | secno hotfix_map; /* info about remapped bad sectors */ | 156 | secno hotfix_map; /* info about remapped bad sectors */ |
133 | unsigned n_spares_used; /* number of hotfixes */ | 157 | u32 n_spares_used; /* number of hotfixes */ |
134 | unsigned n_spares; /* number of spares in hotfix map */ | 158 | u32 n_spares; /* number of spares in hotfix map */ |
135 | unsigned n_dnode_spares_free; /* spare dnodes unused */ | 159 | u32 n_dnode_spares_free; /* spare dnodes unused */ |
136 | unsigned n_dnode_spares; /* length of spare_dnodes[] list, | 160 | u32 n_dnode_spares; /* length of spare_dnodes[] list, |
137 | follows in this block*/ | 161 | follows in this block*/ |
138 | secno code_page_dir; /* code page directory block */ | 162 | secno code_page_dir; /* code page directory block */ |
139 | unsigned n_code_pages; /* number of code pages */ | 163 | u32 n_code_pages; /* number of code pages */ |
140 | /*unsigned large_numbers[2];*/ /* ?? */ | 164 | u32 super_crc; /* on HPFS386 and LAN Server this is |
141 | unsigned super_crc; /* on HPFS386 and LAN Server this is | ||
142 | checksum of superblock, on normal | 165 | checksum of superblock, on normal |
143 | OS/2 unused */ | 166 | OS/2 unused */ |
144 | unsigned spare_crc; /* on HPFS386 checksum of spareblock */ | 167 | u32 spare_crc; /* on HPFS386 checksum of spareblock */ |
145 | unsigned zero1[15]; /* unused */ | 168 | u32 zero1[15]; /* unused */ |
146 | dnode_secno spare_dnodes[100]; /* emergency free dnode list */ | 169 | dnode_secno spare_dnodes[100]; /* emergency free dnode list */ |
147 | unsigned zero2[1]; /* room for more? */ | 170 | u32 zero2[1]; /* room for more? */ |
148 | }; | 171 | }; |
149 | 172 | ||
150 | /* The bad block list is 4 sectors long. The first word must be zero, | 173 | /* The bad block list is 4 sectors long. The first word must be zero, |
@@ -179,18 +202,18 @@ struct hpfs_spare_block | |||
179 | 202 | ||
180 | struct code_page_directory | 203 | struct code_page_directory |
181 | { | 204 | { |
182 | unsigned magic; /* 4945 21f7 */ | 205 | u32 magic; /* 4945 21f7 */ |
183 | unsigned n_code_pages; /* number of pointers following */ | 206 | u32 n_code_pages; /* number of pointers following */ |
184 | unsigned zero1[2]; | 207 | u32 zero1[2]; |
185 | struct { | 208 | struct { |
186 | unsigned short ix; /* index */ | 209 | u16 ix; /* index */ |
187 | unsigned short code_page_number; /* code page number */ | 210 | u16 code_page_number; /* code page number */ |
188 | unsigned bounds; /* matches corresponding word | 211 | u32 bounds; /* matches corresponding word |
189 | in data block */ | 212 | in data block */ |
190 | secno code_page_data; /* sector number of a code_page_data | 213 | secno code_page_data; /* sector number of a code_page_data |
191 | containing c.p. array */ | 214 | containing c.p. array */ |
192 | unsigned short index; /* index in c.p. array in that sector*/ | 215 | u16 index; /* index in c.p. array in that sector*/ |
193 | unsigned short unknown; /* some unknown value; usually 0; | 216 | u16 unknown; /* some unknown value; usually 0; |
194 | 2 in Japanese version */ | 217 | 2 in Japanese version */ |
195 | } array[31]; /* unknown length */ | 218 | } array[31]; /* unknown length */ |
196 | }; | 219 | }; |
@@ -201,21 +224,21 @@ struct code_page_directory | |||
201 | 224 | ||
202 | struct code_page_data | 225 | struct code_page_data |
203 | { | 226 | { |
204 | unsigned magic; /* 8945 21f7 */ | 227 | u32 magic; /* 8945 21f7 */ |
205 | unsigned n_used; /* # elements used in c_p_data[] */ | 228 | u32 n_used; /* # elements used in c_p_data[] */ |
206 | unsigned bounds[3]; /* looks a bit like | 229 | u32 bounds[3]; /* looks a bit like |
207 | (beg1,end1), (beg2,end2) | 230 | (beg1,end1), (beg2,end2) |
208 | one byte each */ | 231 | one byte each */ |
209 | unsigned short offs[3]; /* offsets from start of sector | 232 | u16 offs[3]; /* offsets from start of sector |
210 | to start of c_p_data[ix] */ | 233 | to start of c_p_data[ix] */ |
211 | struct { | 234 | struct { |
212 | unsigned short ix; /* index */ | 235 | u16 ix; /* index */ |
213 | unsigned short code_page_number; /* code page number */ | 236 | u16 code_page_number; /* code page number */ |
214 | unsigned short unknown; /* the same as in cp directory */ | 237 | u16 unknown; /* the same as in cp directory */ |
215 | unsigned char map[128]; /* upcase table for chars 80..ff */ | 238 | u8 map[128]; /* upcase table for chars 80..ff */ |
216 | unsigned short zero2; | 239 | u16 zero2; |
217 | } code_page[3]; | 240 | } code_page[3]; |
218 | unsigned char incognita[78]; | 241 | u8 incognita[78]; |
219 | }; | 242 | }; |
220 | 243 | ||
221 | 244 | ||
@@ -255,50 +278,84 @@ struct code_page_data | |||
255 | #define DNODE_MAGIC 0x77e40aae | 278 | #define DNODE_MAGIC 0x77e40aae |
256 | 279 | ||
257 | struct dnode { | 280 | struct dnode { |
258 | unsigned magic; /* 77e4 0aae */ | 281 | u32 magic; /* 77e4 0aae */ |
259 | unsigned first_free; /* offset from start of dnode to | 282 | u32 first_free; /* offset from start of dnode to |
260 | first free dir entry */ | 283 | first free dir entry */ |
261 | unsigned root_dnode:1; /* Is it root dnode? */ | 284 | #ifdef __LITTLE_ENDIAN |
262 | unsigned increment_me:31; /* some kind of activity counter? | 285 | u8 root_dnode: 1; /* Is it root dnode? */ |
263 | Neither HPFS.IFS nor CHKDSK cares | 286 | u8 increment_me: 7; /* some kind of activity counter? */ |
287 | /* Neither HPFS.IFS nor CHKDSK cares | ||
288 | if you change this word */ | ||
289 | #else | ||
290 | u8 increment_me: 7; /* some kind of activity counter? */ | ||
291 | /* Neither HPFS.IFS nor CHKDSK cares | ||
264 | if you change this word */ | 292 | if you change this word */ |
293 | u8 root_dnode: 1; /* Is it root dnode? */ | ||
294 | #endif | ||
295 | u8 increment_me2[3]; | ||
265 | secno up; /* (root dnode) directory's fnode | 296 | secno up; /* (root dnode) directory's fnode |
266 | (nonroot) parent dnode */ | 297 | (nonroot) parent dnode */ |
267 | dnode_secno self; /* pointer to this dnode */ | 298 | dnode_secno self; /* pointer to this dnode */ |
268 | unsigned char dirent[2028]; /* one or more dirents */ | 299 | u8 dirent[2028]; /* one or more dirents */ |
269 | }; | 300 | }; |
270 | 301 | ||
271 | struct hpfs_dirent { | 302 | struct hpfs_dirent { |
272 | unsigned short length; /* offset to next dirent */ | 303 | u16 length; /* offset to next dirent */ |
273 | unsigned first: 1; /* set on phony ^A^A (".") entry */ | 304 | |
274 | unsigned has_acl: 1; | 305 | #ifdef __LITTLE_ENDIAN |
275 | unsigned down: 1; /* down pointer present (after name) */ | 306 | u8 first: 1; /* set on phony ^A^A (".") entry */ |
276 | unsigned last: 1; /* set on phony \377 entry */ | 307 | u8 has_acl: 1; |
277 | unsigned has_ea: 1; /* entry has EA */ | 308 | u8 down: 1; /* down pointer present (after name) */ |
278 | unsigned has_xtd_perm: 1; /* has extended perm list (???) */ | 309 | u8 last: 1; /* set on phony \377 entry */ |
279 | unsigned has_explicit_acl: 1; | 310 | u8 has_ea: 1; /* entry has EA */ |
280 | unsigned has_needea: 1; /* ?? some EA has NEEDEA set | 311 | u8 has_xtd_perm: 1; /* has extended perm list (???) */ |
312 | u8 has_explicit_acl: 1; | ||
313 | u8 has_needea: 1; /* ?? some EA has NEEDEA set | ||
314 | I have no idea why this is | ||
315 | interesting in a dir entry */ | ||
316 | #else | ||
317 | u8 has_needea: 1; /* ?? some EA has NEEDEA set | ||
281 | I have no idea why this is | 318 | I have no idea why this is |
282 | interesting in a dir entry */ | 319 | interesting in a dir entry */ |
283 | unsigned read_only: 1; /* dos attrib */ | 320 | u8 has_explicit_acl: 1; |
284 | unsigned hidden: 1; /* dos attrib */ | 321 | u8 has_xtd_perm: 1; /* has extended perm list (???) */ |
285 | unsigned system: 1; /* dos attrib */ | 322 | u8 has_ea: 1; /* entry has EA */ |
286 | unsigned flag11: 1; /* would be volume label dos attrib */ | 323 | u8 last: 1; /* set on phony \377 entry */ |
287 | unsigned directory: 1; /* dos attrib */ | 324 | u8 down: 1; /* down pointer present (after name) */ |
288 | unsigned archive: 1; /* dos attrib */ | 325 | u8 has_acl: 1; |
289 | unsigned not_8x3: 1; /* name is not 8.3 */ | 326 | u8 first: 1; /* set on phony ^A^A (".") entry */ |
290 | unsigned flag15: 1; | 327 | #endif |
328 | |||
329 | #ifdef __LITTLE_ENDIAN | ||
330 | u8 read_only: 1; /* dos attrib */ | ||
331 | u8 hidden: 1; /* dos attrib */ | ||
332 | u8 system: 1; /* dos attrib */ | ||
333 | u8 flag11: 1; /* would be volume label dos attrib */ | ||
334 | u8 directory: 1; /* dos attrib */ | ||
335 | u8 archive: 1; /* dos attrib */ | ||
336 | u8 not_8x3: 1; /* name is not 8.3 */ | ||
337 | u8 flag15: 1; | ||
338 | #else | ||
339 | u8 flag15: 1; | ||
340 | u8 not_8x3: 1; /* name is not 8.3 */ | ||
341 | u8 archive: 1; /* dos attrib */ | ||
342 | u8 directory: 1; /* dos attrib */ | ||
343 | u8 flag11: 1; /* would be volume label dos attrib */ | ||
344 | u8 system: 1; /* dos attrib */ | ||
345 | u8 hidden: 1; /* dos attrib */ | ||
346 | u8 read_only: 1; /* dos attrib */ | ||
347 | #endif | ||
348 | |||
291 | fnode_secno fnode; /* fnode giving allocation info */ | 349 | fnode_secno fnode; /* fnode giving allocation info */ |
292 | time32_t write_date; /* mtime */ | 350 | time32_t write_date; /* mtime */ |
293 | unsigned file_size; /* file length, bytes */ | 351 | u32 file_size; /* file length, bytes */ |
294 | time32_t read_date; /* atime */ | 352 | time32_t read_date; /* atime */ |
295 | time32_t creation_date; /* ctime */ | 353 | time32_t creation_date; /* ctime */ |
296 | unsigned ea_size; /* total EA length, bytes */ | 354 | u32 ea_size; /* total EA length, bytes */ |
297 | unsigned char no_of_acls : 3; /* number of ACL's */ | 355 | u8 no_of_acls; /* number of ACL's (low 3 bits) */ |
298 | unsigned char reserver : 5; | 356 | u8 ix; /* code page index (of filename), see |
299 | unsigned char ix; /* code page index (of filename), see | ||
300 | struct code_page_data */ | 357 | struct code_page_data */ |
301 | unsigned char namelen, name[1]; /* file name */ | 358 | u8 namelen, name[1]; /* file name */ |
302 | /* dnode_secno down; btree down pointer, if present, | 359 | /* dnode_secno down; btree down pointer, if present, |
303 | follows name on next word boundary, or maybe it | 360 | follows name on next word boundary, or maybe it |
304 | precedes next dirent, which is on a word boundary. */ | 361 | precedes next dirent, which is on a word boundary. */ |
@@ -318,38 +375,50 @@ struct hpfs_dirent { | |||
318 | 375 | ||
319 | struct bplus_leaf_node | 376 | struct bplus_leaf_node |
320 | { | 377 | { |
321 | unsigned file_secno; /* first file sector in extent */ | 378 | u32 file_secno; /* first file sector in extent */ |
322 | unsigned length; /* length, sectors */ | 379 | u32 length; /* length, sectors */ |
323 | secno disk_secno; /* first corresponding disk sector */ | 380 | secno disk_secno; /* first corresponding disk sector */ |
324 | }; | 381 | }; |
325 | 382 | ||
326 | struct bplus_internal_node | 383 | struct bplus_internal_node |
327 | { | 384 | { |
328 | unsigned file_secno; /* subtree maps sectors < this */ | 385 | u32 file_secno; /* subtree maps sectors < this */ |
329 | anode_secno down; /* pointer to subtree */ | 386 | anode_secno down; /* pointer to subtree */ |
330 | }; | 387 | }; |
331 | 388 | ||
332 | struct bplus_header | 389 | struct bplus_header |
333 | { | 390 | { |
334 | unsigned hbff: 1; /* high bit of first free entry offset */ | 391 | #ifdef __LITTLE_ENDIAN |
335 | unsigned flag1: 1; | 392 | u8 hbff: 1; /* high bit of first free entry offset */ |
336 | unsigned flag2: 1; | 393 | u8 flag1234: 4; |
337 | unsigned flag3: 1; | 394 | u8 fnode_parent: 1; /* ? we're pointed to by an fnode, |
338 | unsigned flag4: 1; | ||
339 | unsigned fnode_parent: 1; /* ? we're pointed to by an fnode, | ||
340 | the data btree or some ea or the | 395 | the data btree or some ea or the |
341 | main ea bootage pointer ea_secno */ | 396 | main ea bootage pointer ea_secno */ |
342 | /* also can get set in fnodes, which | 397 | /* also can get set in fnodes, which |
343 | may be a chkdsk glitch or may mean | 398 | may be a chkdsk glitch or may mean |
344 | this bit is irrelevant in fnodes, | 399 | this bit is irrelevant in fnodes, |
345 | or this interpretation is all wet */ | 400 | or this interpretation is all wet */ |
346 | unsigned binary_search: 1; /* suggest binary search (unused) */ | 401 | u8 binary_search: 1; /* suggest binary search (unused) */ |
347 | unsigned internal: 1; /* 1 -> (internal) tree of anodes | 402 | u8 internal: 1; /* 1 -> (internal) tree of anodes |
403 | 0 -> (leaf) list of extents */ | ||
404 | #else | ||
405 | u8 internal: 1; /* 1 -> (internal) tree of anodes | ||
348 | 0 -> (leaf) list of extents */ | 406 | 0 -> (leaf) list of extents */ |
349 | unsigned char fill[3]; | 407 | u8 binary_search: 1; /* suggest binary search (unused) */ |
350 | unsigned char n_free_nodes; /* free nodes in following array */ | 408 | u8 fnode_parent: 1; /* ? we're pointed to by an fnode, |
351 | unsigned char n_used_nodes; /* used nodes in following array */ | 409 | the data btree or some ea or the |
352 | unsigned short first_free; /* offset from start of header to | 410 | main ea bootage pointer ea_secno */ |
411 | /* also can get set in fnodes, which | ||
412 | may be a chkdsk glitch or may mean | ||
413 | this bit is irrelevant in fnodes, | ||
414 | or this interpretation is all wet */ | ||
415 | u8 flag1234: 4; | ||
416 | u8 hbff: 1; /* high bit of first free entry offset */ | ||
417 | #endif | ||
418 | u8 fill[3]; | ||
419 | u8 n_free_nodes; /* free nodes in following array */ | ||
420 | u8 n_used_nodes; /* used nodes in following array */ | ||
421 | u16 first_free; /* offset from start of header to | ||
353 | first free node in array */ | 422 | first free node in array */ |
354 | union { | 423 | union { |
355 | struct bplus_internal_node internal[0]; /* (internal) 2-word entries giving | 424 | struct bplus_internal_node internal[0]; /* (internal) 2-word entries giving |
@@ -369,37 +438,38 @@ struct bplus_header | |||
369 | 438 | ||
370 | struct fnode | 439 | struct fnode |
371 | { | 440 | { |
372 | unsigned magic; /* f7e4 0aae */ | 441 | u32 magic; /* f7e4 0aae */ |
373 | unsigned zero1[2]; /* read history */ | 442 | u32 zero1[2]; /* read history */ |
374 | unsigned char len, name[15]; /* true length, truncated name */ | 443 | u8 len, name[15]; /* true length, truncated name */ |
375 | fnode_secno up; /* pointer to file's directory fnode */ | 444 | fnode_secno up; /* pointer to file's directory fnode */ |
376 | /*unsigned zero2[3];*/ | ||
377 | secno acl_size_l; | 445 | secno acl_size_l; |
378 | secno acl_secno; | 446 | secno acl_secno; |
379 | unsigned short acl_size_s; | 447 | u16 acl_size_s; |
380 | char acl_anode; | 448 | u8 acl_anode; |
381 | char zero2; /* history bit count */ | 449 | u8 zero2; /* history bit count */ |
382 | unsigned ea_size_l; /* length of disk-resident ea's */ | 450 | u32 ea_size_l; /* length of disk-resident ea's */ |
383 | secno ea_secno; /* first sector of disk-resident ea's*/ | 451 | secno ea_secno; /* first sector of disk-resident ea's*/ |
384 | unsigned short ea_size_s; /* length of fnode-resident ea's */ | 452 | u16 ea_size_s; /* length of fnode-resident ea's */ |
385 | 453 | ||
386 | unsigned flag0: 1; | 454 | #ifdef __LITTLE_ENDIAN |
387 | unsigned ea_anode: 1; /* 1 -> ea_secno is an anode */ | 455 | u8 flag0: 1; |
388 | unsigned flag2: 1; | 456 | u8 ea_anode: 1; /* 1 -> ea_secno is an anode */ |
389 | unsigned flag3: 1; | 457 | u8 flag234567: 6; |
390 | unsigned flag4: 1; | 458 | #else |
391 | unsigned flag5: 1; | 459 | u8 flag234567: 6; |
392 | unsigned flag6: 1; | 460 | u8 ea_anode: 1; /* 1 -> ea_secno is an anode */ |
393 | unsigned flag7: 1; | 461 | u8 flag0: 1; |
394 | unsigned dirflag: 1; /* 1 -> directory. first & only extent | 462 | #endif |
463 | |||
464 | #ifdef __LITTLE_ENDIAN | ||
465 | u8 dirflag: 1; /* 1 -> directory. first & only extent | ||
395 | points to dnode. */ | 466 | points to dnode. */ |
396 | unsigned flag9: 1; | 467 | u8 flag9012345: 7; |
397 | unsigned flag10: 1; | 468 | #else |
398 | unsigned flag11: 1; | 469 | u8 flag9012345: 7; |
399 | unsigned flag12: 1; | 470 | u8 dirflag: 1; /* 1 -> directory. first & only extent |
400 | unsigned flag13: 1; | 471 | points to dnode. */ |
401 | unsigned flag14: 1; | 472 | #endif |
402 | unsigned flag15: 1; | ||
403 | 473 | ||
404 | struct bplus_header btree; /* b+ tree, 8 extents or 12 subtrees */ | 474 | struct bplus_header btree; /* b+ tree, 8 extents or 12 subtrees */ |
405 | union { | 475 | union { |
@@ -407,17 +477,16 @@ struct fnode | |||
407 | struct bplus_internal_node internal[12]; | 477 | struct bplus_internal_node internal[12]; |
408 | } u; | 478 | } u; |
409 | 479 | ||
410 | unsigned file_size; /* file length, bytes */ | 480 | u32 file_size; /* file length, bytes */ |
411 | unsigned n_needea; /* number of EA's with NEEDEA set */ | 481 | u32 n_needea; /* number of EA's with NEEDEA set */ |
412 | char user_id[16]; /* unused */ | 482 | u8 user_id[16]; /* unused */ |
413 | unsigned short ea_offs; /* offset from start of fnode | 483 | u16 ea_offs; /* offset from start of fnode |
414 | to first fnode-resident ea */ | 484 | to first fnode-resident ea */ |
415 | char dasd_limit_treshhold; | 485 | u8 dasd_limit_treshhold; |
416 | char dasd_limit_delta; | 486 | u8 dasd_limit_delta; |
417 | unsigned dasd_limit; | 487 | u32 dasd_limit; |
418 | unsigned dasd_usage; | 488 | u32 dasd_usage; |
419 | /*unsigned zero5[2];*/ | 489 | u8 ea[316]; /* zero or more EA's, packed together |
420 | unsigned char ea[316]; /* zero or more EA's, packed together | ||
421 | with no alignment padding. | 490 | with no alignment padding. |
422 | (Do not use this name, get here | 491 | (Do not use this name, get here |
423 | via fnode + ea_offs. I think.) */ | 492 | via fnode + ea_offs. I think.) */ |
@@ -430,7 +499,7 @@ struct fnode | |||
430 | 499 | ||
431 | struct anode | 500 | struct anode |
432 | { | 501 | { |
433 | unsigned magic; /* 37e4 0aae */ | 502 | u32 magic; /* 37e4 0aae */ |
434 | anode_secno self; /* pointer to this anode */ | 503 | anode_secno self; /* pointer to this anode */ |
435 | secno up; /* parent anode or fnode */ | 504 | secno up; /* parent anode or fnode */ |
436 | 505 | ||
@@ -440,7 +509,7 @@ struct anode | |||
440 | struct bplus_internal_node internal[60]; | 509 | struct bplus_internal_node internal[60]; |
441 | } u; | 510 | } u; |
442 | 511 | ||
443 | unsigned fill[3]; /* unused */ | 512 | u32 fill[3]; /* unused */ |
444 | }; | 513 | }; |
445 | 514 | ||
446 | 515 | ||
@@ -461,25 +530,31 @@ struct anode | |||
461 | 530 | ||
462 | struct extended_attribute | 531 | struct extended_attribute |
463 | { | 532 | { |
464 | unsigned indirect: 1; /* 1 -> value gives sector number | 533 | #ifdef __LITTLE_ENDIAN |
534 | u8 indirect: 1; /* 1 -> value gives sector number | ||
465 | where real value starts */ | 535 | where real value starts */ |
466 | unsigned anode: 1; /* 1 -> sector is an anode | 536 | u8 anode: 1; /* 1 -> sector is an anode |
537 | that points to fragmented value */ | ||
538 | u8 flag23456: 5; | ||
539 | u8 needea: 1; /* required ea */ | ||
540 | #else | ||
541 | u8 needea: 1; /* required ea */ | ||
542 | u8 flag23456: 5; | ||
543 | u8 anode: 1; /* 1 -> sector is an anode | ||
467 | that points to fragmented value */ | 544 | that points to fragmented value */ |
468 | unsigned flag2: 1; | 545 | u8 indirect: 1; /* 1 -> value gives sector number |
469 | unsigned flag3: 1; | 546 | where real value starts */ |
470 | unsigned flag4: 1; | 547 | #endif |
471 | unsigned flag5: 1; | 548 | u8 namelen; /* length of name, bytes */ |
472 | unsigned flag6: 1; | 549 | u8 valuelen_lo; /* length of value, bytes */ |
473 | unsigned needea: 1; /* required ea */ | 550 | u8 valuelen_hi; /* length of value, bytes */ |
474 | unsigned char namelen; /* length of name, bytes */ | 551 | u8 name[0]; |
475 | unsigned short valuelen; /* length of value, bytes */ | ||
476 | unsigned char name[0]; | ||
477 | /* | 552 | /* |
478 | unsigned char name[namelen]; ascii attrib name | 553 | u8 name[namelen]; ascii attrib name |
479 | unsigned char nul; terminating '\0', not counted | 554 | u8 nul; terminating '\0', not counted |
480 | unsigned char value[valuelen]; value, arbitrary | 555 | u8 value[valuelen]; value, arbitrary |
481 | if this.indirect, valuelen is 8 and the value is | 556 | if this.indirect, valuelen is 8 and the value is |
482 | unsigned length; real length of value, bytes | 557 | u32 length; real length of value, bytes |
483 | secno secno; sector address where it starts | 558 | secno secno; sector address where it starts |
484 | if this.anode, the above sector number is the root of an anode tree | 559 | if this.anode, the above sector number is the root of an anode tree |
485 | which points to the value. | 560 | which points to the value. |
diff --git a/fs/hpfs/hpfs_fn.h b/fs/hpfs/hpfs_fn.h index c15adbca07ff..dd552f862c8f 100644 --- a/fs/hpfs/hpfs_fn.h +++ b/fs/hpfs/hpfs_fn.h | |||
@@ -13,6 +13,7 @@ | |||
13 | #include <linux/pagemap.h> | 13 | #include <linux/pagemap.h> |
14 | #include <linux/buffer_head.h> | 14 | #include <linux/buffer_head.h> |
15 | #include <linux/slab.h> | 15 | #include <linux/slab.h> |
16 | #include <asm/unaligned.h> | ||
16 | 17 | ||
17 | #include "hpfs.h" | 18 | #include "hpfs.h" |
18 | 19 | ||
@@ -51,18 +52,16 @@ struct hpfs_inode_info { | |||
51 | unsigned i_disk_sec; /* (files) minimalist cache of alloc info */ | 52 | unsigned i_disk_sec; /* (files) minimalist cache of alloc info */ |
52 | unsigned i_n_secs; /* (files) minimalist cache of alloc info */ | 53 | unsigned i_n_secs; /* (files) minimalist cache of alloc info */ |
53 | unsigned i_ea_size; /* size of extended attributes */ | 54 | unsigned i_ea_size; /* size of extended attributes */ |
54 | unsigned i_conv : 2; /* (files) crlf->newline hackery */ | ||
55 | unsigned i_ea_mode : 1; /* file's permission is stored in ea */ | 55 | unsigned i_ea_mode : 1; /* file's permission is stored in ea */ |
56 | unsigned i_ea_uid : 1; /* file's uid is stored in ea */ | 56 | unsigned i_ea_uid : 1; /* file's uid is stored in ea */ |
57 | unsigned i_ea_gid : 1; /* file's gid is stored in ea */ | 57 | unsigned i_ea_gid : 1; /* file's gid is stored in ea */ |
58 | unsigned i_dirty : 1; | 58 | unsigned i_dirty : 1; |
59 | struct mutex i_mutex; | ||
60 | struct mutex i_parent_mutex; | ||
61 | loff_t **i_rddir_off; | 59 | loff_t **i_rddir_off; |
62 | struct inode vfs_inode; | 60 | struct inode vfs_inode; |
63 | }; | 61 | }; |
64 | 62 | ||
65 | struct hpfs_sb_info { | 63 | struct hpfs_sb_info { |
64 | struct mutex hpfs_mutex; /* global hpfs lock */ | ||
66 | ino_t sb_root; /* inode number of root dir */ | 65 | ino_t sb_root; /* inode number of root dir */ |
67 | unsigned sb_fs_size; /* file system size, sectors */ | 66 | unsigned sb_fs_size; /* file system size, sectors */ |
68 | unsigned sb_bitmaps; /* sector number of bitmap list */ | 67 | unsigned sb_bitmaps; /* sector number of bitmap list */ |
@@ -74,7 +73,6 @@ struct hpfs_sb_info { | |||
74 | uid_t sb_uid; /* uid from mount options */ | 73 | uid_t sb_uid; /* uid from mount options */ |
75 | gid_t sb_gid; /* gid from mount options */ | 74 | gid_t sb_gid; /* gid from mount options */ |
76 | umode_t sb_mode; /* mode from mount options */ | 75 | umode_t sb_mode; /* mode from mount options */ |
77 | unsigned sb_conv : 2; /* crlf->newline hackery */ | ||
78 | unsigned sb_eas : 2; /* eas: 0-ignore, 1-ro, 2-rw */ | 76 | unsigned sb_eas : 2; /* eas: 0-ignore, 1-ro, 2-rw */ |
79 | unsigned sb_err : 2; /* on errs: 0-cont, 1-ro, 2-panic */ | 77 | unsigned sb_err : 2; /* on errs: 0-cont, 1-ro, 2-panic */ |
80 | unsigned sb_chk : 2; /* checks: 0-no, 1-normal, 2-strict */ | 78 | unsigned sb_chk : 2; /* checks: 0-no, 1-normal, 2-strict */ |
@@ -87,20 +85,9 @@ struct hpfs_sb_info { | |||
87 | unsigned *sb_bmp_dir; /* main bitmap directory */ | 85 | unsigned *sb_bmp_dir; /* main bitmap directory */ |
88 | unsigned sb_c_bitmap; /* current bitmap */ | 86 | unsigned sb_c_bitmap; /* current bitmap */ |
89 | unsigned sb_max_fwd_alloc; /* max forwad allocation */ | 87 | unsigned sb_max_fwd_alloc; /* max forwad allocation */ |
90 | struct mutex hpfs_creation_de; /* when creating dirents, nobody else | ||
91 | can alloc blocks */ | ||
92 | /*unsigned sb_mounting : 1;*/ | ||
93 | int sb_timeshift; | 88 | int sb_timeshift; |
94 | }; | 89 | }; |
95 | 90 | ||
96 | /* | ||
97 | * conv= options | ||
98 | */ | ||
99 | |||
100 | #define CONV_BINARY 0 /* no conversion */ | ||
101 | #define CONV_TEXT 1 /* crlf->newline */ | ||
102 | #define CONV_AUTO 2 /* decide based on file contents */ | ||
103 | |||
104 | /* Four 512-byte buffers and the 2k block obtained by concatenating them */ | 91 | /* Four 512-byte buffers and the 2k block obtained by concatenating them */ |
105 | 92 | ||
106 | struct quad_buffer_head { | 93 | struct quad_buffer_head { |
@@ -113,7 +100,7 @@ struct quad_buffer_head { | |||
113 | static inline dnode_secno de_down_pointer (struct hpfs_dirent *de) | 100 | static inline dnode_secno de_down_pointer (struct hpfs_dirent *de) |
114 | { | 101 | { |
115 | CHKCOND(de->down,("HPFS: de_down_pointer: !de->down\n")); | 102 | CHKCOND(de->down,("HPFS: de_down_pointer: !de->down\n")); |
116 | return *(dnode_secno *) ((void *) de + de->length - 4); | 103 | return le32_to_cpu(*(dnode_secno *) ((void *) de + le16_to_cpu(de->length) - 4)); |
117 | } | 104 | } |
118 | 105 | ||
119 | /* The first dir entry in a dnode */ | 106 | /* The first dir entry in a dnode */ |
@@ -127,41 +114,46 @@ static inline struct hpfs_dirent *dnode_first_de (struct dnode *dnode) | |||
127 | 114 | ||
128 | static inline struct hpfs_dirent *dnode_end_de (struct dnode *dnode) | 115 | static inline struct hpfs_dirent *dnode_end_de (struct dnode *dnode) |
129 | { | 116 | { |
130 | CHKCOND(dnode->first_free>=0x14 && dnode->first_free<=0xa00,("HPFS: dnode_end_de: dnode->first_free = %d\n",(int)dnode->first_free)); | 117 | 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 + dnode->first_free; | 118 | return (void *) dnode + le32_to_cpu(dnode->first_free); |
132 | } | 119 | } |
133 | 120 | ||
134 | /* The dir entry after dir entry de */ | 121 | /* The dir entry after dir entry de */ |
135 | 122 | ||
136 | static inline struct hpfs_dirent *de_next_de (struct hpfs_dirent *de) | 123 | static inline struct hpfs_dirent *de_next_de (struct hpfs_dirent *de) |
137 | { | 124 | { |
138 | CHKCOND(de->length>=0x20 && de->length<0x800,("HPFS: de_next_de: de->length = %d\n",(int)de->length)); | 125 | 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 + de->length; | 126 | return (void *) de + le16_to_cpu(de->length); |
140 | } | 127 | } |
141 | 128 | ||
142 | static inline struct extended_attribute *fnode_ea(struct fnode *fnode) | 129 | static inline struct extended_attribute *fnode_ea(struct fnode *fnode) |
143 | { | 130 | { |
144 | return (struct extended_attribute *)((char *)fnode + fnode->ea_offs + fnode->acl_size_s); | 131 | return (struct extended_attribute *)((char *)fnode + le16_to_cpu(fnode->ea_offs) + le16_to_cpu(fnode->acl_size_s)); |
145 | } | 132 | } |
146 | 133 | ||
147 | static inline struct extended_attribute *fnode_end_ea(struct fnode *fnode) | 134 | static inline struct extended_attribute *fnode_end_ea(struct fnode *fnode) |
148 | { | 135 | { |
149 | return (struct extended_attribute *)((char *)fnode + fnode->ea_offs + fnode->acl_size_s + fnode->ea_size_s); | 136 | 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)); |
137 | } | ||
138 | |||
139 | static unsigned ea_valuelen(struct extended_attribute *ea) | ||
140 | { | ||
141 | return ea->valuelen_lo + 256 * ea->valuelen_hi; | ||
150 | } | 142 | } |
151 | 143 | ||
152 | static inline struct extended_attribute *next_ea(struct extended_attribute *ea) | 144 | static inline struct extended_attribute *next_ea(struct extended_attribute *ea) |
153 | { | 145 | { |
154 | return (struct extended_attribute *)((char *)ea + 5 + ea->namelen + ea->valuelen); | 146 | return (struct extended_attribute *)((char *)ea + 5 + ea->namelen + ea_valuelen(ea)); |
155 | } | 147 | } |
156 | 148 | ||
157 | static inline secno ea_sec(struct extended_attribute *ea) | 149 | static inline secno ea_sec(struct extended_attribute *ea) |
158 | { | 150 | { |
159 | return *(secno *)((char *)ea + 9 + ea->namelen); | 151 | return le32_to_cpu(get_unaligned((secno *)((char *)ea + 9 + ea->namelen))); |
160 | } | 152 | } |
161 | 153 | ||
162 | static inline secno ea_len(struct extended_attribute *ea) | 154 | static inline secno ea_len(struct extended_attribute *ea) |
163 | { | 155 | { |
164 | return *(secno *)((char *)ea + 5 + ea->namelen); | 156 | return le32_to_cpu(get_unaligned((secno *)((char *)ea + 5 + ea->namelen))); |
165 | } | 157 | } |
166 | 158 | ||
167 | static inline char *ea_data(struct extended_attribute *ea) | 159 | static inline char *ea_data(struct extended_attribute *ea) |
@@ -186,13 +178,13 @@ static inline void copy_de(struct hpfs_dirent *dst, struct hpfs_dirent *src) | |||
186 | dst->not_8x3 = n; | 178 | dst->not_8x3 = n; |
187 | } | 179 | } |
188 | 180 | ||
189 | static inline unsigned tstbits(unsigned *bmp, unsigned b, unsigned n) | 181 | static inline unsigned tstbits(u32 *bmp, unsigned b, unsigned n) |
190 | { | 182 | { |
191 | int i; | 183 | int i; |
192 | if ((b >= 0x4000) || (b + n - 1 >= 0x4000)) return n; | 184 | if ((b >= 0x4000) || (b + n - 1 >= 0x4000)) return n; |
193 | if (!((bmp[(b & 0x3fff) >> 5] >> (b & 0x1f)) & 1)) return 1; | 185 | if (!((le32_to_cpu(bmp[(b & 0x3fff) >> 5]) >> (b & 0x1f)) & 1)) return 1; |
194 | for (i = 1; i < n; i++) | 186 | for (i = 1; i < n; i++) |
195 | if (/*b+i < 0x4000 &&*/ !((bmp[((b+i) & 0x3fff) >> 5] >> ((b+i) & 0x1f)) & 1)) | 187 | if (!((le32_to_cpu(bmp[((b+i) & 0x3fff) >> 5]) >> ((b+i) & 0x1f)) & 1)) |
196 | return i + 1; | 188 | return i + 1; |
197 | return 0; | 189 | return 0; |
198 | } | 190 | } |
@@ -200,12 +192,12 @@ static inline unsigned tstbits(unsigned *bmp, unsigned b, unsigned n) | |||
200 | /* alloc.c */ | 192 | /* alloc.c */ |
201 | 193 | ||
202 | int hpfs_chk_sectors(struct super_block *, secno, int, char *); | 194 | int hpfs_chk_sectors(struct super_block *, secno, int, char *); |
203 | secno hpfs_alloc_sector(struct super_block *, secno, unsigned, int, int); | 195 | secno hpfs_alloc_sector(struct super_block *, secno, unsigned, int); |
204 | int hpfs_alloc_if_possible(struct super_block *, secno); | 196 | int hpfs_alloc_if_possible(struct super_block *, secno); |
205 | void hpfs_free_sectors(struct super_block *, secno, unsigned); | 197 | void hpfs_free_sectors(struct super_block *, secno, unsigned); |
206 | int hpfs_check_free_dnodes(struct super_block *, int); | 198 | int hpfs_check_free_dnodes(struct super_block *, int); |
207 | void hpfs_free_dnode(struct super_block *, secno); | 199 | void hpfs_free_dnode(struct super_block *, secno); |
208 | struct dnode *hpfs_alloc_dnode(struct super_block *, secno, dnode_secno *, struct quad_buffer_head *, int); | 200 | struct dnode *hpfs_alloc_dnode(struct super_block *, secno, dnode_secno *, struct quad_buffer_head *); |
209 | struct fnode *hpfs_alloc_fnode(struct super_block *, secno, fnode_secno *, struct buffer_head **); | 201 | struct fnode *hpfs_alloc_fnode(struct super_block *, secno, fnode_secno *, struct buffer_head **); |
210 | struct anode *hpfs_alloc_anode(struct super_block *, secno, anode_secno *, struct buffer_head **); | 202 | struct anode *hpfs_alloc_anode(struct super_block *, secno, anode_secno *, struct buffer_head **); |
211 | 203 | ||
@@ -222,8 +214,6 @@ void hpfs_remove_fnode(struct super_block *, fnode_secno fno); | |||
222 | 214 | ||
223 | /* buffer.c */ | 215 | /* buffer.c */ |
224 | 216 | ||
225 | void hpfs_lock_creation(struct super_block *); | ||
226 | void hpfs_unlock_creation(struct super_block *); | ||
227 | void *hpfs_map_sector(struct super_block *, unsigned, struct buffer_head **, int); | 217 | void *hpfs_map_sector(struct super_block *, unsigned, struct buffer_head **, int); |
228 | void *hpfs_get_sector(struct super_block *, unsigned, struct buffer_head **); | 218 | void *hpfs_get_sector(struct super_block *, unsigned, struct buffer_head **); |
229 | void *hpfs_map_4sectors(struct super_block *, unsigned, struct quad_buffer_head *, int); | 219 | void *hpfs_map_4sectors(struct super_block *, unsigned, struct quad_buffer_head *, int); |
@@ -247,7 +237,7 @@ void hpfs_del_pos(struct inode *, loff_t *); | |||
247 | struct hpfs_dirent *hpfs_add_de(struct super_block *, struct dnode *, | 237 | struct hpfs_dirent *hpfs_add_de(struct super_block *, struct dnode *, |
248 | const unsigned char *, unsigned, secno); | 238 | const unsigned char *, unsigned, secno); |
249 | int hpfs_add_dirent(struct inode *, const unsigned char *, unsigned, | 239 | int hpfs_add_dirent(struct inode *, const unsigned char *, unsigned, |
250 | struct hpfs_dirent *, int); | 240 | struct hpfs_dirent *); |
251 | int hpfs_remove_dirent(struct inode *, dnode_secno, struct hpfs_dirent *, struct quad_buffer_head *, int); | 241 | int hpfs_remove_dirent(struct inode *, dnode_secno, struct hpfs_dirent *, struct quad_buffer_head *, int); |
252 | void hpfs_count_dnodes(struct super_block *, dnode_secno, int *, int *, int *); | 242 | void hpfs_count_dnodes(struct super_block *, dnode_secno, int *, int *, int *); |
253 | dnode_secno hpfs_de_as_down_as_possible(struct super_block *, dnode_secno dno); | 243 | dnode_secno hpfs_de_as_down_as_possible(struct super_block *, dnode_secno dno); |
@@ -303,7 +293,6 @@ int hpfs_compare_names(struct super_block *, const unsigned char *, unsigned, | |||
303 | const unsigned char *, unsigned, int); | 293 | const unsigned char *, unsigned, int); |
304 | int hpfs_is_name_long(const unsigned char *, unsigned); | 294 | int hpfs_is_name_long(const unsigned char *, unsigned); |
305 | void hpfs_adjust_length(const unsigned char *, unsigned *); | 295 | void hpfs_adjust_length(const unsigned char *, unsigned *); |
306 | void hpfs_decide_conv(struct inode *, const unsigned char *, unsigned); | ||
307 | 296 | ||
308 | /* namei.c */ | 297 | /* namei.c */ |
309 | 298 | ||
@@ -346,21 +335,26 @@ static inline time32_t gmt_to_local(struct super_block *s, time_t t) | |||
346 | /* | 335 | /* |
347 | * Locking: | 336 | * Locking: |
348 | * | 337 | * |
349 | * hpfs_lock() is a leftover from the big kernel lock. | 338 | * hpfs_lock() locks the whole filesystem. It must be taken |
350 | * Right now, these functions are empty and only left | 339 | * on any method called by the VFS. |
351 | * for documentation purposes. The file system no longer | ||
352 | * works on SMP systems, so the lock is not needed | ||
353 | * any more. | ||
354 | * | 340 | * |
355 | * If someone is interested in making it work again, this | 341 | * We don't do any per-file locking anymore, it is hard to |
356 | * would be the place to start by adding a per-superblock | 342 | * review and HPFS is not performance-sensitive anyway. |
357 | * mutex and fixing all the bugs and performance issues | ||
358 | * caused by that. | ||
359 | */ | 343 | */ |
360 | static inline void hpfs_lock(struct super_block *s) | 344 | static inline void hpfs_lock(struct super_block *s) |
361 | { | 345 | { |
346 | struct hpfs_sb_info *sbi = hpfs_sb(s); | ||
347 | mutex_lock(&sbi->hpfs_mutex); | ||
362 | } | 348 | } |
363 | 349 | ||
364 | static inline void hpfs_unlock(struct super_block *s) | 350 | static inline void hpfs_unlock(struct super_block *s) |
365 | { | 351 | { |
352 | struct hpfs_sb_info *sbi = hpfs_sb(s); | ||
353 | mutex_unlock(&sbi->hpfs_mutex); | ||
354 | } | ||
355 | |||
356 | static inline void hpfs_lock_assert(struct super_block *s) | ||
357 | { | ||
358 | struct hpfs_sb_info *sbi = hpfs_sb(s); | ||
359 | WARN_ON(!mutex_is_locked(&sbi->hpfs_mutex)); | ||
366 | } | 360 | } |
diff --git a/fs/hpfs/inode.c b/fs/hpfs/inode.c index 87f1f787e767..338cd8368451 100644 --- a/fs/hpfs/inode.c +++ b/fs/hpfs/inode.c | |||
@@ -17,7 +17,6 @@ void hpfs_init_inode(struct inode *i) | |||
17 | i->i_uid = hpfs_sb(sb)->sb_uid; | 17 | i->i_uid = hpfs_sb(sb)->sb_uid; |
18 | i->i_gid = hpfs_sb(sb)->sb_gid; | 18 | i->i_gid = hpfs_sb(sb)->sb_gid; |
19 | i->i_mode = hpfs_sb(sb)->sb_mode; | 19 | i->i_mode = hpfs_sb(sb)->sb_mode; |
20 | hpfs_inode->i_conv = hpfs_sb(sb)->sb_conv; | ||
21 | i->i_size = -1; | 20 | i->i_size = -1; |
22 | i->i_blocks = -1; | 21 | i->i_blocks = -1; |
23 | 22 | ||
@@ -116,8 +115,8 @@ void hpfs_read_inode(struct inode *i) | |||
116 | i->i_mode |= S_IFDIR; | 115 | i->i_mode |= S_IFDIR; |
117 | i->i_op = &hpfs_dir_iops; | 116 | i->i_op = &hpfs_dir_iops; |
118 | i->i_fop = &hpfs_dir_ops; | 117 | i->i_fop = &hpfs_dir_ops; |
119 | hpfs_inode->i_parent_dir = fnode->up; | 118 | hpfs_inode->i_parent_dir = le32_to_cpu(fnode->up); |
120 | hpfs_inode->i_dno = fnode->u.external[0].disk_secno; | 119 | hpfs_inode->i_dno = le32_to_cpu(fnode->u.external[0].disk_secno); |
121 | if (hpfs_sb(sb)->sb_chk >= 2) { | 120 | if (hpfs_sb(sb)->sb_chk >= 2) { |
122 | struct buffer_head *bh0; | 121 | struct buffer_head *bh0; |
123 | if (hpfs_map_fnode(sb, hpfs_inode->i_parent_dir, &bh0)) brelse(bh0); | 122 | if (hpfs_map_fnode(sb, hpfs_inode->i_parent_dir, &bh0)) brelse(bh0); |
@@ -133,7 +132,7 @@ void hpfs_read_inode(struct inode *i) | |||
133 | i->i_op = &hpfs_file_iops; | 132 | i->i_op = &hpfs_file_iops; |
134 | i->i_fop = &hpfs_file_ops; | 133 | i->i_fop = &hpfs_file_ops; |
135 | i->i_nlink = 1; | 134 | i->i_nlink = 1; |
136 | i->i_size = fnode->file_size; | 135 | i->i_size = le32_to_cpu(fnode->file_size); |
137 | i->i_blocks = ((i->i_size + 511) >> 9) + 1; | 136 | i->i_blocks = ((i->i_size + 511) >> 9) + 1; |
138 | i->i_data.a_ops = &hpfs_aops; | 137 | i->i_data.a_ops = &hpfs_aops; |
139 | hpfs_i(i)->mmu_private = i->i_size; | 138 | hpfs_i(i)->mmu_private = i->i_size; |
@@ -144,7 +143,7 @@ void hpfs_read_inode(struct inode *i) | |||
144 | static void hpfs_write_inode_ea(struct inode *i, struct fnode *fnode) | 143 | static void hpfs_write_inode_ea(struct inode *i, struct fnode *fnode) |
145 | { | 144 | { |
146 | struct hpfs_inode_info *hpfs_inode = hpfs_i(i); | 145 | struct hpfs_inode_info *hpfs_inode = hpfs_i(i); |
147 | /*if (fnode->acl_size_l || fnode->acl_size_s) { | 146 | /*if (le32_to_cpu(fnode->acl_size_l) || le16_to_cpu(fnode->acl_size_s)) { |
148 | Some unknown structures like ACL may be in fnode, | 147 | Some unknown structures like ACL may be in fnode, |
149 | we'd better not overwrite them | 148 | we'd better not overwrite them |
150 | hpfs_error(i->i_sb, "fnode %08x has some unknown HPFS386 stuctures", i->i_ino); | 149 | hpfs_error(i->i_sb, "fnode %08x has some unknown HPFS386 stuctures", i->i_ino); |
@@ -187,9 +186,7 @@ void hpfs_write_inode(struct inode *i) | |||
187 | kfree(hpfs_inode->i_rddir_off); | 186 | kfree(hpfs_inode->i_rddir_off); |
188 | hpfs_inode->i_rddir_off = NULL; | 187 | hpfs_inode->i_rddir_off = NULL; |
189 | } | 188 | } |
190 | mutex_lock(&hpfs_inode->i_parent_mutex); | ||
191 | if (!i->i_nlink) { | 189 | if (!i->i_nlink) { |
192 | mutex_unlock(&hpfs_inode->i_parent_mutex); | ||
193 | return; | 190 | return; |
194 | } | 191 | } |
195 | parent = iget_locked(i->i_sb, hpfs_inode->i_parent_dir); | 192 | parent = iget_locked(i->i_sb, hpfs_inode->i_parent_dir); |
@@ -200,14 +197,9 @@ void hpfs_write_inode(struct inode *i) | |||
200 | hpfs_read_inode(parent); | 197 | hpfs_read_inode(parent); |
201 | unlock_new_inode(parent); | 198 | unlock_new_inode(parent); |
202 | } | 199 | } |
203 | mutex_lock(&hpfs_inode->i_mutex); | ||
204 | hpfs_write_inode_nolock(i); | 200 | hpfs_write_inode_nolock(i); |
205 | mutex_unlock(&hpfs_inode->i_mutex); | ||
206 | iput(parent); | 201 | iput(parent); |
207 | } else { | ||
208 | mark_inode_dirty(i); | ||
209 | } | 202 | } |
210 | mutex_unlock(&hpfs_inode->i_parent_mutex); | ||
211 | } | 203 | } |
212 | 204 | ||
213 | void hpfs_write_inode_nolock(struct inode *i) | 205 | void hpfs_write_inode_nolock(struct inode *i) |
@@ -226,30 +218,30 @@ void hpfs_write_inode_nolock(struct inode *i) | |||
226 | } | 218 | } |
227 | } else de = NULL; | 219 | } else de = NULL; |
228 | if (S_ISREG(i->i_mode)) { | 220 | if (S_ISREG(i->i_mode)) { |
229 | fnode->file_size = i->i_size; | 221 | fnode->file_size = cpu_to_le32(i->i_size); |
230 | if (de) de->file_size = i->i_size; | 222 | if (de) de->file_size = cpu_to_le32(i->i_size); |
231 | } else if (S_ISDIR(i->i_mode)) { | 223 | } else if (S_ISDIR(i->i_mode)) { |
232 | fnode->file_size = 0; | 224 | fnode->file_size = cpu_to_le32(0); |
233 | if (de) de->file_size = 0; | 225 | if (de) de->file_size = cpu_to_le32(0); |
234 | } | 226 | } |
235 | hpfs_write_inode_ea(i, fnode); | 227 | hpfs_write_inode_ea(i, fnode); |
236 | if (de) { | 228 | if (de) { |
237 | de->write_date = gmt_to_local(i->i_sb, i->i_mtime.tv_sec); | 229 | de->write_date = cpu_to_le32(gmt_to_local(i->i_sb, i->i_mtime.tv_sec)); |
238 | de->read_date = gmt_to_local(i->i_sb, i->i_atime.tv_sec); | 230 | de->read_date = cpu_to_le32(gmt_to_local(i->i_sb, i->i_atime.tv_sec)); |
239 | de->creation_date = gmt_to_local(i->i_sb, i->i_ctime.tv_sec); | 231 | de->creation_date = cpu_to_le32(gmt_to_local(i->i_sb, i->i_ctime.tv_sec)); |
240 | de->read_only = !(i->i_mode & 0222); | 232 | de->read_only = !(i->i_mode & 0222); |
241 | de->ea_size = hpfs_inode->i_ea_size; | 233 | de->ea_size = cpu_to_le32(hpfs_inode->i_ea_size); |
242 | hpfs_mark_4buffers_dirty(&qbh); | 234 | hpfs_mark_4buffers_dirty(&qbh); |
243 | hpfs_brelse4(&qbh); | 235 | hpfs_brelse4(&qbh); |
244 | } | 236 | } |
245 | if (S_ISDIR(i->i_mode)) { | 237 | if (S_ISDIR(i->i_mode)) { |
246 | if ((de = map_dirent(i, hpfs_inode->i_dno, "\001\001", 2, NULL, &qbh))) { | 238 | if ((de = map_dirent(i, hpfs_inode->i_dno, "\001\001", 2, NULL, &qbh))) { |
247 | de->write_date = gmt_to_local(i->i_sb, i->i_mtime.tv_sec); | 239 | de->write_date = cpu_to_le32(gmt_to_local(i->i_sb, i->i_mtime.tv_sec)); |
248 | de->read_date = gmt_to_local(i->i_sb, i->i_atime.tv_sec); | 240 | de->read_date = cpu_to_le32(gmt_to_local(i->i_sb, i->i_atime.tv_sec)); |
249 | de->creation_date = gmt_to_local(i->i_sb, i->i_ctime.tv_sec); | 241 | de->creation_date = cpu_to_le32(gmt_to_local(i->i_sb, i->i_ctime.tv_sec)); |
250 | de->read_only = !(i->i_mode & 0222); | 242 | de->read_only = !(i->i_mode & 0222); |
251 | de->ea_size = /*hpfs_inode->i_ea_size*/0; | 243 | de->ea_size = cpu_to_le32(/*hpfs_inode->i_ea_size*/0); |
252 | de->file_size = 0; | 244 | de->file_size = cpu_to_le32(0); |
253 | hpfs_mark_4buffers_dirty(&qbh); | 245 | hpfs_mark_4buffers_dirty(&qbh); |
254 | hpfs_brelse4(&qbh); | 246 | hpfs_brelse4(&qbh); |
255 | } else | 247 | } else |
@@ -269,6 +261,10 @@ int hpfs_setattr(struct dentry *dentry, struct iattr *attr) | |||
269 | hpfs_lock(inode->i_sb); | 261 | hpfs_lock(inode->i_sb); |
270 | if (inode->i_ino == hpfs_sb(inode->i_sb)->sb_root) | 262 | if (inode->i_ino == hpfs_sb(inode->i_sb)->sb_root) |
271 | goto out_unlock; | 263 | goto out_unlock; |
264 | if ((attr->ia_valid & ATTR_UID) && attr->ia_uid >= 0x10000) | ||
265 | goto out_unlock; | ||
266 | if ((attr->ia_valid & ATTR_GID) && attr->ia_gid >= 0x10000) | ||
267 | goto out_unlock; | ||
272 | if ((attr->ia_valid & ATTR_SIZE) && attr->ia_size > inode->i_size) | 268 | if ((attr->ia_valid & ATTR_SIZE) && attr->ia_size > inode->i_size) |
273 | goto out_unlock; | 269 | goto out_unlock; |
274 | 270 | ||
@@ -284,7 +280,6 @@ int hpfs_setattr(struct dentry *dentry, struct iattr *attr) | |||
284 | } | 280 | } |
285 | 281 | ||
286 | setattr_copy(inode, attr); | 282 | setattr_copy(inode, attr); |
287 | mark_inode_dirty(inode); | ||
288 | 283 | ||
289 | hpfs_write_inode(inode); | 284 | hpfs_write_inode(inode); |
290 | 285 | ||
diff --git a/fs/hpfs/map.c b/fs/hpfs/map.c index 840d033ecee8..a790821366a7 100644 --- a/fs/hpfs/map.c +++ b/fs/hpfs/map.c | |||
@@ -21,7 +21,7 @@ unsigned int *hpfs_map_bitmap(struct super_block *s, unsigned bmp_block, | |||
21 | hpfs_error(s, "hpfs_map_bitmap called with bad parameter: %08x at %s", bmp_block, id); | 21 | hpfs_error(s, "hpfs_map_bitmap called with bad parameter: %08x at %s", bmp_block, id); |
22 | return NULL; | 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 | if (!sec || sec > hpfs_sb(s)->sb_fs_size-4) { | 25 | if (!sec || sec > hpfs_sb(s)->sb_fs_size-4) { |
26 | hpfs_error(s, "invalid bitmap block pointer %08x -> %08x at %s", bmp_block, sec, id); | 26 | hpfs_error(s, "invalid bitmap block pointer %08x -> %08x at %s", bmp_block, sec, id); |
27 | return NULL; | 27 | return NULL; |
@@ -46,18 +46,18 @@ unsigned char *hpfs_load_code_page(struct super_block *s, secno cps) | |||
46 | struct code_page_data *cpd; | 46 | struct code_page_data *cpd; |
47 | struct code_page_directory *cp = hpfs_map_sector(s, cps, &bh, 0); | 47 | struct code_page_directory *cp = hpfs_map_sector(s, cps, &bh, 0); |
48 | if (!cp) return NULL; | 48 | if (!cp) return NULL; |
49 | if (cp->magic != CP_DIR_MAGIC) { | 49 | if (le32_to_cpu(cp->magic) != CP_DIR_MAGIC) { |
50 | printk("HPFS: Code page directory magic doesn't match (magic = %08x)\n", cp->magic); | 50 | printk("HPFS: Code page directory magic doesn't match (magic = %08x)\n", le32_to_cpu(cp->magic)); |
51 | brelse(bh); | 51 | brelse(bh); |
52 | return NULL; | 52 | return NULL; |
53 | } | 53 | } |
54 | if (!cp->n_code_pages) { | 54 | if (!le32_to_cpu(cp->n_code_pages)) { |
55 | printk("HPFS: n_code_pages == 0\n"); | 55 | printk("HPFS: n_code_pages == 0\n"); |
56 | brelse(bh); | 56 | brelse(bh); |
57 | return NULL; | 57 | return NULL; |
58 | } | 58 | } |
59 | cpds = cp->array[0].code_page_data; | 59 | cpds = le32_to_cpu(cp->array[0].code_page_data); |
60 | cpi = cp->array[0].index; | 60 | cpi = le16_to_cpu(cp->array[0].index); |
61 | brelse(bh); | 61 | brelse(bh); |
62 | 62 | ||
63 | if (cpi >= 3) { | 63 | if (cpi >= 3) { |
@@ -66,12 +66,12 @@ unsigned char *hpfs_load_code_page(struct super_block *s, secno cps) | |||
66 | } | 66 | } |
67 | 67 | ||
68 | if (!(cpd = hpfs_map_sector(s, cpds, &bh, 0))) return NULL; | 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 | printk("HPFS: Code page index out of sector\n"); | 70 | printk("HPFS: Code page index out of sector\n"); |
71 | brelse(bh); | 71 | brelse(bh); |
72 | return NULL; | 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 | if (!(cp_table = kmalloc(256, GFP_KERNEL))) { | 75 | if (!(cp_table = kmalloc(256, GFP_KERNEL))) { |
76 | printk("HPFS: out of memory for code page table\n"); | 76 | printk("HPFS: out of memory for code page table\n"); |
77 | brelse(bh); | 77 | brelse(bh); |
@@ -125,7 +125,7 @@ struct fnode *hpfs_map_fnode(struct super_block *s, ino_t ino, struct buffer_hea | |||
125 | if (hpfs_sb(s)->sb_chk) { | 125 | if (hpfs_sb(s)->sb_chk) { |
126 | struct extended_attribute *ea; | 126 | struct extended_attribute *ea; |
127 | struct extended_attribute *ea_end; | 127 | struct extended_attribute *ea_end; |
128 | if (fnode->magic != FNODE_MAGIC) { | 128 | if (le32_to_cpu(fnode->magic) != FNODE_MAGIC) { |
129 | hpfs_error(s, "bad magic on fnode %08lx", | 129 | hpfs_error(s, "bad magic on fnode %08lx", |
130 | (unsigned long)ino); | 130 | (unsigned long)ino); |
131 | goto bail; | 131 | goto bail; |
@@ -138,7 +138,7 @@ struct fnode *hpfs_map_fnode(struct super_block *s, ino_t ino, struct buffer_hea | |||
138 | (unsigned long)ino); | 138 | (unsigned long)ino); |
139 | goto bail; | 139 | goto bail; |
140 | } | 140 | } |
141 | if (fnode->btree.first_free != | 141 | if (le16_to_cpu(fnode->btree.first_free) != |
142 | 8 + fnode->btree.n_used_nodes * (fnode->btree.internal ? 8 : 12)) { | 142 | 8 + fnode->btree.n_used_nodes * (fnode->btree.internal ? 8 : 12)) { |
143 | hpfs_error(s, | 143 | hpfs_error(s, |
144 | "bad first_free pointer in fnode %08lx", | 144 | "bad first_free pointer in fnode %08lx", |
@@ -146,12 +146,12 @@ struct fnode *hpfs_map_fnode(struct super_block *s, ino_t ino, struct buffer_hea | |||
146 | goto bail; | 146 | goto bail; |
147 | } | 147 | } |
148 | } | 148 | } |
149 | if (fnode->ea_size_s && ((signed int)fnode->ea_offs < 0xc4 || | 149 | if (le16_to_cpu(fnode->ea_size_s) && (le16_to_cpu(fnode->ea_offs) < 0xc4 || |
150 | (signed int)fnode->ea_offs + fnode->acl_size_s + fnode->ea_size_s > 0x200)) { | 150 | le16_to_cpu(fnode->ea_offs) + le16_to_cpu(fnode->acl_size_s) + le16_to_cpu(fnode->ea_size_s) > 0x200)) { |
151 | hpfs_error(s, | 151 | hpfs_error(s, |
152 | "bad EA info in fnode %08lx: ea_offs == %04x ea_size_s == %04x", | 152 | "bad EA info in fnode %08lx: ea_offs == %04x ea_size_s == %04x", |
153 | (unsigned long)ino, | 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 | goto bail; | 155 | goto bail; |
156 | } | 156 | } |
157 | ea = fnode_ea(fnode); | 157 | ea = fnode_ea(fnode); |
@@ -178,16 +178,20 @@ struct anode *hpfs_map_anode(struct super_block *s, anode_secno ano, struct buff | |||
178 | if (hpfs_sb(s)->sb_chk) if (hpfs_chk_sectors(s, ano, 1, "anode")) return NULL; | 178 | if (hpfs_sb(s)->sb_chk) if (hpfs_chk_sectors(s, ano, 1, "anode")) return NULL; |
179 | if ((anode = hpfs_map_sector(s, ano, bhp, ANODE_RD_AHEAD))) | 179 | if ((anode = hpfs_map_sector(s, ano, bhp, ANODE_RD_AHEAD))) |
180 | if (hpfs_sb(s)->sb_chk) { | 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 | hpfs_error(s, "bad magic on anode %08x", ano); | 182 | hpfs_error(s, "bad magic on anode %08x", ano); |
183 | goto bail; | 183 | goto bail; |
184 | } | 184 | } |
185 | if (le32_to_cpu(anode->self) != ano) { | ||
186 | hpfs_error(s, "self pointer invalid on anode %08x", ano); | ||
187 | goto bail; | ||
188 | } | ||
185 | if ((unsigned)anode->btree.n_used_nodes + (unsigned)anode->btree.n_free_nodes != | 189 | if ((unsigned)anode->btree.n_used_nodes + (unsigned)anode->btree.n_free_nodes != |
186 | (anode->btree.internal ? 60 : 40)) { | 190 | (anode->btree.internal ? 60 : 40)) { |
187 | hpfs_error(s, "bad number of nodes in anode %08x", ano); | 191 | hpfs_error(s, "bad number of nodes in anode %08x", ano); |
188 | goto bail; | 192 | goto bail; |
189 | } | 193 | } |
190 | if (anode->btree.first_free != | 194 | if (le16_to_cpu(anode->btree.first_free) != |
191 | 8 + anode->btree.n_used_nodes * (anode->btree.internal ? 8 : 12)) { | 195 | 8 + anode->btree.n_used_nodes * (anode->btree.internal ? 8 : 12)) { |
192 | hpfs_error(s, "bad first_free pointer in anode %08x", ano); | 196 | hpfs_error(s, "bad first_free pointer in anode %08x", ano); |
193 | goto bail; | 197 | goto bail; |
@@ -219,26 +223,26 @@ struct dnode *hpfs_map_dnode(struct super_block *s, unsigned secno, | |||
219 | unsigned p, pp = 0; | 223 | unsigned p, pp = 0; |
220 | unsigned char *d = (unsigned char *)dnode; | 224 | unsigned char *d = (unsigned char *)dnode; |
221 | int b = 0; | 225 | int b = 0; |
222 | if (dnode->magic != DNODE_MAGIC) { | 226 | if (le32_to_cpu(dnode->magic) != DNODE_MAGIC) { |
223 | hpfs_error(s, "bad magic on dnode %08x", secno); | 227 | hpfs_error(s, "bad magic on dnode %08x", secno); |
224 | goto bail; | 228 | goto bail; |
225 | } | 229 | } |
226 | if (dnode->self != secno) | 230 | if (le32_to_cpu(dnode->self) != secno) |
227 | hpfs_error(s, "bad self pointer on dnode %08x self = %08x", secno, dnode->self); | 231 | hpfs_error(s, "bad self pointer on dnode %08x self = %08x", secno, le32_to_cpu(dnode->self)); |
228 | /* Check dirents - bad dirents would cause infinite | 232 | /* Check dirents - bad dirents would cause infinite |
229 | loops or shooting to memory */ | 233 | loops or shooting to memory */ |
230 | if (dnode->first_free > 2048/* || dnode->first_free < 84*/) { | 234 | if (le32_to_cpu(dnode->first_free) > 2048) { |
231 | hpfs_error(s, "dnode %08x has first_free == %08x", secno, dnode->first_free); | 235 | hpfs_error(s, "dnode %08x has first_free == %08x", secno, le32_to_cpu(dnode->first_free)); |
232 | goto bail; | 236 | goto bail; |
233 | } | 237 | } |
234 | for (p = 20; p < dnode->first_free; p += d[p] + (d[p+1] << 8)) { | 238 | for (p = 20; p < le32_to_cpu(dnode->first_free); p += d[p] + (d[p+1] << 8)) { |
235 | struct hpfs_dirent *de = (struct hpfs_dirent *)((char *)dnode + p); | 239 | struct hpfs_dirent *de = (struct hpfs_dirent *)((char *)dnode + p); |
236 | if (de->length > 292 || (de->length < 32) || (de->length & 3) || p + de->length > 2048) { | 240 | 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) { |
237 | hpfs_error(s, "bad dirent size in dnode %08x, dirent %03x, last %03x", secno, p, pp); | 241 | hpfs_error(s, "bad dirent size in dnode %08x, dirent %03x, last %03x", secno, p, pp); |
238 | goto bail; | 242 | goto bail; |
239 | } | 243 | } |
240 | if (((31 + de->namelen + de->down*4 + 3) & ~3) != de->length) { | 244 | if (((31 + de->namelen + de->down*4 + 3) & ~3) != le16_to_cpu(de->length)) { |
241 | if (((31 + de->namelen + de->down*4 + 3) & ~3) < de->length && s->s_flags & MS_RDONLY) goto ok; | 245 | if (((31 + de->namelen + de->down*4 + 3) & ~3) < le16_to_cpu(de->length) && s->s_flags & MS_RDONLY) goto ok; |
242 | hpfs_error(s, "namelen does not match dirent size in dnode %08x, dirent %03x, last %03x", secno, p, pp); | 246 | hpfs_error(s, "namelen does not match dirent size in dnode %08x, dirent %03x, last %03x", secno, p, pp); |
243 | goto bail; | 247 | goto bail; |
244 | } | 248 | } |
@@ -251,7 +255,7 @@ struct dnode *hpfs_map_dnode(struct super_block *s, unsigned secno, | |||
251 | pp = p; | 255 | pp = p; |
252 | 256 | ||
253 | } | 257 | } |
254 | if (p != dnode->first_free) { | 258 | if (p != le32_to_cpu(dnode->first_free)) { |
255 | hpfs_error(s, "size on last dirent does not match first_free; dnode %08x", secno); | 259 | hpfs_error(s, "size on last dirent does not match first_free; dnode %08x", secno); |
256 | goto bail; | 260 | goto bail; |
257 | } | 261 | } |
@@ -277,7 +281,7 @@ dnode_secno hpfs_fnode_dno(struct super_block *s, ino_t ino) | |||
277 | if (!fnode) | 281 | if (!fnode) |
278 | return 0; | 282 | return 0; |
279 | 283 | ||
280 | dno = fnode->u.external[0].disk_secno; | 284 | dno = le32_to_cpu(fnode->u.external[0].disk_secno); |
281 | brelse(bh); | 285 | brelse(bh); |
282 | return dno; | 286 | return dno; |
283 | } | 287 | } |
diff --git a/fs/hpfs/name.c b/fs/hpfs/name.c index f24736d7a439..9acdf338def0 100644 --- a/fs/hpfs/name.c +++ b/fs/hpfs/name.c | |||
@@ -8,39 +8,6 @@ | |||
8 | 8 | ||
9 | #include "hpfs_fn.h" | 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 | static inline int not_allowed_char(unsigned char c) | 11 | static inline int not_allowed_char(unsigned char c) |
45 | { | 12 | { |
46 | return c<' ' || c=='"' || c=='*' || c=='/' || c==':' || c=='<' || | 13 | return c<' ' || c=='"' || c=='*' || c=='/' || c==':' || c=='<' || |
diff --git a/fs/hpfs/namei.c b/fs/hpfs/namei.c index d5f8c8a19023..1f05839c27a7 100644 --- a/fs/hpfs/namei.c +++ b/fs/hpfs/namei.c | |||
@@ -29,7 +29,7 @@ static int hpfs_mkdir(struct inode *dir, struct dentry *dentry, int mode) | |||
29 | fnode = hpfs_alloc_fnode(dir->i_sb, hpfs_i(dir)->i_dno, &fno, &bh); | 29 | fnode = hpfs_alloc_fnode(dir->i_sb, hpfs_i(dir)->i_dno, &fno, &bh); |
30 | if (!fnode) | 30 | if (!fnode) |
31 | goto bail; | 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 | if (!dnode) | 33 | if (!dnode) |
34 | goto bail1; | 34 | goto bail1; |
35 | memset(&dee, 0, sizeof dee); | 35 | memset(&dee, 0, sizeof dee); |
@@ -37,8 +37,8 @@ static int hpfs_mkdir(struct inode *dir, struct dentry *dentry, int mode) | |||
37 | if (!(mode & 0222)) dee.read_only = 1; | 37 | if (!(mode & 0222)) dee.read_only = 1; |
38 | /*dee.archive = 0;*/ | 38 | /*dee.archive = 0;*/ |
39 | dee.hidden = name[0] == '.'; | 39 | dee.hidden = name[0] == '.'; |
40 | dee.fnode = fno; | 40 | dee.fnode = cpu_to_le32(fno); |
41 | dee.creation_date = dee.write_date = dee.read_date = gmt_to_local(dir->i_sb, get_seconds()); | 41 | dee.creation_date = dee.write_date = dee.read_date = cpu_to_le32(gmt_to_local(dir->i_sb, get_seconds())); |
42 | result = new_inode(dir->i_sb); | 42 | result = new_inode(dir->i_sb); |
43 | if (!result) | 43 | if (!result) |
44 | goto bail2; | 44 | goto bail2; |
@@ -46,7 +46,7 @@ static int hpfs_mkdir(struct inode *dir, struct dentry *dentry, int mode) | |||
46 | result->i_ino = fno; | 46 | result->i_ino = fno; |
47 | hpfs_i(result)->i_parent_dir = dir->i_ino; | 47 | hpfs_i(result)->i_parent_dir = dir->i_ino; |
48 | hpfs_i(result)->i_dno = dno; | 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 | result->i_ctime.tv_nsec = 0; | 50 | result->i_ctime.tv_nsec = 0; |
51 | result->i_mtime.tv_nsec = 0; | 51 | result->i_mtime.tv_nsec = 0; |
52 | result->i_atime.tv_nsec = 0; | 52 | result->i_atime.tv_nsec = 0; |
@@ -60,8 +60,7 @@ static int hpfs_mkdir(struct inode *dir, struct dentry *dentry, int mode) | |||
60 | if (dee.read_only) | 60 | if (dee.read_only) |
61 | result->i_mode &= ~0222; | 61 | result->i_mode &= ~0222; |
62 | 62 | ||
63 | mutex_lock(&hpfs_i(dir)->i_mutex); | 63 | r = hpfs_add_dirent(dir, name, len, &dee); |
64 | r = hpfs_add_dirent(dir, name, len, &dee, 0); | ||
65 | if (r == 1) | 64 | if (r == 1) |
66 | goto bail3; | 65 | goto bail3; |
67 | if (r == -1) { | 66 | if (r == -1) { |
@@ -70,21 +69,21 @@ static int hpfs_mkdir(struct inode *dir, struct dentry *dentry, int mode) | |||
70 | } | 69 | } |
71 | fnode->len = len; | 70 | fnode->len = len; |
72 | memcpy(fnode->name, name, len > 15 ? 15 : len); | 71 | memcpy(fnode->name, name, len > 15 ? 15 : len); |
73 | fnode->up = dir->i_ino; | 72 | fnode->up = cpu_to_le32(dir->i_ino); |
74 | fnode->dirflag = 1; | 73 | fnode->dirflag = 1; |
75 | fnode->btree.n_free_nodes = 7; | 74 | fnode->btree.n_free_nodes = 7; |
76 | fnode->btree.n_used_nodes = 1; | 75 | fnode->btree.n_used_nodes = 1; |
77 | fnode->btree.first_free = 0x14; | 76 | fnode->btree.first_free = cpu_to_le16(0x14); |
78 | fnode->u.external[0].disk_secno = dno; | 77 | fnode->u.external[0].disk_secno = cpu_to_le32(dno); |
79 | fnode->u.external[0].file_secno = -1; | 78 | fnode->u.external[0].file_secno = cpu_to_le32(-1); |
80 | dnode->root_dnode = 1; | 79 | dnode->root_dnode = 1; |
81 | dnode->up = fno; | 80 | dnode->up = cpu_to_le32(fno); |
82 | de = hpfs_add_de(dir->i_sb, dnode, "\001\001", 2, 0); | 81 | de = hpfs_add_de(dir->i_sb, dnode, "\001\001", 2, 0); |
83 | de->creation_date = de->write_date = de->read_date = gmt_to_local(dir->i_sb, get_seconds()); | 82 | de->creation_date = de->write_date = de->read_date = cpu_to_le32(gmt_to_local(dir->i_sb, get_seconds())); |
84 | if (!(mode & 0222)) de->read_only = 1; | 83 | if (!(mode & 0222)) de->read_only = 1; |
85 | de->first = de->directory = 1; | 84 | de->first = de->directory = 1; |
86 | /*de->hidden = de->system = 0;*/ | 85 | /*de->hidden = de->system = 0;*/ |
87 | de->fnode = fno; | 86 | de->fnode = cpu_to_le32(fno); |
88 | mark_buffer_dirty(bh); | 87 | mark_buffer_dirty(bh); |
89 | brelse(bh); | 88 | brelse(bh); |
90 | hpfs_mark_4buffers_dirty(&qbh0); | 89 | hpfs_mark_4buffers_dirty(&qbh0); |
@@ -101,11 +100,9 @@ static int hpfs_mkdir(struct inode *dir, struct dentry *dentry, int mode) | |||
101 | hpfs_write_inode_nolock(result); | 100 | hpfs_write_inode_nolock(result); |
102 | } | 101 | } |
103 | d_instantiate(dentry, result); | 102 | d_instantiate(dentry, result); |
104 | mutex_unlock(&hpfs_i(dir)->i_mutex); | ||
105 | hpfs_unlock(dir->i_sb); | 103 | hpfs_unlock(dir->i_sb); |
106 | return 0; | 104 | return 0; |
107 | bail3: | 105 | bail3: |
108 | mutex_unlock(&hpfs_i(dir)->i_mutex); | ||
109 | iput(result); | 106 | iput(result); |
110 | bail2: | 107 | bail2: |
111 | hpfs_brelse4(&qbh0); | 108 | hpfs_brelse4(&qbh0); |
@@ -140,8 +137,8 @@ static int hpfs_create(struct inode *dir, struct dentry *dentry, int mode, struc | |||
140 | if (!(mode & 0222)) dee.read_only = 1; | 137 | if (!(mode & 0222)) dee.read_only = 1; |
141 | dee.archive = 1; | 138 | dee.archive = 1; |
142 | dee.hidden = name[0] == '.'; | 139 | dee.hidden = name[0] == '.'; |
143 | dee.fnode = fno; | 140 | dee.fnode = cpu_to_le32(fno); |
144 | dee.creation_date = dee.write_date = dee.read_date = gmt_to_local(dir->i_sb, get_seconds()); | 141 | dee.creation_date = dee.write_date = dee.read_date = cpu_to_le32(gmt_to_local(dir->i_sb, get_seconds())); |
145 | 142 | ||
146 | result = new_inode(dir->i_sb); | 143 | result = new_inode(dir->i_sb); |
147 | if (!result) | 144 | if (!result) |
@@ -154,9 +151,8 @@ static int hpfs_create(struct inode *dir, struct dentry *dentry, int mode, struc | |||
154 | result->i_op = &hpfs_file_iops; | 151 | result->i_op = &hpfs_file_iops; |
155 | result->i_fop = &hpfs_file_ops; | 152 | result->i_fop = &hpfs_file_ops; |
156 | result->i_nlink = 1; | 153 | result->i_nlink = 1; |
157 | hpfs_decide_conv(result, name, len); | ||
158 | hpfs_i(result)->i_parent_dir = dir->i_ino; | 154 | hpfs_i(result)->i_parent_dir = dir->i_ino; |
159 | result->i_ctime.tv_sec = result->i_mtime.tv_sec = result->i_atime.tv_sec = local_to_gmt(dir->i_sb, dee.creation_date); | 155 | 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)); |
160 | result->i_ctime.tv_nsec = 0; | 156 | result->i_ctime.tv_nsec = 0; |
161 | result->i_mtime.tv_nsec = 0; | 157 | result->i_mtime.tv_nsec = 0; |
162 | result->i_atime.tv_nsec = 0; | 158 | result->i_atime.tv_nsec = 0; |
@@ -168,8 +164,7 @@ static int hpfs_create(struct inode *dir, struct dentry *dentry, int mode, struc | |||
168 | result->i_data.a_ops = &hpfs_aops; | 164 | result->i_data.a_ops = &hpfs_aops; |
169 | hpfs_i(result)->mmu_private = 0; | 165 | hpfs_i(result)->mmu_private = 0; |
170 | 166 | ||
171 | mutex_lock(&hpfs_i(dir)->i_mutex); | 167 | r = hpfs_add_dirent(dir, name, len, &dee); |
172 | r = hpfs_add_dirent(dir, name, len, &dee, 0); | ||
173 | if (r == 1) | 168 | if (r == 1) |
174 | goto bail2; | 169 | goto bail2; |
175 | if (r == -1) { | 170 | if (r == -1) { |
@@ -178,7 +173,7 @@ static int hpfs_create(struct inode *dir, struct dentry *dentry, int mode, struc | |||
178 | } | 173 | } |
179 | fnode->len = len; | 174 | fnode->len = len; |
180 | memcpy(fnode->name, name, len > 15 ? 15 : len); | 175 | memcpy(fnode->name, name, len > 15 ? 15 : len); |
181 | fnode->up = dir->i_ino; | 176 | fnode->up = cpu_to_le32(dir->i_ino); |
182 | mark_buffer_dirty(bh); | 177 | mark_buffer_dirty(bh); |
183 | brelse(bh); | 178 | brelse(bh); |
184 | 179 | ||
@@ -193,12 +188,10 @@ static int hpfs_create(struct inode *dir, struct dentry *dentry, int mode, struc | |||
193 | hpfs_write_inode_nolock(result); | 188 | hpfs_write_inode_nolock(result); |
194 | } | 189 | } |
195 | d_instantiate(dentry, result); | 190 | d_instantiate(dentry, result); |
196 | mutex_unlock(&hpfs_i(dir)->i_mutex); | ||
197 | hpfs_unlock(dir->i_sb); | 191 | hpfs_unlock(dir->i_sb); |
198 | return 0; | 192 | return 0; |
199 | 193 | ||
200 | bail2: | 194 | bail2: |
201 | mutex_unlock(&hpfs_i(dir)->i_mutex); | ||
202 | iput(result); | 195 | iput(result); |
203 | bail1: | 196 | bail1: |
204 | brelse(bh); | 197 | brelse(bh); |
@@ -232,8 +225,8 @@ static int hpfs_mknod(struct inode *dir, struct dentry *dentry, int mode, dev_t | |||
232 | if (!(mode & 0222)) dee.read_only = 1; | 225 | if (!(mode & 0222)) dee.read_only = 1; |
233 | dee.archive = 1; | 226 | dee.archive = 1; |
234 | dee.hidden = name[0] == '.'; | 227 | dee.hidden = name[0] == '.'; |
235 | dee.fnode = fno; | 228 | dee.fnode = cpu_to_le32(fno); |
236 | dee.creation_date = dee.write_date = dee.read_date = gmt_to_local(dir->i_sb, get_seconds()); | 229 | dee.creation_date = dee.write_date = dee.read_date = cpu_to_le32(gmt_to_local(dir->i_sb, get_seconds())); |
237 | 230 | ||
238 | result = new_inode(dir->i_sb); | 231 | result = new_inode(dir->i_sb); |
239 | if (!result) | 232 | if (!result) |
@@ -242,7 +235,7 @@ static int hpfs_mknod(struct inode *dir, struct dentry *dentry, int mode, dev_t | |||
242 | hpfs_init_inode(result); | 235 | hpfs_init_inode(result); |
243 | result->i_ino = fno; | 236 | result->i_ino = fno; |
244 | hpfs_i(result)->i_parent_dir = dir->i_ino; | 237 | hpfs_i(result)->i_parent_dir = dir->i_ino; |
245 | result->i_ctime.tv_sec = result->i_mtime.tv_sec = result->i_atime.tv_sec = local_to_gmt(dir->i_sb, dee.creation_date); | 238 | 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)); |
246 | result->i_ctime.tv_nsec = 0; | 239 | result->i_ctime.tv_nsec = 0; |
247 | result->i_mtime.tv_nsec = 0; | 240 | result->i_mtime.tv_nsec = 0; |
248 | result->i_atime.tv_nsec = 0; | 241 | result->i_atime.tv_nsec = 0; |
@@ -254,8 +247,7 @@ static int hpfs_mknod(struct inode *dir, struct dentry *dentry, int mode, dev_t | |||
254 | result->i_blocks = 1; | 247 | result->i_blocks = 1; |
255 | init_special_inode(result, mode, rdev); | 248 | init_special_inode(result, mode, rdev); |
256 | 249 | ||
257 | mutex_lock(&hpfs_i(dir)->i_mutex); | 250 | r = hpfs_add_dirent(dir, name, len, &dee); |
258 | r = hpfs_add_dirent(dir, name, len, &dee, 0); | ||
259 | if (r == 1) | 251 | if (r == 1) |
260 | goto bail2; | 252 | goto bail2; |
261 | if (r == -1) { | 253 | if (r == -1) { |
@@ -264,19 +256,17 @@ static int hpfs_mknod(struct inode *dir, struct dentry *dentry, int mode, dev_t | |||
264 | } | 256 | } |
265 | fnode->len = len; | 257 | fnode->len = len; |
266 | memcpy(fnode->name, name, len > 15 ? 15 : len); | 258 | memcpy(fnode->name, name, len > 15 ? 15 : len); |
267 | fnode->up = dir->i_ino; | 259 | fnode->up = cpu_to_le32(dir->i_ino); |
268 | mark_buffer_dirty(bh); | 260 | mark_buffer_dirty(bh); |
269 | 261 | ||
270 | insert_inode_hash(result); | 262 | insert_inode_hash(result); |
271 | 263 | ||
272 | hpfs_write_inode_nolock(result); | 264 | hpfs_write_inode_nolock(result); |
273 | d_instantiate(dentry, result); | 265 | d_instantiate(dentry, result); |
274 | mutex_unlock(&hpfs_i(dir)->i_mutex); | ||
275 | brelse(bh); | 266 | brelse(bh); |
276 | hpfs_unlock(dir->i_sb); | 267 | hpfs_unlock(dir->i_sb); |
277 | return 0; | 268 | return 0; |
278 | bail2: | 269 | bail2: |
279 | mutex_unlock(&hpfs_i(dir)->i_mutex); | ||
280 | iput(result); | 270 | iput(result); |
281 | bail1: | 271 | bail1: |
282 | brelse(bh); | 272 | brelse(bh); |
@@ -310,8 +300,8 @@ static int hpfs_symlink(struct inode *dir, struct dentry *dentry, const char *sy | |||
310 | memset(&dee, 0, sizeof dee); | 300 | memset(&dee, 0, sizeof dee); |
311 | dee.archive = 1; | 301 | dee.archive = 1; |
312 | dee.hidden = name[0] == '.'; | 302 | dee.hidden = name[0] == '.'; |
313 | dee.fnode = fno; | 303 | dee.fnode = cpu_to_le32(fno); |
314 | dee.creation_date = dee.write_date = dee.read_date = gmt_to_local(dir->i_sb, get_seconds()); | 304 | dee.creation_date = dee.write_date = dee.read_date = cpu_to_le32(gmt_to_local(dir->i_sb, get_seconds())); |
315 | 305 | ||
316 | result = new_inode(dir->i_sb); | 306 | result = new_inode(dir->i_sb); |
317 | if (!result) | 307 | if (!result) |
@@ -319,7 +309,7 @@ static int hpfs_symlink(struct inode *dir, struct dentry *dentry, const char *sy | |||
319 | result->i_ino = fno; | 309 | result->i_ino = fno; |
320 | hpfs_init_inode(result); | 310 | hpfs_init_inode(result); |
321 | hpfs_i(result)->i_parent_dir = dir->i_ino; | 311 | hpfs_i(result)->i_parent_dir = dir->i_ino; |
322 | result->i_ctime.tv_sec = result->i_mtime.tv_sec = result->i_atime.tv_sec = local_to_gmt(dir->i_sb, dee.creation_date); | 312 | 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)); |
323 | result->i_ctime.tv_nsec = 0; | 313 | result->i_ctime.tv_nsec = 0; |
324 | result->i_mtime.tv_nsec = 0; | 314 | result->i_mtime.tv_nsec = 0; |
325 | result->i_atime.tv_nsec = 0; | 315 | result->i_atime.tv_nsec = 0; |
@@ -333,8 +323,7 @@ static int hpfs_symlink(struct inode *dir, struct dentry *dentry, const char *sy | |||
333 | result->i_op = &page_symlink_inode_operations; | 323 | result->i_op = &page_symlink_inode_operations; |
334 | result->i_data.a_ops = &hpfs_symlink_aops; | 324 | result->i_data.a_ops = &hpfs_symlink_aops; |
335 | 325 | ||
336 | mutex_lock(&hpfs_i(dir)->i_mutex); | 326 | r = hpfs_add_dirent(dir, name, len, &dee); |
337 | r = hpfs_add_dirent(dir, name, len, &dee, 0); | ||
338 | if (r == 1) | 327 | if (r == 1) |
339 | goto bail2; | 328 | goto bail2; |
340 | if (r == -1) { | 329 | if (r == -1) { |
@@ -343,7 +332,7 @@ static int hpfs_symlink(struct inode *dir, struct dentry *dentry, const char *sy | |||
343 | } | 332 | } |
344 | fnode->len = len; | 333 | fnode->len = len; |
345 | memcpy(fnode->name, name, len > 15 ? 15 : len); | 334 | memcpy(fnode->name, name, len > 15 ? 15 : len); |
346 | fnode->up = dir->i_ino; | 335 | fnode->up = cpu_to_le32(dir->i_ino); |
347 | hpfs_set_ea(result, fnode, "SYMLINK", symlink, strlen(symlink)); | 336 | hpfs_set_ea(result, fnode, "SYMLINK", symlink, strlen(symlink)); |
348 | mark_buffer_dirty(bh); | 337 | mark_buffer_dirty(bh); |
349 | brelse(bh); | 338 | brelse(bh); |
@@ -352,11 +341,9 @@ static int hpfs_symlink(struct inode *dir, struct dentry *dentry, const char *sy | |||
352 | 341 | ||
353 | hpfs_write_inode_nolock(result); | 342 | hpfs_write_inode_nolock(result); |
354 | d_instantiate(dentry, result); | 343 | d_instantiate(dentry, result); |
355 | mutex_unlock(&hpfs_i(dir)->i_mutex); | ||
356 | hpfs_unlock(dir->i_sb); | 344 | hpfs_unlock(dir->i_sb); |
357 | return 0; | 345 | return 0; |
358 | bail2: | 346 | bail2: |
359 | mutex_unlock(&hpfs_i(dir)->i_mutex); | ||
360 | iput(result); | 347 | iput(result); |
361 | bail1: | 348 | bail1: |
362 | brelse(bh); | 349 | brelse(bh); |
@@ -374,7 +361,6 @@ static int hpfs_unlink(struct inode *dir, struct dentry *dentry) | |||
374 | struct hpfs_dirent *de; | 361 | struct hpfs_dirent *de; |
375 | struct inode *inode = dentry->d_inode; | 362 | struct inode *inode = dentry->d_inode; |
376 | dnode_secno dno; | 363 | dnode_secno dno; |
377 | fnode_secno fno; | ||
378 | int r; | 364 | int r; |
379 | int rep = 0; | 365 | int rep = 0; |
380 | int err; | 366 | int err; |
@@ -382,8 +368,6 @@ static int hpfs_unlink(struct inode *dir, struct dentry *dentry) | |||
382 | hpfs_lock(dir->i_sb); | 368 | hpfs_lock(dir->i_sb); |
383 | hpfs_adjust_length(name, &len); | 369 | hpfs_adjust_length(name, &len); |
384 | again: | 370 | again: |
385 | mutex_lock(&hpfs_i(inode)->i_parent_mutex); | ||
386 | mutex_lock(&hpfs_i(dir)->i_mutex); | ||
387 | err = -ENOENT; | 371 | err = -ENOENT; |
388 | de = map_dirent(dir, hpfs_i(dir)->i_dno, name, len, &dno, &qbh); | 372 | de = map_dirent(dir, hpfs_i(dir)->i_dno, name, len, &dno, &qbh); |
389 | if (!de) | 373 | if (!de) |
@@ -397,7 +381,6 @@ again: | |||
397 | if (de->directory) | 381 | if (de->directory) |
398 | goto out1; | 382 | goto out1; |
399 | 383 | ||
400 | fno = de->fnode; | ||
401 | r = hpfs_remove_dirent(dir, dno, de, &qbh, 1); | 384 | r = hpfs_remove_dirent(dir, dno, de, &qbh, 1); |
402 | switch (r) { | 385 | switch (r) { |
403 | case 1: | 386 | case 1: |
@@ -410,8 +393,6 @@ again: | |||
410 | if (rep++) | 393 | if (rep++) |
411 | break; | 394 | break; |
412 | 395 | ||
413 | mutex_unlock(&hpfs_i(dir)->i_mutex); | ||
414 | mutex_unlock(&hpfs_i(inode)->i_parent_mutex); | ||
415 | dentry_unhash(dentry); | 396 | dentry_unhash(dentry); |
416 | if (!d_unhashed(dentry)) { | 397 | if (!d_unhashed(dentry)) { |
417 | dput(dentry); | 398 | dput(dentry); |
@@ -445,8 +426,6 @@ again: | |||
445 | out1: | 426 | out1: |
446 | hpfs_brelse4(&qbh); | 427 | hpfs_brelse4(&qbh); |
447 | out: | 428 | out: |
448 | mutex_unlock(&hpfs_i(dir)->i_mutex); | ||
449 | mutex_unlock(&hpfs_i(inode)->i_parent_mutex); | ||
450 | hpfs_unlock(dir->i_sb); | 429 | hpfs_unlock(dir->i_sb); |
451 | return err; | 430 | return err; |
452 | } | 431 | } |
@@ -459,15 +438,12 @@ static int hpfs_rmdir(struct inode *dir, struct dentry *dentry) | |||
459 | struct hpfs_dirent *de; | 438 | struct hpfs_dirent *de; |
460 | struct inode *inode = dentry->d_inode; | 439 | struct inode *inode = dentry->d_inode; |
461 | dnode_secno dno; | 440 | dnode_secno dno; |
462 | fnode_secno fno; | ||
463 | int n_items = 0; | 441 | int n_items = 0; |
464 | int err; | 442 | int err; |
465 | int r; | 443 | int r; |
466 | 444 | ||
467 | hpfs_adjust_length(name, &len); | 445 | hpfs_adjust_length(name, &len); |
468 | hpfs_lock(dir->i_sb); | 446 | hpfs_lock(dir->i_sb); |
469 | mutex_lock(&hpfs_i(inode)->i_parent_mutex); | ||
470 | mutex_lock(&hpfs_i(dir)->i_mutex); | ||
471 | err = -ENOENT; | 447 | err = -ENOENT; |
472 | de = map_dirent(dir, hpfs_i(dir)->i_dno, name, len, &dno, &qbh); | 448 | de = map_dirent(dir, hpfs_i(dir)->i_dno, name, len, &dno, &qbh); |
473 | if (!de) | 449 | if (!de) |
@@ -486,7 +462,6 @@ static int hpfs_rmdir(struct inode *dir, struct dentry *dentry) | |||
486 | if (n_items) | 462 | if (n_items) |
487 | goto out1; | 463 | goto out1; |
488 | 464 | ||
489 | fno = de->fnode; | ||
490 | r = hpfs_remove_dirent(dir, dno, de, &qbh, 1); | 465 | r = hpfs_remove_dirent(dir, dno, de, &qbh, 1); |
491 | switch (r) { | 466 | switch (r) { |
492 | case 1: | 467 | case 1: |
@@ -505,8 +480,6 @@ static int hpfs_rmdir(struct inode *dir, struct dentry *dentry) | |||
505 | out1: | 480 | out1: |
506 | hpfs_brelse4(&qbh); | 481 | hpfs_brelse4(&qbh); |
507 | out: | 482 | out: |
508 | mutex_unlock(&hpfs_i(dir)->i_mutex); | ||
509 | mutex_unlock(&hpfs_i(inode)->i_parent_mutex); | ||
510 | hpfs_unlock(dir->i_sb); | 483 | hpfs_unlock(dir->i_sb); |
511 | return err; | 484 | return err; |
512 | } | 485 | } |
@@ -568,12 +541,6 @@ static int hpfs_rename(struct inode *old_dir, struct dentry *old_dentry, | |||
568 | 541 | ||
569 | hpfs_lock(i->i_sb); | 542 | hpfs_lock(i->i_sb); |
570 | /* order doesn't matter, due to VFS exclusion */ | 543 | /* order doesn't matter, due to VFS exclusion */ |
571 | mutex_lock(&hpfs_i(i)->i_parent_mutex); | ||
572 | if (new_inode) | ||
573 | mutex_lock(&hpfs_i(new_inode)->i_parent_mutex); | ||
574 | mutex_lock(&hpfs_i(old_dir)->i_mutex); | ||
575 | if (new_dir != old_dir) | ||
576 | mutex_lock(&hpfs_i(new_dir)->i_mutex); | ||
577 | 544 | ||
578 | /* Erm? Moving over the empty non-busy directory is perfectly legal */ | 545 | /* Erm? Moving over the empty non-busy directory is perfectly legal */ |
579 | if (new_inode && S_ISDIR(new_inode->i_mode)) { | 546 | if (new_inode && S_ISDIR(new_inode->i_mode)) { |
@@ -610,9 +577,7 @@ static int hpfs_rename(struct inode *old_dir, struct dentry *old_dentry, | |||
610 | 577 | ||
611 | if (new_dir == old_dir) hpfs_brelse4(&qbh); | 578 | if (new_dir == old_dir) hpfs_brelse4(&qbh); |
612 | 579 | ||
613 | hpfs_lock_creation(i->i_sb); | 580 | if ((r = hpfs_add_dirent(new_dir, new_name, new_len, &de))) { |
614 | if ((r = hpfs_add_dirent(new_dir, new_name, new_len, &de, 1))) { | ||
615 | hpfs_unlock_creation(i->i_sb); | ||
616 | if (r == -1) hpfs_error(new_dir->i_sb, "hpfs_rename: dirent already exists!"); | 581 | if (r == -1) hpfs_error(new_dir->i_sb, "hpfs_rename: dirent already exists!"); |
617 | err = r == 1 ? -ENOSPC : -EFSERROR; | 582 | err = r == 1 ? -ENOSPC : -EFSERROR; |
618 | if (new_dir != old_dir) hpfs_brelse4(&qbh); | 583 | if (new_dir != old_dir) hpfs_brelse4(&qbh); |
@@ -621,20 +586,17 @@ static int hpfs_rename(struct inode *old_dir, struct dentry *old_dentry, | |||
621 | 586 | ||
622 | if (new_dir == old_dir) | 587 | if (new_dir == old_dir) |
623 | if (!(dep = map_dirent(old_dir, hpfs_i(old_dir)->i_dno, old_name, old_len, &dno, &qbh))) { | 588 | if (!(dep = map_dirent(old_dir, hpfs_i(old_dir)->i_dno, old_name, old_len, &dno, &qbh))) { |
624 | hpfs_unlock_creation(i->i_sb); | ||
625 | hpfs_error(i->i_sb, "lookup succeeded but map dirent failed at #2"); | 589 | hpfs_error(i->i_sb, "lookup succeeded but map dirent failed at #2"); |
626 | err = -ENOENT; | 590 | err = -ENOENT; |
627 | goto end1; | 591 | goto end1; |
628 | } | 592 | } |
629 | 593 | ||
630 | if ((r = hpfs_remove_dirent(old_dir, dno, dep, &qbh, 0))) { | 594 | if ((r = hpfs_remove_dirent(old_dir, dno, dep, &qbh, 0))) { |
631 | hpfs_unlock_creation(i->i_sb); | ||
632 | hpfs_error(i->i_sb, "hpfs_rename: could not remove dirent"); | 595 | hpfs_error(i->i_sb, "hpfs_rename: could not remove dirent"); |
633 | err = r == 2 ? -ENOSPC : -EFSERROR; | 596 | err = r == 2 ? -ENOSPC : -EFSERROR; |
634 | goto end1; | 597 | goto end1; |
635 | } | 598 | } |
636 | hpfs_unlock_creation(i->i_sb); | 599 | |
637 | |||
638 | end: | 600 | end: |
639 | hpfs_i(i)->i_parent_dir = new_dir->i_ino; | 601 | hpfs_i(i)->i_parent_dir = new_dir->i_ino; |
640 | if (S_ISDIR(i->i_mode)) { | 602 | if (S_ISDIR(i->i_mode)) { |
@@ -642,22 +604,14 @@ static int hpfs_rename(struct inode *old_dir, struct dentry *old_dentry, | |||
642 | drop_nlink(old_dir); | 604 | drop_nlink(old_dir); |
643 | } | 605 | } |
644 | if ((fnode = hpfs_map_fnode(i->i_sb, i->i_ino, &bh))) { | 606 | if ((fnode = hpfs_map_fnode(i->i_sb, i->i_ino, &bh))) { |
645 | fnode->up = new_dir->i_ino; | 607 | fnode->up = cpu_to_le32(new_dir->i_ino); |
646 | fnode->len = new_len; | 608 | fnode->len = new_len; |
647 | memcpy(fnode->name, new_name, new_len>15?15:new_len); | 609 | memcpy(fnode->name, new_name, new_len>15?15:new_len); |
648 | if (new_len < 15) memset(&fnode->name[new_len], 0, 15 - new_len); | 610 | if (new_len < 15) memset(&fnode->name[new_len], 0, 15 - new_len); |
649 | mark_buffer_dirty(bh); | 611 | mark_buffer_dirty(bh); |
650 | brelse(bh); | 612 | brelse(bh); |
651 | } | 613 | } |
652 | hpfs_i(i)->i_conv = hpfs_sb(i->i_sb)->sb_conv; | ||
653 | hpfs_decide_conv(i, new_name, new_len); | ||
654 | end1: | 614 | end1: |
655 | if (old_dir != new_dir) | ||
656 | mutex_unlock(&hpfs_i(new_dir)->i_mutex); | ||
657 | mutex_unlock(&hpfs_i(old_dir)->i_mutex); | ||
658 | mutex_unlock(&hpfs_i(i)->i_parent_mutex); | ||
659 | if (new_inode) | ||
660 | mutex_unlock(&hpfs_i(new_inode)->i_parent_mutex); | ||
661 | hpfs_unlock(i->i_sb); | 615 | hpfs_unlock(i->i_sb); |
662 | return err; | 616 | return err; |
663 | } | 617 | } |
diff --git a/fs/hpfs/super.c b/fs/hpfs/super.c index c89b40808587..98580a3b5005 100644 --- a/fs/hpfs/super.c +++ b/fs/hpfs/super.c | |||
@@ -18,15 +18,16 @@ | |||
18 | 18 | ||
19 | /* Mark the filesystem dirty, so that chkdsk checks it when os/2 booted */ | 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 | struct buffer_head *bh; | 24 | struct buffer_head *bh; |
25 | struct hpfs_spare_block *sb; | 25 | struct hpfs_spare_block *sb; |
26 | if ((sb = hpfs_map_sector(s, 17, &bh, 0))) { | 26 | if ((sb = hpfs_map_sector(s, 17, &bh, 0))) { |
27 | sb->dirty = 1; | 27 | sb->dirty = 1; |
28 | sb->old_wrote = 0; | 28 | sb->old_wrote = 0; |
29 | mark_buffer_dirty(bh); | 29 | mark_buffer_dirty(bh); |
30 | sync_dirty_buffer(bh); | ||
30 | brelse(bh); | 31 | brelse(bh); |
31 | } | 32 | } |
32 | } | 33 | } |
@@ -40,10 +41,12 @@ static void unmark_dirty(struct super_block *s) | |||
40 | struct buffer_head *bh; | 41 | struct buffer_head *bh; |
41 | struct hpfs_spare_block *sb; | 42 | struct hpfs_spare_block *sb; |
42 | if (s->s_flags & MS_RDONLY) return; | 43 | if (s->s_flags & MS_RDONLY) return; |
44 | sync_blockdev(s->s_bdev); | ||
43 | if ((sb = hpfs_map_sector(s, 17, &bh, 0))) { | 45 | if ((sb = hpfs_map_sector(s, 17, &bh, 0))) { |
44 | sb->dirty = hpfs_sb(s)->sb_chkdsk > 1 - hpfs_sb(s)->sb_was_error; | 46 | sb->dirty = hpfs_sb(s)->sb_chkdsk > 1 - hpfs_sb(s)->sb_was_error; |
45 | sb->old_wrote = hpfs_sb(s)->sb_chkdsk >= 2 && !hpfs_sb(s)->sb_was_error; | 47 | sb->old_wrote = hpfs_sb(s)->sb_chkdsk >= 2 && !hpfs_sb(s)->sb_was_error; |
46 | mark_buffer_dirty(bh); | 48 | mark_buffer_dirty(bh); |
49 | sync_dirty_buffer(bh); | ||
47 | brelse(bh); | 50 | brelse(bh); |
48 | } | 51 | } |
49 | } | 52 | } |
@@ -63,13 +66,13 @@ void hpfs_error(struct super_block *s, const char *fmt, ...) | |||
63 | if (!hpfs_sb(s)->sb_was_error) { | 66 | if (!hpfs_sb(s)->sb_was_error) { |
64 | if (hpfs_sb(s)->sb_err == 2) { | 67 | if (hpfs_sb(s)->sb_err == 2) { |
65 | printk("; crashing the system because you wanted it\n"); | 68 | printk("; crashing the system because you wanted it\n"); |
66 | mark_dirty(s); | 69 | mark_dirty(s, 0); |
67 | panic("HPFS panic"); | 70 | panic("HPFS panic"); |
68 | } else if (hpfs_sb(s)->sb_err == 1) { | 71 | } else if (hpfs_sb(s)->sb_err == 1) { |
69 | if (s->s_flags & MS_RDONLY) printk("; already mounted read-only\n"); | 72 | if (s->s_flags & MS_RDONLY) printk("; already mounted read-only\n"); |
70 | else { | 73 | else { |
71 | printk("; remounting read-only\n"); | 74 | printk("; remounting read-only\n"); |
72 | mark_dirty(s); | 75 | mark_dirty(s, 0); |
73 | s->s_flags |= MS_RDONLY; | 76 | s->s_flags |= MS_RDONLY; |
74 | } | 77 | } |
75 | } else if (s->s_flags & MS_RDONLY) printk("; going on - but anything won't be destroyed because it's read-only\n"); | 78 | } else if (s->s_flags & MS_RDONLY) printk("; going on - but anything won't be destroyed because it's read-only\n"); |
@@ -102,9 +105,12 @@ static void hpfs_put_super(struct super_block *s) | |||
102 | { | 105 | { |
103 | struct hpfs_sb_info *sbi = hpfs_sb(s); | 106 | struct hpfs_sb_info *sbi = hpfs_sb(s); |
104 | 107 | ||
108 | hpfs_lock(s); | ||
109 | unmark_dirty(s); | ||
110 | hpfs_unlock(s); | ||
111 | |||
105 | kfree(sbi->sb_cp_table); | 112 | kfree(sbi->sb_cp_table); |
106 | kfree(sbi->sb_bmp_dir); | 113 | kfree(sbi->sb_bmp_dir); |
107 | unmark_dirty(s); | ||
108 | s->s_fs_info = NULL; | 114 | s->s_fs_info = NULL; |
109 | kfree(sbi); | 115 | kfree(sbi); |
110 | } | 116 | } |
@@ -129,7 +135,7 @@ static unsigned count_bitmaps(struct super_block *s) | |||
129 | n_bands = (hpfs_sb(s)->sb_fs_size + 0x3fff) >> 14; | 135 | n_bands = (hpfs_sb(s)->sb_fs_size + 0x3fff) >> 14; |
130 | count = 0; | 136 | count = 0; |
131 | for (n = 0; n < n_bands; n++) | 137 | for (n = 0; n < n_bands; n++) |
132 | count += hpfs_count_one_bitmap(s, hpfs_sb(s)->sb_bmp_dir[n]); | 138 | count += hpfs_count_one_bitmap(s, le32_to_cpu(hpfs_sb(s)->sb_bmp_dir[n])); |
133 | return count; | 139 | return count; |
134 | } | 140 | } |
135 | 141 | ||
@@ -188,8 +194,6 @@ static void init_once(void *foo) | |||
188 | { | 194 | { |
189 | struct hpfs_inode_info *ei = (struct hpfs_inode_info *) foo; | 195 | struct hpfs_inode_info *ei = (struct hpfs_inode_info *) foo; |
190 | 196 | ||
191 | mutex_init(&ei->i_mutex); | ||
192 | mutex_init(&ei->i_parent_mutex); | ||
193 | inode_init_once(&ei->vfs_inode); | 197 | inode_init_once(&ei->vfs_inode); |
194 | } | 198 | } |
195 | 199 | ||
@@ -218,7 +222,6 @@ static void destroy_inodecache(void) | |||
218 | 222 | ||
219 | enum { | 223 | enum { |
220 | Opt_help, Opt_uid, Opt_gid, Opt_umask, Opt_case_lower, Opt_case_asis, | 224 | Opt_help, Opt_uid, Opt_gid, Opt_umask, Opt_case_lower, Opt_case_asis, |
221 | Opt_conv_binary, Opt_conv_text, Opt_conv_auto, | ||
222 | Opt_check_none, Opt_check_normal, Opt_check_strict, | 225 | Opt_check_none, Opt_check_normal, Opt_check_strict, |
223 | Opt_err_cont, Opt_err_ro, Opt_err_panic, | 226 | Opt_err_cont, Opt_err_ro, Opt_err_panic, |
224 | Opt_eas_no, Opt_eas_ro, Opt_eas_rw, | 227 | Opt_eas_no, Opt_eas_ro, Opt_eas_rw, |
@@ -233,9 +236,6 @@ static const match_table_t tokens = { | |||
233 | {Opt_umask, "umask=%o"}, | 236 | {Opt_umask, "umask=%o"}, |
234 | {Opt_case_lower, "case=lower"}, | 237 | {Opt_case_lower, "case=lower"}, |
235 | {Opt_case_asis, "case=asis"}, | 238 | {Opt_case_asis, "case=asis"}, |
236 | {Opt_conv_binary, "conv=binary"}, | ||
237 | {Opt_conv_text, "conv=text"}, | ||
238 | {Opt_conv_auto, "conv=auto"}, | ||
239 | {Opt_check_none, "check=none"}, | 239 | {Opt_check_none, "check=none"}, |
240 | {Opt_check_normal, "check=normal"}, | 240 | {Opt_check_normal, "check=normal"}, |
241 | {Opt_check_strict, "check=strict"}, | 241 | {Opt_check_strict, "check=strict"}, |
@@ -253,7 +253,7 @@ static const match_table_t tokens = { | |||
253 | }; | 253 | }; |
254 | 254 | ||
255 | static int parse_opts(char *opts, uid_t *uid, gid_t *gid, umode_t *umask, | 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 | int *chkdsk, int *timeshift) | 257 | int *chkdsk, int *timeshift) |
258 | { | 258 | { |
259 | char *p; | 259 | char *p; |
@@ -295,15 +295,6 @@ static int parse_opts(char *opts, uid_t *uid, gid_t *gid, umode_t *umask, | |||
295 | case Opt_case_asis: | 295 | case Opt_case_asis: |
296 | *lowercase = 0; | 296 | *lowercase = 0; |
297 | break; | 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 | break; | ||
307 | case Opt_check_none: | 298 | case Opt_check_none: |
308 | *chk = 0; | 299 | *chk = 0; |
309 | break; | 300 | break; |
@@ -370,9 +361,6 @@ HPFS filesystem options:\n\ | |||
370 | umask=xxx set mode of files that don't have mode specified in eas\n\ | 361 | umask=xxx set mode of files that don't have mode specified in eas\n\ |
371 | case=lower lowercase all files\n\ | 362 | case=lower lowercase all files\n\ |
372 | case=asis do not lowercase files (default)\n\ | 363 | case=asis do not lowercase files (default)\n\ |
373 | conv=binary do not convert CR/LF -> LF (default)\n\ | ||
374 | conv=auto convert only files with known text extensions\n\ | ||
375 | conv=text convert all files\n\ | ||
376 | check=none no fs checks - kernel may crash on corrupted filesystem\n\ | 364 | check=none no fs checks - kernel may crash on corrupted filesystem\n\ |
377 | check=normal do some checks - it should not crash (default)\n\ | 365 | check=normal do some checks - it should not crash (default)\n\ |
378 | check=strict do extra time-consuming checks, used for debugging\n\ | 366 | check=strict do extra time-consuming checks, used for debugging\n\ |
@@ -394,7 +382,7 @@ static int hpfs_remount_fs(struct super_block *s, int *flags, char *data) | |||
394 | uid_t uid; | 382 | uid_t uid; |
395 | gid_t gid; | 383 | gid_t gid; |
396 | umode_t umask; | 384 | umode_t umask; |
397 | int lowercase, conv, eas, chk, errs, chkdsk, timeshift; | 385 | int lowercase, eas, chk, errs, chkdsk, timeshift; |
398 | int o; | 386 | int o; |
399 | struct hpfs_sb_info *sbi = hpfs_sb(s); | 387 | struct hpfs_sb_info *sbi = hpfs_sb(s); |
400 | char *new_opts = kstrdup(data, GFP_KERNEL); | 388 | char *new_opts = kstrdup(data, GFP_KERNEL); |
@@ -405,11 +393,11 @@ static int hpfs_remount_fs(struct super_block *s, int *flags, char *data) | |||
405 | lock_super(s); | 393 | lock_super(s); |
406 | uid = sbi->sb_uid; gid = sbi->sb_gid; | 394 | uid = sbi->sb_uid; gid = sbi->sb_gid; |
407 | umask = 0777 & ~sbi->sb_mode; | 395 | umask = 0777 & ~sbi->sb_mode; |
408 | lowercase = sbi->sb_lowercase; conv = sbi->sb_conv; | 396 | lowercase = sbi->sb_lowercase; |
409 | eas = sbi->sb_eas; chk = sbi->sb_chk; chkdsk = sbi->sb_chkdsk; | 397 | eas = sbi->sb_eas; chk = sbi->sb_chk; chkdsk = sbi->sb_chkdsk; |
410 | errs = sbi->sb_err; timeshift = sbi->sb_timeshift; | 398 | errs = sbi->sb_err; timeshift = sbi->sb_timeshift; |
411 | 399 | ||
412 | if (!(o = parse_opts(data, &uid, &gid, &umask, &lowercase, &conv, | 400 | if (!(o = parse_opts(data, &uid, &gid, &umask, &lowercase, |
413 | &eas, &chk, &errs, &chkdsk, ×hift))) { | 401 | &eas, &chk, &errs, &chkdsk, ×hift))) { |
414 | printk("HPFS: bad mount options.\n"); | 402 | printk("HPFS: bad mount options.\n"); |
415 | goto out_err; | 403 | goto out_err; |
@@ -427,11 +415,11 @@ static int hpfs_remount_fs(struct super_block *s, int *flags, char *data) | |||
427 | 415 | ||
428 | sbi->sb_uid = uid; sbi->sb_gid = gid; | 416 | sbi->sb_uid = uid; sbi->sb_gid = gid; |
429 | sbi->sb_mode = 0777 & ~umask; | 417 | sbi->sb_mode = 0777 & ~umask; |
430 | sbi->sb_lowercase = lowercase; sbi->sb_conv = conv; | 418 | sbi->sb_lowercase = lowercase; |
431 | sbi->sb_eas = eas; sbi->sb_chk = chk; sbi->sb_chkdsk = chkdsk; | 419 | sbi->sb_eas = eas; sbi->sb_chk = chk; sbi->sb_chkdsk = chkdsk; |
432 | sbi->sb_err = errs; sbi->sb_timeshift = timeshift; | 420 | sbi->sb_err = errs; sbi->sb_timeshift = timeshift; |
433 | 421 | ||
434 | if (!(*flags & MS_RDONLY)) mark_dirty(s); | 422 | if (!(*flags & MS_RDONLY)) mark_dirty(s, 1); |
435 | 423 | ||
436 | replace_mount_options(s, new_opts); | 424 | replace_mount_options(s, new_opts); |
437 | 425 | ||
@@ -471,7 +459,7 @@ static int hpfs_fill_super(struct super_block *s, void *options, int silent) | |||
471 | uid_t uid; | 459 | uid_t uid; |
472 | gid_t gid; | 460 | gid_t gid; |
473 | umode_t umask; | 461 | umode_t umask; |
474 | int lowercase, conv, eas, chk, errs, chkdsk, timeshift; | 462 | int lowercase, eas, chk, errs, chkdsk, timeshift; |
475 | 463 | ||
476 | dnode_secno root_dno; | 464 | dnode_secno root_dno; |
477 | struct hpfs_dirent *de = NULL; | 465 | struct hpfs_dirent *de = NULL; |
@@ -479,11 +467,6 @@ static int hpfs_fill_super(struct super_block *s, void *options, int silent) | |||
479 | 467 | ||
480 | int o; | 468 | int o; |
481 | 469 | ||
482 | if (num_possible_cpus() > 1) { | ||
483 | printk(KERN_ERR "HPFS is not SMP safe\n"); | ||
484 | return -EINVAL; | ||
485 | } | ||
486 | |||
487 | save_mount_options(s, options); | 470 | save_mount_options(s, options); |
488 | 471 | ||
489 | sbi = kzalloc(sizeof(*sbi), GFP_KERNEL); | 472 | sbi = kzalloc(sizeof(*sbi), GFP_KERNEL); |
@@ -495,20 +478,20 @@ static int hpfs_fill_super(struct super_block *s, void *options, int silent) | |||
495 | sbi->sb_bmp_dir = NULL; | 478 | sbi->sb_bmp_dir = NULL; |
496 | sbi->sb_cp_table = NULL; | 479 | sbi->sb_cp_table = NULL; |
497 | 480 | ||
498 | mutex_init(&sbi->hpfs_creation_de); | 481 | mutex_init(&sbi->hpfs_mutex); |
482 | hpfs_lock(s); | ||
499 | 483 | ||
500 | uid = current_uid(); | 484 | uid = current_uid(); |
501 | gid = current_gid(); | 485 | gid = current_gid(); |
502 | umask = current_umask(); | 486 | umask = current_umask(); |
503 | lowercase = 0; | 487 | lowercase = 0; |
504 | conv = CONV_BINARY; | ||
505 | eas = 2; | 488 | eas = 2; |
506 | chk = 1; | 489 | chk = 1; |
507 | errs = 1; | 490 | errs = 1; |
508 | chkdsk = 1; | 491 | chkdsk = 1; |
509 | timeshift = 0; | 492 | timeshift = 0; |
510 | 493 | ||
511 | if (!(o = parse_opts(options, &uid, &gid, &umask, &lowercase, &conv, | 494 | if (!(o = parse_opts(options, &uid, &gid, &umask, &lowercase, |
512 | &eas, &chk, &errs, &chkdsk, ×hift))) { | 495 | &eas, &chk, &errs, &chkdsk, ×hift))) { |
513 | printk("HPFS: bad mount options.\n"); | 496 | printk("HPFS: bad mount options.\n"); |
514 | goto bail0; | 497 | goto bail0; |
@@ -526,9 +509,9 @@ static int hpfs_fill_super(struct super_block *s, void *options, int silent) | |||
526 | if (!(spareblock = hpfs_map_sector(s, 17, &bh2, 0))) goto bail3; | 509 | if (!(spareblock = hpfs_map_sector(s, 17, &bh2, 0))) goto bail3; |
527 | 510 | ||
528 | /* Check magics */ | 511 | /* Check magics */ |
529 | if (/*bootblock->magic != BB_MAGIC | 512 | if (/*le16_to_cpu(bootblock->magic) != BB_MAGIC |
530 | ||*/ superblock->magic != SB_MAGIC | 513 | ||*/ le32_to_cpu(superblock->magic) != SB_MAGIC |
531 | || spareblock->magic != SP_MAGIC) { | 514 | || le32_to_cpu(spareblock->magic) != SP_MAGIC) { |
532 | if (!silent) printk("HPFS: Bad magic ... probably not HPFS\n"); | 515 | if (!silent) printk("HPFS: Bad magic ... probably not HPFS\n"); |
533 | goto bail4; | 516 | goto bail4; |
534 | } | 517 | } |
@@ -549,19 +532,18 @@ static int hpfs_fill_super(struct super_block *s, void *options, int silent) | |||
549 | s->s_op = &hpfs_sops; | 532 | s->s_op = &hpfs_sops; |
550 | s->s_d_op = &hpfs_dentry_operations; | 533 | s->s_d_op = &hpfs_dentry_operations; |
551 | 534 | ||
552 | sbi->sb_root = superblock->root; | 535 | sbi->sb_root = le32_to_cpu(superblock->root); |
553 | sbi->sb_fs_size = superblock->n_sectors; | 536 | sbi->sb_fs_size = le32_to_cpu(superblock->n_sectors); |
554 | sbi->sb_bitmaps = superblock->bitmaps; | 537 | sbi->sb_bitmaps = le32_to_cpu(superblock->bitmaps); |
555 | sbi->sb_dirband_start = superblock->dir_band_start; | 538 | sbi->sb_dirband_start = le32_to_cpu(superblock->dir_band_start); |
556 | sbi->sb_dirband_size = superblock->n_dir_band; | 539 | sbi->sb_dirband_size = le32_to_cpu(superblock->n_dir_band); |
557 | sbi->sb_dmap = superblock->dir_band_bitmap; | 540 | sbi->sb_dmap = le32_to_cpu(superblock->dir_band_bitmap); |
558 | sbi->sb_uid = uid; | 541 | sbi->sb_uid = uid; |
559 | sbi->sb_gid = gid; | 542 | sbi->sb_gid = gid; |
560 | sbi->sb_mode = 0777 & ~umask; | 543 | sbi->sb_mode = 0777 & ~umask; |
561 | sbi->sb_n_free = -1; | 544 | sbi->sb_n_free = -1; |
562 | sbi->sb_n_free_dnodes = -1; | 545 | sbi->sb_n_free_dnodes = -1; |
563 | sbi->sb_lowercase = lowercase; | 546 | sbi->sb_lowercase = lowercase; |
564 | sbi->sb_conv = conv; | ||
565 | sbi->sb_eas = eas; | 547 | sbi->sb_eas = eas; |
566 | sbi->sb_chk = chk; | 548 | sbi->sb_chk = chk; |
567 | sbi->sb_chkdsk = chkdsk; | 549 | sbi->sb_chkdsk = chkdsk; |
@@ -573,7 +555,7 @@ static int hpfs_fill_super(struct super_block *s, void *options, int silent) | |||
573 | sbi->sb_max_fwd_alloc = 0xffffff; | 555 | sbi->sb_max_fwd_alloc = 0xffffff; |
574 | 556 | ||
575 | /* Load bitmap directory */ | 557 | /* Load bitmap directory */ |
576 | if (!(sbi->sb_bmp_dir = hpfs_load_bitmap_directory(s, superblock->bitmaps))) | 558 | if (!(sbi->sb_bmp_dir = hpfs_load_bitmap_directory(s, le32_to_cpu(superblock->bitmaps)))) |
577 | goto bail4; | 559 | goto bail4; |
578 | 560 | ||
579 | /* Check for general fs errors*/ | 561 | /* Check for general fs errors*/ |
@@ -591,20 +573,20 @@ static int hpfs_fill_super(struct super_block *s, void *options, int silent) | |||
591 | mark_buffer_dirty(bh2); | 573 | mark_buffer_dirty(bh2); |
592 | } | 574 | } |
593 | 575 | ||
594 | if (spareblock->hotfixes_used || spareblock->n_spares_used) { | 576 | if (le32_to_cpu(spareblock->hotfixes_used) || le32_to_cpu(spareblock->n_spares_used)) { |
595 | if (errs >= 2) { | 577 | if (errs >= 2) { |
596 | printk("HPFS: Hotfixes not supported here, try chkdsk\n"); | 578 | printk("HPFS: Hotfixes not supported here, try chkdsk\n"); |
597 | mark_dirty(s); | 579 | mark_dirty(s, 0); |
598 | goto bail4; | 580 | goto bail4; |
599 | } | 581 | } |
600 | hpfs_error(s, "hotfixes not supported here, try chkdsk"); | 582 | hpfs_error(s, "hotfixes not supported here, try chkdsk"); |
601 | if (errs == 0) printk("HPFS: Proceeding, but your filesystem will be probably corrupted by this driver...\n"); | 583 | if (errs == 0) printk("HPFS: Proceeding, but your filesystem will be probably corrupted by this driver...\n"); |
602 | else printk("HPFS: This driver may read bad files or crash when operating on disk with hotfixes.\n"); | 584 | else printk("HPFS: This driver may read bad files or crash when operating on disk with hotfixes.\n"); |
603 | } | 585 | } |
604 | if (spareblock->n_dnode_spares != spareblock->n_dnode_spares_free) { | 586 | if (le32_to_cpu(spareblock->n_dnode_spares) != le32_to_cpu(spareblock->n_dnode_spares_free)) { |
605 | if (errs >= 2) { | 587 | if (errs >= 2) { |
606 | printk("HPFS: Spare dnodes used, try chkdsk\n"); | 588 | printk("HPFS: Spare dnodes used, try chkdsk\n"); |
607 | mark_dirty(s); | 589 | mark_dirty(s, 0); |
608 | goto bail4; | 590 | goto bail4; |
609 | } | 591 | } |
610 | hpfs_error(s, "warning: spare dnodes used, try chkdsk"); | 592 | hpfs_error(s, "warning: spare dnodes used, try chkdsk"); |
@@ -612,26 +594,26 @@ static int hpfs_fill_super(struct super_block *s, void *options, int silent) | |||
612 | } | 594 | } |
613 | if (chk) { | 595 | if (chk) { |
614 | unsigned a; | 596 | unsigned a; |
615 | if (superblock->dir_band_end - superblock->dir_band_start + 1 != superblock->n_dir_band || | 597 | if (le32_to_cpu(superblock->dir_band_end) - le32_to_cpu(superblock->dir_band_start) + 1 != le32_to_cpu(superblock->n_dir_band) || |
616 | superblock->dir_band_end < superblock->dir_band_start || superblock->n_dir_band > 0x4000) { | 598 | le32_to_cpu(superblock->dir_band_end) < le32_to_cpu(superblock->dir_band_start) || le32_to_cpu(superblock->n_dir_band) > 0x4000) { |
617 | hpfs_error(s, "dir band size mismatch: dir_band_start==%08x, dir_band_end==%08x, n_dir_band==%08x", | 599 | hpfs_error(s, "dir band size mismatch: dir_band_start==%08x, dir_band_end==%08x, n_dir_band==%08x", |
618 | superblock->dir_band_start, superblock->dir_band_end, superblock->n_dir_band); | 600 | le32_to_cpu(superblock->dir_band_start), le32_to_cpu(superblock->dir_band_end), le32_to_cpu(superblock->n_dir_band)); |
619 | goto bail4; | 601 | goto bail4; |
620 | } | 602 | } |
621 | a = sbi->sb_dirband_size; | 603 | a = sbi->sb_dirband_size; |
622 | sbi->sb_dirband_size = 0; | 604 | sbi->sb_dirband_size = 0; |
623 | if (hpfs_chk_sectors(s, superblock->dir_band_start, superblock->n_dir_band, "dir_band") || | 605 | 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, superblock->dir_band_bitmap, 4, "dir_band_bitmap") || | 606 | hpfs_chk_sectors(s, le32_to_cpu(superblock->dir_band_bitmap), 4, "dir_band_bitmap") || |
625 | hpfs_chk_sectors(s, superblock->bitmaps, 4, "bitmaps")) { | 607 | hpfs_chk_sectors(s, le32_to_cpu(superblock->bitmaps), 4, "bitmaps")) { |
626 | mark_dirty(s); | 608 | mark_dirty(s, 0); |
627 | goto bail4; | 609 | goto bail4; |
628 | } | 610 | } |
629 | sbi->sb_dirband_size = a; | 611 | sbi->sb_dirband_size = a; |
630 | } else printk("HPFS: You really don't want any checks? You are crazy...\n"); | 612 | } else printk("HPFS: You really don't want any checks? You are crazy...\n"); |
631 | 613 | ||
632 | /* Load code page table */ | 614 | /* Load code page table */ |
633 | if (spareblock->n_code_pages) | 615 | if (le32_to_cpu(spareblock->n_code_pages)) |
634 | if (!(sbi->sb_cp_table = hpfs_load_code_page(s, spareblock->code_page_dir))) | 616 | if (!(sbi->sb_cp_table = hpfs_load_code_page(s, le32_to_cpu(spareblock->code_page_dir)))) |
635 | printk("HPFS: Warning: code page support is disabled\n"); | 617 | printk("HPFS: Warning: code page support is disabled\n"); |
636 | 618 | ||
637 | brelse(bh2); | 619 | brelse(bh2); |
@@ -660,13 +642,13 @@ static int hpfs_fill_super(struct super_block *s, void *options, int silent) | |||
660 | if (!de) | 642 | if (!de) |
661 | hpfs_error(s, "unable to find root dir"); | 643 | hpfs_error(s, "unable to find root dir"); |
662 | else { | 644 | else { |
663 | root->i_atime.tv_sec = local_to_gmt(s, de->read_date); | 645 | root->i_atime.tv_sec = local_to_gmt(s, le32_to_cpu(de->read_date)); |
664 | root->i_atime.tv_nsec = 0; | 646 | root->i_atime.tv_nsec = 0; |
665 | root->i_mtime.tv_sec = local_to_gmt(s, de->write_date); | 647 | root->i_mtime.tv_sec = local_to_gmt(s, le32_to_cpu(de->write_date)); |
666 | root->i_mtime.tv_nsec = 0; | 648 | root->i_mtime.tv_nsec = 0; |
667 | root->i_ctime.tv_sec = local_to_gmt(s, de->creation_date); | 649 | root->i_ctime.tv_sec = local_to_gmt(s, le32_to_cpu(de->creation_date)); |
668 | root->i_ctime.tv_nsec = 0; | 650 | root->i_ctime.tv_nsec = 0; |
669 | hpfs_i(root)->i_ea_size = de->ea_size; | 651 | hpfs_i(root)->i_ea_size = le16_to_cpu(de->ea_size); |
670 | hpfs_i(root)->i_parent_dir = root->i_ino; | 652 | hpfs_i(root)->i_parent_dir = root->i_ino; |
671 | if (root->i_size == -1) | 653 | if (root->i_size == -1) |
672 | root->i_size = 2048; | 654 | root->i_size = 2048; |
@@ -674,6 +656,7 @@ static int hpfs_fill_super(struct super_block *s, void *options, int silent) | |||
674 | root->i_blocks = 5; | 656 | root->i_blocks = 5; |
675 | hpfs_brelse4(&qbh); | 657 | hpfs_brelse4(&qbh); |
676 | } | 658 | } |
659 | hpfs_unlock(s); | ||
677 | return 0; | 660 | return 0; |
678 | 661 | ||
679 | bail4: brelse(bh2); | 662 | bail4: brelse(bh2); |
@@ -681,6 +664,7 @@ bail3: brelse(bh1); | |||
681 | bail2: brelse(bh0); | 664 | bail2: brelse(bh0); |
682 | bail1: | 665 | bail1: |
683 | bail0: | 666 | bail0: |
667 | hpfs_unlock(s); | ||
684 | kfree(sbi->sb_bmp_dir); | 668 | kfree(sbi->sb_bmp_dir); |
685 | kfree(sbi->sb_cp_table); | 669 | kfree(sbi->sb_cp_table); |
686 | s->s_fs_info = NULL; | 670 | s->s_fs_info = NULL; |
diff --git a/fs/partitions/efi.c b/fs/partitions/efi.c index ac0ccb5026a2..19d6750d1d6c 100644 --- a/fs/partitions/efi.c +++ b/fs/partitions/efi.c | |||
@@ -348,6 +348,12 @@ static int is_gpt_valid(struct parsed_partitions *state, u64 lba, | |||
348 | goto fail; | 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 | if (!(*ptes = alloc_read_gpt_entries(state, *gpt))) | 357 | if (!(*ptes = alloc_read_gpt_entries(state, *gpt))) |
352 | goto fail; | 358 | goto fail; |
353 | 359 | ||
diff --git a/fs/proc/task_mmu.c b/fs/proc/task_mmu.c index 2e7addfd9803..318d8654989b 100644 --- a/fs/proc/task_mmu.c +++ b/fs/proc/task_mmu.c | |||
@@ -214,7 +214,7 @@ static void show_map_vma(struct seq_file *m, struct vm_area_struct *vma) | |||
214 | int flags = vma->vm_flags; | 214 | int flags = vma->vm_flags; |
215 | unsigned long ino = 0; | 215 | unsigned long ino = 0; |
216 | unsigned long long pgoff = 0; | 216 | unsigned long long pgoff = 0; |
217 | unsigned long start; | 217 | unsigned long start, end; |
218 | dev_t dev = 0; | 218 | dev_t dev = 0; |
219 | int len; | 219 | int len; |
220 | 220 | ||
@@ -227,13 +227,15 @@ static void show_map_vma(struct seq_file *m, struct vm_area_struct *vma) | |||
227 | 227 | ||
228 | /* We don't show the stack guard page in /proc/maps */ | 228 | /* We don't show the stack guard page in /proc/maps */ |
229 | start = vma->vm_start; | 229 | start = vma->vm_start; |
230 | if (vma->vm_flags & VM_GROWSDOWN) | 230 | if (stack_guard_page_start(vma, start)) |
231 | if (!vma_stack_continue(vma->vm_prev, vma->vm_start)) | 231 | start += PAGE_SIZE; |
232 | start += PAGE_SIZE; | 232 | end = vma->vm_end; |
233 | if (stack_guard_page_end(vma, end)) | ||
234 | end -= PAGE_SIZE; | ||
233 | 235 | ||
234 | seq_printf(m, "%08lx-%08lx %c%c%c%c %08llx %02x:%02x %lu %n", | 236 | seq_printf(m, "%08lx-%08lx %c%c%c%c %08llx %02x:%02x %lu %n", |
235 | start, | 237 | start, |
236 | vma->vm_end, | 238 | end, |
237 | flags & VM_READ ? 'r' : '-', | 239 | flags & VM_READ ? 'r' : '-', |
238 | flags & VM_WRITE ? 'w' : '-', | 240 | flags & VM_WRITE ? 'w' : '-', |
239 | flags & VM_EXEC ? 'x' : '-', | 241 | flags & VM_EXEC ? 'x' : '-', |
diff --git a/include/drm/drm_mm.h b/include/drm/drm_mm.h index c2f93a8ae2e1..564b14aa7e16 100644 --- a/include/drm/drm_mm.h +++ b/include/drm/drm_mm.h | |||
@@ -86,7 +86,7 @@ static inline bool drm_mm_initialized(struct drm_mm *mm) | |||
86 | } | 86 | } |
87 | #define drm_mm_for_each_node(entry, mm) list_for_each_entry(entry, \ | 87 | #define drm_mm_for_each_node(entry, mm) list_for_each_entry(entry, \ |
88 | &(mm)->head_node.node_list, \ | 88 | &(mm)->head_node.node_list, \ |
89 | node_list); | 89 | node_list) |
90 | #define drm_mm_for_each_scanned_node_reverse(entry, n, mm) \ | 90 | #define drm_mm_for_each_scanned_node_reverse(entry, n, mm) \ |
91 | for (entry = (mm)->prev_scanned_node, \ | 91 | for (entry = (mm)->prev_scanned_node, \ |
92 | next = entry ? list_entry(entry->node_list.next, \ | 92 | next = entry ? list_entry(entry->node_list.next, \ |
diff --git a/include/linux/flex_array.h b/include/linux/flex_array.h index 70e4efabe0fb..ebeb2f3ad068 100644 --- a/include/linux/flex_array.h +++ b/include/linux/flex_array.h | |||
@@ -61,7 +61,7 @@ struct flex_array { | |||
61 | struct flex_array *flex_array_alloc(int element_size, unsigned int total, | 61 | struct flex_array *flex_array_alloc(int element_size, unsigned int total, |
62 | gfp_t flags); | 62 | gfp_t flags); |
63 | int flex_array_prealloc(struct flex_array *fa, unsigned int start, | 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 | void flex_array_free(struct flex_array *fa); | 65 | void flex_array_free(struct flex_array *fa); |
66 | void flex_array_free_parts(struct flex_array *fa); | 66 | void flex_array_free_parts(struct flex_array *fa); |
67 | int flex_array_put(struct flex_array *fa, unsigned int element_nr, void *src, | 67 | int flex_array_put(struct flex_array *fa, unsigned int element_nr, void *src, |
diff --git a/include/linux/ftrace_event.h b/include/linux/ftrace_event.h index 22b32af1b5ec..b5a550a39a70 100644 --- a/include/linux/ftrace_event.h +++ b/include/linux/ftrace_event.h | |||
@@ -37,6 +37,7 @@ struct trace_entry { | |||
37 | unsigned char flags; | 37 | unsigned char flags; |
38 | unsigned char preempt_count; | 38 | unsigned char preempt_count; |
39 | int pid; | 39 | int pid; |
40 | int padding; | ||
40 | }; | 41 | }; |
41 | 42 | ||
42 | #define FTRACE_MAX_EVENT \ | 43 | #define FTRACE_MAX_EVENT \ |
diff --git a/include/linux/mm.h b/include/linux/mm.h index 2348db26bc3d..6507dde38b16 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h | |||
@@ -1011,11 +1011,33 @@ int set_page_dirty_lock(struct page *page); | |||
1011 | int clear_page_dirty_for_io(struct page *page); | 1011 | int clear_page_dirty_for_io(struct page *page); |
1012 | 1012 | ||
1013 | /* Is the vma a continuation of the stack vma above it? */ | 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 | return vma && (vma->vm_end == addr) && (vma->vm_flags & VM_GROWSDOWN); | 1016 | return vma && (vma->vm_end == addr) && (vma->vm_flags & VM_GROWSDOWN); |
1017 | } | 1017 | } |
1018 | 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); | ||
1039 | } | ||
1040 | |||
1019 | extern unsigned long move_page_tables(struct vm_area_struct *vma, | 1041 | extern unsigned long move_page_tables(struct vm_area_struct *vma, |
1020 | unsigned long old_addr, struct vm_area_struct *new_vma, | 1042 | unsigned long old_addr, struct vm_area_struct *new_vma, |
1021 | unsigned long new_addr, unsigned long len); | 1043 | unsigned long new_addr, unsigned long len); |
diff --git a/include/linux/percpu.h b/include/linux/percpu.h index 3a5c4449fd36..8b97308e65df 100644 --- a/include/linux/percpu.h +++ b/include/linux/percpu.h | |||
@@ -948,7 +948,7 @@ do { \ | |||
948 | irqsafe_generic_cpu_cmpxchg_double(pcp1, pcp2, oval1, oval2, nval1, nval2) | 948 | irqsafe_generic_cpu_cmpxchg_double(pcp1, pcp2, oval1, oval2, nval1, nval2) |
949 | # endif | 949 | # endif |
950 | # define irqsafe_cpu_cmpxchg_double(pcp1, pcp2, oval1, oval2, nval1, nval2) \ | 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 | #endif | 952 | #endif |
953 | 953 | ||
954 | #endif /* __LINUX_PERCPU_H */ | 954 | #endif /* __LINUX_PERCPU_H */ |
diff --git a/include/linux/ptrace.h b/include/linux/ptrace.h index a1147e5dd245..9178d5cc0b01 100644 --- a/include/linux/ptrace.h +++ b/include/linux/ptrace.h | |||
@@ -189,6 +189,10 @@ static inline void ptrace_init_task(struct task_struct *child, bool ptrace) | |||
189 | child->ptrace = current->ptrace; | 189 | child->ptrace = current->ptrace; |
190 | __ptrace_link(child, current->parent); | 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 | /** |
@@ -350,6 +354,13 @@ extern int task_current_syscall(struct task_struct *target, long *callno, | |||
350 | unsigned long args[6], unsigned int maxargs, | 354 | unsigned long args[6], unsigned int maxargs, |
351 | unsigned long *sp, unsigned long *pc); | 355 | unsigned long *sp, unsigned long *pc); |
352 | 356 | ||
353 | #endif | 357 | #ifdef CONFIG_HAVE_HW_BREAKPOINT |
358 | extern int ptrace_get_breakpoints(struct task_struct *tsk); | ||
359 | extern void ptrace_put_breakpoints(struct task_struct *tsk); | ||
360 | #else | ||
361 | static inline void ptrace_put_breakpoints(struct task_struct *tsk) { } | ||
362 | #endif /* CONFIG_HAVE_HW_BREAKPOINT */ | ||
363 | |||
364 | #endif /* __KERNEL */ | ||
354 | 365 | ||
355 | #endif | 366 | #endif |
diff --git a/include/linux/sched.h b/include/linux/sched.h index 18d63cea2848..781abd137673 100644 --- a/include/linux/sched.h +++ b/include/linux/sched.h | |||
@@ -1537,6 +1537,9 @@ struct task_struct { | |||
1537 | unsigned long memsw_nr_pages; /* uncharged mem+swap usage */ | 1537 | unsigned long memsw_nr_pages; /* uncharged mem+swap usage */ |
1538 | } memcg_batch; | 1538 | } memcg_batch; |
1539 | #endif | 1539 | #endif |
1540 | #ifdef CONFIG_HAVE_HW_BREAKPOINT | ||
1541 | atomic_t ptrace_bp_refcnt; | ||
1542 | #endif | ||
1540 | }; | 1543 | }; |
1541 | 1544 | ||
1542 | /* Future-safe accessor for struct task_struct's cpus_allowed. */ | 1545 | /* Future-safe accessor for struct task_struct's cpus_allowed. */ |
diff --git a/kernel/exit.c b/kernel/exit.c index f5d2f63bae0b..8dd874181542 100644 --- a/kernel/exit.c +++ b/kernel/exit.c | |||
@@ -1016,7 +1016,7 @@ NORET_TYPE void do_exit(long code) | |||
1016 | /* | 1016 | /* |
1017 | * FIXME: do that only when needed, using sched_exit tracepoint | 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 | exit_notify(tsk, group_dead); | 1021 | exit_notify(tsk, group_dead); |
1022 | #ifdef CONFIG_NUMA | 1022 | #ifdef CONFIG_NUMA |
diff --git a/kernel/ptrace.c b/kernel/ptrace.c index 0fc1eed28d27..dc7ab65f3b36 100644 --- a/kernel/ptrace.c +++ b/kernel/ptrace.c | |||
@@ -22,6 +22,7 @@ | |||
22 | #include <linux/syscalls.h> | 22 | #include <linux/syscalls.h> |
23 | #include <linux/uaccess.h> | 23 | #include <linux/uaccess.h> |
24 | #include <linux/regset.h> | 24 | #include <linux/regset.h> |
25 | #include <linux/hw_breakpoint.h> | ||
25 | 26 | ||
26 | 27 | ||
27 | /* | 28 | /* |
@@ -879,3 +880,19 @@ asmlinkage long compat_sys_ptrace(compat_long_t request, compat_long_t pid, | |||
879 | return ret; | 880 | return ret; |
880 | } | 881 | } |
881 | #endif /* CONFIG_COMPAT */ | 882 | #endif /* CONFIG_COMPAT */ |
883 | |||
884 | #ifdef CONFIG_HAVE_HW_BREAKPOINT | ||
885 | int ptrace_get_breakpoints(struct task_struct *tsk) | ||
886 | { | ||
887 | if (atomic_inc_not_zero(&tsk->ptrace_bp_refcnt)) | ||
888 | return 0; | ||
889 | |||
890 | return -1; | ||
891 | } | ||
892 | |||
893 | void ptrace_put_breakpoints(struct task_struct *tsk) | ||
894 | { | ||
895 | if (atomic_dec_and_test(&tsk->ptrace_bp_refcnt)) | ||
896 | flush_ptrace_hw_breakpoint(tsk); | ||
897 | } | ||
898 | #endif /* CONFIG_HAVE_HW_BREAKPOINT */ | ||
diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c index d38c16a06a6f..1cb49be7c7fb 100644 --- a/kernel/trace/trace.c +++ b/kernel/trace/trace.c | |||
@@ -1110,6 +1110,7 @@ tracing_generic_entry_update(struct trace_entry *entry, unsigned long flags, | |||
1110 | 1110 | ||
1111 | entry->preempt_count = pc & 0xff; | 1111 | entry->preempt_count = pc & 0xff; |
1112 | entry->pid = (tsk) ? tsk->pid : 0; | 1112 | entry->pid = (tsk) ? tsk->pid : 0; |
1113 | entry->padding = 0; | ||
1113 | entry->flags = | 1114 | entry->flags = |
1114 | #ifdef CONFIG_TRACE_IRQFLAGS_SUPPORT | 1115 | #ifdef CONFIG_TRACE_IRQFLAGS_SUPPORT |
1115 | (irqs_disabled_flags(flags) ? TRACE_FLAG_IRQS_OFF : 0) | | 1116 | (irqs_disabled_flags(flags) ? TRACE_FLAG_IRQS_OFF : 0) | |
diff --git a/kernel/trace/trace_events.c b/kernel/trace/trace_events.c index e88f74fe1d4c..2fe110341359 100644 --- a/kernel/trace/trace_events.c +++ b/kernel/trace/trace_events.c | |||
@@ -116,6 +116,7 @@ static int trace_define_common_fields(void) | |||
116 | __common_field(unsigned char, flags); | 116 | __common_field(unsigned char, flags); |
117 | __common_field(unsigned char, preempt_count); | 117 | __common_field(unsigned char, preempt_count); |
118 | __common_field(int, pid); | 118 | __common_field(int, pid); |
119 | __common_field(int, padding); | ||
119 | 120 | ||
120 | return ret; | 121 | return ret; |
121 | } | 122 | } |
diff --git a/lib/flex_array.c b/lib/flex_array.c index c0ea40ba2082..854b57bd7d9d 100644 --- a/lib/flex_array.c +++ b/lib/flex_array.c | |||
@@ -232,10 +232,10 @@ EXPORT_SYMBOL(flex_array_clear); | |||
232 | 232 | ||
233 | /** | 233 | /** |
234 | * flex_array_prealloc - guarantee that array space exists | 234 | * flex_array_prealloc - guarantee that array space exists |
235 | * @fa: the flex array for which to preallocate parts | 235 | * @fa: the flex array for which to preallocate parts |
236 | * @start: index of first array element for which space is allocated | 236 | * @start: index of first array element for which space is allocated |
237 | * @end: index of last (inclusive) element for which space is allocated | 237 | * @nr_elements: number of elements for which space is allocated |
238 | * @flags: page allocation flags | 238 | * @flags: page allocation flags |
239 | * | 239 | * |
240 | * This will guarantee that no future calls to flex_array_put() | 240 | * This will guarantee that no future calls to flex_array_put() |
241 | * will allocate memory. It can be used if you are expecting to | 241 | * will allocate memory. It can be used if you are expecting to |
@@ -245,14 +245,24 @@ EXPORT_SYMBOL(flex_array_clear); | |||
245 | * Locking must be provided by the caller. | 245 | * Locking must be provided by the caller. |
246 | */ | 246 | */ |
247 | int flex_array_prealloc(struct flex_array *fa, unsigned int start, | 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 | int start_part; | 250 | int start_part; |
251 | int end_part; | 251 | int end_part; |
252 | int part_nr; | 252 | int part_nr; |
253 | unsigned int end; | ||
253 | struct flex_array_part *part; | 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 | return -ENOSPC; | 266 | return -ENOSPC; |
257 | if (elements_fit_in_base(fa)) | 267 | if (elements_fit_in_base(fa)) |
258 | return 0; | 268 | return 0; |
@@ -343,6 +353,8 @@ int flex_array_shrink(struct flex_array *fa) | |||
343 | int part_nr; | 353 | int part_nr; |
344 | int ret = 0; | 354 | int ret = 0; |
345 | 355 | ||
356 | if (!fa->total_nr_elements) | ||
357 | return 0; | ||
346 | if (elements_fit_in_base(fa)) | 358 | if (elements_fit_in_base(fa)) |
347 | return ret; | 359 | return ret; |
348 | for (part_nr = 0; part_nr < FLEX_ARRAY_NR_BASE_PTRS; part_nr++) { | 360 | for (part_nr = 0; part_nr < FLEX_ARRAY_NR_BASE_PTRS; part_nr++) { |
diff --git a/mm/memory.c b/mm/memory.c index 607098d47e74..61e66f026563 100644 --- a/mm/memory.c +++ b/mm/memory.c | |||
@@ -1359,7 +1359,7 @@ split_fallthrough: | |||
1359 | */ | 1359 | */ |
1360 | mark_page_accessed(page); | 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 | * The preliminary mapping check is mainly to avoid the | 1364 | * The preliminary mapping check is mainly to avoid the |
1365 | * pointless overhead of lock_page on the ZERO_PAGE | 1365 | * pointless overhead of lock_page on the ZERO_PAGE |
@@ -1412,9 +1412,8 @@ no_page_table: | |||
1412 | 1412 | ||
1413 | static inline int stack_guard_page(struct vm_area_struct *vma, unsigned long addr) | 1413 | static inline int stack_guard_page(struct vm_area_struct *vma, unsigned long addr) |
1414 | { | 1414 | { |
1415 | return (vma->vm_flags & VM_GROWSDOWN) && | 1415 | return stack_guard_page_start(vma, addr) || |
1416 | (vma->vm_start == addr) && | 1416 | stack_guard_page_end(vma, addr+PAGE_SIZE); |
1417 | !vma_stack_continue(vma->vm_prev, addr); | ||
1418 | } | 1417 | } |
1419 | 1418 | ||
1420 | /** | 1419 | /** |
@@ -1551,13 +1550,6 @@ int __get_user_pages(struct task_struct *tsk, struct mm_struct *mm, | |||
1551 | continue; | 1550 | continue; |
1552 | } | 1551 | } |
1553 | 1552 | ||
1554 | /* | ||
1555 | * If we don't actually want the page itself, | ||
1556 | * and it's the stack guard page, just skip it. | ||
1557 | */ | ||
1558 | if (!pages && stack_guard_page(vma, start)) | ||
1559 | goto next_page; | ||
1560 | |||
1561 | do { | 1553 | do { |
1562 | struct page *page; | 1554 | struct page *page; |
1563 | unsigned int foll_flags = gup_flags; | 1555 | unsigned int foll_flags = gup_flags; |
@@ -1574,6 +1566,11 @@ int __get_user_pages(struct task_struct *tsk, struct mm_struct *mm, | |||
1574 | int ret; | 1566 | int ret; |
1575 | unsigned int fault_flags = 0; | 1567 | unsigned int fault_flags = 0; |
1576 | 1568 | ||
1569 | /* For mlock, just skip the stack guard page. */ | ||
1570 | if (foll_flags & FOLL_MLOCK) { | ||
1571 | if (stack_guard_page(vma, start)) | ||
1572 | goto next_page; | ||
1573 | } | ||
1577 | if (foll_flags & FOLL_WRITE) | 1574 | if (foll_flags & FOLL_WRITE) |
1578 | fault_flags |= FAULT_FLAG_WRITE; | 1575 | fault_flags |= FAULT_FLAG_WRITE; |
1579 | if (nonblocking) | 1576 | if (nonblocking) |
diff --git a/mm/mlock.c b/mm/mlock.c index 6b55e3efe0df..516b2c2ddd5a 100644 --- a/mm/mlock.c +++ b/mm/mlock.c | |||
@@ -162,7 +162,7 @@ static long __mlock_vma_pages_range(struct vm_area_struct *vma, | |||
162 | VM_BUG_ON(end > vma->vm_end); | 162 | VM_BUG_ON(end > vma->vm_end); |
163 | VM_BUG_ON(!rwsem_is_locked(&mm->mmap_sem)); | 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 | * We want to touch writable mappings with a write fault in order | 167 | * We want to touch writable mappings with a write fault in order |
168 | * to break COW, except for shared mappings because these don't COW | 168 | * to break COW, except for shared mappings because these don't COW |
@@ -178,9 +178,6 @@ static long __mlock_vma_pages_range(struct vm_area_struct *vma, | |||
178 | if (vma->vm_flags & (VM_READ | VM_WRITE | VM_EXEC)) | 178 | if (vma->vm_flags & (VM_READ | VM_WRITE | VM_EXEC)) |
179 | gup_flags |= FOLL_FORCE; | 179 | gup_flags |= FOLL_FORCE; |
180 | 180 | ||
181 | if (vma->vm_flags & VM_LOCKED) | ||
182 | gup_flags |= FOLL_MLOCK; | ||
183 | |||
184 | return __get_user_pages(current, mm, addr, nr_pages, gup_flags, | 181 | return __get_user_pages(current, mm, addr, nr_pages, gup_flags, |
185 | NULL, NULL, nonblocking); | 182 | NULL, NULL, nonblocking); |
186 | } | 183 | } |
@@ -1767,10 +1767,13 @@ int expand_upwards(struct vm_area_struct *vma, unsigned long address) | |||
1767 | size = address - vma->vm_start; | 1767 | size = address - vma->vm_start; |
1768 | grow = (address - vma->vm_end) >> PAGE_SHIFT; | 1768 | grow = (address - vma->vm_end) >> PAGE_SHIFT; |
1769 | 1769 | ||
1770 | error = acct_stack_growth(vma, size, grow); | 1770 | error = -ENOMEM; |
1771 | if (!error) { | 1771 | if (vma->vm_pgoff + (size >> PAGE_SHIFT) >= vma->vm_pgoff) { |
1772 | vma->vm_end = address; | 1772 | error = acct_stack_growth(vma, size, grow); |
1773 | perf_event_mmap(vma); | 1773 | if (!error) { |
1774 | vma->vm_end = address; | ||
1775 | perf_event_mmap(vma); | ||
1776 | } | ||
1774 | } | 1777 | } |
1775 | } | 1778 | } |
1776 | vma_unlock_anon_vma(vma); | 1779 | vma_unlock_anon_vma(vma); |
@@ -1940,7 +1940,7 @@ redo: | |||
1940 | * Since this is without lock semantics the protection is only against | 1940 | * Since this is without lock semantics the protection is only against |
1941 | * code executing on this cpu *not* from access by other cpus. | 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 | s->cpu_slab->freelist, s->cpu_slab->tid, | 1944 | s->cpu_slab->freelist, s->cpu_slab->tid, |
1945 | object, tid, | 1945 | object, tid, |
1946 | get_freepointer(s, object), next_tid(tid)))) { | 1946 | get_freepointer(s, object), next_tid(tid)))) { |
@@ -2145,7 +2145,7 @@ redo: | |||
2145 | set_freepointer(s, object, c->freelist); | 2145 | set_freepointer(s, object, c->freelist); |
2146 | 2146 | ||
2147 | #ifdef CONFIG_CMPXCHG_LOCAL | 2147 | #ifdef CONFIG_CMPXCHG_LOCAL |
2148 | if (unlikely(!this_cpu_cmpxchg_double( | 2148 | if (unlikely(!irqsafe_cpu_cmpxchg_double( |
2149 | s->cpu_slab->freelist, s->cpu_slab->tid, | 2149 | s->cpu_slab->freelist, s->cpu_slab->tid, |
2150 | c->freelist, tid, | 2150 | c->freelist, tid, |
2151 | object, next_tid(tid)))) { | 2151 | object, next_tid(tid)))) { |
diff --git a/net/ceph/messenger.c b/net/ceph/messenger.c index 05f357828a2f..e15a82ccc05f 100644 --- a/net/ceph/messenger.c +++ b/net/ceph/messenger.c | |||
@@ -2267,6 +2267,19 @@ struct ceph_msg *ceph_msg_new(int type, int front_len, gfp_t flags) | |||
2267 | m->more_to_follow = false; | 2267 | m->more_to_follow = false; |
2268 | m->pool = NULL; | 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 | /* front */ | 2283 | /* front */ |
2271 | if (front_len) { | 2284 | if (front_len) { |
2272 | if (front_len > PAGE_CACHE_SIZE) { | 2285 | if (front_len > PAGE_CACHE_SIZE) { |
@@ -2286,19 +2299,6 @@ struct ceph_msg *ceph_msg_new(int type, int front_len, gfp_t flags) | |||
2286 | } | 2299 | } |
2287 | m->front.iov_len = front_len; | 2300 | m->front.iov_len = front_len; |
2288 | 2301 | ||
2289 | /* middle */ | ||
2290 | m->middle = NULL; | ||
2291 | |||
2292 | /* data */ | ||
2293 | m->nr_pages = 0; | ||
2294 | m->page_alignment = 0; | ||
2295 | m->pages = NULL; | ||
2296 | m->pagelist = NULL; | ||
2297 | m->bio = NULL; | ||
2298 | m->bio_iter = NULL; | ||
2299 | m->bio_seg = 0; | ||
2300 | m->trail = NULL; | ||
2301 | |||
2302 | dout("ceph_msg_new %p front %d\n", m, front_len); | 2302 | dout("ceph_msg_new %p front %d\n", m, front_len); |
2303 | return m; | 2303 | return m; |
2304 | 2304 | ||
diff --git a/net/ceph/osd_client.c b/net/ceph/osd_client.c index 5a80f41c0cba..6b5dda1cb5df 100644 --- a/net/ceph/osd_client.c +++ b/net/ceph/osd_client.c | |||
@@ -470,8 +470,8 @@ struct ceph_osd_request *ceph_osdc_new_request(struct ceph_osd_client *osdc, | |||
470 | snapc, ops, | 470 | snapc, ops, |
471 | use_mempool, | 471 | use_mempool, |
472 | GFP_NOFS, NULL, NULL); | 472 | GFP_NOFS, NULL, NULL); |
473 | if (IS_ERR(req)) | 473 | if (!req) |
474 | return req; | 474 | return NULL; |
475 | 475 | ||
476 | /* calculate max write size */ | 476 | /* calculate max write size */ |
477 | calc_layout(osdc, vino, layout, off, plen, req, ops); | 477 | calc_layout(osdc, vino, layout, off, plen, req, ops); |
diff --git a/security/selinux/hooks.c b/security/selinux/hooks.c index f7cf0ea6faea..8fb248843009 100644 --- a/security/selinux/hooks.c +++ b/security/selinux/hooks.c | |||
@@ -1578,7 +1578,8 @@ static int may_create(struct inode *dir, | |||
1578 | return rc; | 1578 | return rc; |
1579 | 1579 | ||
1580 | if (!newsid || !(sbsec->flags & SE_SBLABELSUPP)) { | 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 | if (rc) | 1583 | if (rc) |
1583 | return rc; | 1584 | return rc; |
1584 | } | 1585 | } |
diff --git a/security/selinux/ss/policydb.c b/security/selinux/ss/policydb.c index e7b850ad57ee..e6e7ce0d3d55 100644 --- a/security/selinux/ss/policydb.c +++ b/security/selinux/ss/policydb.c | |||
@@ -502,7 +502,7 @@ static int policydb_index(struct policydb *p) | |||
502 | goto out; | 502 | goto out; |
503 | 503 | ||
504 | rc = flex_array_prealloc(p->type_val_to_struct_array, 0, | 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 | if (rc) | 506 | if (rc) |
507 | goto out; | 507 | goto out; |
508 | 508 | ||
@@ -519,7 +519,7 @@ static int policydb_index(struct policydb *p) | |||
519 | goto out; | 519 | goto out; |
520 | 520 | ||
521 | rc = flex_array_prealloc(p->sym_val_to_name[i], | 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 | GFP_KERNEL | __GFP_ZERO); | 523 | GFP_KERNEL | __GFP_ZERO); |
524 | if (rc) | 524 | if (rc) |
525 | goto out; | 525 | goto out; |
@@ -2375,7 +2375,7 @@ int policydb_read(struct policydb *p, void *fp) | |||
2375 | goto bad; | 2375 | goto bad; |
2376 | 2376 | ||
2377 | /* preallocate so we don't have to worry about the put ever failing */ | 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 | GFP_KERNEL | __GFP_ZERO); | 2379 | GFP_KERNEL | __GFP_ZERO); |
2380 | if (rc) | 2380 | if (rc) |
2381 | goto bad; | 2381 | goto bad; |
diff --git a/sound/soc/davinci/davinci-mcasp.c b/sound/soc/davinci/davinci-mcasp.c index a5af834c8ef5..4ddc6d3b6678 100644 --- a/sound/soc/davinci/davinci-mcasp.c +++ b/sound/soc/davinci/davinci-mcasp.c | |||
@@ -434,17 +434,21 @@ static int davinci_mcasp_set_dai_fmt(struct snd_soc_dai *cpu_dai, | |||
434 | mcasp_set_bits(base + DAVINCI_MCASP_ACLKRCTL_REG, ACLKRE); | 434 | mcasp_set_bits(base + DAVINCI_MCASP_ACLKRCTL_REG, ACLKRE); |
435 | mcasp_set_bits(base + DAVINCI_MCASP_RXFMCTL_REG, AFSRE); | 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 | break; | 439 | break; |
439 | case SND_SOC_DAIFMT_CBM_CFS: | 440 | case SND_SOC_DAIFMT_CBM_CFS: |
440 | /* codec is clock master and frame slave */ | 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 | mcasp_set_bits(base + DAVINCI_MCASP_TXFMCTL_REG, AFSXE); | 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 | mcasp_set_bits(base + DAVINCI_MCASP_RXFMCTL_REG, AFSRE); | 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 | break; | 452 | break; |
449 | case SND_SOC_DAIFMT_CBM_CFM: | 453 | case SND_SOC_DAIFMT_CBM_CFM: |
450 | /* codec is clock and frame master */ | 454 | /* codec is clock and frame master */ |
@@ -454,7 +458,8 @@ static int davinci_mcasp_set_dai_fmt(struct snd_soc_dai *cpu_dai, | |||
454 | mcasp_clr_bits(base + DAVINCI_MCASP_ACLKRCTL_REG, ACLKRE); | 458 | mcasp_clr_bits(base + DAVINCI_MCASP_ACLKRCTL_REG, ACLKRE); |
455 | mcasp_clr_bits(base + DAVINCI_MCASP_RXFMCTL_REG, AFSRE); | 459 | mcasp_clr_bits(base + DAVINCI_MCASP_RXFMCTL_REG, AFSRE); |
456 | 460 | ||
457 | mcasp_clr_bits(base + DAVINCI_MCASP_PDIR_REG, (0x3f << 26)); | 461 | mcasp_clr_bits(base + DAVINCI_MCASP_PDIR_REG, |
462 | ACLKX | AHCLKX | AFSX | ACLKR | AHCLKR | AFSR); | ||
458 | break; | 463 | break; |
459 | 464 | ||
460 | default: | 465 | default: |
@@ -644,7 +649,7 @@ static void davinci_hw_param(struct davinci_audio_dev *dev, int stream) | |||
644 | mcasp_set_reg(dev->base + DAVINCI_MCASP_TXTDM_REG, mask); | 649 | mcasp_set_reg(dev->base + DAVINCI_MCASP_TXTDM_REG, mask); |
645 | mcasp_set_bits(dev->base + DAVINCI_MCASP_TXFMT_REG, TXORD); | 650 | mcasp_set_bits(dev->base + DAVINCI_MCASP_TXFMT_REG, TXORD); |
646 | 651 | ||
647 | if ((dev->tdm_slots >= 2) || (dev->tdm_slots <= 32)) | 652 | if ((dev->tdm_slots >= 2) && (dev->tdm_slots <= 32)) |
648 | mcasp_mod_bits(dev->base + DAVINCI_MCASP_TXFMCTL_REG, | 653 | mcasp_mod_bits(dev->base + DAVINCI_MCASP_TXFMCTL_REG, |
649 | FSXMOD(dev->tdm_slots), FSXMOD(0x1FF)); | 654 | FSXMOD(dev->tdm_slots), FSXMOD(0x1FF)); |
650 | else | 655 | else |
@@ -660,7 +665,7 @@ static void davinci_hw_param(struct davinci_audio_dev *dev, int stream) | |||
660 | AHCLKRE); | 665 | AHCLKRE); |
661 | mcasp_set_reg(dev->base + DAVINCI_MCASP_RXTDM_REG, mask); | 666 | mcasp_set_reg(dev->base + DAVINCI_MCASP_RXTDM_REG, mask); |
662 | 667 | ||
663 | if ((dev->tdm_slots >= 2) || (dev->tdm_slots <= 32)) | 668 | if ((dev->tdm_slots >= 2) && (dev->tdm_slots <= 32)) |
664 | mcasp_mod_bits(dev->base + DAVINCI_MCASP_RXFMCTL_REG, | 669 | mcasp_mod_bits(dev->base + DAVINCI_MCASP_RXFMCTL_REG, |
665 | FSRMOD(dev->tdm_slots), FSRMOD(0x1FF)); | 670 | FSRMOD(dev->tdm_slots), FSRMOD(0x1FF)); |
666 | else | 671 | else |
diff --git a/sound/soc/samsung/Kconfig b/sound/soc/samsung/Kconfig index a3fdfb631469..4b96b18a1bb7 100644 --- a/sound/soc/samsung/Kconfig +++ b/sound/soc/samsung/Kconfig | |||
@@ -1,6 +1,6 @@ | |||
1 | config SND_SOC_SAMSUNG | 1 | config SND_SOC_SAMSUNG |
2 | tristate "ASoC support for Samsung" | 2 | tristate "ASoC support for Samsung" |
3 | depends on ARCH_S3C2410 || ARCH_S3C64XX || ARCH_S5PC100 || ARCH_S5PV210 || ARCH_S5P64X0 || ARCH_S5P6442 || ARCH_EXYNOS4 | 3 | depends on ARCH_S3C2410 || ARCH_S3C64XX || ARCH_S5PC100 || ARCH_S5PV210 || ARCH_S5P64X0 || ARCH_EXYNOS4 |
4 | select S3C64XX_DMA if ARCH_S3C64XX | 4 | select S3C64XX_DMA if ARCH_S3C64XX |
5 | select S3C2410_DMA if ARCH_S3C2410 | 5 | select S3C2410_DMA if ARCH_S3C2410 |
6 | help | 6 | help |
@@ -55,7 +55,7 @@ config SND_SOC_SAMSUNG_JIVE_WM8750 | |||
55 | 55 | ||
56 | config SND_SOC_SAMSUNG_SMDK_WM8580 | 56 | config SND_SOC_SAMSUNG_SMDK_WM8580 |
57 | tristate "SoC I2S Audio support for WM8580 on SMDK" | 57 | tristate "SoC I2S Audio support for WM8580 on SMDK" |
58 | depends on SND_SOC_SAMSUNG && (MACH_SMDK6410 || MACH_SMDKC100 || MACH_SMDK6440 || MACH_SMDK6450 || MACH_SMDK6442 || MACH_SMDKV210 || MACH_SMDKC110) | 58 | depends on SND_SOC_SAMSUNG && (MACH_SMDK6410 || MACH_SMDKC100 || MACH_SMDK6440 || MACH_SMDK6450 || MACH_SMDKV210 || MACH_SMDKC110) |
59 | select SND_SOC_WM8580 | 59 | select SND_SOC_WM8580 |
60 | select SND_SAMSUNG_I2S | 60 | select SND_SAMSUNG_I2S |
61 | help | 61 | help |
diff --git a/sound/soc/samsung/goni_wm8994.c b/sound/soc/samsung/goni_wm8994.c index f6b3a3ce5919..0e80daee8b6f 100644 --- a/sound/soc/samsung/goni_wm8994.c +++ b/sound/soc/samsung/goni_wm8994.c | |||
@@ -236,18 +236,18 @@ static struct snd_soc_dai_link goni_dai[] = { | |||
236 | .name = "WM8994", | 236 | .name = "WM8994", |
237 | .stream_name = "WM8994 HiFi", | 237 | .stream_name = "WM8994 HiFi", |
238 | .cpu_dai_name = "samsung-i2s.0", | 238 | .cpu_dai_name = "samsung-i2s.0", |
239 | .codec_dai_name = "wm8994-hifi", | 239 | .codec_dai_name = "wm8994-aif1", |
240 | .platform_name = "samsung-audio", | 240 | .platform_name = "samsung-audio", |
241 | .codec_name = "wm8994-codec.0-0x1a", | 241 | .codec_name = "wm8994-codec.0-001a", |
242 | .init = goni_wm8994_init, | 242 | .init = goni_wm8994_init, |
243 | .ops = &goni_hifi_ops, | 243 | .ops = &goni_hifi_ops, |
244 | }, { | 244 | }, { |
245 | .name = "WM8994 Voice", | 245 | .name = "WM8994 Voice", |
246 | .stream_name = "Voice", | 246 | .stream_name = "Voice", |
247 | .cpu_dai_name = "goni-voice-dai", | 247 | .cpu_dai_name = "goni-voice-dai", |
248 | .codec_dai_name = "wm8994-voice", | 248 | .codec_dai_name = "wm8994-aif2", |
249 | .platform_name = "samsung-audio", | 249 | .platform_name = "samsung-audio", |
250 | .codec_name = "wm8994-codec.0-0x1a", | 250 | .codec_name = "wm8994-codec.0-001a", |
251 | .ops = &goni_voice_ops, | 251 | .ops = &goni_voice_ops, |
252 | }, | 252 | }, |
253 | }; | 253 | }; |
diff --git a/sound/soc/samsung/smdk_wm8580.c b/sound/soc/samsung/smdk_wm8580.c index 8aacf23d6f3a..3d26f6607aa4 100644 --- a/sound/soc/samsung/smdk_wm8580.c +++ b/sound/soc/samsung/smdk_wm8580.c | |||
@@ -249,7 +249,7 @@ static int __init smdk_audio_init(void) | |||
249 | int ret; | 249 | int ret; |
250 | char *str; | 250 | char *str; |
251 | 251 | ||
252 | if (machine_is_smdkc100() || machine_is_smdk6442() | 252 | if (machine_is_smdkc100() |
253 | || machine_is_smdkv210() || machine_is_smdkc110()) { | 253 | || machine_is_smdkv210() || machine_is_smdkc110()) { |
254 | smdk.num_links = 3; | 254 | smdk.num_links = 3; |
255 | /* Secondary is at offset SAMSUNG_I2S_SECOFF from Primary */ | 255 | /* Secondary is at offset SAMSUNG_I2S_SECOFF from Primary */ |
diff --git a/tools/perf/Makefile b/tools/perf/Makefile index 207dee5c5b16..0c542563ea6c 100644 --- a/tools/perf/Makefile +++ b/tools/perf/Makefile | |||
@@ -35,15 +35,21 @@ ARCH ?= $(shell echo $(uname_M) | sed -e s/i.86/i386/ -e s/sun4u/sparc64/ \ | |||
35 | -e s/ppc.*/powerpc/ -e s/mips.*/mips/ \ | 35 | -e s/ppc.*/powerpc/ -e s/mips.*/mips/ \ |
36 | -e s/sh[234].*/sh/ ) | 36 | -e s/sh[234].*/sh/ ) |
37 | 37 | ||
38 | CC = $(CROSS_COMPILE)gcc | ||
39 | AR = $(CROSS_COMPILE)ar | ||
40 | |||
38 | # Additional ARCH settings for x86 | 41 | # Additional ARCH settings for x86 |
39 | ifeq ($(ARCH),i386) | 42 | ifeq ($(ARCH),i386) |
40 | ARCH := x86 | 43 | ARCH := x86 |
41 | endif | 44 | endif |
42 | ifeq ($(ARCH),x86_64) | 45 | ifeq ($(ARCH),x86_64) |
43 | RAW_ARCH := x86_64 | 46 | ARCH := x86 |
44 | ARCH := x86 | 47 | IS_X86_64 := $(shell echo __x86_64__ | ${CC} -E -xc - | tail -n 1) |
45 | ARCH_CFLAGS := -DARCH_X86_64 | 48 | ifeq (${IS_X86_64}, 1) |
46 | ARCH_INCLUDE = ../../arch/x86/lib/memcpy_64.S | 49 | RAW_ARCH := x86_64 |
50 | ARCH_CFLAGS := -DARCH_X86_64 | ||
51 | ARCH_INCLUDE = ../../arch/x86/lib/memcpy_64.S | ||
52 | endif | ||
47 | endif | 53 | endif |
48 | 54 | ||
49 | # | 55 | # |
@@ -119,8 +125,6 @@ lib = lib | |||
119 | 125 | ||
120 | export prefix bindir sharedir sysconfdir | 126 | export prefix bindir sharedir sysconfdir |
121 | 127 | ||
122 | CC = $(CROSS_COMPILE)gcc | ||
123 | AR = $(CROSS_COMPILE)ar | ||
124 | RM = rm -f | 128 | RM = rm -f |
125 | MKDIR = mkdir | 129 | MKDIR = mkdir |
126 | FIND = find | 130 | FIND = find |