Skip to content

Commit a63ecd8

Browse files
committed
Merge master.kernel.org:/home/rmk/linux-2.6-arm
* master.kernel.org:/home/rmk/linux-2.6-arm: cyber2000fb: fix console in truecolor modes cyber2000fb: fix machine hang on module load SA1111: Eliminate use after free ARM: Fix Versatile/Realview/VExpress MMC card detection sense ARM: 6279/1: highmem: fix SMP preemption bug in kmap_high_l1_vipt ARM: Add barriers to io{read,write}{8,16,32} accessors as well ARM: 6273/1: Add barriers to the I/O accessors if ARM_DMA_MEM_BUFFERABLE ARM: 6272/1: Convert L2x0 to use the IO relaxed operations ARM: 6271/1: Introduce *_relaxed() I/O accessors ARM: 6275/1: ux500: don't use writeb() in uncompress.h ARM: 6270/1: clean files in arch/arm/boot/compressed/ ARM: Fix csum_partial_copy_from_user()
2 parents fc71ff8 + e76df4d commit a63ecd8

File tree

11 files changed

+75
-49
lines changed

11 files changed

+75
-49
lines changed

arch/arm/boot/compressed/Makefile

+3
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,9 @@ targets := vmlinux vmlinux.lds \
7171
piggy.$(suffix_y) piggy.$(suffix_y).o \
7272
font.o font.c head.o misc.o $(OBJS)
7373

74+
# Make sure files are removed during clean
75+
extra-y += piggy.gzip piggy.lzo piggy.lzma lib1funcs.S
76+
7477
ifeq ($(CONFIG_FUNCTION_TRACER),y)
7578
ORIG_CFLAGS := $(KBUILD_CFLAGS)
7679
KBUILD_CFLAGS = $(subst -pg, , $(ORIG_CFLAGS))

arch/arm/common/sa1111.c

+2-3
Original file line numberDiff line numberDiff line change
@@ -1028,13 +1028,12 @@ static int sa1111_remove(struct platform_device *pdev)
10281028
struct sa1111 *sachip = platform_get_drvdata(pdev);
10291029

10301030
if (sachip) {
1031-
__sa1111_remove(sachip);
1032-
platform_set_drvdata(pdev, NULL);
1033-
10341031
#ifdef CONFIG_PM
10351032
kfree(sachip->saved_state);
10361033
sachip->saved_state = NULL;
10371034
#endif
1035+
__sa1111_remove(sachip);
1036+
platform_set_drvdata(pdev, NULL);
10381037
}
10391038

10401039
return 0;

arch/arm/include/asm/io.h

+32-18
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
#include <linux/types.h>
2727
#include <asm/byteorder.h>
2828
#include <asm/memory.h>
29+
#include <asm/system.h>
2930

3031
/*
3132
* ISA I/O bus memory addresses are 1:1 with the physical address.
@@ -179,25 +180,38 @@ extern void _memset_io(volatile void __iomem *, int, size_t);
179180
* IO port primitives for more information.
180181
*/
181182
#ifdef __mem_pci
182-
#define readb(c) ({ __u8 __v = __raw_readb(__mem_pci(c)); __v; })
183-
#define readw(c) ({ __u16 __v = le16_to_cpu((__force __le16) \
183+
#define readb_relaxed(c) ({ u8 __v = __raw_readb(__mem_pci(c)); __v; })
184+
#define readw_relaxed(c) ({ u16 __v = le16_to_cpu((__force __le16) \
184185
__raw_readw(__mem_pci(c))); __v; })
185-
#define readl(c) ({ __u32 __v = le32_to_cpu((__force __le32) \
186+
#define readl_relaxed(c) ({ u32 __v = le32_to_cpu((__force __le32) \
186187
__raw_readl(__mem_pci(c))); __v; })
187-
#define readb_relaxed(addr) readb(addr)
188-
#define readw_relaxed(addr) readw(addr)
189-
#define readl_relaxed(addr) readl(addr)
188+
189+
#define writeb_relaxed(v,c) ((void)__raw_writeb(v,__mem_pci(c)))
190+
#define writew_relaxed(v,c) ((void)__raw_writew((__force u16) \
191+
cpu_to_le16(v),__mem_pci(c)))
192+
#define writel_relaxed(v,c) ((void)__raw_writel((__force u32) \
193+
cpu_to_le32(v),__mem_pci(c)))
194+
195+
#ifdef CONFIG_ARM_DMA_MEM_BUFFERABLE
196+
#define __iormb() rmb()
197+
#define __iowmb() wmb()
198+
#else
199+
#define __iormb() do { } while (0)
200+
#define __iowmb() do { } while (0)
201+
#endif
202+
203+
#define readb(c) ({ u8 __v = readb_relaxed(c); __iormb(); __v; })
204+
#define readw(c) ({ u16 __v = readw_relaxed(c); __iormb(); __v; })
205+
#define readl(c) ({ u32 __v = readl_relaxed(c); __iormb(); __v; })
206+
207+
#define writeb(v,c) ({ __iowmb(); writeb_relaxed(v,c); })
208+
#define writew(v,c) ({ __iowmb(); writew_relaxed(v,c); })
209+
#define writel(v,c) ({ __iowmb(); writel_relaxed(v,c); })
190210

