diff options
| author | Linus Torvalds <torvalds@ppc970.osdl.org> | 2004-09-10 09:15:30 -0700 |
|---|---|---|
| committer | Linus Torvalds <torvalds@ppc970.osdl.org> | 2004-09-10 09:15:30 -0700 |
| commit | c293b6331e94e39263a9bca599e1626ed15b3fbd (patch) | |
| tree | c66b64cb4bc9d393065c08b5306e69f47229fcc2 | |
| parent | eceac7241ba9d6c5af9549950207cc207ee52eee (diff) | |
| parent | db2ffb284fd528e653bcdd696ebc244db09f0683 (diff) | |
Merge bk://bk.arm.linux.org.uk/linux-2.6-rmk
into ppc970.osdl.org:/home/torvalds/v2.6/linux
124 files changed, 2132 insertions, 1457 deletions
diff --git a/arch/arm/kernel/time.c b/arch/arm/kernel/time.c index 86b2b897a479..c30bf05675ee 100644 --- a/arch/arm/kernel/time.c +++ b/arch/arm/kernel/time.c @@ -57,8 +57,7 @@ unsigned long profile_pc(struct pt_regs *regs) { unsigned long fp, pc = instruction_pointer(regs); - if (pc >= (unsigned long)&__lock_text_start && - pc <= (unsigned long)&__lock_text_end) { + if (in_lock_functions(pc)) { fp = thread_saved_fp(current); pc = pc_pointer(((unsigned long *)fp)[-1]); } diff --git a/arch/i386/kernel/pci-dma.c b/arch/i386/kernel/pci-dma.c index 61817b7231ce..982fe8c2b875 100644 --- a/arch/i386/kernel/pci-dma.c +++ b/arch/i386/kernel/pci-dma.c @@ -72,7 +72,7 @@ void dma_free_coherent(struct device *dev, size_t size, int dma_declare_coherent_memory(struct device *dev, dma_addr_t bus_addr, dma_addr_t device_addr, size_t size, int flags) { - void *mem_base; + void __iomem *mem_base; int pages = size >> PAGE_SHIFT; int bitmap_size = (pages + 31)/32; diff --git a/arch/i386/kernel/time.c b/arch/i386/kernel/time.c index 8a8c0f643d1f..7013663d7e8a 100644 --- a/arch/i386/kernel/time.c +++ b/arch/i386/kernel/time.c @@ -205,8 +205,7 @@ unsigned long profile_pc(struct pt_regs *regs) { unsigned long pc = instruction_pointer(regs); - if (pc >= (unsigned long)&__lock_text_start && - pc <= (unsigned long)&__lock_text_end) + if (in_lock_functions(pc)) return *(unsigned long *)(regs->ebp + 4); return pc; diff --git a/arch/i386/mm/ioremap.c b/arch/i386/mm/ioremap.c index 7b11be02843b..aee0bb1f495d 100644 --- a/arch/i386/mm/ioremap.c +++ b/arch/i386/mm/ioremap.c @@ -110,9 +110,9 @@ static int remap_area_pages(unsigned long address, unsigned long phys_addr, * have to convert them into an offset in a page-aligned mapping, but the * caller shouldn't need to know that small detail. */ -void * __ioremap(unsigned long phys_addr, unsigned long size, unsigned long flags) +void __iomem * __ioremap(unsigned long phys_addr, unsigned long size, unsigned long flags) { - void * addr; + void __iomem * addr; struct vm_struct * area; unsigned long offset, last_addr; @@ -125,7 +125,7 @@ void * __ioremap(unsigned long phys_addr, unsigned long size, unsigned long flag * Don't remap the low PCI/ISA area, it's always mapped.. */ if (phys_addr >= 0xA0000 && last_addr < 0x100000) - return phys_to_virt(phys_addr); + return (void __iomem *) phys_to_virt(phys_addr); /* * Don't allow anybody to remap normal RAM that we're using.. @@ -156,12 +156,12 @@ void * __ioremap(unsigned long phys_addr, unsigned long size, unsigned long flag if (!area) return NULL; area->phys_addr = phys_addr; - addr = area->addr; + addr = (void __iomem *) area->addr; if (remap_area_pages((unsigned long) addr, phys_addr, size, flags)) { - vunmap(addr); + vunmap((void __force *) addr); return NULL; } - return (void *) (offset + (char *)addr); + return (void __iomem *) (offset + (char __iomem *)addr); } @@ -187,10 +187,10 @@ void * __ioremap(unsigned long phys_addr, unsigned long size, unsigned long flag * Must be freed with iounmap. */ -void *ioremap_nocache (unsigned long phys_addr, unsigned long size) +void __iomem *ioremap_nocache (unsigned long phys_addr, unsigned long size) { unsigned long last_addr; - void *p = __ioremap(phys_addr, size, _PAGE_PCD); + void __iomem *p = __ioremap(phys_addr, size, _PAGE_PCD); if (!p) return p; @@ -221,12 +221,12 @@ void *ioremap_nocache (unsigned long phys_addr, unsigned long size) return p; } -void iounmap(void *addr) +void iounmap(volatile void __iomem *addr) { struct vm_struct *p; - if (addr <= high_memory) + if ((void __force *) addr <= high_memory) return; - p = remove_vm_area((void *) (PAGE_MASK & (unsigned long) addr)); + p = remove_vm_area((void *) (PAGE_MASK & (unsigned long __force) addr)); if (!p) { printk("__iounmap: bad address %p\n", addr); return; diff --git a/arch/i386/pci/mmconfig.c b/arch/i386/pci/mmconfig.c index 0b95fc46d113..3b1acd7356f5 100644 --- a/arch/i386/pci/mmconfig.c +++ b/arch/i386/pci/mmconfig.c @@ -9,7 +9,7 @@ /* The physical address of the MMCONFIG aperture. Set from ACPI tables. */ u32 pci_mmcfg_base_addr; -#define mmcfg_virt_addr (fix_to_virt(FIX_PCIE_MCFG)) +#define mmcfg_virt_addr ((void __iomem *) fix_to_virt(FIX_PCIE_MCFG)) /* The base address of the last MMCONFIG device accessed */ static u32 mmcfg_last_accessed_device; diff --git a/arch/ia64/hp/sim/simserial.c b/arch/ia64/hp/sim/simserial.c index 0fda3d08bb37..af4b7143d0c9 100644 --- a/arch/ia64/hp/sim/simserial.c +++ b/arch/ia64/hp/sim/simserial.c @@ -50,10 +50,6 @@ #define _INLINE_ inline #endif -#ifndef MIN -#define MIN(a,b) ((a) < (b) ? (a) : (b)) -#endif - #define IRQ_T(info) ((info->flags & ASYNC_SHARE_IRQ) ? SA_SHIRQ : SA_INTERRUPT) #define SSC_GETCHAR 21 @@ -275,7 +271,7 @@ static _INLINE_ void transmit_chars(struct async_struct *info, int *intr_done) * Then from the beginning of the buffer until necessary */ - count = MIN(CIRC_CNT(info->xmit.head, info->xmit.tail, SERIAL_XMIT_SIZE), + count = min(CIRC_CNT(info->xmit.head, info->xmit.tail, SERIAL_XMIT_SIZE), SERIAL_XMIT_SIZE - info->xmit.tail); console->write(console, info->xmit.buf+info->xmit.tail, count); diff --git a/arch/ia64/kernel/acpi.c b/arch/ia64/kernel/acpi.c index 79ee0129156a..e2e1c7616d3d 100644 --- a/arch/ia64/kernel/acpi.c +++ b/arch/ia64/kernel/acpi.c @@ -61,6 +61,7 @@ void (*pm_idle) (void); EXPORT_SYMBOL(pm_idle); void (*pm_power_off) (void); +EXPORT_SYMBOL(pm_power_off); unsigned char acpi_kbd_controller_present = 1; unsigned char acpi_legacy_devices; diff --git a/arch/ia64/kernel/irq.c b/arch/ia64/kernel/irq.c index 0a7bfc507748..0126b68369ea 100644 --- a/arch/ia64/kernel/irq.c +++ b/arch/ia64/kernel/irq.c @@ -84,11 +84,13 @@ irq_desc_t _irq_desc[NR_IRQS] __cacheline_aligned = { } }; +#ifdef CONFIG_SMP /* * This is updated when the user sets irq affinity via /proc */ cpumask_t __cacheline_aligned pending_irq_cpumask[NR_IRQS]; static unsigned long pending_irq_redir[BITS_TO_LONGS(NR_IRQS)]; +#endif #ifdef CONFIG_IA64_GENERIC irq_desc_t * __ia64_irq_desc (unsigned int irq) diff --git a/arch/ia64/kernel/unwind.c b/arch/ia64/kernel/unwind.c index 769d880df580..a6b11f609288 100644 --- a/arch/ia64/kernel/unwind.c +++ b/arch/ia64/kernel/unwind.c @@ -47,7 +47,6 @@ #include "entry.h" #include "unwind_i.h" -#define MIN(a,b) ((a) < (b) ? (a) : (b)) #define p5 5 #define UNW_LOG_CACHE_SIZE 7 /* each unw_script is ~256 bytes in size */ @@ -963,13 +962,13 @@ static inline void desc_mem_stack_f (unw_word t, unw_word size, struct unw_state_record *sr) { set_reg(sr->curr.reg + UNW_REG_PSP, UNW_WHERE_NONE, - sr->region_start + MIN((int)t, sr->region_len - 1), 16*size); + sr->region_start + min_t(int, t, sr->region_len - 1), 16*size); } static inline void desc_mem_stack_v (unw_word t, struct unw_state_record *sr) { - sr->curr.reg[UNW_REG_PSP].when = sr->region_start + MIN((int)t, sr->region_len - 1); + sr->curr.reg[UNW_REG_PSP].when = sr->region_start + min_t(int, t, sr->region_len - 1); } static inline void @@ -1005,7 +1004,7 @@ desc_reg_when (unsigned char regnum, unw_word t, struct unw_state_record *sr) if (reg->where == UNW_WHERE_NONE) reg->where = UNW_WHERE_GR_SAVE; - reg->when = sr->region_start + MIN((int)t, sr->region_len - 1); + reg->when = sr->region_start + min_t(int, t, sr->region_len - 1); } static inline void @@ -1073,7 +1072,7 @@ desc_label_state (unw_word label, struct unw_state_record *sr) static inline int desc_is_active (unsigned char qp, unw_word t, struct unw_state_record *sr) { - if (sr->when_target <= sr->region_start + MIN((int)t, sr->region_len - 1)) + if (sr->when_target <= sr->region_start + min_t(int, t, sr->region_len - 1)) return 0; if (qp > 0) { if ((sr->pr_val & (1UL << qp)) == 0) @@ -1114,7 +1113,7 @@ desc_spill_reg_p (unsigned char qp, unw_word t, unsigned char abreg, unsigned ch r = sr->curr.reg + decode_abreg(abreg, 0); r->where = where; - r->when = sr->region_start + MIN((int)t, sr->region_len - 1); + r->when = sr->region_start + min_t(int, t, sr->region_len - 1); r->val = (ytreg & 0x7f); } @@ -1129,7 +1128,7 @@ desc_spill_psprel_p (unsigned char qp, unw_word t, unsigned char abreg, unw_word r = sr->curr.reg + decode_abreg(abreg, 1); r->where = UNW_WHERE_PSPREL; - r->when = sr->region_start + MIN((int)t, sr->region_len - 1); + r->when = sr->region_start + min_t(int, t, sr->region_len - 1); r->val = 0x10 - 4*pspoff; } @@ -1144,7 +1143,7 @@ desc_spill_sprel_p (unsigned char qp, unw_word t, unsigned char abreg, unw_word r = sr->curr.reg + decode_abreg(abreg, 1); r->where = UNW_WHERE_SPREL; - r->when = sr->region_start + MIN((int)t, sr->region_len - 1); + r->when = sr->region_start + min_t(int, t, sr->region_len - 1); r->val = 4*spoff; } diff --git a/arch/ia64/mm/discontig.c b/arch/ia64/mm/discontig.c index c030b951f50b..951faf1e2847 100644 --- a/arch/ia64/mm/discontig.c +++ b/arch/ia64/mm/discontig.c @@ -492,14 +492,17 @@ void *per_cpu_init(void) */ void show_mem(void) { - int i, reserved = 0; - int shared = 0, cached = 0; + int i, total_reserved = 0; + int total_shared = 0, total_cached = 0; + unsigned long total_present = 0; pg_data_t *pgdat; printk("Mem-info:\n"); show_free_areas(); printk("Free swap: %6ldkB\n", nr_swap_pages<<(PAGE_SHIFT-10)); for_each_pgdat(pgdat) { + unsigned long present = pgdat->node_present_pages; + int shared = 0, cached = 0, reserved = 0; printk("Node ID: %d\n", pgdat->node_id); for(i = 0; i < pgdat->node_spanned_pages; i++) { if (!ia64_pfn_valid(pgdat->node_start_pfn+i)) @@ -511,11 +514,19 @@ void show_mem(void) else if (page_count(pgdat->node_mem_map+i)) shared += page_count(pgdat->node_mem_map+i)-1; } - printk("\t%ld pages of RAM\n", pgdat->node_present_pages); + total_present += present; + total_reserved += reserved; + total_cached += cached; + total_shared += shared; + printk("\t%ld pages of RAM\n", present); printk("\t%d reserved pages\n", reserved); printk("\t%d pages shared\n", shared); printk("\t%d pages swap cached\n", cached); } + printk("%ld pages of RAM\n", total_present); + printk("%d reserved pages\n", total_reserved); + printk("%d pages shared\n", total_shared); + printk("%d pages swap cached\n", total_cached); printk("Total of %ld pages in page table cache\n", pgtable_cache_size); printk("%d free buffer pages\n", nr_free_buffer_pages()); } diff --git a/arch/ia64/pci/pci.c b/arch/ia64/pci/pci.c index be8ec0e0db16..9ac53df79d4c 100644 --- a/arch/ia64/pci/pci.c +++ b/arch/ia64/pci/pci.c @@ -330,7 +330,7 @@ pcibios_fixup_device_resources (struct pci_dev *dev, struct pci_bus *bus) struct pci_window *window; int i, j; int limit = (dev->hdr_type == PCI_HEADER_TYPE_NORMAL) ? \ - PCI_ROM_RESOURCE : PCI_NUM_RESOURCES; + PCI_BRIDGE_RESOURCES : PCI_NUM_RESOURCES; for (i = 0; i < limit; i++) { if (!dev->resource[i].start) diff --git a/arch/ppc/kernel/cpu_setup_power4.S b/arch/ppc/kernel/cpu_setup_power4.S index 6a6ee985c719..f2ea1a990f17 100644 --- a/arch/ppc/kernel/cpu_setup_power4.S +++ b/arch/ppc/kernel/cpu_setup_power4.S @@ -112,7 +112,9 @@ _GLOBAL(__save_cpu_setup) /* We only deal with 970 for now */ mfspr r0,SPRN_PVR srwi r0,r0,16 - cmpwi r0,0x39 + cmpwi cr0,r0,0x39 + cmpwi cr1,r0,0x3c + cror 4*cr0+eq,4*cr0+eq,4*cr1+eq bne 1f /* Save HID0,1,4 and 5 */ @@ -144,7 +146,9 @@ _GLOBAL(__restore_cpu_setup) /* We only deal with 970 for now */ mfspr r0,SPRN_PVR srwi r0,r0,16 - cmpwi r0,0x39 + cmpwi cr0,r0,0x39 + cmpwi cr1,r0,0x3c + cror 4*cr0+eq,4*cr0+eq,4*cr1+eq bne 1f /* Clear interrupt prefix */ diff --git a/arch/ppc/kernel/cputable.c b/arch/ppc/kernel/cputable.c index b3d3d371a25a..6f32ce915ec3 100644 --- a/arch/ppc/kernel/cputable.c +++ b/arch/ppc/kernel/cputable.c @@ -445,6 +445,15 @@ struct cpu_spec cpu_specs[] = { 128, 128, __setup_cpu_ppc970 }, + { /* PPC970FX */ + 0xffff0000, 0x003c0000, "PPC970FX", + CPU_FTR_COMMON | + CPU_FTR_SPLIT_ID_CACHE | CPU_FTR_USE_TB | CPU_FTR_HPTE_TABLE | + CPU_FTR_ALTIVEC_COMP | CPU_FTR_CAN_NAP, + COMMON_PPC | PPC_FEATURE_64 | PPC_FEATURE_ALTIVEC_COMP, + 128, 128, + __setup_cpu_ppc970 + }, #endif /* CONFIG_POWER4 */ #ifdef CONFIG_8xx { /* 8xx */ diff --git a/arch/ppc/kernel/time.c b/arch/ppc/kernel/time.c index 924c594e5775..60e7ef5ad9ab 100644 --- a/arch/ppc/kernel/time.c +++ b/arch/ppc/kernel/time.c @@ -113,8 +113,7 @@ unsigned long profile_pc(struct pt_regs *regs) { unsigned long pc = instruction_pointer(regs); - if (pc >= (unsigned long)&__lock_text_start && - pc <= (unsigned long)&__lock_text_end) + if (in_lock_functions(pc)) return regs->link; return pc; diff --git a/arch/ppc64/kernel/eeh.c b/arch/ppc64/kernel/eeh.c index f2f339fbe08e..ff08aee4846b 100644 --- a/arch/ppc64/kernel/eeh.c +++ b/arch/ppc64/kernel/eeh.c @@ -473,7 +473,7 @@ EXPORT_SYMBOL(eeh_dn_check_failure); * * Note this routine is safe to call in an interrupt context. */ -unsigned long eeh_check_failure(void *token, unsigned long val) +unsigned long eeh_check_failure(const volatile void __iomem *token, unsigned long val) { unsigned long addr; struct pci_dev *dev; @@ -739,7 +739,7 @@ EXPORT_SYMBOL(eeh_remove_device); * Remap the addr (trivially) to the EEH region if EEH checking enabled. * For addresses not known to PCI the vaddr is simply returned unchanged. */ -void *eeh_ioremap(unsigned long addr, void *vaddr) +void __iomem *eeh_ioremap(unsigned long addr, void __iomem *vaddr) { struct pci_dev *dev; struct device_node *dn; @@ -763,7 +763,7 @@ void *eeh_ioremap(unsigned long addr, void *vaddr) } pci_dev_put(dev); - return (void *)IO_ADDR_TO_TOKEN(vaddr); + return (void __iomem *)IO_ADDR_TO_TOKEN(vaddr); } static int proc_eeh_show(struct seq_file *m, void *v) diff --git a/arch/ppc64/kernel/iSeries_pci.c b/arch/ppc64/kernel/iSeries_pci.c index e6f431ab4b4c..d3715a1538c6 100644 --- a/arch/ppc64/kernel/iSeries_pci.c +++ b/arch/ppc64/kernel/iSeries_pci.c @@ -419,46 +419,39 @@ static int iSeries_Scan_Bridge_Slot(HvBusNumber Bus, * I/0 Memory copy MUST use mmio commands on iSeries * To do; For performance, include the hv call directly */ -void *iSeries_memset_io(void *dest, char c, size_t Count) +void iSeries_memset_io(volatile void __iomem *dest, char c, size_t Count) { u8 ByteValue = c; long NumberOfBytes = Count; - char *IoBuffer = dest; while (NumberOfBytes > 0) { - iSeries_Write_Byte(ByteValue, (void *)IoBuffer); - ++IoBuffer; + iSeries_Write_Byte(ByteValue, dest++); -- NumberOfBytes; } - return dest; } EXPORT_SYMBOL(iSeries_memset_io); -void *iSeries_memcpy_toio(void *dest, void *source, size_t count) +void iSeries_memcpy_toio(volatile void __iomem *dest, void *source, size_t count) { - char *dst = dest; char *src = source; long NumberOfBytes = count; while (NumberOfBytes > 0) { - iSeries_Write_Byte(*src++, (void *)dst++); + iSeries_Write_Byte(*src++, dest++); -- NumberOfBytes; } - return dest; } EXPORT_SYMBOL(iSeries_memcpy_toio); -void *iSeries_memcpy_fromio(void *dest, void *source, size_t count) +void iSeries_memcpy_fromio(void *dest, const volatile void __iomem *src, size_t count) { char *dst = dest; - char *src = source; long NumberOfBytes = count; while (NumberOfBytes > 0) { - *dst++ = iSeries_Read_Byte((void *)src++); + *dst++ = iSeries_Read_Byte(src++); -- NumberOfBytes; } - return dest; } EXPORT_SYMBOL(iSeries_memcpy_fromio); @@ -612,17 +605,19 @@ static int CheckReturnCode(char *TextHdr, struct iSeries_Device_Node *DevNode, * Note: Make sure the passed variable end up on the stack to avoid * the exposure of being device global. */ -static inline struct iSeries_Device_Node *xlateIoMmAddress(void *IoAddress, +static inline struct iSeries_Device_Node *xlateIoMmAddress(const volatile void __iomem *IoAddress, u64 *dsaptr, u64 *BarOffsetPtr) { + unsigned long OrigIoAddr; unsigned long BaseIoAddr; unsigned long TableIndex; struct iSeries_Device_Node *DevNode; - if (((unsigned long)IoAddress < iSeries_Base_Io_Memory) || - ((unsigned long)IoAddress >= iSeries_Max_Io_Memory)) + OrigIoAddr = (unsigned long __force)IoAddress; + if ((OrigIoAddr < iSeries_Base_Io_Memory) || + (OrigIoAddr >= iSeries_Max_Io_Memory)) return NULL; - BaseIoAddr = (unsigned long)IoAddress - iSeries_Base_Io_Memory; + BaseIoAddr = OrigIoAddr - iSeries_Base_Io_Memory; TableIndex = BaseIoAddr / iSeries_IoMmTable_Entry_Size; DevNode = iSeries_IoMmTable[TableIndex]; @@ -644,7 +639,7 @@ static inline struct iSeries_Device_Node *xlateIoMmAddress(void *IoAddress, * iSeries_Read_Word = Read Word (16 bit) * iSeries_Read_Long = Read Long (32 bit) */ -u8 iSeries_Read_Byte(void *IoAddress) +u8 iSeries_Read_Byte(const volatile void __iomem *IoAddress) { u64 BarOffset; u64 dsa; @@ -673,7 +668,7 @@ u8 iSeries_Read_Byte(void *IoAddress) } EXPORT_SYMBOL(iSeries_Read_Byte); -u16 iSeries_Read_Word(void *IoAddress) +u16 iSeries_Read_Word(const volatile void __iomem *IoAddress) { u64 BarOffset; u64 dsa; @@ -703,7 +698,7 @@ u16 iSeries_Read_Word(void *IoAddress) } EXPORT_SYMBOL(iSeries_Read_Word); -u32 iSeries_Read_Long(void *IoAddress) +u32 iSeries_Read_Long(const volatile void __iomem *IoAddress) { u64 BarOffset; u64 dsa; @@ -740,7 +735,7 @@ EXPORT_SYMBOL(iSeries_Read_Long); * iSeries_Write_Word = Write Word(16 bit) * iSeries_Write_Long = Write Long(32 bit) */ -void iSeries_Write_Byte(u8 data, void *IoAddress) +void iSeries_Write_Byte(u8 data, volatile void __iomem *IoAddress) { u64 BarOffset; u64 dsa; @@ -767,7 +762,7 @@ void iSeries_Write_Byte(u8 data, void *IoAddress) } EXPORT_SYMBOL(iSeries_Write_Byte); -void iSeries_Write_Word(u16 data, void *IoAddress) +void iSeries_Write_Word(u16 data, volatile void __iomem *IoAddress) { u64 BarOffset; u64 dsa; @@ -794,7 +789,7 @@ void iSeries_Write_Word(u16 data, void *IoAddress) } EXPORT_SYMBOL(iSeries_Write_Word); -void iSeries_Write_Long(u32 data, void *IoAddress) +void iSeries_Write_Long(u32 data, volatile void __iomem *IoAddress) { u64 BarOffset; u64 dsa; diff --git a/arch/ppc64/kernel/time.c b/arch/ppc64/kernel/time.c index 1c17ed358d0a..f3fcb600a021 100644 --- a/arch/ppc64/kernel/time.c +++ b/arch/ppc64/kernel/time.c @@ -163,8 +163,7 @@ unsigned long profile_pc(struct pt_regs *regs) { unsigned long pc = instruction_pointer(regs); - if (pc >= (unsigned long)&__lock_text_start && - pc <= (unsigned long)&__lock_text_end) + if (in_lock_functions(pc)) return regs->link; return pc; diff --git a/arch/ppc64/mm/init.c b/arch/ppc64/mm/init.c index e7f2b81facca..081e65a5de5d 100644 --- a/arch/ppc64/mm/init.c +++ b/arch/ppc64/mm/init.c @@ -117,18 +117,18 @@ void show_mem(void) #ifdef CONFIG_PPC_ISERIES -void *ioremap(unsigned long addr, unsigned long size) +void __iomem *ioremap(unsigned long addr, unsigned long size) { - return (void *)addr; + return (void __iomem *)addr; } -extern void *__ioremap(unsigned long addr, unsigned long size, +extern void __iomem *__ioremap(unsigned long addr, unsigned long size, unsigned long flags) { - return (void *)addr; + return (void __iomem *)addr; } -void iounmap(void *addr) +void iounmap(volatile void __iomem *addr) { return; } @@ -182,7 +182,7 @@ static void map_io_page(unsigned long ea, unsigned long pa, int flags) } -static void * __ioremap_com(unsigned long addr, unsigned long pa, +static void __iomem * __ioremap_com(unsigned long addr, unsigned long pa, unsigned long ea, unsigned long size, unsigned long flags) { @@ -197,20 +197,20 @@ static void * __ioremap_com(unsigned long addr, unsigned long pa, map_io_page(ea+i, pa+i, flags); } - return (void *) (ea + (addr & ~PAGE_MASK)); + return (void __iomem *) (ea + (addr & ~PAGE_MASK)); } -void * +void __iomem * ioremap(unsigned long addr, unsigned long size) { - void *ret = __ioremap(addr, size, _PAGE_NO_CACHE); + void __iomem *ret = __ioremap(addr, size, _PAGE_NO_CACHE); if(mem_init_done) return eeh_ioremap(addr, ret); /* may remap the addr */ return ret; } -void * +void __iomem * __ioremap(unsigned long addr, unsigned long size, unsigned long flags) { unsigned long pa, ea; @@ -353,11 +353,12 @@ static void unmap_im_area_pmd(pgd_t *dir, unsigned long address, * * XXX what about calls before mem_init_done (ie python_countermeasures()) */ -void iounmap(void *addr) +void iounmap(volatile void __iomem *token) { unsigned long address, start, end, size; struct mm_struct *mm; pgd_t *dir; + void *addr; if (!mem_init_done) { return; @@ -365,7 +366,7 @@ void iounmap(void *addr) /* addr could be in EEH or IO region, map it to IO region regardless. */ - addr = (void *) (IO_TOKEN_TO_ADDR(addr) & PAGE_MASK); + addr = (void *) (IO_TOKEN_TO_ADDR(token) & PAGE_MASK); if ((size = im_free(addr)) == 0) { return; @@ -391,38 +392,39 @@ void iounmap(void *addr) return; } -static int iounmap_subset_regions(void *addr, unsigned long size) +static int iounmap_subset_regions(unsigned long addr, unsigned long size) { struct vm_struct *area; /* Check whether subsets of this region exist */ - area = im_get_area((unsigned long) addr, size, IM_REGION_SUPERSET); + area = im_get_area(addr, size, IM_REGION_SUPERSET); if (area == NULL) return 1; while (area) { - iounmap(area->addr); - area = im_get_area((unsigned long) addr, size, + iounmap((void __iomem *) area->addr); + area = im_get_area(addr, size, IM_REGION_SUPERSET); } return 0; } -int iounmap_explicit(void *addr, unsigned long size) +int iounmap_explicit(volatile void __iomem *start, unsigned long size) { struct vm_struct *area; + unsigned long addr; int rc; /* addr could be in EEH or IO region, map it to IO region regardless. */ - addr = (void *) (IO_TOKEN_TO_ADDR(addr) & PAGE_MASK); + addr = (IO_TOKEN_TO_ADDR(start) & PAGE_MASK); /* Verify that the region either exists or is a subset of an existing * region. In the latter case, split the parent region to create * the exact region */ - area = im_get_area((unsigned long) addr, size, + area = im_get_area(addr, size, IM_REGION_EXISTS | IM_REGION_SUBSET); if (area == NULL) { /* Determine whether subset regions exist. If so, unmap */ @@ -430,14 +432,17 @@ int iounmap_explicit(void *addr, unsigned long size) if (rc) { printk(KERN_ERR "%s() cannot unmap nonexistent range 0x%lx\n", - __FUNCTION__, (unsigned long) addr); + __FUNCTION__, addr); return 1; } } else { - iounmap(area->addr); + iounmap((void __iomem *) area->addr); } - + /* + * FIXME! This can't be right: iounmap(area->addr); + * Maybe it should be "iounmap(area);" + */ return 0; } diff --git a/arch/sparc/kernel/time.c b/arch/sparc/kernel/time.c index 72c74face413..60507d394868 100644 --- a/arch/sparc/kernel/time.c +++ b/arch/sparc/kernel/time.c @@ -81,20 +81,22 @@ struct intersil *intersil_clock; unsigned long profile_pc(struct pt_regs *regs) { - extern int __copy_user_begin, __copy_user_end; - extern int __atomic_begin, __atomic_end; - extern int __bzero_begin, __bzero_end; - extern int __bitops_begin, __bitops_end; + extern char __copy_user_begin[], __copy_user_end[]; + extern char __atomic_begin[], __atomic_end[]; + extern char __bzero_begin[], __bzero_end[]; + extern char __bitops_begin[], __bitops_end[]; + unsigned long pc = regs->pc; - if ((pc >= (unsigned long) &__copy_user_begin && - pc < (unsigned long) &__copy_user_end) || - (pc >= (unsigned long) &__atomic_begin && - pc < (unsigned long) &__atomic_end) || - (pc >= (unsigned long) &__bzero_begin && - pc < (unsigned long) &__bzero_end) || - (pc >= (unsigned long) &__bitops_begin && - pc < (unsigned long) &__bitops_end)) + if (in_lock_functions(pc) || + (pc >= (unsigned long) __copy_user_begin && + pc < (unsigned long) __copy_user_end) || + (pc >= (unsigned long) __atomic_begin && + pc < (unsigned long) __atomic_end) || + (pc >= (unsigned long) __bzero_begin && + pc < (unsigned long) __bzero_end) || + (pc >= (unsigned long) __bitops_begin && + pc < (unsigned long) __bitops_end)) pc = regs->u_regs[UREG_RETPC]; return pc; } diff --git a/arch/sparc64/kernel/time.c b/arch/sparc64/kernel/time.c index ecd881fa6333..104fc2528937 100644 --- a/arch/sparc64/kernel/time.c +++ b/arch/sparc64/kernel/time.c @@ -73,8 +73,7 @@ unsigned long profile_pc(struct pt_regs *regs) { unsigned long pc = instruction_pointer(regs); - if (pc >= (unsigned long)&__lock_text_start && - pc <= (unsigned long)&__lock_text_end) + if (in_lock_functions(pc)) return regs->u_regs[UREG_RETPC]; return pc; } diff --git a/arch/x86_64/kernel/early_printk.c b/arch/x86_64/kernel/early_printk.c index 215a9b947182..600ec815a2a8 100644 --- a/arch/x86_64/kernel/early_printk.c +++ b/arch/x86_64/kernel/early_printk.c @@ -8,7 +8,7 @@ /* Simple VGA output */ #ifdef __i386__ -#define VGABASE __pa((void *)(__PAGE_OFFSET + 0xb8000UL)) +#define VGABASE (__ISA_IO_base + 0xb8000) #else #define VGABASE 0xffffffff800b8000UL #endif diff --git a/arch/x86_64/kernel/time.c b/arch/x86_64/kernel/time.c index 802420f6b954..2d03cb2e0315 100644 --- a/arch/x86_64/kernel/time.c +++ b/arch/x86_64/kernel/time.c @@ -184,8 +184,7 @@ unsigned long profile_pc(struct pt_regs *regs) { unsigned long pc = instruction_pointer(regs); - if (pc >= (unsigned long)&__lock_text_start && - pc <= (unsigned long)&__lock_text_end) + if (in_lock_functions(pc)) return *(unsigned long *)regs->rbp; return pc; } diff --git a/drivers/acpi/osl.c b/drivers/acpi/osl.c index 22e7094bbe08..ae9027a4536a 100644 --- a/drivers/acpi/osl.c +++ b/drivers/acpi/osl.c @@ -171,11 +171,11 @@ acpi_os_get_root_pointer(u32 flags, struct acpi_pointer *addr) } acpi_status -acpi_os_map_memory(acpi_physical_address phys, acpi_size size, void **virt) +acpi_os_map_memory(acpi_physical_address phys, acpi_size size, void __iomem **virt) { if (efi_enabled) { if (EFI_MEMORY_WB & efi_mem_attributes(phys)) { - *virt = phys_to_virt(phys); + *virt = (void __iomem *) phys_to_virt(phys); } else { *virt = ioremap(phys, size); } @@ -197,7 +197,7 @@ acpi_os_map_memory(acpi_physical_address phys, acpi_size size, void **virt) } void -acpi_os_unmap_memory(void *virt, acpi_size size) +acpi_os_unmap_memory(void __iomem *virt, acpi_size size) { iounmap(virt); } @@ -376,30 +376,31 @@ acpi_os_read_memory( u32 width) { u32 dummy; - void *virt_addr; + void __iomem *virt_addr; int iomem = 0; if (efi_enabled) { if (EFI_MEMORY_WB & efi_mem_attributes(phys_addr)) { - virt_addr = phys_to_virt(phys_addr); + /* HACK ALERT! We can use readb/w/l on real memory too.. */ + virt_addr = (void __iomem *) phys_to_virt(phys_addr); } else { iomem = 1; virt_addr = ioremap(phys_addr, width); } } else - virt_addr = phys_to_virt(phys_addr); + virt_addr = (void __iomem *) phys_to_virt(phys_addr); if (!value) value = &dummy; switch (width) { case 8: - *(u8*) value = *(u8*) virt_addr; + *(u8*) value = readb(virt_addr); break; case 16: - *(u16*) value = *(u16*) virt_addr; + *(u16*) value = readw(virt_addr); break; case 32: - *(u32*) value = *(u32*) virt_addr; + *(u32*) value = readl(virt_addr); break; default: BUG(); @@ -419,28 +420,29 @@ acpi_os_write_memory( u32 value, u32 width) { - void *virt_addr; + void __iomem *virt_addr; int iomem = 0; if (efi_enabled) { if (EFI_MEMORY_WB & efi_mem_attributes(phys_addr)) { - virt_addr = phys_to_virt(phys_addr); + /* HACK ALERT! We can use writeb/w/l on real memory too */ + virt_addr = (void __iomem *) phys_to_virt(phys_addr); } else { iomem = 1; virt_addr = ioremap(phys_addr, width); } } else - virt_addr = phys_to_virt(phys_addr); + virt_addr = (void __iomem *) phys_to_virt(phys_addr); switch (width) { case 8: - *(u8*) virt_addr = value; + writeb(value, virt_addr); break; case 16: - *(u16*) virt_addr = value; + writew(value, virt_addr); break; case 32: - *(u32*) virt_addr = value; + writel(value, virt_addr); break; default: BUG(); @@ -962,7 +964,7 @@ acpi_os_readable(void *ptr, acpi_size len) { #if defined(__i386__) || defined(__x86_64__) char tmp; - return !__get_user(tmp, (char *)ptr) && !__get_user(tmp, (char *)ptr + len - 1); + return !__get_user(tmp, (char __user *)ptr) && !__get_user(tmp, (char __user *)ptr + len - 1); #endif return 1; } diff --git a/drivers/char/agp/agp.h b/drivers/char/agp/agp.h index 2128374e7502..f83e3e342f14 100644 --- a/drivers/char/agp/agp.h +++ b/drivers/char/agp/agp.h @@ -123,7 +123,7 @@ struct agp_bridge_data { void *current_size; void *dev_private_data; struct pci_dev *dev; - u32 *gatt_table; + u32 __iomem *gatt_table; u32 *gatt_table_real; unsigned long scratch_page; unsigned long scratch_page_real; diff --git a/drivers/char/agp/intel-agp.c b/drivers/char/agp/intel-agp.c index 3988ec6371b2..0f41f748a04e 100644 --- a/drivers/char/agp/intel-agp.c +++ b/drivers/char/agp/intel-agp.c @@ -69,7 +69,7 @@ static struct gatt_mask intel_i810_masks[] = static struct _intel_i810_private { struct pci_dev *i810_dev; /* device one */ - volatile u8 *registers; + volatile u8 __iomem *registers; int num_dcache_entries; } intel_i810_private; @@ -111,7 +111,7 @@ static int intel_i810_configure(void) pci_read_config_dword(intel_i810_private.i810_dev, I810_MMADDR, &temp); temp &= 0xfff80000; - intel_i810_private.registers = (volatile u8 *) ioremap(temp, 128 * 4096); + intel_i810_private.registers = ioremap(temp, 128 * 4096); if (!intel_i810_private.registers) { printk(KERN_ERR PFX "Unable to remap memory.\n"); return -ENOMEM; @@ -142,7 +142,7 @@ static int intel_i810_configure(void) static void intel_i810_cleanup(void) { OUTREG32(intel_i810_private.registers, I810_PGETBL_CTL, 0); - iounmap((void *) intel_i810_private.registers); + iounmap(intel_i810_private.registers); } static void intel_i810_tlbflush(struct agp_memory *mem) @@ -353,8 +353,8 @@ static struct aper_size_info_fixed intel_i830_sizes[] = static struct _intel_i830_private { struct pci_dev *i830_dev; /* device one */ - volatile u8 *registers; - volatile u32 *gtt; /* I915G */ + volatile u8 __iomem *registers; + volatile u32 __iomem *gtt; /* I915G */ int gtt_entries; } intel_i830_private; @@ -461,7 +461,7 @@ static int intel_i830_create_gatt_table(void) pci_read_config_dword(intel_i830_private.i830_dev,I810_MMADDR,&temp); temp &= 0xfff80000; - intel_i830_private.registers = (volatile u8 *) ioremap(temp,128 * 4096); + intel_i830_private.registers = ioremap(temp,128 * 4096); if (!intel_i830_private.registers) return (-ENOMEM); @@ -544,7 +544,7 @@ static int intel_i830_configure(void) static void intel_i830_cleanup(void) { - iounmap((void *) intel_i830_private.registers); + iounmap(intel_i830_private.registers); } static int intel_i830_insert_entries(struct agp_memory *mem,off_t pg_start, @@ -649,8 +649,8 @@ static int intel_i915_configure(void) static void intel_i915_cleanup(void) { - iounmap((void *) intel_i830_private.gtt); - iounmap((void *) intel_i830_private.registers); + iounmap(intel_i830_private.gtt); + iounmap(intel_i830_private.registers); } static int intel_i915_insert_entries(struct agp_memory *mem,off_t pg_start, @@ -751,13 +751,13 @@ static int intel_i915_create_gatt_table(void) pci_read_config_dword(intel_i830_private.i830_dev, I915_MMADDR, &temp); pci_read_config_dword(intel_i830_private.i830_dev, I915_PTEADDR,&temp2); - intel_i830_private.gtt = (volatile u32 *) ioremap(temp2, 256 * 1024); + intel_i830_private.gtt = ioremap(temp2, 256 * 1024); if (!intel_i830_private.gtt) return (-ENOMEM); temp &= 0xfff80000; - intel_i830_private.registers = (volatile u8 *) ioremap(temp,128 * 4096); + intel_i830_private.registers = ioremap(temp,128 * 4096); if (!intel_i830_private.registers) return (-ENOMEM); diff --git a/drivers/char/drm/drm_os_linux.h b/drivers/char/drm/drm_os_linux.h index dff91caecdbe..271be620ddb0 100644 --- a/drivers/char/drm/drm_os_linux.h +++ b/drivers/char/drm/drm_os_linux.h @@ -16,17 +16,17 @@ #define DRM_CURRENTPID current->pid #define DRM_UDELAY(d) udelay(d) /** Read a byte from a MMIO region */ -#define DRM_READ8(map, offset) readb(((unsigned long)(map)->handle) + (offset)) +#define DRM_READ8(map, offset) readb(((void __iomem *)(map)->handle) + (offset)) /** Read a word from a MMIO region */ -#define DRM_READ16(map, offset) readw(((unsigned long)(map)->handle) + (offset)) +#define DRM_READ16(map, offset) readw(((void __iomem *)(map)->handle) + (offset)) /** Read a dword from a MMIO region */ -#define DRM_READ32(map, offset) readl(((unsigned long)(map)->handle) + (offset)) +#define DRM_READ32(map, offset) readl(((void __iomem *)(map)->handle) + (offset)) /** Write a byte into a MMIO region */ -#define DRM_WRITE8(map, offset, val) writeb(val, ((unsigned long)(map)->handle) + (offset)) +#define DRM_WRITE8(map, offset, val) writeb(val, ((void __iomem *)(map)->handle) + (offset)) /** Write a word into a MMIO region */ -#define DRM_WRITE16(map, offset, val) writew(val, ((unsigned long)(map)->handle) + (offset)) +#define DRM_WRITE16(map, offset, val) writew(val, ((void __iomem *)(map)->handle) + (offset)) /** Write a dword into a MMIO region */ -#define DRM_WRITE32(map, offset, val) writel(val, ((unsigned long)(map)->handle) + (offset)) +#define DRM_WRITE32(map, offset, val) writel(val, ((void __iomem *)(map)->handle) + (offset)) /** Read memory barrier */ #define DRM_READMEMORYBARRIER() rmb() /** Write memory barrier */ diff --git a/drivers/char/hpet.c b/drivers/char/hpet.c index 5b8dbba2a604..dc0a6a67fa45 100644 --- a/drivers/char/hpet.c +++ b/drivers/char/hpet.c @@ -664,8 +664,7 @@ int hpet_control(struct hpet_task *tp, unsigned int cmd, unsigned long arg) static struct time_interpolator hpet_interpolator = { .source = TIME_SOURCE_MMIO64, - .shift = 10, - .addr = MC + .shift = 10 }; #endif @@ -953,11 +952,10 @@ static int __init hpet_init(void) struct hpet *hpet; hpet = hpets->hp_hpet; - hpet_cycles_per_sec = hpet_time_div(hpets->hp_period); - hpet_interpolator.frequency = hpet_cycles_per_sec; - hpet_interpolator.drift = hpet_cycles_per_sec * + hpet_interpolator.addr = &hpets->hp_hpet->hpet_mc; + hpet_interpolator.frequency = hpet_time_div(hpets->hp_period); + hpet_interpolator.drift = hpet_interpolator.frequency * HPET_DRIFT / 1000000; - hpet_nsecs_per_cycle = 1000000000 / hpet_cycles_per_sec; register_time_interpolator(&hpet_interpolator); } #endif diff --git a/drivers/ide/ide-disk.c b/drivers/ide/ide-disk.c index fc9a8428d5cf..020bb4c11a31 100644 --- a/drivers/ide/ide-disk.c +++ b/drivers/ide/ide-disk.c @@ -340,12 +340,18 @@ static ide_startstop_t multwrite_intr (ide_drive_t *drive) ide_startstop_t __ide_do_rw_disk (ide_drive_t *drive, struct request *rq, sector_t block) { ide_hwif_t *hwif = HWIF(drive); + unsigned int dma = drive->using_dma; u8 lba48 = (drive->addressing == 1) ? 1 : 0; task_ioreg_t command = WIN_NOP; ata_nsector_t nsectors; nsectors.all = (u16) rq->nr_sectors; + if (hwif->no_lba48_dma && lba48 && dma) { + if (rq->sector + rq->nr_sectors > 1ULL << 28) + dma = 0; + } + if (IDE_CONTROL_REG) hwif->OUTB(drive->ctl, IDE_CONTROL_REG); @@ -414,7 +420,7 @@ ide_startstop_t __ide_do_rw_disk (ide_drive_t *drive, struct request *rq, sector } if (rq_data_dir(rq) == READ) { - if (drive->using_dma && !hwif->ide_dma_read(drive)) + if (dma && !hwif->ide_dma_read(drive)) return ide_started; command = ((drive->mult_count) ? @@ -425,7 +431,7 @@ ide_startstop_t __ide_do_rw_disk (ide_drive_t *drive, struct request *rq, sector } else { ide_startstop_t startstop; - if (drive->using_dma && !(HWIF(drive)->ide_dma_write(drive))) + if (dma && !hwif->ide_dma_write(drive)) return ide_started; command = ((drive->mult_count) ? @@ -488,31 +494,38 @@ ide_startstop_t __ide_do_rw_disk (ide_drive_t *drive, struct request *rq, sector } EXPORT_SYMBOL_GPL(__ide_do_rw_disk); -static u8 get_command(ide_drive_t *drive, int cmd, ide_task_t *task) +static u8 get_command(ide_drive_t *drive, struct request *rq, ide_task_t *task) { unsigned int lba48 = (drive->addressing == 1) ? 1 : 0; + unsigned int dma = drive->using_dma; + + if (drive->hwif->no_lba48_dma && lba48 && dma) { + if (rq->sector + rq->nr_sectors > 1ULL << 28) + dma = 0; + } - if (cmd == READ) { + if (rq_data_dir(rq) == READ) { task->command_type = IDE_DRIVE_TASK_IN; - if (drive->using_dma) + if (dma) return lba48 ? WIN_READDMA_EXT : WIN_READDMA; + task->handler = &task_in_intr; if (drive->mult_count) { - task->handler = &task_mulin_intr; + task->data_phase = TASKFILE_MULTI_IN; return lba48 ? WIN_MULTREAD_EXT : WIN_MULTREAD; } - task->handler = &task_in_intr; + task->data_phase = TASKFILE_IN; return lba48 ? WIN_READ_EXT : WIN_READ; } else { task->command_type = IDE_DRIVE_TASK_RAW_WRITE; - if (drive->using_dma) + if (dma) return lba48 ? WIN_WRITEDMA_EXT : WIN_WRITEDMA; + task->prehandler = &pre_task_out_intr; + task->handler = &task_out_intr; if (drive->mult_count) { - task->prehandler = &pre_task_mulout_intr; - task->handler = &task_mulout_intr; + task->data_phase = TASKFILE_MULTI_OUT; return lba48 ? WIN_MULTWRITE_EXT : WIN_MULTWRITE; } - task->prehandler = &pre_task_out_intr; - task->handler = &task_out_intr; + task->data_phase = TASKFILE_OUT; return lba48 ? WIN_WRITE_EXT : WIN_WRITE; } } @@ -541,9 +554,10 @@ static ide_startstop_t chs_rw_disk (ide_drive_t *drive, struct request *rq, unsi args.tfRegister[IDE_HCYL_OFFSET] = (cyl>>8); args.tfRegister[IDE_SELECT_OFFSET] = head; args.tfRegister[IDE_SELECT_OFFSET] |= drive->select.all; - args.tfRegister[IDE_COMMAND_OFFSET] = get_command(drive, rq_data_dir(rq), &args); + args.tfRegister[IDE_COMMAND_OFFSET] = get_command(drive, rq, &args); args.rq = (struct request *) rq; rq->special = (ide_task_t *)&args; + drive->hwif->data_phase = args.data_phase; return do_rw_taskfile(drive, &args); } @@ -565,9 +579,10 @@ static ide_startstop_t lba_28_rw_disk (ide_drive_t *drive, struct request *rq, u args.tfRegister[IDE_HCYL_OFFSET] = (block>>=8); args.tfRegister[IDE_SELECT_OFFSET] = ((block>>8)&0x0f); args.tfRegister[IDE_SELECT_OFFSET] |= drive->select.all; - args.tfRegister[IDE_COMMAND_OFFSET] = get_command(drive, rq_data_dir(rq), &args); + args.tfRegister[IDE_COMMAND_OFFSET] = get_command(drive, rq, &args); args.rq = (struct request *) rq; rq->special = (ide_task_t *)&args; + drive->hwif->data_phase = args.data_phase; return do_rw_taskfile(drive, &args); } @@ -595,7 +610,7 @@ static ide_startstop_t lba_48_rw_disk (ide_drive_t *drive, struct request *rq, u args.tfRegister[IDE_LCYL_OFFSET] = (block>>=8); /* mid lba */ args.tfRegister[IDE_HCYL_OFFSET] = (block>>=8); /* hi lba */ args.tfRegister[IDE_SELECT_OFFSET] = drive->select.all; - args.tfRegister[IDE_COMMAND_OFFSET] = get_command(drive, rq_data_dir(rq), &args); + args.tfRegister[IDE_COMMAND_OFFSET] = get_command(drive, rq, &args); args.hobRegister[IDE_SECTOR_OFFSET] = (block>>=8); /* low lba */ args.hobRegister[IDE_LCYL_OFFSET] = (block>>=8); /* mid lba */ args.hobRegister[IDE_HCYL_OFFSET] = (block>>=8); /* hi lba */ @@ -603,6 +618,7 @@ static ide_startstop_t lba_48_rw_disk (ide_drive_t *drive, struct request *rq, u args.hobRegister[IDE_CONTROL_OFFSET_HOB]= (drive->ctl|0x80); args.rq = (struct request *) rq; rq->special = (ide_task_t *)&args; + drive->hwif->data_phase = args.data_phase; return do_rw_taskfile(drive, &args); } @@ -638,7 +654,6 @@ static u8 idedisk_dump_status (ide_drive_t *drive, const char *msg, u8 stat) local_irq_set(flags); printk("%s: %s: status=0x%02x", drive->name, msg, stat); -#if FANCY_STATUS_DUMPS printk(" { "); if (stat & BUSY_STAT) printk("Busy "); @@ -652,12 +667,10 @@ static u8 idedisk_dump_status (ide_drive_t *drive, const char *msg, u8 stat) if (stat & ERR_STAT) printk("Error "); } printk("}"); -#endif /* FANCY_STATUS_DUMPS */ printk("\n"); if ((stat & (BUSY_STAT|ERR_STAT)) == ERR_STAT) { err = hwif->INB(IDE_ERROR_REG); printk("%s: %s: error=0x%02x", drive->name, msg, err); -#if FANCY_STATUS_DUMPS printk(" { "); if (err & ABRT_ERR) printk("DriveStatusError "); if (err & ICRC_ERR) @@ -700,7 +713,6 @@ static u8 idedisk_dump_status (ide_drive_t *drive, const char *msg, u8 stat) (unsigned long long)HWGROUP(drive)->rq->sector); } } -#endif /* FANCY_STATUS_DUMPS */ printk("\n"); { struct request *rq; @@ -1148,6 +1160,7 @@ static int get_smart_values(ide_drive_t *drive, u8 *buf) args.tfRegister[IDE_HCYL_OFFSET] = SMART_HCYL_PASS; args.tfRegister[IDE_COMMAND_OFFSET] = WIN_SMART; args.command_type = IDE_DRIVE_TASK_IN; + args.data_phase = TASKFILE_IN; args.handler = &task_in_intr; (void) smart_enable(drive); return ide_raw_taskfile(drive, &args, buf); @@ -1544,6 +1557,15 @@ static void idedisk_setup (ide_drive_t *drive) drive->capacity64 = 1ULL << 28; } + if (drive->hwif->no_lba48_dma && drive->addressing) { + if (drive->capacity64 > 1ULL << 28) { + printk(KERN_INFO "%s: cannot use LBA48 DMA - PIO mode will" + " be used for accessing sectors > %u\n", + drive->name, 1 << 28); + } else + drive->addressing = 0; + } + /* * if possible, give fdisk access to more of the drive, * by correcting bios_cyls: @@ -1607,6 +1629,8 @@ static void idedisk_setup (ide_drive_t *drive) if ((id->csfo & 1) || (id->cfs_enable_1 & (1 << 5))) drive->wcache = 1; + write_cache(drive, 1); + /* * We must avoid issuing commands a drive does not understand * or we may crash it. We check flush cache is supported. We also @@ -1622,14 +1646,6 @@ static void idedisk_setup (ide_drive_t *drive) if (capacity > (1ULL << 28) && !ide_id_has_flush_cache_ext(id)) barrier = 0; } - /* Now we have barrier awareness we can be properly conservative - by default with other drives. We turn off write caching when - barrier is not available. Users can adjust this at runtime if - they need unsafe but fast filesystems. This will reduce the - performance of non cache flush supporting disks but it means - you get the data order guarantees the journalling fs's require */ - - write_cache(drive, barrier); printk(KERN_DEBUG "%s: cache flushes %ssupported\n", drive->name, barrier ? "" : "not "); diff --git a/drivers/ide/ide-io.c b/drivers/ide/ide-io.c index ba620bc0c0e0..b50ba0257b4c 100644 --- a/drivers/ide/ide-io.c +++ b/drivers/ide/ide-io.c @@ -692,7 +692,9 @@ ide_startstop_t execute_drive_cmd (ide_drive_t *drive, struct request *rq) if (!args) goto done; - + + hwif->data_phase = args->data_phase; + if (args->tf_out_flags.all != 0) return flagged_taskfile(drive, args); return do_rw_taskfile(drive, args); diff --git a/drivers/ide/ide-iops.c b/drivers/ide/ide-iops.c index b7c47d235e91..c104120ae669 100644 --- a/drivers/ide/ide-iops.c +++ b/drivers/ide/ide-iops.c @@ -112,57 +112,57 @@ EXPORT_SYMBOL(default_hwif_iops); static u8 ide_mm_inb (unsigned long port) { - return (u8) readb(port); + return (u8) readb((void __iomem *) port); } static u16 ide_mm_inw (unsigned long port) { - return (u16) readw(port); + return (u16) readw((void __iomem *) port); } static void ide_mm_insw (unsigned long port, void *addr, u32 count) { - __ide_mm_insw(port, addr, count); + __ide_mm_insw((void __iomem *) port, addr, count); } static u32 ide_mm_inl (unsigned long port) { - return (u32) readl(port); + return (u32) readl((void __iomem *) port); } static void ide_mm_insl (unsigned long port, void *addr, u32 count) { - __ide_mm_insl(port, addr, count); + __ide_mm_insl((void __iomem *) port, addr, count); } static void ide_mm_outb (u8 value, unsigned long port) { - writeb(value, port); + writeb(value, (void __iomem *) port); } static void ide_mm_outbsync (ide_drive_t *drive, u8 value, unsigned long port) { - writeb(value, port); + writeb(value, (void __iomem *) port); } static void ide_mm_outw (u16 value, unsigned long port) { - writew(value, port); + writew(value, (void __iomem *) port); } static void ide_mm_outsw (unsigned long port, void *addr, u32 count) { - __ide_mm_outsw(port, addr, count); + __ide_mm_outsw((void __iomem *) port, addr, count); } static void ide_mm_outl (u32 value, unsigned long port) { - writel(value, port); + writel(value, (void __iomem *) port); } static void ide_mm_outsl (unsigned long port, void *addr, u32 count) { - __ide_mm_outsl(port, addr, count); + __ide_mm_outsl((void __iomem *) port, addr, count); } void default_hwif_mmiops (ide_hwif_t *hwif) @@ -1096,7 +1096,6 @@ static ide_startstop_t reset_pollfunc (ide_drive_t *drive) drive->failures = 0; } else { drive->failures++; -#if FANCY_STATUS_DUMPS printk("master: "); switch (tmp & 0x7f) { case 1: printk("passed"); @@ -1114,9 +1113,6 @@ static ide_startstop_t reset_pollfunc (ide_drive_t *drive) if (tmp & 0x80) printk("; slave: failed"); printk("\n"); -#else - printk("failed\n"); -#endif /* FANCY_STATUS_DUMPS */ } } hwgroup->poll_timeout = 0; /* done polling */ diff --git a/drivers/ide/ide-lib.c b/drivers/ide/ide-lib.c index 073c3fb82db3..b2fa5eccdcad 100644 --- a/drivers/ide/ide-lib.c +++ b/drivers/ide/ide-lib.c @@ -465,7 +465,6 @@ byte ide_dump_atapi_status (ide_drive_t *drive, const char *msg, byte stat) status.all = stat; local_irq_set(flags); printk("%s: %s: status=0x%02x", drive->name, msg, stat); -#if FANCY_STATUS_DUMPS printk(" { "); if (status.b.bsy) printk("Busy "); @@ -479,19 +478,16 @@ byte ide_dump_atapi_status (ide_drive_t *drive, const char *msg, byte stat) if (status.b.check) printk("Error "); } printk("}"); -#endif /* FANCY_STATUS_DUMPS */ printk("\n"); if ((status.all & (status.b.bsy|status.b.check)) == status.b.check) { error.all = HWIF(drive)->INB(IDE_ERROR_REG); printk("%s: %s: error=0x%02x", drive->name, msg, error.all); -#if FANCY_STATUS_DUMPS if (error.b.ili) printk("IllegalLengthIndication "); if (error.b.eom) printk("EndOfMedia "); if (error.b.abrt) printk("Aborted Command "); if (error.b.mcr) printk("MediaChangeRequested "); if (error.b.sense_key) printk("LastFailedSense 0x%02x ", error.b.sense_key); -#endif /* FANCY_STATUS_DUMPS */ printk("\n"); } local_irq_restore(flags); diff --git a/drivers/ide/ide-probe.c b/drivers/ide/ide-probe.c index 997b58bf4a4e..dd9229190f3f 100644 --- a/drivers/ide/ide-probe.c +++ b/drivers/ide/ide-probe.c @@ -904,8 +904,12 @@ static int ide_init_queue(ide_drive_t *drive) q->queuedata = drive; blk_queue_segment_boundary(q, 0xffff); - if (!hwif->rqsize) - hwif->rqsize = hwif->no_lba48 ? 256 : 65536; + if (!hwif->rqsize) { + if (hwif->no_lba48 || hwif->no_lba48_dma) + hwif->rqsize = 256; + else + hwif->rqsize = 65536; + } if (hwif->rqsize < max_sectors) max_sectors = hwif->rqsize; blk_queue_max_sectors(q, max_sectors); @@ -914,11 +918,11 @@ static int ide_init_queue(ide_drive_t *drive) /* When we have an IOMMU, we may have a problem where pci_map_sg() * creates segments that don't completely match our boundary * requirements and thus need to be broken up again. Because it - * doesn't align properly neither, we may actually have to break up + * doesn't align properly either, we may actually have to break up * to more segments than what was we got in the first place, a max * worst case is twice as many. * This will be fixed once we teach pci_map_sg() about our boundary - * requirements, hopefully soon + * requirements, hopefully soon. *FIXME* */ if (!PCI_DMA_BUS_IS_PHYS) max_sg_entries >>= 1; diff --git a/drivers/ide/ide-taskfile.c b/drivers/ide/ide-taskfile.c index e83c9a9eb228..977672ab7d86 100644 --- a/drivers/ide/ide-taskfile.c +++ b/drivers/ide/ide-taskfile.c @@ -96,6 +96,7 @@ int taskfile_lib_get_identify (ide_drive_t *drive, u8 *buf) else args.tfRegister[IDE_COMMAND_OFFSET] = WIN_PIDENTIFY; args.command_type = IDE_DRIVE_TASK_IN; + args.data_phase = TASKFILE_IN; args.handler = &task_in_intr; return ide_raw_taskfile(drive, &args, buf); } @@ -367,12 +368,44 @@ static u8 wait_drive_not_busy(ide_drive_t *drive) return stat; } +static inline void ide_pio_datablock(ide_drive_t *drive, struct request *rq, + unsigned int write) +{ + switch (drive->hwif->data_phase) { + case TASKFILE_MULTI_IN: + case TASKFILE_MULTI_OUT: + task_multi_sectors(drive, rq, write); + break; + default: + task_sectors(drive, rq, 1, write); + break; + } +} + #ifdef CONFIG_IDE_TASKFILE_IO static ide_startstop_t task_error(ide_drive_t *drive, struct request *rq, - const char *s, u8 stat, unsigned cur_bad) + const char *s, u8 stat) { if (rq->bio) { - int sectors = rq->hard_nr_sectors - rq->nr_sectors - cur_bad; + int sectors = rq->hard_nr_sectors - rq->nr_sectors; + + switch (drive->hwif->data_phase) { + case TASKFILE_IN: + if (rq->nr_sectors) + break; + /* fall through */ + case TASKFILE_OUT: + sectors--; + break; + case TASKFILE_MULTI_IN: + if (rq->nr_sectors) + break; + /* fall through */ + case TASKFILE_MULTI_OUT: + sectors -= drive->mult_count; + default: + break; + } if (sectors > 0) drive->driver->end_request(drive, 1, sectors); @@ -380,7 +413,7 @@ static ide_startstop_t task_error(ide_drive_t *drive, struct request *rq, return drive->driver->error(drive, s, stat); } #else -# define task_error(d, rq, s, stat, cur_bad) drive->driver->error(d, s, stat) +# define task_error(d, rq, s, stat) drive->driver->error(d, s, stat) #endif static void task_end_request(ide_drive_t *drive, struct request *rq, u8 stat) @@ -398,7 +431,7 @@ static void task_end_request(ide_drive_t *drive, struct request *rq, u8 stat) } /* - * Handler for command with PIO data-in phase (Read). + * Handler for command with PIO data-in phase (Read/Read Multiple). */ ide_startstop_t task_in_intr (ide_drive_t *drive) { @@ -407,19 +440,19 @@ ide_startstop_t task_in_intr (ide_drive_t *drive) if (!OK_STAT(stat, DATA_READY, BAD_R_STAT)) { if (stat & (ERR_STAT | DRQ_STAT)) - return task_error(drive, rq, __FUNCTION__, stat, 0); + return task_error(drive, rq, __FUNCTION__, stat); /* No data yet, so wait for another IRQ. */ ide_set_handler(drive, &task_in_intr, WAIT_WORSTCASE, NULL); return ide_started; } - task_sectors(drive, rq, 1, IDE_PIO_IN); + ide_pio_datablock(drive, rq, 0); /* If it was the last datablock check status and finish transfer. */ if (!rq->nr_sectors) { stat = wait_drive_not_busy(drive); if (!OK_STAT(stat, 0, BAD_R_STAT)) - return task_error(drive, rq, __FUNCTION__, stat, 1); + return task_error(drive, rq, __FUNCTION__, stat); task_end_request(drive, rq, stat); return ide_stopped; } @@ -432,41 +465,7 @@ ide_startstop_t task_in_intr (ide_drive_t *drive) EXPORT_SYMBOL(task_in_intr); /* - * Handler for command with PIO data-in phase (Read Multiple). - */ -ide_startstop_t task_mulin_intr (ide_drive_t *drive) -{ - struct request *rq = HWGROUP(drive)->rq; - u8 stat = HWIF(drive)->INB(IDE_STATUS_REG); - - if (!OK_STAT(stat, DATA_READY, BAD_R_STAT)) { - if (stat & (ERR_STAT | DRQ_STAT)) - return task_error(drive, rq, __FUNCTION__, stat, 0); - /* No data yet, so wait for another IRQ. */ - ide_set_handler(drive, &task_mulin_intr, WAIT_WORSTCASE, NULL); - return ide_started; - } - - task_multi_sectors(drive, rq, IDE_PIO_IN); - - /* If it was the last datablock check status and finish transfer. */ - if (!rq->nr_sectors) { - stat = wait_drive_not_busy(drive); - if (!OK_STAT(stat, 0, BAD_R_STAT)) - return task_error(drive, rq, __FUNCTION__, stat, drive->mult_count); - task_end_request(drive, rq, stat); - return ide_stopped; - } - - /* Still data left to transfer. */ - ide_set_handler(drive, &task_mulin_intr, WAIT_WORSTCASE, NULL); - - return ide_started; -} -EXPORT_SYMBOL(task_mulin_intr); - -/* - * Handler for command with PIO data-out phase (Write). + * Handler for command with PIO data-out phase (Write/Write Multiple). */ ide_startstop_t task_out_intr (ide_drive_t *drive) { @@ -475,11 +474,11 @@ ide_startstop_t task_out_intr (ide_drive_t *drive) stat = HWIF(drive)->INB(IDE_STATUS_REG); if (!OK_STAT(stat, DRIVE_READY, drive->bad_wstat)) - return task_error(drive, rq, __FUNCTION__, stat, 1); + return task_error(drive, rq, __FUNCTION__, stat); /* Deal with unexpected ATA data phase. */ if (((stat & DRQ_STAT) == 0) ^ !rq->nr_sectors) - return task_error(drive, rq, __FUNCTION__, stat, 1); + return task_error(drive, rq, __FUNCTION__, stat); if (!rq->nr_sectors) { task_end_request(drive, rq, stat); @@ -487,7 +486,7 @@ ide_startstop_t task_out_intr (ide_drive_t *drive) } /* Still data left to transfer. */ - task_sectors(drive, rq, 1, IDE_PIO_OUT); + ide_pio_datablock(drive, rq, 1); ide_set_handler(drive, &task_out_intr, WAIT_WORSTCASE, NULL); return ide_started; @@ -501,8 +500,10 @@ ide_startstop_t pre_task_out_intr (ide_drive_t *drive, struct request *rq) if (ide_wait_stat(&startstop, drive, DATA_READY, drive->bad_wstat, WAIT_DRQ)) { - printk(KERN_ERR "%s: no DRQ after issuing WRITE%s\n", - drive->name, drive->addressing ? "_EXT" : ""); + printk(KERN_ERR "%s: no DRQ after issuing %sWRITE%s\n", + drive->name, + drive->hwif->data_phase ? "MULT" : "", + drive->addressing ? "_EXT" : ""); return startstop; } @@ -510,62 +511,12 @@ ide_startstop_t pre_task_out_intr (ide_drive_t *drive, struct request *rq) local_irq_disable(); ide_set_handler(drive, &task_out_intr, WAIT_WORSTCASE, NULL); - task_sectors(drive, rq, 1, IDE_PIO_OUT); + ide_pio_datablock(drive, rq, 1); return ide_started; } EXPORT_SYMBOL(pre_task_out_intr); -/* - * Handler for command with PIO data-out phase (Write Multiple). - */ -ide_startstop_t task_mulout_intr (ide_drive_t *drive) -{ - struct request *rq = HWGROUP(drive)->rq; - u8 stat; - - stat = HWIF(drive)->INB(IDE_STATUS_REG); - if (!OK_STAT(stat, DRIVE_READY, drive->bad_wstat)) - return task_error(drive, rq, __FUNCTION__, stat, drive->mult_count); - - /* Deal with unexpected ATA data phase. */ - if (((stat & DRQ_STAT) == 0) ^ !rq->nr_sectors) - return task_error(drive, rq, __FUNCTION__, stat, drive->mult_count); - - if (!rq->nr_sectors) { - task_end_request(drive, rq, stat); - return ide_stopped; - } - - /* Still data left to transfer. */ - task_multi_sectors(drive, rq, IDE_PIO_OUT); - ide_set_handler(drive, &task_mulout_intr, WAIT_WORSTCASE, NULL); - - return ide_started; -} -EXPORT_SYMBOL(task_mulout_intr); - -ide_startstop_t pre_task_mulout_intr (ide_drive_t *drive, struct request *rq) -{ - ide_startstop_t startstop; - - if (ide_wait_stat(&startstop, drive, DATA_READY, - drive->bad_wstat, WAIT_DRQ)) { - printk(KERN_ERR "%s: no DRQ after issuing MULTWRITE%s\n", - drive->name, drive->addressing ? "_EXT" : ""); - return startstop; - } - - if (!drive->unmask) - local_irq_disable(); - - ide_set_handler(drive, &task_mulout_intr, WAIT_WORSTCASE, NULL); - task_multi_sectors(drive, rq, IDE_PIO_OUT); - - return ide_started; -} -EXPORT_SYMBOL(pre_task_mulout_intr); - int ide_diag_taskfile (ide_drive_t *drive, ide_task_t *args, unsigned long data_size, u8 *buf) { struct request rq; @@ -710,10 +661,7 @@ int ide_taskfile_ioctl (ide_drive_t *drive, unsigned int cmd, unsigned long arg) err = -EPERM; goto abort; } - args.prehandler = &pre_task_mulout_intr; - args.handler = &task_mulout_intr; - err = ide_diag_taskfile(drive, &args, taskout, outbuf); - break; + /* fall through */ case TASKFILE_OUT: args.prehandler = &pre_task_out_intr; args.handler = &task_out_intr; @@ -728,9 +676,7 @@ int ide_taskfile_ioctl (ide_drive_t *drive, unsigned int cmd, unsigned long arg) err = -EPERM; goto abort; } - args.handler = &task_mulin_intr; - err = ide_diag_taskfile(drive, &args, taskin, inbuf); - break; + /* fall through */ case TASKFILE_IN: args.handler = &task_in_intr; err = ide_diag_taskfile(drive, &args, taskin, inbuf); diff --git a/drivers/ide/ide.c b/drivers/ide/ide.c index 39388ed9b4d0..c57bd4cc9e20 100644 --- a/drivers/ide/ide.c +++ b/drivers/ide/ide.c @@ -320,13 +320,19 @@ static void __init init_ide_data (void) #endif } -/* - * ide_system_bus_speed() returns what we think is the system VESA/PCI - * bus speed (in MHz). This is used for calculating interface PIO timings. - * The default is 40 for known PCI systems, 50 otherwise. - * The "idebus=xx" parameter can be used to override this value. - * The actual value to be used is computed/displayed the first time through. +/** + * ide_system_bus_speed - guess bus speed + * + * ide_system_bus_speed() returns what we think is the system VESA/PCI + * bus speed (in MHz). This is used for calculating interface PIO timings. + * The default is 40 for known PCI systems, 50 otherwise. + * The "idebus=xx" parameter can be used to override this value. + * The actual value to be used is computed/displayed the first time + * through. Drivers should only use this as a last resort. + * + * Returns a guessed speed in MHz. */ + int ide_system_bus_speed (void) { if (!system_bus_speed) { @@ -347,10 +353,15 @@ int ide_system_bus_speed (void) return system_bus_speed; } -/* - * current_capacity() returns the capacity (in sectors) of a drive - * according to its current geometry/LBA settings. +/** + * current_capacity - drive capacity + * @drive: drive to query + * + * Return the current capacity (in sectors) of a drive according to + * its current geometry/LBA settings. Empty removables are reported + * as size zero. */ + sector_t current_capacity (ide_drive_t *drive) { if (!drive->present) @@ -360,9 +371,17 @@ sector_t current_capacity (ide_drive_t *drive) EXPORT_SYMBOL(current_capacity); -/* - * Error reporting, in human readable form (luxurious, but a memory hog). +/** + * ide_dump_status - translate ATA error + * @drive: drive the error occured on + * @msg: information string + * @stat: status byte + * + * Error reporting, in human readable form (luxurious, but a memory hog). + * Combines the drive name, message and status byte to provide a + * user understandable explanation of the device error. */ + u8 ide_dump_status (ide_drive_t *drive, const char *msg, u8 stat) { ide_hwif_t *hwif = HWIF(drive); @@ -371,7 +390,6 @@ u8 ide_dump_status (ide_drive_t *drive, const char *msg, u8 stat) local_irq_set(flags); printk(KERN_WARNING "%s: %s: status=0x%02x", drive->name, msg, stat); -#if FANCY_STATUS_DUMPS printk(" { "); if (stat & BUSY_STAT) { printk("Busy "); @@ -385,12 +403,10 @@ u8 ide_dump_status (ide_drive_t *drive, const char *msg, u8 stat) if (stat & ERR_STAT) printk("Error "); } printk("}"); -#endif /* FANCY_STATUS_DUMPS */ printk("\n"); if ((stat & (BUSY_STAT|ERR_STAT)) == ERR_STAT) { err = hwif->INB(IDE_ERROR_REG); printk("%s: %s: error=0x%02x", drive->name, msg, err); -#if FANCY_STATUS_DUMPS if (drive->media == ide_disk) { printk(" { "); if (err & ABRT_ERR) printk("DriveStatusError "); @@ -434,7 +450,6 @@ u8 ide_dump_status (ide_drive_t *drive, const char *msg, u8 stat) printk(", sector=%llu", (unsigned long long)HWGROUP(drive)->rq->sector); } } -#endif /* FANCY_STATUS_DUMPS */ printk("\n"); } { @@ -474,11 +489,17 @@ static int ide_open (struct inode * inode, struct file * filp) return -ENXIO; } +/* + * drives_lock protects the list of drives, drivers_lock the + * list of drivers. Currently nobody takes both at once. + */ + static spinlock_t drives_lock = SPIN_LOCK_UNLOCKED; static spinlock_t drivers_lock = SPIN_LOCK_UNLOCKED; static LIST_HEAD(drivers); -/* Iterator */ +/* Iterator for the driver list. */ + static void *m_start(struct seq_file *m, loff_t *pos) { struct list_head *p; @@ -489,22 +510,26 @@ static void *m_start(struct seq_file *m, loff_t *pos) return list_entry(p, ide_driver_t, drivers); return NULL; } + static void *m_next(struct seq_file *m, void *v, loff_t *pos) { struct list_head *p = ((ide_driver_t *)v)->drivers.next; (*pos)++; return p==&drivers ? NULL : list_entry(p, ide_driver_t, drivers); } + static void m_stop(struct seq_file *m, void *v) { spin_unlock(&drivers_lock); } + static int show_driver(struct seq_file *m, void *v) { ide_driver_t *driver = v; seq_printf(m, "%s version %s\n", driver->name, driver->version); return 0; } + struct seq_operations ide_drivers_op = { .start = m_start, .next = m_next, @@ -541,6 +566,7 @@ static struct resource* hwif_request_region(ide_hwif_t *hwif, * MMIO leaves it to the controller driver, * PIO will migrate this way over time. */ + int ide_hwif_request_regions(ide_hwif_t *hwif) { unsigned long addr; @@ -590,6 +616,7 @@ control_region_busy: * importantly our caller should be doing this so we need to * restructure this as a helper function for drivers. */ + void ide_hwif_release_regions(ide_hwif_t *hwif) { u32 i = 0; @@ -607,7 +634,15 @@ void ide_hwif_release_regions(ide_hwif_t *hwif) release_region(hwif->io_ports[i], 1); } -/* restore hwif to a sane state */ +/** + * ide_hwif_restore - restore hwif to template + * @hwif: hwif to update + * @tmp_hwif: template + * + * Restore hwif to a previous state by copying most settngs + * from the template. + */ + static void ide_hwif_restore(ide_hwif_t *hwif, ide_hwif_t *tmp_hwif) { hwif->hwgroup = tmp_hwif->hwgroup; @@ -728,18 +763,13 @@ static void ide_hwif_restore(ide_hwif_t *hwif, ide_hwif_t *tmp_hwif) void ide_unregister(unsigned int index) { ide_drive_t *drive; - ide_hwif_t *hwif, *g, *tmp_hwif; + ide_hwif_t *hwif, *g; + static ide_hwif_t tmp_hwif; /* protected by ide_cfg_sem */ ide_hwgroup_t *hwgroup; int irq_count = 0, unit, i; BUG_ON(index >= MAX_HWIFS); - tmp_hwif = kmalloc(sizeof(*tmp_hwif), GFP_KERNEL|__GFP_NOFAIL); - if (!tmp_hwif) { - printk(KERN_ERR "%s: unable to allocate memory\n", __FUNCTION__); - return; - } - BUG_ON(in_interrupt()); BUG_ON(irqs_disabled()); down(&ide_cfg_sem); @@ -886,19 +916,17 @@ void ide_unregister(unsigned int index) } /* copy original settings */ - *tmp_hwif = *hwif; + tmp_hwif = *hwif; /* restore hwif data to pristine status */ init_hwif_data(hwif, index); init_hwif_default(hwif, index); - ide_hwif_restore(hwif, tmp_hwif); + ide_hwif_restore(hwif, &tmp_hwif); abort: spin_unlock_irq(&ide_lock); up(&ide_cfg_sem); - - kfree(tmp_hwif); } EXPORT_SYMBOL(ide_unregister); @@ -957,10 +985,17 @@ void ide_setup_ports ( hw_regs_t *hw, */ } -/* - * Register an IDE interface, specifying exactly the registers etc - * Set init=1 iff calling before probes have taken place. +/** + * ide_register_hw - register IDE interface + * @hw: hardware registers + * @hwifp: pointer to returned hwif + * + * Register an IDE interface, specifying exactly the registers etc. + * Set init=1 iff calling before probes have taken place. + * + * Returns -1 on error. */ + int ide_register_hw (hw_regs_t *hw, ide_hwif_t **hwifp) { int index, retry = 1; @@ -1214,6 +1249,15 @@ int ide_read_setting (ide_drive_t *drive, ide_settings_t *setting) return val; } +/** + * ide_spin_wait_hwgroup - wait for group + * @drive: drive in the group + * + * Wait for an IDE device group to go non busy and then return + * holding the ide_lock which guards the hwgroup->busy status + * and right to use it. + */ + int ide_spin_wait_hwgroup (ide_drive_t *drive) { ide_hwgroup_t *hwgroup = HWGROUP(drive); @@ -1255,6 +1299,7 @@ EXPORT_SYMBOL(ide_spin_wait_hwgroup); * to the driver to change settings, and then wait on a sema for completion. * The current scheme of polling is kludgy, though safe enough. */ + int ide_write_setting (ide_drive_t *drive, ide_settings_t *setting, int val) { int i; @@ -1348,6 +1393,15 @@ static int set_xfer_rate (ide_drive_t *drive, int arg) return err; } +/** + * ide_add_generic_settings - generic ide settings + * @drive: drive being configured + * + * Add the generic parts of the system settings to the /proc files and + * ioctls for this IDE device. The caller must not be holding the + * ide_setting_sem. + */ + void ide_add_generic_settings (ide_drive_t *drive) { /* @@ -1364,6 +1418,13 @@ void ide_add_generic_settings (ide_drive_t *drive) ide_add_setting(drive, "number", SETTING_RW, -1, -1, TYPE_BYTE, 0, 3, 1, 1, &drive->dn, NULL); } +/** + * system_bus_clock - clock guess + * + * External version of the bus clock guess used by very old IDE drivers + * for things like VLB timings. Should not be used. + */ + int system_bus_clock (void) { return((int) ((!system_bus_speed) ? ide_system_bus_speed() : system_bus_speed )); @@ -1398,6 +1459,22 @@ abort: return 1; } +/** + * ata_attach - attach an ATA/ATAPI device + * @drive: drive to attach + * + * Takes a drive that is as yet not assigned to any midlayer IDE + * driver (or is assigned to the default driver) and figures out + * which driver would like to own it. If nobody claims the drive + * then it is automatically attached to the default driver used for + * unclaimed objects. + * + * A return of zero indicates attachment to a driver, of one + * attachment to the default driver. + * + * Takes drivers_lock. + */ + int ata_attach(ide_drive_t *drive) { struct list_head *p; @@ -2206,6 +2283,20 @@ int ide_register_subdriver(ide_drive_t *drive, ide_driver_t *driver) EXPORT_SYMBOL(ide_register_subdriver); +/** + * ide_unregister_subdriver - disconnect drive from driver + * @drive: drive to unplug + * + * Disconnect a drive from the driver it was attached to and then + * clean up the various proc files and other objects attached to it. + * + * Takes ide_setting_sem, ide_lock and drives_lock. + * Caller must hold none of the locks. + * + * No locking versus subdriver unload because we are moving to the + * default driver anyway. Wants double checking. + */ + int ide_unregister_subdriver (ide_drive_t *drive) { unsigned long flags; @@ -2241,6 +2332,17 @@ static int ide_drive_remove(struct device * dev) return 0; } +/** + * ide_register_driver - register IDE device driver + * @driver: the IDE device driver + * + * Register a new device driver and then scan the devices + * on the IDE bus in case any should be attached to the + * driver we have just registered. If so attach them. + * + * Takes drivers_lock and drives_lock. + */ + int ide_register_driver(ide_driver_t *driver) { struct list_head list; @@ -2272,6 +2374,17 @@ int ide_register_driver(ide_driver_t *driver) EXPORT_SYMBOL(ide_register_driver); +/** + * ide_unregister_driver - unregister IDE device driver + * @driver: the IDE device driver + * + * Called when a driver module is being unloaded. We reattach any + * devices to whatever driver claims them next (typically the default + * driver). + * + * Takes drivers_lock and called functions will take ide_setting_sem. + */ + void ide_unregister_driver(ide_driver_t *driver) { ide_drive_t *drive; diff --git a/drivers/ide/pci/alim15x3.c b/drivers/ide/pci/alim15x3.c index 12711cddbf2a..82a449dc8222 100644 --- a/drivers/ide/pci/alim15x3.c +++ b/drivers/ide/pci/alim15x3.c @@ -752,8 +752,8 @@ static void __init init_hwif_common_ali15x3 (ide_hwif_t *hwif) hwif->tuneproc = &ali15x3_tune_drive; hwif->speedproc = &ali15x3_tune_chipset; - /* Don't use LBA48 on ALi devices before rev 0xC5 */ - hwif->no_lba48 = (m5229_revision <= 0xC4) ? 1 : 0; + /* don't use LBA48 DMA on ALi devices before rev 0xC5 */ + hwif->no_lba48_dma = (m5229_revision <= 0xC4) ? 1 : 0; if (!hwif->dma_base) { hwif->drives[0].autotune = 1; diff --git a/drivers/ide/pci/siimage.c b/drivers/ide/pci/siimage.c index fc8f88b66279..6c874989bb61 100644 --- a/drivers/ide/pci/siimage.c +++ b/drivers/ide/pci/siimage.c @@ -727,8 +727,7 @@ static unsigned int setup_mmio_siimage (struct pci_dev *dev, const char *name) unsigned long bar5 = pci_resource_start(dev, 5); unsigned long barsize = pci_resource_len(dev, 5); u8 tmpbyte = 0; - unsigned long addr; - void *ioaddr; + void __iomem *ioaddr; /* * Drop back to PIO if we can't map the mmio. Some @@ -751,22 +750,21 @@ static unsigned int setup_mmio_siimage (struct pci_dev *dev, const char *name) } pci_set_master(dev); - pci_set_drvdata(dev, ioaddr); - addr = (unsigned long) ioaddr; + pci_set_drvdata(dev, (void *) ioaddr); if (pdev_is_sata(dev)) { - writel(0, addr + 0x148); - writel(0, addr + 0x1C8); + writel(0, ioaddr + 0x148); + writel(0, ioaddr + 0x1C8); } - writeb(0, addr + 0xB4); - writeb(0, addr + 0xF4); - tmpbyte = readb(addr + 0x4A); + writeb(0, ioaddr + 0xB4); + writeb(0, ioaddr + 0xF4); + tmpbyte = readb(ioaddr + 0x4A); switch(tmpbyte & 0x30) { case 0x00: /* In 100 MHz clocking, try and switch to 133 */ - writeb(tmpbyte|0x10, addr + 0x4A); + writeb(tmpbyte|0x10, ioaddr + 0x4A); break; case 0x10: /* On 133Mhz clocking */ @@ -777,29 +775,29 @@ static unsigned int setup_mmio_siimage (struct pci_dev *dev, const char *name) case 0x30: /* Clocking is disabled */ /* 133 clock attempt to force it on */ - writeb(tmpbyte & ~0x20, addr + 0x4A); + writeb(tmpbyte & ~0x20, ioaddr + 0x4A); break; } - writeb( 0x72, addr + 0xA1); - writew( 0x328A, addr + 0xA2); - writel(0x62DD62DD, addr + 0xA4); - writel(0x43924392, addr + 0xA8); - writel(0x40094009, addr + 0xAC); - writeb( 0x72, addr + 0xE1); - writew( 0x328A, addr + 0xE2); - writel(0x62DD62DD, addr + 0xE4); - writel(0x43924392, addr + 0xE8); - writel(0x40094009, addr + 0xEC); + writeb( 0x72, ioaddr + 0xA1); + writew( 0x328A, ioaddr + 0xA2); + writel(0x62DD62DD, ioaddr + 0xA4); + writel(0x43924392, ioaddr + 0xA8); + writel(0x40094009, ioaddr + 0xAC); + writeb( 0x72, ioaddr + 0xE1); + writew( 0x328A, ioaddr + 0xE2); + writel(0x62DD62DD, ioaddr + 0xE4); + writel(0x43924392, ioaddr + 0xE8); + writel(0x40094009, ioaddr + 0xEC); if (pdev_is_sata(dev)) { - writel(0xFFFF0000, addr + 0x108); - writel(0xFFFF0000, addr + 0x188); - writel(0x00680000, addr + 0x148); - writel(0x00680000, addr + 0x1C8); + writel(0xFFFF0000, ioaddr + 0x108); + writel(0xFFFF0000, ioaddr + 0x188); + writel(0x00680000, ioaddr + 0x148); + writel(0x00680000, ioaddr + 0x1C8); } - tmpbyte = readb(addr + 0x4A); + tmpbyte = readb(ioaddr + 0x4A); proc_reports_siimage(dev, (tmpbyte>>4), name); return 1; diff --git a/drivers/ide/ppc/pmac.c b/drivers/ide/ppc/pmac.c index d4884c7f1dfa..bc08b6326d19 100644 --- a/drivers/ide/ppc/pmac.c +++ b/drivers/ide/ppc/pmac.c @@ -568,7 +568,7 @@ pmac_outbsync(ide_drive_t *drive, u8 value, unsigned long port) { u32 tmp; - writeb(value, port); + writeb(value, (void __iomem *) port); tmp = readl((unsigned *)(IDE_DATA_REG + IDE_TIMING_CONFIG)); } diff --git a/drivers/ieee1394/ohci1394.h b/drivers/ieee1394/ohci1394.h index e2e6194c9728..d1758d409610 100644 --- a/drivers/ieee1394/ohci1394.h +++ b/drivers/ieee1394/ohci1394.h @@ -163,7 +163,7 @@ struct ti_ohci { } init_state; /* remapped memory spaces */ - void *registers; + void __iomem *registers; /* dma buffer for self-id packets */ quadlet_t *selfid_buf_cpu; diff --git a/drivers/net/sungem.c b/drivers/net/sungem.c index 6177397c30cb..1d63097d5785 100644 --- a/drivers/net/sungem.c +++ b/drivers/net/sungem.c @@ -651,7 +651,7 @@ static __inline__ void gem_tx(struct net_device *dev, struct gem *gp, u32 gem_st } gp->net_stats.tx_packets++; - dev_kfree_skb(skb); + dev_kfree_skb_irq(skb); } gp->tx_old = entry; @@ -2656,7 +2656,7 @@ static void find_eth_addr_in_vpd(void *rom_base, int len, unsigned char *dev_add static void get_gem_mac_nonobp(struct pci_dev *pdev, unsigned char *dev_addr) { u32 rom_reg_orig; - void *p; + void __iomem *p; if (pdev->resource[PCI_ROM_RESOURCE].parent == NULL) { if (pci_assign_resource(pdev, PCI_ROM_RESOURCE) < 0) @@ -2825,7 +2825,7 @@ static int __devinit gem_init_one(struct pci_dev *pdev, gp->timer_ticks = 0; netif_carrier_off(dev); - gp->regs = (unsigned long) ioremap(gemreg_base, gemreg_len); + gp->regs = ioremap(gemreg_base, gemreg_len); if (gp->regs == 0UL) { printk(KERN_ERR PFX "Cannot map device registers, " "aborting.\n"); @@ -2944,7 +2944,7 @@ err_out_iounmap: gem_shutdown(gp); up(&gp->pm_sem); - iounmap((void *) gp->regs); + iounmap(gp->regs); err_out_free_res: pci_release_regions(pdev); @@ -2978,7 +2978,7 @@ static void __devexit gem_remove_one(struct pci_dev *pdev) sizeof(struct gem_init_block), gp->init_block, gp->gblock_dvma); - iounmap((void *) gp->regs); + iounmap(gp->regs); pci_release_regions(pdev); free_netdev(dev); diff --git a/drivers/net/sungem.h b/drivers/net/sungem.h index bc0175acb52e..8bbc104d848f 100644 --- a/drivers/net/sungem.h +++ b/drivers/net/sungem.h @@ -953,7 +953,7 @@ enum link_state { struct gem { spinlock_t lock; - unsigned long regs; + void __iomem *regs; int rx_new, rx_old; int tx_new, tx_old; diff --git a/drivers/net/tg3.c b/drivers/net/tg3.c index f07841f75a3d..7b8f016b7956 100644 --- a/drivers/net/tg3.c +++ b/drivers/net/tg3.c @@ -331,7 +331,7 @@ static void _tw32_flush(struct tg3 *tp, u32 off, u32 val) pci_write_config_dword(tp->pdev, TG3PCI_REG_DATA, val); spin_unlock_irqrestore(&tp->indirect_lock, flags); } else { - unsigned long dest = tp->regs + off; + void __iomem *dest = tp->regs + off; writel(val, dest); readl(dest); /* always flush PCI write */ } @@ -339,7 +339,7 @@ static void _tw32_flush(struct tg3 *tp, u32 off, u32 val) static inline void _tw32_rx_mbox(struct tg3 *tp, u32 off, u32 val) { - unsigned long mbox = tp->regs + off; + void __iomem *mbox = tp->regs + off; writel(val, mbox); if (tp->tg3_flags & TG3_FLAG_MBOX_WRITE_REORDER) readl(mbox); @@ -347,7 +347,7 @@ static inline void _tw32_rx_mbox(struct tg3 *tp, u32 off, u32 val) static inline void _tw32_tx_mbox(struct tg3 *tp, u32 off, u32 val) { - unsigned long mbox = tp->regs + off; + void __iomem *mbox = tp->regs + off; writel(val, mbox); if (tp->tg3_flags & TG3_FLAG_TXD_MBOX_HWBUG) writel(val, mbox); @@ -2976,7 +2976,7 @@ static void tg3_set_txd(struct tg3 *tp, int entry, txd->vlan_tag = vlan_tag << TXD_VLAN_TAG_SHIFT; } else { struct tx_ring_info *txr = &tp->tx_buffers[entry]; - unsigned long txd; + void __iomem *txd; txd = (tp->regs + NIC_SRAM_WIN_BASE + @@ -3339,7 +3339,7 @@ static void tg3_free_rings(struct tg3 *tp) */ static void tg3_init_rings(struct tg3 *tp) { - unsigned long start, end; + void __iomem *start, *end; u32 i; /* Free up all the SKBs. */ @@ -7614,7 +7614,7 @@ static int __devinit tg3_get_invariants(struct tg3 *tp) chiprevid == CHIPREV_ID_5701_B0 || chiprevid == CHIPREV_ID_5701_B2 || chiprevid == CHIPREV_ID_5701_B5) { - unsigned long sram_base; + void __iomem *sram_base; /* Write some dummy words into the SRAM status block * area, see if it reads back correctly. If the return @@ -8305,7 +8305,7 @@ static int __devinit tg3_init_one(struct pci_dev *pdev, spin_lock_init(&tp->indirect_lock); INIT_WORK(&tp->reset_task, tg3_reset_task, tp); - tp->regs = (unsigned long) ioremap(tg3reg_base, tg3reg_len); + tp->regs = ioremap(tg3reg_base, tg3reg_len); if (tp->regs == 0UL) { printk(KERN_ERR PFX "Cannot map device registers, " "aborting.\n"); @@ -8468,7 +8468,7 @@ static int __devinit tg3_init_one(struct pci_dev *pdev, return 0; err_out_iounmap: - iounmap((void *) tp->regs); + iounmap(tp->regs); err_out_free_dev: free_netdev(dev); @@ -8490,7 +8490,7 @@ static void __devexit tg3_remove_one(struct pci_dev *pdev) struct tg3 *tp = netdev_priv(dev); unregister_netdev(dev); - iounmap((void *)tp->regs); + iounmap(tp->regs); free_netdev(dev); pci_release_regions(pdev); pci_disable_device(pdev); diff --git a/drivers/net/tg3.h b/drivers/net/tg3.h index 2ef465214769..9128d8d5410c 100644 --- a/drivers/net/tg3.h +++ b/drivers/net/tg3.h @@ -1989,7 +1989,7 @@ struct tg3 { spinlock_t lock; spinlock_t indirect_lock; - unsigned long regs; + void __iomem *regs; struct net_device *dev; struct pci_dev *pdev; diff --git a/drivers/net/tokenring/olympic.c b/drivers/net/tokenring/olympic.c index ea82d131a6c7..ed8af9c24f0e 100644 --- a/drivers/net/tokenring/olympic.c +++ b/drivers/net/tokenring/olympic.c @@ -291,7 +291,7 @@ op_disable_dev: static int __devinit olympic_init(struct net_device *dev) { struct olympic_private *olympic_priv; - u8 *olympic_mmio, *init_srb,*adapter_addr; + u8 __iomem *olympic_mmio, *init_srb,*adapter_addr; unsigned long t; unsigned int uaa_addr; @@ -435,7 +435,7 @@ static int __devinit olympic_init(struct net_device *dev) static int olympic_open(struct net_device *dev) { struct olympic_private *olympic_priv=(struct olympic_private *)dev->priv; - u8 *olympic_mmio=olympic_priv->olympic_mmio,*init_srb; + u8 __iomem *olympic_mmio=olympic_priv->olympic_mmio,*init_srb; unsigned long flags, t; char open_error[255] ; int i, open_finished = 1 ; @@ -706,10 +706,10 @@ static int olympic_open(struct net_device *dev) #endif if (olympic_priv->olympic_network_monitor) { - u8 *oat ; - u8 *opt ; - oat = (u8 *)(olympic_priv->olympic_lap + olympic_priv->olympic_addr_table_addr) ; - opt = (u8 *)(olympic_priv->olympic_lap + olympic_priv->olympic_parms_addr) ; + u8 __iomem *oat ; + u8 __iomem *opt ; + oat = (olympic_priv->olympic_lap + olympic_priv->olympic_addr_table_addr) ; + opt = (olympic_priv->olympic_lap + olympic_priv->olympic_parms_addr) ; printk("%s: Node Address: %02x:%02x:%02x:%02x:%02x:%02x\n",dev->name, readb(oat+offsetof(struct olympic_adapter_addr_table,node_addr)), @@ -755,7 +755,7 @@ static int olympic_open(struct net_device *dev) static void olympic_rx(struct net_device *dev) { struct olympic_private *olympic_priv=(struct olympic_private *)dev->priv; - u8 *olympic_mmio=olympic_priv->olympic_mmio; + u8 __iomem *olympic_mmio=olympic_priv->olympic_mmio; struct olympic_rx_status *rx_status; struct olympic_rx_desc *rx_desc ; int rx_ring_last_received,length, buffer_cnt, cpy_length, frag_len; @@ -925,9 +925,9 @@ static irqreturn_t olympic_interrupt(int irq, void *dev_id, struct pt_regs *regs { struct net_device *dev= (struct net_device *)dev_id; struct olympic_private *olympic_priv=(struct olympic_private *)dev->priv; - u8 *olympic_mmio=olympic_priv->olympic_mmio; + u8 __iomem *olympic_mmio=olympic_priv->olympic_mmio; u32 sisr; - u8 *adapter_check_area ; + u8 __iomem *adapter_check_area ; /* * Read sisr but don't reset it yet. @@ -1049,7 +1049,7 @@ static irqreturn_t olympic_interrupt(int irq, void *dev_id, struct pt_regs *regs static int olympic_xmit(struct sk_buff *skb, struct net_device *dev) { struct olympic_private *olympic_priv=(struct olympic_private *)dev->priv; - u8 *olympic_mmio=olympic_priv->olympic_mmio; + u8 __iomem *olympic_mmio=olympic_priv->olympic_mmio; unsigned long flags ; spin_lock_irqsave(&olympic_priv->olympic_lock, flags); @@ -1080,7 +1080,7 @@ static int olympic_xmit(struct sk_buff *skb, struct net_device *dev) static int olympic_close(struct net_device *dev) { struct olympic_private *olympic_priv=(struct olympic_private *)dev->priv; - u8 *olympic_mmio=olympic_priv->olympic_mmio,*srb; + u8 __iomem *olympic_mmio=olympic_priv->olympic_mmio,*srb; unsigned long t,flags; DECLARE_WAITQUEUE(wait,current) ; @@ -1152,9 +1152,9 @@ static int olympic_close(struct net_device *dev) static void olympic_set_rx_mode(struct net_device *dev) { struct olympic_private *olympic_priv = (struct olympic_private *) dev->priv ; - u8 *olympic_mmio = olympic_priv->olympic_mmio ; + u8 __iomem *olympic_mmio = olympic_priv->olympic_mmio ; u8 options = 0; - u8 *srb; + u8 __iomem *srb; struct dev_mc_list *dmi ; unsigned char dev_mc_address[4] ; int i ; @@ -1220,8 +1220,8 @@ static void olympic_set_rx_mode(struct net_device *dev) static void olympic_srb_bh(struct net_device *dev) { struct olympic_private *olympic_priv = (struct olympic_private *) dev->priv ; - u8 *olympic_mmio = olympic_priv->olympic_mmio ; - u8 *srb; + u8 __iomem *olympic_mmio = olympic_priv->olympic_mmio ; + u8 __iomem *srb; writel(olympic_priv->srb,olympic_mmio+LAPA); srb=olympic_priv->olympic_lap + (olympic_priv->srb & (~0xf800)); @@ -1394,22 +1394,22 @@ static int olympic_set_mac_address (struct net_device *dev, void *addr) static void olympic_arb_cmd(struct net_device *dev) { struct olympic_private *olympic_priv = (struct olympic_private *) dev->priv; - u8 *olympic_mmio=olympic_priv->olympic_mmio; - u8 *arb_block, *asb_block, *srb ; + u8 __iomem *olympic_mmio=olympic_priv->olympic_mmio; + u8 __iomem *arb_block, *asb_block, *srb ; u8 header_len ; u16 frame_len, buffer_len ; struct sk_buff *mac_frame ; - u8 *buf_ptr ; - u8 *frame_data ; + u8 __iomem *buf_ptr ; + u8 __iomem *frame_data ; u16 buff_off ; u16 lan_status = 0, lan_status_diff ; /* Initialize to stop compiler warning */ u8 fdx_prot_error ; u16 next_ptr; int i ; - arb_block = (u8 *)(olympic_priv->olympic_lap + olympic_priv->arb) ; - asb_block = (u8 *)(olympic_priv->olympic_lap + olympic_priv->asb) ; - srb = (u8 *)(olympic_priv->olympic_lap + olympic_priv->srb) ; + arb_block = (olympic_priv->olympic_lap + olympic_priv->arb) ; + asb_block = (olympic_priv->olympic_lap + olympic_priv->asb) ; + srb = (olympic_priv->olympic_lap + olympic_priv->srb) ; if (readb(arb_block+0) == ARB_RECEIVE_DATA) { /* Receive.data, MAC frames */ @@ -1604,10 +1604,10 @@ drop_frame: static void olympic_asb_bh(struct net_device *dev) { struct olympic_private *olympic_priv = (struct olympic_private *) dev->priv ; - u8 *arb_block, *asb_block ; + u8 __iomem *arb_block, *asb_block ; - arb_block = (u8 *)(olympic_priv->olympic_lap + olympic_priv->arb) ; - asb_block = (u8 *)(olympic_priv->olympic_lap + olympic_priv->asb) ; + arb_block = (olympic_priv->olympic_lap + olympic_priv->arb) ; + asb_block = (olympic_priv->olympic_lap + olympic_priv->asb) ; if (olympic_priv->asb_queued == 1) { /* Dropped through the first time */ @@ -1666,8 +1666,8 @@ static int olympic_proc_info(char *buffer, char **start, off_t offset, int lengt { struct net_device *dev = (struct net_device *)data ; struct olympic_private *olympic_priv=(struct olympic_private *)dev->priv; - u8 *oat = (u8 *)(olympic_priv->olympic_lap + olympic_priv->olympic_addr_table_addr) ; - u8 *opt = (u8 *)(olympic_priv->olympic_lap + olympic_priv->olympic_parms_addr) ; + u8 __iomem *oat = (olympic_priv->olympic_lap + olympic_priv->olympic_addr_table_addr) ; + u8 __iomem *opt = (olympic_priv->olympic_lap + olympic_priv->olympic_parms_addr) ; int size = 0 ; int len=0; off_t begin=0; diff --git a/drivers/net/tokenring/olympic.h b/drivers/net/tokenring/olympic.h index e209b79d65fd..2fc59c997468 100644 --- a/drivers/net/tokenring/olympic.h +++ b/drivers/net/tokenring/olympic.h @@ -251,8 +251,8 @@ struct olympic_private { u16 arb; /* be16 */ u16 asb; /* be16 */ - u8 *olympic_mmio; - u8 *olympic_lap; + u8 __iomem *olympic_mmio; + u8 __iomem *olympic_lap; struct pci_dev *pdev ; char *olympic_card_name ; diff --git a/drivers/scsi/libata-core.c b/drivers/scsi/libata-core.c index 52cfe3e97cfc..f32ea04e4fa7 100644 --- a/drivers/scsi/libata-core.c +++ b/drivers/scsi/libata-core.c @@ -142,17 +142,17 @@ void ata_tf_load_mmio(struct ata_port *ap, struct ata_taskfile *tf) unsigned int is_addr = tf->flags & ATA_TFLAG_ISADDR; if (tf->ctl != ap->last_ctl) { - writeb(tf->ctl, ap->ioaddr.ctl_addr); + writeb(tf->ctl, (void __iomem *) ap->ioaddr.ctl_addr); ap->last_ctl = tf->ctl; ata_wait_idle(ap); } if (is_addr && (tf->flags & ATA_TFLAG_LBA48)) { - writeb(tf->hob_feature, (void *) ioaddr->feature_addr); - writeb(tf->hob_nsect, (void *) ioaddr->nsect_addr); - writeb(tf->hob_lbal, (void *) ioaddr->lbal_addr); - writeb(tf->hob_lbam, (void *) ioaddr->lbam_addr); - writeb(tf->hob_lbah, (void *) ioaddr->lbah_addr); + writeb(tf->hob_feature, (void __iomem *) ioaddr->feature_addr); + writeb(tf->hob_nsect, (void __iomem *) ioaddr->nsect_addr); + writeb(tf->hob_lbal, (void __iomem *) ioaddr->lbal_addr); + writeb(tf->hob_lbam, (void __iomem *) ioaddr->lbam_addr); + writeb(tf->hob_lbah, (void __iomem *) ioaddr->lbah_addr); VPRINTK("hob: feat 0x%X nsect 0x%X, lba 0x%X 0x%X 0x%X\n", tf->hob_feature, tf->hob_nsect, @@ -162,11 +162,11 @@ void ata_tf_load_mmio(struct ata_port *ap, struct ata_taskfile *tf) } if (is_addr) { - writeb(tf->feature, (void *) ioaddr->feature_addr); - writeb(tf->nsect, (void *) ioaddr->nsect_addr); - writeb(tf->lbal, (void *) ioaddr->lbal_addr); - writeb(tf->lbam, (void *) ioaddr->lbam_addr); - writeb(tf->lbah, (void *) ioaddr->lbah_addr); + writeb(tf->feature, (void __iomem *) ioaddr->feature_addr); + writeb(tf->nsect, (void __iomem *) ioaddr->nsect_addr); + writeb(tf->lbal, (void __iomem *) ioaddr->lbal_addr); + writeb(tf->lbam, (void __iomem *) ioaddr->lbam_addr); + writeb(tf->lbah, (void __iomem *) ioaddr->lbah_addr); VPRINTK("feat 0x%X nsect 0x%X lba 0x%X 0x%X 0x%X\n", tf->feature, tf->nsect, @@ -176,7 +176,7 @@ void ata_tf_load_mmio(struct ata_port *ap, struct ata_taskfile *tf) } if (tf->flags & ATA_TFLAG_DEVICE) { - writeb(tf->device, (void *) ioaddr->device_addr); + writeb(tf->device, (void __iomem *) ioaddr->device_addr); VPRINTK("device 0x%X\n", tf->device); } @@ -220,7 +220,7 @@ void ata_exec_command_mmio(struct ata_port *ap, struct ata_taskfile *tf) { DPRINTK("ata%u: cmd 0x%X\n", ap->id, tf->command); - writeb(tf->command, (void *) ap->ioaddr.command_addr); + writeb(tf->command, (void __iomem *) ap->ioaddr.command_addr); ata_pause(ap); } @@ -333,19 +333,19 @@ void ata_tf_read_mmio(struct ata_port *ap, struct ata_taskfile *tf) { struct ata_ioports *ioaddr = &ap->ioaddr; - tf->nsect = readb((void *)ioaddr->nsect_addr); - tf->lbal = readb((void *)ioaddr->lbal_addr); - tf->lbam = readb((void *)ioaddr->lbam_addr); - tf->lbah = readb((void *)ioaddr->lbah_addr); - tf->device = readb((void *)ioaddr->device_addr); + tf->nsect = readb((void __iomem *)ioaddr->nsect_addr); + tf->lbal = readb((void __iomem *)ioaddr->lbal_addr); + tf->lbam = readb((void __iomem *)ioaddr->lbam_addr); + tf->lbah = readb((void __iomem *)ioaddr->lbah_addr); + tf->device = readb((void __iomem *)ioaddr->device_addr); if (tf->flags & ATA_TFLAG_LBA48) { - writeb(tf->ctl | ATA_HOB, ap->ioaddr.ctl_addr); - tf->hob_feature = readb((void *)ioaddr->error_addr); - tf->hob_nsect = readb((void *)ioaddr->nsect_addr); - tf->hob_lbal = readb((void *)ioaddr->lbal_addr); - tf->hob_lbam = readb((void *)ioaddr->lbam_addr); - tf->hob_lbah = readb((void *)ioaddr->lbah_addr); + writeb(tf->ctl | ATA_HOB, (void __iomem *) ap->ioaddr.ctl_addr); + tf->hob_feature = readb((void __iomem *)ioaddr->error_addr); + tf->hob_nsect = readb((void __iomem *)ioaddr->nsect_addr); + tf->hob_lbal = readb((void __iomem *)ioaddr->lbal_addr); + tf->hob_lbam = readb((void __iomem *)ioaddr->lbam_addr); + tf->hob_lbah = readb((void __iomem *)ioaddr->lbah_addr); } } @@ -378,7 +378,7 @@ u8 ata_check_status_pio(struct ata_port *ap) */ u8 ata_check_status_mmio(struct ata_port *ap) { - return readb((void *) ap->ioaddr.status_addr); + return readb((void __iomem *) ap->ioaddr.status_addr); } /** @@ -652,17 +652,17 @@ static unsigned int ata_mmio_devchk(struct ata_port *ap, __ata_dev_select(ap, device); - writeb(0x55, (void *) ioaddr->nsect_addr); - writeb(0xaa, (void *) ioaddr->lbal_addr); + writeb(0x55, (void __iomem *) ioaddr->nsect_addr); + writeb(0xaa, (void __iomem *) ioaddr->lbal_addr); - writeb(0xaa, (void *) ioaddr->nsect_addr); - writeb(0x55, (void *) ioaddr->lbal_addr); + writeb(0xaa, (void __iomem *) ioaddr->nsect_addr); + writeb(0x55, (void __iomem *) ioaddr->lbal_addr); - writeb(0x55, (void *) ioaddr->nsect_addr); - writeb(0xaa, (void *) ioaddr->lbal_addr); + writeb(0x55, (void __iomem *) ioaddr->nsect_addr); + writeb(0xaa, (void __iomem *) ioaddr->lbal_addr); - nsect = readb((void *) ioaddr->nsect_addr); - lbal = readb((void *) ioaddr->lbal_addr); + nsect = readb((void __iomem *) ioaddr->nsect_addr); + lbal = readb((void __iomem *) ioaddr->lbal_addr); if ((nsect == 0x55) && (lbal == 0xaa)) return 1; /* we found a device */ @@ -841,7 +841,7 @@ static void __ata_dev_select (struct ata_port *ap, unsigned int device) tmp = ATA_DEVICE_OBS | ATA_DEV1; if (ap->flags & ATA_FLAG_MMIO) { - writeb(tmp, (void *) ap->ioaddr.device_addr); + writeb(tmp, (void __iomem *) ap->ioaddr.device_addr); } else { outb(tmp, ap->ioaddr.device_addr); } @@ -1454,8 +1454,8 @@ static void ata_bus_post_reset(struct ata_port *ap, unsigned int devmask) __ata_dev_select(ap, 1); if (ap->flags & ATA_FLAG_MMIO) { - nsect = readb((void *) ioaddr->nsect_addr); - lbal = readb((void *) ioaddr->lbal_addr); + nsect = readb((void __iomem *) ioaddr->nsect_addr); + lbal = readb((void __iomem *) ioaddr->lbal_addr); } else { nsect = inb(ioaddr->nsect_addr); lbal = inb(ioaddr->lbal_addr); @@ -1519,11 +1519,11 @@ static unsigned int ata_bus_softreset(struct ata_port *ap, /* software reset. causes dev0 to be selected */ if (ap->flags & ATA_FLAG_MMIO) { - writeb(ap->ctl, ioaddr->ctl_addr); + writeb(ap->ctl, (void __iomem *) ioaddr->ctl_addr); udelay(20); /* FIXME: flush */ - writeb(ap->ctl | ATA_SRST, ioaddr->ctl_addr); + writeb(ap->ctl | ATA_SRST, (void __iomem *) ioaddr->ctl_addr); udelay(20); /* FIXME: flush */ - writeb(ap->ctl, ioaddr->ctl_addr); + writeb(ap->ctl, (void __iomem *) ioaddr->ctl_addr); } else { outb(ap->ctl, ioaddr->ctl_addr); udelay(10); @@ -1599,7 +1599,7 @@ void ata_bus_reset(struct ata_port *ap) else if ((ap->flags & ATA_FLAG_SATA_RESET) == 0) { /* set up device control */ if (ap->flags & ATA_FLAG_MMIO) - writeb(ap->ctl, ioaddr->ctl_addr); + writeb(ap->ctl, (void __iomem *) ioaddr->ctl_addr); else outb(ap->ctl, ioaddr->ctl_addr); rc = ata_bus_edd(ap); @@ -1632,7 +1632,7 @@ void ata_bus_reset(struct ata_port *ap) if (ap->flags & (ATA_FLAG_SATA_RESET | ATA_FLAG_SRST)) { /* set up device control for ATA_FLAG_SATA_RESET */ if (ap->flags & ATA_FLAG_MMIO) - writeb(ap->ctl, ioaddr->ctl_addr); + writeb(ap->ctl, (void __iomem *) ioaddr->ctl_addr); else outb(ap->ctl, ioaddr->ctl_addr); } @@ -2081,7 +2081,7 @@ static void ata_mmio_data_xfer(struct ata_port *ap, unsigned char *buf, unsigned int i; unsigned int words = buflen >> 1; u16 *buf16 = (u16 *) buf; - void *mmio = (void *)ap->ioaddr.data_addr; + void __iomem *mmio = (void __iomem *)ap->ioaddr.data_addr; if (write_data) { for (i = 0; i < words; i++) @@ -2618,7 +2618,7 @@ void ata_bmdma_setup_mmio (struct ata_queued_cmd *qc) struct ata_port *ap = qc->ap; unsigned int rw = (qc->tf.flags & ATA_TFLAG_WRITE); u8 dmactl; - void *mmio = (void *) ap->ioaddr.bmdma_addr; + void __iomem *mmio = (void __iomem *) ap->ioaddr.bmdma_addr; /* load PRD table addr. */ mb(); /* make sure PRD table writes are visible to controller */ @@ -2646,7 +2646,7 @@ void ata_bmdma_setup_mmio (struct ata_queued_cmd *qc) void ata_bmdma_start_mmio (struct ata_queued_cmd *qc) { struct ata_port *ap = qc->ap; - void *mmio = (void *) ap->ioaddr.bmdma_addr; + void __iomem *mmio = (void __iomem *) ap->ioaddr.bmdma_addr; u8 dmactl; /* start host DMA transaction */ diff --git a/drivers/serial/8250_pci.c b/drivers/serial/8250_pci.c index 7e7014eaa32f..55c8aa908616 100644 --- a/drivers/serial/8250_pci.c +++ b/drivers/serial/8250_pci.c @@ -83,7 +83,7 @@ struct pci_serial_quirk { struct serial_private { unsigned int nr; - void *remapped_bar[PCI_NUM_BAR_RESOURCES]; + void __iomem *remapped_bar[PCI_NUM_BAR_RESOURCES]; struct pci_serial_quirk *quirk; int line[0]; }; @@ -243,7 +243,8 @@ static int __devinit pci_inteli960ni_init(struct pci_dev *dev) */ static int __devinit pci_plx9050_init(struct pci_dev *dev) { - u8 *p, irq_config; + u8 irq_config; + void __iomem *p; if ((pci_resource_flags(dev, 0) & IORESOURCE_MEM) == 0) { moan_device("no memory in bar 0", dev); @@ -272,12 +273,12 @@ static int __devinit pci_plx9050_init(struct pci_dev *dev) p = ioremap(pci_resource_start(dev, 0), 0x80); if (p == NULL) return -ENOMEM; - writel(irq_config, (unsigned long)p + 0x4c); + writel(irq_config, p + 0x4c); /* * Read the register back to ensure that it took effect. */ - readl((unsigned long)p + 0x4c); + readl(p + 0x4c); iounmap(p); return 0; @@ -397,7 +398,8 @@ static void __devexit sbs_exit(struct pci_dev *dev) static int pci_siig10x_init(struct pci_dev *dev) { - u16 data, *p; + u16 data; + void __iomem *p; switch (dev->device & 0xfff8) { case PCI_DEVICE_ID_SIIG_1S_10x: /* 1S */ @@ -415,8 +417,8 @@ static int pci_siig10x_init(struct pci_dev *dev) if (p == NULL) return -ENOMEM; - writew(readw((unsigned long) p + 0x28) & data, (unsigned long) p + 0x28); - readw((unsigned long)p + 0x28); + writew(readw(p + 0x28) & data, p + 0x28); + readw(p + 0x28); iounmap(p); return 0; } diff --git a/drivers/video/Makefile b/drivers/video/Makefile index bfb4c9d7d2c3..5158995d5a1b 100644 --- a/drivers/video/Makefile +++ b/drivers/video/Makefile @@ -13,7 +13,6 @@ ifeq ($(CONFIG_FB),y) obj-$(CONFIG_PPC) += macmodes.o endif -obj-$(CONFIG_FB_OF) += offb.o cfbfillrect.o cfbimgblt.o cfbcopyarea.o obj-$(CONFIG_FB_ARMCLCD) += amba-clcd.o cfbfillrect.o cfbcopyarea.o cfbimgblt.o obj-$(CONFIG_FB_ACORN) += acornfb.o cfbfillrect.o cfbcopyarea.o cfbimgblt.o obj-$(CONFIG_FB_AMIGA) += amifb.o c2p.o @@ -94,3 +93,4 @@ obj-$(CONFIG_FB_VGA16) += vga16fb.o cfbfillrect.o cfbcopyarea.o \ cfbimgblt.o vgastate.o obj-$(CONFIG_FB_VESA) += vesafb.o cfbfillrect.o cfbcopyarea.o cfbimgblt.o obj-$(CONFIG_FB_VIRTUAL) += vfb.o cfbfillrect.o cfbcopyarea.o cfbimgblt.o +obj-$(CONFIG_FB_OF) += offb.o cfbfillrect.o cfbimgblt.o cfbcopyarea.o diff --git a/drivers/video/aty/radeon_base.c b/drivers/video/aty/radeon_base.c index 54b34963f4f4..f86fbf6de972 100644 --- a/drivers/video/aty/radeon_base.c +++ b/drivers/video/aty/radeon_base.c @@ -282,7 +282,7 @@ static void __devexit radeon_unmap_ROM(struct radeonfb_info *rinfo, struct pci_d static int __devinit radeon_map_ROM(struct radeonfb_info *rinfo, struct pci_dev *dev) { - void *rom; + void __iomem *rom; struct resource *r; u16 dptr; u8 rom_type; @@ -395,13 +395,13 @@ static int __devinit radeon_find_mem_vbios(struct radeonfb_info *rinfo) * if we end up having conflicts */ u32 segstart; - unsigned char *rom_base = NULL; + void __iomem *rom_base = NULL; for(segstart=0x000c0000; segstart<0x000f0000; segstart+=0x00001000) { - rom_base = (char *)ioremap(segstart, 0x10000); + rom_base = ioremap(segstart, 0x10000); if (rom_base == NULL) return -ENOMEM; - if ((*rom_base == 0x55) && (((*(rom_base + 1)) & 0xff) == 0xaa)) + if (readb(rom_base) == 0x55 && readb(rom_base + 1) == 0xaa) break; iounmap(rom_base); rom_base = NULL; @@ -1719,10 +1719,10 @@ static ssize_t radeonfb_read(struct file *file, char __user *buf, size_t count, count = rinfo->mapped_vram - p; radeonfb_sync(info); if (count) { - char *base_addr; + void __iomem *base_addr; base_addr = info->screen_base; - count -= copy_to_user(buf, base_addr+p, count); + count -= copy_to_user(buf, base_addr+p, count); /* Ayee!! */ if (!count) return -EFAULT; *ppos += count; @@ -1751,10 +1751,10 @@ static ssize_t radeonfb_write(struct file *file, const char __user *buf, size_t } radeonfb_sync(info); if (count) { - char *base_addr; + void __iomem *base_addr; base_addr = info->screen_base; - count -= copy_from_user(base_addr+p, buf, count); + count -= copy_from_user(base_addr+p, buf, count); /* Ayee!! */ *ppos += count; err = -EFAULT; } @@ -1795,7 +1795,7 @@ static int __devinit radeon_set_fbinfo (struct radeonfb_info *rinfo) | FBINFO_HWACCEL_XPAN | FBINFO_HWACCEL_YPAN; info->fbops = &radeonfb_ops; - info->screen_base = (char *)rinfo->fb_base; + info->screen_base = rinfo->fb_base; /* Fill fix common fields */ strlcpy(info->fix.id, rinfo->name, sizeof(info->fix.id)); @@ -2117,7 +2117,7 @@ static int radeonfb_pci_register (struct pci_dev *pdev, } /* map the regions */ - rinfo->mmio_base = (unsigned long) ioremap(rinfo->mmio_base_phys, RADEON_REGSIZE); + rinfo->mmio_base = ioremap(rinfo->mmio_base_phys, RADEON_REGSIZE); if (!rinfo->mmio_base) { printk(KERN_ERR "radeonfb: cannot map MMIO\n"); ret = -EIO; @@ -2228,8 +2228,8 @@ static int radeonfb_pci_register (struct pci_dev *pdev, rinfo->mapped_vram = min_t(unsigned long, MAX_MAPPED_VRAM, rinfo->video_ram); do { - rinfo->fb_base = (unsigned long) ioremap (rinfo->fb_base_phys, - rinfo->mapped_vram); + rinfo->fb_base = ioremap (rinfo->fb_base_phys, + rinfo->mapped_vram); } while ( rinfo->fb_base == 0 && ((rinfo->mapped_vram /=2) >= MIN_MAPPED_VRAM) ); @@ -2356,7 +2356,7 @@ static int radeonfb_pci_register (struct pci_dev *pdev, return 0; err_unmap_fb: - iounmap ((void*)rinfo->fb_base); + iounmap(rinfo->fb_base); err_unmap_rom: if (rinfo->mon1_EDID) kfree(rinfo->mon1_EDID); @@ -2370,7 +2370,7 @@ err_unmap_rom: #endif if (rinfo->bios_seg) radeon_unmap_ROM(rinfo, pdev); - iounmap ((void*)rinfo->mmio_base); + iounmap(rinfo->mmio_base); err_release_pci: pci_release_regions(pdev); err_release_fb: @@ -2407,8 +2407,8 @@ static void __devexit radeonfb_pci_unregister (struct pci_dev *pdev) unregister_framebuffer(info); - iounmap ((void*)rinfo->mmio_base); - iounmap ((void*)rinfo->fb_base); + iounmap(rinfo->mmio_base); + iounmap(rinfo->fb_base); pci_release_regions(pdev); diff --git a/drivers/video/aty/radeonfb.h b/drivers/video/aty/radeonfb.h index 87223df80cb0..447eb58411d7 100644 --- a/drivers/video/aty/radeonfb.h +++ b/drivers/video/aty/radeonfb.h @@ -262,14 +262,14 @@ struct radeonfb_info { unsigned long mmio_base_phys; unsigned long fb_base_phys; - unsigned long mmio_base; - unsigned long fb_base; + void __iomem *mmio_base; + void __iomem *fb_base; - unsigned long fb_local_base; + unsigned long fb_local_base; struct pci_dev *pdev; - u8 *bios_seg; + void __iomem *bios_seg; int fp_bios_start; u32 pseudo_palette[17]; diff --git a/fs/adfs/dir_f.c b/fs/adfs/dir_f.c index 7d6a8213cbde..b61648b2d1dd 100644 --- a/fs/adfs/dir_f.c +++ b/fs/adfs/dir_f.c @@ -93,7 +93,7 @@ static inline void adfs_writename(char *to, char *from, int maxlen) #define dir_u32(idx) \ ({ int _buf = idx >> blocksize_bits; \ int _off = idx - (_buf << blocksize_bits);\ - *(u32 *)(bh[_buf]->b_data + _off); \ + *(__le32 *)(bh[_buf]->b_data + _off); \ }) #define bufoff(_bh,_idx) \ @@ -112,7 +112,7 @@ adfs_dir_checkbyte(const struct adfs_dir *dir) { struct buffer_head * const *bh = dir->bh; const int blocksize_bits = dir->sb->s_blocksize_bits; - union { u32 *ptr32; u8 *ptr8; } ptr, end; + union { __le32 *ptr32; u8 *ptr8; } ptr, end; u32 dircheck = 0; int last = 5 - 26; int i = 0; @@ -125,7 +125,7 @@ adfs_dir_checkbyte(const struct adfs_dir *dir) do { last += 26; do { - dircheck = cpu_to_le32(dir_u32(i)) ^ ror13(dircheck); + dircheck = le32_to_cpu(dir_u32(i)) ^ ror13(dircheck); i += sizeof(u32); } while (i < (last & ~3)); @@ -155,8 +155,8 @@ adfs_dir_checkbyte(const struct adfs_dir *dir) end.ptr8 = ptr.ptr8 + 36; do { - unsigned int v = *ptr.ptr32++; - dircheck = cpu_to_le32(v) ^ ror13(dircheck); + __le32 v = *ptr.ptr32++; + dircheck = le32_to_cpu(v) ^ ror13(dircheck); } while (ptr.ptr32 < end.ptr32); return (dircheck ^ (dircheck >> 8) ^ (dircheck >> 16) ^ (dircheck >> 24)) & 0xff; diff --git a/fs/adfs/dir_fplus.h b/fs/adfs/dir_fplus.h index a65f65348d0c..b55aa41a68fe 100644 --- a/fs/adfs/dir_fplus.h +++ b/fs/adfs/dir_fplus.h @@ -18,27 +18,27 @@ struct adfs_bigdirheader { __u8 startmasseq; __u8 bigdirversion[3]; - __u32 bigdirstartname; - __u32 bigdirnamelen; - __u32 bigdirsize; - __u32 bigdirentries; - __u32 bigdirnamesize; - __u32 bigdirparent; + __le32 bigdirstartname; + __le32 bigdirnamelen; + __le32 bigdirsize; + __le32 bigdirentries; + __le32 bigdirnamesize; + __le32 bigdirparent; char bigdirname[1]; }; struct adfs_bigdirentry { - __u32 bigdirload; - __u32 bigdirexec; - __u32 bigdirlen; - __u32 bigdirindaddr; - __u32 bigdirattr; - __u32 bigdirobnamelen; - __u32 bigdirobnameptr; + __le32 bigdirload; + __le32 bigdirexec; + __le32 bigdirlen; + __le32 bigdirindaddr; + __le32 bigdirattr; + __le32 bigdirobnamelen; + __le32 bigdirobnameptr; }; struct adfs_bigdirtail { - __u32 bigdirendname; + __le32 bigdirendname; __u8 bigdirendmasseq; __u8 reserved[2]; __u8 bigdircheckbyte; diff --git a/fs/adfs/map.c b/fs/adfs/map.c index 7c59ca701a36..48c7a31c862a 100644 --- a/fs/adfs/map.c +++ b/fs/adfs/map.c @@ -92,9 +92,8 @@ lookup_zone(const struct adfs_discmap *dm, const unsigned int idlen, * find end of fragment */ { - u32 v, *_map = (u32 *)map; - - v = le32_to_cpu(_map[mapptr >> 5]) >> (mapptr & 31); + __le32 *_map = (__le32 *)map; + u32 v = le32_to_cpu(_map[mapptr >> 5]) >> (mapptr & 31); while (v == 0) { mapptr = (mapptr & ~31) + 32; if (mapptr >= mapsize) @@ -171,9 +170,8 @@ scan_free_map(struct adfs_sb_info *asb, struct adfs_discmap *dm) * find end of fragment */ { - u32 v, *_map = (u32 *)map; - - v = le32_to_cpu(_map[mapptr >> 5]) >> (mapptr & 31); + __le32 *_map = (__le32 *)map; + u32 v = le32_to_cpu(_map[mapptr >> 5]) >> (mapptr & 31); while (v == 0) { mapptr = (mapptr & ~31) + 32; if (mapptr >= mapsize) diff --git a/fs/affs/amigaffs.c b/fs/affs/amigaffs.c index 17a4bfbb1f58..1ad6291679ec 100644 --- a/fs/affs/amigaffs.c +++ b/fs/affs/amigaffs.c @@ -84,7 +84,8 @@ affs_remove_hash(struct inode *dir, struct buffer_head *rem_bh) { struct super_block *sb; struct buffer_head *bh; - u32 rem_ino, hash_ino, ino; + u32 rem_ino, hash_ino; + __be32 ino; int offset, retval; sb = dir->i_sb; @@ -203,9 +204,9 @@ affs_remove_link(struct dentry *dentry) while ((ino = be32_to_cpu(AFFS_TAIL(sb, bh)->link_chain)) != 0) { if (ino == link_ino) { - ino = AFFS_TAIL(sb, link_bh)->link_chain; - AFFS_TAIL(sb, bh)->link_chain = ino; - affs_adjust_checksum(bh, be32_to_cpu(ino) - link_ino); + __be32 ino2 = AFFS_TAIL(sb, link_bh)->link_chain; + AFFS_TAIL(sb, bh)->link_chain = ino2; + affs_adjust_checksum(bh, be32_to_cpu(ino2) - link_ino); mark_buffer_dirty_inode(bh, inode); retval = 0; /* Fix the link count, if bh is a normal header block without links */ @@ -341,12 +342,12 @@ done_unlock: u32 affs_checksum_block(struct super_block *sb, struct buffer_head *bh) { - u32 *ptr = (u32 *)bh->b_data; + __be32 *ptr = (__be32 *)bh->b_data; u32 sum; int bsize; sum = 0; - for (bsize = sb->s_blocksize / sizeof(u32); bsize > 0; bsize--) + for (bsize = sb->s_blocksize / sizeof(__be32); bsize > 0; bsize--) sum += be32_to_cpu(*ptr++); return sum; } @@ -359,9 +360,10 @@ affs_checksum_block(struct super_block *sb, struct buffer_head *bh) void affs_fix_checksum(struct super_block *sb, struct buffer_head *bh) { - int cnt = sb->s_blocksize / sizeof(u32); - u32 *ptr = (u32 *)bh->b_data; - u32 checksum, *checksumptr; + int cnt = sb->s_blocksize / sizeof(__be32); + __be32 *ptr = (__be32 *)bh->b_data; + u32 checksum; + __be32 *checksumptr; checksumptr = ptr + 5; *checksumptr = 0; @@ -384,9 +386,9 @@ secs_to_datestamp(time_t secs, struct affs_date *ds) minute = secs / 60; secs -= minute * 60; - ds->days = be32_to_cpu(days); - ds->mins = be32_to_cpu(minute); - ds->ticks = be32_to_cpu(secs * 50); + ds->days = cpu_to_be32(days); + ds->mins = cpu_to_be32(minute); + ds->ticks = cpu_to_be32(secs * 50); } mode_t diff --git a/fs/affs/bitmap.c b/fs/affs/bitmap.c index 5574bbd3da3a..44e322143e39 100644 --- a/fs/affs/bitmap.c +++ b/fs/affs/bitmap.c @@ -72,7 +72,7 @@ affs_free_block(struct super_block *sb, u32 block) struct affs_bm_info *bm; struct buffer_head *bh; u32 blk, bmap, bit, mask, tmp; - u32 *data; + __be32 *data; pr_debug("AFFS: free_block(%u)\n", block); @@ -97,7 +97,7 @@ affs_free_block(struct super_block *sb, u32 block) } mask = 1 << (bit & 31); - data = (u32 *)bh->b_data + bit / 32 + 1; + data = (__be32 *)bh->b_data + bit / 32 + 1; /* mark block free */ tmp = be32_to_cpu(*data); @@ -106,8 +106,8 @@ affs_free_block(struct super_block *sb, u32 block) *data = cpu_to_be32(tmp | mask); /* fix checksum */ - tmp = be32_to_cpu(*(u32 *)bh->b_data); - *(u32 *)bh->b_data = cpu_to_be32(tmp - mask); + tmp = be32_to_cpu(*(__be32 *)bh->b_data); + *(__be32 *)bh->b_data = cpu_to_be32(tmp - mask); mark_buffer_dirty(bh); sb->s_dirt = 1; @@ -149,7 +149,7 @@ affs_alloc_block(struct inode *inode, u32 goal) struct affs_sb_info *sbi; struct affs_bm_info *bm; struct buffer_head *bh; - u32 *data, *enddata; + __be32 *data, *enddata; u32 blk, bmap, bit, mask, mask2, tmp; int i; @@ -211,8 +211,8 @@ find_bmap_bit: /* find an unused block in this bitmap block */ bit = blk % sbi->s_bmap_bits; - data = (u32 *)bh->b_data + bit / 32 + 1; - enddata = (u32 *)((u8 *)bh->b_data + sb->s_blocksize); + data = (__be32 *)bh->b_data + bit / 32 + 1; + enddata = (__be32 *)((u8 *)bh->b_data + sb->s_blocksize); mask = ~0UL << (bit & 31); blk &= ~31UL; @@ -228,8 +228,8 @@ find_bmap_bit: * if scan didn't start at 0, try next bmap */ goto find_bmap; - } while (!(tmp = *data)); - tmp = be32_to_cpu(tmp); + } while (!*data); + tmp = be32_to_cpu(*data); mask = ~0; find_bit: @@ -251,8 +251,8 @@ find_bit: *data = cpu_to_be32(tmp & ~mask); /* fix checksum */ - tmp = be32_to_cpu(*(u32 *)bh->b_data); - *(u32 *)bh->b_data = cpu_to_be32(tmp + mask); + tmp = be32_to_cpu(*(__be32 *)bh->b_data); + *(__be32 *)bh->b_data = cpu_to_be32(tmp + mask); mark_buffer_dirty(bh); sb->s_dirt = 1; @@ -276,7 +276,7 @@ int affs_init_bitmap(struct super_block *sb, int *flags) { struct affs_bm_info *bm; struct buffer_head *bmap_bh = NULL, *bh = NULL; - u32 *bmap_blk; + __be32 *bmap_blk; u32 size, blk, end, offset, mask; int i, res = 0; struct affs_sb_info *sbi = AFFS_SB(sb); @@ -304,7 +304,7 @@ int affs_init_bitmap(struct super_block *sb, int *flags) } memset(sbi->s_bitmap, 0, size); - bmap_blk = (u32 *)sbi->s_root_bh->b_data; + bmap_blk = (__be32 *)sbi->s_root_bh->b_data; blk = sb->s_blocksize / 4 - 49; end = blk + 25; @@ -340,7 +340,7 @@ int affs_init_bitmap(struct super_block *sb, int *flags) res = -EIO; goto out; } - bmap_blk = (u32 *)bmap_bh->b_data; + bmap_blk = (__be32 *)bmap_bh->b_data; blk = 0; end = sb->s_blocksize / 4 - 1; } @@ -354,23 +354,23 @@ int affs_init_bitmap(struct super_block *sb, int *flags) u32 old, new; /* Mark unused bits in the last word as allocated */ - old = be32_to_cpu(((u32 *)bh->b_data)[offset]); + old = be32_to_cpu(((__be32 *)bh->b_data)[offset]); new = old & mask; //if (old != new) { - ((u32 *)bh->b_data)[offset] = cpu_to_be32(new); + ((__be32 *)bh->b_data)[offset] = cpu_to_be32(new); /* fix checksum */ //new -= old; - //old = be32_to_cpu(*(u32 *)bh->b_data); - //*(u32 *)bh->b_data = cpu_to_be32(old - new); + //old = be32_to_cpu(*(__be32 *)bh->b_data); + //*(__be32 *)bh->b_data = cpu_to_be32(old - new); //mark_buffer_dirty(bh); //} /* correct offset for the bitmap count below */ //offset++; } while (++offset < sb->s_blocksize / 4) - ((u32 *)bh->b_data)[offset] = 0; - ((u32 *)bh->b_data)[0] = 0; - ((u32 *)bh->b_data)[0] = cpu_to_be32(-affs_checksum_block(sb, bh)); + ((__be32 *)bh->b_data)[offset] = 0; + ((__be32 *)bh->b_data)[0] = 0; + ((__be32 *)bh->b_data)[0] = cpu_to_be32(-affs_checksum_block(sb, bh)); mark_buffer_dirty(bh); /* recalculate bitmap count for last block */ diff --git a/fs/affs/inode.c b/fs/affs/inode.c index f94afc028e2c..9f929f70640c 100644 --- a/fs/affs/inode.c +++ b/fs/affs/inode.c @@ -201,7 +201,7 @@ affs_write_inode(struct inode *inode, int unused) return; } tail = AFFS_TAIL(sb, bh); - if (tail->stype == be32_to_cpu(ST_ROOT)) { + if (tail->stype == cpu_to_be32(ST_ROOT)) { secs_to_datestamp(inode->i_mtime.tv_sec,&AFFS_ROOT_TAIL(sb, bh)->root_change); } else { tail->protect = cpu_to_be32(AFFS_I(inode)->i_protect); @@ -396,7 +396,7 @@ affs_add_entry(struct inode *dir, struct inode *inode, struct dentry *dentry, s3 AFFS_TAIL(sb, bh)->parent = cpu_to_be32(dir->i_ino); if (inode_bh) { - u32 chain; + __be32 chain; chain = AFFS_TAIL(sb, inode_bh)->link_chain; AFFS_TAIL(sb, bh)->original = cpu_to_be32(inode->i_ino); AFFS_TAIL(sb, bh)->link_chain = chain; diff --git a/fs/affs/super.c b/fs/affs/super.c index a0358130f498..073e80cbed85 100644 --- a/fs/affs/super.c +++ b/fs/affs/super.c @@ -44,7 +44,7 @@ affs_put_super(struct super_block *sb) pr_debug("AFFS: put_super()\n"); if (!(sb->s_flags & MS_RDONLY)) { - AFFS_ROOT_TAIL(sb, sbi->s_root_bh)->bm_flag = be32_to_cpu(1); + AFFS_ROOT_TAIL(sb, sbi->s_root_bh)->bm_flag = cpu_to_be32(1); secs_to_datestamp(get_seconds(), &AFFS_ROOT_TAIL(sb, sbi->s_root_bh)->disk_change); affs_fix_checksum(sb, sbi->s_root_bh); @@ -70,7 +70,7 @@ affs_write_super(struct super_block *sb) // if (sbi->s_bitmap[i].bm_bh) { // if (buffer_dirty(sbi->s_bitmap[i].bm_bh)) { // clean = 0; - AFFS_ROOT_TAIL(sb, sbi->s_root_bh)->bm_flag = be32_to_cpu(clean); + AFFS_ROOT_TAIL(sb, sbi->s_root_bh)->bm_flag = cpu_to_be32(clean); secs_to_datestamp(get_seconds(), &AFFS_ROOT_TAIL(sb, sbi->s_root_bh)->disk_change); affs_fix_checksum(sb, sbi->s_root_bh); @@ -387,7 +387,7 @@ got_root: printk(KERN_ERR "AFFS: Cannot read boot block\n"); goto out_error; } - chksum = be32_to_cpu(*(u32 *)boot_bh->b_data); + chksum = be32_to_cpu(*(__be32 *)boot_bh->b_data); brelse(boot_bh); /* Dircache filesystems are compatible with non-dircache ones diff --git a/fs/buffer.c b/fs/buffer.c index 3233a6ec387d..81f31297b81e 100644 --- a/fs/buffer.c +++ b/fs/buffer.c @@ -895,9 +895,8 @@ void mark_buffer_dirty_inode(struct buffer_head *bh, struct inode *inode) spin_lock(&buffer_mapping->private_lock); list_move_tail(&bh->b_assoc_buffers, &mapping->private_list); - spin_lock(&buffer_mapping->private_lock); -} - + spin_unlock(&buffer_mapping->private_lock); + } } EXPORT_SYMBOL(mark_buffer_dirty_inode); diff --git a/fs/ext2/acl.h b/fs/ext2/acl.h index 01937daf1168..b0a1c4b38be7 100644 --- a/fs/ext2/acl.h +++ b/fs/ext2/acl.h @@ -10,18 +10,18 @@ #define EXT2_ACL_MAX_ENTRIES 32 typedef struct { - __u16 e_tag; - __u16 e_perm; - __u32 e_id; + __le16 e_tag; + __le16 e_perm; + __le32 e_id; } ext2_acl_entry; typedef struct { - __u16 e_tag; - __u16 e_perm; + __le16 e_tag; + __le16 e_perm; } ext2_acl_entry_short; typedef struct { - __u32 a_version; + __le32 a_version; } ext2_acl_header; static inline size_t ext2_acl_size(int count) diff --git a/fs/ext2/ext2.h b/fs/ext2/ext2.h index bfabd0b3c56f..9d8770e8af0f 100644 --- a/fs/ext2/ext2.h +++ b/fs/ext2/ext2.h @@ -5,7 +5,7 @@ * second extended file system inode data in memory */ struct ext2_inode_info { - __u32 i_data[15]; + __le32 i_data[15]; __u32 i_flags; __u32 i_faddr; __u8 i_frag_no; diff --git a/fs/ext2/inode.c b/fs/ext2/inode.c index 694e6ee40690..a77e96a1a00f 100644 --- a/fs/ext2/inode.c +++ b/fs/ext2/inode.c @@ -142,12 +142,12 @@ static int ext2_alloc_block (struct inode * inode, unsigned long goal, int *err) } typedef struct { - u32 *p; - u32 key; + __le32 *p; + __le32 key; struct buffer_head *bh; } Indirect; -static inline void add_chain(Indirect *p, struct buffer_head *bh, u32 *v) +static inline void add_chain(Indirect *p, struct buffer_head *bh, __le32 *v) { p->key = *(p->p = v); p->bh = bh; @@ -280,7 +280,7 @@ static Indirect *ext2_get_branch(struct inode *inode, read_lock(&EXT2_I(inode)->i_meta_lock); if (!verify_chain(chain, p)) goto changed; - add_chain(++p, bh, (u32*)bh->b_data + *++offsets); + add_chain(++p, bh, (__le32*)bh->b_data + *++offsets); read_unlock(&EXT2_I(inode)->i_meta_lock); if (!p->key) goto no_block; @@ -321,8 +321,8 @@ no_block: static unsigned long ext2_find_near(struct inode *inode, Indirect *ind) { struct ext2_inode_info *ei = EXT2_I(inode); - u32 *start = ind->bh ? (u32*) ind->bh->b_data : ei->i_data; - u32 *p; + __le32 *start = ind->bh ? (__le32 *) ind->bh->b_data : ei->i_data; + __le32 *p; unsigned long bg_start; unsigned long colour; @@ -440,7 +440,7 @@ static int ext2_alloc_branch(struct inode *inode, lock_buffer(bh); memset(bh->b_data, 0, blocksize); branch[n].bh = bh; - branch[n].p = (u32*) bh->b_data + offsets[n]; + branch[n].p = (__le32 *) bh->b_data + offsets[n]; *branch[n].p = branch[n].key; set_buffer_uptodate(bh); unlock_buffer(bh); @@ -702,7 +702,7 @@ struct address_space_operations ext2_nobh_aops = { * or memcmp with zero_page, whatever is better for particular architecture. * Linus? */ -static inline int all_zeroes(u32 *p, u32 *q) +static inline int all_zeroes(__le32 *p, __le32 *q) { while (p < q) if (*p++) @@ -748,7 +748,7 @@ static Indirect *ext2_find_shared(struct inode *inode, int depth, int offsets[4], Indirect chain[4], - u32 *top) + __le32 *top) { Indirect *partial, *p; int k, err; @@ -768,7 +768,7 @@ static Indirect *ext2_find_shared(struct inode *inode, write_unlock(&EXT2_I(inode)->i_meta_lock); goto no_top; } - for (p=partial; p>chain && all_zeroes((u32*)p->bh->b_data,p->p); p--) + for (p=partial; p>chain && all_zeroes((__le32*)p->bh->b_data,p->p); p--) ; /* * OK, we've found the last block that must survive. The rest of our @@ -803,7 +803,7 @@ no_top: * stored as little-endian 32-bit) and updating @inode->i_blocks * appropriately. */ -static inline void ext2_free_data(struct inode *inode, u32 *p, u32 *q) +static inline void ext2_free_data(struct inode *inode, __le32 *p, __le32 *q) { unsigned long block_to_free = 0, count = 0; unsigned long nr; @@ -843,7 +843,7 @@ static inline void ext2_free_data(struct inode *inode, u32 *p, u32 *q) * stored as little-endian 32-bit) and updating @inode->i_blocks * appropriately. */ -static void ext2_free_branches(struct inode *inode, u32 *p, u32 *q, int depth) +static void ext2_free_branches(struct inode *inode, __le32 *p, __le32 *q, int depth) { struct buffer_head * bh; unsigned long nr; @@ -867,8 +867,8 @@ static void ext2_free_branches(struct inode *inode, u32 *p, u32 *q, int depth) continue; } ext2_free_branches(inode, - (u32*)bh->b_data, - (u32*)bh->b_data + addr_per_block, + (__le32*)bh->b_data, + (__le32*)bh->b_data + addr_per_block, depth); bforget(bh); ext2_free_blocks(inode, nr, 1); @@ -880,12 +880,12 @@ static void ext2_free_branches(struct inode *inode, u32 *p, u32 *q, int depth) void ext2_truncate (struct inode * inode) { - u32 *i_data = EXT2_I(inode)->i_data; + __le32 *i_data = EXT2_I(inode)->i_data; int addr_per_block = EXT2_ADDR_PER_BLOCK(inode->i_sb); int offsets[4]; Indirect chain[4]; Indirect *partial; - int nr = 0; + __le32 nr = 0; int n; long iblock; unsigned blocksize; @@ -933,7 +933,7 @@ void ext2_truncate (struct inode * inode) while (partial > chain) { ext2_free_branches(inode, partial->p + 1, - (u32*)partial->bh->b_data + addr_per_block, + (__le32*)partial->bh->b_data+addr_per_block, (chain+n-1) - partial); mark_buffer_dirty_inode(partial->bh, inode); brelse (partial->bh); diff --git a/fs/ext2/super.c b/fs/ext2/super.c index 582fd490f715..ad3face04fe4 100644 --- a/fs/ext2/super.c +++ b/fs/ext2/super.c @@ -113,7 +113,7 @@ static void ext2_put_super (struct super_block * sb) if (!(sb->s_flags & MS_RDONLY)) { struct ext2_super_block *es = sbi->s_es; - es->s_state = le16_to_cpu(sbi->s_mount_state); + es->s_state = cpu_to_le16(sbi->s_mount_state); ext2_sync_super(sb, es); } db_count = sbi->s_gdb_count; @@ -428,8 +428,8 @@ static int ext2_setup_super (struct super_block * sb, (le32_to_cpu(es->s_lastcheck) + le32_to_cpu(es->s_checkinterval) <= get_seconds())) printk ("EXT2-fs warning: checktime reached, " "running e2fsck is recommended\n"); - if (!(__s16) le16_to_cpu(es->s_max_mnt_count)) - es->s_max_mnt_count = (__s16) cpu_to_le16(EXT2_DFL_MAX_MNT_COUNT); + if (!le16_to_cpu(es->s_max_mnt_count)) + es->s_max_mnt_count = cpu_to_le16(EXT2_DFL_MAX_MNT_COUNT); es->s_mnt_count=cpu_to_le16(le16_to_cpu(es->s_mnt_count) + 1); ext2_write_super(sb); if (test_opt (sb, DEBUG)) @@ -551,7 +551,7 @@ static int ext2_fill_super(struct super_block *sb, void *data, int silent) int blocksize = BLOCK_SIZE; int db_count; int i, j; - __u32 features; + __le32 features; sbi = kmalloc(sizeof(*sbi), GFP_KERNEL); if (!sbi) @@ -675,7 +675,7 @@ static int ext2_fill_super(struct super_block *sb, void *data, int silent) } es = (struct ext2_super_block *) (((char *)bh->b_data) + offset); sbi->s_es = es; - if (es->s_magic != le16_to_cpu(EXT2_SUPER_MAGIC)) { + if (es->s_magic != cpu_to_le16(EXT2_SUPER_MAGIC)) { printk ("EXT2-fs: Magic mismatch, very weird !\n"); goto failed_mount; } @@ -918,7 +918,7 @@ static int ext2_remount (struct super_block * sb, int * flags, char * data) es->s_state = cpu_to_le16(sbi->s_mount_state); es->s_mtime = cpu_to_le32(get_seconds()); } else { - __u32 ret = EXT2_HAS_RO_COMPAT_FEATURE(sb, + __le32 ret = EXT2_HAS_RO_COMPAT_FEATURE(sb, ~EXT2_FEATURE_RO_COMPAT_SUPP); if (ret) { printk("EXT2-fs: %s: couldn't remount RDWR because of " diff --git a/fs/ext2/xattr.c b/fs/ext2/xattr.c index 85ee4e8bee0e..c8642719c170 100644 --- a/fs/ext2/xattr.c +++ b/fs/ext2/xattr.c @@ -1071,7 +1071,7 @@ static inline void ext2_xattr_hash_entry(struct ext2_xattr_header *header, } if (entry->e_value_block == 0 && entry->e_value_size != 0) { - __u32 *value = (__u32 *)((char *)header + + __le32 *value = (__le32 *)((char *)header + le16_to_cpu(entry->e_value_offs)); for (n = (le32_to_cpu(entry->e_value_size) + EXT2_XATTR_ROUND) >> EXT2_XATTR_PAD_BITS; n; n--) { diff --git a/fs/ext2/xattr.h b/fs/ext2/xattr.h index a113ead4adf9..6268bcdaf753 100644 --- a/fs/ext2/xattr.h +++ b/fs/ext2/xattr.h @@ -26,20 +26,20 @@ #define EXT2_XATTR_INDEX_SECURITY 6 struct ext2_xattr_header { - __u32 h_magic; /* magic number for identification */ - __u32 h_refcount; /* reference count */ - __u32 h_blocks; /* number of disk blocks used */ - __u32 h_hash; /* hash value of all attributes */ + __le32 h_magic; /* magic number for identification */ + __le32 h_refcount; /* reference count */ + __le32 h_blocks; /* number of disk blocks used */ + __le32 h_hash; /* hash value of all attributes */ __u32 h_reserved[4]; /* zero right now */ }; struct ext2_xattr_entry { __u8 e_name_len; /* length of name */ __u8 e_name_index; /* attribute name index */ - __u16 e_value_offs; /* offset in disk block of value */ - __u32 e_value_block; /* disk block attribute is stored on (n/i) */ - __u32 e_value_size; /* size of attribute value */ - __u32 e_hash; /* hash value of name and value */ + __le16 e_value_offs; /* offset in disk block of value */ + __le32 e_value_block; /* disk block attribute is stored on (n/i) */ + __le32 e_value_size; /* size of attribute value */ + __le32 e_hash; /* hash value of name and value */ char e_name[0]; /* attribute name */ }; diff --git a/fs/udf/balloc.c b/fs/udf/balloc.c index 8f7d9eff554b..448a8983294b 100644 --- a/fs/udf/balloc.c +++ b/fs/udf/balloc.c @@ -44,7 +44,7 @@ #define xleNUM_to_cpup(x,y) (le ## x ## _to_cpup(y)) #define uintBPL_t uint(BITS_PER_LONG) #define uint(x) xuint(x) -#define xuint(x) uint ## x ## _t +#define xuint(x) __le ## x extern inline int find_next_one_bit (void * addr, int size, int offset) { @@ -91,7 +91,7 @@ static int read_block_bitmap(struct super_block * sb, { struct buffer_head *bh = NULL; int retval = 0; - lb_addr loc; + kernel_lb_addr loc; loc.logicalBlockNum = bitmap->s_extPosition; loc.partitionReferenceNum = UDF_SB_PARTITION(sb); @@ -145,7 +145,8 @@ static inline int load_block_bitmap(struct super_block * sb, static void udf_bitmap_free_blocks(struct super_block * sb, struct inode * inode, - struct udf_bitmap *bitmap, lb_addr bloc, uint32_t offset, uint32_t count) + struct udf_bitmap *bitmap, + kernel_lb_addr bloc, uint32_t offset, uint32_t count) { struct buffer_head * bh = NULL; unsigned long block; @@ -424,11 +425,12 @@ error_return: static void udf_table_free_blocks(struct super_block * sb, struct inode * inode, - struct inode * table, lb_addr bloc, uint32_t offset, uint32_t count) + struct inode * table, + kernel_lb_addr bloc, uint32_t offset, uint32_t count) { uint32_t start, end; uint32_t nextoffset, oextoffset, elen; - lb_addr nbloc, obloc, eloc; + kernel_lb_addr nbloc, obloc, eloc; struct buffer_head *obh, *nbh; int8_t etype; int i; @@ -678,7 +680,7 @@ static int udf_table_prealloc_blocks(struct super_block * sb, { int alloc_count = 0; uint32_t extoffset, elen, adsize; - lb_addr bloc, eloc; + kernel_lb_addr bloc, eloc; struct buffer_head *bh; int8_t etype = -1; @@ -748,7 +750,7 @@ static int udf_table_new_block(struct super_block * sb, uint32_t spread = 0xFFFFFFFF, nspread = 0xFFFFFFFF; uint32_t newblock = 0, adsize; uint32_t extoffset, goal_extoffset, elen, goal_elen = 0; - lb_addr bloc, goal_bloc, eloc, goal_eloc; + kernel_lb_addr bloc, goal_bloc, eloc, goal_eloc; struct buffer_head *bh, *goal_bh; int8_t etype; @@ -854,7 +856,7 @@ static int udf_table_new_block(struct super_block * sb, inline void udf_free_blocks(struct super_block * sb, struct inode * inode, - lb_addr bloc, uint32_t offset, uint32_t count) + kernel_lb_addr bloc, uint32_t offset, uint32_t count) { uint16_t partition = bloc.partitionReferenceNum; diff --git a/fs/udf/dir.c b/fs/udf/dir.c index 33228f1493cf..82440b731142 100644 --- a/fs/udf/dir.c +++ b/fs/udf/dir.c @@ -117,7 +117,7 @@ do_udf_readdir(struct inode * dir, struct file *filp, filldir_t filldir, void *d uint8_t lfi; loff_t size = (udf_ext0_offset(dir) + dir->i_size) >> 2; struct buffer_head * bh = NULL, * tmp, * bha[16]; - lb_addr bloc, eloc; + kernel_lb_addr bloc, eloc; uint32_t extoffset, elen, offset; int i, num; unsigned int dt_type; @@ -237,7 +237,7 @@ do_udf_readdir(struct inode * dir, struct file *filp, filldir_t filldir, void *d } else { - lb_addr tloc = lelb_to_cpu(cfi.icb.extLocation); + kernel_lb_addr tloc = lelb_to_cpu(cfi.icb.extLocation); iblock = udf_get_lb_pblock(dir->i_sb, tloc, 0); flen = udf_get_filename(dir->i_sb, nameptr, fname, lfi); diff --git a/fs/udf/directory.c b/fs/udf/directory.c index 1f967a033ed9..9a61ecc5451b 100644 --- a/fs/udf/directory.c +++ b/fs/udf/directory.c @@ -26,7 +26,7 @@ #if 0 static uint8_t * udf_filead_read(struct inode *dir, uint8_t *tmpad, uint8_t ad_size, - lb_addr fe_loc, int *pos, int *offset, + kernel_lb_addr fe_loc, int *pos, int *offset, struct buffer_head **bh, int *error) { int loffset = *offset; @@ -80,8 +80,8 @@ struct fileIdentDesc * udf_fileident_read(struct inode *dir, loff_t *nf_pos, struct udf_fileident_bh *fibh, struct fileIdentDesc *cfi, - lb_addr *bloc, uint32_t *extoffset, - lb_addr *eloc, uint32_t *elen, + kernel_lb_addr *bloc, uint32_t *extoffset, + kernel_lb_addr *eloc, uint32_t *elen, uint32_t *offset, struct buffer_head **bh) { struct fileIdentDesc *fi; diff --git a/fs/udf/ecma_167.h b/fs/udf/ecma_167.h index 9132ff515a18..f81f2ebbf508 100644 --- a/fs/udf/ecma_167.h +++ b/fs/udf/ecma_167.h @@ -60,6 +60,20 @@ typedef uint8_t dstring; /* Timestamp (ECMA 167r3 1/7.3) */ typedef struct { + __le16 typeAndTimezone; + __le16 year; + uint8_t month; + uint8_t day; + uint8_t hour; + uint8_t minute; + uint8_t second; + uint8_t centiseconds; + uint8_t hundredsOfMicroseconds; + uint8_t microseconds; +} __attribute__ ((packed)) timestamp; + +typedef struct +{ uint16_t typeAndTimezone; int16_t year; uint8_t month; @@ -70,7 +84,7 @@ typedef struct uint8_t centiseconds; uint8_t hundredsOfMicroseconds; uint8_t microseconds; -} __attribute__ ((packed)) timestamp; +} __attribute__ ((packed)) kernel_timestamp; /* Type and Time Zone (ECMA 167r3 1/7.3.1) */ #define TIMESTAMP_TYPE_MASK 0xF000 @@ -139,12 +153,12 @@ struct bootDesc uint8_t reserved1; regid archType; regid bootIdent; - uint32_t bootExtLocation; - uint32_t bootExtLength; - uint64_t loadAddress; - uint64_t startAddress; + __le32 bootExtLocation; + __le32 bootExtLength; + __le64 loadAddress; + __le64 startAddress; timestamp descCreationDateAndTime; - uint16_t flags; + __le16 flags; uint8_t reserved2[32]; uint8_t bootUse[1906]; } __attribute__ ((packed)); @@ -155,21 +169,27 @@ struct bootDesc /* Extent Descriptor (ECMA 167r3 3/7.1) */ typedef struct { + __le32 extLength; + __le32 extLocation; +} __attribute__ ((packed)) extent_ad; + +typedef struct +{ uint32_t extLength; uint32_t extLocation; -} __attribute__ ((packed)) extent_ad; +} kernel_extent_ad; /* Descriptor Tag (ECMA 167r3 3/7.2) */ typedef struct { - uint16_t tagIdent; - uint16_t descVersion; + __le16 tagIdent; + __le16 descVersion; uint8_t tagChecksum; uint8_t reserved; - uint16_t tagSerialNum; - uint16_t descCRC; - uint16_t descCRCLength; - uint32_t tagLocation; + __le16 tagSerialNum; + __le16 descCRC; + __le16 descCRCLength; + __le32 tagLocation; } __attribute__ ((packed)) tag; /* Tag Identifier (ECMA 167r3 3/7.2.1) */ @@ -197,15 +217,15 @@ struct NSRDesc struct primaryVolDesc { tag descTag; - uint32_t volDescSeqNum; - uint32_t primaryVolDescNum; + __le32 volDescSeqNum; + __le32 primaryVolDescNum; dstring volIdent[32]; - uint16_t volSeqNum; - uint16_t maxVolSeqNum; - uint16_t interchangeLvl; - uint16_t maxInterchangeLvl; - uint32_t charSetList; - uint32_t maxCharSetList; + __le16 volSeqNum; + __le16 maxVolSeqNum; + __le16 interchangeLvl; + __le16 maxInterchangeLvl; + __le32 charSetList; + __le32 maxCharSetList; dstring volSetIdent[128]; charspec descCharSet; charspec explanatoryCharSet; @@ -215,8 +235,8 @@ struct primaryVolDesc timestamp recordingDateAndTime; regid impIdent; uint8_t impUse[64]; - uint32_t predecessorVolDescSeqLocation; - uint16_t flags; + __le32 predecessorVolDescSeqLocation; + __le16 flags; uint8_t reserved[22]; } __attribute__ ((packed)); @@ -236,7 +256,7 @@ struct anchorVolDescPtr struct volDescPtr { tag descTag; - uint32_t volDescSeqNum; + __le32 volDescSeqNum; extent_ad nextVolDescSeqExt; uint8_t reserved[484]; } __attribute__ ((packed)); @@ -245,7 +265,7 @@ struct volDescPtr struct impUseVolDesc { tag descTag; - uint32_t volDescSeqNum; + __le32 volDescSeqNum; regid impIdent; uint8_t impUse[460]; } __attribute__ ((packed)); @@ -254,14 +274,14 @@ struct impUseVolDesc struct partitionDesc { tag descTag; - uint32_t volDescSeqNum; - uint16_t partitionFlags; - uint16_t partitionNumber; + __le32 volDescSeqNum; + __le16 partitionFlags; + __le16 partitionNumber; regid partitionContents; uint8_t partitionContentsUse[128]; - uint32_t accessType; - uint32_t partitionStartingLocation; - uint32_t partitionLength; + __le32 accessType; + __le32 partitionStartingLocation; + __le32 partitionLength; regid impIdent; uint8_t impUse[128]; uint8_t reserved[156]; @@ -290,14 +310,14 @@ struct partitionDesc struct logicalVolDesc { tag descTag; - uint32_t volDescSeqNum; + __le32 volDescSeqNum; charspec descCharSet; dstring logicalVolIdent[128]; - uint32_t logicalBlockSize; + __le32 logicalBlockSize; regid domainIdent; uint8_t logicalVolContentsUse[16]; - uint32_t mapTableLength; - uint32_t numPartitionMaps; + __le32 mapTableLength; + __le32 numPartitionMaps; regid impIdent; uint8_t impUse[128]; extent_ad integritySeqExt; @@ -322,8 +342,8 @@ struct genericPartitionMap1 { uint8_t partitionMapType; uint8_t partitionMapLength; - uint16_t volSeqNum; - uint16_t partitionNum; + __le16 volSeqNum; + __le16 partitionNum; } __attribute__ ((packed)); /* Type 2 Partition Map (ECMA 167r3 3/10.7.3) */ @@ -338,8 +358,8 @@ struct genericPartitionMap2 struct unallocSpaceDesc { tag descTag; - uint32_t volDescSeqNum; - uint32_t numAllocDescs; + __le32 volDescSeqNum; + __le32 numAllocDescs; extent_ad allocDescs[0]; } __attribute__ ((packed)); @@ -355,13 +375,13 @@ struct logicalVolIntegrityDesc { tag descTag; timestamp recordingDateAndTime; - uint32_t integrityType; + __le32 integrityType; extent_ad nextIntegrityExt; uint8_t logicalVolContentsUse[32]; - uint32_t numOfPartitions; - uint32_t lengthOfImpUse; - uint32_t freeSpaceTable[0]; - uint32_t sizeTable[0]; + __le32 numOfPartitions; + __le32 lengthOfImpUse; + __le32 freeSpaceTable[0]; + __le32 sizeTable[0]; uint8_t impUse[0]; } __attribute__ ((packed)); @@ -372,33 +392,55 @@ struct logicalVolIntegrityDesc /* Recorded Address (ECMA 167r3 4/7.1) */ typedef struct { - uint32_t logicalBlockNum; - uint16_t partitionReferenceNum; + __le32 logicalBlockNum; + __le16 partitionReferenceNum; } __attribute__ ((packed)) lb_addr; +/* ... and its in-core analog */ +typedef struct +{ + uint32_t logicalBlockNum; + uint16_t partitionReferenceNum; +} kernel_lb_addr; + /* Short Allocation Descriptor (ECMA 167r3 4/14.14.1) */ typedef struct { - uint32_t extLength; - uint32_t extPosition; + __le32 extLength; + __le32 extPosition; } __attribute__ ((packed)) short_ad; /* Long Allocation Descriptor (ECMA 167r3 4/14.14.2) */ typedef struct { - uint32_t extLength; + __le32 extLength; lb_addr extLocation; uint8_t impUse[6]; } __attribute__ ((packed)) long_ad; +typedef struct +{ + uint32_t extLength; + kernel_lb_addr extLocation; + uint8_t impUse[6]; +} kernel_long_ad; + /* Extended Allocation Descriptor (ECMA 167r3 4/14.14.3) */ typedef struct { + __le32 extLength; + __le32 recordedLength; + __le32 informationLength; + lb_addr extLocation; +} __attribute__ ((packed)) ext_ad; + +typedef struct +{ uint32_t extLength; uint32_t recordedLength; uint32_t informationLength; - lb_addr extLocation; -} __attribute__ ((packed)) ext_ad; + kernel_lb_addr extLocation; +} kernel_ext_ad; /* Descriptor Tag (ECMA 167r3 4/7.2 - See 3/7.2) */ @@ -420,12 +462,12 @@ struct fileSetDesc { tag descTag; timestamp recordingDateAndTime; - uint16_t interchangeLvl; - uint16_t maxInterchangeLvl; - uint32_t charSetList; - uint32_t maxCharSetList; - uint32_t fileSetNum; - uint32_t fileSetDescNum; + __le16 interchangeLvl; + __le16 maxInterchangeLvl; + __le32 charSetList; + __le32 maxCharSetList; + __le32 fileSetNum; + __le32 fileSetDescNum; charspec logicalVolIdentCharSet; dstring logicalVolIdent[128]; charspec fileSetCharSet; @@ -454,11 +496,11 @@ struct partitionHeaderDesc struct fileIdentDesc { tag descTag; - uint16_t fileVersionNum; + __le16 fileVersionNum; uint8_t fileCharacteristics; uint8_t lengthFileIdent; long_ad icb; - uint16_t lengthOfImpUse; + __le16 lengthOfImpUse; uint8_t impUse[0]; uint8_t fileIdent[0]; uint8_t padding[0]; @@ -475,21 +517,21 @@ struct fileIdentDesc struct allocExtDesc { tag descTag; - uint32_t previousAllocExtLocation; - uint32_t lengthAllocDescs; + __le32 previousAllocExtLocation; + __le32 lengthAllocDescs; } __attribute__ ((packed)); /* ICB Tag (ECMA 167r3 4/14.6) */ typedef struct { - uint32_t priorRecordedNumDirectEntries; - uint16_t strategyType; - uint16_t strategyParameter; - uint16_t numEntries; + __le32 priorRecordedNumDirectEntries; + __le16 strategyType; + __le16 strategyParameter; + __le16 numEntries; uint8_t reserved; uint8_t fileType; lb_addr parentICBLocation; - uint16_t flags; + __le16 flags; } __attribute__ ((packed)) icbtag; /* Strategy Type (ECMA 167r3 4/14.6.2) */ @@ -553,24 +595,24 @@ struct fileEntry { tag descTag; icbtag icbTag; - uint32_t uid; - uint32_t gid; - uint32_t permissions; - uint16_t fileLinkCount; + __le32 uid; + __le32 gid; + __le32 permissions; + __le16 fileLinkCount; uint8_t recordFormat; uint8_t recordDisplayAttr; - uint32_t recordLength; - uint64_t informationLength; - uint64_t logicalBlocksRecorded; + __le32 recordLength; + __le64 informationLength; + __le64 logicalBlocksRecorded; timestamp accessTime; timestamp modificationTime; timestamp attrTime; - uint32_t checkpoint; + __le32 checkpoint; long_ad extendedAttrICB; regid impIdent; - uint64_t uniqueID; - uint32_t lengthExtendedAttr; - uint32_t lengthAllocDescs; + __le64 uniqueID; + __le32 lengthExtendedAttr; + __le32 lengthAllocDescs; uint8_t extendedAttr[0]; uint8_t allocDescs[0]; } __attribute__ ((packed)); @@ -616,28 +658,28 @@ struct fileEntry struct extendedAttrHeaderDesc { tag descTag; - uint32_t impAttrLocation; - uint32_t appAttrLocation; + __le32 impAttrLocation; + __le32 appAttrLocation; } __attribute__ ((packed)); /* Generic Format (ECMA 167r3 4/14.10.2) */ struct genericFormat { - uint32_t attrType; + __le32 attrType; uint8_t attrSubtype; uint8_t reserved[3]; - uint32_t attrLength; + __le32 attrLength; uint8_t attrData[0]; } __attribute__ ((packed)); /* Character Set Information (ECMA 167r3 4/14.10.3) */ struct charSetInfo { - uint32_t attrType; + __le32 attrType; uint8_t attrSubtype; uint8_t reserved[3]; - uint32_t attrLength; - uint32_t escapeSeqLength; + __le32 attrLength; + __le32 escapeSeqLength; uint8_t charSetType; uint8_t escapeSeq[0]; } __attribute__ ((packed)); @@ -645,24 +687,24 @@ struct charSetInfo /* Alternate Permissions (ECMA 167r3 4/14.10.4) */ struct altPerms { - uint32_t attrType; + __le32 attrType; uint8_t attrSubtype; uint8_t reserved[3]; - uint32_t attrLength; - uint16_t ownerIdent; - uint16_t groupIdent; - uint16_t permission; + __le32 attrLength; + __le16 ownerIdent; + __le16 groupIdent; + __le16 permission; } __attribute__ ((packed)); /* File Times Extended Attribute (ECMA 167r3 4/14.10.5) */ struct fileTimesExtAttr { - uint32_t attrType; + __le32 attrType; uint8_t attrSubtype; uint8_t reserved[3]; - uint32_t attrLength; - uint32_t dataLength; - uint32_t fileTimeExistence; + __le32 attrLength; + __le32 dataLength; + __le32 fileTimeExistence; uint8_t fileTimes; } __attribute__ ((packed)); @@ -675,36 +717,36 @@ struct fileTimesExtAttr /* Information Times Extended Attribute (ECMA 167r3 4/14.10.6) */ struct infoTimesExtAttr { - uint32_t attrType; + __le32 attrType; uint8_t attrSubtype; uint8_t reserved[3]; - uint32_t attrLength; - uint32_t dataLength; - uint32_t infoTimeExistence; + __le32 attrLength; + __le32 dataLength; + __le32 infoTimeExistence; uint8_t infoTimes[0]; } __attribute__ ((packed)); /* Device Specification (ECMA 167r3 4/14.10.7) */ struct deviceSpec { - uint32_t attrType; + __le32 attrType; uint8_t attrSubtype; uint8_t reserved[3]; - uint32_t attrLength; - uint32_t impUseLength; - uint32_t majorDeviceIdent; - uint32_t minorDeviceIdent; + __le32 attrLength; + __le32 impUseLength; + __le32 majorDeviceIdent; + __le32 minorDeviceIdent; uint8_t impUse[0]; } __attribute__ ((packed)); /* Implementation Use Extended Attr (ECMA 167r3 4/14.10.8) */ struct impUseExtAttr { - uint32_t attrType; + __le32 attrType; uint8_t attrSubtype; uint8_t reserved[3]; - uint32_t attrLength; - uint32_t impUseLength; + __le32 attrLength; + __le32 impUseLength; regid impIdent; uint8_t impUse[0]; } __attribute__ ((packed)); @@ -712,11 +754,11 @@ struct impUseExtAttr /* Application Use Extended Attribute (ECMA 167r3 4/14.10.9) */ struct appUseExtAttr { - uint32_t attrType; + __le32 attrType; uint8_t attrSubtype; uint8_t reserved[3]; - uint32_t attrLength; - uint32_t appUseLength; + __le32 attrLength; + __le32 appUseLength; regid appIdent; uint8_t appUse[0]; } __attribute__ ((packed)); @@ -735,7 +777,7 @@ struct unallocSpaceEntry { tag descTag; icbtag icbTag; - uint32_t lengthAllocDescs; + __le32 lengthAllocDescs; uint8_t allocDescs[0]; } __attribute__ ((packed)); @@ -743,8 +785,8 @@ struct unallocSpaceEntry struct spaceBitmapDesc { tag descTag; - uint32_t numOfBits; - uint32_t numOfBytes; + __le32 numOfBits; + __le32 numOfBytes; uint8_t bitmap[0]; } __attribute__ ((packed)); @@ -775,7 +817,7 @@ struct partitionIntegrityEntry /* Logical Volume Header Descriptor (ECMA 167r3 4/14.15) */ struct logicalVolHeaderDesc { - uint64_t uniqueID; + __le64 uniqueID; uint8_t reserved[24]; } __attribute__ ((packed)); @@ -784,7 +826,7 @@ struct pathComponent { uint8_t componentType; uint8_t lengthComponentIdent; - uint16_t componentFileVersionNum; + __le16 componentFileVersionNum; dstring componentIdent[0]; } __attribute__ ((packed)); @@ -793,28 +835,28 @@ struct extendedFileEntry { tag descTag; icbtag icbTag; - uint32_t uid; - uint32_t gid; - uint32_t permissions; - uint16_t fileLinkCount; + __le32 uid; + __le32 gid; + __le32 permissions; + __le16 fileLinkCount; uint8_t recordFormat; uint8_t recordDisplayAttr; - uint32_t recordLength; - uint64_t informationLength; - uint64_t objectSize; - uint64_t logicalBlocksRecorded; + __le32 recordLength; + __le64 informationLength; + __le64 objectSize; + __le64 logicalBlocksRecorded; timestamp accessTime; timestamp modificationTime; timestamp createTime; timestamp attrTime; - uint32_t checkpoint; - uint32_t reserved; + __le32 checkpoint; + __le32 reserved; long_ad extendedAttrICB; long_ad streamDirectoryICB; regid impIdent; - uint64_t uniqueID; - uint32_t lengthExtendedAttr; - uint32_t lengthAllocDescs; + __le64 uniqueID; + __le32 lengthExtendedAttr; + __le32 lengthAllocDescs; uint8_t extendedAttr[0]; uint8_t allocDescs[0]; } __attribute__ ((packed)); diff --git a/fs/udf/inode.c b/fs/udf/inode.c index a1aa17525855..769ad9822987 100644 --- a/fs/udf/inode.c +++ b/fs/udf/inode.c @@ -56,17 +56,17 @@ static int udf_update_inode(struct inode *, int); static void udf_fill_inode(struct inode *, struct buffer_head *); static struct buffer_head *inode_getblk(struct inode *, long, int *, long *, int *); -static int8_t udf_insert_aext(struct inode *, lb_addr, int, - lb_addr, uint32_t, struct buffer_head *); +static int8_t udf_insert_aext(struct inode *, kernel_lb_addr, int, + kernel_lb_addr, uint32_t, struct buffer_head *); static void udf_split_extents(struct inode *, int *, int, int, - long_ad [EXTENT_MERGE_SIZE], int *); + kernel_long_ad [EXTENT_MERGE_SIZE], int *); static void udf_prealloc_extents(struct inode *, int, int, - long_ad [EXTENT_MERGE_SIZE], int *); + kernel_long_ad [EXTENT_MERGE_SIZE], int *); static void udf_merge_extents(struct inode *, - long_ad [EXTENT_MERGE_SIZE], int *); + kernel_long_ad [EXTENT_MERGE_SIZE], int *); static void udf_update_extents(struct inode *, - long_ad [EXTENT_MERGE_SIZE], int, int, - lb_addr, uint32_t, struct buffer_head **); + kernel_long_ad [EXTENT_MERGE_SIZE], int, int, + kernel_lb_addr, uint32_t, struct buffer_head **); static int udf_get_block(struct inode *, sector_t, struct buffer_head *, int); /* @@ -216,7 +216,7 @@ struct buffer_head * udf_expand_dir_adinicb(struct inode *inode, int *block, int { int newblock; struct buffer_head *sbh = NULL, *dbh = NULL; - lb_addr bloc, eloc; + kernel_lb_addr bloc, eloc; uint32_t elen, extoffset; uint8_t alloctype; @@ -381,11 +381,11 @@ static struct buffer_head * inode_getblk(struct inode * inode, long block, int *err, long *phys, int *new) { struct buffer_head *pbh = NULL, *cbh = NULL, *nbh = NULL, *result = NULL; - long_ad laarr[EXTENT_MERGE_SIZE]; + kernel_long_ad laarr[EXTENT_MERGE_SIZE]; uint32_t pextoffset = 0, cextoffset = 0, nextoffset = 0; int count = 0, startnum = 0, endnum = 0; uint32_t elen = 0; - lb_addr eloc, pbloc, cbloc, nbloc; + kernel_lb_addr eloc, pbloc, cbloc, nbloc; int c = 1; uint64_t lbcount = 0, b_off = 0; uint32_t newblocknum, newblock, offset = 0; @@ -479,7 +479,7 @@ static struct buffer_head * inode_getblk(struct inode * inode, long block, c = !c; laarr[c].extLength = EXT_NOT_RECORDED_NOT_ALLOCATED | ((offset + 1) << inode->i_sb->s_blocksize_bits); - memset(&laarr[c].extLocation, 0x00, sizeof(lb_addr)); + memset(&laarr[c].extLocation, 0x00, sizeof(kernel_lb_addr)); count ++; endnum ++; lastblock = 1; @@ -578,7 +578,7 @@ static struct buffer_head * inode_getblk(struct inode * inode, long block, } static void udf_split_extents(struct inode *inode, int *c, int offset, int newblocknum, - long_ad laarr[EXTENT_MERGE_SIZE], int *endnum) + kernel_long_ad laarr[EXTENT_MERGE_SIZE], int *endnum) { if ((laarr[*c].extLength >> 30) == (EXT_NOT_RECORDED_ALLOCATED >> 30) || (laarr[*c].extLength >> 30) == (EXT_NOT_RECORDED_NOT_ALLOCATED >> 30)) @@ -640,7 +640,7 @@ static void udf_split_extents(struct inode *inode, int *c, int offset, int newbl } static void udf_prealloc_extents(struct inode *inode, int c, int lastblock, - long_ad laarr[EXTENT_MERGE_SIZE], int *endnum) + kernel_long_ad laarr[EXTENT_MERGE_SIZE], int *endnum) { int start, length = 0, currlength = 0, i; @@ -732,7 +732,7 @@ static void udf_prealloc_extents(struct inode *inode, int c, int lastblock, } static void udf_merge_extents(struct inode *inode, - long_ad laarr[EXTENT_MERGE_SIZE], int *endnum) + kernel_long_ad laarr[EXTENT_MERGE_SIZE], int *endnum) { int i; @@ -817,11 +817,11 @@ static void udf_merge_extents(struct inode *inode, } static void udf_update_extents(struct inode *inode, - long_ad laarr[EXTENT_MERGE_SIZE], int startnum, int endnum, - lb_addr pbloc, uint32_t pextoffset, struct buffer_head **pbh) + kernel_long_ad laarr[EXTENT_MERGE_SIZE], int startnum, int endnum, + kernel_lb_addr pbloc, uint32_t pextoffset, struct buffer_head **pbh) { int start = 0, i; - lb_addr tmploc; + kernel_lb_addr tmploc; uint32_t tmplen; if (startnum > endnum) @@ -941,7 +941,7 @@ void udf_truncate(struct inode * inode) void udf_read_inode(struct inode *inode) { - memset(&UDF_I_LOCATION(inode), 0xFF, sizeof(lb_addr)); + memset(&UDF_I_LOCATION(inode), 0xFF, sizeof(kernel_lb_addr)); } static void @@ -997,7 +997,7 @@ __udf_read_inode(struct inode *inode) { if (ibh) { - lb_addr loc; + kernel_lb_addr loc; ie = (struct indirectEntry *)ibh->b_data; loc = lelb_to_cpu(ie->indirectICB.extLocation); @@ -1008,7 +1008,7 @@ __udf_read_inode(struct inode *inode) if (ident == TAG_IDENT_FE || ident == TAG_IDENT_EFE) { - memcpy(&UDF_I_LOCATION(inode), &loc, sizeof(lb_addr)); + memcpy(&UDF_I_LOCATION(inode), &loc, sizeof(kernel_lb_addr)); udf_release_data(bh); udf_release_data(ibh); udf_release_data(nbh); @@ -1338,7 +1338,7 @@ udf_update_inode(struct inode *inode, int do_sync) uint16_t icbflags; uint16_t crclen; int i; - timestamp cpu_time; + kernel_timestamp cpu_time; int err = 0; bh = udf_tread(inode->i_sb, @@ -1449,7 +1449,7 @@ udf_update_inode(struct inode *inode, int do_sync) fe->uniqueID = cpu_to_le64(UDF_I_UNIQUE(inode)); fe->lengthExtendedAttr = cpu_to_le32(UDF_I_LENEATTR(inode)); fe->lengthAllocDescs = cpu_to_le32(UDF_I_LENALLOC(inode)); - fe->descTag.tagIdent = le16_to_cpu(TAG_IDENT_FE); + fe->descTag.tagIdent = cpu_to_le16(TAG_IDENT_FE); crclen = sizeof(struct fileEntry); } else @@ -1495,7 +1495,7 @@ udf_update_inode(struct inode *inode, int do_sync) efe->uniqueID = cpu_to_le64(UDF_I_UNIQUE(inode)); efe->lengthExtendedAttr = cpu_to_le32(UDF_I_LENEATTR(inode)); efe->lengthAllocDescs = cpu_to_le32(UDF_I_LENALLOC(inode)); - efe->descTag.tagIdent = le16_to_cpu(TAG_IDENT_EFE); + efe->descTag.tagIdent = cpu_to_le16(TAG_IDENT_EFE); crclen = sizeof(struct extendedFileEntry); } if (UDF_I_STRAT4096(inode)) @@ -1581,7 +1581,7 @@ udf_update_inode(struct inode *inode, int do_sync) * 12/19/98 dgb Added semaphore and changed to be a wrapper of iget */ struct inode * -udf_iget(struct super_block *sb, lb_addr ino) +udf_iget(struct super_block *sb, kernel_lb_addr ino) { struct inode *inode; unsigned long block; @@ -1606,7 +1606,7 @@ udf_iget(struct super_block *sb, lb_addr ino) else if (UDF_I_LOCATION(inode).logicalBlockNum == 0xFFFFFFFF && UDF_I_LOCATION(inode).partitionReferenceNum == 0xFFFF) { - memcpy(&UDF_I_LOCATION(inode), &ino, sizeof(lb_addr)); + memcpy(&UDF_I_LOCATION(inode), &ino, sizeof(kernel_lb_addr)); __udf_read_inode(inode); if (is_bad_inode(inode)) { @@ -1627,8 +1627,8 @@ udf_iget(struct super_block *sb, lb_addr ino) return inode; } -int8_t udf_add_aext(struct inode *inode, lb_addr *bloc, int *extoffset, - lb_addr eloc, uint32_t elen, struct buffer_head **bh, int inc) +int8_t udf_add_aext(struct inode *inode, kernel_lb_addr *bloc, int *extoffset, + kernel_lb_addr eloc, uint32_t elen, struct buffer_head **bh, int inc) { int adsize; short_ad *sad = NULL; @@ -1654,7 +1654,7 @@ int8_t udf_add_aext(struct inode *inode, lb_addr *bloc, int *extoffset, char *sptr, *dptr; struct buffer_head *nbh; int err, loffset; - lb_addr obloc = *bloc; + kernel_lb_addr obloc = *bloc; if (!(bloc->logicalBlockNum = udf_new_block(inode->i_sb, NULL, obloc.partitionReferenceNum, obloc.logicalBlockNum, &err))) @@ -1767,8 +1767,8 @@ int8_t udf_add_aext(struct inode *inode, lb_addr *bloc, int *extoffset, return etype; } -int8_t udf_write_aext(struct inode *inode, lb_addr bloc, int *extoffset, - lb_addr eloc, uint32_t elen, struct buffer_head *bh, int inc) +int8_t udf_write_aext(struct inode *inode, kernel_lb_addr bloc, int *extoffset, + kernel_lb_addr eloc, uint32_t elen, struct buffer_head *bh, int inc) { int adsize; uint8_t *ptr; @@ -1823,8 +1823,8 @@ int8_t udf_write_aext(struct inode *inode, lb_addr bloc, int *extoffset, return (elen >> 30); } -int8_t udf_next_aext(struct inode *inode, lb_addr *bloc, int *extoffset, - lb_addr *eloc, uint32_t *elen, struct buffer_head **bh, int inc) +int8_t udf_next_aext(struct inode *inode, kernel_lb_addr *bloc, int *extoffset, + kernel_lb_addr *eloc, uint32_t *elen, struct buffer_head **bh, int inc) { int8_t etype; @@ -1845,8 +1845,8 @@ int8_t udf_next_aext(struct inode *inode, lb_addr *bloc, int *extoffset, return etype; } -int8_t udf_current_aext(struct inode *inode, lb_addr *bloc, int *extoffset, - lb_addr *eloc, uint32_t *elen, struct buffer_head **bh, int inc) +int8_t udf_current_aext(struct inode *inode, kernel_lb_addr *bloc, int *extoffset, + kernel_lb_addr *eloc, uint32_t *elen, struct buffer_head **bh, int inc) { int alen; int8_t etype; @@ -1905,10 +1905,10 @@ int8_t udf_current_aext(struct inode *inode, lb_addr *bloc, int *extoffset, } static int8_t -udf_insert_aext(struct inode *inode, lb_addr bloc, int extoffset, - lb_addr neloc, uint32_t nelen, struct buffer_head *bh) +udf_insert_aext(struct inode *inode, kernel_lb_addr bloc, int extoffset, + kernel_lb_addr neloc, uint32_t nelen, struct buffer_head *bh) { - lb_addr oeloc; + kernel_lb_addr oeloc; uint32_t oelen; int8_t etype; @@ -1927,11 +1927,11 @@ udf_insert_aext(struct inode *inode, lb_addr bloc, int extoffset, return (nelen >> 30); } -int8_t udf_delete_aext(struct inode *inode, lb_addr nbloc, int nextoffset, - lb_addr eloc, uint32_t elen, struct buffer_head *nbh) +int8_t udf_delete_aext(struct inode *inode, kernel_lb_addr nbloc, int nextoffset, + kernel_lb_addr eloc, uint32_t elen, struct buffer_head *nbh) { struct buffer_head *obh; - lb_addr obloc; + kernel_lb_addr obloc; int oextoffset, adsize; int8_t etype; struct allocExtDesc *aed; @@ -1968,7 +1968,7 @@ int8_t udf_delete_aext(struct inode *inode, lb_addr nbloc, int nextoffset, oextoffset = nextoffset - adsize; } } - memset(&eloc, 0x00, sizeof(lb_addr)); + memset(&eloc, 0x00, sizeof(kernel_lb_addr)); elen = 0; if (nbh != obh) @@ -2019,8 +2019,8 @@ int8_t udf_delete_aext(struct inode *inode, lb_addr nbloc, int nextoffset, return (elen >> 30); } -int8_t inode_bmap(struct inode *inode, int block, lb_addr *bloc, uint32_t *extoffset, - lb_addr *eloc, uint32_t *elen, uint32_t *offset, struct buffer_head **bh) +int8_t inode_bmap(struct inode *inode, int block, kernel_lb_addr *bloc, uint32_t *extoffset, + kernel_lb_addr *eloc, uint32_t *elen, uint32_t *offset, struct buffer_head **bh) { uint64_t lbcount = 0, bcount = (uint64_t)block << inode->i_sb->s_blocksize_bits; int8_t etype; @@ -2058,7 +2058,7 @@ int8_t inode_bmap(struct inode *inode, int block, lb_addr *bloc, uint32_t *extof long udf_block_map(struct inode *inode, long block) { - lb_addr eloc, bloc; + kernel_lb_addr eloc, bloc; uint32_t offset, extoffset, elen; struct buffer_head *bh = NULL; int ret; diff --git a/fs/udf/misc.c b/fs/udf/misc.c index 174d7a3eca63..fd321f9ace83 100644 --- a/fs/udf/misc.c +++ b/fs/udf/misc.c @@ -273,7 +273,7 @@ error_out: } struct buffer_head * -udf_read_ptagged(struct super_block *sb, lb_addr loc, uint32_t offset, uint16_t *ident) +udf_read_ptagged(struct super_block *sb, kernel_lb_addr loc, uint32_t offset, uint16_t *ident) { return udf_read_tagged(sb, udf_get_lb_pblock(sb, loc, offset), loc.logicalBlockNum + offset, ident); @@ -293,8 +293,8 @@ void udf_update_tag(char *data, int length) length -= sizeof(tag); tptr->tagChecksum = 0; - tptr->descCRCLength = le16_to_cpu(length); - tptr->descCRC = le16_to_cpu(udf_crc(data + sizeof(tag), length, 0)); + tptr->descCRCLength = cpu_to_le16(length); + tptr->descCRC = cpu_to_le16(udf_crc(data + sizeof(tag), length, 0)); for (i=0; i<16; i++) if (i != 4) @@ -305,9 +305,9 @@ void udf_new_tag(char *data, uint16_t ident, uint16_t version, uint16_t snum, uint32_t loc, int length) { tag *tptr = (tag *)data; - tptr->tagIdent = le16_to_cpu(ident); - tptr->descVersion = le16_to_cpu(version); - tptr->tagSerialNum = le16_to_cpu(snum); - tptr->tagLocation = le32_to_cpu(loc); + tptr->tagIdent = cpu_to_le16(ident); + tptr->descVersion = cpu_to_le16(version); + tptr->tagSerialNum = cpu_to_le16(snum); + tptr->tagLocation = cpu_to_le32(loc); udf_update_tag(data, length); } diff --git a/fs/udf/namei.c b/fs/udf/namei.c index 0c5615ae4f05..a0e9b733b841 100644 --- a/fs/udf/namei.c +++ b/fs/udf/namei.c @@ -160,7 +160,7 @@ udf_find_entry(struct inode *dir, struct dentry *dentry, uint8_t lfi; uint16_t liu; loff_t size = (udf_ext0_offset(dir) + dir->i_size) >> 2; - lb_addr bloc, eloc; + kernel_lb_addr bloc, eloc; uint32_t extoffset, elen, offset; struct buffer_head *bh = NULL; @@ -314,7 +314,7 @@ udf_lookup(struct inode *dir, struct dentry *dentry, struct nameidata *nd) /* temporary shorthand for specifying files by inode number */ if (!strncmp(dentry->d_name.name, ".B=", 3) ) { - lb_addr lb = { 0, simple_strtoul(dentry->d_name.name+3, NULL, 0) }; + kernel_lb_addr lb = { 0, simple_strtoul(dentry->d_name.name+3, NULL, 0) }; inode = udf_iget(dir->i_sb, lb); if (!inode) { @@ -360,7 +360,7 @@ udf_add_entry(struct inode *dir, struct dentry *dentry, uint8_t lfi; uint16_t liu; int block; - lb_addr bloc, eloc; + kernel_lb_addr bloc, eloc; uint32_t extoffset, elen, offset; struct buffer_head *bh = NULL; @@ -655,7 +655,7 @@ static int udf_create(struct inode *dir, struct dentry *dentry, int mode, struct } cfi.icb.extLength = cpu_to_le32(inode->i_sb->s_blocksize); cfi.icb.extLocation = cpu_to_lelb(UDF_I_LOCATION(inode)); - *(uint32_t *)((struct allocDescImpUse *)cfi.icb.impUse)->impUse = + *(__le32 *)((struct allocDescImpUse *)cfi.icb.impUse)->impUse = cpu_to_le32(UDF_I_UNIQUE(inode) & 0x00000000FFFFFFFFUL); udf_write_fi(dir, &cfi, fi, &fibh, NULL, NULL); if (UDF_I_ALLOCTYPE(dir) == ICBTAG_FLAG_AD_IN_ICB) @@ -698,7 +698,7 @@ static int udf_mknod(struct inode * dir, struct dentry * dentry, int mode, dev_t } cfi.icb.extLength = cpu_to_le32(inode->i_sb->s_blocksize); cfi.icb.extLocation = cpu_to_lelb(UDF_I_LOCATION(inode)); - *(uint32_t *)((struct allocDescImpUse *)cfi.icb.impUse)->impUse = + *(__le32 *)((struct allocDescImpUse *)cfi.icb.impUse)->impUse = cpu_to_le32(UDF_I_UNIQUE(inode) & 0x00000000FFFFFFFFUL); udf_write_fi(dir, &cfi, fi, &fibh, NULL, NULL); if (UDF_I_ALLOCTYPE(dir) == ICBTAG_FLAG_AD_IN_ICB) @@ -746,7 +746,7 @@ static int udf_mkdir(struct inode * dir, struct dentry * dentry, int mode) inode->i_nlink = 2; cfi.icb.extLength = cpu_to_le32(inode->i_sb->s_blocksize); cfi.icb.extLocation = cpu_to_lelb(UDF_I_LOCATION(dir)); - *(uint32_t *)((struct allocDescImpUse *)cfi.icb.impUse)->impUse = + *(__le32 *)((struct allocDescImpUse *)cfi.icb.impUse)->impUse = cpu_to_le32(UDF_I_UNIQUE(dir) & 0x00000000FFFFFFFFUL); cfi.fileCharacteristics = FID_FILE_CHAR_DIRECTORY | FID_FILE_CHAR_PARENT; udf_write_fi(inode, &cfi, fi, &fibh, NULL, NULL); @@ -765,7 +765,7 @@ static int udf_mkdir(struct inode * dir, struct dentry * dentry, int mode) } cfi.icb.extLength = cpu_to_le32(inode->i_sb->s_blocksize); cfi.icb.extLocation = cpu_to_lelb(UDF_I_LOCATION(inode)); - *(uint32_t *)((struct allocDescImpUse *)cfi.icb.impUse)->impUse = + *(__le32 *)((struct allocDescImpUse *)cfi.icb.impUse)->impUse = cpu_to_le32(UDF_I_UNIQUE(inode) & 0x00000000FFFFFFFFUL); cfi.fileCharacteristics |= FID_FILE_CHAR_DIRECTORY; udf_write_fi(dir, &cfi, fi, &fibh, NULL, NULL); @@ -788,7 +788,7 @@ static int empty_dir(struct inode *dir) loff_t f_pos; loff_t size = (udf_ext0_offset(dir) + dir->i_size) >> 2; int block; - lb_addr bloc, eloc; + kernel_lb_addr bloc, eloc; uint32_t extoffset, elen, offset; struct buffer_head *bh = NULL; @@ -861,7 +861,7 @@ static int udf_rmdir(struct inode * dir, struct dentry * dentry) struct inode * inode = dentry->d_inode; struct udf_fileident_bh fibh; struct fileIdentDesc *fi, cfi; - lb_addr tloc; + kernel_lb_addr tloc; retval = -ENOENT; lock_kernel(); @@ -906,7 +906,7 @@ static int udf_unlink(struct inode * dir, struct dentry * dentry) struct udf_fileident_bh fibh; struct fileIdentDesc *fi; struct fileIdentDesc cfi; - lb_addr tloc; + kernel_lb_addr tloc; retval = -ENOENT; lock_kernel(); @@ -971,7 +971,7 @@ static int udf_symlink(struct inode * dir, struct dentry * dentry, const char * if (UDF_I_ALLOCTYPE(inode) != ICBTAG_FLAG_AD_IN_ICB) { struct buffer_head *bh = NULL; - lb_addr bloc, eloc; + kernel_lb_addr bloc, eloc; uint32_t elen, extoffset; block = udf_new_block(inode->i_sb, inode, @@ -1085,7 +1085,7 @@ static int udf_symlink(struct inode * dir, struct dentry * dentry, const char * uint64_t uniqueID; lvhd = (struct logicalVolHeaderDesc *)(UDF_SB_LVID(inode->i_sb)->logicalVolContentsUse); uniqueID = le64_to_cpu(lvhd->uniqueID); - *(uint32_t *)((struct allocDescImpUse *)cfi.icb.impUse)->impUse = + *(__le32 *)((struct allocDescImpUse *)cfi.icb.impUse)->impUse = cpu_to_le32(uniqueID & 0x00000000FFFFFFFFUL); if (!(++uniqueID & 0x00000000FFFFFFFFUL)) uniqueID += 16; @@ -1142,7 +1142,7 @@ static int udf_link(struct dentry * old_dentry, struct inode * dir, uint64_t uniqueID; lvhd = (struct logicalVolHeaderDesc *)(UDF_SB_LVID(inode->i_sb)->logicalVolContentsUse); uniqueID = le64_to_cpu(lvhd->uniqueID); - *(uint32_t *)((struct allocDescImpUse *)cfi.icb.impUse)->impUse = + *(__le32 *)((struct allocDescImpUse *)cfi.icb.impUse)->impUse = cpu_to_le32(uniqueID & 0x00000000FFFFFFFFUL); if (!(++uniqueID & 0x00000000FFFFFFFFUL)) uniqueID += 16; @@ -1178,7 +1178,7 @@ static int udf_rename (struct inode * old_dir, struct dentry * old_dentry, struct fileIdentDesc *ofi = NULL, *nfi = NULL, *dir_fi = NULL, ocfi, ncfi; struct buffer_head *dir_bh = NULL; int retval = -ENOENT; - lb_addr tloc; + kernel_lb_addr tloc; lock_kernel(); if ((ofi = udf_find_entry(old_dir, old_dentry, &ofibh, &ocfi))) @@ -1231,7 +1231,7 @@ static int udf_rename (struct inode * old_dir, struct dentry * old_dentry, } if (!dir_fi) goto end_rename; - tloc = cpu_to_lelb(dir_fi->icb.extLocation); + tloc = lelb_to_cpu(dir_fi->icb.extLocation); if (udf_get_lb_pblock(old_inode->i_sb, tloc, 0) != old_dir->i_ino) goto end_rename; @@ -1277,9 +1277,9 @@ static int udf_rename (struct inode * old_dir, struct dentry * old_dentry, if (dir_fi) { - dir_fi->icb.extLocation = lelb_to_cpu(UDF_I_LOCATION(new_dir)); + dir_fi->icb.extLocation = cpu_to_lelb(UDF_I_LOCATION(new_dir)); udf_update_tag((char *)dir_fi, (sizeof(struct fileIdentDesc) + - cpu_to_le16(dir_fi->lengthOfImpUse) + 3) & ~3); + le16_to_cpu(dir_fi->lengthOfImpUse) + 3) & ~3); if (UDF_I_ALLOCTYPE(old_inode) == ICBTAG_FLAG_AD_IN_ICB) { mark_inode_dirty(old_inode); diff --git a/fs/udf/osta_udf.h b/fs/udf/osta_udf.h index 037d0b7e36ad..e82aae652697 100644 --- a/fs/udf/osta_udf.h +++ b/fs/udf/osta_udf.h @@ -67,7 +67,7 @@ struct UDFIdentSuffix { - uint16_t UDFRevision; + __le16 UDFRevision; uint8_t OSClass; uint8_t OSIdentifier; uint8_t reserved[4]; @@ -90,11 +90,11 @@ struct appIdentSuffix struct logicalVolIntegrityDescImpUse { regid impIdent; - uint32_t numFiles; - uint32_t numDirs; - uint16_t minUDFReadRev; - uint16_t minUDFWriteRev; - uint16_t maxUDFWriteRev; + __le32 numFiles; + __le32 numDirs; + __le16 minUDFReadRev; + __le16 minUDFWriteRev; + __le16 maxUDFWriteRev; uint8_t impUse[0]; } __attribute__ ((packed)); @@ -117,8 +117,8 @@ struct udfPartitionMap2 uint8_t partitionMapLength; uint8_t reserved1[2]; regid partIdent; - uint16_t volSeqNum; - uint16_t partitionNum; + __le16 volSeqNum; + __le16 partitionNum; } __attribute__ ((packed)); /* Virtual Partition Map (UDF 2.50 2.2.8) */ @@ -128,8 +128,8 @@ struct virtualPartitionMap uint8_t partitionMapLength; uint8_t reserved1[2]; regid partIdent; - uint16_t volSeqNum; - uint16_t partitionNum; + __le16 volSeqNum; + __le16 partitionNum; uint8_t reserved2[24]; } __attribute__ ((packed)); @@ -140,13 +140,13 @@ struct sparablePartitionMap uint8_t partitionMapLength; uint8_t reserved1[2]; regid partIdent; - uint16_t volSeqNum; - uint16_t partitionNum; - uint16_t packetLength; + __le16 volSeqNum; + __le16 partitionNum; + __le16 packetLength; uint8_t numSparingTables; uint8_t reserved2[1]; - uint32_t sizeSparingTable; - uint32_t locSparingTable[4]; + __le32 sizeSparingTable; + __le32 locSparingTable[4]; } __attribute__ ((packed)); /* Metadata Partition Map (UDF 2.4.0 2.2.10) */ @@ -156,13 +156,13 @@ struct metadataPartitionMap uint8_t partitionMapLength; uint8_t reserved1[2]; regid partIdent; - uint16_t volSeqNum; - uint16_t partitionNum; - uint32_t metadataFileLoc; - uint32_t metadataMirrorFileLoc; - uint32_t metadataBitmapFileLoc; - uint32_t allocUnitSize; - uint16_t alignUnitSize; + __le16 volSeqNum; + __le16 partitionNum; + __le32 metadataFileLoc; + __le32 metadataMirrorFileLoc; + __le32 metadataBitmapFileLoc; + __le32 allocUnitSize; + __le16 alignUnitSize; uint8_t flags; uint8_t reserved2[5]; } __attribute__ ((packed)); @@ -170,9 +170,9 @@ struct metadataPartitionMap /* Virtual Allocation Table (UDF 1.5 2.2.10) */ struct virtualAllocationTable15 { - uint32_t VirtualSector[0]; + __le32 VirtualSector[0]; regid vatIdent; - uint32_t previousVATICBLoc; + __le32 previousVATICBLoc; } __attribute__ ((packed)); #define ICBTAG_FILE_TYPE_VAT15 0x00U @@ -180,18 +180,18 @@ struct virtualAllocationTable15 /* Virtual Allocation Table (UDF 2.50 2.2.11) */ struct virtualAllocationTable20 { - uint16_t lengthHeader; - uint16_t lengthImpUse; + __le16 lengthHeader; + __le16 lengthImpUse; dstring logicalVolIdent[128]; - uint32_t previousVATICBLoc; - uint32_t numFiles; - uint32_t numDirs; - uint16_t minReadRevision; - uint16_t minWriteRevision; - uint16_t maxWriteRevision; - uint16_t reserved; + __le32 previousVATICBLoc; + __le32 numFiles; + __le32 numDirs; + __le16 minReadRevision; + __le16 minWriteRevision; + __le16 maxWriteRevision; + __le16 reserved; uint8_t impUse[0]; - uint32_t vatEntry[0]; + __le32 vatEntry[0]; } __attribute__ ((packed)); #define ICBTAG_FILE_TYPE_VAT20 0xF8U @@ -199,17 +199,17 @@ struct virtualAllocationTable20 /* Sparing Table (UDF 2.50 2.2.12) */ struct sparingEntry { - uint32_t origLocation; - uint32_t mappedLocation; + __le32 origLocation; + __le32 mappedLocation; } __attribute__ ((packed)); struct sparingTable { tag descTag; regid sparingIdent; - uint16_t reallocationTableLen; - uint16_t reserved; - uint32_t sequenceNum; + __le16 reallocationTableLen; + __le16 reserved; + __le32 sequenceNum; struct sparingEntry mapEntry[0]; } __attribute__ ((packed)); @@ -222,7 +222,7 @@ struct sparingTable /* struct long_ad ICB - ADImpUse (UDF 2.50 2.2.4.3) */ struct allocDescImpUse { - uint16_t flags; + __le16 flags; uint8_t impUse[4]; } __attribute__ ((packed)); @@ -235,14 +235,14 @@ struct allocDescImpUse /* FreeEASpace (UDF 2.50 3.3.4.5.1.1) */ struct freeEaSpace { - uint16_t headerChecksum; + __le16 headerChecksum; uint8_t freeEASpace[0]; } __attribute__ ((packed)); /* DVD Copyright Management Information (UDF 2.50 3.3.4.5.1.2) */ struct DVDCopyrightImpUse { - uint16_t headerChecksum; + __le16 headerChecksum; uint8_t CGMSInfo; uint8_t dataType; uint8_t protectionSystemInfo[4]; @@ -252,7 +252,7 @@ struct DVDCopyrightImpUse /* FreeAppEASpace (UDF 2.50 3.3.4.6.1) */ struct freeAppEASpace { - uint16_t headerChecksum; + __le16 headerChecksum; uint8_t freeEASpace[0]; } __attribute__ ((packed)); diff --git a/fs/udf/partition.c b/fs/udf/partition.c index 92e8cbf02d12..4d36f264be0d 100644 --- a/fs/udf/partition.c +++ b/fs/udf/partition.c @@ -84,7 +84,7 @@ uint32_t udf_get_pblock_virt15(struct super_block *sb, uint32_t block, uint16_t return 0xFFFFFFFF; } - loc = le32_to_cpu(((uint32_t *)bh->b_data)[index]); + loc = le32_to_cpu(((__le32 *)bh->b_data)[index]); udf_release_data(bh); diff --git a/fs/udf/super.c b/fs/udf/super.c index 7b5484a5ba1f..1865c5a446d2 100644 --- a/fs/udf/super.c +++ b/fs/udf/super.c @@ -85,13 +85,13 @@ static void udf_write_super(struct super_block *); static int udf_remount_fs(struct super_block *, int *, char *); static int udf_check_valid(struct super_block *, int, int); static int udf_vrs(struct super_block *sb, int silent); -static int udf_load_partition(struct super_block *, lb_addr *); -static int udf_load_logicalvol(struct super_block *, struct buffer_head *, lb_addr *); -static void udf_load_logicalvolint(struct super_block *, extent_ad); +static int udf_load_partition(struct super_block *, kernel_lb_addr *); +static int udf_load_logicalvol(struct super_block *, struct buffer_head *, kernel_lb_addr *); +static void udf_load_logicalvolint(struct super_block *, kernel_extent_ad); static void udf_find_anchor(struct super_block *); -static int udf_find_fileset(struct super_block *, lb_addr *, lb_addr *); +static int udf_find_fileset(struct super_block *, kernel_lb_addr *, kernel_lb_addr *); static void udf_load_pvoldesc(struct super_block *, struct buffer_head *); -static void udf_load_fileset(struct super_block *, struct buffer_head *, lb_addr *); +static void udf_load_fileset(struct super_block *, struct buffer_head *, kernel_lb_addr *); static void udf_load_partdesc(struct super_block *, struct buffer_head *); static void udf_open_lvid(struct super_block *); static void udf_close_lvid(struct super_block *); @@ -769,7 +769,7 @@ udf_find_anchor(struct super_block *sb) } static int -udf_find_fileset(struct super_block *sb, lb_addr *fileset, lb_addr *root) +udf_find_fileset(struct super_block *sb, kernel_lb_addr *fileset, kernel_lb_addr *root) { struct buffer_head *bh = NULL; long lastblock; @@ -792,7 +792,7 @@ udf_find_fileset(struct super_block *sb, lb_addr *fileset, lb_addr *root) if (!bh) /* Search backwards through the partitions */ { - lb_addr newfileset; + kernel_lb_addr newfileset; return 1; @@ -874,7 +874,7 @@ udf_load_pvoldesc(struct super_block *sb, struct buffer_head *bh) if ( udf_stamp_to_time(&recording, &recording_usec, lets_to_cpu(pvoldesc->recordingDateAndTime)) ) { - timestamp ts; + kernel_timestamp ts; ts = lets_to_cpu(pvoldesc->recordingDateAndTime); udf_debug("recording time %ld/%ld, %04u/%02u/%02u %02u:%02u (%x)\n", recording, recording_usec, @@ -901,7 +901,7 @@ udf_load_pvoldesc(struct super_block *sb, struct buffer_head *bh) } static void -udf_load_fileset(struct super_block *sb, struct buffer_head *bh, lb_addr *root) +udf_load_fileset(struct super_block *sb, struct buffer_head *bh, kernel_lb_addr *root) { struct fileSetDesc *fset; @@ -948,7 +948,7 @@ udf_load_partdesc(struct super_block *sb, struct buffer_head *bh) phd = (struct partitionHeaderDesc *)(p->partitionContentsUse); if (phd->unallocSpaceTable.extLength) { - lb_addr loc = { le32_to_cpu(phd->unallocSpaceTable.extPosition), i }; + kernel_lb_addr loc = { le32_to_cpu(phd->unallocSpaceTable.extPosition), i }; UDF_SB_PARTMAPS(sb)[i].s_uspace.s_table = udf_iget(sb, loc); @@ -974,7 +974,7 @@ udf_load_partdesc(struct super_block *sb, struct buffer_head *bh) udf_debug("partitionIntegrityTable (part %d)\n", i); if (phd->freedSpaceTable.extLength) { - lb_addr loc = { le32_to_cpu(phd->freedSpaceTable.extPosition), i }; + kernel_lb_addr loc = { le32_to_cpu(phd->freedSpaceTable.extPosition), i }; UDF_SB_PARTMAPS(sb)[i].s_fspace.s_table = udf_iget(sb, loc); @@ -1013,7 +1013,7 @@ udf_load_partdesc(struct super_block *sb, struct buffer_head *bh) } static int -udf_load_logicalvol(struct super_block *sb, struct buffer_head * bh, lb_addr *fileset) +udf_load_logicalvol(struct super_block *sb, struct buffer_head * bh, kernel_lb_addr *fileset) { struct logicalVolDesc *lvd; int i, j, offset; @@ -1041,12 +1041,12 @@ udf_load_logicalvol(struct super_block *sb, struct buffer_head * bh, lb_addr *fi struct udfPartitionMap2 *upm2 = (struct udfPartitionMap2 *)&(lvd->partitionMaps[offset]); if (!strncmp(upm2->partIdent.ident, UDF_ID_VIRTUAL, strlen(UDF_ID_VIRTUAL))) { - if (le16_to_cpu(((uint16_t *)upm2->partIdent.identSuffix)[0]) == 0x0150) + if (le16_to_cpu(((__le16 *)upm2->partIdent.identSuffix)[0]) == 0x0150) { UDF_SB_PARTTYPE(sb,i) = UDF_VIRTUAL_MAP15; UDF_SB_PARTFUNC(sb,i) = udf_get_pblock_virt15; } - else if (le16_to_cpu(((uint16_t *)upm2->partIdent.identSuffix)[0]) == 0x0200) + else if (le16_to_cpu(((__le16 *)upm2->partIdent.identSuffix)[0]) == 0x0200) { UDF_SB_PARTTYPE(sb,i) = UDF_VIRTUAL_MAP20; UDF_SB_PARTFUNC(sb,i) = udf_get_pblock_virt20; @@ -1110,7 +1110,7 @@ udf_load_logicalvol(struct super_block *sb, struct buffer_head * bh, lb_addr *fi * */ static void -udf_load_logicalvolint(struct super_block *sb, extent_ad loc) +udf_load_logicalvolint(struct super_block *sb, kernel_extent_ad loc) { struct buffer_head *bh = NULL; uint16_t ident; @@ -1150,7 +1150,7 @@ udf_load_logicalvolint(struct super_block *sb, extent_ad loc) * Written, tested, and released. */ static int -udf_process_sequence(struct super_block *sb, long block, long lastblock, lb_addr *fileset) +udf_process_sequence(struct super_block *sb, long block, long lastblock, kernel_lb_addr *fileset) { struct buffer_head *bh = NULL; struct udf_vds_record vds[VDS_POS_LENGTH]; @@ -1293,7 +1293,7 @@ udf_check_valid(struct super_block *sb, int novrs, int silent) } static int -udf_load_partition(struct super_block *sb, lb_addr *fileset) +udf_load_partition(struct super_block *sb, kernel_lb_addr *fileset) { struct anchorVolDescPtr *anchor; uint16_t ident; @@ -1350,7 +1350,7 @@ udf_load_partition(struct super_block *sb, lb_addr *fileset) case UDF_VIRTUAL_MAP15: case UDF_VIRTUAL_MAP20: { - lb_addr ino; + kernel_lb_addr ino; if (!UDF_SB_LASTBLOCK(sb)) { @@ -1415,7 +1415,7 @@ static void udf_open_lvid(struct super_block *sb) if (UDF_SB_LVIDBH(sb)) { int i; - timestamp cpu_time; + kernel_timestamp cpu_time; UDF_SB_LVIDIU(sb)->impIdent.identSuffix[0] = UDF_OS_CLASS_UNIX; UDF_SB_LVIDIU(sb)->impIdent.identSuffix[1] = UDF_OS_ID_LINUX; @@ -1443,7 +1443,7 @@ static void udf_close_lvid(struct super_block *sb) UDF_SB_LVID(sb)->integrityType == LVID_INTEGRITY_TYPE_OPEN) { int i; - timestamp cpu_time; + kernel_timestamp cpu_time; UDF_SB_LVIDIU(sb)->impIdent.identSuffix[0] = UDF_OS_CLASS_UNIX; UDF_SB_LVIDIU(sb)->impIdent.identSuffix[1] = UDF_OS_ID_LINUX; @@ -1492,7 +1492,7 @@ static int udf_fill_super(struct super_block *sb, void *options, int silent) int i; struct inode *inode=NULL; struct udf_options uopt; - lb_addr rootdir, fileset; + kernel_lb_addr rootdir, fileset; struct udf_sb_info *sbi; uopt.flags = (1 << UDF_FLAG_USE_AD_IN_ICB) | (1 << UDF_FLAG_STRICT); @@ -1616,7 +1616,7 @@ static int udf_fill_super(struct super_block *sb, void *options, int silent) if (!silent) { - timestamp ts; + kernel_timestamp ts; udf_time_to_stamp(&ts, UDF_SB_RECORDTIME(sb)); udf_info("UDF %s (%s) Mounting volume '%s', timestamp %04u/%02u/%02u %02u:%02u (%x)\n", UDFFS_VERSION, UDFFS_DATE, @@ -1799,7 +1799,7 @@ udf_count_free_bitmap(struct super_block *sb, struct udf_bitmap *bitmap) unsigned int accum = 0; int index; int block = 0, newblock; - lb_addr loc; + kernel_lb_addr loc; uint32_t bytes; uint8_t value; uint8_t *ptr; @@ -1866,7 +1866,7 @@ udf_count_free_table(struct super_block *sb, struct inode * table) { unsigned int accum = 0; uint32_t extoffset, elen; - lb_addr bloc, eloc; + kernel_lb_addr bloc, eloc; int8_t etype; struct buffer_head *bh = NULL; diff --git a/fs/udf/truncate.c b/fs/udf/truncate.c index b51ea9cf0799..7dc8a5572ca1 100644 --- a/fs/udf/truncate.c +++ b/fs/udf/truncate.c @@ -33,10 +33,10 @@ #include "udf_i.h" #include "udf_sb.h" -static void extent_trunc(struct inode * inode, lb_addr bloc, int extoffset, - lb_addr eloc, int8_t etype, uint32_t elen, struct buffer_head *bh, uint32_t nelen) +static void extent_trunc(struct inode * inode, kernel_lb_addr bloc, int extoffset, + kernel_lb_addr eloc, int8_t etype, uint32_t elen, struct buffer_head *bh, uint32_t nelen) { - lb_addr neloc = { 0, 0 }; + kernel_lb_addr neloc = { 0, 0 }; int last_block = (elen + inode->i_sb->s_blocksize - 1) >> inode->i_sb->s_blocksize_bits; int first_block = (nelen + inode->i_sb->s_blocksize - 1) >> inode->i_sb->s_blocksize_bits; @@ -68,7 +68,7 @@ static void extent_trunc(struct inode * inode, lb_addr bloc, int extoffset, void udf_discard_prealloc(struct inode * inode) { - lb_addr bloc, eloc; + kernel_lb_addr bloc, eloc; uint32_t extoffset = 0, elen, nelen; uint64_t lbcount = 0; int8_t etype = -1, netype; @@ -129,7 +129,7 @@ void udf_discard_prealloc(struct inode * inode) void udf_truncate_extents(struct inode * inode) { - lb_addr bloc, eloc, neloc = { 0, 0 }; + kernel_lb_addr bloc, eloc, neloc = { 0, 0 }; uint32_t extoffset, elen, offset, nelen = 0, lelen = 0, lenalloc; int8_t etype; int first_block = inode->i_size >> inode->i_sb->s_blocksize_bits; @@ -254,7 +254,7 @@ void udf_truncate_extents(struct inode * inode) } else if (etype == (EXT_NOT_RECORDED_ALLOCATED >> 30)) { - lb_addr neloc = { 0, 0 }; + kernel_lb_addr neloc = { 0, 0 }; extoffset -= adsize; nelen = EXT_NOT_RECORDED_NOT_ALLOCATED | ((elen + offset + inode->i_sb->s_blocksize - 1) & @@ -272,7 +272,7 @@ void udf_truncate_extents(struct inode * inode) ~(inode->i_sb->s_blocksize - 1)); udf_write_aext(inode, bloc, &extoffset, eloc, elen, bh, 1); } - memset(&eloc, 0x00, sizeof(lb_addr)); + memset(&eloc, 0x00, sizeof(kernel_lb_addr)); elen = EXT_NOT_RECORDED_NOT_ALLOCATED | offset; udf_add_aext(inode, &bloc, &extoffset, eloc, elen, &bh, 1); } diff --git a/fs/udf/udfdecl.h b/fs/udf/udfdecl.h index 6767f30be66c..c1eca9d055cf 100644 --- a/fs/udf/udfdecl.h +++ b/fs/udf/udfdecl.h @@ -68,7 +68,7 @@ struct udf_vds_record struct generic_desc { tag descTag; - uint32_t volDescSeqNum; + __le32 volDescSeqNum; }; struct ustr @@ -89,7 +89,7 @@ extern int udf_write_fi(struct inode *inode, struct fileIdentDesc *, struct file extern int udf_ioctl(struct inode *, struct file *, unsigned int, unsigned long); /* inode.c */ -extern struct inode *udf_iget(struct super_block *, lb_addr); +extern struct inode *udf_iget(struct super_block *, kernel_lb_addr); extern int udf_sync_inode(struct inode *); extern void udf_expand_file_adinicb(struct inode *, int, int *); extern struct buffer_head * udf_expand_dir_adinicb(struct inode *, int *, int *); @@ -101,12 +101,12 @@ extern void udf_delete_inode(struct inode *); extern void udf_clear_inode(struct inode *); extern void udf_write_inode(struct inode *, int); extern long udf_block_map(struct inode *, long); -extern int8_t inode_bmap(struct inode *, int, lb_addr *, uint32_t *, lb_addr *, uint32_t *, uint32_t *, struct buffer_head **); -extern int8_t udf_add_aext(struct inode *, lb_addr *, int *, lb_addr, uint32_t, struct buffer_head **, int); -extern int8_t udf_write_aext(struct inode *, lb_addr, int *, lb_addr, uint32_t, struct buffer_head *, int); -extern int8_t udf_delete_aext(struct inode *, lb_addr, int, lb_addr, uint32_t, struct buffer_head *); -extern int8_t udf_next_aext(struct inode *, lb_addr *, int *, lb_addr *, uint32_t *, struct buffer_head **, int); -extern int8_t udf_current_aext(struct inode *, lb_addr *, int *, lb_addr *, uint32_t *, struct buffer_head **, int); +extern int8_t inode_bmap(struct inode *, int, kernel_lb_addr *, uint32_t *, kernel_lb_addr *, uint32_t *, uint32_t *, struct buffer_head **); +extern int8_t udf_add_aext(struct inode *, kernel_lb_addr *, int *, kernel_lb_addr, uint32_t, struct buffer_head **, int); +extern int8_t udf_write_aext(struct inode *, kernel_lb_addr, int *, kernel_lb_addr, uint32_t, struct buffer_head *, int); +extern int8_t udf_delete_aext(struct inode *, kernel_lb_addr, int, kernel_lb_addr, uint32_t, struct buffer_head *); +extern int8_t udf_next_aext(struct inode *, kernel_lb_addr *, int *, kernel_lb_addr *, uint32_t *, struct buffer_head **, int); +extern int8_t udf_current_aext(struct inode *, kernel_lb_addr *, int *, kernel_lb_addr *, uint32_t *, struct buffer_head **, int); /* misc.c */ extern struct buffer_head *udf_tgetblk(struct super_block *, int); @@ -114,7 +114,7 @@ extern struct buffer_head *udf_tread(struct super_block *, int); extern struct genericFormat *udf_add_extendedattr(struct inode *, uint32_t, uint32_t, uint8_t); extern struct genericFormat *udf_get_extendedattr(struct inode *, uint32_t, uint8_t); extern struct buffer_head *udf_read_tagged(struct super_block *, uint32_t, uint32_t, uint16_t *); -extern struct buffer_head *udf_read_ptagged(struct super_block *, lb_addr, uint32_t, uint16_t *); +extern struct buffer_head *udf_read_ptagged(struct super_block *, kernel_lb_addr, uint32_t, uint16_t *); extern void udf_release_data(struct buffer_head *); extern void udf_update_tag(char *, int); extern void udf_new_tag(char *, uint16_t, uint16_t, uint16_t, uint32_t, int); @@ -145,7 +145,7 @@ extern void udf_discard_prealloc(struct inode *); extern void udf_truncate_extents(struct inode *); /* balloc.c */ -extern void udf_free_blocks(struct super_block *, struct inode *, lb_addr, uint32_t, uint32_t); +extern void udf_free_blocks(struct super_block *, struct inode *, kernel_lb_addr, uint32_t, uint32_t); extern int udf_prealloc_blocks(struct super_block *, struct inode *, uint16_t, uint32_t, uint32_t); extern int udf_new_block(struct super_block *, struct inode *, uint16_t, uint32_t, int *); @@ -153,7 +153,7 @@ extern int udf_new_block(struct super_block *, struct inode *, uint16_t, uint32_ extern int udf_fsync_file(struct file *, struct dentry *, int); /* directory.c */ -extern struct fileIdentDesc * udf_fileident_read(struct inode *, loff_t *, struct udf_fileident_bh *, struct fileIdentDesc *, lb_addr *, uint32_t *, lb_addr *, uint32_t *, uint32_t *, struct buffer_head **); +extern struct fileIdentDesc * udf_fileident_read(struct inode *, loff_t *, struct udf_fileident_bh *, struct fileIdentDesc *, kernel_lb_addr *, uint32_t *, kernel_lb_addr *, uint32_t *, uint32_t *, struct buffer_head **); extern struct fileIdentDesc * udf_get_fileident(void * buffer, int bufsize, int * offset); extern long_ad * udf_get_filelongad(uint8_t *, int, int *, int); extern short_ad * udf_get_fileshortad(uint8_t *, int, int *, int); @@ -162,7 +162,7 @@ extern short_ad * udf_get_fileshortad(uint8_t *, int, int *, int); extern uint16_t udf_crc(uint8_t *, uint32_t, uint16_t); /* udftime.c */ -extern time_t *udf_stamp_to_time(time_t *, long *, timestamp); -extern timestamp *udf_time_to_stamp(timestamp *, struct timespec); +extern time_t *udf_stamp_to_time(time_t *, long *, kernel_timestamp); +extern kernel_timestamp *udf_time_to_stamp(kernel_timestamp *, struct timespec); #endif /* __UDF_DECL_H */ diff --git a/fs/udf/udfend.h b/fs/udf/udfend.h index 6313daab090e..17d378879561 100644 --- a/fs/udf/udfend.h +++ b/fs/udf/udfend.h @@ -4,15 +4,15 @@ #include <asm/byteorder.h> #include <linux/string.h> -static inline lb_addr lelb_to_cpu(lb_addr in) +static inline kernel_lb_addr lelb_to_cpu(lb_addr in) { - lb_addr out; + kernel_lb_addr out; out.logicalBlockNum = le32_to_cpu(in.logicalBlockNum); out.partitionReferenceNum = le16_to_cpu(in.partitionReferenceNum); return out; } -static inline lb_addr cpu_to_lelb(lb_addr in) +static inline lb_addr cpu_to_lelb(kernel_lb_addr in) { lb_addr out; out.logicalBlockNum = cpu_to_le32(in.logicalBlockNum); @@ -20,9 +20,9 @@ static inline lb_addr cpu_to_lelb(lb_addr in) return out; } -static inline timestamp lets_to_cpu(timestamp in) +static inline kernel_timestamp lets_to_cpu(timestamp in) { - timestamp out; + kernel_timestamp out; memcpy(&out, &in, sizeof(timestamp)); out.typeAndTimezone = le16_to_cpu(in.typeAndTimezone); out.year = le16_to_cpu(in.year); @@ -45,15 +45,15 @@ static inline short_ad cpu_to_lesa(short_ad in) return out; } -static inline long_ad lela_to_cpu(long_ad in) +static inline kernel_long_ad lela_to_cpu(long_ad in) { - long_ad out; + kernel_long_ad out; out.extLength = le32_to_cpu(in.extLength); out.extLocation = lelb_to_cpu(in.extLocation); return out; } -static inline long_ad cpu_to_lela(long_ad in) +static inline long_ad cpu_to_lela(kernel_long_ad in) { long_ad out; out.extLength = cpu_to_le32(in.extLength); @@ -61,15 +61,15 @@ static inline long_ad cpu_to_lela(long_ad in) return out; } -static inline extent_ad leea_to_cpu(extent_ad in) +static inline kernel_extent_ad leea_to_cpu(extent_ad in) { - extent_ad out; + kernel_extent_ad out; out.extLength = le32_to_cpu(in.extLength); out.extLocation = le32_to_cpu(in.extLocation); return out; } -static inline timestamp cpu_to_lets(timestamp in) +static inline timestamp cpu_to_lets(kernel_timestamp in) { timestamp out; memcpy(&out, &in, sizeof(timestamp)); diff --git a/fs/udf/udftime.c b/fs/udf/udftime.c index 983c98ce129b..c2634bda6b50 100644 --- a/fs/udf/udftime.c +++ b/fs/udf/udftime.c @@ -85,7 +85,7 @@ extern struct timezone sys_tz; #define SECS_PER_DAY (SECS_PER_HOUR * 24) time_t * -udf_stamp_to_time(time_t *dest, long *dest_usec, timestamp src) +udf_stamp_to_time(time_t *dest, long *dest_usec, kernel_timestamp src) { int yday; uint8_t type = src.typeAndTimezone >> 12; @@ -120,8 +120,8 @@ udf_stamp_to_time(time_t *dest, long *dest_usec, timestamp src) } -timestamp * -udf_time_to_stamp(timestamp *dest, struct timespec ts) +kernel_timestamp * +udf_time_to_stamp(kernel_timestamp *dest, struct timespec ts) { long int days, rem, y; const unsigned short int *ip; diff --git a/include/acpi/acpiosxf.h b/include/acpi/acpiosxf.h index dc75f08ee304..a76c952f89af 100644 --- a/include/acpi/acpiosxf.h +++ b/include/acpi/acpiosxf.h @@ -169,11 +169,11 @@ acpi_status acpi_os_map_memory ( acpi_physical_address physical_address, acpi_size size, - void **logical_address); + void __iomem **logical_address); void acpi_os_unmap_memory ( - void *logical_address, + void __iomem *logical_address, acpi_size size); acpi_status diff --git a/include/asm-generic/ide_iops.h b/include/asm-generic/ide_iops.h index 8574de4bde41..1b91d0681914 100644 --- a/include/asm-generic/ide_iops.h +++ b/include/asm-generic/ide_iops.h @@ -5,7 +5,7 @@ #define __ide_outsw outsw #define __ide_outsl outsl -static __inline__ void __ide_mm_insw(unsigned long port, void *addr, u32 count) +static __inline__ void __ide_mm_insw(void __iomem *port, void *addr, u32 count) { while (count--) { *(u16 *)addr = readw(port); @@ -13,7 +13,7 @@ static __inline__ void __ide_mm_insw(unsigned long port, void *addr, u32 count) } } -static __inline__ void __ide_mm_insl(unsigned long port, void *addr, u32 count) +static __inline__ void __ide_mm_insl(void __iomem *port, void *addr, u32 count) { while (count--) { *(u32 *)addr = readl(port); @@ -21,7 +21,7 @@ static __inline__ void __ide_mm_insl(unsigned long port, void *addr, u32 count) } } -static __inline__ void __ide_mm_outsw(unsigned long port, void *addr, u32 count) +static __inline__ void __ide_mm_outsw(void __iomem *port, void *addr, u32 count) { while (count--) { writew(*(u16 *)addr, port); @@ -29,7 +29,7 @@ static __inline__ void __ide_mm_outsw(unsigned long port, void *addr, u32 count) } } -static __inline__ void __ide_mm_outsl(unsigned long port, void *addr, u32 count) +static __inline__ void __ide_mm_outsl(void __iomem * port, void *addr, u32 count) { while (count--) { writel(*(u32 *)addr, port); diff --git a/include/asm-i386/io.h b/include/asm-i386/io.h index 1d9fa560d6b6..b659a98cba1d 100644 --- a/include/asm-i386/io.h +++ b/include/asm-i386/io.h @@ -2,6 +2,8 @@ #define _ASM_IO_H #include <linux/config.h> +#include <linux/string.h> +#include <linux/compiler.h> /* * This file contains the definitions for the x86 IO instructions @@ -86,7 +88,7 @@ static inline void * phys_to_virt(unsigned long address) */ #define page_to_phys(page) ((dma_addr_t)page_to_pfn(page) << PAGE_SHIFT) -extern void * __ioremap(unsigned long offset, unsigned long size, unsigned long flags); +extern void __iomem * __ioremap(unsigned long offset, unsigned long size, unsigned long flags); /** * ioremap - map bus memory into CPU space @@ -100,13 +102,13 @@ extern void * __ioremap(unsigned long offset, unsigned long size, unsigned long * address. */ -static inline void * ioremap (unsigned long offset, unsigned long size) +static inline void __iomem * ioremap(unsigned long offset, unsigned long size) { return __ioremap(offset, size, 0); } -extern void * ioremap_nocache (unsigned long offset, unsigned long size); -extern void iounmap(void *addr); +extern void __iomem * ioremap_nocache(unsigned long offset, unsigned long size); +extern void iounmap(volatile void __iomem *addr); /* * bt_ioremap() and bt_iounmap() are for temporary early boot-time @@ -139,9 +141,18 @@ extern void bt_iounmap(void *addr, unsigned long size); * memory location directly. */ -#define readb(addr) (*(volatile unsigned char *) (addr)) -#define readw(addr) (*(volatile unsigned short *) (addr)) -#define readl(addr) (*(volatile unsigned int *) (addr)) +static inline unsigned char readb(const volatile void __iomem *addr) +{ + return *(volatile unsigned char __force *) addr; +} +static inline unsigned short readw(const volatile void __iomem *addr) +{ + return *(volatile unsigned short __force *) addr; +} +static inline unsigned int readl(const volatile void __iomem *addr) +{ + return *(volatile unsigned int __force *) addr; +} #define readb_relaxed(addr) readb(addr) #define readw_relaxed(addr) readw(addr) #define readl_relaxed(addr) readl(addr) @@ -149,16 +160,34 @@ extern void bt_iounmap(void *addr, unsigned long size); #define __raw_readw readw #define __raw_readl readl -#define writeb(b,addr) (*(volatile unsigned char *) (addr) = (b)) -#define writew(b,addr) (*(volatile unsigned short *) (addr) = (b)) -#define writel(b,addr) (*(volatile unsigned int *) (addr) = (b)) +static inline void writeb(unsigned char b, volatile void __iomem *addr) +{ + *(volatile unsigned char __force *) addr = b; +} +static inline void writew(unsigned short b, volatile void __iomem *addr) +{ + *(volatile unsigned short __force *) addr = b; +} +static inline void writel(unsigned int b, volatile void __iomem *addr) +{ + *(volatile unsigned int __force *) addr = b; +} #define __raw_writeb writeb #define __raw_writew writew #define __raw_writel writel -#define memset_io(a,b,c) memset((void *)(a),(b),(c)) -#define memcpy_fromio(a,b,c) __memcpy((a),(void *)(b),(c)) -#define memcpy_toio(a,b,c) __memcpy((void *)(a),(b),(c)) +static inline void memset_io(volatile void __iomem *addr, unsigned char val, int count) +{ + memset((void __force *) addr, val, count); +} +static inline void memcpy_fromio(void *dst, volatile void __iomem *src, int count) +{ + __memcpy(dst, (void __force *) src, count); +} +static inline void memcpy_toio(volatile void __iomem *dst, void *src, int count) +{ + __memcpy((void __force *) dst, src, count); +} /* * ISA space is 'always mapped' on a typical x86 system, no need to @@ -168,7 +197,7 @@ extern void bt_iounmap(void *addr, unsigned long size); * used as the IO-area pointer (it can be iounmapped as well, so the * analogy with PCI is quite large): */ -#define __ISA_IO_base ((char *)(PAGE_OFFSET)) +#define __ISA_IO_base ((char __iomem *)(PAGE_OFFSET)) #define isa_readb(a) readb(__ISA_IO_base + (a)) #define isa_readw(a) readw(__ISA_IO_base + (a)) @@ -185,8 +214,8 @@ extern void bt_iounmap(void *addr, unsigned long size); * Again, i386 does not require mem IO specific function. */ -#define eth_io_copy_and_sum(a,b,c,d) eth_copy_and_sum((a),(void *)(b),(c),(d)) -#define isa_eth_io_copy_and_sum(a,b,c,d) eth_copy_and_sum((a),(void *)(__ISA_IO_base + (b)),(c),(d)) +#define eth_io_copy_and_sum(a,b,c,d) eth_copy_and_sum((a),(void __force *)(b),(c),(d)) +#define isa_eth_io_copy_and_sum(a,b,c,d) eth_copy_and_sum((a),(void __force *)(__ISA_IO_base + (b)),(c),(d)) /** * check_signature - find BIOS signatures @@ -199,7 +228,7 @@ extern void bt_iounmap(void *addr, unsigned long size); * Returns 1 on a match. */ -static inline int check_signature(unsigned long io_addr, +static inline int check_signature(volatile void __iomem * io_addr, const unsigned char *signature, int length) { int retval = 0; diff --git a/include/asm-i386/spinlock.h b/include/asm-i386/spinlock.h index c189e1b9be4c..89ad2d7b58ad 100644 --- a/include/asm-i386/spinlock.h +++ b/include/asm-i386/spinlock.h @@ -128,10 +128,8 @@ static inline int _raw_spin_trylock(spinlock_t *lock) static inline void _raw_spin_lock(spinlock_t *lock) { #ifdef CONFIG_DEBUG_SPINLOCK - __label__ here; -here: if (unlikely(lock->magic != SPINLOCK_MAGIC)) { - printk("eip: %p\n", &&here); + printk("eip: %p\n", __builtin_return_address(0)); BUG(); } #endif @@ -143,10 +141,8 @@ here: static inline void _raw_spin_lock_flags (spinlock_t *lock, unsigned long flags) { #ifdef CONFIG_DEBUG_SPINLOCK - __label__ here; -here: if (unlikely(lock->magic != SPINLOCK_MAGIC)) { - printk("eip: %p\n", &&here); + printk("eip: %p\n", __builtin_return_address(0)); BUG(); } #endif diff --git a/include/asm-ppc64/eeh.h b/include/asm-ppc64/eeh.h index 0b705aec9780..046eeec5da89 100644 --- a/include/asm-ppc64/eeh.h +++ b/include/asm-ppc64/eeh.h @@ -31,7 +31,7 @@ struct device_node; * never actually mapped. Translation between IO <-> EEH region is 1 to 1. */ #define IO_TOKEN_TO_ADDR(token) \ - (((unsigned long)(token) & ~(0xfUL << REGION_SHIFT)) | \ + (((unsigned long __force)(token) & ~(0xfUL << REGION_SHIFT)) | \ (IO_REGION_ID << REGION_SHIFT)) #define IO_ADDR_TO_TOKEN(addr) \ @@ -43,9 +43,9 @@ struct device_node; #define EEH_MODE_NOCHECK (1<<1) extern void __init eeh_init(void); -unsigned long eeh_check_failure(void *token, unsigned long val); +unsigned long eeh_check_failure(const volatile void __iomem *token, unsigned long val); int eeh_dn_check_failure (struct device_node *dn, struct pci_dev *dev); -void *eeh_ioremap(unsigned long addr, void *vaddr); +void __iomem *eeh_ioremap(unsigned long addr, void __iomem *vaddr); void __init pci_addr_cache_build(void); /** @@ -108,83 +108,83 @@ int eeh_set_option(struct pci_dev *dev, int options); /* * MMIO read/write operations with EEH support. */ -static inline u8 eeh_readb(void *addr) { +static inline u8 eeh_readb(const volatile void __iomem *addr) { volatile u8 *vaddr = (volatile u8 *)IO_TOKEN_TO_ADDR(addr); u8 val = in_8(vaddr); if (EEH_POSSIBLE_ERROR(addr, vaddr, val, u8)) return eeh_check_failure(addr, val); return val; } -static inline void eeh_writeb(u8 val, void *addr) { +static inline void eeh_writeb(u8 val, volatile void __iomem *addr) { volatile u8 *vaddr = (volatile u8 *)IO_TOKEN_TO_ADDR(addr); out_8(vaddr, val); } -static inline u16 eeh_readw(void *addr) { +static inline u16 eeh_readw(const volatile void __iomem *addr) { volatile u16 *vaddr = (volatile u16 *)IO_TOKEN_TO_ADDR(addr); u16 val = in_le16(vaddr); if (EEH_POSSIBLE_ERROR(addr, vaddr, val, u16)) return eeh_check_failure(addr, val); return val; } -static inline void eeh_writew(u16 val, void *addr) { +static inline void eeh_writew(u16 val, volatile void __iomem *addr) { volatile u16 *vaddr = (volatile u16 *)IO_TOKEN_TO_ADDR(addr); out_le16(vaddr, val); } -static inline u16 eeh_raw_readw(void *addr) { +static inline u16 eeh_raw_readw(const volatile void __iomem *addr) { volatile u16 *vaddr = (volatile u16 *)IO_TOKEN_TO_ADDR(addr); u16 val = in_be16(vaddr); if (EEH_POSSIBLE_ERROR(addr, vaddr, val, u16)) return eeh_check_failure(addr, val); return val; } -static inline void eeh_raw_writew(u16 val, void *addr) { +static inline void eeh_raw_writew(u16 val, volatile void __iomem *addr) { volatile u16 *vaddr = (volatile u16 *)IO_TOKEN_TO_ADDR(addr); out_be16(vaddr, val); } -static inline u32 eeh_readl(void *addr) { +static inline u32 eeh_readl(const volatile void __iomem *addr) { volatile u32 *vaddr = (volatile u32 *)IO_TOKEN_TO_ADDR(addr); u32 val = in_le32(vaddr); if (EEH_POSSIBLE_ERROR(addr, vaddr, val, u32)) return eeh_check_failure(addr, val); return val; } -static inline void eeh_writel(u32 val, void *addr) { +static inline void eeh_writel(u32 val, volatile void __iomem *addr) { volatile u32 *vaddr = (volatile u32 *)IO_TOKEN_TO_ADDR(addr); out_le32(vaddr, val); } -static inline u32 eeh_raw_readl(void *addr) { +static inline u32 eeh_raw_readl(const volatile void __iomem *addr) { volatile u32 *vaddr = (volatile u32 *)IO_TOKEN_TO_ADDR(addr); u32 val = in_be32(vaddr); if (EEH_POSSIBLE_ERROR(addr, vaddr, val, u32)) return eeh_check_failure(addr, val); return val; } -static inline void eeh_raw_writel(u32 val, void *addr) { +static inline void eeh_raw_writel(u32 val, volatile void __iomem *addr) { volatile u32 *vaddr = (volatile u32 *)IO_TOKEN_TO_ADDR(addr); out_be32(vaddr, val); } -static inline u64 eeh_readq(void *addr) { +static inline u64 eeh_readq(const volatile void __iomem *addr) { volatile u64 *vaddr = (volatile u64 *)IO_TOKEN_TO_ADDR(addr); u64 val = in_le64(vaddr); if (EEH_POSSIBLE_ERROR(addr, vaddr, val, u64)) return eeh_check_failure(addr, val); return val; } -static inline void eeh_writeq(u64 val, void *addr) { +static inline void eeh_writeq(u64 val, volatile void __iomem *addr) { volatile u64 *vaddr = (volatile u64 *)IO_TOKEN_TO_ADDR(addr); out_le64(vaddr, val); } -static inline u64 eeh_raw_readq(void *addr) { +static inline u64 eeh_raw_readq(const volatile void __iomem *addr) { volatile u64 *vaddr = (volatile u64 *)IO_TOKEN_TO_ADDR(addr); u64 val = in_be64(vaddr); if (EEH_POSSIBLE_ERROR(addr, vaddr, val, u64)) return eeh_check_failure(addr, val); return val; } -static inline void eeh_raw_writeq(u64 val, void *addr) { +static inline void eeh_raw_writeq(u64 val, volatile void __iomem *addr) { volatile u64 *vaddr = (volatile u64 *)IO_TOKEN_TO_ADDR(addr); out_be64(vaddr, val); } @@ -192,7 +192,7 @@ static inline void eeh_raw_writeq(u64 val, void *addr) { #define EEH_CHECK_ALIGN(v,a) \ ((((unsigned long)(v)) & ((a) - 1)) == 0) -static inline void eeh_memset_io(void *addr, int c, unsigned long n) { +static inline void eeh_memset_io(volatile void __iomem *addr, int c, unsigned long n) { void *vaddr = (void *)IO_TOKEN_TO_ADDR(addr); u32 lc = c; lc |= lc << 8; @@ -215,9 +215,10 @@ static inline void eeh_memset_io(void *addr, int c, unsigned long n) { } __asm__ __volatile__ ("sync" : : : "memory"); } -static inline void eeh_memcpy_fromio(void *dest, void *src, unsigned long n) { +static inline void eeh_memcpy_fromio(void *dest, const volatile void __iomem *src, unsigned long n) { void *vsrc = (void *)IO_TOKEN_TO_ADDR(src); - void *vsrcsave = vsrc, *destsave = dest, *srcsave = src; + void *vsrcsave = vsrc, *destsave = dest; + const volatile void __iomem *srcsave = src; unsigned long nsave = n; while(n && (!EEH_CHECK_ALIGN(vsrc, 4) || !EEH_CHECK_ALIGN(dest, 4))) { @@ -253,7 +254,7 @@ static inline void eeh_memcpy_fromio(void *dest, void *src, unsigned long n) { } } -static inline void eeh_memcpy_toio(void *dest, const void *src, unsigned long n) { +static inline void eeh_memcpy_toio(volatile void __iomem *dest, const void *src, unsigned long n) { void *vdest = (void *)IO_TOKEN_TO_ADDR(dest); while(n && (!EEH_CHECK_ALIGN(vdest, 4) || !EEH_CHECK_ALIGN(src, 4))) { @@ -289,7 +290,7 @@ static inline u8 eeh_inb(unsigned long port) { return ~0; val = in_8((u8 *)(port+pci_io_base)); if (EEH_POSSIBLE_IO_ERROR(val, u8)) - return eeh_check_failure((void*)(port), val); + return eeh_check_failure((void __iomem *)(port), val); return val; } @@ -304,7 +305,7 @@ static inline u16 eeh_inw(unsigned long port) { return ~0; val = in_le16((u16 *)(port+pci_io_base)); if (EEH_POSSIBLE_IO_ERROR(val, u16)) - return eeh_check_failure((void*)(port), val); + return eeh_check_failure((void __iomem *)(port), val); return val; } @@ -319,7 +320,7 @@ static inline u32 eeh_inl(unsigned long port) { return ~0; val = in_le32((u32 *)(port+pci_io_base)); if (EEH_POSSIBLE_IO_ERROR(val, u32)) - return eeh_check_failure((void*)(port), val); + return eeh_check_failure((void __iomem *)(port), val); return val; } @@ -332,19 +333,19 @@ static inline void eeh_outl(u32 val, unsigned long port) { static inline void eeh_insb(unsigned long port, void * buf, int ns) { _insb((u8 *)(port+pci_io_base), buf, ns); if (EEH_POSSIBLE_IO_ERROR((*(((u8*)buf)+ns-1)), u8)) - eeh_check_failure((void*)(port), *(u8*)buf); + eeh_check_failure((void __iomem *)(port), *(u8*)buf); } static inline void eeh_insw_ns(unsigned long port, void * buf, int ns) { _insw_ns((u16 *)(port+pci_io_base), buf, ns); if (EEH_POSSIBLE_IO_ERROR((*(((u16*)buf)+ns-1)), u16)) - eeh_check_failure((void*)(port), *(u16*)buf); + eeh_check_failure((void __iomem *)(port), *(u16*)buf); } static inline void eeh_insl_ns(unsigned long port, void * buf, int nl) { _insl_ns((u32 *)(port+pci_io_base), buf, nl); if (EEH_POSSIBLE_IO_ERROR((*(((u32*)buf)+nl-1)), u32)) - eeh_check_failure((void*)(port), *(u32*)buf); + eeh_check_failure((void __iomem *)(port), *(u32*)buf); } #endif /* _PPC64_EEH_H */ diff --git a/include/asm-ppc64/iSeries/iSeries_io.h b/include/asm-ppc64/iSeries/iSeries_io.h index 96b07b14610e..f52b7599b372 100644 --- a/include/asm-ppc64/iSeries/iSeries_io.h +++ b/include/asm-ppc64/iSeries/iSeries_io.h @@ -31,16 +31,16 @@ /* Created December 28, 2000 */ /* End Change Activity */ /************************************************************************/ -extern u8 iSeries_Read_Byte(void* IoAddress); -extern u16 iSeries_Read_Word(void* IoAddress); -extern u32 iSeries_Read_Long(void* IoAddress); -extern void iSeries_Write_Byte(u8 IoData,void* IoAddress); -extern void iSeries_Write_Word(u16 IoData,void* IoAddress); -extern void iSeries_Write_Long(u32 IoData,void* IoAddress); +extern u8 iSeries_Read_Byte(const volatile void __iomem * IoAddress); +extern u16 iSeries_Read_Word(const volatile void __iomem * IoAddress); +extern u32 iSeries_Read_Long(const volatile void __iomem * IoAddress); +extern void iSeries_Write_Byte(u8 IoData, volatile void __iomem * IoAddress); +extern void iSeries_Write_Word(u16 IoData, volatile void __iomem * IoAddress); +extern void iSeries_Write_Long(u32 IoData, volatile void __iomem * IoAddress); -extern void* iSeries_memset_io(void *dest, char x, size_t n); -extern void* iSeries_memcpy_toio(void *dest, void *source, size_t n); -extern void* iSeries_memcpy_fromio(void *dest, void *source, size_t n); +extern void iSeries_memset_io(volatile void __iomem *dest, char x, size_t n); +extern void iSeries_memcpy_toio(volatile void __iomem *dest, void *source, size_t n); +extern void iSeries_memcpy_fromio(void *dest, const volatile void __iomem *source, size_t n); #endif /* CONFIG_PPC_ISERIES */ #endif /* _ISERIES_IO_H */ diff --git a/include/asm-ppc64/io.h b/include/asm-ppc64/io.h index f6262bad7084..33c2dfff9815 100644 --- a/include/asm-ppc64/io.h +++ b/include/asm-ppc64/io.h @@ -9,6 +9,7 @@ */ #include <linux/config.h> +#include <linux/compiler.h> #include <asm/page.h> #include <asm/byteorder.h> #ifdef CONFIG_PPC_ISERIES @@ -41,21 +42,22 @@ extern unsigned long pci_io_base; #define __raw_writew(v, addr) { BUG(); 0; } #define __raw_writel(v, addr) { BUG(); 0; } #define __raw_writeq(v, addr) { BUG(); 0; } -#define readb(addr) iSeries_Read_Byte((void*)(addr)) -#define readw(addr) iSeries_Read_Word((void*)(addr)) -#define readl(addr) iSeries_Read_Long((void*)(addr)) -#define writeb(data, addr) iSeries_Write_Byte(data,((void*)(addr))) -#define writew(data, addr) iSeries_Write_Word(data,((void*)(addr))) -#define writel(data, addr) iSeries_Write_Long(data,((void*)(addr))) -#define memset_io(a,b,c) iSeries_memset_io((void *)(a),(b),(c)) -#define memcpy_fromio(a,b,c) iSeries_memcpy_fromio((void *)(a), (void *)(b), (c)) -#define memcpy_toio(a,b,c) iSeries_memcpy_toio((void *)(a), (void *)(b), (c)) -#define inb(addr) readb(((unsigned long)(addr))) -#define inw(addr) readw(((unsigned long)(addr))) -#define inl(addr) readl(((unsigned long)(addr))) -#define outb(data,addr) writeb(data,((unsigned long)(addr))) -#define outw(data,addr) writew(data,((unsigned long)(addr))) -#define outl(data,addr) writel(data,((unsigned long)(addr))) +#define readb(addr) iSeries_Read_Byte(addr) +#define readw(addr) iSeries_Read_Word(addr) +#define readl(addr) iSeries_Read_Long(addr) +#define writeb(data, addr) iSeries_Write_Byte((data),(addr)) +#define writew(data, addr) iSeries_Write_Word((data),(addr)) +#define writel(data, addr) iSeries_Write_Long((data),(addr)) +#define memset_io(a,b,c) iSeries_memset_io((a),(b),(c)) +#define memcpy_fromio(a,b,c) iSeries_memcpy_fromio((a), (b), (c)) +#define memcpy_toio(a,b,c) iSeries_memcpy_toio((a), (b), (c)) + +#define inb(addr) readb(((void __iomem *)(long)(addr))) +#define inw(addr) readw(((void __iomem *)(long)(addr))) +#define inl(addr) readl(((void __iomem *)(long)(addr))) +#define outb(data,addr) writeb(data,((void __iomem *)(long)(addr))) +#define outw(data,addr) writew(data,((void __iomem *)(long)(addr))) +#define outl(data,addr) writel(data,((void __iomem *)(long)(addr))) /* * The *_ns versions below don't do byte-swapping. * Neither do the standard versions now, these are just here @@ -64,25 +66,50 @@ extern unsigned long pci_io_base; #define insw_ns(port, buf, ns) _insw_ns((u16 *)((port)+pci_io_base), (buf), (ns)) #define insl_ns(port, buf, nl) _insl_ns((u32 *)((port)+pci_io_base), (buf), (nl)) #else -#define __raw_readb(addr) (*(volatile unsigned char *)(addr)) -#define __raw_readw(addr) (*(volatile unsigned short *)(addr)) -#define __raw_readl(addr) (*(volatile unsigned int *)(addr)) -#define __raw_readq(addr) (*(volatile unsigned long *)(addr)) -#define __raw_writeb(v, addr) (*(volatile unsigned char *)(addr) = (v)) -#define __raw_writew(v, addr) (*(volatile unsigned short *)(addr) = (v)) -#define __raw_writel(v, addr) (*(volatile unsigned int *)(addr) = (v)) -#define __raw_writeq(v, addr) (*(volatile unsigned long *)(addr) = (v)) -#define readb(addr) eeh_readb((void*)(addr)) -#define readw(addr) eeh_readw((void*)(addr)) -#define readl(addr) eeh_readl((void*)(addr)) -#define readq(addr) eeh_readq((void*)(addr)) -#define writeb(data, addr) eeh_writeb((data), ((void*)(addr))) -#define writew(data, addr) eeh_writew((data), ((void*)(addr))) -#define writel(data, addr) eeh_writel((data), ((void*)(addr))) -#define writeq(data, addr) eeh_writeq((data), ((void*)(addr))) -#define memset_io(a,b,c) eeh_memset_io((void *)(a),(b),(c)) -#define memcpy_fromio(a,b,c) eeh_memcpy_fromio((a),(void *)(b),(c)) -#define memcpy_toio(a,b,c) eeh_memcpy_toio((void *)(a),(b),(c)) + +static inline unsigned char __raw_readb(const volatile void __iomem *addr) +{ + return *(unsigned char __force *)addr; +} +static inline unsigned short __raw_readw(const volatile void __iomem *addr) +{ + return *(unsigned short __force *)addr; +} +static inline unsigned int __raw_readl(const volatile void __iomem *addr) +{ + return *(unsigned int __force *)addr; +} +static inline unsigned long __raw_readq(const volatile void __iomem *addr) +{ + return *(unsigned long __force *)addr; +} +static inline void __raw_writeb(unsigned char v, volatile void __iomem *addr) +{ + *(unsigned char __force *)addr = v; +} +static inline void __raw_writew(unsigned short v, volatile void __iomem *addr) +{ + *(unsigned short __force *)addr = v; +} +static inline void __raw_writel(unsigned int v, volatile void __iomem *addr) +{ + *(unsigned int __force *)addr = v; +} +static inline void __raw_writeq(unsigned long v, volatile void __iomem *addr) +{ + *(unsigned long __force *)addr = v; +} +#define readb(addr) eeh_readb(addr) +#define readw(addr) eeh_readw(addr) +#define readl(addr) eeh_readl(addr) +#define readq(addr) eeh_readq(addr) +#define writeb(data, addr) eeh_writeb((data), (addr)) +#define writew(data, addr) eeh_writew((data), (addr)) +#define writel(data, addr) eeh_writel((data), (addr)) +#define writeq(data, addr) eeh_writeq((data), (addr)) +#define memset_io(a,b,c) eeh_memset_io((a),(b),(c)) +#define memcpy_fromio(a,b,c) eeh_memcpy_fromio((a),(b),(c)) +#define memcpy_toio(a,b,c) eeh_memcpy_toio((a),(b),(c)) #define inb(port) eeh_inb((unsigned long)port) #define outb(val, port) eeh_outb(val, (unsigned long)port) #define inw(port) eeh_inw((unsigned long)port) @@ -149,7 +176,7 @@ extern void _outsl_ns(volatile u32 *port, const void *buf, int nl); #ifdef __KERNEL__ extern int __ioremap_explicit(unsigned long p_addr, unsigned long v_addr, unsigned long size, unsigned long flags); -extern void *__ioremap(unsigned long address, unsigned long size, +extern void __iomem *__ioremap(unsigned long address, unsigned long size, unsigned long flags); /** @@ -163,11 +190,11 @@ extern void *__ioremap(unsigned long address, unsigned long size, * address is not guaranteed to be usable directly as a virtual * address. */ -extern void *ioremap(unsigned long address, unsigned long size); +extern void __iomem *ioremap(unsigned long address, unsigned long size); #define ioremap_nocache(addr, size) ioremap((addr), (size)) -extern int iounmap_explicit(void *addr, unsigned long size); -extern void iounmap(void *addr); +extern int iounmap_explicit(volatile void __iomem *addr, unsigned long size); +extern void iounmap(volatile void __iomem *addr); extern void * reserve_phb_iospace(unsigned long size); /** @@ -377,7 +404,7 @@ static inline void out_be64(volatile unsigned long *addr, unsigned long val) * address should have been obtained by ioremap. * Returns 1 on a match. */ -static inline int check_signature(unsigned long io_addr, +static inline int check_signature(const volatile void __iomem * io_addr, const unsigned char *signature, int length) { int retval = 0; diff --git a/include/asm-x86_64/spinlock.h b/include/asm-x86_64/spinlock.h index 3177138f9e31..185e087e88ab 100644 --- a/include/asm-x86_64/spinlock.h +++ b/include/asm-x86_64/spinlock.h @@ -113,10 +113,8 @@ static inline int _raw_spin_trylock(spinlock_t *lock) static inline void _raw_spin_lock(spinlock_t *lock) { #ifdef CONFIG_DEBUG_SPINLOCK - __label__ here; -here: if (lock->magic != SPINLOCK_MAGIC) { -printk("eip: %p\n", &&here); + printk("eip: %p\n", __builtin_return_address(0)); BUG(); } #endif diff --git a/include/linux/adfs_fs.h b/include/linux/adfs_fs.h index 9b49e9fcfb7c..4a5d50c2bdbf 100644 --- a/include/linux/adfs_fs.h +++ b/include/linux/adfs_fs.h @@ -17,20 +17,20 @@ struct adfs_discrecord { __u8 bootoption; __u8 lowsector; __u8 nzones; - __u16 zone_spare; - __u32 root; - __u32 disc_size; - __u16 disc_id; + __le16 zone_spare; + __le32 root; + __le32 disc_size; + __le16 disc_id; __u8 disc_name[10]; - __u32 disc_type; - __u32 disc_size_high; + __le32 disc_type; + __le32 disc_size_high; __u8 log2sharesize:4; __u8 unused40:4; __u8 big_flag:1; __u8 unused41:1; __u8 nzones_high; - __u32 format_version; - __u32 root_size; + __le32 format_version; + __le32 root_size; __u8 unused52[60 - 52]; }; diff --git a/include/linux/adfs_fs_sb.h b/include/linux/adfs_fs_sb.h index 30082c823176..d9bf05c02ccc 100644 --- a/include/linux/adfs_fs_sb.h +++ b/include/linux/adfs_fs_sb.h @@ -31,7 +31,7 @@ struct adfs_sb_info { unsigned long s_size; /* total size (in blocks) of this fs */ signed int s_map2blk; /* shift left by this for map->sector */ unsigned int s_log2sharesize;/* log2 share size */ - unsigned int s_version; /* disc format version */ + __le32 s_version; /* disc format version */ unsigned int s_namelen; /* maximum number of characters in name */ }; diff --git a/include/linux/affs_hardblocks.h b/include/linux/affs_hardblocks.h index ae893e022f1a..3fb869939d82 100644 --- a/include/linux/affs_hardblocks.h +++ b/include/linux/affs_hardblocks.h @@ -5,13 +5,13 @@ struct RigidDiskBlock { u32 rdb_ID; - u32 rdb_SummedLongs; + __be32 rdb_SummedLongs; s32 rdb_ChkSum; u32 rdb_HostID; - u32 rdb_BlockBytes; + __be32 rdb_BlockBytes; u32 rdb_Flags; u32 rdb_BadBlockList; - u32 rdb_PartitionList; + __be32 rdb_PartitionList; u32 rdb_FileSysHeaderList; u32 rdb_DriveInit; u32 rdb_Reserved1[6]; @@ -45,17 +45,17 @@ struct RigidDiskBlock { #define IDNAME_RIGIDDISK 0x5244534B /* "RDSK" */ struct PartitionBlock { - u32 pb_ID; - u32 pb_SummedLongs; + __be32 pb_ID; + __be32 pb_SummedLongs; s32 pb_ChkSum; u32 pb_HostID; - u32 pb_Next; + __be32 pb_Next; u32 pb_Flags; u32 pb_Reserved1[2]; u32 pb_DevFlags; u8 pb_DriveName[32]; u32 pb_Reserved2[15]; - u32 pb_Environment[17]; + __be32 pb_Environment[17]; u32 pb_EReserved[15]; }; diff --git a/include/linux/amigaffs.h b/include/linux/amigaffs.h index 6fb6bb5c6696..b9a0ee68cbcf 100644 --- a/include/linux/amigaffs.h +++ b/include/linux/amigaffs.h @@ -80,14 +80,14 @@ affs_brelse(struct buffer_head *bh) static inline void affs_adjust_checksum(struct buffer_head *bh, u32 val) { - u32 tmp = be32_to_cpu(((u32 *)bh->b_data)[5]); - ((u32 *)bh->b_data)[5] = cpu_to_be32(tmp - val); + u32 tmp = be32_to_cpu(((__be32 *)bh->b_data)[5]); + ((__be32 *)bh->b_data)[5] = cpu_to_be32(tmp - val); } static inline void affs_adjust_bitmapchecksum(struct buffer_head *bh, u32 val) { - u32 tmp = be32_to_cpu(((u32 *)bh->b_data)[0]); - ((u32 *)bh->b_data)[0] = cpu_to_be32(tmp - val); + u32 tmp = be32_to_cpu(((__be32 *)bh->b_data)[0]); + ((__be32 *)bh->b_data)[0] = cpu_to_be32(tmp - val); } static inline void @@ -164,89 +164,89 @@ affs_unlock_ext(struct inode *inode) #define AFFS_DATA(bh) (((struct affs_data_head *)(bh)->b_data)->data) struct affs_date { - u32 days; - u32 mins; - u32 ticks; + __be32 days; + __be32 mins; + __be32 ticks; }; struct affs_short_date { - u16 days; - u16 mins; - u16 ticks; + __be16 days; + __be16 mins; + __be16 ticks; }; struct affs_root_head { - u32 ptype; - u32 spare1; - u32 spare2; - u32 hash_size; - u32 spare3; - u32 checksum; - u32 hashtable[1]; + __be32 ptype; + __be32 spare1; + __be32 spare2; + __be32 hash_size; + __be32 spare3; + __be32 checksum; + __be32 hashtable[1]; }; struct affs_root_tail { - u32 bm_flag; - u32 bm_blk[AFFS_ROOT_BMAPS]; - u32 bm_ext; + __be32 bm_flag; + __be32 bm_blk[AFFS_ROOT_BMAPS]; + __be32 bm_ext; struct affs_date root_change; u8 disk_name[32]; - u32 spare1; - u32 spare2; + __be32 spare1; + __be32 spare2; struct affs_date disk_change; struct affs_date disk_create; - u32 spare3; - u32 spare4; - u32 dcache; - u32 stype; + __be32 spare3; + __be32 spare4; + __be32 dcache; + __be32 stype; }; struct affs_head { - u32 ptype; - u32 key; - u32 block_count; - u32 spare1; - u32 first_data; - u32 checksum; - u32 table[1]; + __be32 ptype; + __be32 key; + __be32 block_count; + __be32 spare1; + __be32 first_data; + __be32 checksum; + __be32 table[1]; }; struct affs_tail { - u32 spare1; - u16 uid; - u16 gid; - u32 protect; - u32 size; + __be32 spare1; + __be16 uid; + __be16 gid; + __be32 protect; + __be32 size; u8 comment[92]; struct affs_date change; u8 name[32]; - u32 spare2; - u32 original; - u32 link_chain; - u32 spare[5]; - u32 hash_chain; - u32 parent; - u32 extension; - u32 stype; + __be32 spare2; + __be32 original; + __be32 link_chain; + __be32 spare[5]; + __be32 hash_chain; + __be32 parent; + __be32 extension; + __be32 stype; }; struct slink_front { - u32 ptype; - u32 key; - u32 spare1[3]; - u32 checksum; + __be32 ptype; + __be32 key; + __be32 spare1[3]; + __be32 checksum; u8 symname[1]; /* depends on block size */ }; struct affs_data_head { - u32 ptype; - u32 key; - u32 sequence; - u32 size; - u32 next; - u32 checksum; + __be32 ptype; + __be32 key; + __be32 sequence; + __be32 size; + __be32 next; + __be32 checksum; u8 data[1]; /* depends on block size */ }; diff --git a/include/linux/byteorder/big_endian.h b/include/linux/byteorder/big_endian.h index b84efd74c995..c2071cc9e5a1 100644 --- a/include/linux/byteorder/big_endian.h +++ b/include/linux/byteorder/big_endian.h @@ -8,48 +8,86 @@ #define __BIG_ENDIAN_BITFIELD #endif +#include <linux/types.h> #include <linux/byteorder/swab.h> #define __constant_htonl(x) ((__u32)(x)) #define __constant_ntohl(x) ((__u32)(x)) #define __constant_htons(x) ((__u16)(x)) #define __constant_ntohs(x) ((__u16)(x)) -#define __constant_cpu_to_le64(x) ___constant_swab64((x)) -#define __constant_le64_to_cpu(x) ___constant_swab64((x)) -#define __constant_cpu_to_le32(x) ___constant_swab32((x)) -#define __constant_le32_to_cpu(x) ___constant_swab32((x)) -#define __constant_cpu_to_le16(x) ___constant_swab16((x)) -#define __constant_le16_to_cpu(x) ___constant_swab16((x)) -#define __constant_cpu_to_be64(x) ((__u64)(x)) -#define __constant_be64_to_cpu(x) ((__u64)(x)) -#define __constant_cpu_to_be32(x) ((__u32)(x)) -#define __constant_be32_to_cpu(x) ((__u32)(x)) -#define __constant_cpu_to_be16(x) ((__u16)(x)) -#define __constant_be16_to_cpu(x) ((__u16)(x)) -#define __cpu_to_le64(x) __swab64((x)) -#define __le64_to_cpu(x) __swab64((x)) -#define __cpu_to_le32(x) __swab32((x)) -#define __le32_to_cpu(x) __swab32((x)) -#define __cpu_to_le16(x) __swab16((x)) -#define __le16_to_cpu(x) __swab16((x)) -#define __cpu_to_be64(x) ((__u64)(x)) -#define __be64_to_cpu(x) ((__u64)(x)) -#define __cpu_to_be32(x) ((__u32)(x)) -#define __be32_to_cpu(x) ((__u32)(x)) -#define __cpu_to_be16(x) ((__u16)(x)) -#define __be16_to_cpu(x) ((__u16)(x)) -#define __cpu_to_le64p(x) __swab64p((x)) -#define __le64_to_cpup(x) __swab64p((x)) -#define __cpu_to_le32p(x) __swab32p((x)) -#define __le32_to_cpup(x) __swab32p((x)) -#define __cpu_to_le16p(x) __swab16p((x)) -#define __le16_to_cpup(x) __swab16p((x)) -#define __cpu_to_be64p(x) (*(__u64*)(x)) -#define __be64_to_cpup(x) (*(__u64*)(x)) -#define __cpu_to_be32p(x) (*(__u32*)(x)) -#define __be32_to_cpup(x) (*(__u32*)(x)) -#define __cpu_to_be16p(x) (*(__u16*)(x)) -#define __be16_to_cpup(x) (*(__u16*)(x)) +#define __constant_cpu_to_le64(x) ((__force __le64)___constant_swab64((x))) +#define __constant_le64_to_cpu(x) ___constant_swab64((__force __u64)(__le64)(x)) +#define __constant_cpu_to_le32(x) ((__force __le32)___constant_swab32((x))) +#define __constant_le32_to_cpu(x) ___constant_swab32((__force __u32)(__le32)(x)) +#define __constant_cpu_to_le16(x) ((__force __le16)___constant_swab16((x))) +#define __constant_le16_to_cpu(x) ___constant_swab16((__force __u16)(__le16)(x)) +#define __constant_cpu_to_be64(x) ((__force __be64)(__u64)(x)) +#define __constant_be64_to_cpu(x) ((__force __u64)(__be64)(x)) +#define __constant_cpu_to_be32(x) ((__force __be32)(__u32)(x)) +#define __constant_be32_to_cpu(x) ((__force __u32)(__be32)(x)) +#define __constant_cpu_to_be16(x) ((__force __be16)(__u16)(x)) +#define __constant_be16_to_cpu(x) ((__force __u16)(__be16)(x)) +#define __cpu_to_le64(x) ((__force __le64)___swab64((x))) +#define __le64_to_cpu(x) ___swab64((__force __u64)(__le64)(x)) +#define __cpu_to_le32(x) ((__force __le32)___swab32((x))) +#define __le32_to_cpu(x) ___swab32((__force __u32)(__le32)(x)) +#define __cpu_to_le16(x) ((__force __le16)___swab16((x))) +#define __le16_to_cpu(x) ___swab16((__force __u16)(__le16)(x)) +#define __cpu_to_be64(x) ((__force __be64)(__u64)(x)) +#define __be64_to_cpu(x) ((__force __u64)(__be64)(x)) +#define __cpu_to_be32(x) ((__force __be32)(__u32)(x)) +#define __be32_to_cpu(x) ((__force __u32)(__be32)(x)) +#define __cpu_to_be16(x) ((__force __be16)(__u16)(x)) +#define __be16_to_cpu(x) ((__force __u16)(__be16)(x)) + +static inline __le64 __cpu_to_le64p(const __u64 *p) +{ + return (__force __le64)__swab64p(p); +} +static inline __u64 __le64_to_cpup(const __le64 *p) +{ + return __swab64p((__u64 *)p); +} +static inline __le32 __cpu_to_le32p(const __u32 *p) +{ + return (__force __le32)__swab32p(p); +} +static inline __u32 __le32_to_cpup(const __le32 *p) +{ + return __swab32p((__u32 *)p); +} +static inline __le16 __cpu_to_le16p(const __u16 *p) +{ + return (__force __le16)__swab16p(p); +} +static inline __u16 __le16_to_cpup(const __le16 *p) +{ + return __swab16p((__u16 *)p); +} +static inline __be64 __cpu_to_be64p(const __u64 *p) +{ + return (__force __be64)*p; +} +static inline __u64 __be64_to_cpup(const __be64 *p) +{ + return (__force __u64)*p; +} +static inline __be32 __cpu_to_be32p(const __u32 *p) +{ + return (__force __be32)*p; +} +static inline __u32 __be32_to_cpup(const __be32 *p) +{ + return (__force __u32)*p; +} +static inline __be16 __cpu_to_be16p(const __u16 *p) +{ + return (__force __be16)*p; +} +static inline __u16 __be16_to_cpup(const __be16 *p) +{ + return (__force __u16)*p; +} #define __cpu_to_le64s(x) __swab64s((x)) #define __le64_to_cpus(x) __swab64s((x)) #define __cpu_to_le32s(x) __swab32s((x)) diff --git a/include/linux/byteorder/little_endian.h b/include/linux/byteorder/little_endian.h index 143166362156..be51748878ea 100644 --- a/include/linux/byteorder/little_endian.h +++ b/include/linux/byteorder/little_endian.h @@ -8,48 +8,86 @@ #define __LITTLE_ENDIAN_BITFIELD #endif +#include <linux/types.h> #include <linux/byteorder/swab.h> #define __constant_htonl(x) ___constant_swab32((x)) #define __constant_ntohl(x) ___constant_swab32((x)) #define __constant_htons(x) ___constant_swab16((x)) #define __constant_ntohs(x) ___constant_swab16((x)) -#define __constant_cpu_to_le64(x) ((__u64)(x)) -#define __constant_le64_to_cpu(x) ((__u64)(x)) -#define __constant_cpu_to_le32(x) ((__u32)(x)) -#define __constant_le32_to_cpu(x) ((__u32)(x)) -#define __constant_cpu_to_le16(x) ((__u16)(x)) -#define __constant_le16_to_cpu(x) ((__u16)(x)) -#define __constant_cpu_to_be64(x) ___constant_swab64((x)) -#define __constant_be64_to_cpu(x) ___constant_swab64((x)) -#define __constant_cpu_to_be32(x) ___constant_swab32((x)) -#define __constant_be32_to_cpu(x) ___constant_swab32((x)) -#define __constant_cpu_to_be16(x) ___constant_swab16((x)) -#define __constant_be16_to_cpu(x) ___constant_swab16((x)) -#define __cpu_to_le64(x) ((__u64)(x)) -#define __le64_to_cpu(x) ((__u64)(x)) -#define __cpu_to_le32(x) ((__u32)(x)) -#define __le32_to_cpu(x) ((__u32)(x)) -#define __cpu_to_le16(x) ((__u16)(x)) -#define __le16_to_cpu(x) ((__u16)(x)) -#define __cpu_to_be64(x) __swab64((x)) -#define __be64_to_cpu(x) __swab64((x)) -#define __cpu_to_be32(x) __swab32((x)) -#define __be32_to_cpu(x) __swab32((x)) -#define __cpu_to_be16(x) __swab16((x)) -#define __be16_to_cpu(x) __swab16((x)) -#define __cpu_to_le64p(x) (*(__u64*)(x)) -#define __le64_to_cpup(x) (*(__u64*)(x)) -#define __cpu_to_le32p(x) (*(__u32*)(x)) -#define __le32_to_cpup(x) (*(__u32*)(x)) -#define __cpu_to_le16p(x) (*(__u16*)(x)) -#define __le16_to_cpup(x) (*(__u16*)(x)) -#define __cpu_to_be64p(x) __swab64p((x)) -#define __be64_to_cpup(x) __swab64p((x)) -#define __cpu_to_be32p(x) __swab32p((x)) -#define __be32_to_cpup(x) __swab32p((x)) -#define __cpu_to_be16p(x) __swab16p((x)) -#define __be16_to_cpup(x) __swab16p((x)) +#define __constant_cpu_to_le64(x) ((__force __le64)(__u64)(x)) +#define __constant_le64_to_cpu(x) ((__force __u64)(__le64)(x)) +#define __constant_cpu_to_le32(x) ((__force __le32)(__u32)(x)) +#define __constant_le32_to_cpu(x) ((__force __u32)(__le32)(x)) +#define __constant_cpu_to_le16(x) ((__force __le16)(__u16)(x)) +#define __constant_le16_to_cpu(x) ((__force __u16)(__le16)(x)) +#define __constant_cpu_to_be64(x) ((__force __be64)___constant_swab64((x))) +#define __constant_be64_to_cpu(x) ___constant_swab64((__force __u64)(__be64)(x)) +#define __constant_cpu_to_be32(x) ((__force __be32)___constant_swab32((x))) +#define __constant_be32_to_cpu(x) ___constant_swab32((__force __u32)(__be32)(x)) +#define __constant_cpu_to_be16(x) ((__force __be16)___constant_swab16((x))) +#define __constant_be16_to_cpu(x) ___constant_swab16((__force __u16)(__be16)(x)) +#define __cpu_to_le64(x) ((__force __le64)(__u64)(x)) +#define __le64_to_cpu(x) ((__force __u64)(__le64)(x)) +#define __cpu_to_le32(x) ((__force __le32)(__u32)(x)) +#define __le32_to_cpu(x) ((__force __u32)(__le32)(x)) +#define __cpu_to_le16(x) ((__force __le16)(__u16)(x)) +#define __le16_to_cpu(x) ((__force __u16)(__le16)(x)) +#define __cpu_to_be64(x) ((__force __be64)___swab64((x))) +#define __be64_to_cpu(x) ___swab64((__force __u64)(__be64)(x)) +#define __cpu_to_be32(x) ((__force __be32)___swab32((x))) +#define __be32_to_cpu(x) ___swab32((__force __u32)(__be32)(x)) +#define __cpu_to_be16(x) ((__force __be16)___swab16((x))) +#define __be16_to_cpu(x) ___swab16((__force __u16)(__be16)(x)) + +static inline __le64 __cpu_to_le64p(const __u64 *p) +{ + return (__force __le64)*p; +} +static inline __u64 __le64_to_cpup(const __le64 *p) +{ + return (__force __u64)*p; +} +static inline __le32 __cpu_to_le32p(const __u32 *p) +{ + return (__force __le32)*p; +} +static inline __u32 __le32_to_cpup(const __le32 *p) +{ + return (__force __u32)*p; +} +static inline __le16 __cpu_to_le16p(const __u16 *p) +{ + return (__force __le16)*p; +} +static inline __u16 __le16_to_cpup(const __le16 *p) +{ + return (__force __u16)*p; +} +static inline __be64 __cpu_to_be64p(const __u64 *p) +{ + return (__force __be64)__swab64p(p); +} +static inline __u64 __be64_to_cpup(const __be64 *p) +{ + return __swab64p((__u64 *)p); +} +static inline __be32 __cpu_to_be32p(const __u32 *p) +{ + return (__force __be32)__swab32p(p); +} +static inline __u32 __be32_to_cpup(const __be32 *p) +{ + return __swab32p((__u32 *)p); +} +static inline __be16 __cpu_to_be16p(const __u16 *p) +{ + return (__force __be16)__swab16p(p); +} +static inline __u16 __be16_to_cpup(const __be16 *p) +{ + return __swab16p((__u16 *)p); +} #define __cpu_to_le64s(x) do {} while (0) #define __le64_to_cpus(x) do {} while (0) #define __cpu_to_le32s(x) do {} while (0) diff --git a/include/linux/compiler.h b/include/linux/compiler.h index aabe12cb898c..62949aa638bb 100644 --- a/include/linux/compiler.h +++ b/include/linux/compiler.h @@ -6,13 +6,17 @@ # define __kernel /* default address space */ # define __safe __attribute__((safe)) # define __force __attribute__((force)) +# define __iomem __attribute__((noderef, address_space(2))) extern void __chk_user_ptr(void __user *); +extern void __chk_io_ptr(void __iomem *); #else # define __user # define __kernel # define __safe # define __force +# define __iomem # define __chk_user_ptr(x) (void)0 +# define __chk_io_ptr(x) (void)0 #endif #ifdef __KERNEL__ diff --git a/include/linux/ext2_fs.h b/include/linux/ext2_fs.h index d701ba88c688..fab43527e597 100644 --- a/include/linux/ext2_fs.h +++ b/include/linux/ext2_fs.h @@ -135,14 +135,14 @@ static inline struct ext2_sb_info *EXT2_SB(struct super_block *sb) */ struct ext2_group_desc { - __u32 bg_block_bitmap; /* Blocks bitmap block */ - __u32 bg_inode_bitmap; /* Inodes bitmap block */ - __u32 bg_inode_table; /* Inodes table block */ - __u16 bg_free_blocks_count; /* Free blocks count */ - __u16 bg_free_inodes_count; /* Free inodes count */ - __u16 bg_used_dirs_count; /* Directories count */ - __u16 bg_pad; - __u32 bg_reserved[3]; + __le32 bg_block_bitmap; /* Blocks bitmap block */ + __le32 bg_inode_bitmap; /* Inodes bitmap block */ + __le32 bg_inode_table; /* Inodes table block */ + __le16 bg_free_blocks_count; /* Free blocks count */ + __le16 bg_free_inodes_count; /* Free inodes count */ + __le16 bg_used_dirs_count; /* Directories count */ + __le16 bg_pad; + __le32 bg_reserved[3]; }; /* @@ -209,49 +209,49 @@ struct ext2_group_desc * Structure of an inode on the disk */ struct ext2_inode { - __u16 i_mode; /* File mode */ - __u16 i_uid; /* Low 16 bits of Owner Uid */ - __u32 i_size; /* Size in bytes */ - __u32 i_atime; /* Access time */ - __u32 i_ctime; /* Creation time */ - __u32 i_mtime; /* Modification time */ - __u32 i_dtime; /* Deletion Time */ - __u16 i_gid; /* Low 16 bits of Group Id */ - __u16 i_links_count; /* Links count */ - __u32 i_blocks; /* Blocks count */ - __u32 i_flags; /* File flags */ + __le16 i_mode; /* File mode */ + __le16 i_uid; /* Low 16 bits of Owner Uid */ + __le32 i_size; /* Size in bytes */ + __le32 i_atime; /* Access time */ + __le32 i_ctime; /* Creation time */ + __le32 i_mtime; /* Modification time */ + __le32 i_dtime; /* Deletion Time */ + __le16 i_gid; /* Low 16 bits of Group Id */ + __le16 i_links_count; /* Links count */ + __le32 i_blocks; /* Blocks count */ + __le32 i_flags; /* File flags */ union { struct { - __u32 l_i_reserved1; + __le32 l_i_reserved1; } linux1; struct { - __u32 h_i_translator; + __le32 h_i_translator; } hurd1; struct { - __u32 m_i_reserved1; + __le32 m_i_reserved1; } masix1; } osd1; /* OS dependent 1 */ - __u32 i_block[EXT2_N_BLOCKS];/* Pointers to blocks */ - __u32 i_generation; /* File version (for NFS) */ - __u32 i_file_acl; /* File ACL */ - __u32 i_dir_acl; /* Directory ACL */ - __u32 i_faddr; /* Fragment address */ + __le32 i_block[EXT2_N_BLOCKS];/* Pointers to blocks */ + __le32 i_generation; /* File version (for NFS) */ + __le32 i_file_acl; /* File ACL */ + __le32 i_dir_acl; /* Directory ACL */ + __le32 i_faddr; /* Fragment address */ union { struct { __u8 l_i_frag; /* Fragment number */ __u8 l_i_fsize; /* Fragment size */ __u16 i_pad1; - __u16 l_i_uid_high; /* these 2 fields */ - __u16 l_i_gid_high; /* were reserved2[0] */ + __le16 l_i_uid_high; /* these 2 fields */ + __le16 l_i_gid_high; /* were reserved2[0] */ __u32 l_i_reserved2; } linux2; struct { __u8 h_i_frag; /* Fragment number */ __u8 h_i_fsize; /* Fragment size */ - __u16 h_i_mode_high; - __u16 h_i_uid_high; - __u16 h_i_gid_high; - __u32 h_i_author; + __le16 h_i_mode_high; + __le16 h_i_uid_high; + __le16 h_i_gid_high; + __le32 h_i_author; } hurd2; struct { __u8 m_i_frag; /* Fragment number */ @@ -335,31 +335,31 @@ struct ext2_inode { * Structure of the super block */ struct ext2_super_block { - __u32 s_inodes_count; /* Inodes count */ - __u32 s_blocks_count; /* Blocks count */ - __u32 s_r_blocks_count; /* Reserved blocks count */ - __u32 s_free_blocks_count; /* Free blocks count */ - __u32 s_free_inodes_count; /* Free inodes count */ - __u32 s_first_data_block; /* First Data Block */ - __u32 s_log_block_size; /* Block size */ - __s32 s_log_frag_size; /* Fragment size */ - __u32 s_blocks_per_group; /* # Blocks per group */ - __u32 s_frags_per_group; /* # Fragments per group */ - __u32 s_inodes_per_group; /* # Inodes per group */ - __u32 s_mtime; /* Mount time */ - __u32 s_wtime; /* Write time */ - __u16 s_mnt_count; /* Mount count */ - __s16 s_max_mnt_count; /* Maximal mount count */ - __u16 s_magic; /* Magic signature */ - __u16 s_state; /* File system state */ - __u16 s_errors; /* Behaviour when detecting errors */ - __u16 s_minor_rev_level; /* minor revision level */ - __u32 s_lastcheck; /* time of last check */ - __u32 s_checkinterval; /* max. time between checks */ - __u32 s_creator_os; /* OS */ - __u32 s_rev_level; /* Revision level */ - __u16 s_def_resuid; /* Default uid for reserved blocks */ - __u16 s_def_resgid; /* Default gid for reserved blocks */ + __le32 s_inodes_count; /* Inodes count */ + __le32 s_blocks_count; /* Blocks count */ + __le32 s_r_blocks_count; /* Reserved blocks count */ + __le32 s_free_blocks_count; /* Free blocks count */ + __le32 s_free_inodes_count; /* Free inodes count */ + __le32 s_first_data_block; /* First Data Block */ + __le32 s_log_block_size; /* Block size */ + __le32 s_log_frag_size; /* Fragment size */ + __le32 s_blocks_per_group; /* # Blocks per group */ + __le32 s_frags_per_group; /* # Fragments per group */ + __le32 s_inodes_per_group; /* # Inodes per group */ + __le32 s_mtime; /* Mount time */ + __le32 s_wtime; /* Write time */ + __le16 s_mnt_count; /* Mount count */ + __le16 s_max_mnt_count; /* Maximal mount count */ + __le16 s_magic; /* Magic signature */ + __le16 s_state; /* File system state */ + __le16 s_errors; /* Behaviour when detecting errors */ + __le16 s_minor_rev_level; /* minor revision level */ + __le32 s_lastcheck; /* time of last check */ + __le32 s_checkinterval; /* max. time between checks */ + __le32 s_creator_os; /* OS */ + __le32 s_rev_level; /* Revision level */ + __le16 s_def_resuid; /* Default uid for reserved blocks */ + __le16 s_def_resgid; /* Default gid for reserved blocks */ /* * These fields are for EXT2_DYNAMIC_REV superblocks only. * @@ -373,16 +373,16 @@ struct ext2_super_block { * feature set, it must abort and not try to meddle with * things it doesn't understand... */ - __u32 s_first_ino; /* First non-reserved inode */ - __u16 s_inode_size; /* size of inode structure */ - __u16 s_block_group_nr; /* block group # of this superblock */ - __u32 s_feature_compat; /* compatible feature set */ - __u32 s_feature_incompat; /* incompatible feature set */ - __u32 s_feature_ro_compat; /* readonly-compatible feature set */ + __le32 s_first_ino; /* First non-reserved inode */ + __le16 s_inode_size; /* size of inode structure */ + __le16 s_block_group_nr; /* block group # of this superblock */ + __le32 s_feature_compat; /* compatible feature set */ + __le32 s_feature_incompat; /* incompatible feature set */ + __le32 s_feature_ro_compat; /* readonly-compatible feature set */ __u8 s_uuid[16]; /* 128-bit uuid for volume */ char s_volume_name[16]; /* volume name */ char s_last_mounted[64]; /* directory where last mounted */ - __u32 s_algorithm_usage_bitmap; /* For compression */ + __le32 s_algorithm_usage_bitmap; /* For compression */ /* * Performance hints. Directory preallocation should only * happen if the EXT2_COMPAT_PREALLOC flag is on. @@ -401,8 +401,8 @@ struct ext2_super_block { __u8 s_def_hash_version; /* Default hash version to use */ __u8 s_reserved_char_pad; __u16 s_reserved_word_pad; - __u32 s_default_mount_opts; - __u32 s_first_meta_bg; /* First metablock block group */ + __le32 s_default_mount_opts; + __le32 s_first_meta_bg; /* First metablock block group */ __u32 s_reserved[190]; /* Padding to the end of the block */ }; @@ -504,9 +504,9 @@ struct ext2_super_block { #define EXT2_NAME_LEN 255 struct ext2_dir_entry { - __u32 inode; /* Inode number */ - __u16 rec_len; /* Directory entry length */ - __u16 name_len; /* Name length */ + __le32 inode; /* Inode number */ + __le16 rec_len; /* Directory entry length */ + __le16 name_len; /* Name length */ char name[EXT2_NAME_LEN]; /* File name */ }; @@ -517,8 +517,8 @@ struct ext2_dir_entry { * file_type field. */ struct ext2_dir_entry_2 { - __u32 inode; /* Inode number */ - __u16 rec_len; /* Directory entry length */ + __le32 inode; /* Inode number */ + __le16 rec_len; /* Directory entry length */ __u8 name_len; /* Name length */ __u8 file_type; char name[EXT2_NAME_LEN]; /* File name */ diff --git a/include/linux/fb.h b/include/linux/fb.h index 673211d62204..190dcfd2e0b7 100644 --- a/include/linux/fb.h +++ b/include/linux/fb.h @@ -602,7 +602,7 @@ struct fb_info { struct fb_pixmap sprite; /* Cursor hardware mapper */ struct fb_cmap cmap; /* Current cmap */ struct fb_ops *fbops; - char *screen_base; /* Virtual address */ + char __iomem *screen_base; /* Virtual address */ int currcon; /* Current VC. */ void *pseudo_palette; /* Fake palette of 16 colors */ #define FBINFO_STATE_RUNNING 0 diff --git a/include/linux/ide.h b/include/linux/ide.h index 936790012164..6bdf3302f4be 100644 --- a/include/linux/ide.h +++ b/include/linux/ide.h @@ -51,9 +51,6 @@ #ifndef OK_TO_RESET_CONTROLLER /* 1 needed for good error recovery */ #define OK_TO_RESET_CONTROLLER 1 /* 0 for use with AH2372A/B interface */ #endif -#ifndef FANCY_STATUS_DUMPS /* 1 for human-readable drive errors */ -#define FANCY_STATUS_DUMPS 1 /* 0 to reduce kernel size */ -#endif #ifdef CONFIG_BLK_DEV_CMD640 #if 0 /* change to 1 when debugging cmd640 problems */ @@ -799,31 +796,6 @@ typedef struct ide_drive_s { struct gendisk *disk; } ide_drive_t; -typedef struct ide_pio_ops_s { - void (*ata_input_data)(ide_drive_t *, void *, u32); - void (*ata_output_data)(ide_drive_t *, void *, u32); - - void (*atapi_input_bytes)(ide_drive_t *, void *, u32); - void (*atapi_output_bytes)(ide_drive_t *, void *, u32); -} ide_pio_ops_t; - -typedef struct ide_dma_ops_s { - /* insert dma operations here! */ - int (*ide_dma_read)(ide_drive_t *drive); - int (*ide_dma_write)(ide_drive_t *drive); - int (*ide_dma_begin)(ide_drive_t *drive); - int (*ide_dma_end)(ide_drive_t *drive); - int (*ide_dma_check)(ide_drive_t *drive); - int (*ide_dma_on)(ide_drive_t *drive); - int (*ide_dma_off_quietly)(ide_drive_t *drive); - int (*ide_dma_test_irq)(ide_drive_t *drive); - int (*ide_dma_host_on)(ide_drive_t *drive); - int (*ide_dma_host_off)(ide_drive_t *drive); - int (*ide_dma_verbose)(ide_drive_t *drive); - int (*ide_dma_lostirq)(ide_drive_t *drive); - int (*ide_dma_timeout)(ide_drive_t *drive); -} ide_dma_ops_t; - /* * mapping stuff, prepare for highmem... * @@ -916,15 +888,11 @@ typedef struct hwif_s { // u8 (*ratefilter)(ide_drive_t *, u8); #endif -#if 0 - ide_pio_ops_t *pioops; -#else void (*ata_input_data)(ide_drive_t *, void *, u32); void (*ata_output_data)(ide_drive_t *, void *, u32); void (*atapi_input_bytes)(ide_drive_t *, void *, u32); void (*atapi_output_bytes)(ide_drive_t *, void *, u32); -#endif int (*ide_dma_read)(ide_drive_t *drive); int (*ide_dma_write)(ide_drive_t *drive); @@ -963,6 +931,9 @@ typedef struct hwif_s { int sg_dma_direction; /* dma transfer direction */ int sg_dma_active; /* is it in use */ + /* data phase of the active command (currently only valid for PIO/DMA) */ + int data_phase; + int mmio; /* hosts iomio (0) or custom (2) select */ int rqsize; /* max sectors per request */ int irq; /* our irq number */ @@ -989,6 +960,7 @@ typedef struct hwif_s { unsigned autodma : 1; /* auto-attempt using DMA at boot */ unsigned udma_four : 1; /* 1=ATA-66 capable, 0=default */ unsigned no_lba48 : 1; /* 1 = cannot do LBA48 */ + unsigned no_lba48_dma : 1; /* 1 = cannot do LBA48 DMA */ unsigned no_dsc : 1; /* 0 default, 1 dsc_overlap disabled */ unsigned auto_poll : 1; /* supports nop auto-poll */ @@ -1452,11 +1424,8 @@ extern ide_startstop_t set_geometry_intr(ide_drive_t *); extern ide_startstop_t recal_intr(ide_drive_t *); extern ide_startstop_t task_no_data_intr(ide_drive_t *); extern ide_startstop_t task_in_intr(ide_drive_t *); -extern ide_startstop_t task_mulin_intr(ide_drive_t *); extern ide_startstop_t pre_task_out_intr(ide_drive_t *, struct request *); extern ide_startstop_t task_out_intr(ide_drive_t *); -extern ide_startstop_t pre_task_mulout_intr(ide_drive_t *, struct request *); -extern ide_startstop_t task_mulout_intr(ide_drive_t *); extern int ide_raw_taskfile(ide_drive_t *, ide_task_t *, u8 *); diff --git a/include/linux/libata.h b/include/linux/libata.h index efacf9293f26..0de72a7fbcb7 100644 --- a/include/linux/libata.h +++ b/include/linux/libata.h @@ -196,7 +196,7 @@ struct ata_probe_ent { unsigned long irq; unsigned int irq_flags; unsigned long host_flags; - void *mmio_base; + void __iomem *mmio_base; void *private_data; }; @@ -204,7 +204,7 @@ struct ata_host_set { spinlock_t lock; struct pci_dev *pdev; unsigned long irq; - void *mmio_base; + void __iomem *mmio_base; unsigned int n_ports; void *private_data; struct ata_port_operations *ops; @@ -428,7 +428,7 @@ static inline unsigned int ata_dev_present(struct ata_device *dev) static inline u8 ata_chk_err(struct ata_port *ap) { if (ap->flags & ATA_FLAG_MMIO) { - return readb((void *) ap->ioaddr.error_addr); + return readb((void __iomem *) ap->ioaddr.error_addr); } return inb(ap->ioaddr.error_addr); } @@ -441,7 +441,7 @@ static inline u8 ata_chk_status(struct ata_port *ap) static inline u8 ata_altstatus(struct ata_port *ap) { if (ap->flags & ATA_FLAG_MMIO) - return readb(ap->ioaddr.altstatus_addr); + return readb((void __iomem *)ap->ioaddr.altstatus_addr); return inb(ap->ioaddr.altstatus_addr); } @@ -512,7 +512,7 @@ static inline u8 ata_irq_on(struct ata_port *ap) ap->last_ctl = ap->ctl; if (ap->flags & ATA_FLAG_MMIO) - writeb(ap->ctl, ioaddr->ctl_addr); + writeb(ap->ctl, (void __iomem *) ioaddr->ctl_addr); else outb(ap->ctl, ioaddr->ctl_addr); tmp = ata_wait_idle(ap); @@ -533,7 +533,7 @@ static inline u8 ata_irq_ack(struct ata_port *ap, unsigned int chk_drq) /* get controller status; clear intr, err bits */ if (ap->flags & ATA_FLAG_MMIO) { - void *mmio = (void *) ap->ioaddr.bmdma_addr; + void __iomem *mmio = (void __iomem *) ap->ioaddr.bmdma_addr; host_stat = readb(mmio + ATA_DMA_STATUS); writeb(host_stat | ATA_DMA_INTR | ATA_DMA_ERR, mmio + ATA_DMA_STATUS); @@ -571,7 +571,7 @@ static inline unsigned int sata_dev_present(struct ata_port *ap) static inline void ata_bmdma_stop(struct ata_port *ap) { if (ap->flags & ATA_FLAG_MMIO) { - void *mmio = (void *) ap->ioaddr.bmdma_addr; + void __iomem *mmio = (void __iomem *) ap->ioaddr.bmdma_addr; /* clear start/stop bit */ writeb(readb(mmio + ATA_DMA_CMD) & ~ATA_DMA_START, @@ -589,7 +589,7 @@ static inline void ata_bmdma_stop(struct ata_port *ap) static inline void ata_bmdma_ack_irq(struct ata_port *ap) { if (ap->flags & ATA_FLAG_MMIO) { - void *mmio = ((void *) ap->ioaddr.bmdma_addr) + ATA_DMA_STATUS; + void __iomem *mmio = ((void __iomem *) ap->ioaddr.bmdma_addr) + ATA_DMA_STATUS; writeb(readb(mmio), mmio); } else { unsigned long addr = ap->ioaddr.bmdma_addr + ATA_DMA_STATUS; @@ -601,7 +601,7 @@ static inline u8 ata_bmdma_status(struct ata_port *ap) { u8 host_stat; if (ap->flags & ATA_FLAG_MMIO) { - void *mmio = (void *) ap->ioaddr.bmdma_addr; + void __iomem *mmio = (void __iomem *) ap->ioaddr.bmdma_addr; host_stat = readb(mmio + ATA_DMA_STATUS); } else host_stat = inb(ap->ioaddr.bmdma_addr + ATA_DMA_STATUS); diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h index 62d21c00b9cc..a8a542ca89bf 100644 --- a/include/linux/netdevice.h +++ b/include/linux/netdevice.h @@ -677,6 +677,7 @@ extern int dev_ioctl(unsigned int cmd, void __user *); extern int dev_ethtool(struct ifreq *); extern unsigned dev_get_flags(const struct net_device *); extern int dev_change_flags(struct net_device *, unsigned); +extern int dev_change_name(struct net_device *, char *); extern int dev_set_mtu(struct net_device *, int); extern void dev_queue_xmit_nit(struct sk_buff *skb, struct net_device *dev); diff --git a/include/linux/rtnetlink.h b/include/linux/rtnetlink.h index 388b3d3feb43..e53c1e72701a 100644 --- a/include/linux/rtnetlink.h +++ b/include/linux/rtnetlink.h @@ -660,10 +660,6 @@ enum #define TCA_PAYLOAD(n) NLMSG_PAYLOAD(n,sizeof(struct tcmsg)) -/* SUMMARY: maximal rtattr understood by kernel */ - -#define RTATTR_MAX RTA_MAX - /* RTnetlink multicast groups */ #define RTMGRP_LINK 1 diff --git a/include/linux/spinlock.h b/include/linux/spinlock.h index 947abd3ff9bd..37852d55f946 100644 --- a/include/linux/spinlock.h +++ b/include/linux/spinlock.h @@ -68,11 +68,11 @@ void __lockfunc _write_unlock_irqrestore(rwlock_t *lock, unsigned long flags); void __lockfunc _write_unlock_irq(rwlock_t *lock); void __lockfunc _write_unlock_bh(rwlock_t *lock); int __lockfunc _spin_trylock_bh(spinlock_t *lock); - -extern unsigned long __lock_text_start; -extern unsigned long __lock_text_end; +int in_lock_functions(unsigned long addr); #else +#define in_lock_functions(ADDR) 0 + #if !defined(CONFIG_PREEMPT) && !defined(CONFIG_DEBUG_SPINLOCK) # define atomic_dec_and_lock(atomic,lock) atomic_dec_and_test(atomic) # define ATOMIC_DEC_AND_LOCK @@ -405,11 +405,6 @@ do { \ /* Where's read_trylock? */ -#if defined(CONFIG_SMP) && defined(CONFIG_PREEMPT) -void __preempt_spin_lock(spinlock_t *lock); -void __preempt_write_lock(rwlock_t *lock); -#endif - #define spin_lock(lock) _spin_lock(lock) #define write_lock(lock) _write_lock(lock) #define read_lock(lock) _read_lock(lock) diff --git a/include/linux/types.h b/include/linux/types.h index 23c414f11cbe..13ccdf3036fd 100644 --- a/include/linux/types.h +++ b/include/linux/types.h @@ -140,6 +140,19 @@ typedef unsigned long sector_t; #define pgoff_t unsigned long #endif +#ifdef __CHECKER__ +#define __bitwise __attribute__((bitwise)) +#else +#define __bitwise +#endif + +typedef __u16 __bitwise __le16; +typedef __u16 __bitwise __be16; +typedef __u32 __bitwise __le32; +typedef __u32 __bitwise __be32; +typedef __u64 __bitwise __le64; +typedef __u64 __bitwise __be64; + #endif /* __KERNEL_STRICT_NAMES */ /* diff --git a/include/linux/udf_fs_i.h b/include/linux/udf_fs_i.h index 186a5a47b50b..62b15a4214e6 100644 --- a/include/linux/udf_fs_i.h +++ b/include/linux/udf_fs_i.h @@ -45,7 +45,7 @@ struct udf_inode_info { struct timespec i_crtime; /* Physical address of inode */ - lb_addr i_location; + kernel_lb_addr i_location; __u64 i_unique; __u32 i_lenEAttr; __u32 i_lenAlloc; diff --git a/include/net/inet_ecn.h b/include/net/inet_ecn.h index 8d0df10e4549..2aee47abb463 100644 --- a/include/net/inet_ecn.h +++ b/include/net/inet_ecn.h @@ -49,19 +49,25 @@ static inline __u8 INET_ECN_encapsulate(__u8 outer, __u8 inner) static inline void IP_ECN_set_ce(struct iphdr *iph) { u32 check = iph->check; - - switch (iph->tos & INET_ECN_MASK) { - default: - case INET_ECN_NOT_ECT: - case INET_ECN_CE: + u32 ecn = (iph->tos + 1) & INET_ECN_MASK; + + /* + * After the last operation we have (in binary): + * INET_ECN_NOT_ECT => 01 + * INET_ECN_ECT_1 => 10 + * INET_ECN_ECT_0 => 11 + * INET_ECN_CE => 00 + */ + if (!(ecn & 2)) return; - case INET_ECN_ECT_1: - check += __constant_htons(0xFFFD); - break; - case INET_ECN_ECT_0: - check += __constant_htons(0xFFFE); - break; - } + + /* + * The following gives us: + * INET_ECN_ECT_1 => check += htons(0xFFFD) + * INET_ECN_ECT_0 => check += htons(0xFFFE) + */ + check += htons(0xFFFB) + htons(ecn); + iph->check = check + (check>=0xFFFF); iph->tos |= INET_ECN_CE; } diff --git a/include/net/ipcomp.h b/include/net/ipcomp.h index e94a6488a7ee..e651a57ecdd5 100644 --- a/include/net/ipcomp.h +++ b/include/net/ipcomp.h @@ -5,8 +5,7 @@ struct ipcomp_data { u16 threshold; - u8 *scratch; - struct crypto_tfm *tfm; + struct crypto_tfm **tfms; }; #endif diff --git a/include/net/pkt_act.h b/include/net/pkt_act.h index be5d651e4fe3..e7e7da355012 100644 --- a/include/net/pkt_act.h +++ b/include/net/pkt_act.h @@ -212,9 +212,8 @@ tcf_hash_search(struct tc_action *a, u32 index) if (p != NULL) { a->priv = p; return 1; - } else { - return 0; } + return 0; } #ifdef CONFIG_NET_ACT_INIT diff --git a/include/net/tcp.h b/include/net/tcp.h index 1a8a317f2bd5..55790f842afc 100644 --- a/include/net/tcp.h +++ b/include/net/tcp.h @@ -954,7 +954,6 @@ extern int tcp_write_wakeup(struct sock *); extern void tcp_send_fin(struct sock *sk); extern void tcp_send_active_reset(struct sock *sk, int priority); extern int tcp_send_synack(struct sock *); -extern int tcp_transmit_skb(struct sock *, struct sk_buff *); extern void tcp_push_one(struct sock *, unsigned mss_now); extern void tcp_send_ack(struct sock *sk); extern void tcp_send_delayed_ack(struct sock *sk); @@ -1469,7 +1468,7 @@ tcp_nagle_check(struct tcp_opt *tp, struct sk_buff *skb, unsigned mss_now, int n tcp_minshall_check(tp)))); } -extern void tcp_set_skb_tso_factor(struct sk_buff *, unsigned int, unsigned int); +extern void tcp_set_skb_tso_factor(struct sk_buff *, unsigned int); /* This checks if the data bearing packet SKB (usually sk->sk_send_head) * should be put on the wire right now. @@ -1480,7 +1479,7 @@ static __inline__ int tcp_snd_test(struct tcp_opt *tp, struct sk_buff *skb, int pkts = TCP_SKB_CB(skb)->tso_factor; if (!pkts) { - tcp_set_skb_tso_factor(skb, cur_mss, tp->mss_cache_std); + tcp_set_skb_tso_factor(skb, tp->mss_cache_std); pkts = TCP_SKB_CB(skb)->tso_factor; } diff --git a/include/net/xfrm.h b/include/net/xfrm.h index 40c65dbb4fb1..b5c9b1028583 100644 --- a/include/net/xfrm.h +++ b/include/net/xfrm.h @@ -896,4 +896,17 @@ typedef void (icv_update_fn_t)(struct crypto_tfm *, struct scatterlist *, unsign extern void skb_icv_walk(const struct sk_buff *skb, struct crypto_tfm *tfm, int offset, int len, icv_update_fn_t icv_update); +static inline int xfrm_addr_cmp(xfrm_address_t *a, xfrm_address_t *b, + int family) +{ + switch (family) { + default: + case AF_INET: + return a->a4 - b->a4; + case AF_INET6: + return ipv6_addr_cmp((struct in6_addr *)a, + (struct in6_addr *)b); + } +} + #endif /* _NET_XFRM_H */ diff --git a/kernel/sched.c b/kernel/sched.c index 075c100a5d6e..7dd6c27f6094 100644 --- a/kernel/sched.c +++ b/kernel/sched.c @@ -4654,8 +4654,9 @@ int in_sched_functions(unsigned long addr) { /* Linker adds these: start and end of __sched functions */ extern char __sched_text_start[], __sched_text_end[]; - return addr >= (unsigned long)__sched_text_start - && addr < (unsigned long)__sched_text_end; + return in_lock_functions(addr) || + (addr >= (unsigned long)__sched_text_start + && addr < (unsigned long)__sched_text_end); } void __init sched_init(void) @@ -4747,49 +4748,3 @@ void __might_sleep(char *file, int line) } EXPORT_SYMBOL(__might_sleep); #endif - - -#if defined(CONFIG_SMP) && defined(CONFIG_PREEMPT) -/* - * This could be a long-held lock. If another CPU holds it for a long time, - * and that CPU is not asked to reschedule then *this* CPU will spin on the - * lock for a long time, even if *this* CPU is asked to reschedule. - * - * So what we do here, in the slow (contended) path is to spin on the lock by - * hand while permitting preemption. - * - * Called inside preempt_disable(). - */ -void __sched __preempt_spin_lock(spinlock_t *lock) -{ - if (preempt_count() > 1) { - _raw_spin_lock(lock); - return; - } - do { - preempt_enable(); - while (spin_is_locked(lock)) - cpu_relax(); - preempt_disable(); - } while (!_raw_spin_trylock(lock)); -} - -EXPORT_SYMBOL(__preempt_spin_lock); - -void __sched __preempt_write_lock(rwlock_t *lock) -{ - if (preempt_count() > 1) { - _raw_write_lock(lock); - return; - } - - do { - preempt_enable(); - while (rwlock_is_locked(lock)) - cpu_relax(); - preempt_disable(); - } while (!_raw_write_trylock(lock)); -} - -EXPORT_SYMBOL(__preempt_write_lock); -#endif /* defined(CONFIG_SMP) && defined(CONFIG_PREEMPT) */ diff --git a/kernel/spinlock.c b/kernel/spinlock.c index fdbe640b3243..476da1fd86f4 100644 --- a/kernel/spinlock.c +++ b/kernel/spinlock.c @@ -33,7 +33,32 @@ int __lockfunc _write_trylock(rwlock_t *lock) } EXPORT_SYMBOL(_write_trylock); -#if defined(CONFIG_SMP) && defined(CONFIG_PREEMPT) +#ifdef CONFIG_PREEMPT +/* + * This could be a long-held lock. If another CPU holds it for a long time, + * and that CPU is not asked to reschedule then *this* CPU will spin on the + * lock for a long time, even if *this* CPU is asked to reschedule. + * + * So what we do here, in the slow (contended) path is to spin on the lock by + * hand while permitting preemption. + * + * Called inside preempt_disable(). + */ +static inline void __preempt_spin_lock(spinlock_t *lock) +{ + if (preempt_count() > 1) { + _raw_spin_lock(lock); + return; + } + + do { + preempt_enable(); + while (spin_is_locked(lock)) + cpu_relax(); + preempt_disable(); + } while (!_raw_spin_trylock(lock)); +} + void __lockfunc _spin_lock(spinlock_t *lock) { preempt_disable(); @@ -41,6 +66,21 @@ void __lockfunc _spin_lock(spinlock_t *lock) __preempt_spin_lock(lock); } +static inline void __preempt_write_lock(rwlock_t *lock) +{ + if (preempt_count() > 1) { + _raw_write_lock(lock); + return; + } + + do { + preempt_enable(); + while (rwlock_is_locked(lock)) + cpu_relax(); + preempt_disable(); + } while (!_raw_write_trylock(lock)); +} + void __lockfunc _write_lock(rwlock_t *lock) { preempt_disable(); @@ -256,3 +296,13 @@ int __lockfunc _spin_trylock_bh(spinlock_t *lock) return 0; } EXPORT_SYMBOL(_spin_trylock_bh); + +int in_lock_functions(unsigned long addr) +{ + /* Linker adds these: start and end of __lockfunc functions */ + extern char __lock_text_start[], __lock_text_end[]; + + return addr >= (unsigned long)__lock_text_start + && addr < (unsigned long)__lock_text_end; +} +EXPORT_SYMBOL(in_lock_functions); diff --git a/mm/highmem.c b/mm/highmem.c index 432da5b68baf..c4debe257647 100644 --- a/mm/highmem.c +++ b/mm/highmem.c @@ -284,7 +284,7 @@ static void copy_to_high_bio_irq(struct bio *to, struct bio *from) struct bio_vec *tovec, *fromvec; int i; - bio_for_each_segment(tovec, to, i) { + __bio_for_each_segment(tovec, to, i, 0) { fromvec = from->bi_io_vec + i; /* @@ -316,7 +316,7 @@ static void bounce_end_io(struct bio *bio, mempool_t *pool) /* * free up bounce indirect pages used */ - bio_for_each_segment(bvec, bio, i) { + __bio_for_each_segment(bvec, bio, i, 0) { org_vec = bio_orig->bi_io_vec + i; if (bvec->bv_page == org_vec->bv_page) continue; diff --git a/net/8021q/vlan_dev.c b/net/8021q/vlan_dev.c index 460aabc09d29..5e8e9460c85d 100644 --- a/net/8021q/vlan_dev.c +++ b/net/8021q/vlan_dev.c @@ -244,7 +244,7 @@ int vlan_skb_recv(struct sk_buff *skb, struct net_device *dev, /* TODO: Add a more specific counter here. */ stats->rx_errors++; } - rcu_read_lock(); + rcu_read_unlock(); return 0; } @@ -772,7 +772,7 @@ int vlan_dev_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd) case SIOCGMIIREG: case SIOCSMIIREG: if (real_dev->do_ioctl && netif_device_present(real_dev)) - err = real_dev->do_ioctl(dev, &ifrr, cmd); + err = real_dev->do_ioctl(real_dev, &ifrr, cmd); break; case SIOCETHTOOL: diff --git a/net/core/dev.c b/net/core/dev.c index 47b3d8497a5d..4829caa535ed 100644 --- a/net/core/dev.c +++ b/net/core/dev.c @@ -3347,6 +3347,7 @@ EXPORT_SYMBOL(dev_remove_pack); EXPORT_SYMBOL(dev_set_allmulti); EXPORT_SYMBOL(dev_set_promiscuity); EXPORT_SYMBOL(dev_change_flags); +EXPORT_SYMBOL(dev_change_name); EXPORT_SYMBOL(dev_set_mtu); EXPORT_SYMBOL(free_netdev); EXPORT_SYMBOL(netdev_boot_setup_check); diff --git a/net/core/rtnetlink.c b/net/core/rtnetlink.c index 24c9551c45b5..41d6c115ed4a 100644 --- a/net/core/rtnetlink.c +++ b/net/core/rtnetlink.c @@ -345,6 +345,23 @@ static int do_setlink(struct sk_buff *skb, struct nlmsghdr *nlh, void *arg) dev->weight = *((u32 *) RTA_DATA(ida[IFLA_WEIGHT - 1])); } + if (ida[IFLA_IFNAME - 1]) { + char ifname[IFNAMSIZ]; + + if (ida[IFLA_IFNAME - 1]->rta_len > RTA_LENGTH(sizeof(ifname))) + goto out; + + memset(ifname, 0, sizeof(ifname)); + memcpy(ifname, RTA_DATA(ida[IFLA_IFNAME - 1]), + RTA_PAYLOAD(ida[IFLA_IFNAME - 1])); + ifname[IFNAMSIZ - 1] = '\0'; + + err = dev_change_name(dev, ifname); + + if (err) + goto out; + } + err = 0; out: @@ -401,6 +418,10 @@ static int rtnetlink_done(struct netlink_callback *cb) return 0; } +/* Protected by RTNL sempahore. */ +static struct rtattr **rta_buf; +static int rtattr_max; + /* Process one rtnetlink message. */ static __inline__ int @@ -408,8 +429,6 @@ rtnetlink_rcv_msg(struct sk_buff *skb, struct nlmsghdr *nlh, int *errp) { struct rtnetlink_link *link; struct rtnetlink_link *link_tab; - struct rtattr *rta[RTATTR_MAX]; - int sz_idx, kind; int min_len; int family; @@ -476,7 +495,7 @@ rtnetlink_rcv_msg(struct sk_buff *skb, struct nlmsghdr *nlh, int *errp) return -1; } - memset(&rta, 0, sizeof(rta)); + memset(rta_buf, 0, (rtattr_max * sizeof(struct rtattr *))); min_len = rtm_min[sz_idx]; if (nlh->nlmsg_len < min_len) @@ -491,7 +510,7 @@ rtnetlink_rcv_msg(struct sk_buff *skb, struct nlmsghdr *nlh, int *errp) if (flavor) { if (flavor > rta_max[sz_idx]) goto err_inval; - rta[flavor-1] = attr; + rta_buf[flavor-1] = attr; } attr = RTA_NEXT(attr, attrlen); } @@ -501,7 +520,7 @@ rtnetlink_rcv_msg(struct sk_buff *skb, struct nlmsghdr *nlh, int *errp) link = &(rtnetlink_links[PF_UNSPEC][type]); if (link->doit == NULL) goto err_inval; - err = link->doit(skb, nlh, (void *)&rta); + err = link->doit(skb, nlh, (void *)&rta_buf[0]); *errp = err; return err; @@ -621,6 +640,16 @@ static struct notifier_block rtnetlink_dev_notifier = { void __init rtnetlink_init(void) { + int i; + + rtattr_max = 0; + for (i = 0; i < ARRAY_SIZE(rta_max); i++) + if (rta_max[i] > rtattr_max) + rtattr_max = rta_max[i]; + rta_buf = kmalloc(rtattr_max * sizeof(struct rtattr *), GFP_KERNEL); + if (!rta_buf) + panic("rtnetlink_init: cannot allocate rta_buf\n"); + rtnl = netlink_kernel_create(NETLINK_ROUTE, rtnetlink_rcv); if (rtnl == NULL) panic("rtnetlink_init: cannot initialize rtnetlink\n"); diff --git a/net/ipv4/ipcomp.c b/net/ipv4/ipcomp.c index 095028111e64..6845207f2edd 100644 --- a/net/ipv4/ipcomp.c +++ b/net/ipv4/ipcomp.c @@ -16,25 +16,48 @@ #include <linux/config.h> #include <linux/module.h> #include <asm/scatterlist.h> +#include <asm/semaphore.h> #include <linux/crypto.h> #include <linux/pfkeyv2.h> +#include <linux/percpu.h> +#include <linux/smp.h> +#include <linux/list.h> +#include <linux/vmalloc.h> +#include <linux/rtnetlink.h> #include <net/ip.h> #include <net/xfrm.h> #include <net/icmp.h> #include <net/ipcomp.h> +struct ipcomp_tfms { + struct list_head list; + struct crypto_tfm **tfms; + int users; +}; + +static DECLARE_MUTEX(ipcomp_resource_sem); +static void **ipcomp_scratches; +static int ipcomp_scratch_users; +static LIST_HEAD(ipcomp_tfms_list); + static int ipcomp_decompress(struct xfrm_state *x, struct sk_buff *skb) { int err, plen, dlen; struct iphdr *iph; struct ipcomp_data *ipcd = x->data; - u8 *start, *scratch = ipcd->scratch; + u8 *start, *scratch; + struct crypto_tfm *tfm; + int cpu; plen = skb->len; dlen = IPCOMP_SCRATCH_SIZE; start = skb->data; - err = crypto_comp_decompress(ipcd->tfm, start, plen, scratch, &dlen); + cpu = get_cpu(); + scratch = *per_cpu_ptr(ipcomp_scratches, cpu); + tfm = *per_cpu_ptr(ipcd->tfms, cpu); + + err = crypto_comp_decompress(tfm, start, plen, scratch, &dlen); if (err) goto out; @@ -52,6 +75,7 @@ static int ipcomp_decompress(struct xfrm_state *x, struct sk_buff *skb) iph = skb->nh.iph; iph->tot_len = htons(dlen + iph->ihl * 4); out: + put_cpu(); return err; } @@ -97,14 +121,20 @@ static int ipcomp_compress(struct xfrm_state *x, struct sk_buff *skb) int err, plen, dlen, ihlen; struct iphdr *iph = skb->nh.iph; struct ipcomp_data *ipcd = x->data; - u8 *start, *scratch = ipcd->scratch; + u8 *start, *scratch; + struct crypto_tfm *tfm; + int cpu; ihlen = iph->ihl * 4; plen = skb->len - ihlen; dlen = IPCOMP_SCRATCH_SIZE; start = skb->data + ihlen; - err = crypto_comp_compress(ipcd->tfm, start, plen, scratch, &dlen); + cpu = get_cpu(); + scratch = *per_cpu_ptr(ipcomp_scratches, cpu); + tfm = *per_cpu_ptr(ipcd->tfms, cpu); + + err = crypto_comp_compress(tfm, start, plen, scratch, &dlen); if (err) goto out; @@ -114,9 +144,13 @@ static int ipcomp_compress(struct xfrm_state *x, struct sk_buff *skb) } memcpy(start + sizeof(struct ip_comp_hdr), scratch, dlen); + put_cpu(); + pskb_trim(skb, ihlen + dlen + sizeof(struct ip_comp_hdr)); + return 0; out: + put_cpu(); return err; } @@ -260,12 +294,132 @@ out: return err; } +static void ipcomp_free_scratches(void) +{ + int i; + void **scratches; + + if (--ipcomp_scratch_users) + return; + + scratches = ipcomp_scratches; + if (!scratches) + return; + + for_each_cpu(i) { + void *scratch = *per_cpu_ptr(scratches, i); + if (scratch) + vfree(scratch); + } + + free_percpu(scratches); +} + +static void **ipcomp_alloc_scratches(void) +{ + int i; + void **scratches; + + if (ipcomp_scratch_users++) + return ipcomp_scratches; + + scratches = alloc_percpu(void *); + if (!scratches) + return NULL; + + ipcomp_scratches = scratches; + + for_each_cpu(i) { + void *scratch = vmalloc(IPCOMP_SCRATCH_SIZE); + if (!scratch) + return NULL; + *per_cpu_ptr(scratches, i) = scratch; + } + + return scratches; +} + +static void ipcomp_free_tfms(struct crypto_tfm **tfms) +{ + struct ipcomp_tfms *pos; + int cpu; + + list_for_each_entry(pos, &ipcomp_tfms_list, list) { + if (pos->tfms == tfms) + break; + } + + BUG_TRAP(pos); + + if (--pos->users) + return; + + list_del(&pos->list); + kfree(pos); + + if (!tfms) + return; + + for_each_cpu(cpu) { + struct crypto_tfm *tfm = *per_cpu_ptr(tfms, cpu); + if (tfm) + crypto_free_tfm(tfm); + } + free_percpu(tfms); +} + +static struct crypto_tfm **ipcomp_alloc_tfms(const char *alg_name) +{ + struct ipcomp_tfms *pos; + struct crypto_tfm **tfms; + int cpu; + + /* This can be any valid CPU ID so we don't need locking. */ + cpu = smp_processor_id(); + + list_for_each_entry(pos, &ipcomp_tfms_list, list) { + struct crypto_tfm *tfm; + + tfms = pos->tfms; + tfm = *per_cpu_ptr(tfms, cpu); + + if (!strcmp(crypto_tfm_alg_name(tfm), alg_name)) { + pos->users++; + return tfms; + } + } + + pos = kmalloc(sizeof(*pos), GFP_KERNEL); + if (!pos) + return NULL; + + pos->users = 1; + INIT_LIST_HEAD(&pos->list); + list_add(&pos->list, &ipcomp_tfms_list); + + pos->tfms = tfms = alloc_percpu(struct crypto_tfm *); + if (!tfms) + goto error; + + for_each_cpu(cpu) { + struct crypto_tfm *tfm = crypto_alloc_tfm(alg_name, 0); + if (!tfm) + goto error; + *per_cpu_ptr(tfms, cpu) = tfm; + } + + return tfms; + +error: + ipcomp_free_tfms(tfms); + return NULL; +} + static void ipcomp_free_data(struct ipcomp_data *ipcd) { - if (ipcd->tfm) - crypto_free_tfm(ipcd->tfm); - if (ipcd->scratch) - kfree(ipcd->scratch); + if (ipcd->tfms) + ipcomp_free_tfms(ipcd->tfms); + ipcomp_free_scratches(); } static void ipcomp_destroy(struct xfrm_state *x) @@ -274,7 +428,9 @@ static void ipcomp_destroy(struct xfrm_state *x) if (!ipcd) return; xfrm_state_delete_tunnel(x); + down(&ipcomp_resource_sem); ipcomp_free_data(ipcd); + up(&ipcomp_resource_sem); kfree(ipcd); } @@ -294,25 +450,26 @@ static int ipcomp_init_state(struct xfrm_state *x, void *args) err = -ENOMEM; ipcd = kmalloc(sizeof(*ipcd), GFP_KERNEL); if (!ipcd) - goto error; + goto out; memset(ipcd, 0, sizeof(*ipcd)); x->props.header_len = 0; if (x->props.mode) x->props.header_len += sizeof(struct iphdr); - ipcd->scratch = kmalloc(IPCOMP_SCRATCH_SIZE, GFP_KERNEL); - if (!ipcd->scratch) + down(&ipcomp_resource_sem); + if (!ipcomp_alloc_scratches()) goto error; - - ipcd->tfm = crypto_alloc_tfm(x->calg->alg_name, 0); - if (!ipcd->tfm) + + ipcd->tfms = ipcomp_alloc_tfms(x->calg->alg_name); + if (!ipcd->tfms) goto error; + up(&ipcomp_resource_sem); if (x->props.mode) { err = ipcomp_tunnel_attach(x); if (err) - goto error; + goto error_tunnel; } calg_desc = xfrm_calg_get_byname(x->calg->alg_name); @@ -323,11 +480,12 @@ static int ipcomp_init_state(struct xfrm_state *x, void *args) out: return err; +error_tunnel: + down(&ipcomp_resource_sem); error: - if (ipcd) { - ipcomp_free_data(ipcd); - kfree(ipcd); - } + ipcomp_free_data(ipcd); + up(&ipcomp_resource_sem); + kfree(ipcd); goto out; } diff --git a/net/ipv4/ipconfig.c b/net/ipv4/ipconfig.c index 9fd8ed153ea3..4228dcf0e90c 100644 --- a/net/ipv4/ipconfig.c +++ b/net/ipv4/ipconfig.c @@ -966,9 +966,7 @@ static int __init ic_bootp_recv(struct sk_buff *skb, struct net_device *dev, str break; case DHCPACK: - for (i = 0; (dev->dev_addr[i] == b->hw_addr[i]) - && (i < dev->addr_len); i++); - if (i < dev->addr_len) + if (memcmp(dev->dev_addr, b->hw_addr, dev->addr_len) != 0) goto drop_unlock; /* Yeah! */ diff --git a/net/ipv4/netfilter/ip_conntrack_standalone.c b/net/ipv4/netfilter/ip_conntrack_standalone.c index f4c3899771c4..0af744a38655 100644 --- a/net/ipv4/netfilter/ip_conntrack_standalone.c +++ b/net/ipv4/netfilter/ip_conntrack_standalone.c @@ -48,6 +48,8 @@ MODULE_LICENSE("GPL"); extern atomic_t ip_conntrack_count; DECLARE_PER_CPU(struct ip_conntrack_stat, ip_conntrack_stat); +unsigned int ip_ct_log_invalid = 0; + static int kill_proto(const struct ip_conntrack *i, void *data) { return (i->tuplehash[IP_CT_DIR_ORIGINAL].tuple.dst.protonum == @@ -524,7 +526,6 @@ extern unsigned long ip_ct_icmp_timeout; extern unsigned long ip_ct_generic_timeout; /* Log invalid packets of a given protocol */ -unsigned int ip_ct_log_invalid = 0; static int log_invalid_proto_min = 0; static int log_invalid_proto_max = 255; diff --git a/net/ipv4/tcp_output.c b/net/ipv4/tcp_output.c index 36a345ece94c..535e438a3276 100644 --- a/net/ipv4/tcp_output.c +++ b/net/ipv4/tcp_output.c @@ -257,7 +257,7 @@ static __inline__ u16 tcp_select_window(struct sock *sk) * We are working here with either a clone of the original * SKB, or a fresh unique copy made by the retransmit engine. */ -int tcp_transmit_skb(struct sock *sk, struct sk_buff *skb) +static int tcp_transmit_skb(struct sock *sk, struct sk_buff *skb) { if (skb != NULL) { struct inet_opt *inet = inet_sk(sk); @@ -422,8 +422,7 @@ void tcp_push_one(struct sock *sk, unsigned cur_mss) } } -void tcp_set_skb_tso_factor(struct sk_buff *skb, unsigned int mss, - unsigned int mss_std) +void tcp_set_skb_tso_factor(struct sk_buff *skb, unsigned int mss_std) { if (skb->len <= mss_std) { /* Avoid the costly divide in the normal @@ -434,7 +433,7 @@ void tcp_set_skb_tso_factor(struct sk_buff *skb, unsigned int mss, unsigned int factor; factor = skb->len + (mss_std - 1); - factor /= mss; + factor /= mss_std; TCP_SKB_CB(skb)->tso_factor = factor; } } @@ -474,10 +473,6 @@ static int tcp_fragment(struct sock *sk, struct sk_buff *skb, u32 len) TCP_SKB_CB(buff)->sacked = (TCP_SKB_CB(skb)->sacked & (TCPCB_LOST | TCPCB_EVER_RETRANS | TCPCB_AT_TAIL)); - if (TCP_SKB_CB(buff)->sacked&TCPCB_LOST) { - tcp_inc_pcount(&tp->lost_out, buff); - tcp_inc_pcount(&tp->left_out, buff); - } TCP_SKB_CB(skb)->sacked &= ~TCPCB_AT_TAIL; if (!skb_shinfo(skb)->nr_frags && skb->ip_summed != CHECKSUM_HW) { @@ -501,8 +496,13 @@ static int tcp_fragment(struct sock *sk, struct sk_buff *skb, u32 len) TCP_SKB_CB(buff)->when = TCP_SKB_CB(skb)->when; /* Fix up tso_factor for both original and new SKB. */ - tcp_set_skb_tso_factor(skb, tp->mss_cache, tp->mss_cache_std); - tcp_set_skb_tso_factor(buff, tp->mss_cache, tp->mss_cache_std); + tcp_set_skb_tso_factor(skb, tp->mss_cache_std); + tcp_set_skb_tso_factor(buff, tp->mss_cache_std); + + if (TCP_SKB_CB(buff)->sacked&TCPCB_LOST) { + tcp_inc_pcount(&tp->lost_out, buff); + tcp_inc_pcount(&tp->left_out, buff); + } /* Link BUFF into the send queue. */ __skb_append(skb, buff); @@ -681,8 +681,12 @@ int tcp_write_xmit(struct sock *sk, int nonagle) TCP_SKB_CB(skb)->when = tcp_time_stamp; if (tcp_transmit_skb(sk, skb_clone(skb, GFP_ATOMIC))) break; - /* Advance the send_head. This one is sent out. */ + + /* Advance the send_head. This one is sent out. + * This call will increment packets_out. + */ update_send_head(sk, tp, skb); + tcp_minshall_update(tp, mss_now, skb); sent_pkts = 1; } @@ -968,11 +972,17 @@ int tcp_retransmit_skb(struct sock *sk, struct sk_buff *skb) return -EAGAIN; if (skb->len > cur_mss) { + int old_factor = TCP_SKB_CB(skb)->tso_factor; + int new_factor; + if (tcp_fragment(sk, skb, cur_mss)) return -ENOMEM; /* We'll try again later. */ /* New SKB created, account for it. */ - tcp_inc_pcount(&tp->packets_out, skb); + new_factor = TCP_SKB_CB(skb)->tso_factor; + tcp_dec_pcount_explicit(&tp->packets_out, + new_factor - old_factor); + tcp_inc_pcount(&tp->packets_out, skb->next); } /* Collapse two adjacent packets if worthwhile and we can. */ @@ -1055,12 +1065,15 @@ void tcp_xmit_retransmit_queue(struct sock *sk) if (packet_cnt) { sk_stream_for_retrans_queue(skb, sk) { __u8 sacked = TCP_SKB_CB(skb)->sacked; - int pkts = TCP_SKB_CB(skb)->tso_factor; - - BUG_ON(!pkts); - if ((tcp_packets_in_flight(tp) + (pkts-1)) >= - tp->snd_cwnd) + /* Assume this retransmit will generate + * only one packet for congestion window + * calculation purposes. This works because + * tcp_retransmit_skb() will chop up the + * packet to be MSS sized and all the + * packet counting works out. + */ + if (tcp_packets_in_flight(tp) >= tp->snd_cwnd) return; if (sacked&TCPCB_LOST) { @@ -1107,15 +1120,16 @@ void tcp_xmit_retransmit_queue(struct sock *sk) packet_cnt = 0; sk_stream_for_retrans_queue(skb, sk) { - int pkts = TCP_SKB_CB(skb)->tso_factor; - - BUG_ON(!pkts); - - packet_cnt += pkts; - if (packet_cnt > tcp_get_pcount(&tp->fackets_out)) + /* Similar to the retransmit loop above we + * can pretend that the retransmitted SKB + * we send out here will be composed of one + * real MSS sized packet because tcp_retransmit_skb() + * will fragment it if necessary. + */ + if (++packet_cnt > tcp_get_pcount(&tp->fackets_out)) break; - if ((tcp_packets_in_flight(tp) + (pkts-1)) >= tp->snd_cwnd) + if (tcp_packets_in_flight(tp) >= tp->snd_cwnd) break; if (TCP_SKB_CB(skb)->sacked & TCPCB_TAGBITS) @@ -1561,7 +1575,7 @@ int tcp_write_wakeup(struct sock *sk) tp->mss_cache = tp->mss_cache_std; } } else if (!TCP_SKB_CB(skb)->tso_factor) - tcp_set_skb_tso_factor(skb, mss, tp->mss_cache_std); + tcp_set_skb_tso_factor(skb, tp->mss_cache_std); TCP_SKB_CB(skb)->flags |= TCPCB_FLAG_PSH; TCP_SKB_CB(skb)->when = tcp_time_stamp; @@ -1624,6 +1638,5 @@ EXPORT_SYMBOL(tcp_make_synack); EXPORT_SYMBOL(tcp_send_synack); EXPORT_SYMBOL(tcp_simple_retransmit); EXPORT_SYMBOL(tcp_sync_mss); -EXPORT_SYMBOL(tcp_transmit_skb); EXPORT_SYMBOL(tcp_write_wakeup); EXPORT_SYMBOL(tcp_write_xmit); diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c index d2091c5ce489..999071accc71 100644 --- a/net/ipv6/addrconf.c +++ b/net/ipv6/addrconf.c @@ -2108,21 +2108,13 @@ static void addrconf_rs_timer(unsigned long data) ndisc_send_rs(ifp->idev->dev, &ifp->addr, &all_routers); } else { - struct in6_rtmsg rtmsg; - spin_unlock(&ifp->lock); - + /* + * Note: we do not support deprecated "all on-link" + * assumption any longer. + */ printk(KERN_DEBUG "%s: no IPv6 routers present\n", ifp->idev->dev->name); - - memset(&rtmsg, 0, sizeof(struct in6_rtmsg)); - rtmsg.rtmsg_type = RTMSG_NEWROUTE; - rtmsg.rtmsg_metric = IP6_RT_PRIO_ADDRCONF; - rtmsg.rtmsg_flags = (RTF_ALLONLINK | RTF_DEFAULT | RTF_UP); - - rtmsg.rtmsg_ifindex = ifp->idev->dev->ifindex; - - ip6_route_add(&rtmsg, NULL, NULL); } out: diff --git a/net/ipv6/ip6_tunnel.c b/net/ipv6/ip6_tunnel.c index 0c8db0391a78..a2353a1fba20 100644 --- a/net/ipv6/ip6_tunnel.c +++ b/net/ipv6/ip6_tunnel.c @@ -48,6 +48,8 @@ #include <net/addrconf.h> #include <net/ip6_tunnel.h> #include <net/xfrm.h> +#include <net/dsfield.h> +#include <net/inet_ecn.h> MODULE_AUTHOR("Ville Nuorvala"); MODULE_DESCRIPTION("IPv6-in-IPv6 tunnel"); @@ -490,6 +492,15 @@ out: read_unlock(&ip6ip6_lock); } +static inline void ip6ip6_ecn_decapsulate(struct ipv6hdr *outer_iph, + struct sk_buff *skb) +{ + struct ipv6hdr *inner_iph = skb->nh.ipv6h; + + if (INET_ECN_is_ce(ipv6_get_dsfield(outer_iph))) + IP6_ECN_set_ce(inner_iph); +} + /** * ip6ip6_rcv - decapsulate IPv6 packet and retransmit it locally * @skb: received socket buffer @@ -531,6 +542,7 @@ ip6ip6_rcv(struct sk_buff **pskb, unsigned int *nhoffp) skb->dev = t->dev; dst_release(skb->dst); skb->dst = NULL; + ip6ip6_ecn_decapsulate(ipv6h, skb); t->stat.rx_packets++; t->stat.rx_bytes += skb->len; netif_rx(skb); @@ -621,6 +633,7 @@ ip6ip6_tnl_xmit(struct sk_buff *skb, struct net_device *dev) u8 proto; int err; int pkt_len; + int dsfield; if (t->recursion++) { stats->collisions++; @@ -646,6 +659,7 @@ ip6ip6_tnl_xmit(struct sk_buff *skb, struct net_device *dev) memcpy(&fl, &t->fl, sizeof (fl)); proto = fl.proto; + dsfield = ipv6_get_dsfield(ipv6h); if ((t->parms.flags & IP6_TNL_F_USE_ORIG_TCLASS)) fl.fl6_flowlabel |= (*(__u32 *) ipv6h & IPV6_TCLASS_MASK); if ((t->parms.flags & IP6_TNL_F_USE_ORIG_FLOWLABEL)) @@ -717,6 +731,8 @@ ip6ip6_tnl_xmit(struct sk_buff *skb, struct net_device *dev) skb->nh.raw = skb_push(skb, sizeof(struct ipv6hdr)); ipv6h = skb->nh.ipv6h; *(u32*)ipv6h = fl.fl6_flowlabel | htonl(0x60000000); + dsfield = INET_ECN_encapsulate(0, dsfield); + ipv6_change_dsfield(ipv6h, ~INET_ECN_MASK, dsfield); ipv6h->payload_len = htons(skb->len - sizeof(struct ipv6hdr)); ipv6h->hop_limit = t->parms.hop_limit; ipv6h->nexthdr = proto; diff --git a/net/ipv6/ipcomp6.c b/net/ipv6/ipcomp6.c index 8f5296e3f9d0..f3093f2cd430 100644 --- a/net/ipv6/ipcomp6.c +++ b/net/ipv6/ipcomp6.c @@ -36,14 +36,31 @@ #include <net/xfrm.h> #include <net/ipcomp.h> #include <asm/scatterlist.h> +#include <asm/semaphore.h> #include <linux/crypto.h> #include <linux/pfkeyv2.h> #include <linux/random.h> +#include <linux/percpu.h> +#include <linux/smp.h> +#include <linux/list.h> +#include <linux/vmalloc.h> +#include <linux/rtnetlink.h> #include <net/icmp.h> #include <net/ipv6.h> #include <linux/ipv6.h> #include <linux/icmpv6.h> +struct ipcomp6_tfms { + struct list_head list; + struct crypto_tfm **tfms; + int users; +}; + +static DECLARE_MUTEX(ipcomp6_resource_sem); +static void **ipcomp6_scratches; +static int ipcomp6_scratch_users; +static LIST_HEAD(ipcomp6_tfms_list); + static int ipcomp6_input(struct xfrm_state *x, struct xfrm_decap_state *decap, struct sk_buff *skb) { int err = 0; @@ -53,7 +70,9 @@ static int ipcomp6_input(struct xfrm_state *x, struct xfrm_decap_state *decap, s struct ipv6hdr *iph; int plen, dlen; struct ipcomp_data *ipcd = x->data; - u8 *start, *scratch = ipcd->scratch; + u8 *start, *scratch; + struct crypto_tfm *tfm; + int cpu; if ((skb_is_nonlinear(skb) || skb_cloned(skb)) && skb_linearize(skb, GFP_ATOMIC) != 0) { @@ -82,20 +101,24 @@ static int ipcomp6_input(struct xfrm_state *x, struct xfrm_decap_state *decap, s dlen = IPCOMP_SCRATCH_SIZE; start = skb->data; - err = crypto_comp_decompress(ipcd->tfm, start, plen, scratch, &dlen); + cpu = get_cpu(); + scratch = *per_cpu_ptr(ipcomp6_scratches, cpu); + tfm = *per_cpu_ptr(ipcd->tfms, cpu); + + err = crypto_comp_decompress(tfm, start, plen, scratch, &dlen); if (err) { err = -EINVAL; - goto out; + goto out_put_cpu; } if (dlen < (plen + sizeof(struct ipv6_comp_hdr))) { err = -EINVAL; - goto out; + goto out_put_cpu; } err = pskb_expand_head(skb, 0, dlen - plen, GFP_ATOMIC); if (err) { - goto out; + goto out_put_cpu; } skb_put(skb, dlen - plen); @@ -104,6 +127,8 @@ static int ipcomp6_input(struct xfrm_state *x, struct xfrm_decap_state *decap, s iph = skb->nh.ipv6h; iph->payload_len = htons(skb->len); +out_put_cpu: + put_cpu(); out: if (tmp_hdr) kfree(tmp_hdr); @@ -124,7 +149,9 @@ static int ipcomp6_output(struct sk_buff *skb) struct ipv6_comp_hdr *ipch; struct ipcomp_data *ipcd = x->data; int plen, dlen; - u8 *start, *scratch = ipcd->scratch; + u8 *start, *scratch; + struct crypto_tfm *tfm; + int cpu; hdr_len = skb->h.raw - skb->data; @@ -144,14 +171,21 @@ static int ipcomp6_output(struct sk_buff *skb) dlen = IPCOMP_SCRATCH_SIZE; start = skb->h.raw; - err = crypto_comp_compress(ipcd->tfm, start, plen, scratch, &dlen); + cpu = get_cpu(); + scratch = *per_cpu_ptr(ipcomp6_scratches, cpu); + tfm = *per_cpu_ptr(ipcd->tfms, cpu); + + err = crypto_comp_compress(tfm, start, plen, scratch, &dlen); if (err) { + put_cpu(); goto error; } if ((dlen + sizeof(struct ipv6_comp_hdr)) >= plen) { + put_cpu(); goto out_ok; } memcpy(start + sizeof(struct ip_comp_hdr), scratch, dlen); + put_cpu(); pskb_trim(skb, hdr_len + dlen + sizeof(struct ip_comp_hdr)); /* insert ipcomp header and replace datagram */ @@ -254,12 +288,132 @@ out: return err; } +static void ipcomp6_free_scratches(void) +{ + int i; + void **scratches; + + if (--ipcomp6_scratch_users) + return; + + scratches = ipcomp6_scratches; + if (!scratches) + return; + + for_each_cpu(i) { + void *scratch = *per_cpu_ptr(scratches, i); + if (scratch) + vfree(scratch); + } + + free_percpu(scratches); +} + +static void **ipcomp6_alloc_scratches(void) +{ + int i; + void **scratches; + + if (ipcomp6_scratch_users++) + return ipcomp6_scratches; + + scratches = alloc_percpu(void *); + if (!scratches) + return NULL; + + ipcomp6_scratches = scratches; + + for_each_cpu(i) { + void *scratch = vmalloc(IPCOMP_SCRATCH_SIZE); + if (!scratch) + return NULL; + *per_cpu_ptr(scratches, i) = scratch; + } + + return scratches; +} + +static void ipcomp6_free_tfms(struct crypto_tfm **tfms) +{ + struct ipcomp6_tfms *pos; + int cpu; + + list_for_each_entry(pos, &ipcomp6_tfms_list, list) { + if (pos->tfms == tfms) + break; + } + + BUG_TRAP(pos); + + if (--pos->users) + return; + + list_del(&pos->list); + kfree(pos); + + if (!tfms) + return; + + for_each_cpu(cpu) { + struct crypto_tfm *tfm = *per_cpu_ptr(tfms, cpu); + if (tfm) + crypto_free_tfm(tfm); + } + free_percpu(tfms); +} + +static struct crypto_tfm **ipcomp6_alloc_tfms(const char *alg_name) +{ + struct ipcomp6_tfms *pos; + struct crypto_tfm **tfms; + int cpu; + + /* This can be any valid CPU ID so we don't need locking. */ + cpu = smp_processor_id(); + + list_for_each_entry(pos, &ipcomp6_tfms_list, list) { + struct crypto_tfm *tfm; + + tfms = pos->tfms; + tfm = *per_cpu_ptr(tfms, cpu); + + if (!strcmp(crypto_tfm_alg_name(tfm), alg_name)) { + pos->users++; + return tfms; + } + } + + pos = kmalloc(sizeof(*pos), GFP_KERNEL); + if (!pos) + return NULL; + + pos->users = 1; + INIT_LIST_HEAD(&pos->list); + list_add(&pos->list, &ipcomp6_tfms_list); + + pos->tfms = tfms = alloc_percpu(struct crypto_tfm *); + if (!tfms) + goto error; + + for_each_cpu(cpu) { + struct crypto_tfm *tfm = crypto_alloc_tfm(alg_name, 0); + if (!tfm) + goto error; + *per_cpu_ptr(tfms, cpu) = tfm; + } + + return tfms; + +error: + ipcomp6_free_tfms(tfms); + return NULL; +} + static void ipcomp6_free_data(struct ipcomp_data *ipcd) { - if (ipcd->tfm) - crypto_free_tfm(ipcd->tfm); - if (ipcd->scratch) - kfree(ipcd->scratch); + if (ipcd->tfms) + ipcomp6_free_tfms(ipcd->tfms); + ipcomp6_free_scratches(); } static void ipcomp6_destroy(struct xfrm_state *x) @@ -268,7 +422,9 @@ static void ipcomp6_destroy(struct xfrm_state *x) if (!ipcd) return; xfrm_state_delete_tunnel(x); + down(&ipcomp6_resource_sem); ipcomp6_free_data(ipcd); + up(&ipcomp6_resource_sem); kfree(ipcd); xfrm6_tunnel_free_spi((xfrm_address_t *)&x->props.saddr); @@ -290,25 +446,26 @@ static int ipcomp6_init_state(struct xfrm_state *x, void *args) err = -ENOMEM; ipcd = kmalloc(sizeof(*ipcd), GFP_KERNEL); if (!ipcd) - goto error; + goto out; memset(ipcd, 0, sizeof(*ipcd)); x->props.header_len = 0; if (x->props.mode) x->props.header_len += sizeof(struct ipv6hdr); - ipcd->scratch = kmalloc(IPCOMP_SCRATCH_SIZE, GFP_KERNEL); - if (!ipcd->scratch) + down(&ipcomp6_resource_sem); + if (!ipcomp6_alloc_scratches()) goto error; - ipcd->tfm = crypto_alloc_tfm(x->calg->alg_name, 0); - if (!ipcd->tfm) + ipcd->tfms = ipcomp6_alloc_tfms(x->calg->alg_name); + if (!ipcd->tfms) goto error; + up(&ipcomp6_resource_sem); if (x->props.mode) { err = ipcomp6_tunnel_attach(x); if (err) - goto error; + goto error_tunnel; } calg_desc = xfrm_calg_get_byname(x->calg->alg_name); @@ -318,11 +475,12 @@ static int ipcomp6_init_state(struct xfrm_state *x, void *args) err = 0; out: return err; +error_tunnel: + down(&ipcomp6_resource_sem); error: - if (ipcd) { - ipcomp6_free_data(ipcd); - kfree(ipcd); - } + ipcomp6_free_data(ipcd); + up(&ipcomp6_resource_sem); + kfree(ipcd); goto out; } diff --git a/net/ipv6/xfrm6_output.c b/net/ipv6/xfrm6_output.c index b67187525d3c..40612ec54305 100644 --- a/net/ipv6/xfrm6_output.c +++ b/net/ipv6/xfrm6_output.c @@ -12,6 +12,7 @@ #include <linux/skbuff.h> #include <linux/spinlock.h> #include <linux/icmpv6.h> +#include <net/dsfield.h> #include <net/inet_ecn.h> #include <net/ipv6.h> #include <net/xfrm.h> @@ -36,6 +37,7 @@ static void xfrm6_encap(struct sk_buff *skb) struct dst_entry *dst = skb->dst; struct xfrm_state *x = dst->xfrm; struct ipv6hdr *iph, *top_iph; + int dsfield; skb_push(skb, x->props.header_len); iph = skb->nh.ipv6h; @@ -58,11 +60,14 @@ static void xfrm6_encap(struct sk_buff *skb) top_iph->version = 6; top_iph->priority = iph->priority; - if (x->props.flags & XFRM_STATE_NOECN) - IP6_ECN_clear(top_iph); top_iph->flow_lbl[0] = iph->flow_lbl[0]; top_iph->flow_lbl[1] = iph->flow_lbl[1]; top_iph->flow_lbl[2] = iph->flow_lbl[2]; + dsfield = ipv6_get_dsfield(top_iph); + dsfield = INET_ECN_encapsulate(dsfield, dsfield); + if (x->props.flags & XFRM_STATE_NOECN) + dsfield &= ~INET_ECN_MASK; + ipv6_change_dsfield(top_iph, 0, dsfield); top_iph->nexthdr = IPPROTO_IPV6; top_iph->hop_limit = dst_path_metric(dst, RTAX_HOPLIMIT); ipv6_addr_copy(&top_iph->saddr, (struct in6_addr *)&x->props.saddr); diff --git a/net/key/af_key.c b/net/key/af_key.c index 8ca25fd7efe7..b059fa2931f0 100644 --- a/net/key/af_key.c +++ b/net/key/af_key.c @@ -1156,7 +1156,16 @@ static int pfkey_getspi(struct sock *sk, struct sk_buff *skb, struct sadb_msg *h break; #endif } - if (xdaddr) + + if (hdr->sadb_msg_seq) { + x = xfrm_find_acq_byseq(hdr->sadb_msg_seq); + if (x && xfrm_addr_cmp(&x->id.daddr, xdaddr, family)) { + xfrm_state_put(x); + x = NULL; + } + } + + if (!x) x = xfrm_find_acq(mode, reqid, proto, xdaddr, xsaddr, 1, family); if (x == NULL) diff --git a/net/xfrm/xfrm_state.c b/net/xfrm/xfrm_state.c index f45fa55c2c6c..835c92afcdcf 100644 --- a/net/xfrm/xfrm_state.c +++ b/net/xfrm/xfrm_state.c @@ -387,13 +387,17 @@ void xfrm_state_insert(struct xfrm_state *x) spin_unlock_bh(&xfrm_state_lock); } +static struct xfrm_state *__xfrm_find_acq_byseq(u32 seq); + int xfrm_state_add(struct xfrm_state *x) { struct xfrm_state_afinfo *afinfo; struct xfrm_state *x1; + int family; int err; - afinfo = xfrm_state_get_afinfo(x->props.family); + family = x->props.family; + afinfo = xfrm_state_get_afinfo(family); if (unlikely(afinfo == NULL)) return -EAFNOSUPPORT; @@ -407,9 +411,18 @@ int xfrm_state_add(struct xfrm_state *x) goto out; } - x1 = afinfo->find_acq( - x->props.mode, x->props.reqid, x->id.proto, - &x->id.daddr, &x->props.saddr, 0); + if (x->km.seq) { + x1 = __xfrm_find_acq_byseq(x->km.seq); + if (x1 && xfrm_addr_cmp(&x1->id.daddr, &x->id.daddr, family)) { + xfrm_state_put(x1); + x1 = NULL; + } + } + + if (!x1) + x1 = afinfo->find_acq( + x->props.mode, x->props.reqid, x->id.proto, + &x->id.daddr, &x->props.saddr, 0); __xfrm_state_insert(x); err = 0; @@ -570,12 +583,11 @@ xfrm_find_acq(u8 mode, u32 reqid, u8 proto, /* Silly enough, but I'm lazy to build resolution list */ -struct xfrm_state * xfrm_find_acq_byseq(u32 seq) +static struct xfrm_state *__xfrm_find_acq_byseq(u32 seq) { int i; struct xfrm_state *x; - spin_lock_bh(&xfrm_state_lock); for (i = 0; i < XFRM_DST_HSIZE; i++) { list_for_each_entry(x, xfrm_state_bydst+i, bydst) { if (x->km.seq == seq) { @@ -585,9 +597,18 @@ struct xfrm_state * xfrm_find_acq_byseq(u32 seq) } } } - spin_unlock_bh(&xfrm_state_lock); return NULL; } + +struct xfrm_state *xfrm_find_acq_byseq(u32 seq) +{ + struct xfrm_state *x; + + spin_lock_bh(&xfrm_state_lock); + x = __xfrm_find_acq_byseq(seq); + spin_unlock_bh(&xfrm_state_lock); + return x; +} u32 xfrm_get_acqseq(void) { diff --git a/net/xfrm/xfrm_user.c b/net/xfrm/xfrm_user.c index be298cde3022..db2087c26c62 100644 --- a/net/xfrm/xfrm_user.c +++ b/net/xfrm/xfrm_user.c @@ -470,16 +470,32 @@ static int xfrm_alloc_userspi(struct sk_buff *skb, struct nlmsghdr *nlh, void ** struct xfrm_state *x; struct xfrm_userspi_info *p; struct sk_buff *resp_skb; + xfrm_address_t *daddr; + int family; int err; p = NLMSG_DATA(nlh); err = verify_userspi_info(p); if (err) goto out_noput; - x = xfrm_find_acq(p->info.mode, p->info.reqid, p->info.id.proto, - &p->info.id.daddr, - &p->info.saddr, 1, - p->info.family); + + family = p->info.family; + daddr = &p->info.id.daddr; + + x = NULL; + if (p->info.seq) { + x = xfrm_find_acq_byseq(p->info.seq); + if (x && xfrm_addr_cmp(&x->id.daddr, daddr, family)) { + xfrm_state_put(x); + x = NULL; + } + } + + if (!x) + x = xfrm_find_acq(p->info.mode, p->info.reqid, + p->info.id.proto, daddr, + &p->info.saddr, 1, + family); err = -ENOENT; if (x == NULL) goto out_noput; diff --git a/sound/pci/intel8x0.c b/sound/pci/intel8x0.c index 34d7f0a49053..5e7999084526 100644 --- a/sound/pci/intel8x0.c +++ b/sound/pci/intel8x0.c @@ -406,10 +406,10 @@ struct _snd_intel8x0 { unsigned int mmio; unsigned long addr; - unsigned long remap_addr; + void __iomem * remap_addr; unsigned int bm_mmio; unsigned long bmaddr; - unsigned long remap_bmaddr; + void __iomem * remap_bmaddr; struct pci_dev *pci; snd_card_t *card; @@ -2227,9 +2227,9 @@ static int snd_intel8x0_free(intel8x0_t *chip) snd_dma_free_pages(&chip->bdbars); } if (chip->remap_addr) - iounmap((void *) chip->remap_addr); + iounmap(chip->remap_addr); if (chip->remap_bmaddr) - iounmap((void *) chip->remap_bmaddr); + iounmap(chip->remap_bmaddr); pci_release_regions(chip->pci); kfree(chip); return 0; @@ -2502,9 +2502,8 @@ static int __devinit snd_intel8x0_create(snd_card_t * card, if (pci_resource_flags(pci, 2) & IORESOURCE_MEM) { /* ICH4 and Nforce */ chip->mmio = 1; chip->addr = pci_resource_start(pci, 2); - chip->remap_addr = (unsigned long) ioremap_nocache(chip->addr, - pci_resource_len(pci, 2)); - if (chip->remap_addr == 0) { + chip->remap_addr = ioremap_nocache(chip->addr, pci_resource_len(pci, 2)); + if (!chip->remap_addr) { snd_printk("AC'97 space ioremap problem\n"); snd_intel8x0_free(chip); return -EIO; @@ -2515,9 +2514,8 @@ static int __devinit snd_intel8x0_create(snd_card_t * card, if (pci_resource_flags(pci, 3) & IORESOURCE_MEM) { /* ICH4 */ chip->bm_mmio = 1; chip->bmaddr = pci_resource_start(pci, 3); - chip->remap_bmaddr = (unsigned long) ioremap_nocache(chip->bmaddr, - pci_resource_len(pci, 3)); - if (chip->remap_bmaddr == 0) { + chip->remap_bmaddr = ioremap_nocache(chip->bmaddr, pci_resource_len(pci, 3)); + if (!chip->remap_bmaddr) { snd_printk("Controller space ioremap problem\n"); snd_intel8x0_free(chip); return -EIO; |