191211
#define readsb(p,d,l) __raw_readsb(__mem_pci(p),d,l)
192212
#define readsw(p,d,l) __raw_readsw(__mem_pci(p),d,l)
193213
#define readsl(p,d,l) __raw_readsl(__mem_pci(p),d,l)
194214

195-
#define writeb(v,c) __raw_writeb(v,__mem_pci(c))
196-
#define writew(v,c) __raw_writew((__force __u16) \
197-
cpu_to_le16(v),__mem_pci(c))
198-
#define writel(v,c) __raw_writel((__force __u32) \
199-
cpu_to_le32(v),__mem_pci(c))
200-
201215
#define writesb(p,d,l) __raw_writesb(__mem_pci(p),d,l)
202216
#define writesw(p,d,l) __raw_writesw(__mem_pci(p),d,l)
203217
#define writesl(p,d,l) __raw_writesl(__mem_pci(p),d,l)
@@ -244,13 +258,13 @@ extern void _memset_io(volatile void __iomem *, int, size_t);
244258
* io{read,write}{8,16,32} macros
245259
*/
246260
#ifndef ioread8
247-
#define ioread8(p) ({ unsigned int __v = __raw_readb(p); __v; })
248-
#define ioread16(p) ({ unsigned int __v = le16_to_cpu((__force __le16)__raw_readw(p)); __v; })
249-
#define ioread32(p) ({ unsigned int __v = le32_to_cpu((__force __le32)__raw_readl(p)); __v; })
261+
#define ioread8(p) ({ unsigned int __v = __raw_readb(p); __iormb(); __v; })
262+
#define ioread16(p) ({ unsigned int __v = le16_to_cpu((__force __le16)__raw_readw(p)); __iormb(); __v; })
263+
#define ioread32(p) ({ unsigned int __v = le32_to_cpu((__force __le32)__raw_readl(p)); __iormb(); __v; })
250264

251-
#define iowrite8(v,p) __raw_writeb(v, p)
252-
#define iowrite16(v,p) __raw_writew((__force __u16)cpu_to_le16(v), p)
253-
#define iowrite32(v,p) __raw_writel((__force __u32)cpu_to_le32(v), p)
265+
#define iowrite8(v,p) ({ __iowmb(); (void)__raw_writeb(v, p); })
266+
#define iowrite16(v,p) ({ __iowmb(); (void)__raw_writew((__force __u16)cpu_to_le16(v), p); })
267+
#define iowrite32(v,p) ({ __iowmb(); (void)__raw_writel((__force __u32)cpu_to_le32(v), p); })
254268

255269
#define ioread8_rep(p,d,c) __raw_readsb(p,d,c)
256270
#define ioread16_rep(p,d,c) __raw_readsw(p,d,c)

arch/arm/lib/csumpartialcopyuser.S

+1-1
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@
7171
.pushsection .fixup,"ax"
7272
.align 4
7373
9001: mov r4, #-EFAULT
74-
ldr r5, [fp, #4] @ *err_ptr
74+
ldr r5, [sp, #8*4] @ *err_ptr
7575
str r4, [r5]
7676
ldmia sp, {r1, r2} @ retrieve dst, len
7777
add r2, r2, r1

arch/arm/mach-realview/core.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -237,7 +237,7 @@ static unsigned int realview_mmc_status(struct device *dev)
237237
else
238238
mask = 2;
239239

240-
return !(readl(REALVIEW_SYSMCI) & mask);
240+
return readl(REALVIEW_SYSMCI) & mask;
241241
}
242242

243243
struct mmci_platform_data realview_mmc0_plat_data = {

arch/arm/mach-ux500/include/mach/uncompress.h

+5-5
Original file line numberDiff line numberDiff line change
@@ -30,22 +30,22 @@
3030
static void putc(const char c)
3131
{
3232
/* Do nothing if the UART is not enabled. */
33-
if (!(readb(U8500_UART_CR) & 0x1))
33+
if (!(__raw_readb(U8500_UART_CR) & 0x1))
3434
return;
3535

3636
if (c == '\n')
3737
putc('\r');
3838

39-
while (readb(U8500_UART_FR) & (1 << 5))
39+
while (__raw_readb(U8500_UART_FR) & (1 << 5))
4040
barrier();
41-
writeb(c, U8500_UART_DR);
41+
__raw_writeb(c, U8500_UART_DR);
4242
}
4343

4444
static void flush(void)
4545
{
46-
if (!(readb(U8500_UART_CR) & 0x1))
46+
if (!(__raw_readb(U8500_UART_CR) & 0x1))
4747
return;
48-
while (readb(U8500_UART_FR) & (1 << 3))
48+
while (__raw_readb(U8500_UART_FR) & (1 << 3))
4949
barrier();
5050
}
5151

arch/arm/mach-vexpress/v2m.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -241,7 +241,7 @@ static struct platform_device v2m_flash_device = {
241241

242242
static unsigned int v2m_mmci_status(struct device *dev)
243243
{
244-
return !(readl(MMIO_P2V(V2M_SYS_MCI)) & (1 << 0));
244+
return readl(MMIO_P2V(V2M_SYS_MCI)) & (1 << 0);
245245
}
246246

247247
static struct mmci_platform_data v2m_mmci_data = {

arch/arm/mm/cache-l2x0.c

+13-13
Original file line numberDiff line numberDiff line change
@@ -32,29 +32,29 @@ static uint32_t l2x0_way_mask; /* Bitmask of active ways */
3232
static inline void cache_wait(void __iomem *reg, unsigned long mask)
3333
{
3434
/* wait for the operation to complete */
35-
while (readl(reg) & mask)
35+
while (readl_relaxed(reg) & mask)
3636
;
3737
}
3838

3939
static inline void cache_sync(void)
4040
{
4141
void __iomem *base = l2x0_base;
42-
writel(0, base + L2X0_CACHE_SYNC);
42+
writel_relaxed(0, base + L2X0_CACHE_SYNC);
4343
cache_wait(base + L2X0_CACHE_SYNC, 1);
4444
}
4545

4646
static inline void l2x0_clean_line(unsigned long addr)
4747
{
4848
void __iomem *base = l2x0_base;
4949
cache_wait(base + L2X0_CLEAN_LINE_PA, 1);
50-
writel(addr, base + L2X0_CLEAN_LINE_PA);
50+
writel_relaxed(addr, base + L2X0_CLEAN_LINE_PA);
5151
}
5252

5353
static inline void l2x0_inv_line(unsigned long addr)
5454
{
5555
void __iomem *base = l2x0_base;
5656
cache_wait(base + L2X0_INV_LINE_PA, 1);
57-
writel(addr, base + L2X0_INV_LINE_PA);
57+
writel_relaxed(addr, base + L2X0_INV_LINE_PA);
5858
}
5959

6060
#ifdef CONFIG_PL310_ERRATA_588369
@@ -75,9 +75,9 @@ static inline void l2x0_flush_line(unsigned long addr)
7575

7676
/* Clean by PA followed by Invalidate by PA */
7777
cache_wait(base + L2X0_CLEAN_LINE_PA, 1);
78-
writel(addr, base + L2X0_CLEAN_LINE_PA);
78+
writel_relaxed(addr, base + L2X0_CLEAN_LINE_PA);
7979
cache_wait(base + L2X0_INV_LINE_PA, 1);
80-
writel(addr, base + L2X0_INV_LINE_PA);
80+
writel_relaxed(addr, base + L2X0_INV_LINE_PA);
8181
}
8282
#else
8383

@@ -90,7 +90,7 @@ static inline void l2x0_flush_line(unsigned long addr)
9090
{
9191
void __iomem *base = l2x0_base;
9292
cache_wait(base + L2X0_CLEAN_INV_LINE_PA, 1);
93-
writel(addr, base + L2X0_CLEAN_INV_LINE_PA);
93+
writel_relaxed(addr, base + L2X0_CLEAN_INV_LINE_PA);
9494
}
9595
#endif
9696

@@ -109,7 +109,7 @@ static inline void l2x0_inv_all(void)
109109

110110
/* invalidate all ways */
111111
spin_lock_irqsave(&l2x0_lock, flags);
112-
writel(l2x0_way_mask, l2x0_base + L2X0_INV_WAY);
112+
writel_relaxed(l2x0_way_mask, l2x0_base + L2X0_INV_WAY);
113113
cache_wait(l2x0_base + L2X0_INV_WAY, l2x0_way_mask);
114114
cache_sync();
115115
spin_unlock_irqrestore(&l2x0_lock, flags);
@@ -215,8 +215,8 @@ void __init l2x0_init(void __iomem *base, __u32 aux_val, __u32 aux_mask)
215215

216216
l2x0_base = base;
217217

218-
cache_id = readl(l2x0_base + L2X0_CACHE_ID);
219-
aux = readl(l2x0_base + L2X0_AUX_CTRL);
218+
cache_id = readl_relaxed(l2x0_base + L2X0_CACHE_ID);
219+
aux = readl_relaxed(l2x0_base + L2X0_AUX_CTRL);
220220

221221
aux &= aux_mask;
222222
aux |= aux_val;
@@ -248,15 +248,15 @@ void __init l2x0_init(void __iomem *base, __u32 aux_val, __u32 aux_mask)
248248
* If you are booting from non-secure mode
249249
* accessing the below registers will fault.
250250
*/
251-
if (!(readl(l2x0_base + L2X0_CTRL) & 1)) {
251+
if (!(readl_relaxed(l2x0_base + L2X0_CTRL) & 1)) {
252252

253253
/* l2x0 controller is disabled */
254-
writel(aux, l2x0_base + L2X0_AUX_CTRL);
254+
writel_relaxed(aux, l2x0_base + L2X0_AUX_CTRL);
255255

256256
l2x0_inv_all();
257257

258258
/* enable L2X0 */
259-
writel(1, l2x0_base + L2X0_CTRL);
259+
writel_relaxed(1, l2x0_base + L2X0_CTRL);
260260
}
261261

262262
outer_cache.inv_range = l2x0_inv_range;

arch/arm/mm/highmem.c

+8-5
Original file line numberDiff line numberDiff line change
@@ -163,19 +163,22 @@ static DEFINE_PER_CPU(int, kmap_high_l1_vipt_depth);
163163

164164
void *kmap_high_l1_vipt(struct page *page, pte_t *saved_pte)
165165
{
166-
unsigned int idx, cpu = smp_processor_id();
167-
int *depth = &per_cpu(kmap_high_l1_vipt_depth, cpu);
166+
unsigned int idx, cpu;
167+
int *depth;
168168
unsigned long vaddr, flags;
169169
pte_t pte, *ptep;
170170

171+
if (!in_interrupt())
172+
preempt_disable();
173+
174+
cpu = smp_processor_id();
175+
depth = &per_cpu(kmap_high_l1_vipt_depth, cpu);
176+
171177
idx = KM_L1_CACHE + KM_TYPE_NR * cpu;
172178
vaddr = __fix_to_virt(FIX_KMAP_BEGIN + idx);
173179
ptep = TOP_PTE(vaddr);
174180
pte = mk_pte(page, kmap_prot);
175181

176-
if (!in_interrupt())
177-
preempt_disable();
178-
179182
raw_local_irq_save(flags);
180183
(*depth)++;
181184
if (pte_val(*ptep) == pte_val(pte)) {

drivers/mmc/host/mmci.c

+6-2
Original file line numberDiff line numberDiff line change
@@ -539,9 +539,13 @@ static int mmci_get_cd(struct mmc_host *mmc)
539539
if (host->gpio_cd == -ENOSYS)
540540
status = host->plat->status(mmc_dev(host->mmc));
541541
else
542-
status = gpio_get_value(host->gpio_cd);
542+
status = !gpio_get_value(host->gpio_cd);
543543

544-
return !status;
544+
/*
545+
* Use positive logic throughout - status is zero for no card,
546+
* non-zero for card inserted.
547+
*/
548+
return status;
545549
}
546550

547551
static const struct mmc_host_ops mmci_ops = {

drivers/video/cyber2000fb.c

+3
Original file line numberDiff line numberDiff line change
@@ -388,6 +388,7 @@ cyber2000fb_setcolreg(u_int regno, u_int red, u_int green, u_int blue,
388388
pseudo_val |= convert_bitfield(red, &var->red);
389389
pseudo_val |= convert_bitfield(green, &var->green);
390390
pseudo_val |= convert_bitfield(blue, &var->blue);
391+
ret = 0;
391392
break;
392393
}
393394

@@ -436,6 +437,8 @@ static void cyber2000fb_write_ramdac_ctrl(struct cfb_info *cfb)
436437
cyber2000fb_writeb(i | 4, 0x3cf, cfb);
437438
cyber2000fb_writeb(val, 0x3c6, cfb);
438439
cyber2000fb_writeb(i, 0x3cf, cfb);
440+
/* prevent card lock-up observed on x86 with CyberPro 2000 */
441+
cyber2000fb_readb(0x3cf, cfb);
439442
}
440443

441444
static void cyber2000fb_set_timing(struct cfb_info *cfb, struct par_info *hw)

0 commit comments

Comments
 (0)