From c80ef7c102496175fa753dc14ef9105c56f53c02 Mon Sep 17 00:00:00 2001 From: Paul Gortmaker Date: Fri, 23 Sep 2005 05:18:45 -0400 Subject: [PATCH] --- yaml --- r: 9279 b: refs/heads/master c: 9389d79fbf9a0167ff2de87e8796c6bb803219bf h: refs/heads/master i: 9277: cc3ed1ed9e0a19592ceddb4dcae31d702ddc1ecb 9275: c25750b1f723e0b7acbb322a02c8773bc68950cd 9271: cfc9dce76869d6f324b9e2b87af08a78f20bf2ad 9263: a7f5465dcf31a930cae42a9a7f189f442a6e1bc4 9247: c5122907223e7e66d916c6b79f1c323c7f399bda 9215: a1ace4a95b363b50e5732ed90db4696d619744ba v: v3 --- [refs] | 2 +- .../Documentation/device-mapper/snapshot.txt | 73 -- trunk/Documentation/sparse.txt | 4 +- trunk/MAINTAINERS | 12 - trunk/README | 8 +- trunk/arch/alpha/kernel/process.c | 4 - trunk/arch/arm/kernel/entry-armv.S | 2 +- trunk/arch/ia64/hp/sim/simscsi.c | 29 +- trunk/arch/ia64/kernel/mca_asm.S | 96 +- trunk/arch/ia64/kernel/mca_drv.c | 21 +- trunk/arch/ppc/kernel/Makefile | 3 +- trunk/arch/ppc/kernel/perfmon.c | 6 +- trunk/arch/ppc/platforms/pmac_setup.c | 10 +- trunk/arch/ppc/syslib/of_device.c | 6 +- trunk/arch/ppc64/kernel/of_device.c | 7 +- trunk/arch/ppc64/kernel/pSeries_iommu.c | 16 +- trunk/arch/ppc64/kernel/pmac_setup.c | 18 +- trunk/arch/ppc64/kernel/pmac_time.c | 4 +- trunk/arch/ppc64/kernel/ptrace.c | 1 - trunk/arch/ppc64/mm/hash_native.c | 5 +- trunk/arch/ppc64/mm/hugetlbpage.c | 7 +- trunk/arch/um/drivers/chan_kern.c | 60 +- trunk/arch/um/drivers/mconsole_user.c | 2 +- trunk/arch/um/include/user.h | 4 +- trunk/arch/um/kernel/process_kern.c | 3 +- trunk/arch/um/kernel/sigio_user.c | 2 +- trunk/arch/um/kernel/tlb.c | 12 +- trunk/arch/um/kernel/trap_kern.c | 18 +- trunk/arch/um/kernel/tt/uaccess_user.c | 11 +- trunk/arch/um/kernel/umid.c | 41 +- trunk/arch/xtensa/kernel/pci.c | 4 +- trunk/arch/xtensa/kernel/platform.c | 2 +- trunk/arch/xtensa/kernel/process.c | 2 +- trunk/arch/xtensa/kernel/setup.c | 2 +- trunk/arch/xtensa/kernel/signal.c | 2 +- trunk/arch/xtensa/kernel/time.c | 2 +- trunk/arch/xtensa/mm/init.c | 2 +- trunk/drivers/char/hpet.c | 1 + trunk/drivers/char/ipmi/ipmi_msghandler.c | 6 +- trunk/drivers/hwmon/Kconfig | 9 +- trunk/drivers/hwmon/hdaps.c | 21 +- trunk/drivers/i2c/busses/Kconfig | 12 - trunk/drivers/i2c/busses/Makefile | 1 - trunk/drivers/i2c/busses/i2c-pmac-smu.c | 316 ----- trunk/drivers/isdn/hisax/st5481_b.c | 2 + trunk/drivers/isdn/hisax/st5481_usb.c | 2 + trunk/drivers/macintosh/smu.c | 1030 +++-------------- trunk/drivers/macintosh/therm_adt746x.c | 2 +- trunk/drivers/macintosh/therm_pm72.c | 2 +- trunk/drivers/macintosh/therm_windtunnel.c | 2 +- trunk/drivers/media/video/bttv-driver.c | 14 +- trunk/drivers/media/video/bttvp.h | 2 +- trunk/drivers/mtd/devices/docecc.c | 8 +- trunk/drivers/net/8390.c | 2 +- trunk/drivers/pci/probe.c | 18 +- trunk/drivers/scsi/mesh.c | 29 +- trunk/drivers/video/aty/xlinit.c | 8 +- trunk/fs/9p/conv.c | 157 ++- trunk/fs/9p/v9fs.c | 8 +- trunk/fs/9p/vfs_inode.c | 4 +- trunk/fs/9p/vfs_super.c | 24 +- trunk/fs/cifs/cifsfs.c | 2 - trunk/fs/cifs/connect.c | 2 - trunk/fs/ext3/balloc.c | 6 +- trunk/fs/ext3/resize.c | 6 +- trunk/fs/ext3/super.c | 11 +- trunk/fs/jfs/inode.c | 3 +- trunk/fs/jfs/jfs_dmap.c | 2 +- trunk/fs/jfs/jfs_txnmgr.c | 15 +- trunk/fs/jfs/jfs_txnmgr.h | 1 - trunk/fs/nfs/read.c | 5 +- trunk/fs/proc/base.c | 8 +- trunk/include/asm-alpha/compiler.h | 5 +- trunk/include/asm-ia64/mca.h | 5 - trunk/include/asm-ppc/macio.h | 1 + trunk/include/asm-ppc/of_device.h | 5 +- trunk/include/asm-ppc64/smu.h | 365 +----- trunk/include/asm-um/pgtable.h | 1 + trunk/include/asm-xtensa/atomic.h | 2 +- trunk/include/asm-xtensa/bitops.h | 2 +- trunk/include/asm-xtensa/hardirq.h | 1 - trunk/include/asm-xtensa/semaphore.h | 49 +- trunk/include/asm-xtensa/system.h | 16 + .../linux/netfilter_ipv4/ip_conntrack.h | 25 +- .../linux/netfilter_ipv4/ip_conntrack_pptp.h | 125 +- .../linux/netfilter_ipv4/ip_conntrack_tuple.h | 6 +- trunk/include/linux/reboot.h | 4 - trunk/kernel/power/Kconfig | 2 +- trunk/kernel/power/disk.c | 6 +- trunk/kernel/power/power.h | 2 +- trunk/kernel/power/swsusp.c | 12 +- trunk/kernel/signal.c | 31 +- trunk/kernel/sys.c | 52 +- trunk/mm/slab.c | 45 +- trunk/mm/swapfile.c | 1 - trunk/net/bridge/br_forward.c | 3 +- .../net/ipv4/netfilter/ip_conntrack_amanda.c | 2 +- trunk/net/ipv4/netfilter/ip_conntrack_core.c | 49 +- .../ipv4/netfilter/ip_conntrack_helper_pptp.c | 17 +- .../ipv4/netfilter/ip_conntrack_netbios_ns.c | 2 +- .../ipv4/netfilter/ip_conntrack_standalone.c | 2 +- trunk/net/ipv4/tcp_output.c | 9 - trunk/net/sctp/sm_statefuns.c | 22 +- trunk/sound/oss/au1000.c | 2 +- trunk/sound/oss/ite8172.c | 2 +- trunk/sound/pci/atiixp_modem.c | 16 +- 106 files changed, 675 insertions(+), 2458 deletions(-) delete mode 100644 trunk/Documentation/device-mapper/snapshot.txt delete mode 100644 trunk/drivers/i2c/busses/i2c-pmac-smu.c diff --git a/[refs] b/[refs] index e64dec5777a5..cc44e1a7be13 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 7f28f394bd68e58bf3938c67bbeca7825b4687b8 +refs/heads/master: 9389d79fbf9a0167ff2de87e8796c6bb803219bf diff --git a/trunk/Documentation/device-mapper/snapshot.txt b/trunk/Documentation/device-mapper/snapshot.txt deleted file mode 100644 index dca274ff4005..000000000000 --- a/trunk/Documentation/device-mapper/snapshot.txt +++ /dev/null @@ -1,73 +0,0 @@ -Device-mapper snapshot support -============================== - -Device-mapper allows you, without massive data copying: - -*) To create snapshots of any block device i.e. mountable, saved states of -the block device which are also writable without interfering with the -original content; -*) To create device "forks", i.e. multiple different versions of the -same data stream. - - -In both cases, dm copies only the chunks of data that get changed and -uses a separate copy-on-write (COW) block device for storage. - - -There are two dm targets available: snapshot and snapshot-origin. - -*) snapshot-origin - -which will normally have one or more snapshots based on it. -You must create the snapshot-origin device before you can create snapshots. -Reads will be mapped directly to the backing device. For each write, the -original data will be saved in the of each snapshot to keep -its visible content unchanged, at least until the fills up. - - -*) snapshot - -A snapshot is created of the block device. Changed chunks of - sectors will be stored on the . Writes will -only go to the . Reads will come from the or -from for unchanged data. will often be -smaller than the origin and if it fills up the snapshot will become -useless and be disabled, returning errors. So it is important to monitor -the amount of free space and expand the before it fills up. - - is P (Persistent) or N (Not persistent - will not survive -after reboot). - - -How this is used by LVM2 -======================== -When you create the first LVM2 snapshot of a volume, four dm devices are used: - -1) a device containing the original mapping table of the source volume; -2) a device used as the ; -3) a "snapshot" device, combining #1 and #2, which is the visible snapshot - volume; -4) the "original" volume (which uses the device number used by the original - source volume), whose table is replaced by a "snapshot-origin" mapping - from device #1. - -A fixed naming scheme is used, so with the following commands: - -lvcreate -L 1G -n base volumeGroup -lvcreate -L 100M --snapshot -n snap volumeGroup/base - -we'll have this situation (with volumes in above order): - -# dmsetup table|grep volumeGroup - -volumeGroup-base-real: 0 2097152 linear 8:19 384 -volumeGroup-snap-cow: 0 204800 linear 8:19 2097536 -volumeGroup-snap: 0 2097152 snapshot 254:11 254:12 P 16 -volumeGroup-base: 0 2097152 snapshot-origin 254:11 - -# ls -lL /dev/mapper/volumeGroup-* -brw------- 1 root root 254, 11 29 ago 18:15 /dev/mapper/volumeGroup-base-real -brw------- 1 root root 254, 12 29 ago 18:15 /dev/mapper/volumeGroup-snap-cow -brw------- 1 root root 254, 13 29 ago 18:15 /dev/mapper/volumeGroup-snap -brw------- 1 root root 254, 10 29 ago 18:14 /dev/mapper/volumeGroup-base - diff --git a/trunk/Documentation/sparse.txt b/trunk/Documentation/sparse.txt index 1829009db771..5df44dc894e5 100644 --- a/trunk/Documentation/sparse.txt +++ b/trunk/Documentation/sparse.txt @@ -51,9 +51,9 @@ or you don't get any checking at all. Where to get sparse ~~~~~~~~~~~~~~~~~~~ -With git, you can just get it from +With BK, you can just get it from - rsync://rsync.kernel.org/pub/scm/devel/sparse/sparse.git + bk://sparse.bkbits.net/sparse and DaveJ has tar-balls at diff --git a/trunk/MAINTAINERS b/trunk/MAINTAINERS index 7d1dd5bad39a..78aca12101a0 100644 --- a/trunk/MAINTAINERS +++ b/trunk/MAINTAINERS @@ -1402,18 +1402,6 @@ L: linux-kernel@vger.kernel.org L: fastboot@osdl.org S: Maintained -KPROBES -P: Prasanna S Panchamukhi -M: prasanna@in.ibm.com -P: Ananth N Mavinakayanahalli -M: ananth@in.ibm.com -P: Anil S Keshavamurthy -M: anil.s.keshavamurthy@intel.com -P: David S. Miller -M: davem@davemloft.net -L: linux-kernel@vger.kernel.org -S: Maintained - LANMEDIA WAN CARD DRIVER P: Andrew Stanley-Jones M: asj@lanmedia.com diff --git a/trunk/README b/trunk/README index d1edcc7adabe..2b5844d8cfa0 100644 --- a/trunk/README +++ b/trunk/README @@ -151,7 +151,7 @@ CONFIGURING the kernel: your existing ./.config file. "make silentoldconfig" Like above, but avoids cluttering the screen - with questions already answered. + with question already answered. NOTES on "make config": - having unnecessary drivers will make the kernel bigger, and can @@ -199,9 +199,9 @@ COMPILING the kernel: are installing a new kernel with the same version number as your working kernel, make a backup of your modules directory before you do a "make modules_install". - Alternatively, before compiling, use the kernel config option - "LOCALVERSION" to append a unique suffix to the regular kernel version. - LOCALVERSION can be set in the "General Setup" menu. + In alternative, before compiling, edit your Makefile and change the + "EXTRAVERSION" line - its content is appended to the regular kernel + version. - In order to boot your new kernel, you'll need to copy the kernel image (e.g. .../linux/arch/i386/boot/bzImage after compilation) diff --git a/trunk/arch/alpha/kernel/process.c b/trunk/arch/alpha/kernel/process.c index eb20c3afff58..fa98dae3cd98 100644 --- a/trunk/arch/alpha/kernel/process.c +++ b/trunk/arch/alpha/kernel/process.c @@ -127,10 +127,6 @@ common_shutdown_1(void *generic_ptr) /* If booted from SRM, reset some of the original environment. */ if (alpha_using_srm) { #ifdef CONFIG_DUMMY_CONSOLE - /* If we've gotten here after SysRq-b, leave interrupt - context before taking over the console. */ - if (in_interrupt()) - irq_exit(); /* This has the effect of resetting the VGA video origin. */ take_over_console(&dummy_con, 0, MAX_NR_CONSOLES-1, 1); #endif diff --git a/trunk/arch/arm/kernel/entry-armv.S b/trunk/arch/arm/kernel/entry-armv.S index 93b5e8e5292e..7152bfbee581 100644 --- a/trunk/arch/arm/kernel/entry-armv.S +++ b/trunk/arch/arm/kernel/entry-armv.S @@ -537,7 +537,7 @@ ENTRY(__switch_to) #ifdef CONFIG_CPU_MPCORE clrex #else - strex r5, r4, [ip] @ Clear exclusive monitor + strex r3, r4, [ip] @ Clear exclusive monitor #endif #endif #if defined(CONFIG_CPU_XSCALE) && !defined(CONFIG_IWMMXT) diff --git a/trunk/arch/ia64/hp/sim/simscsi.c b/trunk/arch/ia64/hp/sim/simscsi.c index a18983a3c934..56405dbfd739 100644 --- a/trunk/arch/ia64/hp/sim/simscsi.c +++ b/trunk/arch/ia64/hp/sim/simscsi.c @@ -233,23 +233,6 @@ simscsi_readwrite10 (struct scsi_cmnd *sc, int mode) simscsi_readwrite(sc, mode, offset, ((sc->cmnd[7] << 8) | sc->cmnd[8])*512); } -static void simscsi_fillresult(struct scsi_cmnd *sc, char *buf, unsigned len) -{ - - int scatterlen = sc->use_sg; - struct scatterlist *slp; - - if (scatterlen == 0) - memcpy(sc->request_buffer, buf, len); - else for (slp = (struct scatterlist *)sc->buffer; scatterlen-- > 0 && len > 0; slp++) { - unsigned thislen = min(len, slp->length); - - memcpy(page_address(slp->page) + slp->offset, buf, thislen); - slp++; - len -= thislen; - } -} - static int simscsi_queuecommand (struct scsi_cmnd *sc, void (*done)(struct scsi_cmnd *)) { @@ -257,7 +240,6 @@ simscsi_queuecommand (struct scsi_cmnd *sc, void (*done)(struct scsi_cmnd *)) char fname[MAX_ROOT_LEN+16]; size_t disk_size; char *buf; - char localbuf[36]; #if DEBUG_SIMSCSI register long sp asm ("sp"); @@ -281,7 +263,7 @@ simscsi_queuecommand (struct scsi_cmnd *sc, void (*done)(struct scsi_cmnd *)) /* disk doesn't exist... */ break; } - buf = localbuf; + buf = sc->request_buffer; buf[0] = 0; /* magnetic disk */ buf[1] = 0; /* not a removable medium */ buf[2] = 2; /* SCSI-2 compliant device */ @@ -291,7 +273,6 @@ simscsi_queuecommand (struct scsi_cmnd *sc, void (*done)(struct scsi_cmnd *)) buf[6] = 0; /* reserved */ buf[7] = 0; /* various flags */ memcpy(buf + 8, "HP SIMULATED DISK 0.00", 28); - simscsi_fillresult(sc, buf, 36); sc->result = GOOD; break; @@ -323,13 +304,16 @@ simscsi_queuecommand (struct scsi_cmnd *sc, void (*done)(struct scsi_cmnd *)) simscsi_readwrite10(sc, SSC_WRITE); break; + case READ_CAPACITY: if (desc[target_id] < 0 || sc->request_bufflen < 8) { break; } - buf = localbuf; + buf = sc->request_buffer; + disk_size = simscsi_get_disk_size(desc[target_id]); + /* pretend to be a 1GB disk (partition table contains real stuff): */ buf[0] = (disk_size >> 24) & 0xff; buf[1] = (disk_size >> 16) & 0xff; buf[2] = (disk_size >> 8) & 0xff; @@ -339,14 +323,13 @@ simscsi_queuecommand (struct scsi_cmnd *sc, void (*done)(struct scsi_cmnd *)) buf[5] = 0; buf[6] = 2; buf[7] = 0; - simscsi_fillresult(sc, buf, 8); sc->result = GOOD; break; case MODE_SENSE: case MODE_SENSE_10: /* sd.c uses this to determine whether disk does write-caching. */ - simscsi_fillresult(sc, (char *)empty_zero_page, sc->request_bufflen); + memset(sc->request_buffer, 0, 128); sc->result = GOOD; break; diff --git a/trunk/arch/ia64/kernel/mca_asm.S b/trunk/arch/ia64/kernel/mca_asm.S index db32fc1d3935..499a065f4e60 100644 --- a/trunk/arch/ia64/kernel/mca_asm.S +++ b/trunk/arch/ia64/kernel/mca_asm.S @@ -489,27 +489,24 @@ ia64_state_save: ;; st8 [temp1]=r17,16 // pal_min_state st8 [temp2]=r6,16 // prev_IA64_KR_CURRENT - mov r6=IA64_KR(CURRENT_STACK) - ;; - st8 [temp1]=r6,16 // prev_IA64_KR_CURRENT_STACK - st8 [temp2]=r0,16 // prev_task, starts off as NULL mov r6=cr.ifa ;; - st8 [temp1]=r12,16 // cr.isr - st8 [temp2]=r6,16 // cr.ifa + st8 [temp1]=r0,16 // prev_task, starts off as NULL + st8 [temp2]=r12,16 // cr.isr mov r12=cr.itir ;; - st8 [temp1]=r12,16 // cr.itir - st8 [temp2]=r11,16 // cr.iipa + st8 [temp1]=r6,16 // cr.ifa + st8 [temp2]=r12,16 // cr.itir mov r12=cr.iim ;; - st8 [temp1]=r12,16 // cr.iim + st8 [temp1]=r11,16 // cr.iipa + st8 [temp2]=r12,16 // cr.iim + mov r6=cr.iha (p1) mov r12=IA64_MCA_COLD_BOOT (p2) mov r12=IA64_INIT_WARM_BOOT - mov r6=cr.iha ;; - st8 [temp2]=r6,16 // cr.iha - st8 [temp1]=r12 // os_status, default is cold boot + st8 [temp1]=r6,16 // cr.iha + st8 [temp2]=r12 // os_status, default is cold boot mov r6=IA64_MCA_SAME_CONTEXT ;; st8 [temp1]=r6 // context, default is same context @@ -826,12 +823,9 @@ ia64_state_restore: ld8 r12=[temp1],16 // sal_ra ld8 r9=[temp2],16 // sal_gp ;; - ld8 r22=[temp1],16 // pal_min_state, virtual + ld8 r22=[temp1],24 // pal_min_state, virtual. skip prev_task ld8 r21=[temp2],16 // prev_IA64_KR_CURRENT ;; - ld8 r16=[temp1],16 // prev_IA64_KR_CURRENT_STACK - ld8 r20=[temp2],16 // prev_task - ;; ld8 temp3=[temp1],16 // cr.isr ld8 temp4=[temp2],16 // cr.ifa ;; @@ -852,45 +846,6 @@ ia64_state_restore: ld8 r8=[temp1] // os_status ld8 r10=[temp2] // context - /* Wire IA64_TR_CURRENT_STACK to the stack that we are resuming to. To - * avoid any dependencies on the algorithm in ia64_switch_to(), just - * purge any existing CURRENT_STACK mapping and insert the new one. - * - * r16 contains prev_IA64_KR_CURRENT_STACK, r21 contains - * prev_IA64_KR_CURRENT, these values may have been changed by the C - * code. Do not use r8, r9, r10, r22, they contain values ready for - * the return to SAL. - */ - - mov r15=IA64_KR(CURRENT_STACK) // physical granule mapped by IA64_TR_CURRENT_STACK - ;; - shl r15=r15,IA64_GRANULE_SHIFT - ;; - dep r15=-1,r15,61,3 // virtual granule - mov r18=IA64_GRANULE_SHIFT<<2 // for cr.itir.ps - ;; - ptr.d r15,r18 - ;; - srlz.d - - extr.u r19=r21,61,3 // r21 = prev_IA64_KR_CURRENT - shl r20=r16,IA64_GRANULE_SHIFT // r16 = prev_IA64_KR_CURRENT_STACK - movl r21=PAGE_KERNEL // page properties - ;; - mov IA64_KR(CURRENT_STACK)=r16 - cmp.ne p6,p0=RGN_KERNEL,r19 // new stack is in the kernel region? - or r21=r20,r21 // construct PA | page properties -(p6) br.spnt 1f // the dreaded cpu 0 idle task in region 5:( - ;; - mov cr.itir=r18 - mov cr.ifa=r21 - mov r20=IA64_TR_CURRENT_STACK - ;; - itr.d dtr[r20]=r21 - ;; - srlz.d -1: - br.sptk b0 //EndStub////////////////////////////////////////////////////////////////////// @@ -1027,7 +982,6 @@ ia64_set_kernel_registers: add temp4=temp4, temp1 // &struct ia64_sal_os_state.os_gp add r12=temp1, temp3 // kernel stack pointer on MCA/INIT stack add r13=temp1, r3 // set current to start of MCA/INIT stack - add r20=temp1, r3 // physical start of MCA/INIT stack ;; ld8 r1=[temp4] // OS GP from SAL OS state ;; @@ -1037,35 +991,7 @@ ia64_set_kernel_registers: ;; mov IA64_KR(CURRENT)=r13 - /* Wire IA64_TR_CURRENT_STACK to the MCA/INIT handler stack. To avoid - * any dependencies on the algorithm in ia64_switch_to(), just purge - * any existing CURRENT_STACK mapping and insert the new one. - */ - - mov r16=IA64_KR(CURRENT_STACK) // physical granule mapped by IA64_TR_CURRENT_STACK - ;; - shl r16=r16,IA64_GRANULE_SHIFT - ;; - dep r16=-1,r16,61,3 // virtual granule - mov r18=IA64_GRANULE_SHIFT<<2 // for cr.itir.ps - ;; - ptr.d r16,r18 - ;; - srlz.d - - shr.u r16=r20,IA64_GRANULE_SHIFT // r20 = physical start of MCA/INIT stack - movl r21=PAGE_KERNEL // page properties - ;; - mov IA64_KR(CURRENT_STACK)=r16 - or r21=r20,r21 // construct PA | page properties - ;; - mov cr.itir=r18 - mov cr.ifa=r13 - mov r20=IA64_TR_CURRENT_STACK - ;; - itr.d dtr[r20]=r21 - ;; - srlz.d + // FIXME: do I need to wire IA64_KR_CURRENT_STACK and IA64_TR_CURRENT_STACK? br.sptk b0 diff --git a/trunk/arch/ia64/kernel/mca_drv.c b/trunk/arch/ia64/kernel/mca_drv.c index f081c60ab206..80f83d6cdbfc 100644 --- a/trunk/arch/ia64/kernel/mca_drv.c +++ b/trunk/arch/ia64/kernel/mca_drv.c @@ -56,9 +56,8 @@ static struct page *page_isolate[MAX_PAGE_ISOLATE]; static int num_page_isolate = 0; typedef enum { - ISOLATE_NG, - ISOLATE_OK, - ISOLATE_NONE + ISOLATE_NG = 0, + ISOLATE_OK = 1 } isolate_status_t; /* @@ -75,7 +74,7 @@ static struct { * @paddr: poisoned memory location * * Return value: - * one of isolate_status_t, ISOLATE_OK/NG/NONE. + * ISOLATE_OK / ISOLATE_NG */ static isolate_status_t @@ -86,10 +85,7 @@ mca_page_isolate(unsigned long paddr) /* whether physical address is valid or not */ if (!ia64_phys_addr_valid(paddr)) - return ISOLATE_NONE; - - if (!pfn_valid(paddr)) - return ISOLATE_NONE; + return ISOLATE_NG; /* convert physical address to physical page number */ p = pfn_to_page(paddr>>PAGE_SHIFT); @@ -126,15 +122,10 @@ mca_handler_bh(unsigned long paddr) current->pid, current->comm); spin_lock(&mca_bh_lock); - switch (mca_page_isolate(paddr)) { - case ISOLATE_OK: + if (mca_page_isolate(paddr) == ISOLATE_OK) { printk(KERN_DEBUG "Page isolation: ( %lx ) success.\n", paddr); - break; - case ISOLATE_NG: + } else { printk(KERN_DEBUG "Page isolation: ( %lx ) failure.\n", paddr); - break; - default: - break; } spin_unlock(&mca_bh_lock); diff --git a/trunk/arch/ppc/kernel/Makefile b/trunk/arch/ppc/kernel/Makefile index b1457a8a9c0f..1fb92f16acd6 100644 --- a/trunk/arch/ppc/kernel/Makefile +++ b/trunk/arch/ppc/kernel/Makefile @@ -15,8 +15,9 @@ extra-y += vmlinux.lds obj-y := entry.o traps.o irq.o idle.o time.o misc.o \ process.o signal.o ptrace.o align.o \ semaphore.o syscalls.o setup.o \ - cputable.o ppc_htab.o perfmon.o + cputable.o ppc_htab.o obj-$(CONFIG_6xx) += l2cr.o cpu_setup_6xx.o +obj-$(CONFIG_E500) += perfmon.o obj-$(CONFIG_SOFTWARE_SUSPEND) += swsusp.o obj-$(CONFIG_POWER4) += cpu_setup_power4.o obj-$(CONFIG_MODULES) += module.o ppc_ksyms.o diff --git a/trunk/arch/ppc/kernel/perfmon.c b/trunk/arch/ppc/kernel/perfmon.c index 04c18788e85f..fa1dad96b830 100644 --- a/trunk/arch/ppc/kernel/perfmon.c +++ b/trunk/arch/ppc/kernel/perfmon.c @@ -45,7 +45,7 @@ static void dummy_perf(struct pt_regs *regs) mtpmr(PMRN_PMGC0, pmgc0); } -#elif CONFIG_6xx +#else /* Ensure exceptions are disabled */ static void dummy_perf(struct pt_regs *regs) @@ -55,10 +55,6 @@ static void dummy_perf(struct pt_regs *regs) mmcr0 &= ~MMCR0_PMXE; mtspr(SPRN_MMCR0, mmcr0); } -#else -static void dummy_perf(struct pt_regs *regs) -{ -} #endif void (*perf_irq)(struct pt_regs *) = dummy_perf; diff --git a/trunk/arch/ppc/platforms/pmac_setup.c b/trunk/arch/ppc/platforms/pmac_setup.c index 4c56a4734aec..b392b9a15987 100644 --- a/trunk/arch/ppc/platforms/pmac_setup.c +++ b/trunk/arch/ppc/platforms/pmac_setup.c @@ -719,8 +719,7 @@ pmac_declare_of_platform_devices(void) if (np) { for (np = np->child; np != NULL; np = np->sibling) if (strncmp(np->name, "i2c", 3) == 0) { - of_platform_device_create(np, "uni-n-i2c", - NULL); + of_platform_device_create(np, "uni-n-i2c"); break; } } @@ -728,18 +727,17 @@ pmac_declare_of_platform_devices(void) if (np) { for (np = np->child; np != NULL; np = np->sibling) if (strncmp(np->name, "i2c", 3) == 0) { - of_platform_device_create(np, "u3-i2c", - NULL); + of_platform_device_create(np, "u3-i2c"); break; } } np = find_devices("valkyrie"); if (np) - of_platform_device_create(np, "valkyrie", NULL); + of_platform_device_create(np, "valkyrie"); np = find_devices("platinum"); if (np) - of_platform_device_create(np, "platinum", NULL); + of_platform_device_create(np, "platinum"); return 0; } diff --git a/trunk/arch/ppc/syslib/of_device.c b/trunk/arch/ppc/syslib/of_device.c index 93c7231ea709..da8a0f2128dc 100644 --- a/trunk/arch/ppc/syslib/of_device.c +++ b/trunk/arch/ppc/syslib/of_device.c @@ -234,9 +234,7 @@ void of_device_unregister(struct of_device *ofdev) device_unregister(&ofdev->dev); } -struct of_device* of_platform_device_create(struct device_node *np, - const char *bus_id, - struct device *parent) +struct of_device* of_platform_device_create(struct device_node *np, const char *bus_id) { struct of_device *dev; u32 *reg; @@ -249,7 +247,7 @@ struct of_device* of_platform_device_create(struct device_node *np, dev->node = of_node_get(np); dev->dma_mask = 0xffffffffUL; dev->dev.dma_mask = &dev->dma_mask; - dev->dev.parent = parent; + dev->dev.parent = NULL; dev->dev.bus = &of_platform_bus_type; dev->dev.release = of_release_dev; diff --git a/trunk/arch/ppc64/kernel/of_device.c b/trunk/arch/ppc64/kernel/of_device.c index 9f200f0f2ad5..da580812ddfe 100644 --- a/trunk/arch/ppc64/kernel/of_device.c +++ b/trunk/arch/ppc64/kernel/of_device.c @@ -233,9 +233,7 @@ void of_device_unregister(struct of_device *ofdev) device_unregister(&ofdev->dev); } -struct of_device* of_platform_device_create(struct device_node *np, - const char *bus_id, - struct device *parent) +struct of_device* of_platform_device_create(struct device_node *np, const char *bus_id) { struct of_device *dev; @@ -247,7 +245,7 @@ struct of_device* of_platform_device_create(struct device_node *np, dev->node = np; dev->dma_mask = 0xffffffffUL; dev->dev.dma_mask = &dev->dma_mask; - dev->dev.parent = parent; + dev->dev.parent = NULL; dev->dev.bus = &of_platform_bus_type; dev->dev.release = of_release_dev; @@ -261,7 +259,6 @@ struct of_device* of_platform_device_create(struct device_node *np, return dev; } - EXPORT_SYMBOL(of_match_device); EXPORT_SYMBOL(of_platform_bus_type); EXPORT_SYMBOL(of_register_driver); diff --git a/trunk/arch/ppc64/kernel/pSeries_iommu.c b/trunk/arch/ppc64/kernel/pSeries_iommu.c index d17f0108a032..8c6313e7e145 100644 --- a/trunk/arch/ppc64/kernel/pSeries_iommu.c +++ b/trunk/arch/ppc64/kernel/pSeries_iommu.c @@ -364,8 +364,7 @@ static void iommu_bus_setup_pSeries(struct pci_bus *bus) while (pci->phb->dma_window_size * children > 0x80000000ul) pci->phb->dma_window_size >>= 1; - DBG("No ISA/IDE, window size is 0x%lx\n", - pci->phb->dma_window_size); + DBG("No ISA/IDE, window size is %x\n", pci->phb->dma_window_size); pci->phb->dma_window_base_cur = 0; return; @@ -389,7 +388,7 @@ static void iommu_bus_setup_pSeries(struct pci_bus *bus) while (pci->phb->dma_window_size * children > 0x70000000ul) pci->phb->dma_window_size >>= 1; - DBG("ISA/IDE, window size is 0x%lx\n", pci->phb->dma_window_size); + DBG("ISA/IDE, window size is %x\n", pci->phb->dma_window_size); } @@ -443,7 +442,7 @@ static void iommu_dev_setup_pSeries(struct pci_dev *dev) struct device_node *dn, *mydn; struct iommu_table *tbl; - DBG("iommu_dev_setup_pSeries, dev %p (%s)\n", dev, pci_name(dev)); + DBG("iommu_dev_setup_pSeries, dev %p (%s)\n", dev, dev->pretty_name); mydn = dn = pci_device_to_OF_node(dev); @@ -470,7 +469,7 @@ static void iommu_dev_setup_pSeries(struct pci_dev *dev) if (dn && dn->data) { PCI_DN(mydn)->iommu_table = PCI_DN(dn)->iommu_table; } else { - DBG("iommu_dev_setup_pSeries, dev %p (%s) has no iommu table\n", dev, pci_name(dev)); + DBG("iommu_dev_setup_pSeries, dev %p (%s) has no iommu table\n", dev, dev->pretty_name); } } @@ -504,7 +503,7 @@ static void iommu_dev_setup_pSeriesLP(struct pci_dev *dev) int *dma_window = NULL; struct pci_dn *pci; - DBG("iommu_dev_setup_pSeriesLP, dev %p (%s)\n", dev, pci_name(dev)); + DBG("iommu_dev_setup_pSeriesLP, dev %p (%s)\n", dev, dev->pretty_name); /* dev setup for LPAR is a little tricky, since the device tree might * contain the dma-window properties per-device and not neccesarily @@ -526,8 +525,9 @@ static void iommu_dev_setup_pSeriesLP(struct pci_dev *dev) * slots on POWER4 machines. */ if (dma_window == NULL || pdn->parent == NULL) { - DBG("No dma window for device, linking to parent\n"); - PCI_DN(dn)->iommu_table = PCI_DN(pdn)->iommu_table; + /* Fall back to regular (non-LPAR) dev setup */ + DBG("No dma window for device, falling back to regular setup\n"); + iommu_dev_setup_pSeries(dev); return; } else { DBG("Found DMA window, allocating table\n"); diff --git a/trunk/arch/ppc64/kernel/pmac_setup.c b/trunk/arch/ppc64/kernel/pmac_setup.c index 25755252067a..325426c7bed0 100644 --- a/trunk/arch/ppc64/kernel/pmac_setup.c +++ b/trunk/arch/ppc64/kernel/pmac_setup.c @@ -434,23 +434,15 @@ static int pmac_check_legacy_ioport(unsigned int baseport) static int __init pmac_declare_of_platform_devices(void) { - struct device_node *np, *npp; + struct device_node *np; - npp = of_find_node_by_name(NULL, "u3"); - if (npp) { - for (np = NULL; (np = of_get_next_child(npp, np)) != NULL;) { + np = find_devices("u3"); + if (np) { + for (np = np->child; np != NULL; np = np->sibling) if (strncmp(np->name, "i2c", 3) == 0) { - of_platform_device_create(np, "u3-i2c", NULL); - of_node_put(np); + of_platform_device_create(np, "u3-i2c"); break; } - } - of_node_put(npp); - } - npp = of_find_node_by_type(NULL, "smu"); - if (npp) { - of_platform_device_create(npp, "smu", NULL); - of_node_put(npp); } return 0; diff --git a/trunk/arch/ppc64/kernel/pmac_time.c b/trunk/arch/ppc64/kernel/pmac_time.c index 41bbb8c59697..3059edb09cc8 100644 --- a/trunk/arch/ppc64/kernel/pmac_time.c +++ b/trunk/arch/ppc64/kernel/pmac_time.c @@ -84,7 +84,7 @@ void __pmac pmac_get_rtc_time(struct rtc_time *tm) #ifdef CONFIG_PMAC_SMU case SYS_CTRLER_SMU: - smu_get_rtc_time(tm, 1); + smu_get_rtc_time(tm); break; #endif /* CONFIG_PMAC_SMU */ default: @@ -128,7 +128,7 @@ int __pmac pmac_set_rtc_time(struct rtc_time *tm) #ifdef CONFIG_PMAC_SMU case SYS_CTRLER_SMU: - return smu_set_rtc_time(tm, 1); + return smu_set_rtc_time(tm); #endif /* CONFIG_PMAC_SMU */ default: return -ENODEV; diff --git a/trunk/arch/ppc64/kernel/ptrace.c b/trunk/arch/ppc64/kernel/ptrace.c index b1c044ca5756..85ed3188a91d 100644 --- a/trunk/arch/ppc64/kernel/ptrace.c +++ b/trunk/arch/ppc64/kernel/ptrace.c @@ -219,7 +219,6 @@ int sys_ptrace(long request, long pid, long addr, long data) case PTRACE_SET_DEBUGREG: ret = ptrace_set_debugreg(child, addr, data); - break; case PTRACE_DETACH: ret = ptrace_detach(child, data); diff --git a/trunk/arch/ppc64/mm/hash_native.c b/trunk/arch/ppc64/mm/hash_native.c index eb1bbb5b6c16..7626bb59954d 100644 --- a/trunk/arch/ppc64/mm/hash_native.c +++ b/trunk/arch/ppc64/mm/hash_native.c @@ -343,7 +343,9 @@ static void native_flush_hash_range(unsigned long context, hpte_t *hptep; unsigned long hpte_v; struct ppc64_tlb_batch *batch = &__get_cpu_var(ppc64_tlb_batch); - unsigned long large; + + /* XXX fix for large ptes */ + unsigned long large = 0; local_irq_save(flags); @@ -356,7 +358,6 @@ static void native_flush_hash_range(unsigned long context, va = (vsid << 28) | (batch->addr[i] & 0x0fffffff); batch->vaddr[j] = va; - large = pte_huge(batch->pte[i]); if (large) vpn = va >> HPAGE_SHIFT; else diff --git a/trunk/arch/ppc64/mm/hugetlbpage.c b/trunk/arch/ppc64/mm/hugetlbpage.c index 0ea0994ed974..338771ec70d7 100644 --- a/trunk/arch/ppc64/mm/hugetlbpage.c +++ b/trunk/arch/ppc64/mm/hugetlbpage.c @@ -710,13 +710,10 @@ int hash_huge_page(struct mm_struct *mm, unsigned long access, hpte_group = ((~hash & htab_hash_mask) * HPTES_PER_GROUP) & ~0x7UL; slot = ppc_md.hpte_insert(hpte_group, va, prpn, - HPTE_V_LARGE | - HPTE_V_SECONDARY, - rflags); + HPTE_V_LARGE, rflags); if (slot == -1) { if (mftb() & 0x1) - hpte_group = ((hash & htab_hash_mask) * - HPTES_PER_GROUP)&~0x7UL; + hpte_group = ((hash & htab_hash_mask) * HPTES_PER_GROUP) & ~0x7UL; ppc_md.hpte_remove(hpte_group); goto repeat; diff --git a/trunk/arch/um/drivers/chan_kern.c b/trunk/arch/um/drivers/chan_kern.c index 16e7dc89f61d..14a12d6b3df6 100644 --- a/trunk/arch/um/drivers/chan_kern.c +++ b/trunk/arch/um/drivers/chan_kern.c @@ -19,44 +19,18 @@ #include "line.h" #include "os.h" -/* XXX: could well be moved to somewhere else, if needed. */ -static int my_printf(const char * fmt, ...) - __attribute__ ((format (printf, 1, 2))); - -static int my_printf(const char * fmt, ...) -{ - /* Yes, can be called on atomic context.*/ - char *buf = kmalloc(4096, GFP_ATOMIC); - va_list args; - int r; - - if (!buf) { - /* We print directly fmt. - * Yes, yes, yes, feel free to complain. */ - r = strlen(fmt); - } else { - va_start(args, fmt); - r = vsprintf(buf, fmt, args); - va_end(args); - fmt = buf; - } - - if (r) - r = os_write_file(1, fmt, r); - return r; - -} - #ifdef CONFIG_NOCONFIG_CHAN -/* Despite its name, there's no added trailing newline. */ -static int my_puts(const char * buf) -{ - return os_write_file(1, buf, strlen(buf)); -} + +/* The printk's here are wrong because we are complaining that there is no + * output device, but printk is printing to that output device. The user will + * never see the error. printf would be better, except it can't run on a + * kernel stack because it will overflow it. + * Use printk for now since that will avoid crashing. + */ static void *not_configged_init(char *str, int device, struct chan_opts *opts) { - my_puts("Using a channel type which is configured out of " + printk(KERN_ERR "Using a channel type which is configured out of " "UML\n"); return(NULL); } @@ -64,27 +38,27 @@ static void *not_configged_init(char *str, int device, struct chan_opts *opts) static int not_configged_open(int input, int output, int primary, void *data, char **dev_out) { - my_puts("Using a channel type which is configured out of " + printk(KERN_ERR "Using a channel type which is configured out of " "UML\n"); return(-ENODEV); } static void not_configged_close(int fd, void *data) { - my_puts("Using a channel type which is configured out of " + printk(KERN_ERR "Using a channel type which is configured out of " "UML\n"); } static int not_configged_read(int fd, char *c_out, void *data) { - my_puts("Using a channel type which is configured out of " + printk(KERN_ERR "Using a channel type which is configured out of " "UML\n"); return(-EIO); } static int not_configged_write(int fd, const char *buf, int len, void *data) { - my_puts("Using a channel type which is configured out of " + printk(KERN_ERR "Using a channel type which is configured out of " "UML\n"); return(-EIO); } @@ -92,7 +66,7 @@ static int not_configged_write(int fd, const char *buf, int len, void *data) static int not_configged_console_write(int fd, const char *buf, int len, void *data) { - my_puts("Using a channel type which is configured out of " + printk(KERN_ERR "Using a channel type which is configured out of " "UML\n"); return(-EIO); } @@ -100,14 +74,14 @@ static int not_configged_console_write(int fd, const char *buf, int len, static int not_configged_window_size(int fd, void *data, unsigned short *rows, unsigned short *cols) { - my_puts("Using a channel type which is configured out of " + printk(KERN_ERR "Using a channel type which is configured out of " "UML\n"); return(-ENODEV); } static void not_configged_free(void *data) { - my_puts("Using a channel type which is configured out of " + printf(KERN_ERR "Using a channel type which is configured out of " "UML\n"); } @@ -483,7 +457,7 @@ static struct chan *parse_chan(char *str, int pri, int device, } } if(ops == NULL){ - my_printf("parse_chan couldn't parse \"%s\"\n", + printk(KERN_ERR "parse_chan couldn't parse \"%s\"\n", str); return(NULL); } @@ -491,7 +465,7 @@ static struct chan *parse_chan(char *str, int pri, int device, data = (*ops->init)(str, device, opts); if(data == NULL) return(NULL); - chan = kmalloc(sizeof(*chan), GFP_ATOMIC); + chan = kmalloc(sizeof(*chan), GFP_KERNEL); if(chan == NULL) return(NULL); *chan = ((struct chan) { .list = LIST_HEAD_INIT(chan->list), .primary = 1, diff --git a/trunk/arch/um/drivers/mconsole_user.c b/trunk/arch/um/drivers/mconsole_user.c index 04383f98f4d5..310c1f823f26 100644 --- a/trunk/arch/um/drivers/mconsole_user.c +++ b/trunk/arch/um/drivers/mconsole_user.c @@ -23,7 +23,7 @@ static struct mconsole_command commands[] = { { "reboot", mconsole_reboot, MCONSOLE_PROC }, { "config", mconsole_config, MCONSOLE_PROC }, { "remove", mconsole_remove, MCONSOLE_PROC }, - { "sysrq", mconsole_sysrq, MCONSOLE_PROC }, + { "sysrq", mconsole_sysrq, MCONSOLE_INTR }, { "help", mconsole_help, MCONSOLE_INTR }, { "cad", mconsole_cad, MCONSOLE_INTR }, { "stop", mconsole_stop, MCONSOLE_PROC }, diff --git a/trunk/arch/um/include/user.h b/trunk/arch/um/include/user.h index 0f865ef46918..57ee9e261228 100644 --- a/trunk/arch/um/include/user.h +++ b/trunk/arch/um/include/user.h @@ -14,9 +14,7 @@ extern void *um_kmalloc_atomic(int size); extern void kfree(void *ptr); extern int in_aton(char *str); extern int open_gdb_chan(void); -/* These use size_t, however unsigned long is correct on both i386 and x86_64. */ -extern unsigned long strlcpy(char *, const char *, unsigned long); -extern unsigned long strlcat(char *, const char *, unsigned long); +extern int strlcpy(char *, const char *, int); extern void *um_vmalloc(int size); extern void vfree(void *ptr); diff --git a/trunk/arch/um/kernel/process_kern.c b/trunk/arch/um/kernel/process_kern.c index ea65db679e9c..39cf568ccfaf 100644 --- a/trunk/arch/um/kernel/process_kern.c +++ b/trunk/arch/um/kernel/process_kern.c @@ -82,8 +82,7 @@ unsigned long alloc_stack(int order, int atomic) unsigned long page; int flags = GFP_KERNEL; - if (atomic) - flags = GFP_ATOMIC; + if(atomic) flags |= GFP_ATOMIC; page = __get_free_pages(flags, order); if(page == 0) return(0); diff --git a/trunk/arch/um/kernel/sigio_user.c b/trunk/arch/um/kernel/sigio_user.c index a52751108aa1..e89218958f38 100644 --- a/trunk/arch/um/kernel/sigio_user.c +++ b/trunk/arch/um/kernel/sigio_user.c @@ -340,7 +340,7 @@ static int setup_initial_poll(int fd) { struct pollfd *p; - p = um_kmalloc_atomic(sizeof(struct pollfd)); + p = um_kmalloc(sizeof(struct pollfd)); if(p == NULL){ printk("setup_initial_poll : failed to allocate poll\n"); return(-1); diff --git a/trunk/arch/um/kernel/tlb.c b/trunk/arch/um/kernel/tlb.c index f5b0636f9ad7..0a562c3c0fd8 100644 --- a/trunk/arch/um/kernel/tlb.c +++ b/trunk/arch/um/kernel/tlb.c @@ -193,12 +193,12 @@ void fix_range_common(struct mm_struct *mm, unsigned long start_addr, r = pte_read(*npte); w = pte_write(*npte); x = pte_exec(*npte); - if (!pte_young(*npte)) { - r = 0; - w = 0; - } else if (!pte_dirty(*npte)) { - w = 0; - } + if(!pte_dirty(*npte)) + w = 0; + if(!pte_young(*npte)){ + r = 0; + w = 0; + } if(force || pte_newpage(*npte)){ if(pte_present(*npte)) ret = add_mmap(addr, diff --git a/trunk/arch/um/kernel/trap_kern.c b/trunk/arch/um/kernel/trap_kern.c index d297429ac360..87cc6fd76ced 100644 --- a/trunk/arch/um/kernel/trap_kern.c +++ b/trunk/arch/um/kernel/trap_kern.c @@ -18,7 +18,6 @@ #include "asm/a.out.h" #include "asm/current.h" #include "asm/irq.h" -#include "sysdep/sigcontext.h" #include "user_util.h" #include "kern_util.h" #include "kern.h" @@ -40,12 +39,6 @@ int handle_page_fault(unsigned long address, unsigned long ip, int err = -EFAULT; *code_out = SEGV_MAPERR; - - /* If the fault was during atomic operation, don't take the fault, just - * fail. */ - if (in_atomic()) - goto out_nosemaphore; - down_read(&mm->mmap_sem); vma = find_vma(mm, address); if(!vma) @@ -96,7 +89,6 @@ int handle_page_fault(unsigned long address, unsigned long ip, flush_tlb_page(vma, address); out: up_read(&mm->mmap_sem); -out_nosemaphore: return(err); /* @@ -133,15 +125,7 @@ unsigned long segv(struct faultinfo fi, unsigned long ip, int is_user, void *sc) } else if(current->mm == NULL) panic("Segfault with no mm"); - - if (SEGV_IS_FIXABLE(&fi)) - err = handle_page_fault(address, ip, is_write, is_user, &si.si_code); - else { - err = -EFAULT; - /* A thread accessed NULL, we get a fault, but CR2 is invalid. - * This code is used in __do_copy_from_user() of TT mode. */ - address = 0; - } + err = handle_page_fault(address, ip, is_write, is_user, &si.si_code); catcher = current->thread.fault_catcher; if(!err) diff --git a/trunk/arch/um/kernel/tt/uaccess_user.c b/trunk/arch/um/kernel/tt/uaccess_user.c index 8c220f054b61..f01475512ecb 100644 --- a/trunk/arch/um/kernel/tt/uaccess_user.c +++ b/trunk/arch/um/kernel/tt/uaccess_user.c @@ -22,15 +22,8 @@ int __do_copy_from_user(void *to, const void *from, int n, __do_copy, &faulted); TASK_REGS(get_current())->tt = save; - if(!faulted) - return 0; - else if (fault) - return n - (fault - (unsigned long) from); - else - /* In case of a general protection fault, we don't have the - * fault address, so NULL is used instead. Pretend we didn't - * copy anything. */ - return n; + if(!faulted) return(0); + else return(n - (fault - (unsigned long) from)); } static void __do_strncpy(void *dst, const void *src, int count) diff --git a/trunk/arch/um/kernel/umid.c b/trunk/arch/um/kernel/umid.c index 0b21d59ba0cd..186c28885016 100644 --- a/trunk/arch/um/kernel/umid.c +++ b/trunk/arch/um/kernel/umid.c @@ -31,8 +31,6 @@ static char *uml_dir = UML_DIR; /* Changed by set_umid */ static int umid_is_random = 1; static int umid_inited = 0; -/* Have we created the files? Should we remove them? */ -static int umid_owned = 0; static int make_umid(int (*printer)(const char *fmt, ...)); @@ -84,21 +82,20 @@ int __init umid_file_name(char *name, char *buf, int len) extern int tracing_pid; -static void __init create_pid_file(void) +static int __init create_pid_file(void) { char file[strlen(uml_dir) + UMID_LEN + sizeof("/pid\0")]; char pid[sizeof("nnnnn\0")]; int fd, n; - if(umid_file_name("pid", file, sizeof(file))) - return; + if(umid_file_name("pid", file, sizeof(file))) return 0; fd = os_open_file(file, of_create(of_excl(of_rdwr(OPENFLAGS()))), 0644); if(fd < 0){ printf("Open of machine pid file \"%s\" failed: %s\n", file, strerror(-fd)); - return; + return 0; } sprintf(pid, "%d\n", os_getpid()); @@ -106,6 +103,7 @@ static void __init create_pid_file(void) if(n != strlen(pid)) printf("Write of pid file failed - err = %d\n", -n); os_close_file(fd); + return 0; } static int actually_do_remove(char *dir) @@ -149,8 +147,7 @@ static int actually_do_remove(char *dir) void remove_umid_dir(void) { char dir[strlen(uml_dir) + UMID_LEN + 1]; - if (!umid_owned) - return; + if(!umid_inited) return; sprintf(dir, "%s%s", uml_dir, umid); actually_do_remove(dir); @@ -158,12 +155,11 @@ void remove_umid_dir(void) char *get_umid(int only_if_set) { - if(only_if_set && umid_is_random) - return NULL; - return umid; + if(only_if_set && umid_is_random) return(NULL); + return(umid); } -static int not_dead_yet(char *dir) +int not_dead_yet(char *dir) { char file[strlen(uml_dir) + UMID_LEN + sizeof("/pid\0")]; char pid[sizeof("nnnnn\0")], *end; @@ -197,8 +193,7 @@ static int not_dead_yet(char *dir) (p == CHOOSE_MODE(tracing_pid, os_getpid()))) dead = 1; } - if(!dead) - return(1); + if(!dead) return(1); return(actually_do_remove(dir)); } @@ -237,13 +232,16 @@ static int __init make_uml_dir(void) strlcpy(dir, home, sizeof(dir)); uml_dir++; } - strlcat(dir, uml_dir, sizeof(dir)); len = strlen(dir); - if (len > 0 && dir[len - 1] != '/') - strlcat(dir, "/", sizeof(dir)); + strncat(dir, uml_dir, sizeof(dir) - len); + len = strlen(dir); + if((len > 0) && (len < sizeof(dir) - 1) && (dir[len - 1] != '/')){ + dir[len] = '/'; + dir[len + 1] = '\0'; + } uml_dir = malloc(strlen(dir) + 1); - if (uml_dir == NULL) { + if(uml_dir == NULL){ printf("make_uml_dir : malloc failed, errno = %d\n", errno); exit(1); } @@ -288,7 +286,6 @@ static int __init make_umid(int (*printer)(const char *fmt, ...)) if(errno == EEXIST){ if(not_dead_yet(tmp)){ (*printer)("umid '%s' is in use\n", umid); - umid_owned = 0; return(-1); } err = mkdir(tmp, 0777); @@ -299,8 +296,7 @@ static int __init make_umid(int (*printer)(const char *fmt, ...)) return(-1); } - umid_owned = 1; - return 0; + return(0); } __uml_setup("uml_dir=", set_uml_dir, @@ -313,8 +309,7 @@ static int __init make_umid_setup(void) /* one function with the ordering we need ... */ make_uml_dir(); make_umid(printf); - create_pid_file(); - return 0; + return create_pid_file(); } __uml_postsetup(make_umid_setup); diff --git a/trunk/arch/xtensa/kernel/pci.c b/trunk/arch/xtensa/kernel/pci.c index de19501aa809..09887c96e9a1 100644 --- a/trunk/arch/xtensa/kernel/pci.c +++ b/trunk/arch/xtensa/kernel/pci.c @@ -402,8 +402,8 @@ int pci_mmap_page_range(struct pci_dev *dev, struct vm_area_struct *vma, __pci_mmap_set_flags(dev, vma, mmap_state); __pci_mmap_set_pgprot(dev, vma, mmap_state, write_combine); - ret = io_remap_pfn_range(vma, vma->vm_start, vma->vm_pgoff, - vma->vm_end - vma->vm_start,vma->vm_page_prot); + ret = io_remap_page_range(vma, vma->vm_start, vma->vm_pgoff<vm_end - vma->vm_start, vma->vm_page_prot); return ret; } diff --git a/trunk/arch/xtensa/kernel/platform.c b/trunk/arch/xtensa/kernel/platform.c index 03674daabc66..cf1362784443 100644 --- a/trunk/arch/xtensa/kernel/platform.c +++ b/trunk/arch/xtensa/kernel/platform.c @@ -39,7 +39,7 @@ _F(int, pcibios_fixup, (void), { return 0; }); _F(int, get_rtc_time, (time_t* t), { return 0; }); _F(int, set_rtc_time, (time_t t), { return 0; }); -#ifdef CONFIG_XTENSA_CALIBRATE_CCOUNT +#if CONFIG_XTENSA_CALIBRATE_CCOUNT _F(void, calibrate_ccount, (void), { printk ("ERROR: Cannot calibrate cpu frequency! Assuming 100MHz.\n"); diff --git a/trunk/arch/xtensa/kernel/process.c b/trunk/arch/xtensa/kernel/process.c index 08ef6d82ee51..c83bb0d41787 100644 --- a/trunk/arch/xtensa/kernel/process.c +++ b/trunk/arch/xtensa/kernel/process.c @@ -457,7 +457,7 @@ int dump_task_fpu(struct pt_regs *regs, struct task_struct *task, elf_fpregset_t *r) { /* see asm/coprocessor.h for this magic number 16 */ -#if XTENSA_CP_EXTRA_SIZE > 16 +#if TOTAL_CPEXTRA_SIZE > 16 do_save_fpregs (r, regs, task); /* For now, bit 16 means some extra state may be present: */ diff --git a/trunk/arch/xtensa/kernel/setup.c b/trunk/arch/xtensa/kernel/setup.c index 513ed8d67766..1f5bf5d624e4 100644 --- a/trunk/arch/xtensa/kernel/setup.c +++ b/trunk/arch/xtensa/kernel/setup.c @@ -304,7 +304,7 @@ void __init setup_arch(char **cmdline_p) # endif #endif -#ifdef CONFIG_PCI +#if CONFIG_PCI platform_pcibios_init(); #endif } diff --git a/trunk/arch/xtensa/kernel/signal.c b/trunk/arch/xtensa/kernel/signal.c index e252b61e45a5..dc42cede9394 100644 --- a/trunk/arch/xtensa/kernel/signal.c +++ b/trunk/arch/xtensa/kernel/signal.c @@ -182,7 +182,7 @@ restore_cpextra (struct _cpstate *buf) struct task_struct *tsk = current; release_all_cp(tsk); - return __copy_from_user(tsk->thread.cpextra, buf, XTENSA_CP_EXTRA_SIZE); + return __copy_from_user(tsk->thread.cpextra, buf, TOTAL_CPEXTRA_SIZE); #endif return 0; } diff --git a/trunk/arch/xtensa/kernel/time.c b/trunk/arch/xtensa/kernel/time.c index 8e423d1335ce..1ac7d5ce7456 100644 --- a/trunk/arch/xtensa/kernel/time.c +++ b/trunk/arch/xtensa/kernel/time.c @@ -68,7 +68,7 @@ void __init time_init(void) * speed for the CALIBRATE. */ -#ifdef CONFIG_XTENSA_CALIBRATE_CCOUNT +#if CONFIG_XTENSA_CALIBRATE_CCOUNT printk("Calibrating CPU frequency "); platform_calibrate_ccount(); printk("%d.%02d MHz\n", (int)ccount_per_jiffy/(1000000/HZ), diff --git a/trunk/arch/xtensa/mm/init.c b/trunk/arch/xtensa/mm/init.c index 5a91d6c9e66d..56aace84aaeb 100644 --- a/trunk/arch/xtensa/mm/init.c +++ b/trunk/arch/xtensa/mm/init.c @@ -239,7 +239,7 @@ void __init mem_init(void) high_memory = (void *) __va(max_mapnr << PAGE_SHIFT); highmemsize = 0; -#ifdef CONFIG_HIGHMEM +#if CONFIG_HIGHMEM #error HIGHGMEM not implemented in init.c #endif diff --git a/trunk/drivers/char/hpet.c b/trunk/drivers/char/hpet.c index c055bb630ffc..de0379b6d502 100644 --- a/trunk/drivers/char/hpet.c +++ b/trunk/drivers/char/hpet.c @@ -273,6 +273,7 @@ static int hpet_mmap(struct file *file, struct vm_area_struct *vma) vma->vm_flags |= VM_IO; vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot); + addr = __pa(addr); if (io_remap_pfn_range(vma, vma->vm_start, addr >> PAGE_SHIFT, PAGE_SIZE, vma->vm_page_prot)) { diff --git a/trunk/drivers/char/ipmi/ipmi_msghandler.c b/trunk/drivers/char/ipmi/ipmi_msghandler.c index 32fa82c78c73..463351d4f942 100644 --- a/trunk/drivers/char/ipmi/ipmi_msghandler.c +++ b/trunk/drivers/char/ipmi/ipmi_msghandler.c @@ -2620,7 +2620,7 @@ void ipmi_smi_msg_received(ipmi_smi_t intf, spin_lock_irqsave(&(intf->waiting_msgs_lock), flags); if (!list_empty(&(intf->waiting_msgs))) { list_add_tail(&(msg->link), &(intf->waiting_msgs)); - spin_unlock_irqrestore(&(intf->waiting_msgs_lock), flags); + spin_unlock(&(intf->waiting_msgs_lock)); goto out_unlock; } spin_unlock_irqrestore(&(intf->waiting_msgs_lock), flags); @@ -2629,9 +2629,9 @@ void ipmi_smi_msg_received(ipmi_smi_t intf, if (rv > 0) { /* Could not handle the message now, just add it to a list to handle later. */ - spin_lock_irqsave(&(intf->waiting_msgs_lock), flags); + spin_lock(&(intf->waiting_msgs_lock)); list_add_tail(&(msg->link), &(intf->waiting_msgs)); - spin_unlock_irqrestore(&(intf->waiting_msgs_lock), flags); + spin_unlock(&(intf->waiting_msgs_lock)); } else if (rv == 0) { ipmi_free_smi_msg(msg); } diff --git a/trunk/drivers/hwmon/Kconfig b/trunk/drivers/hwmon/Kconfig index db358cfa7cbf..7e72e922b41c 100644 --- a/trunk/drivers/hwmon/Kconfig +++ b/trunk/drivers/hwmon/Kconfig @@ -418,11 +418,12 @@ config SENSORS_HDAPS help This driver provides support for the IBM Hard Drive Active Protection System (hdaps), which provides an accelerometer and other misc. data. - ThinkPads starting with the R50, T41, and X40 are supported. The - accelerometer data is readable via sysfs. + Supported laptops include the IBM ThinkPad T41, T42, T43, and R51. + The accelerometer data is readable via sysfs. - This driver also provides an absolute input class device, allowing - the laptop to act as a pinball machine-esque joystick. + This driver also provides an input class device, allowing the + laptop to act as a pinball machine-esque mouse. This is off by + default but enabled via sysfs or the module parameter "mousedev". Say Y here if you have an applicable laptop and want to experience the awesome power of hdaps. diff --git a/trunk/drivers/hwmon/hdaps.c b/trunk/drivers/hwmon/hdaps.c index 7f0107613827..4c56411f3993 100644 --- a/trunk/drivers/hwmon/hdaps.c +++ b/trunk/drivers/hwmon/hdaps.c @@ -4,9 +4,9 @@ * Copyright (C) 2005 Robert Love * Copyright (C) 2005 Jesper Juhl * - * The HardDisk Active Protection System (hdaps) is present in IBM ThinkPads - * starting with the R40, T41, and X40. It provides a basic two-axis - * accelerometer and other data, such as the device's temperature. + * The HardDisk Active Protection System (hdaps) is present in the IBM ThinkPad + * T41, T42, T43, R50, R50p, R51, and X40, at least. It provides a basic + * two-axis accelerometer and other data, such as the device's temperature. * * This driver is based on the document by Mark A. Smith available at * http://www.almaden.ibm.com/cs/people/marksmith/tpaps.html and a lot of trial @@ -487,19 +487,24 @@ static struct attribute_group hdaps_attribute_group = { /* Module stuff */ -/* hdaps_dmi_match - found a match. return one, short-circuiting the hunt. */ +/* + * XXX: We should be able to return nonzero and halt the detection process. + * But there is a bug in dmi_check_system() where a nonzero return from the + * first match will result in a return of failure from dmi_check_system(). + * I fixed this; the patch is 2.6-git. Once in a released tree, we can make + * hdaps_dmi_match_invert() return hdaps_dmi_match(), which in turn returns 1. + */ static int hdaps_dmi_match(struct dmi_system_id *id) { printk(KERN_INFO "hdaps: %s detected.\n", id->ident); - return 1; + return 0; } -/* hdaps_dmi_match_invert - found an inverted match. */ static int hdaps_dmi_match_invert(struct dmi_system_id *id) { hdaps_invert = 1; printk(KERN_INFO "hdaps: inverting axis readings.\n"); - return hdaps_dmi_match(id); + return 0; } #define HDAPS_DMI_MATCH_NORMAL(model) { \ @@ -529,7 +534,6 @@ static int __init hdaps_init(void) HDAPS_DMI_MATCH_INVERT("ThinkPad R50p"), HDAPS_DMI_MATCH_NORMAL("ThinkPad R50"), HDAPS_DMI_MATCH_NORMAL("ThinkPad R51"), - HDAPS_DMI_MATCH_NORMAL("ThinkPad R52"), HDAPS_DMI_MATCH_INVERT("ThinkPad T41p"), HDAPS_DMI_MATCH_NORMAL("ThinkPad T41"), HDAPS_DMI_MATCH_INVERT("ThinkPad T42p"), @@ -537,7 +541,6 @@ static int __init hdaps_init(void) HDAPS_DMI_MATCH_NORMAL("ThinkPad T43"), HDAPS_DMI_MATCH_NORMAL("ThinkPad X40"), HDAPS_DMI_MATCH_NORMAL("ThinkPad X41 Tablet"), - HDAPS_DMI_MATCH_NORMAL("ThinkPad X41"), { .ident = NULL } }; diff --git a/trunk/drivers/i2c/busses/Kconfig b/trunk/drivers/i2c/busses/Kconfig index 3badfec75b1c..8334496a7e0a 100644 --- a/trunk/drivers/i2c/busses/Kconfig +++ b/trunk/drivers/i2c/busses/Kconfig @@ -245,18 +245,6 @@ config I2C_KEYWEST This support is also available as a module. If so, the module will be called i2c-keywest. -config I2C_PMAC_SMU - tristate "Powermac SMU I2C interface" - depends on I2C && PMAC_SMU - help - This supports the use of the I2C interface in the SMU - chip on recent Apple machines like the iMac G5. It is used - among others by the thermal control driver for those machines. - Say Y if you have such a machine. - - This support is also available as a module. If so, the module - will be called i2c-pmac-smu. - config I2C_MPC tristate "MPC107/824x/85xx/52xx" depends on I2C && PPC32 diff --git a/trunk/drivers/i2c/busses/Makefile b/trunk/drivers/i2c/busses/Makefile index f1df00f66c6c..980b3e983670 100644 --- a/trunk/drivers/i2c/busses/Makefile +++ b/trunk/drivers/i2c/busses/Makefile @@ -20,7 +20,6 @@ obj-$(CONFIG_I2C_ITE) += i2c-ite.o obj-$(CONFIG_I2C_IXP2000) += i2c-ixp2000.o obj-$(CONFIG_I2C_IXP4XX) += i2c-ixp4xx.o obj-$(CONFIG_I2C_KEYWEST) += i2c-keywest.o -obj-$(CONFIG_I2C_PMAC_SMU) += i2c-pmac-smu.o obj-$(CONFIG_I2C_MPC) += i2c-mpc.o obj-$(CONFIG_I2C_MV64XXX) += i2c-mv64xxx.o obj-$(CONFIG_I2C_NFORCE2) += i2c-nforce2.o diff --git a/trunk/drivers/i2c/busses/i2c-pmac-smu.c b/trunk/drivers/i2c/busses/i2c-pmac-smu.c deleted file mode 100644 index 8a9f5648a23d..000000000000 --- a/trunk/drivers/i2c/busses/i2c-pmac-smu.c +++ /dev/null @@ -1,316 +0,0 @@ -/* - i2c Support for Apple SMU Controller - - Copyright (c) 2005 Benjamin Herrenschmidt, IBM Corp. - - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - -*/ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -static int probe; - -MODULE_AUTHOR("Benjamin Herrenschmidt "); -MODULE_DESCRIPTION("I2C driver for Apple's SMU"); -MODULE_LICENSE("GPL"); -module_param(probe, bool, 0); - - -/* Physical interface */ -struct smu_iface -{ - struct i2c_adapter adapter; - struct completion complete; - u32 busid; -}; - -static void smu_i2c_done(struct smu_i2c_cmd *cmd, void *misc) -{ - struct smu_iface *iface = misc; - complete(&iface->complete); -} - -/* - * SMBUS-type transfer entrypoint - */ -static s32 smu_smbus_xfer( struct i2c_adapter* adap, - u16 addr, - unsigned short flags, - char read_write, - u8 command, - int size, - union i2c_smbus_data* data) -{ - struct smu_iface *iface = i2c_get_adapdata(adap); - struct smu_i2c_cmd cmd; - int rc = 0; - int read = (read_write == I2C_SMBUS_READ); - - cmd.info.bus = iface->busid; - cmd.info.devaddr = (addr << 1) | (read ? 0x01 : 0x00); - - /* Prepare datas & select mode */ - switch (size) { - case I2C_SMBUS_QUICK: - cmd.info.type = SMU_I2C_TRANSFER_SIMPLE; - cmd.info.datalen = 0; - break; - case I2C_SMBUS_BYTE: - cmd.info.type = SMU_I2C_TRANSFER_SIMPLE; - cmd.info.datalen = 1; - if (!read) - cmd.info.data[0] = data->byte; - break; - case I2C_SMBUS_BYTE_DATA: - cmd.info.type = SMU_I2C_TRANSFER_STDSUB; - cmd.info.datalen = 1; - cmd.info.sublen = 1; - cmd.info.subaddr[0] = command; - cmd.info.subaddr[1] = 0; - cmd.info.subaddr[2] = 0; - if (!read) - cmd.info.data[0] = data->byte; - break; - case I2C_SMBUS_WORD_DATA: - cmd.info.type = SMU_I2C_TRANSFER_STDSUB; - cmd.info.datalen = 2; - cmd.info.sublen = 1; - cmd.info.subaddr[0] = command; - cmd.info.subaddr[1] = 0; - cmd.info.subaddr[2] = 0; - if (!read) { - cmd.info.data[0] = data->byte & 0xff; - cmd.info.data[1] = (data->byte >> 8) & 0xff; - } - break; - /* Note that these are broken vs. the expected smbus API where - * on reads, the lenght is actually returned from the function, - * but I think the current API makes no sense and I don't want - * any driver that I haven't verified for correctness to go - * anywhere near a pmac i2c bus anyway ... - */ - case I2C_SMBUS_BLOCK_DATA: - cmd.info.type = SMU_I2C_TRANSFER_STDSUB; - cmd.info.datalen = data->block[0] + 1; - if (cmd.info.datalen > 6) - return -EINVAL; - if (!read) - memcpy(cmd.info.data, data->block, cmd.info.datalen); - cmd.info.sublen = 1; - cmd.info.subaddr[0] = command; - cmd.info.subaddr[1] = 0; - cmd.info.subaddr[2] = 0; - break; - case I2C_SMBUS_I2C_BLOCK_DATA: - cmd.info.type = SMU_I2C_TRANSFER_STDSUB; - cmd.info.datalen = data->block[0]; - if (cmd.info.datalen > 7) - return -EINVAL; - if (!read) - memcpy(cmd.info.data, &data->block[1], - cmd.info.datalen); - cmd.info.sublen = 1; - cmd.info.subaddr[0] = command; - cmd.info.subaddr[1] = 0; - cmd.info.subaddr[2] = 0; - break; - - default: - return -EINVAL; - } - - /* Turn a standardsub read into a combined mode access */ - if (read_write == I2C_SMBUS_READ && - cmd.info.type == SMU_I2C_TRANSFER_STDSUB) - cmd.info.type = SMU_I2C_TRANSFER_COMBINED; - - /* Finish filling command and submit it */ - cmd.done = smu_i2c_done; - cmd.misc = iface; - rc = smu_queue_i2c(&cmd); - if (rc < 0) - return rc; - wait_for_completion(&iface->complete); - rc = cmd.status; - - if (!read || rc < 0) - return rc; - - switch (size) { - case I2C_SMBUS_BYTE: - case I2C_SMBUS_BYTE_DATA: - data->byte = cmd.info.data[0]; - break; - case I2C_SMBUS_WORD_DATA: - data->word = ((u16)cmd.info.data[1]) << 8; - data->word |= cmd.info.data[0]; - break; - /* Note that these are broken vs. the expected smbus API where - * on reads, the lenght is actually returned from the function, - * but I think the current API makes no sense and I don't want - * any driver that I haven't verified for correctness to go - * anywhere near a pmac i2c bus anyway ... - */ - case I2C_SMBUS_BLOCK_DATA: - case I2C_SMBUS_I2C_BLOCK_DATA: - memcpy(&data->block[0], cmd.info.data, cmd.info.datalen); - break; - } - - return rc; -} - -static u32 -smu_smbus_func(struct i2c_adapter * adapter) -{ - return I2C_FUNC_SMBUS_QUICK | I2C_FUNC_SMBUS_BYTE | - I2C_FUNC_SMBUS_BYTE_DATA | I2C_FUNC_SMBUS_WORD_DATA | - I2C_FUNC_SMBUS_BLOCK_DATA; -} - -/* For now, we only handle combined mode (smbus) */ -static struct i2c_algorithm smu_algorithm = { - .smbus_xfer = smu_smbus_xfer, - .functionality = smu_smbus_func, -}; - -static int create_iface(struct device_node *np, struct device *dev) -{ - struct smu_iface* iface; - u32 *reg, busid; - int rc; - - reg = (u32 *)get_property(np, "reg", NULL); - if (reg == NULL) { - printk(KERN_ERR "i2c-pmac-smu: can't find bus number !\n"); - return -ENXIO; - } - busid = *reg; - - iface = kmalloc(sizeof(struct smu_iface), GFP_KERNEL); - if (iface == NULL) { - printk(KERN_ERR "i2c-pmac-smu: can't allocate inteface !\n"); - return -ENOMEM; - } - memset(iface, 0, sizeof(struct smu_iface)); - init_completion(&iface->complete); - iface->busid = busid; - - dev_set_drvdata(dev, iface); - - sprintf(iface->adapter.name, "smu-i2c-%02x", busid); - iface->adapter.algo = &smu_algorithm; - iface->adapter.algo_data = NULL; - iface->adapter.client_register = NULL; - iface->adapter.client_unregister = NULL; - i2c_set_adapdata(&iface->adapter, iface); - iface->adapter.dev.parent = dev; - - rc = i2c_add_adapter(&iface->adapter); - if (rc) { - printk(KERN_ERR "i2c-pamc-smu.c: Adapter %s registration " - "failed\n", iface->adapter.name); - i2c_set_adapdata(&iface->adapter, NULL); - } - - if (probe) { - unsigned char addr; - printk("Probe: "); - for (addr = 0x00; addr <= 0x7f; addr++) { - if (i2c_smbus_xfer(&iface->adapter,addr, - 0,0,0,I2C_SMBUS_QUICK,NULL) >= 0) - printk("%02x ", addr); - } - printk("\n"); - } - - printk(KERN_INFO "SMU i2c bus %x registered\n", busid); - - return 0; -} - -static int dispose_iface(struct device *dev) -{ - struct smu_iface *iface = dev_get_drvdata(dev); - int rc; - - rc = i2c_del_adapter(&iface->adapter); - i2c_set_adapdata(&iface->adapter, NULL); - /* We aren't that prepared to deal with this... */ - if (rc) - printk("i2c-pmac-smu.c: Failed to remove bus %s !\n", - iface->adapter.name); - dev_set_drvdata(dev, NULL); - kfree(iface); - - return 0; -} - - -static int create_iface_of_platform(struct of_device* dev, - const struct of_device_id *match) -{ - return create_iface(dev->node, &dev->dev); -} - - -static int dispose_iface_of_platform(struct of_device* dev) -{ - return dispose_iface(&dev->dev); -} - - -static struct of_device_id i2c_smu_match[] = -{ - { - .compatible = "smu-i2c", - }, - {}, -}; -static struct of_platform_driver i2c_smu_of_platform_driver = -{ - .name = "i2c-smu", - .match_table = i2c_smu_match, - .probe = create_iface_of_platform, - .remove = dispose_iface_of_platform -}; - - -static int __init i2c_pmac_smu_init(void) -{ - of_register_driver(&i2c_smu_of_platform_driver); - return 0; -} - - -static void __exit i2c_pmac_smu_cleanup(void) -{ - of_unregister_driver(&i2c_smu_of_platform_driver); -} - -module_init(i2c_pmac_smu_init); -module_exit(i2c_pmac_smu_cleanup); diff --git a/trunk/drivers/isdn/hisax/st5481_b.c b/trunk/drivers/isdn/hisax/st5481_b.c index 657817a591fe..0a2536d62402 100644 --- a/trunk/drivers/isdn/hisax/st5481_b.c +++ b/trunk/drivers/isdn/hisax/st5481_b.c @@ -209,7 +209,9 @@ static void st5481B_mode(struct st5481_bcs *bcs, int mode) bcs->mode = mode; // Cancel all USB transfers on this B channel + b_out->urb[0]->transfer_flags |= URB_ASYNC_UNLINK; usb_unlink_urb(b_out->urb[0]); + b_out->urb[1]->transfer_flags |= URB_ASYNC_UNLINK; usb_unlink_urb(b_out->urb[1]); b_out->busy = 0; diff --git a/trunk/drivers/isdn/hisax/st5481_usb.c b/trunk/drivers/isdn/hisax/st5481_usb.c index 89fbeb58485d..ffd5b2d45552 100644 --- a/trunk/drivers/isdn/hisax/st5481_usb.c +++ b/trunk/drivers/isdn/hisax/st5481_usb.c @@ -645,7 +645,9 @@ void st5481_in_mode(struct st5481_in *in, int mode) in->mode = mode; + in->urb[0]->transfer_flags |= URB_ASYNC_UNLINK; usb_unlink_urb(in->urb[0]); + in->urb[1]->transfer_flags |= URB_ASYNC_UNLINK; usb_unlink_urb(in->urb[1]); if (in->mode != L1_MODE_NULL) { diff --git a/trunk/drivers/macintosh/smu.c b/trunk/drivers/macintosh/smu.c index a85ac18dd21d..fb535737d17d 100644 --- a/trunk/drivers/macintosh/smu.c +++ b/trunk/drivers/macintosh/smu.c @@ -8,15 +8,21 @@ */ /* + * For now, this driver includes: + * - RTC get & set + * - reboot & shutdown commands + * all synchronous with IRQ disabled (ugh) + * * TODO: - * - maybe add timeout to commands ? - * - blocking version of time functions - * - polling version of i2c commands (including timer that works with - * interrutps off) - * - maybe avoid some data copies with i2c by directly using the smu cmd - * buffer and a lower level internal interface - * - understand SMU -> CPU events and implement reception of them via - * the userland interface + * rework in a way the PMU driver works, that is asynchronous + * with a queue of commands. I'll do that as soon as I have an + * SMU based machine at hand. Some more cleanup is needed too, + * like maybe fitting it into a platform device, etc... + * Also check what's up with cache coherency, and if we really + * can't do better than flushing the cache, maybe build a table + * of command len/reply len like the PMU driver to only flush + * what is actually necessary. + * --BenH. */ #include @@ -30,11 +36,6 @@ #include #include #include -#include -#include -#include -#include -#include #include #include @@ -44,13 +45,8 @@ #include #include #include -#include -#include - -#define VERSION "0.6" -#define AUTHOR "(c) 2005 Benjamin Herrenschmidt, IBM Corp." -#undef DEBUG_SMU +#define DEBUG_SMU 1 #ifdef DEBUG_SMU #define DPRINTK(fmt, args...) do { printk(KERN_DEBUG fmt , ##args); } while (0) @@ -61,30 +57,20 @@ /* * This is the command buffer passed to the SMU hardware */ -#define SMU_MAX_DATA 254 - struct smu_cmd_buf { u8 cmd; u8 length; - u8 data[SMU_MAX_DATA]; + u8 data[0x0FFE]; }; struct smu_device { spinlock_t lock; struct device_node *of_node; - struct of_device *of_dev; - int doorbell; /* doorbell gpio */ + int db_ack; /* doorbell ack GPIO */ + int db_req; /* doorbell req GPIO */ u32 __iomem *db_buf; /* doorbell buffer */ - int db_irq; - int msg; - int msg_irq; struct smu_cmd_buf *cmd_buf; /* command buffer virtual */ u32 cmd_buf_abs; /* command buffer absolute */ - struct list_head cmd_list; - struct smu_cmd *cmd_cur; /* pending command */ - struct list_head cmd_i2c_list; - struct smu_i2c_cmd *cmd_i2c_cur; /* pending i2c command */ - struct timer_list i2c_timer; }; /* @@ -93,243 +79,113 @@ struct smu_device { */ static struct smu_device *smu; - /* - * SMU driver low level stuff + * SMU low level communication stuff */ - -static void smu_start_cmd(void) +static inline int smu_cmd_stat(struct smu_cmd_buf *cmd_buf, u8 cmd_ack) { - unsigned long faddr, fend; - struct smu_cmd *cmd; - - if (list_empty(&smu->cmd_list)) - return; - - /* Fetch first command in queue */ - cmd = list_entry(smu->cmd_list.next, struct smu_cmd, link); - smu->cmd_cur = cmd; - list_del(&cmd->link); - - DPRINTK("SMU: starting cmd %x, %d bytes data\n", cmd->cmd, - cmd->data_len); - DPRINTK("SMU: data buffer: %02x %02x %02x %02x ...\n", - ((u8 *)cmd->data_buf)[0], ((u8 *)cmd->data_buf)[1], - ((u8 *)cmd->data_buf)[2], ((u8 *)cmd->data_buf)[3]); - - /* Fill the SMU command buffer */ - smu->cmd_buf->cmd = cmd->cmd; - smu->cmd_buf->length = cmd->data_len; - memcpy(smu->cmd_buf->data, cmd->data_buf, cmd->data_len); - - /* Flush command and data to RAM */ - faddr = (unsigned long)smu->cmd_buf; - fend = faddr + smu->cmd_buf->length + 2; - flush_inval_dcache_range(faddr, fend); - - /* This isn't exactly a DMA mapping here, I suspect - * the SMU is actually communicating with us via i2c to the - * northbridge or the CPU to access RAM. - */ - writel(smu->cmd_buf_abs, smu->db_buf); - - /* Ring the SMU doorbell */ - pmac_do_feature_call(PMAC_FTR_WRITE_GPIO, NULL, smu->doorbell, 4); + rmb(); + return cmd_buf->cmd == cmd_ack && cmd_buf->length != 0; } - -static irqreturn_t smu_db_intr(int irq, void *arg, struct pt_regs *regs) +static inline u8 smu_save_ack_cmd(struct smu_cmd_buf *cmd_buf) { - unsigned long flags; - struct smu_cmd *cmd; - void (*done)(struct smu_cmd *cmd, void *misc) = NULL; - void *misc = NULL; - u8 gpio; - int rc = 0; - - /* SMU completed the command, well, we hope, let's make sure - * of it - */ - spin_lock_irqsave(&smu->lock, flags); - - gpio = pmac_do_feature_call(PMAC_FTR_READ_GPIO, NULL, smu->doorbell); - if ((gpio & 7) != 7) - return IRQ_HANDLED; - - cmd = smu->cmd_cur; - smu->cmd_cur = NULL; - if (cmd == NULL) - goto bail; - - if (rc == 0) { - unsigned long faddr; - int reply_len; - u8 ack; - - /* CPU might have brought back the cache line, so we need - * to flush again before peeking at the SMU response. We - * flush the entire buffer for now as we haven't read the - * reply lenght (it's only 2 cache lines anyway) - */ - faddr = (unsigned long)smu->cmd_buf; - flush_inval_dcache_range(faddr, faddr + 256); - - /* Now check ack */ - ack = (~cmd->cmd) & 0xff; - if (ack != smu->cmd_buf->cmd) { - DPRINTK("SMU: incorrect ack, want %x got %x\n", - ack, smu->cmd_buf->cmd); - rc = -EIO; - } - reply_len = rc == 0 ? smu->cmd_buf->length : 0; - DPRINTK("SMU: reply len: %d\n", reply_len); - if (reply_len > cmd->reply_len) { - printk(KERN_WARNING "SMU: reply buffer too small," - "got %d bytes for a %d bytes buffer\n", - reply_len, cmd->reply_len); - reply_len = cmd->reply_len; - } - cmd->reply_len = reply_len; - if (cmd->reply_buf && reply_len) - memcpy(cmd->reply_buf, smu->cmd_buf->data, reply_len); - } - - /* Now complete the command. Write status last in order as we lost - * ownership of the command structure as soon as it's no longer -1 - */ - done = cmd->done; - misc = cmd->misc; - mb(); - cmd->status = rc; - bail: - /* Start next command if any */ - smu_start_cmd(); - spin_unlock_irqrestore(&smu->lock, flags); - - /* Call command completion handler if any */ - if (done) - done(cmd, misc); - - /* It's an edge interrupt, nothing to do */ - return IRQ_HANDLED; + return (~cmd_buf->cmd) & 0xff; } - -static irqreturn_t smu_msg_intr(int irq, void *arg, struct pt_regs *regs) +static void smu_send_cmd(struct smu_device *dev) { - /* I don't quite know what to do with this one, we seem to never - * receive it, so I suspect we have to arm it someway in the SMU - * to start getting events that way. + /* SMU command buf is currently cacheable, we need a physical + * address. This isn't exactly a DMA mapping here, I suspect + * the SMU is actually communicating with us via i2c to the + * northbridge or the CPU to access RAM. */ + writel(dev->cmd_buf_abs, dev->db_buf); - printk(KERN_INFO "SMU: message interrupt !\n"); - - /* It's an edge interrupt, nothing to do */ - return IRQ_HANDLED; + /* Ring the SMU doorbell */ + pmac_do_feature_call(PMAC_FTR_WRITE_GPIO, NULL, dev->db_req, 4); + pmac_do_feature_call(PMAC_FTR_READ_GPIO, NULL, dev->db_req, 4); } - -/* - * Queued command management. - * - */ - -int smu_queue_cmd(struct smu_cmd *cmd) +static int smu_cmd_done(struct smu_device *dev) { - unsigned long flags; + unsigned long wait = 0; + int gpio; - if (smu == NULL) - return -ENODEV; - if (cmd->data_len > SMU_MAX_DATA || - cmd->reply_len > SMU_MAX_DATA) - return -EINVAL; + /* Check the SMU doorbell */ + do { + gpio = pmac_do_feature_call(PMAC_FTR_READ_GPIO, + NULL, dev->db_ack); + if ((gpio & 7) == 7) + return 0; + udelay(100); + } while(++wait < 10000); - cmd->status = 1; - spin_lock_irqsave(&smu->lock, flags); - list_add_tail(&cmd->link, &smu->cmd_list); - if (smu->cmd_cur == NULL) - smu_start_cmd(); - spin_unlock_irqrestore(&smu->lock, flags); - - return 0; + printk(KERN_ERR "SMU timeout !\n"); + return -ENXIO; } -EXPORT_SYMBOL(smu_queue_cmd); - -int smu_queue_simple(struct smu_simple_cmd *scmd, u8 command, - unsigned int data_len, - void (*done)(struct smu_cmd *cmd, void *misc), - void *misc, ...) +static int smu_do_cmd(struct smu_device *dev) { - struct smu_cmd *cmd = &scmd->cmd; - va_list list; - int i; + int rc; + u8 cmd_ack; - if (data_len > sizeof(scmd->buffer)) - return -EINVAL; + DPRINTK("SMU do_cmd %02x len=%d %02x\n", + dev->cmd_buf->cmd, dev->cmd_buf->length, + dev->cmd_buf->data[0]); - memset(scmd, 0, sizeof(*scmd)); - cmd->cmd = command; - cmd->data_len = data_len; - cmd->data_buf = scmd->buffer; - cmd->reply_len = sizeof(scmd->buffer); - cmd->reply_buf = scmd->buffer; - cmd->done = done; - cmd->misc = misc; + cmd_ack = smu_save_ack_cmd(dev->cmd_buf); - va_start(list, misc); - for (i = 0; i < data_len; ++i) - scmd->buffer[i] = (u8)va_arg(list, int); - va_end(list); + /* Clear cmd_buf cache lines */ + flush_inval_dcache_range((unsigned long)dev->cmd_buf, + ((unsigned long)dev->cmd_buf) + + sizeof(struct smu_cmd_buf)); + smu_send_cmd(dev); + rc = smu_cmd_done(dev); + if (rc == 0) + rc = smu_cmd_stat(dev->cmd_buf, cmd_ack) ? 0 : -1; - return smu_queue_cmd(cmd); -} -EXPORT_SYMBOL(smu_queue_simple); + DPRINTK("SMU do_cmd %02x len=%d %02x => %d (%02x)\n", + dev->cmd_buf->cmd, dev->cmd_buf->length, + dev->cmd_buf->data[0], rc, cmd_ack); + return rc; +} -void smu_poll(void) +/* RTC low level commands */ +static inline int bcd2hex (int n) { - u8 gpio; - - if (smu == NULL) - return; - - gpio = pmac_do_feature_call(PMAC_FTR_READ_GPIO, NULL, smu->doorbell); - if ((gpio & 7) == 7) - smu_db_intr(smu->db_irq, smu, NULL); + return (((n & 0xf0) >> 4) * 10) + (n & 0xf); } -EXPORT_SYMBOL(smu_poll); - -void smu_done_complete(struct smu_cmd *cmd, void *misc) +static inline int hex2bcd (int n) { - struct completion *comp = misc; - - complete(comp); + return ((n / 10) << 4) + (n % 10); } -EXPORT_SYMBOL(smu_done_complete); - -void smu_spinwait_cmd(struct smu_cmd *cmd) +#if 0 +static inline void smu_fill_set_pwrup_timer_cmd(struct smu_cmd_buf *cmd_buf) { - while(cmd->status == 1) - smu_poll(); + cmd_buf->cmd = 0x8e; + cmd_buf->length = 8; + cmd_buf->data[0] = 0x00; + memset(cmd_buf->data + 1, 0, 7); } -EXPORT_SYMBOL(smu_spinwait_cmd); - -/* RTC low level commands */ -static inline int bcd2hex (int n) +static inline void smu_fill_get_pwrup_timer_cmd(struct smu_cmd_buf *cmd_buf) { - return (((n & 0xf0) >> 4) * 10) + (n & 0xf); + cmd_buf->cmd = 0x8e; + cmd_buf->length = 1; + cmd_buf->data[0] = 0x01; } - -static inline int hex2bcd (int n) +static inline void smu_fill_dis_pwrup_timer_cmd(struct smu_cmd_buf *cmd_buf) { - return ((n / 10) << 4) + (n % 10); + cmd_buf->cmd = 0x8e; + cmd_buf->length = 1; + cmd_buf->data[0] = 0x02; } - +#endif static inline void smu_fill_set_rtc_cmd(struct smu_cmd_buf *cmd_buf, struct rtc_time *time) @@ -346,96 +202,100 @@ static inline void smu_fill_set_rtc_cmd(struct smu_cmd_buf *cmd_buf, cmd_buf->data[7] = hex2bcd(time->tm_year - 100); } +static inline void smu_fill_get_rtc_cmd(struct smu_cmd_buf *cmd_buf) +{ + cmd_buf->cmd = 0x8e; + cmd_buf->length = 1; + cmd_buf->data[0] = 0x81; +} -int smu_get_rtc_time(struct rtc_time *time, int spinwait) +static void smu_parse_get_rtc_reply(struct smu_cmd_buf *cmd_buf, + struct rtc_time *time) { - struct smu_simple_cmd cmd; + time->tm_sec = bcd2hex(cmd_buf->data[0]); + time->tm_min = bcd2hex(cmd_buf->data[1]); + time->tm_hour = bcd2hex(cmd_buf->data[2]); + time->tm_wday = bcd2hex(cmd_buf->data[3]); + time->tm_mday = bcd2hex(cmd_buf->data[4]); + time->tm_mon = bcd2hex(cmd_buf->data[5]) - 1; + time->tm_year = bcd2hex(cmd_buf->data[6]) + 100; +} + +int smu_get_rtc_time(struct rtc_time *time) +{ + unsigned long flags; int rc; if (smu == NULL) return -ENODEV; memset(time, 0, sizeof(struct rtc_time)); - rc = smu_queue_simple(&cmd, SMU_CMD_RTC_COMMAND, 1, NULL, NULL, - SMU_CMD_RTC_GET_DATETIME); - if (rc) - return rc; - smu_spinwait_simple(&cmd); - - time->tm_sec = bcd2hex(cmd.buffer[0]); - time->tm_min = bcd2hex(cmd.buffer[1]); - time->tm_hour = bcd2hex(cmd.buffer[2]); - time->tm_wday = bcd2hex(cmd.buffer[3]); - time->tm_mday = bcd2hex(cmd.buffer[4]); - time->tm_mon = bcd2hex(cmd.buffer[5]) - 1; - time->tm_year = bcd2hex(cmd.buffer[6]) + 100; + spin_lock_irqsave(&smu->lock, flags); + smu_fill_get_rtc_cmd(smu->cmd_buf); + rc = smu_do_cmd(smu); + if (rc == 0) + smu_parse_get_rtc_reply(smu->cmd_buf, time); + spin_unlock_irqrestore(&smu->lock, flags); - return 0; + return rc; } - -int smu_set_rtc_time(struct rtc_time *time, int spinwait) +int smu_set_rtc_time(struct rtc_time *time) { - struct smu_simple_cmd cmd; + unsigned long flags; int rc; if (smu == NULL) return -ENODEV; - rc = smu_queue_simple(&cmd, SMU_CMD_RTC_COMMAND, 8, NULL, NULL, - SMU_CMD_RTC_SET_DATETIME, - hex2bcd(time->tm_sec), - hex2bcd(time->tm_min), - hex2bcd(time->tm_hour), - time->tm_wday, - hex2bcd(time->tm_mday), - hex2bcd(time->tm_mon) + 1, - hex2bcd(time->tm_year - 100)); - if (rc) - return rc; - smu_spinwait_simple(&cmd); + spin_lock_irqsave(&smu->lock, flags); + smu_fill_set_rtc_cmd(smu->cmd_buf, time); + rc = smu_do_cmd(smu); + spin_unlock_irqrestore(&smu->lock, flags); - return 0; + return rc; } - void smu_shutdown(void) { - struct smu_simple_cmd cmd; + const unsigned char *command = "SHUTDOWN"; + unsigned long flags; if (smu == NULL) return; - if (smu_queue_simple(&cmd, SMU_CMD_POWER_COMMAND, 9, NULL, NULL, - 'S', 'H', 'U', 'T', 'D', 'O', 'W', 'N', 0)) - return; - smu_spinwait_simple(&cmd); + spin_lock_irqsave(&smu->lock, flags); + smu->cmd_buf->cmd = 0xaa; + smu->cmd_buf->length = strlen(command); + strcpy(smu->cmd_buf->data, command); + smu_do_cmd(smu); for (;;) ; + spin_unlock_irqrestore(&smu->lock, flags); } - void smu_restart(void) { - struct smu_simple_cmd cmd; + const unsigned char *command = "RESTART"; + unsigned long flags; if (smu == NULL) return; - if (smu_queue_simple(&cmd, SMU_CMD_POWER_COMMAND, 8, NULL, NULL, - 'R', 'E', 'S', 'T', 'A', 'R', 'T', 0)) - return; - smu_spinwait_simple(&cmd); + spin_lock_irqsave(&smu->lock, flags); + smu->cmd_buf->cmd = 0xaa; + smu->cmd_buf->length = strlen(command); + strcpy(smu->cmd_buf->data, command); + smu_do_cmd(smu); for (;;) ; + spin_unlock_irqrestore(&smu->lock, flags); } - int smu_present(void) { return smu != NULL; } -EXPORT_SYMBOL(smu_present); int smu_init (void) @@ -447,8 +307,6 @@ int smu_init (void) if (np == NULL) return -ENODEV; - printk(KERN_INFO "SMU driver %s %s\n", VERSION, AUTHOR); - if (smu_cmdbuf_abs == 0) { printk(KERN_ERR "SMU: Command buffer not allocated !\n"); return -EINVAL; @@ -460,13 +318,7 @@ int smu_init (void) memset(smu, 0, sizeof(*smu)); spin_lock_init(&smu->lock); - INIT_LIST_HEAD(&smu->cmd_list); - INIT_LIST_HEAD(&smu->cmd_i2c_list); smu->of_node = np; - smu->db_irq = NO_IRQ; - smu->msg_irq = NO_IRQ; - init_timer(&smu->i2c_timer); - /* smu_cmdbuf_abs is in the low 2G of RAM, can be converted to a * 32 bits value safely */ @@ -479,8 +331,8 @@ int smu_init (void) goto fail; } data = (u32 *)get_property(np, "reg", NULL); + of_node_put(np); if (data == NULL) { - of_node_put(np); printk(KERN_ERR "SMU: Can't find doorbell GPIO address !\n"); goto fail; } @@ -489,31 +341,8 @@ int smu_init (void) * and ack. GPIOs are at 0x50, best would be to find that out * in the device-tree though. */ - smu->doorbell = *data; - if (smu->doorbell < 0x50) - smu->doorbell += 0x50; - if (np->n_intrs > 0) - smu->db_irq = np->intrs[0].line; - - of_node_put(np); - - /* Now look for the smu-interrupt GPIO */ - do { - np = of_find_node_by_name(NULL, "smu-interrupt"); - if (np == NULL) - break; - data = (u32 *)get_property(np, "reg", NULL); - if (data == NULL) { - of_node_put(np); - break; - } - smu->msg = *data; - if (smu->msg < 0x50) - smu->msg += 0x50; - if (np->n_intrs > 0) - smu->msg_irq = np->intrs[0].line; - of_node_put(np); - } while(0); + smu->db_req = 0x50 + *data; + smu->db_ack = 0x50 + *data; /* Doorbell buffer is currently hard-coded, I didn't find a proper * device-tree entry giving the address. Best would probably to use @@ -533,584 +362,3 @@ int smu_init (void) return -ENXIO; } - - -static int smu_late_init(void) -{ - if (!smu) - return 0; - - /* - * Try to request the interrupts - */ - - if (smu->db_irq != NO_IRQ) { - if (request_irq(smu->db_irq, smu_db_intr, - SA_SHIRQ, "SMU doorbell", smu) < 0) { - printk(KERN_WARNING "SMU: can't " - "request interrupt %d\n", - smu->db_irq); - smu->db_irq = NO_IRQ; - } - } - - if (smu->msg_irq != NO_IRQ) { - if (request_irq(smu->msg_irq, smu_msg_intr, - SA_SHIRQ, "SMU message", smu) < 0) { - printk(KERN_WARNING "SMU: can't " - "request interrupt %d\n", - smu->msg_irq); - smu->msg_irq = NO_IRQ; - } - } - - return 0; -} -arch_initcall(smu_late_init); - -/* - * sysfs visibility - */ - -static void smu_expose_childs(void *unused) -{ - struct device_node *np; - - for (np = NULL; (np = of_get_next_child(smu->of_node, np)) != NULL;) { - if (device_is_compatible(np, "smu-i2c")) { - char name[32]; - u32 *reg = (u32 *)get_property(np, "reg", NULL); - - if (reg == NULL) - continue; - sprintf(name, "smu-i2c-%02x", *reg); - of_platform_device_create(np, name, &smu->of_dev->dev); - } - } - -} - -static DECLARE_WORK(smu_expose_childs_work, smu_expose_childs, NULL); - -static int smu_platform_probe(struct of_device* dev, - const struct of_device_id *match) -{ - if (!smu) - return -ENODEV; - smu->of_dev = dev; - - /* - * Ok, we are matched, now expose all i2c busses. We have to defer - * that unfortunately or it would deadlock inside the device model - */ - schedule_work(&smu_expose_childs_work); - - return 0; -} - -static struct of_device_id smu_platform_match[] = -{ - { - .type = "smu", - }, - {}, -}; - -static struct of_platform_driver smu_of_platform_driver = -{ - .name = "smu", - .match_table = smu_platform_match, - .probe = smu_platform_probe, -}; - -static int __init smu_init_sysfs(void) -{ - int rc; - - /* - * Due to sysfs bogosity, a sysdev is not a real device, so - * we should in fact create both if we want sysdev semantics - * for power management. - * For now, we don't power manage machines with an SMU chip, - * I'm a bit too far from figuring out how that works with those - * new chipsets, but that will come back and bite us - */ - rc = of_register_driver(&smu_of_platform_driver); - return 0; -} - -device_initcall(smu_init_sysfs); - -struct of_device *smu_get_ofdev(void) -{ - if (!smu) - return NULL; - return smu->of_dev; -} - -EXPORT_SYMBOL_GPL(smu_get_ofdev); - -/* - * i2c interface - */ - -static void smu_i2c_complete_command(struct smu_i2c_cmd *cmd, int fail) -{ - void (*done)(struct smu_i2c_cmd *cmd, void *misc) = cmd->done; - void *misc = cmd->misc; - unsigned long flags; - - /* Check for read case */ - if (!fail && cmd->read) { - if (cmd->pdata[0] < 1) - fail = 1; - else - memcpy(cmd->info.data, &cmd->pdata[1], - cmd->info.datalen); - } - - DPRINTK("SMU: completing, success: %d\n", !fail); - - /* Update status and mark no pending i2c command with lock - * held so nobody comes in while we dequeue an eventual - * pending next i2c command - */ - spin_lock_irqsave(&smu->lock, flags); - smu->cmd_i2c_cur = NULL; - wmb(); - cmd->status = fail ? -EIO : 0; - - /* Is there another i2c command waiting ? */ - if (!list_empty(&smu->cmd_i2c_list)) { - struct smu_i2c_cmd *newcmd; - - /* Fetch it, new current, remove from list */ - newcmd = list_entry(smu->cmd_i2c_list.next, - struct smu_i2c_cmd, link); - smu->cmd_i2c_cur = newcmd; - list_del(&cmd->link); - - /* Queue with low level smu */ - list_add_tail(&cmd->scmd.link, &smu->cmd_list); - if (smu->cmd_cur == NULL) - smu_start_cmd(); - } - spin_unlock_irqrestore(&smu->lock, flags); - - /* Call command completion handler if any */ - if (done) - done(cmd, misc); - -} - - -static void smu_i2c_retry(unsigned long data) -{ - struct smu_i2c_cmd *cmd = (struct smu_i2c_cmd *)data; - - DPRINTK("SMU: i2c failure, requeuing...\n"); - - /* requeue command simply by resetting reply_len */ - cmd->pdata[0] = 0xff; - cmd->scmd.reply_len = 0x10; - smu_queue_cmd(&cmd->scmd); -} - - -static void smu_i2c_low_completion(struct smu_cmd *scmd, void *misc) -{ - struct smu_i2c_cmd *cmd = misc; - int fail = 0; - - DPRINTK("SMU: i2c compl. stage=%d status=%x pdata[0]=%x rlen: %x\n", - cmd->stage, scmd->status, cmd->pdata[0], scmd->reply_len); - - /* Check for possible status */ - if (scmd->status < 0) - fail = 1; - else if (cmd->read) { - if (cmd->stage == 0) - fail = cmd->pdata[0] != 0; - else - fail = cmd->pdata[0] >= 0x80; - } else { - fail = cmd->pdata[0] != 0; - } - - /* Handle failures by requeuing command, after 5ms interval - */ - if (fail && --cmd->retries > 0) { - DPRINTK("SMU: i2c failure, starting timer...\n"); - smu->i2c_timer.function = smu_i2c_retry; - smu->i2c_timer.data = (unsigned long)cmd; - smu->i2c_timer.expires = jiffies + msecs_to_jiffies(5); - add_timer(&smu->i2c_timer); - return; - } - - /* If failure or stage 1, command is complete */ - if (fail || cmd->stage != 0) { - smu_i2c_complete_command(cmd, fail); - return; - } - - DPRINTK("SMU: going to stage 1\n"); - - /* Ok, initial command complete, now poll status */ - scmd->reply_buf = cmd->pdata; - scmd->reply_len = 0x10; - scmd->data_buf = cmd->pdata; - scmd->data_len = 1; - cmd->pdata[0] = 0; - cmd->stage = 1; - cmd->retries = 20; - smu_queue_cmd(scmd); -} - - -int smu_queue_i2c(struct smu_i2c_cmd *cmd) -{ - unsigned long flags; - - if (smu == NULL) - return -ENODEV; - - /* Fill most fields of scmd */ - cmd->scmd.cmd = SMU_CMD_I2C_COMMAND; - cmd->scmd.done = smu_i2c_low_completion; - cmd->scmd.misc = cmd; - cmd->scmd.reply_buf = cmd->pdata; - cmd->scmd.reply_len = 0x10; - cmd->scmd.data_buf = (u8 *)(char *)&cmd->info; - cmd->scmd.status = 1; - cmd->stage = 0; - cmd->pdata[0] = 0xff; - cmd->retries = 20; - cmd->status = 1; - - /* Check transfer type, sanitize some "info" fields - * based on transfer type and do more checking - */ - cmd->info.caddr = cmd->info.devaddr; - cmd->read = cmd->info.devaddr & 0x01; - switch(cmd->info.type) { - case SMU_I2C_TRANSFER_SIMPLE: - memset(&cmd->info.sublen, 0, 4); - break; - case SMU_I2C_TRANSFER_COMBINED: - cmd->info.devaddr &= 0xfe; - case SMU_I2C_TRANSFER_STDSUB: - if (cmd->info.sublen > 3) - return -EINVAL; - break; - default: - return -EINVAL; - } - - /* Finish setting up command based on transfer direction - */ - if (cmd->read) { - if (cmd->info.datalen > SMU_I2C_READ_MAX) - return -EINVAL; - memset(cmd->info.data, 0xff, cmd->info.datalen); - cmd->scmd.data_len = 9; - } else { - if (cmd->info.datalen > SMU_I2C_WRITE_MAX) - return -EINVAL; - cmd->scmd.data_len = 9 + cmd->info.datalen; - } - - DPRINTK("SMU: i2c enqueuing command\n"); - DPRINTK("SMU: %s, len=%d bus=%x addr=%x sub0=%x type=%x\n", - cmd->read ? "read" : "write", cmd->info.datalen, - cmd->info.bus, cmd->info.caddr, - cmd->info.subaddr[0], cmd->info.type); - - - /* Enqueue command in i2c list, and if empty, enqueue also in - * main command list - */ - spin_lock_irqsave(&smu->lock, flags); - if (smu->cmd_i2c_cur == NULL) { - smu->cmd_i2c_cur = cmd; - list_add_tail(&cmd->scmd.link, &smu->cmd_list); - if (smu->cmd_cur == NULL) - smu_start_cmd(); - } else - list_add_tail(&cmd->link, &smu->cmd_i2c_list); - spin_unlock_irqrestore(&smu->lock, flags); - - return 0; -} - - - -/* - * Userland driver interface - */ - - -static LIST_HEAD(smu_clist); -static DEFINE_SPINLOCK(smu_clist_lock); - -enum smu_file_mode { - smu_file_commands, - smu_file_events, - smu_file_closing -}; - -struct smu_private -{ - struct list_head list; - enum smu_file_mode mode; - int busy; - struct smu_cmd cmd; - spinlock_t lock; - wait_queue_head_t wait; - u8 buffer[SMU_MAX_DATA]; -}; - - -static int smu_open(struct inode *inode, struct file *file) -{ - struct smu_private *pp; - unsigned long flags; - - pp = kmalloc(sizeof(struct smu_private), GFP_KERNEL); - if (pp == 0) - return -ENOMEM; - memset(pp, 0, sizeof(struct smu_private)); - spin_lock_init(&pp->lock); - pp->mode = smu_file_commands; - init_waitqueue_head(&pp->wait); - - spin_lock_irqsave(&smu_clist_lock, flags); - list_add(&pp->list, &smu_clist); - spin_unlock_irqrestore(&smu_clist_lock, flags); - file->private_data = pp; - - return 0; -} - - -static void smu_user_cmd_done(struct smu_cmd *cmd, void *misc) -{ - struct smu_private *pp = misc; - - wake_up_all(&pp->wait); -} - - -static ssize_t smu_write(struct file *file, const char __user *buf, - size_t count, loff_t *ppos) -{ - struct smu_private *pp = file->private_data; - unsigned long flags; - struct smu_user_cmd_hdr hdr; - int rc = 0; - - if (pp->busy) - return -EBUSY; - else if (copy_from_user(&hdr, buf, sizeof(hdr))) - return -EFAULT; - else if (hdr.cmdtype == SMU_CMDTYPE_WANTS_EVENTS) { - pp->mode = smu_file_events; - return 0; - } else if (hdr.cmdtype != SMU_CMDTYPE_SMU) - return -EINVAL; - else if (pp->mode != smu_file_commands) - return -EBADFD; - else if (hdr.data_len > SMU_MAX_DATA) - return -EINVAL; - - spin_lock_irqsave(&pp->lock, flags); - if (pp->busy) { - spin_unlock_irqrestore(&pp->lock, flags); - return -EBUSY; - } - pp->busy = 1; - pp->cmd.status = 1; - spin_unlock_irqrestore(&pp->lock, flags); - - if (copy_from_user(pp->buffer, buf + sizeof(hdr), hdr.data_len)) { - pp->busy = 0; - return -EFAULT; - } - - pp->cmd.cmd = hdr.cmd; - pp->cmd.data_len = hdr.data_len; - pp->cmd.reply_len = SMU_MAX_DATA; - pp->cmd.data_buf = pp->buffer; - pp->cmd.reply_buf = pp->buffer; - pp->cmd.done = smu_user_cmd_done; - pp->cmd.misc = pp; - rc = smu_queue_cmd(&pp->cmd); - if (rc < 0) - return rc; - return count; -} - - -static ssize_t smu_read_command(struct file *file, struct smu_private *pp, - char __user *buf, size_t count) -{ - DECLARE_WAITQUEUE(wait, current); - struct smu_user_reply_hdr hdr; - unsigned long flags; - int size, rc = 0; - - if (!pp->busy) - return 0; - if (count < sizeof(struct smu_user_reply_hdr)) - return -EOVERFLOW; - spin_lock_irqsave(&pp->lock, flags); - if (pp->cmd.status == 1) { - if (file->f_flags & O_NONBLOCK) - return -EAGAIN; - add_wait_queue(&pp->wait, &wait); - for (;;) { - set_current_state(TASK_INTERRUPTIBLE); - rc = 0; - if (pp->cmd.status != 1) - break; - rc = -ERESTARTSYS; - if (signal_pending(current)) - break; - spin_unlock_irqrestore(&pp->lock, flags); - schedule(); - spin_lock_irqsave(&pp->lock, flags); - } - set_current_state(TASK_RUNNING); - remove_wait_queue(&pp->wait, &wait); - } - spin_unlock_irqrestore(&pp->lock, flags); - if (rc) - return rc; - if (pp->cmd.status != 0) - pp->cmd.reply_len = 0; - size = sizeof(hdr) + pp->cmd.reply_len; - if (count < size) - size = count; - rc = size; - hdr.status = pp->cmd.status; - hdr.reply_len = pp->cmd.reply_len; - if (copy_to_user(buf, &hdr, sizeof(hdr))) - return -EFAULT; - size -= sizeof(hdr); - if (size && copy_to_user(buf + sizeof(hdr), pp->buffer, size)) - return -EFAULT; - pp->busy = 0; - - return rc; -} - - -static ssize_t smu_read_events(struct file *file, struct smu_private *pp, - char __user *buf, size_t count) -{ - /* Not implemented */ - msleep_interruptible(1000); - return 0; -} - - -static ssize_t smu_read(struct file *file, char __user *buf, - size_t count, loff_t *ppos) -{ - struct smu_private *pp = file->private_data; - - if (pp->mode == smu_file_commands) - return smu_read_command(file, pp, buf, count); - if (pp->mode == smu_file_events) - return smu_read_events(file, pp, buf, count); - - return -EBADFD; -} - -static unsigned int smu_fpoll(struct file *file, poll_table *wait) -{ - struct smu_private *pp = file->private_data; - unsigned int mask = 0; - unsigned long flags; - - if (pp == 0) - return 0; - - if (pp->mode == smu_file_commands) { - poll_wait(file, &pp->wait, wait); - - spin_lock_irqsave(&pp->lock, flags); - if (pp->busy && pp->cmd.status != 1) - mask |= POLLIN; - spin_unlock_irqrestore(&pp->lock, flags); - } if (pp->mode == smu_file_events) { - /* Not yet implemented */ - } - return mask; -} - -static int smu_release(struct inode *inode, struct file *file) -{ - struct smu_private *pp = file->private_data; - unsigned long flags; - unsigned int busy; - - if (pp == 0) - return 0; - - file->private_data = NULL; - - /* Mark file as closing to avoid races with new request */ - spin_lock_irqsave(&pp->lock, flags); - pp->mode = smu_file_closing; - busy = pp->busy; - - /* Wait for any pending request to complete */ - if (busy && pp->cmd.status == 1) { - DECLARE_WAITQUEUE(wait, current); - - add_wait_queue(&pp->wait, &wait); - for (;;) { - set_current_state(TASK_UNINTERRUPTIBLE); - if (pp->cmd.status != 1) - break; - spin_lock_irqsave(&pp->lock, flags); - schedule(); - spin_unlock_irqrestore(&pp->lock, flags); - } - set_current_state(TASK_RUNNING); - remove_wait_queue(&pp->wait, &wait); - } - spin_unlock_irqrestore(&pp->lock, flags); - - spin_lock_irqsave(&smu_clist_lock, flags); - list_del(&pp->list); - spin_unlock_irqrestore(&smu_clist_lock, flags); - kfree(pp); - - return 0; -} - - -static struct file_operations smu_device_fops __pmacdata = { - .llseek = no_llseek, - .read = smu_read, - .write = smu_write, - .poll = smu_fpoll, - .open = smu_open, - .release = smu_release, -}; - -static struct miscdevice pmu_device __pmacdata = { - MISC_DYNAMIC_MINOR, "smu", &smu_device_fops -}; - -static int smu_device_init(void) -{ - if (!smu) - return -ENODEV; - if (misc_register(&pmu_device) < 0) - printk(KERN_ERR "via-pmu: cannot register misc device.\n"); - return 0; -} -device_initcall(smu_device_init); diff --git a/trunk/drivers/macintosh/therm_adt746x.c b/trunk/drivers/macintosh/therm_adt746x.c index f38696622eb4..c9ca1118e449 100644 --- a/trunk/drivers/macintosh/therm_adt746x.c +++ b/trunk/drivers/macintosh/therm_adt746x.c @@ -599,7 +599,7 @@ thermostat_init(void) sensor_location[2] = "?"; } - of_dev = of_platform_device_create(np, "temperatures", NULL); + of_dev = of_platform_device_create(np, "temperatures"); if (of_dev == NULL) { printk(KERN_ERR "Can't register temperatures device !\n"); diff --git a/trunk/drivers/macintosh/therm_pm72.c b/trunk/drivers/macintosh/therm_pm72.c index cc507ceef153..703e31973314 100644 --- a/trunk/drivers/macintosh/therm_pm72.c +++ b/trunk/drivers/macintosh/therm_pm72.c @@ -2051,7 +2051,7 @@ static int __init therm_pm72_init(void) return -ENODEV; } } - of_dev = of_platform_device_create(np, "temperature", NULL); + of_dev = of_platform_device_create(np, "temperature"); if (of_dev == NULL) { printk(KERN_ERR "Can't register FCU platform device !\n"); return -ENODEV; diff --git a/trunk/drivers/macintosh/therm_windtunnel.c b/trunk/drivers/macintosh/therm_windtunnel.c index 6aaa1df1a64e..cbb72eb0426d 100644 --- a/trunk/drivers/macintosh/therm_windtunnel.c +++ b/trunk/drivers/macintosh/therm_windtunnel.c @@ -504,7 +504,7 @@ g4fan_init( void ) } if( !(np=of_find_node_by_name(NULL, "fan")) ) return -ENODEV; - x.of_dev = of_platform_device_create(np, "temperature", NULL); + x.of_dev = of_platform_device_create( np, "temperature" ); of_node_put( np ); if( !x.of_dev ) { diff --git a/trunk/drivers/media/video/bttv-driver.c b/trunk/drivers/media/video/bttv-driver.c index c062a017491e..a564321db2f0 100644 --- a/trunk/drivers/media/video/bttv-driver.c +++ b/trunk/drivers/media/video/bttv-driver.c @@ -763,21 +763,21 @@ static void set_pll(struct bttv *btv) /* no PLL needed */ if (btv->pll.pll_current == 0) return; - bttv_printk(KERN_INFO "bttv%d: PLL can sleep, using XTAL (%d).\n", - btv->c.nr,btv->pll.pll_ifreq); + vprintk(KERN_INFO "bttv%d: PLL can sleep, using XTAL (%d).\n", + btv->c.nr,btv->pll.pll_ifreq); btwrite(0x00,BT848_TGCTRL); btwrite(0x00,BT848_PLL_XCI); btv->pll.pll_current = 0; return; } - bttv_printk(KERN_INFO "bttv%d: PLL: %d => %d ",btv->c.nr, - btv->pll.pll_ifreq, btv->pll.pll_ofreq); + vprintk(KERN_INFO "bttv%d: PLL: %d => %d ",btv->c.nr, + btv->pll.pll_ifreq, btv->pll.pll_ofreq); set_pll_freq(btv, btv->pll.pll_ifreq, btv->pll.pll_ofreq); for (i=0; i<10; i++) { /* Let other people run while the PLL stabilizes */ - bttv_printk("."); + vprintk("."); msleep(10); if (btread(BT848_DSTATUS) & BT848_DSTATUS_PLOCK) { @@ -785,12 +785,12 @@ static void set_pll(struct bttv *btv) } else { btwrite(0x08,BT848_TGCTRL); btv->pll.pll_current = btv->pll.pll_ofreq; - bttv_printk(" ok\n"); + vprintk(" ok\n"); return; } } btv->pll.pll_current = -1; - bttv_printk("failed\n"); + vprintk("failed\n"); return; } diff --git a/trunk/drivers/media/video/bttvp.h b/trunk/drivers/media/video/bttvp.h index 7a312f79340a..9b0b7ca035f8 100644 --- a/trunk/drivers/media/video/bttvp.h +++ b/trunk/drivers/media/video/bttvp.h @@ -221,7 +221,7 @@ extern void bttv_gpio_tracking(struct bttv *btv, char *comment); extern int init_bttv_i2c(struct bttv *btv); extern int fini_bttv_i2c(struct bttv *btv); -#define bttv_printk if (bttv_verbose) printk +#define vprintk if (bttv_verbose) printk #define dprintk if (bttv_debug >= 1) printk #define d2printk if (bttv_debug >= 2) printk diff --git a/trunk/drivers/mtd/devices/docecc.c b/trunk/drivers/mtd/devices/docecc.c index 24f670b5a4f3..9a087c1fb0b7 100644 --- a/trunk/drivers/mtd/devices/docecc.c +++ b/trunk/drivers/mtd/devices/docecc.c @@ -40,7 +40,7 @@ #include #include -#define DEBUG_ECC 0 +#define DEBUG 0 /* need to undef it (from asm/termbits.h) */ #undef B0 @@ -249,7 +249,7 @@ eras_dec_rs(dtype Alpha_to[NN + 1], dtype Index_of[NN + 1], lambda[j] ^= Alpha_to[modnn(u + tmp)]; } } -#if DEBUG_ECC >= 1 +#if DEBUG >= 1 /* Test code that verifies the erasure locator polynomial just constructed Needed only for decoder debugging. */ @@ -276,7 +276,7 @@ eras_dec_rs(dtype Alpha_to[NN + 1], dtype Index_of[NN + 1], count = -1; goto finish; } -#if DEBUG_ECC >= 2 +#if DEBUG >= 2 printf("\n Erasure positions as determined by roots of Eras Loc Poly:\n"); for (i = 0; i < count; i++) printf("%d ", loc[i]); @@ -409,7 +409,7 @@ eras_dec_rs(dtype Alpha_to[NN + 1], dtype Index_of[NN + 1], den ^= Alpha_to[modnn(lambda[i+1] + i * root[j])]; } if (den == 0) { -#if DEBUG_ECC >= 1 +#if DEBUG >= 1 printf("\n ERROR: denominator = 0\n"); #endif /* Convert to dual- basis */ diff --git a/trunk/drivers/net/8390.c b/trunk/drivers/net/8390.c index 6d76f3a99b17..f87027420081 100644 --- a/trunk/drivers/net/8390.c +++ b/trunk/drivers/net/8390.c @@ -1094,7 +1094,7 @@ static void NS8390_trigger_send(struct net_device *dev, unsigned int length, outb_p(E8390_NODMA+E8390_PAGE0, e8390_base+E8390_CMD); - if (inb_p(e8390_base) & E8390_TRANS) + if (inb_p(e8390_base + E8390_CMD) & E8390_TRANS) { printk(KERN_WARNING "%s: trigger_send() called with the transmitter busy.\n", dev->name); diff --git a/trunk/drivers/pci/probe.c b/trunk/drivers/pci/probe.c index 005786416bb5..c77d5b1bbff6 100644 --- a/trunk/drivers/pci/probe.c +++ b/trunk/drivers/pci/probe.c @@ -402,12 +402,6 @@ static void pci_enable_crs(struct pci_dev *dev) static void __devinit pci_fixup_parent_subordinate_busnr(struct pci_bus *child, int max) { struct pci_bus *parent = child->parent; - - /* Attempts to fix that up are really dangerous unless - we're going to re-assign all bus numbers. */ - if (!pcibios_assign_all_busses()) - return; - while (parent->parent && parent->subordinate < max) { parent->subordinate = max; pci_write_config_byte(parent->self, PCI_SUBORDINATE_BUS, max); @@ -484,18 +478,8 @@ int __devinit pci_scan_bridge(struct pci_bus *bus, struct pci_dev * dev, int max * We need to assign a number to this bus which we always * do in the second pass. */ - if (!pass) { - if (pcibios_assign_all_busses()) - /* Temporarily disable forwarding of the - configuration cycles on all bridges in - this bus segment to avoid possible - conflicts in the second pass between two - bridges programmed with overlapping - bus ranges. */ - pci_write_config_dword(dev, PCI_PRIMARY_BUS, - buses & ~0xffffff); + if (!pass) return max; - } /* Clear errors */ pci_write_config_word(dev, PCI_STATUS, 0xffff); diff --git a/trunk/drivers/scsi/mesh.c b/trunk/drivers/scsi/mesh.c index b235556b7b65..a4857db4f9b8 100644 --- a/trunk/drivers/scsi/mesh.c +++ b/trunk/drivers/scsi/mesh.c @@ -1959,35 +1959,22 @@ static int mesh_probe(struct macio_dev *mdev, const struct of_device_id *match) /* Set it up */ mesh_init(ms); - /* Request interrupt */ - if (request_irq(ms->meshintr, do_mesh_interrupt, 0, "MESH", ms)) { + /* XXX FIXME: error should be fatal */ + if (request_irq(ms->meshintr, do_mesh_interrupt, 0, "MESH", ms)) printk(KERN_ERR "MESH: can't get irq %d\n", ms->meshintr); - goto out_shutdown; - } - /* Add scsi host & scan */ - if (scsi_add_host(mesh_host, &mdev->ofdev.dev)) - goto out_release_irq; + /* XXX FIXME: handle failure */ + scsi_add_host(mesh_host, &mdev->ofdev.dev); scsi_scan_host(mesh_host); return 0; - out_release_irq: - free_irq(ms->meshintr, ms); - out_shutdown: - /* shutdown & reset bus in case of error or macos can be confused - * at reboot if the bus was set to synchronous mode already - */ - mesh_shutdown(mdev); - set_mesh_power(ms, 0); - pci_free_consistent(macio_get_pci_dev(mdev), ms->dma_cmd_size, - ms->dma_cmd_space, ms->dma_cmd_bus); - out_unmap: +out_unmap: iounmap(ms->dma); iounmap(ms->mesh); - out_free: +out_free: scsi_host_put(mesh_host); - out_release: +out_release: macio_release_resources(mdev); return -ENODEV; @@ -2014,7 +2001,7 @@ static int mesh_remove(struct macio_dev *mdev) /* Free DMA commands memory */ pci_free_consistent(macio_get_pci_dev(mdev), ms->dma_cmd_size, - ms->dma_cmd_space, ms->dma_cmd_bus); + ms->dma_cmd_space, ms->dma_cmd_bus); /* Release memory resources */ macio_release_resources(mdev); diff --git a/trunk/drivers/video/aty/xlinit.c b/trunk/drivers/video/aty/xlinit.c index a085cbf74ecb..0bea0d8d7821 100644 --- a/trunk/drivers/video/aty/xlinit.c +++ b/trunk/drivers/video/aty/xlinit.c @@ -253,11 +253,9 @@ int atyfb_xl_init(struct fb_info *info) aty_st_le32(0xFC, 0x00000000, par); #if defined (CONFIG_FB_ATY_GENERIC_LCD) - { - int i; - - for (i = 0; i < ARRAY_SIZE(lcd_tbl); i++) - aty_st_lcd(lcd_tbl[i].lcd_reg, lcd_tbl[i].val, par); + int i; + for (i=0; i * Copyright (C) 2004 by Eric Van Hensbergen * Copyright (C) 2002 by Ron Minnich * @@ -56,70 +55,66 @@ static inline int buf_check_overflow(struct cbuf *buf) return buf->p > buf->ep; } -static inline int buf_check_size(struct cbuf *buf, int len) +static inline void buf_check_size(struct cbuf *buf, int len) { if (buf->p+len > buf->ep) { if (buf->p < buf->ep) { eprintk(KERN_ERR, "buffer overflow\n"); buf->p = buf->ep + 1; - return 0; } } - - return 1; } static inline void *buf_alloc(struct cbuf *buf, int len) { void *ret = NULL; - if (buf_check_size(buf, len)) { - ret = buf->p; - buf->p += len; - } + buf_check_size(buf, len); + ret = buf->p; + buf->p += len; return ret; } static inline void buf_put_int8(struct cbuf *buf, u8 val) { - if (buf_check_size(buf, 1)) { - buf->p[0] = val; - buf->p++; - } + buf_check_size(buf, 1); + + buf->p[0] = val; + buf->p++; } static inline void buf_put_int16(struct cbuf *buf, u16 val) { - if (buf_check_size(buf, 2)) { - *(__le16 *) buf->p = cpu_to_le16(val); - buf->p += 2; - } + buf_check_size(buf, 2); + + *(__le16 *) buf->p = cpu_to_le16(val); + buf->p += 2; } static inline void buf_put_int32(struct cbuf *buf, u32 val) { - if (buf_check_size(buf, 4)) { - *(__le32 *)buf->p = cpu_to_le32(val); - buf->p += 4; - } + buf_check_size(buf, 4); + + *(__le32 *)buf->p = cpu_to_le32(val); + buf->p += 4; } static inline void buf_put_int64(struct cbuf *buf, u64 val) { - if (buf_check_size(buf, 8)) { - *(__le64 *)buf->p = cpu_to_le64(val); - buf->p += 8; - } + buf_check_size(buf, 8); + + *(__le64 *)buf->p = cpu_to_le64(val); + buf->p += 8; } static inline void buf_put_stringn(struct cbuf *buf, const char *s, u16 slen) { - if (buf_check_size(buf, slen + 2)) { - buf_put_int16(buf, slen); - memcpy(buf->p, s, slen); - buf->p += slen; - } + buf_check_size(buf, slen + 2); + + buf_put_int16(buf, slen); + memcpy(buf->p, s, slen); + buf->p += slen; } static inline void buf_put_string(struct cbuf *buf, const char *s) @@ -129,20 +124,20 @@ static inline void buf_put_string(struct cbuf *buf, const char *s) static inline void buf_put_data(struct cbuf *buf, void *data, u32 datalen) { - if (buf_check_size(buf, datalen)) { - memcpy(buf->p, data, datalen); - buf->p += datalen; - } + buf_check_size(buf, datalen); + + memcpy(buf->p, data, datalen); + buf->p += datalen; } static inline u8 buf_get_int8(struct cbuf *buf) { u8 ret = 0; - if (buf_check_size(buf, 1)) { - ret = buf->p[0]; - buf->p++; - } + buf_check_size(buf, 1); + ret = buf->p[0]; + + buf->p++; return ret; } @@ -151,10 +146,10 @@ static inline u16 buf_get_int16(struct cbuf *buf) { u16 ret = 0; - if (buf_check_size(buf, 2)) { - ret = le16_to_cpu(*(__le16 *)buf->p); - buf->p += 2; - } + buf_check_size(buf, 2); + ret = le16_to_cpu(*(__le16 *)buf->p); + + buf->p += 2; return ret; } @@ -163,10 +158,10 @@ static inline u32 buf_get_int32(struct cbuf *buf) { u32 ret = 0; - if (buf_check_size(buf, 4)) { - ret = le32_to_cpu(*(__le32 *)buf->p); - buf->p += 4; - } + buf_check_size(buf, 4); + ret = le32_to_cpu(*(__le32 *)buf->p); + + buf->p += 4; return ret; } @@ -175,10 +170,10 @@ static inline u64 buf_get_int64(struct cbuf *buf) { u64 ret = 0; - if (buf_check_size(buf, 8)) { - ret = le64_to_cpu(*(__le64 *)buf->p); - buf->p += 8; - } + buf_check_size(buf, 8); + ret = le64_to_cpu(*(__le64 *)buf->p); + + buf->p += 8; return ret; } @@ -186,35 +181,27 @@ static inline u64 buf_get_int64(struct cbuf *buf) static inline int buf_get_string(struct cbuf *buf, char *data, unsigned int datalen) { - u16 len = 0; - - len = buf_get_int16(buf); - if (!buf_check_overflow(buf) && buf_check_size(buf, len) && len+1>datalen) { - memcpy(data, buf->p, len); - data[len] = 0; - buf->p += len; - len++; - } - return len; + u16 len = buf_get_int16(buf); + buf_check_size(buf, len); + if (len + 1 > datalen) + return 0; + + memcpy(data, buf->p, len); + data[len] = 0; + buf->p += len; + + return len + 1; } static inline char *buf_get_stringb(struct cbuf *buf, struct cbuf *sbuf) { - char *ret; - u16 len; - - ret = NULL; - len = buf_get_int16(buf); - - if (!buf_check_overflow(buf) && buf_check_size(buf, len) && - buf_check_size(sbuf, len+1)) { + char *ret = NULL; + int n = buf_get_string(buf, sbuf->p, sbuf->ep - sbuf->p); - memcpy(sbuf->p, buf->p, len); - sbuf->p[len] = 0; + if (n > 0) { ret = sbuf->p; - buf->p += len; - sbuf->p += len + 1; + sbuf->p += n; } return ret; @@ -222,15 +209,12 @@ static inline char *buf_get_stringb(struct cbuf *buf, struct cbuf *sbuf) static inline int buf_get_data(struct cbuf *buf, void *data, int datalen) { - int ret = 0; + buf_check_size(buf, datalen); - if (buf_check_size(buf, datalen)) { - memcpy(data, buf->p, datalen); - buf->p += datalen; - ret = datalen; - } + memcpy(data, buf->p, datalen); + buf->p += datalen; - return ret; + return datalen; } static inline void *buf_get_datab(struct cbuf *buf, struct cbuf *dbuf, @@ -239,12 +223,13 @@ static inline void *buf_get_datab(struct cbuf *buf, struct cbuf *dbuf, char *ret = NULL; int n = 0; - if (buf_check_size(dbuf, datalen)) { - n = buf_get_data(buf, dbuf->p, datalen); - if (n > 0) { - ret = dbuf->p; - dbuf->p += n; - } + buf_check_size(dbuf, datalen); + + n = buf_get_data(buf, dbuf->p, datalen); + + if (n > 0) { + ret = dbuf->p; + dbuf->p += n; } return ret; @@ -651,7 +636,7 @@ v9fs_deserialize_fcall(struct v9fs_session_info *v9ses, u32 msgsize, break; case RWALK: rcall->params.rwalk.nwqid = buf_get_int16(bufp); - rcall->params.rwalk.wqids = buf_alloc(dbufp, + rcall->params.rwalk.wqids = buf_alloc(bufp, rcall->params.rwalk.nwqid * sizeof(struct v9fs_qid)); if (rcall->params.rwalk.wqids) for (i = 0; i < rcall->params.rwalk.nwqid; i++) { diff --git a/trunk/fs/9p/v9fs.c b/trunk/fs/9p/v9fs.c index 82303f3bf76f..13bdbbab4387 100644 --- a/trunk/fs/9p/v9fs.c +++ b/trunk/fs/9p/v9fs.c @@ -303,13 +303,7 @@ v9fs_session_init(struct v9fs_session_info *v9ses, goto SessCleanUp; }; - v9ses->transport = kmalloc(sizeof(*v9ses->transport), GFP_KERNEL); - if (!v9ses->transport) { - retval = -ENOMEM; - goto SessCleanUp; - } - - memmove(v9ses->transport, trans_proto, sizeof(*v9ses->transport)); + v9ses->transport = trans_proto; if ((retval = v9ses->transport->init(v9ses, dev_name, data)) < 0) { eprintk(KERN_ERR, "problem initializing transport\n"); diff --git a/trunk/fs/9p/vfs_inode.c b/trunk/fs/9p/vfs_inode.c index b16322db5ce6..0c13fc600049 100644 --- a/trunk/fs/9p/vfs_inode.c +++ b/trunk/fs/9p/vfs_inode.c @@ -1063,8 +1063,8 @@ static int v9fs_vfs_readlink(struct dentry *dentry, char __user * buffer, int ret; char *link = __getname(); - if (buflen > PATH_MAX) - buflen = PATH_MAX; + if (strlen(link) < buflen) + buflen = strlen(link); dprintk(DEBUG_VFS, " dentry: %s (%p)\n", dentry->d_iname, dentry); diff --git a/trunk/fs/9p/vfs_super.c b/trunk/fs/9p/vfs_super.c index 1e2b2b54d300..868f350b2c5f 100644 --- a/trunk/fs/9p/vfs_super.c +++ b/trunk/fs/9p/vfs_super.c @@ -129,8 +129,8 @@ static struct super_block *v9fs_get_sb(struct file_system_type if ((newfid = v9fs_session_init(v9ses, dev_name, data)) < 0) { dprintk(DEBUG_ERROR, "problem initiating session\n"); - kfree(v9ses); - return ERR_PTR(newfid); + retval = newfid; + goto free_session; } sb = sget(fs_type, NULL, v9fs_set_super, v9ses); @@ -150,7 +150,7 @@ static struct super_block *v9fs_get_sb(struct file_system_type if (!root) { retval = -ENOMEM; - goto put_back_sb; + goto release_inode; } sb->s_root = root; @@ -159,7 +159,7 @@ static struct super_block *v9fs_get_sb(struct file_system_type root_fid = v9fs_fid_create(root); if (root_fid == NULL) { retval = -ENOMEM; - goto put_back_sb; + goto release_dentry; } root_fid->fidopen = 0; @@ -182,15 +182,25 @@ static struct super_block *v9fs_get_sb(struct file_system_type if (stat_result < 0) { retval = stat_result; - goto put_back_sb; + goto release_dentry; } return sb; -put_back_sb: - /* deactivate_super calls v9fs_kill_super which will frees the rest */ + release_dentry: + dput(sb->s_root); + + release_inode: + iput(inode); + + put_back_sb: up_write(&sb->s_umount); deactivate_super(sb); + v9fs_session_close(v9ses); + + free_session: + kfree(v9ses); + return ERR_PTR(retval); } diff --git a/trunk/fs/cifs/cifsfs.c b/trunk/fs/cifs/cifsfs.c index 1ebf7dafc1d7..8cc23e7d0d5d 100644 --- a/trunk/fs/cifs/cifsfs.c +++ b/trunk/fs/cifs/cifsfs.c @@ -781,8 +781,6 @@ static int cifs_oplock_thread(void * dummyarg) oplockThread = current; do { - if (try_to_freeze()) - continue; set_current_state(TASK_INTERRUPTIBLE); schedule_timeout(1*HZ); diff --git a/trunk/fs/cifs/connect.c b/trunk/fs/cifs/connect.c index 47360156cc54..2335f14a1583 100644 --- a/trunk/fs/cifs/connect.c +++ b/trunk/fs/cifs/connect.c @@ -344,8 +344,6 @@ cifs_demultiplex_thread(struct TCP_Server_Info *server) } while (server->tcpStatus != CifsExiting) { - if (try_to_freeze()) - continue; if (bigbuf == NULL) { bigbuf = cifs_buf_get(); if(bigbuf == NULL) { diff --git a/trunk/fs/ext3/balloc.c b/trunk/fs/ext3/balloc.c index 0213db4911a2..e463dca008e4 100644 --- a/trunk/fs/ext3/balloc.c +++ b/trunk/fs/ext3/balloc.c @@ -1410,7 +1410,7 @@ unsigned long ext3_count_free_blocks(struct super_block *sb) unsigned long desc_count; struct ext3_group_desc *gdp; int i; - unsigned long ngroups = EXT3_SB(sb)->s_groups_count; + unsigned long ngroups; #ifdef EXT3FS_DEBUG struct ext3_super_block *es; unsigned long bitmap_count, x; @@ -1421,8 +1421,7 @@ unsigned long ext3_count_free_blocks(struct super_block *sb) desc_count = 0; bitmap_count = 0; gdp = NULL; - - for (i = 0; i < ngroups; i++) { + for (i = 0; i < EXT3_SB(sb)->s_groups_count; i++) { gdp = ext3_get_group_desc(sb, i, NULL); if (!gdp) continue; @@ -1444,6 +1443,7 @@ unsigned long ext3_count_free_blocks(struct super_block *sb) return bitmap_count; #else desc_count = 0; + ngroups = EXT3_SB(sb)->s_groups_count; smp_rmb(); for (i = 0; i < ngroups; i++) { gdp = ext3_get_group_desc(sb, i, NULL); diff --git a/trunk/fs/ext3/resize.c b/trunk/fs/ext3/resize.c index 57f79106267d..2c9f81278d5d 100644 --- a/trunk/fs/ext3/resize.c +++ b/trunk/fs/ext3/resize.c @@ -242,7 +242,7 @@ static int setup_new_group_blocks(struct super_block *sb, i < sbi->s_itb_per_group; i++, bit++, block++) { struct buffer_head *it; - ext3_debug("clear inode block %#04lx (+%d)\n", block, bit); + ext3_debug("clear inode block %#04x (+%ld)\n", block, bit); if (IS_ERR(it = bclean(handle, sb, block))) { err = PTR_ERR(it); goto exit_bh; @@ -643,8 +643,8 @@ static void update_backups(struct super_block *sb, break; bh = sb_getblk(sb, group * bpg + blk_off); - ext3_debug("update metadata backup %#04lx\n", - (unsigned long)bh->b_blocknr); + ext3_debug(sb, __FUNCTION__, "update metadata backup %#04lx\n", + bh->b_blocknr); if ((err = ext3_journal_get_write_access(handle, bh))) break; lock_buffer(bh); diff --git a/trunk/fs/ext3/super.c b/trunk/fs/ext3/super.c index 9e24ceb019fe..a93c3609025d 100644 --- a/trunk/fs/ext3/super.c +++ b/trunk/fs/ext3/super.c @@ -512,14 +512,15 @@ static void ext3_clear_inode(struct inode *inode) static int ext3_show_options(struct seq_file *seq, struct vfsmount *vfs) { - struct super_block *sb = vfs->mnt_sb; - struct ext3_sb_info *sbi = EXT3_SB(sb); + struct ext3_sb_info *sbi = EXT3_SB(vfs->mnt_sb); - if (test_opt(sb, DATA_FLAGS) == EXT3_MOUNT_JOURNAL_DATA) + if (sbi->s_mount_opt & EXT3_MOUNT_JOURNAL_DATA) seq_puts(seq, ",data=journal"); - else if (test_opt(sb, DATA_FLAGS) == EXT3_MOUNT_ORDERED_DATA) + + if (sbi->s_mount_opt & EXT3_MOUNT_ORDERED_DATA) seq_puts(seq, ",data=ordered"); - else if (test_opt(sb, DATA_FLAGS) == EXT3_MOUNT_WRITEBACK_DATA) + + if (sbi->s_mount_opt & EXT3_MOUNT_WRITEBACK_DATA) seq_puts(seq, ",data=writeback"); #if defined(CONFIG_QUOTA) diff --git a/trunk/fs/jfs/inode.c b/trunk/fs/jfs/inode.c index 9f942ca8e4e3..0ec62d5310db 100644 --- a/trunk/fs/jfs/inode.c +++ b/trunk/fs/jfs/inode.c @@ -129,7 +129,8 @@ void jfs_delete_inode(struct inode *inode) jfs_info("In jfs_delete_inode, inode = 0x%p", inode); if (!is_bad_inode(inode) && - (JFS_IP(inode)->fileset == FILESYSTEM_I)) { + (JFS_IP(inode)->fileset == cpu_to_le32(FILESYSTEM_I))) { + truncate_inode_pages(&inode->i_data, 0); if (test_cflag(COMMIT_Freewmap, inode)) diff --git a/trunk/fs/jfs/jfs_dmap.c b/trunk/fs/jfs/jfs_dmap.c index eadf319bee22..c739626f5bf1 100644 --- a/trunk/fs/jfs/jfs_dmap.c +++ b/trunk/fs/jfs/jfs_dmap.c @@ -3055,7 +3055,7 @@ static int cntlz(u32 value) * RETURN VALUES: * log2 number of blocks */ -static int blkstol2(s64 nb) +int blkstol2(s64 nb) { int l2nb; s64 mask; /* meant to be signed */ diff --git a/trunk/fs/jfs/jfs_txnmgr.c b/trunk/fs/jfs/jfs_txnmgr.c index 9b71ed2674fe..c7a92f9deb2b 100644 --- a/trunk/fs/jfs/jfs_txnmgr.c +++ b/trunk/fs/jfs/jfs_txnmgr.c @@ -725,9 +725,6 @@ struct tlock *txLock(tid_t tid, struct inode *ip, struct metapage * mp, else tlck->flag = tlckINODELOCK; - if (S_ISDIR(ip->i_mode)) - tlck->flag |= tlckDIRECTORY; - tlck->type = 0; /* bind the tlock and the page */ @@ -1012,8 +1009,6 @@ struct tlock *txMaplock(tid_t tid, struct inode *ip, int type) /* bind the tlock and the object */ tlck->flag = tlckINODELOCK; - if (S_ISDIR(ip->i_mode)) - tlck->flag |= tlckDIRECTORY; tlck->ip = ip; tlck->mp = NULL; @@ -1082,8 +1077,6 @@ struct linelock *txLinelock(struct linelock * tlock) linelock->flag = tlckLINELOCK; linelock->maxcnt = TLOCKLONG; linelock->index = 0; - if (tlck->flag & tlckDIRECTORY) - linelock->flag |= tlckDIRECTORY; /* append linelock after tlock */ linelock->next = tlock->next; @@ -2077,8 +2070,8 @@ static void xtLog(struct jfs_log * log, struct tblock * tblk, struct lrd * lrd, * * function: log from maplock of freed data extents; */ -static void mapLog(struct jfs_log * log, struct tblock * tblk, struct lrd * lrd, - struct tlock * tlck) +void mapLog(struct jfs_log * log, struct tblock * tblk, struct lrd * lrd, + struct tlock * tlck) { struct pxd_lock *pxdlock; int i, nlock; @@ -2216,7 +2209,7 @@ void txEA(tid_t tid, struct inode *ip, dxd_t * oldea, dxd_t * newea) * function: synchronously write pages locked by transaction * after txLog() but before txUpdateMap(); */ -static void txForce(struct tblock * tblk) +void txForce(struct tblock * tblk) { struct tlock *tlck; lid_t lid, next; @@ -2365,7 +2358,7 @@ static void txUpdateMap(struct tblock * tblk) */ else { /* (maplock->flag & mlckFREE) */ - if (tlck->flag & tlckDIRECTORY) + if (S_ISDIR(tlck->ip->i_mode)) txFreeMap(ipimap, maplock, tblk, COMMIT_PWMAP); else diff --git a/trunk/fs/jfs/jfs_txnmgr.h b/trunk/fs/jfs/jfs_txnmgr.h index 0e4dc4514c47..59ad0f6b7231 100644 --- a/trunk/fs/jfs/jfs_txnmgr.h +++ b/trunk/fs/jfs/jfs_txnmgr.h @@ -122,7 +122,6 @@ extern struct tlock *TxLock; /* transaction lock table */ #define tlckLOG 0x0800 /* updateMap state */ #define tlckUPDATEMAP 0x0080 -#define tlckDIRECTORY 0x0040 /* freeLock state */ #define tlckFREELOCK 0x0008 #define tlckWRITEPAGE 0x0004 diff --git a/trunk/fs/nfs/read.c b/trunk/fs/nfs/read.c index 9758ebd49905..6ceb1d471f20 100644 --- a/trunk/fs/nfs/read.c +++ b/trunk/fs/nfs/read.c @@ -184,13 +184,14 @@ static void nfs_readpage_release(struct nfs_page *req) { unlock_page(req->wb_page); + nfs_clear_request(req); + nfs_release_request(req); + dprintk("NFS: read done (%s/%Ld %d@%Ld)\n", req->wb_context->dentry->d_inode->i_sb->s_id, (long long)NFS_FILEID(req->wb_context->dentry->d_inode), req->wb_bytes, (long long)req_offset(req)); - nfs_clear_request(req); - nfs_release_request(req); } /* diff --git a/trunk/fs/proc/base.c b/trunk/fs/proc/base.c index 3b33f94020db..fb34f88a4a74 100644 --- a/trunk/fs/proc/base.c +++ b/trunk/fs/proc/base.c @@ -343,8 +343,7 @@ static int proc_root_link(struct inode *inode, struct dentry **dentry, struct vf /* Same as proc_root_link, but this addionally tries to get fs from other * threads in the group */ -static int proc_task_root_link(struct inode *inode, struct dentry **dentry, - struct vfsmount **mnt) +static int proc_task_root_link(struct inode *inode, struct dentry **dentry, struct vfsmount **mnt) { struct fs_struct *fs; int result = -ENOENT; @@ -358,10 +357,9 @@ static int proc_task_root_link(struct inode *inode, struct dentry **dentry, } else { /* Try to get fs from other threads */ task_unlock(leader); + struct task_struct *task = leader; read_lock(&tasklist_lock); - if (pid_alive(leader)) { - struct task_struct *task = leader; - + if (pid_alive(task)) { while ((task = next_thread(task)) != leader) { task_lock(task); fs = task->fs; diff --git a/trunk/include/asm-alpha/compiler.h b/trunk/include/asm-alpha/compiler.h index 0a4a8b40dfcd..399c33b7be51 100644 --- a/trunk/include/asm-alpha/compiler.h +++ b/trunk/include/asm-alpha/compiler.h @@ -98,9 +98,6 @@ #undef inline #undef __inline__ #undef __inline -#if __GNUC__ == 3 && __GNUC_MINOR__ >= 1 || __GNUC__ > 3 -#undef __always_inline -#define __always_inline inline __attribute__((always_inline)) -#endif + #endif /* __ALPHA_COMPILER_H */ diff --git a/trunk/include/asm-ia64/mca.h b/trunk/include/asm-ia64/mca.h index c7d9c9ed38ba..97a28b8b2ddd 100644 --- a/trunk/include/asm-ia64/mca.h +++ b/trunk/include/asm-ia64/mca.h @@ -80,12 +80,7 @@ struct ia64_sal_os_state { u64 sal_ra; /* Return address in SAL, physical */ u64 sal_gp; /* GP of the SAL - physical */ pal_min_state_area_t *pal_min_state; /* from R17. physical in asm, virtual in C */ - /* Previous values of IA64_KR(CURRENT) and IA64_KR(CURRENT_STACK). - * Note: if the MCA/INIT recovery code wants to resume to a new context - * then it must change these values to reflect the new kernel stack. - */ u64 prev_IA64_KR_CURRENT; /* previous value of IA64_KR(CURRENT) */ - u64 prev_IA64_KR_CURRENT_STACK; struct task_struct *prev_task; /* previous task, NULL if it is not useful */ /* Some interrupt registers are not saved in minstate, pt_regs or * switch_stack. Because MCA/INIT can occur when interrupts are diff --git a/trunk/include/asm-ppc/macio.h b/trunk/include/asm-ppc/macio.h index b553dd4b139e..a481b772d154 100644 --- a/trunk/include/asm-ppc/macio.h +++ b/trunk/include/asm-ppc/macio.h @@ -1,6 +1,7 @@ #ifndef __MACIO_ASIC_H__ #define __MACIO_ASIC_H__ +#include #include extern struct bus_type macio_bus_type; diff --git a/trunk/include/asm-ppc/of_device.h b/trunk/include/asm-ppc/of_device.h index 575bce418f80..4b264cfd3998 100644 --- a/trunk/include/asm-ppc/of_device.h +++ b/trunk/include/asm-ppc/of_device.h @@ -2,7 +2,6 @@ #define __OF_DEVICE_H__ #include -#include #include /* @@ -56,9 +55,7 @@ extern int of_register_driver(struct of_platform_driver *drv); extern void of_unregister_driver(struct of_platform_driver *drv); extern int of_device_register(struct of_device *ofdev); extern void of_device_unregister(struct of_device *ofdev); -extern struct of_device *of_platform_device_create(struct device_node *np, - const char *bus_id, - struct device *parent); +extern struct of_device *of_platform_device_create(struct device_node *np, const char *bus_id); extern void of_release_dev(struct device *dev); #endif /* __OF_DEVICE_H__ */ diff --git a/trunk/include/asm-ppc64/smu.h b/trunk/include/asm-ppc64/smu.h index dee8eefe47bc..10b4397af9aa 100644 --- a/trunk/include/asm-ppc64/smu.h +++ b/trunk/include/asm-ppc64/smu.h @@ -1,379 +1,22 @@ -#ifndef _SMU_H -#define _SMU_H - /* * Definitions for talking to the SMU chip in newer G5 PowerMacs */ #include -#include - -/* - * Known SMU commands - * - * Most of what is below comes from looking at the Open Firmware driver, - * though this is still incomplete and could use better documentation here - * or there... - */ - - -/* - * Partition info commands - * - * I do not know what those are for at this point - */ -#define SMU_CMD_PARTITION_COMMAND 0x3e - - -/* - * Fan control - * - * This is a "mux" for fan control commands, first byte is the - * "sub" command. - */ -#define SMU_CMD_FAN_COMMAND 0x4a - - -/* - * Battery access - * - * Same command number as the PMU, could it be same syntax ? - */ -#define SMU_CMD_BATTERY_COMMAND 0x6f -#define SMU_CMD_GET_BATTERY_INFO 0x00 - -/* - * Real time clock control - * - * This is a "mux", first data byte contains the "sub" command. - * The "RTC" part of the SMU controls the date, time, powerup - * timer, but also a PRAM - * - * Dates are in BCD format on 7 bytes: - * [sec] [min] [hour] [weekday] [month day] [month] [year] - * with month being 1 based and year minus 100 - */ -#define SMU_CMD_RTC_COMMAND 0x8e -#define SMU_CMD_RTC_SET_PWRUP_TIMER 0x00 /* i: 7 bytes date */ -#define SMU_CMD_RTC_GET_PWRUP_TIMER 0x01 /* o: 7 bytes date */ -#define SMU_CMD_RTC_STOP_PWRUP_TIMER 0x02 -#define SMU_CMD_RTC_SET_PRAM_BYTE_ACC 0x20 /* i: 1 byte (address?) */ -#define SMU_CMD_RTC_SET_PRAM_AUTOINC 0x21 /* i: 1 byte (data?) */ -#define SMU_CMD_RTC_SET_PRAM_LO_BYTES 0x22 /* i: 10 bytes */ -#define SMU_CMD_RTC_SET_PRAM_HI_BYTES 0x23 /* i: 10 bytes */ -#define SMU_CMD_RTC_GET_PRAM_BYTE 0x28 /* i: 1 bytes (address?) */ -#define SMU_CMD_RTC_GET_PRAM_LO_BYTES 0x29 /* o: 10 bytes */ -#define SMU_CMD_RTC_GET_PRAM_HI_BYTES 0x2a /* o: 10 bytes */ -#define SMU_CMD_RTC_SET_DATETIME 0x80 /* i: 7 bytes date */ -#define SMU_CMD_RTC_GET_DATETIME 0x81 /* o: 7 bytes date */ - - /* - * i2c commands - * - * To issue an i2c command, first is to send a parameter block to the - * the SMU. This is a command of type 0x9a with 9 bytes of header - * eventually followed by data for a write: - * - * 0: bus number (from device-tree usually, SMU has lots of busses !) - * 1: transfer type/format (see below) - * 2: device address. For combined and combined4 type transfers, this - * is the "write" version of the address (bit 0x01 cleared) - * 3: subaddress length (0..3) - * 4: subaddress byte 0 (or only byte for subaddress length 1) - * 5: subaddress byte 1 - * 6: subaddress byte 2 - * 7: combined address (device address for combined mode data phase) - * 8: data length - * - * The transfer types are the same good old Apple ones it seems, - * that is: - * - 0x00: Simple transfer - * - 0x01: Subaddress transfer (addr write + data tx, no restart) - * - 0x02: Combined transfer (addr write + restart + data tx) - * - * This is then followed by actual data for a write. - * - * At this point, the OF driver seems to have a limitation on transfer - * sizes of 0xd bytes on reads and 0x5 bytes on writes. I do not know - * wether this is just an OF limit due to some temporary buffer size - * or if this is an SMU imposed limit. This driver has the same limitation - * for now as I use a 0x10 bytes temporary buffer as well - * - * Once that is completed, a response is expected from the SMU. This is - * obtained via a command of type 0x9a with a length of 1 byte containing - * 0 as the data byte. OF also fills the rest of the data buffer with 0xff's - * though I can't tell yet if this is actually necessary. Once this command - * is complete, at this point, all I can tell is what OF does. OF tests - * byte 0 of the reply: - * - on read, 0xfe or 0xfc : bus is busy, wait (see below) or nak ? - * - on read, 0x00 or 0x01 : reply is in buffer (after the byte 0) - * - on write, < 0 -> failure (immediate exit) - * - else, OF just exists (without error, weird) - * - * So on read, there is this wait-for-busy thing when getting a 0xfc or - * 0xfe result. OF does a loop of up to 64 retries, waiting 20ms and - * doing the above again until either the retries expire or the result - * is no longer 0xfe or 0xfc - * - * The Darwin I2C driver is less subtle though. On any non-success status - * from the response command, it waits 5ms and tries again up to 20 times, - * it doesn't differenciate between fatal errors or "busy" status. - * - * This driver provides an asynchronous paramblock based i2c command - * interface to be used either directly by low level code or by a higher - * level driver interfacing to the linux i2c layer. The current - * implementation of this relies on working timers & timer interrupts - * though, so be careful of calling context for now. This may be "fixed" - * in the future by adding a polling facility. - */ -#define SMU_CMD_I2C_COMMAND 0x9a - /* transfer types */ -#define SMU_I2C_TRANSFER_SIMPLE 0x00 -#define SMU_I2C_TRANSFER_STDSUB 0x01 -#define SMU_I2C_TRANSFER_COMBINED 0x02 - -/* - * Power supply control - * - * The "sub" command is an ASCII string in the data, the - * data lenght is that of the string. - * - * The VSLEW command can be used to get or set the voltage slewing. - * - lenght 5 (only "VSLEW") : it returns "DONE" and 3 bytes of - * reply at data offset 6, 7 and 8. - * - lenght 8 ("VSLEWxyz") has 3 additional bytes appended, and is - * used to set the voltage slewing point. The SMU replies with "DONE" - * I yet have to figure out their exact meaning of those 3 bytes in - * both cases. - * - */ -#define SMU_CMD_POWER_COMMAND 0xaa -#define SMU_CMD_POWER_RESTART "RESTART" -#define SMU_CMD_POWER_SHUTDOWN "SHUTDOWN" -#define SMU_CMD_POWER_VOLTAGE_SLEW "VSLEW" - -/* Misc commands - * - * This command seem to be a grab bag of various things - */ -#define SMU_CMD_MISC_df_COMMAND 0xdf -#define SMU_CMD_MISC_df_SET_DISPLAY_LIT 0x02 /* i: 1 byte */ -#define SMU_CMD_MISC_df_NMI_OPTION 0x04 - -/* - * Version info commands - * - * I haven't quite tried to figure out how these work - */ -#define SMU_CMD_VERSION_COMMAND 0xea - - -/* - * Misc commands - * - * This command seem to be a grab bag of various things - */ -#define SMU_CMD_MISC_ee_COMMAND 0xee -#define SMU_CMD_MISC_ee_GET_DATABLOCK_REC 0x02 -#define SMU_CMD_MISC_ee_LEDS_CTRL 0x04 /* i: 00 (00,01) [00] */ -#define SMU_CMD_MISC_ee_GET_DATA 0x05 /* i: 00 , o: ?? */ - - - -/* - * - Kernel side interface - - */ - -#ifdef __KERNEL__ - -/* - * Asynchronous SMU commands - * - * Fill up this structure and submit it via smu_queue_command(), - * and get notified by the optional done() callback, or because - * status becomes != 1 - */ - -struct smu_cmd; - -struct smu_cmd -{ - /* public */ - u8 cmd; /* command */ - int data_len; /* data len */ - int reply_len; /* reply len */ - void *data_buf; /* data buffer */ - void *reply_buf; /* reply buffer */ - int status; /* command status */ - void (*done)(struct smu_cmd *cmd, void *misc); - void *misc; - - /* private */ - struct list_head link; -}; - -/* - * Queues an SMU command, all fields have to be initialized - */ -extern int smu_queue_cmd(struct smu_cmd *cmd); - -/* - * Simple command wrapper. This structure embeds a small buffer - * to ease sending simple SMU commands from the stack - */ -struct smu_simple_cmd -{ - struct smu_cmd cmd; - u8 buffer[16]; -}; - -/* - * Queues a simple command. All fields will be initialized by that - * function - */ -extern int smu_queue_simple(struct smu_simple_cmd *scmd, u8 command, - unsigned int data_len, - void (*done)(struct smu_cmd *cmd, void *misc), - void *misc, - ...); - -/* - * Completion helper. Pass it to smu_queue_simple or as 'done' - * member to smu_queue_cmd, it will call complete() on the struct - * completion passed in the "misc" argument - */ -extern void smu_done_complete(struct smu_cmd *cmd, void *misc); /* - * Synchronous helpers. Will spin-wait for completion of a command - */ -extern void smu_spinwait_cmd(struct smu_cmd *cmd); - -static inline void smu_spinwait_simple(struct smu_simple_cmd *scmd) -{ - smu_spinwait_cmd(&scmd->cmd); -} - -/* - * Poll routine to call if blocked with irqs off - */ -extern void smu_poll(void); - - -/* - * Init routine, presence check.... + * Basic routines for use by architecture. To be extended as + * we understand more of the chip */ extern int smu_init(void); extern int smu_present(void); -struct of_device; -extern struct of_device *smu_get_ofdev(void); - - -/* - * Common command wrappers - */ extern void smu_shutdown(void); extern void smu_restart(void); -struct rtc_time; -extern int smu_get_rtc_time(struct rtc_time *time, int spinwait); -extern int smu_set_rtc_time(struct rtc_time *time, int spinwait); +extern int smu_get_rtc_time(struct rtc_time *time); +extern int smu_set_rtc_time(struct rtc_time *time); /* * SMU command buffer absolute address, exported by pmac_setup, * this is allocated very early during boot. */ extern unsigned long smu_cmdbuf_abs; - - -/* - * Kenrel asynchronous i2c interface - */ - -/* SMU i2c header, exactly matches i2c header on wire */ -struct smu_i2c_param -{ - u8 bus; /* SMU bus ID (from device tree) */ - u8 type; /* i2c transfer type */ - u8 devaddr; /* device address (includes direction) */ - u8 sublen; /* subaddress length */ - u8 subaddr[3]; /* subaddress */ - u8 caddr; /* combined address, filled by SMU driver */ - u8 datalen; /* length of transfer */ - u8 data[7]; /* data */ -}; - -#define SMU_I2C_READ_MAX 0x0d -#define SMU_I2C_WRITE_MAX 0x05 - -struct smu_i2c_cmd -{ - /* public */ - struct smu_i2c_param info; - void (*done)(struct smu_i2c_cmd *cmd, void *misc); - void *misc; - int status; /* 1 = pending, 0 = ok, <0 = fail */ - - /* private */ - struct smu_cmd scmd; - int read; - int stage; - int retries; - u8 pdata[0x10]; - struct list_head link; -}; - -/* - * Call this to queue an i2c command to the SMU. You must fill info, - * including info.data for a write, done and misc. - * For now, no polling interface is provided so you have to use completion - * callback. - */ -extern int smu_queue_i2c(struct smu_i2c_cmd *cmd); - - -#endif /* __KERNEL__ */ - -/* - * - Userland interface - - */ - -/* - * A given instance of the device can be configured for 2 different - * things at the moment: - * - * - sending SMU commands (default at open() time) - * - receiving SMU events (not yet implemented) - * - * Commands are written with write() of a command block. They can be - * "driver" commands (for example to switch to event reception mode) - * or real SMU commands. They are made of a header followed by command - * data if any. - * - * For SMU commands (not for driver commands), you can then read() back - * a reply. The reader will be blocked or not depending on how the device - * file is opened. poll() isn't implemented yet. The reply will consist - * of a header as well, followed by the reply data if any. You should - * always provide a buffer large enough for the maximum reply data, I - * recommand one page. - * - * It is illegal to send SMU commands through a file descriptor configured - * for events reception - * - */ -struct smu_user_cmd_hdr -{ - __u32 cmdtype; -#define SMU_CMDTYPE_SMU 0 /* SMU command */ -#define SMU_CMDTYPE_WANTS_EVENTS 1 /* switch fd to events mode */ - - __u8 cmd; /* SMU command byte */ - __u32 data_len; /* Lenght of data following */ -}; - -struct smu_user_reply_hdr -{ - __u32 status; /* Command status */ - __u32 reply_len; /* Lenght of data follwing */ -}; - -#endif /* _SMU_H */ diff --git a/trunk/include/asm-um/pgtable.h b/trunk/include/asm-um/pgtable.h index 616d02b57ea9..ed06170e0edd 100644 --- a/trunk/include/asm-um/pgtable.h +++ b/trunk/include/asm-um/pgtable.h @@ -346,6 +346,7 @@ static inline void set_pte(pte_t *pteptr, pte_t pteval) static inline pte_t pte_modify(pte_t pte, pgprot_t newprot) { pte_set_val(pte, (pte_val(pte) & _PAGE_CHG_MASK), newprot); + if(pte_present(pte)) pte = pte_mknewpage(pte_mknewprot(pte)); return pte; } diff --git a/trunk/include/asm-xtensa/atomic.h b/trunk/include/asm-xtensa/atomic.h index 12b5732dc6e5..24f86f0e43cf 100644 --- a/trunk/include/asm-xtensa/atomic.h +++ b/trunk/include/asm-xtensa/atomic.h @@ -22,7 +22,7 @@ typedef struct { volatile int counter; } atomic_t; #include #include -#define ATOMIC_INIT(i) { (i) } +#define ATOMIC_INIT(i) ( (atomic_t) { (i) } ) /* * This Xtensa implementation assumes that the right mechanism diff --git a/trunk/include/asm-xtensa/bitops.h b/trunk/include/asm-xtensa/bitops.h index e76ee889e21d..d395ef226c32 100644 --- a/trunk/include/asm-xtensa/bitops.h +++ b/trunk/include/asm-xtensa/bitops.h @@ -174,7 +174,7 @@ static __inline__ int test_bit(int nr, const volatile void *addr) return 1UL & (((const volatile unsigned int *)addr)[nr>>5] >> (nr&31)); } -#if XCHAL_HAVE_NSA +#if XCHAL_HAVE_NSAU static __inline__ int __cntlz (unsigned long x) { diff --git a/trunk/include/asm-xtensa/hardirq.h b/trunk/include/asm-xtensa/hardirq.h index aa9c1adf68d7..e07c76c36b95 100644 --- a/trunk/include/asm-xtensa/hardirq.h +++ b/trunk/include/asm-xtensa/hardirq.h @@ -23,7 +23,6 @@ typedef struct { unsigned int __nmi_count; /* arch dependent */ } ____cacheline_aligned irq_cpustat_t; -void ack_bad_irq(unsigned int irq); #include /* Standard mappings for irq_cpustat_t above */ #endif /* _XTENSA_HARDIRQ_H */ diff --git a/trunk/include/asm-xtensa/semaphore.h b/trunk/include/asm-xtensa/semaphore.h index 09e89ab3eb61..db740b8bc6f0 100644 --- a/trunk/include/asm-xtensa/semaphore.h +++ b/trunk/include/asm-xtensa/semaphore.h @@ -20,19 +20,28 @@ struct semaphore { atomic_t count; int sleepers; wait_queue_head_t wait; +#if WAITQUEUE_DEBUG + long __magic; +#endif }; -#define __SEMAPHORE_INITIALIZER(name,n) \ -{ \ - .count = ATOMIC_INIT(n), \ - .sleepers = 0, \ - .wait = __WAIT_QUEUE_HEAD_INITIALIZER((name).wait) \ -} +#if WAITQUEUE_DEBUG +# define __SEM_DEBUG_INIT(name) \ + , (int)&(name).__magic +#else +# define __SEM_DEBUG_INIT(name) +#endif + +#define __SEMAPHORE_INITIALIZER(name,count) \ + { ATOMIC_INIT(count), \ + 0, \ + __WAIT_QUEUE_HEAD_INITIALIZER((name).wait) \ + __SEM_DEBUG_INIT(name) } -#define __MUTEX_INITIALIZER(name) \ +#define __MUTEX_INITIALIZER(name) \ __SEMAPHORE_INITIALIZER(name, 1) -#define __DECLARE_SEMAPHORE_GENERIC(name,count) \ +#define __DECLARE_SEMAPHORE_GENERIC(name,count) \ struct semaphore name = __SEMAPHORE_INITIALIZER(name,count) #define DECLARE_MUTEX(name) __DECLARE_SEMAPHORE_GENERIC(name,1) @@ -40,8 +49,17 @@ struct semaphore { static inline void sema_init (struct semaphore *sem, int val) { +/* + * *sem = (struct semaphore)__SEMAPHORE_INITIALIZER((*sem),val); + * + * i'd rather use the more flexible initialization above, but sadly + * GCC 2.7.2.3 emits a bogus warning. EGCS doesnt. Oh well. + */ atomic_set(&sem->count, val); init_waitqueue_head(&sem->wait); +#if WAITQUEUE_DEBUG + sem->__magic = (int)&sem->__magic; +#endif } static inline void init_MUTEX (struct semaphore *sem) @@ -63,7 +81,9 @@ extern spinlock_t semaphore_wake_lock; static inline void down(struct semaphore * sem) { - might_sleep(); +#if WAITQUEUE_DEBUG + CHECK_MAGIC(sem->__magic); +#endif if (atomic_sub_return(1, &sem->count) < 0) __down(sem); @@ -72,8 +92,9 @@ static inline void down(struct semaphore * sem) static inline int down_interruptible(struct semaphore * sem) { int ret = 0; - - might_sleep(); +#if WAITQUEUE_DEBUG + CHECK_MAGIC(sem->__magic); +#endif if (atomic_sub_return(1, &sem->count) < 0) ret = __down_interruptible(sem); @@ -83,6 +104,9 @@ static inline int down_interruptible(struct semaphore * sem) static inline int down_trylock(struct semaphore * sem) { int ret = 0; +#if WAITQUEUE_DEBUG + CHECK_MAGIC(sem->__magic); +#endif if (atomic_sub_return(1, &sem->count) < 0) ret = __down_trylock(sem); @@ -95,6 +119,9 @@ static inline int down_trylock(struct semaphore * sem) */ static inline void up(struct semaphore * sem) { +#if WAITQUEUE_DEBUG + CHECK_MAGIC(sem->__magic); +#endif if (atomic_add_return(1, &sem->count) <= 0) __up(sem); } diff --git a/trunk/include/asm-xtensa/system.h b/trunk/include/asm-xtensa/system.h index 9284867f1cb9..f09393232e5e 100644 --- a/trunk/include/asm-xtensa/system.h +++ b/trunk/include/asm-xtensa/system.h @@ -189,6 +189,20 @@ static inline unsigned long xchg_u32(volatile int * m, unsigned long val) #define tas(ptr) (xchg((ptr),1)) +#if ( __XCC__ == 1 ) + +/* xt-xcc processes __inline__ differently than xt-gcc and decides to + * insert an out-of-line copy of function __xchg. This presents the + * unresolved symbol at link time of __xchg_called_with_bad_pointer, + * even though such a function would never be called at run-time. + * xt-gcc always inlines __xchg, and optimizes away the undefined + * bad_pointer function. + */ + +#define xchg(ptr,x) xchg_u32(ptr,x) + +#else /* assume xt-gcc */ + #define xchg(ptr,x) ((__typeof__(*(ptr)))__xchg((unsigned long)(x),(ptr),sizeof(*(ptr)))) /* @@ -210,6 +224,8 @@ __xchg(unsigned long x, volatile void * ptr, int size) return x; } +#endif + extern void set_except_vector(int n, void *addr); static inline void spill_registers(void) diff --git a/trunk/include/linux/netfilter_ipv4/ip_conntrack.h b/trunk/include/linux/netfilter_ipv4/ip_conntrack.h index 4ced38736813..bace72a76cc4 100644 --- a/trunk/include/linux/netfilter_ipv4/ip_conntrack.h +++ b/trunk/include/linux/netfilter_ipv4/ip_conntrack.h @@ -332,28 +332,11 @@ extern void need_ip_conntrack(void); extern int invert_tuplepr(struct ip_conntrack_tuple *inverse, const struct ip_conntrack_tuple *orig); -extern void __ip_ct_refresh_acct(struct ip_conntrack *ct, - enum ip_conntrack_info ctinfo, - const struct sk_buff *skb, - unsigned long extra_jiffies, - int do_acct); - -/* Refresh conntrack for this many jiffies and do accounting */ -static inline void ip_ct_refresh_acct(struct ip_conntrack *ct, - enum ip_conntrack_info ctinfo, - const struct sk_buff *skb, - unsigned long extra_jiffies) -{ - __ip_ct_refresh_acct(ct, ctinfo, skb, extra_jiffies, 1); -} - /* Refresh conntrack for this many jiffies */ -static inline void ip_ct_refresh(struct ip_conntrack *ct, - const struct sk_buff *skb, - unsigned long extra_jiffies) -{ - __ip_ct_refresh_acct(ct, 0, skb, extra_jiffies, 0); -} +extern void ip_ct_refresh_acct(struct ip_conntrack *ct, + enum ip_conntrack_info ctinfo, + const struct sk_buff *skb, + unsigned long extra_jiffies); /* These are for NAT. Icky. */ /* Update TCP window tracking data when NAT mangles the packet */ diff --git a/trunk/include/linux/netfilter_ipv4/ip_conntrack_pptp.h b/trunk/include/linux/netfilter_ipv4/ip_conntrack_pptp.h index 816144c75de0..389e3851d52f 100644 --- a/trunk/include/linux/netfilter_ipv4/ip_conntrack_pptp.h +++ b/trunk/include/linux/netfilter_ipv4/ip_conntrack_pptp.h @@ -60,8 +60,8 @@ struct ip_ct_pptp_expect { struct pptp_pkt_hdr { __u16 packetLength; - __be16 packetType; - __be32 magicCookie; + __u16 packetType; + __u32 magicCookie; }; /* PptpControlMessageType values */ @@ -93,7 +93,7 @@ struct pptp_pkt_hdr { #define PPTP_REMOVE_DEVICE_ERROR 6 struct PptpControlHeader { - __be16 messageType; + __u16 messageType; __u16 reserved; }; @@ -106,13 +106,13 @@ struct PptpControlHeader { #define PPTP_BEARER_CAP_DIGITAL 0x2 struct PptpStartSessionRequest { - __be16 protocolVersion; + __u16 protocolVersion; __u8 reserved1; __u8 reserved2; - __be32 framingCapability; - __be32 bearerCapability; - __be16 maxChannels; - __be16 firmwareRevision; + __u32 framingCapability; + __u32 bearerCapability; + __u16 maxChannels; + __u16 firmwareRevision; __u8 hostName[64]; __u8 vendorString[64]; }; @@ -125,13 +125,13 @@ struct PptpStartSessionRequest { #define PPTP_START_UNKNOWN_PROTOCOL 5 struct PptpStartSessionReply { - __be16 protocolVersion; + __u16 protocolVersion; __u8 resultCode; __u8 generalErrorCode; - __be32 framingCapability; - __be32 bearerCapability; - __be16 maxChannels; - __be16 firmwareRevision; + __u32 framingCapability; + __u32 bearerCapability; + __u16 maxChannels; + __u16 firmwareRevision; __u8 hostName[64]; __u8 vendorString[64]; }; @@ -155,7 +155,7 @@ struct PptpStopSessionReply { }; struct PptpEchoRequest { - __be32 identNumber; + __u32 identNumber; }; /* PptpEchoReplyResultCode */ @@ -163,7 +163,7 @@ struct PptpEchoRequest { #define PPTP_ECHO_GENERAL_ERROR 2 struct PptpEchoReply { - __be32 identNumber; + __u32 identNumber; __u8 resultCode; __u8 generalErrorCode; __u16 reserved; @@ -180,16 +180,16 @@ struct PptpEchoReply { #define PPTP_DONT_CARE_BEARER_TYPE 3 struct PptpOutCallRequest { - __be16 callID; - __be16 callSerialNumber; - __be32 minBPS; - __be32 maxBPS; - __be32 bearerType; - __be32 framingType; - __be16 packetWindow; - __be16 packetProcDelay; + __u16 callID; + __u16 callSerialNumber; + __u32 minBPS; + __u32 maxBPS; + __u32 bearerType; + __u32 framingType; + __u16 packetWindow; + __u16 packetProcDelay; __u16 reserved1; - __be16 phoneNumberLength; + __u16 phoneNumberLength; __u16 reserved2; __u8 phoneNumber[64]; __u8 subAddress[64]; @@ -205,24 +205,24 @@ struct PptpOutCallRequest { #define PPTP_OUTCALL_DONT_ACCEPT 7 struct PptpOutCallReply { - __be16 callID; - __be16 peersCallID; + __u16 callID; + __u16 peersCallID; __u8 resultCode; __u8 generalErrorCode; - __be16 causeCode; - __be32 connectSpeed; - __be16 packetWindow; - __be16 packetProcDelay; - __be32 physChannelID; + __u16 causeCode; + __u32 connectSpeed; + __u16 packetWindow; + __u16 packetProcDelay; + __u32 physChannelID; }; struct PptpInCallRequest { - __be16 callID; - __be16 callSerialNumber; - __be32 callBearerType; - __be32 physChannelID; - __be16 dialedNumberLength; - __be16 dialingNumberLength; + __u16 callID; + __u16 callSerialNumber; + __u32 callBearerType; + __u32 physChannelID; + __u16 dialedNumberLength; + __u16 dialingNumberLength; __u8 dialedNumber[64]; __u8 dialingNumber[64]; __u8 subAddress[64]; @@ -234,54 +234,61 @@ struct PptpInCallRequest { #define PPTP_INCALL_DONT_ACCEPT 3 struct PptpInCallReply { - __be16 callID; - __be16 peersCallID; + __u16 callID; + __u16 peersCallID; __u8 resultCode; __u8 generalErrorCode; - __be16 packetWindow; - __be16 packetProcDelay; + __u16 packetWindow; + __u16 packetProcDelay; __u16 reserved; }; struct PptpInCallConnected { - __be16 peersCallID; + __u16 peersCallID; __u16 reserved; - __be32 connectSpeed; - __be16 packetWindow; - __be16 packetProcDelay; - __be32 callFramingType; + __u32 connectSpeed; + __u16 packetWindow; + __u16 packetProcDelay; + __u32 callFramingType; }; struct PptpClearCallRequest { - __be16 callID; + __u16 callID; __u16 reserved; }; struct PptpCallDisconnectNotify { - __be16 callID; + __u16 callID; __u8 resultCode; __u8 generalErrorCode; - __be16 causeCode; + __u16 causeCode; __u16 reserved; __u8 callStatistics[128]; }; struct PptpWanErrorNotify { - __be16 peersCallID; + __u16 peersCallID; __u16 reserved; - __be32 crcErrors; - __be32 framingErrors; - __be32 hardwareOverRuns; - __be32 bufferOverRuns; - __be32 timeoutErrors; - __be32 alignmentErrors; + __u32 crcErrors; + __u32 framingErrors; + __u32 hardwareOverRuns; + __u32 bufferOverRuns; + __u32 timeoutErrors; + __u32 alignmentErrors; }; struct PptpSetLinkInfo { - __be16 peersCallID; + __u16 peersCallID; __u16 reserved; - __be32 sendAccm; - __be32 recvAccm; + __u32 sendAccm; + __u32 recvAccm; +}; + + +struct pptp_priv_data { + __u16 call_id; + __u16 mcall_id; + __u16 pcall_id; }; union pptp_ctrl_union { diff --git a/trunk/include/linux/netfilter_ipv4/ip_conntrack_tuple.h b/trunk/include/linux/netfilter_ipv4/ip_conntrack_tuple.h index 20e43f018b7c..14dc0f7b6556 100644 --- a/trunk/include/linux/netfilter_ipv4/ip_conntrack_tuple.h +++ b/trunk/include/linux/netfilter_ipv4/ip_conntrack_tuple.h @@ -17,7 +17,7 @@ union ip_conntrack_manip_proto u_int16_t all; struct { - __be16 port; + u_int16_t port; } tcp; struct { u_int16_t port; @@ -29,7 +29,7 @@ union ip_conntrack_manip_proto u_int16_t port; } sctp; struct { - __be16 key; /* key is 32bit, pptp only uses 16 */ + u_int16_t key; /* key is 32bit, pptp only uses 16 */ } gre; }; @@ -65,7 +65,7 @@ struct ip_conntrack_tuple u_int16_t port; } sctp; struct { - __be16 key; /* key is 32bit, + u_int16_t key; /* key is 32bit, * pptp only uses 16 */ } gre; } u; diff --git a/trunk/include/linux/reboot.h b/trunk/include/linux/reboot.h index 7ab2cdb83ef0..3b3266ff1a95 100644 --- a/trunk/include/linux/reboot.h +++ b/trunk/include/linux/reboot.h @@ -59,10 +59,6 @@ extern void machine_crash_shutdown(struct pt_regs *); * Architecture independent implemenations of sys_reboot commands. */ -extern void kernel_restart_prepare(char *cmd); -extern void kernel_halt_prepare(void); -extern void kernel_power_off_prepare(void); - extern void kernel_restart(char *cmd); extern void kernel_halt(void); extern void kernel_power_off(void); diff --git a/trunk/kernel/power/Kconfig b/trunk/kernel/power/Kconfig index 46a5e5acff97..396c7873e804 100644 --- a/trunk/kernel/power/Kconfig +++ b/trunk/kernel/power/Kconfig @@ -29,7 +29,7 @@ config PM_DEBUG config SOFTWARE_SUSPEND bool "Software Suspend" - depends on PM && SWAP && (X86 && (!SMP || SUSPEND_SMP)) || ((FVR || PPC32) && !SMP) + depends on PM && SWAP && (X86 || ((FVR || PPC32) && !SMP)) ---help--- Enable the possibility of suspending the machine. It doesn't need APM. diff --git a/trunk/kernel/power/disk.c b/trunk/kernel/power/disk.c index 761956e813f5..2d8bf054d036 100644 --- a/trunk/kernel/power/disk.c +++ b/trunk/kernel/power/disk.c @@ -17,12 +17,12 @@ #include #include #include -#include #include "power.h" extern suspend_disk_method_t pm_disk_mode; +extern struct pm_ops * pm_ops; extern int swsusp_suspend(void); extern int swsusp_write(void); @@ -49,11 +49,13 @@ dev_t swsusp_resume_device; static void power_down(suspend_disk_method_t mode) { + unsigned long flags; int error = 0; + local_irq_save(flags); switch(mode) { case PM_DISK_PLATFORM: - kernel_power_off_prepare(); + device_shutdown(); error = pm_ops->enter(PM_SUSPEND_DISK); break; case PM_DISK_SHUTDOWN: diff --git a/trunk/kernel/power/power.h b/trunk/kernel/power/power.h index 9c9167d910dd..cd6a3493cc0d 100644 --- a/trunk/kernel/power/power.h +++ b/trunk/kernel/power/power.h @@ -1,7 +1,7 @@ #include #include -/* With SUSPEND_CONSOLE defined suspend looks *really* cool, but +/* With SUSPEND_CONSOLE defined, it suspend looks *really* cool, but we probably do not take enough locks for switching consoles, etc, so bad things might happen. */ diff --git a/trunk/kernel/power/swsusp.c b/trunk/kernel/power/swsusp.c index 1cc9ff25e479..d967e875ee82 100644 --- a/trunk/kernel/power/swsusp.c +++ b/trunk/kernel/power/swsusp.c @@ -363,7 +363,7 @@ static void lock_swapdevices(void) } /** - * write_page - Write one page to a fresh swap location. + * write_swap_page - Write one page to a fresh swap location. * @addr: Address we're writing. * @loc: Place to store the entry we used. * @@ -863,9 +863,6 @@ static int alloc_image_pages(void) return 0; } -/* Free pages we allocated for suspend. Suspend pages are alocated - * before atomic copy, so we need to free them after resume. - */ void swsusp_free(void) { BUG_ON(PageNosave(virt_to_page(pagedir_save))); @@ -921,7 +918,6 @@ static int swsusp_alloc(void) pagedir_nosave = NULL; nr_copy_pages = calc_nr(nr_copy_pages); - nr_copy_pages_check = nr_copy_pages; pr_debug("suspend: (pages needed: %d + %d free: %d)\n", nr_copy_pages, PAGES_FOR_IO, nr_free_pages()); @@ -944,6 +940,7 @@ static int swsusp_alloc(void) return error; } + nr_copy_pages_check = nr_copy_pages; return 0; } @@ -1216,9 +1213,8 @@ static struct pbe * swsusp_pagedir_relocate(struct pbe *pblist) free_pagedir(pblist); free_eaten_memory(); pblist = NULL; - /* Is this even worth handling? It should never ever happen, and we - have just lost user's state, anyway... */ - } else + } + else printk("swsusp: Relocated %d pages\n", rel); return pblist; diff --git a/trunk/kernel/signal.c b/trunk/kernel/signal.c index 5a274705ba19..b92c3c9f8b9a 100644 --- a/trunk/kernel/signal.c +++ b/trunk/kernel/signal.c @@ -936,31 +936,34 @@ force_sig_specific(int sig, struct task_struct *t) * as soon as they're available, so putting the signal on the shared queue * will be equivalent to sending it to one such thread. */ -static inline int wants_signal(int sig, struct task_struct *p) -{ - if (sigismember(&p->blocked, sig)) - return 0; - if (p->flags & PF_EXITING) - return 0; - if (sig == SIGKILL) - return 1; - if (p->state & (TASK_STOPPED | TASK_TRACED)) - return 0; - return task_curr(p) || !signal_pending(p); -} +#define wants_signal(sig, p, mask) \ + (!sigismember(&(p)->blocked, sig) \ + && !((p)->state & mask) \ + && !((p)->flags & PF_EXITING) \ + && (task_curr(p) || !signal_pending(p))) + static void __group_complete_signal(int sig, struct task_struct *p) { + unsigned int mask; struct task_struct *t; + /* + * Don't bother traced and stopped tasks (but + * SIGKILL will punch through that). + */ + mask = TASK_STOPPED | TASK_TRACED; + if (sig == SIGKILL) + mask = 0; + /* * Now find a thread we can wake up to take the signal off the queue. * * If the main thread wants the signal, it gets first crack. * Probably the least surprising to the average bear. */ - if (wants_signal(sig, p)) + if (wants_signal(sig, p, mask)) t = p; else if (thread_group_empty(p)) /* @@ -978,7 +981,7 @@ __group_complete_signal(int sig, struct task_struct *p) t = p->signal->curr_target = p; BUG_ON(t->tgid != p->tgid); - while (!wants_signal(sig, t)) { + while (!wants_signal(sig, t, mask)) { t = next_thread(t); if (t == p->signal->curr_target) /* diff --git a/trunk/kernel/sys.c b/trunk/kernel/sys.c index 2fa1ed18123c..f723522e6986 100644 --- a/trunk/kernel/sys.c +++ b/trunk/kernel/sys.c @@ -361,35 +361,17 @@ asmlinkage long sys_getpriority(int which, int who) return retval; } -/** - * emergency_restart - reboot the system - * - * Without shutting down any hardware or taking any locks - * reboot the system. This is called when we know we are in - * trouble so this is our best effort to reboot. This is - * safe to call in interrupt context. - */ void emergency_restart(void) { machine_emergency_restart(); } EXPORT_SYMBOL_GPL(emergency_restart); -/** - * kernel_restart - reboot the system - * - * Shutdown everything and perform a clean reboot. - * This is not safe to call in interrupt context. - */ -void kernel_restart_prepare(char *cmd) +void kernel_restart(char *cmd) { notifier_call_chain(&reboot_notifier_list, SYS_RESTART, cmd); system_state = SYSTEM_RESTART; device_shutdown(); -} -void kernel_restart(char *cmd) -{ - kernel_restart_prepare(cmd); if (!cmd) { printk(KERN_EMERG "Restarting system.\n"); } else { @@ -400,12 +382,6 @@ void kernel_restart(char *cmd) } EXPORT_SYMBOL_GPL(kernel_restart); -/** - * kernel_kexec - reboot the system - * - * Move into place and start executing a preloaded standalone - * executable. If nothing was preloaded return an error. - */ void kernel_kexec(void) { #ifdef CONFIG_KEXEC @@ -414,7 +390,9 @@ void kernel_kexec(void) if (!image) { return; } - kernel_restart_prepare(NULL); + notifier_call_chain(&reboot_notifier_list, SYS_RESTART, NULL); + system_state = SYSTEM_RESTART; + device_shutdown(); printk(KERN_EMERG "Starting new kernel\n"); machine_shutdown(); machine_kexec(image); @@ -422,39 +400,21 @@ void kernel_kexec(void) } EXPORT_SYMBOL_GPL(kernel_kexec); -/** - * kernel_halt - halt the system - * - * Shutdown everything and perform a clean system halt. - */ -void kernel_halt_prepare(void) +void kernel_halt(void) { notifier_call_chain(&reboot_notifier_list, SYS_HALT, NULL); system_state = SYSTEM_HALT; device_shutdown(); -} -void kernel_halt(void) -{ - kernel_halt_prepare(); printk(KERN_EMERG "System halted.\n"); machine_halt(); } EXPORT_SYMBOL_GPL(kernel_halt); -/** - * kernel_power_off - power_off the system - * - * Shutdown everything and perform a clean system power_off. - */ -void kernel_power_off_prepare(void) +void kernel_power_off(void) { notifier_call_chain(&reboot_notifier_list, SYS_POWER_OFF, NULL); system_state = SYSTEM_POWER_OFF; device_shutdown(); -} -void kernel_power_off(void) -{ - kernel_power_off_prepare(); printk(KERN_EMERG "Power down.\n"); machine_power_off(); } diff --git a/trunk/mm/slab.c b/trunk/mm/slab.c index c9adfce00405..437d3388054b 100644 --- a/trunk/mm/slab.c +++ b/trunk/mm/slab.c @@ -308,12 +308,12 @@ struct kmem_list3 __initdata initkmem_list3[NUM_INIT_LISTS]; #define SIZE_L3 (1 + MAX_NUMNODES) /* - * This function must be completely optimized away if + * This function may be completely optimized away if * a constant is passed to it. Mostly the same as * what is in linux/slab.h except it returns an * index. */ -static __always_inline int index_of(const size_t size) +static inline int index_of(const size_t size) { if (__builtin_constant_p(size)) { int i = 0; @@ -329,8 +329,7 @@ static __always_inline int index_of(const size_t size) extern void __bad_size(void); __bad_size(); } - } else - BUG(); + } return 0; } @@ -640,7 +639,7 @@ static enum { static DEFINE_PER_CPU(struct work_struct, reap_work); -static void free_block(kmem_cache_t* cachep, void** objpp, int len, int node); +static void free_block(kmem_cache_t* cachep, void** objpp, int len); static void enable_cpucache (kmem_cache_t *cachep); static void cache_reap (void *unused); static int __node_shrink(kmem_cache_t *cachep, int node); @@ -805,7 +804,7 @@ static inline void __drain_alien_cache(kmem_cache_t *cachep, struct array_cache if (ac->avail) { spin_lock(&rl3->list_lock); - free_block(cachep, ac->entry, ac->avail, node); + free_block(cachep, ac->entry, ac->avail); ac->avail = 0; spin_unlock(&rl3->list_lock); } @@ -926,7 +925,7 @@ static int __devinit cpuup_callback(struct notifier_block *nfb, /* Free limit for this kmem_list3 */ l3->free_limit -= cachep->batchcount; if (nc) - free_block(cachep, nc->entry, nc->avail, node); + free_block(cachep, nc->entry, nc->avail); if (!cpus_empty(mask)) { spin_unlock(&l3->list_lock); @@ -935,7 +934,7 @@ static int __devinit cpuup_callback(struct notifier_block *nfb, if (l3->shared) { free_block(cachep, l3->shared->entry, - l3->shared->avail, node); + l3->shared->avail); kfree(l3->shared); l3->shared = NULL; } @@ -1883,13 +1882,12 @@ static void do_drain(void *arg) { kmem_cache_t *cachep = (kmem_cache_t*)arg; struct array_cache *ac; - int node = numa_node_id(); check_irq_off(); ac = ac_data(cachep); - spin_lock(&cachep->nodelists[node]->list_lock); - free_block(cachep, ac->entry, ac->avail, node); - spin_unlock(&cachep->nodelists[node]->list_lock); + spin_lock(&cachep->nodelists[numa_node_id()]->list_lock); + free_block(cachep, ac->entry, ac->avail); + spin_unlock(&cachep->nodelists[numa_node_id()]->list_lock); ac->avail = 0; } @@ -2610,7 +2608,7 @@ static void *__cache_alloc_node(kmem_cache_t *cachep, int flags, int nodeid) /* * Caller needs to acquire correct kmem_list's list_lock */ -static void free_block(kmem_cache_t *cachep, void **objpp, int nr_objects, int node) +static void free_block(kmem_cache_t *cachep, void **objpp, int nr_objects) { int i; struct kmem_list3 *l3; @@ -2619,12 +2617,14 @@ static void free_block(kmem_cache_t *cachep, void **objpp, int nr_objects, int n void *objp = objpp[i]; struct slab *slabp; unsigned int objnr; + int nodeid = 0; slabp = GET_PAGE_SLAB(virt_to_page(objp)); - l3 = cachep->nodelists[node]; + nodeid = slabp->nodeid; + l3 = cachep->nodelists[nodeid]; list_del(&slabp->list); objnr = (objp - slabp->s_mem) / cachep->objsize; - check_spinlock_acquired_node(cachep, node); + check_spinlock_acquired_node(cachep, nodeid); check_slabp(cachep, slabp); @@ -2664,14 +2664,13 @@ static void cache_flusharray(kmem_cache_t *cachep, struct array_cache *ac) { int batchcount; struct kmem_list3 *l3; - int node = numa_node_id(); batchcount = ac->batchcount; #if DEBUG BUG_ON(!batchcount || batchcount > ac->avail); #endif check_irq_off(); - l3 = cachep->nodelists[node]; + l3 = cachep->nodelists[numa_node_id()]; spin_lock(&l3->list_lock); if (l3->shared) { struct array_cache *shared_array = l3->shared; @@ -2687,7 +2686,7 @@ static void cache_flusharray(kmem_cache_t *cachep, struct array_cache *ac) } } - free_block(cachep, ac->entry, batchcount, node); + free_block(cachep, ac->entry, batchcount); free_done: #if STATS { @@ -2752,7 +2751,7 @@ static inline void __cache_free(kmem_cache_t *cachep, void *objp) } else { spin_lock(&(cachep->nodelists[nodeid])-> list_lock); - free_block(cachep, &objp, 1, nodeid); + free_block(cachep, &objp, 1); spin_unlock(&(cachep->nodelists[nodeid])-> list_lock); } @@ -2845,7 +2844,7 @@ void *kmem_cache_alloc_node(kmem_cache_t *cachep, unsigned int __nocast flags, i unsigned long save_flags; void *ptr; - if (nodeid == -1) + if (nodeid == numa_node_id() || nodeid == -1) return __cache_alloc(cachep, flags); if (unlikely(!cachep->nodelists[nodeid])) { @@ -3080,7 +3079,7 @@ static int alloc_kmemlist(kmem_cache_t *cachep) if ((nc = cachep->nodelists[node]->shared)) free_block(cachep, nc->entry, - nc->avail, node); + nc->avail); l3->shared = new; if (!cachep->nodelists[node]->alien) { @@ -3161,7 +3160,7 @@ static int do_tune_cpucache(kmem_cache_t *cachep, int limit, int batchcount, if (!ccold) continue; spin_lock_irq(&cachep->nodelists[cpu_to_node(i)]->list_lock); - free_block(cachep, ccold->entry, ccold->avail, cpu_to_node(i)); + free_block(cachep, ccold->entry, ccold->avail); spin_unlock_irq(&cachep->nodelists[cpu_to_node(i)]->list_lock); kfree(ccold); } @@ -3241,7 +3240,7 @@ static void drain_array_locked(kmem_cache_t *cachep, if (tofree > ac->avail) { tofree = (ac->avail+1)/2; } - free_block(cachep, ac->entry, tofree, node); + free_block(cachep, ac->entry, tofree); ac->avail -= tofree; memmove(ac->entry, &(ac->entry[tofree]), sizeof(void*)*ac->avail); diff --git a/trunk/mm/swapfile.c b/trunk/mm/swapfile.c index 1dcaeda039f4..0184f510aace 100644 --- a/trunk/mm/swapfile.c +++ b/trunk/mm/swapfile.c @@ -1381,7 +1381,6 @@ asmlinkage long sys_swapon(const char __user * specialfile, int swap_flags) error = bd_claim(bdev, sys_swapon); if (error < 0) { bdev = NULL; - error = -EINVAL; goto bad_swap; } p->old_block_size = block_size(bdev); diff --git a/trunk/net/bridge/br_forward.c b/trunk/net/bridge/br_forward.c index 2d24fb400e0c..069253f830c1 100644 --- a/trunk/net/bridge/br_forward.c +++ b/trunk/net/bridge/br_forward.c @@ -31,8 +31,7 @@ static inline int should_deliver(const struct net_bridge_port *p, int br_dev_queue_push_xmit(struct sk_buff *skb) { - /* drop mtu oversized packets except tso */ - if (skb->len > skb->dev->mtu && !skb_shinfo(skb)->tso_size) + if (skb->len > skb->dev->mtu) kfree_skb(skb); else { #ifdef CONFIG_BRIDGE_NETFILTER diff --git a/trunk/net/ipv4/netfilter/ip_conntrack_amanda.c b/trunk/net/ipv4/netfilter/ip_conntrack_amanda.c index fa3f914117ec..dc20881004bc 100644 --- a/trunk/net/ipv4/netfilter/ip_conntrack_amanda.c +++ b/trunk/net/ipv4/netfilter/ip_conntrack_amanda.c @@ -65,7 +65,7 @@ static int help(struct sk_buff **pskb, /* increase the UDP timeout of the master connection as replies from * Amanda clients to the server can be quite delayed */ - ip_ct_refresh(ct, *pskb, master_timeout * HZ); + ip_ct_refresh_acct(ct, ctinfo, NULL, master_timeout * HZ); /* No data? */ dataoff = (*pskb)->nh.iph->ihl*4 + sizeof(struct udphdr); diff --git a/trunk/net/ipv4/netfilter/ip_conntrack_core.c b/trunk/net/ipv4/netfilter/ip_conntrack_core.c index ea65dd3e517a..c1f82e0c81cf 100644 --- a/trunk/net/ipv4/netfilter/ip_conntrack_core.c +++ b/trunk/net/ipv4/netfilter/ip_conntrack_core.c @@ -1112,46 +1112,45 @@ void ip_conntrack_helper_unregister(struct ip_conntrack_helper *me) synchronize_net(); } -/* Refresh conntrack for this many jiffies and do accounting if do_acct is 1 */ -void __ip_ct_refresh_acct(struct ip_conntrack *ct, +static inline void ct_add_counters(struct ip_conntrack *ct, + enum ip_conntrack_info ctinfo, + const struct sk_buff *skb) +{ +#ifdef CONFIG_IP_NF_CT_ACCT + if (skb) { + ct->counters[CTINFO2DIR(ctinfo)].packets++; + ct->counters[CTINFO2DIR(ctinfo)].bytes += + ntohs(skb->nh.iph->tot_len); + } +#endif +} + +/* Refresh conntrack for this many jiffies and do accounting (if skb != NULL) */ +void ip_ct_refresh_acct(struct ip_conntrack *ct, enum ip_conntrack_info ctinfo, const struct sk_buff *skb, - unsigned long extra_jiffies, - int do_acct) + unsigned long extra_jiffies) { - int do_event = 0; - IP_NF_ASSERT(ct->timeout.data == (unsigned long)ct); - IP_NF_ASSERT(skb); - - write_lock_bh(&ip_conntrack_lock); /* If not in hash table, timer will not be active yet */ if (!is_confirmed(ct)) { ct->timeout.expires = extra_jiffies; - do_event = 1; + ct_add_counters(ct, ctinfo, skb); } else { + write_lock_bh(&ip_conntrack_lock); /* Need del_timer for race avoidance (may already be dying). */ if (del_timer(&ct->timeout)) { ct->timeout.expires = jiffies + extra_jiffies; add_timer(&ct->timeout); - do_event = 1; + /* FIXME: We loose some REFRESH events if this function + * is called without an skb. I'll fix this later -HW */ + if (skb) + ip_conntrack_event_cache(IPCT_REFRESH, skb); } + ct_add_counters(ct, ctinfo, skb); + write_unlock_bh(&ip_conntrack_lock); } - -#ifdef CONFIG_IP_NF_CT_ACCT - if (do_acct) { - ct->counters[CTINFO2DIR(ctinfo)].packets++; - ct->counters[CTINFO2DIR(ctinfo)].bytes += - ntohs(skb->nh.iph->tot_len); - } -#endif - - write_unlock_bh(&ip_conntrack_lock); - - /* must be unlocked when calling event cache */ - if (do_event) - ip_conntrack_event_cache(IPCT_REFRESH, skb); } #if defined(CONFIG_IP_NF_CONNTRACK_NETLINK) || \ diff --git a/trunk/net/ipv4/netfilter/ip_conntrack_helper_pptp.c b/trunk/net/ipv4/netfilter/ip_conntrack_helper_pptp.c index 926a6684643d..79db5b70d5f6 100644 --- a/trunk/net/ipv4/netfilter/ip_conntrack_helper_pptp.c +++ b/trunk/net/ipv4/netfilter/ip_conntrack_helper_pptp.c @@ -172,6 +172,7 @@ static int destroy_sibling_or_exp(const struct ip_conntrack_tuple *t) DEBUGP("setting timeout of conntrack %p to 0\n", sibling); sibling->proto.gre.timeout = 0; sibling->proto.gre.stream_timeout = 0; + /* refresh_acct will not modify counters if skb == NULL */ if (del_timer(&sibling->timeout)) sibling->timeout.function((unsigned long)sibling); ip_conntrack_put(sibling); @@ -222,8 +223,8 @@ static void pptp_destroy_siblings(struct ip_conntrack *ct) static inline int exp_gre(struct ip_conntrack *master, u_int32_t seq, - __be16 callid, - __be16 peer_callid) + u_int16_t callid, + u_int16_t peer_callid) { struct ip_conntrack_tuple inv_tuple; struct ip_conntrack_tuple exp_tuples[] = { @@ -262,7 +263,7 @@ exp_gre(struct ip_conntrack *master, exp_orig->mask.src.ip = 0xffffffff; exp_orig->mask.src.u.all = 0; exp_orig->mask.dst.u.all = 0; - exp_orig->mask.dst.u.gre.key = htons(0xffff); + exp_orig->mask.dst.u.gre.key = 0xffff; exp_orig->mask.dst.ip = 0xffffffff; exp_orig->mask.dst.protonum = 0xff; @@ -339,8 +340,7 @@ pptp_inbound_pkt(struct sk_buff **pskb, unsigned int reqlen; union pptp_ctrl_union _pptpReq, *pptpReq; struct ip_ct_pptp_master *info = &ct->help.ct_pptp_info; - u_int16_t msg; - __be16 *cid, *pcid; + u_int16_t msg, *cid, *pcid; u_int32_t seq; ctlh = skb_header_pointer(*pskb, nexthdr_off, sizeof(_ctlh), &_ctlh); @@ -485,7 +485,7 @@ pptp_inbound_pkt(struct sk_buff **pskb, if (info->pns_call_id != ntohs(*pcid)) { DEBUGP("%s for unknown CallID %u\n", - pptp_msg_name[msg], ntohs(*pcid)); + pptp_msg_name[msg], ntohs(*cid)); break; } @@ -551,8 +551,7 @@ pptp_outbound_pkt(struct sk_buff **pskb, unsigned int reqlen; union pptp_ctrl_union _pptpReq, *pptpReq; struct ip_ct_pptp_master *info = &ct->help.ct_pptp_info; - u_int16_t msg; - __be16 *cid, *pcid; + u_int16_t msg, *cid, *pcid; ctlh = skb_header_pointer(*pskb, nexthdr_off, sizeof(_ctlh), &_ctlh); if (!ctlh) @@ -756,7 +755,7 @@ static struct ip_conntrack_helper pptp = { } }, .mask = { .src = { .ip = 0, - .u = { .tcp = { .port = __constant_htons(0xffff) } } + .u = { .tcp = { .port = 0xffff } } }, .dst = { .ip = 0, .u = { .all = 0 }, diff --git a/trunk/net/ipv4/netfilter/ip_conntrack_netbios_ns.c b/trunk/net/ipv4/netfilter/ip_conntrack_netbios_ns.c index 577bac22dcc6..71ef19d126d0 100644 --- a/trunk/net/ipv4/netfilter/ip_conntrack_netbios_ns.c +++ b/trunk/net/ipv4/netfilter/ip_conntrack_netbios_ns.c @@ -91,7 +91,7 @@ static int help(struct sk_buff **pskb, ip_conntrack_expect_related(exp); ip_conntrack_expect_put(exp); - ip_ct_refresh(ct, *pskb, timeout * HZ); + ip_ct_refresh_acct(ct, ctinfo, NULL, timeout * HZ); out: return NF_ACCEPT; } diff --git a/trunk/net/ipv4/netfilter/ip_conntrack_standalone.c b/trunk/net/ipv4/netfilter/ip_conntrack_standalone.c index dd476b191f4b..d3c7808010ec 100644 --- a/trunk/net/ipv4/netfilter/ip_conntrack_standalone.c +++ b/trunk/net/ipv4/netfilter/ip_conntrack_standalone.c @@ -989,7 +989,7 @@ EXPORT_SYMBOL(need_ip_conntrack); EXPORT_SYMBOL(ip_conntrack_helper_register); EXPORT_SYMBOL(ip_conntrack_helper_unregister); EXPORT_SYMBOL(ip_ct_iterate_cleanup); -EXPORT_SYMBOL(__ip_ct_refresh_acct); +EXPORT_SYMBOL(ip_ct_refresh_acct); EXPORT_SYMBOL(ip_conntrack_expect_alloc); EXPORT_SYMBOL(ip_conntrack_expect_put); diff --git a/trunk/net/ipv4/tcp_output.c b/trunk/net/ipv4/tcp_output.c index d6e3d269e906..5dd6dd7d091e 100644 --- a/trunk/net/ipv4/tcp_output.c +++ b/trunk/net/ipv4/tcp_output.c @@ -509,16 +509,7 @@ int tcp_fragment(struct sock *sk, struct sk_buff *skb, u32 len, unsigned int mss tp->lost_out -= diff; tp->left_out -= diff; } - if (diff > 0) { - /* Adjust Reno SACK estimate. */ - if (!tp->rx_opt.sack_ok) { - tp->sacked_out -= diff; - if ((int)tp->sacked_out < 0) - tp->sacked_out = 0; - tcp_sync_left_out(tp); - } - tp->fackets_out -= diff; if ((int)tp->fackets_out < 0) tp->fackets_out = 0; diff --git a/trunk/net/sctp/sm_statefuns.c b/trunk/net/sctp/sm_statefuns.c index 505c7de10c50..86073df418f5 100644 --- a/trunk/net/sctp/sm_statefuns.c +++ b/trunk/net/sctp/sm_statefuns.c @@ -2414,17 +2414,6 @@ sctp_disposition_t sctp_sf_do_9_2_shutdown(const struct sctp_endpoint *ep, skb_pull(chunk->skb, sizeof(sctp_shutdownhdr_t)); chunk->subh.shutdown_hdr = sdh; - /* API 5.3.1.5 SCTP_SHUTDOWN_EVENT - * When a peer sends a SHUTDOWN, SCTP delivers this notification to - * inform the application that it should cease sending data. - */ - ev = sctp_ulpevent_make_shutdown_event(asoc, 0, GFP_ATOMIC); - if (!ev) { - disposition = SCTP_DISPOSITION_NOMEM; - goto out; - } - sctp_add_cmd_sf(commands, SCTP_CMD_EVENT_ULP, SCTP_ULPEVENT(ev)); - /* Upon the reception of the SHUTDOWN, the peer endpoint shall * - enter the SHUTDOWN-RECEIVED state, * - stop accepting new data from its SCTP user @@ -2450,6 +2439,17 @@ sctp_disposition_t sctp_sf_do_9_2_shutdown(const struct sctp_endpoint *ep, sctp_add_cmd_sf(commands, SCTP_CMD_PROCESS_CTSN, SCTP_U32(chunk->subh.shutdown_hdr->cum_tsn_ack)); + /* API 5.3.1.5 SCTP_SHUTDOWN_EVENT + * When a peer sends a SHUTDOWN, SCTP delivers this notification to + * inform the application that it should cease sending data. + */ + ev = sctp_ulpevent_make_shutdown_event(asoc, 0, GFP_ATOMIC); + if (!ev) { + disposition = SCTP_DISPOSITION_NOMEM; + goto out; + } + sctp_add_cmd_sf(commands, SCTP_CMD_EVENT_ULP, SCTP_ULPEVENT(ev)); + out: return disposition; } diff --git a/trunk/sound/oss/au1000.c b/trunk/sound/oss/au1000.c index 2c2ae2ee01ac..4491733c9e4e 100644 --- a/trunk/sound/oss/au1000.c +++ b/trunk/sound/oss/au1000.c @@ -1295,7 +1295,7 @@ static int au1000_mmap(struct file *file, struct vm_area_struct *vma) unsigned long size; int ret = 0; - dbg("%s", __FUNCTION__); + dbg(__FUNCTION__); lock_kernel(); down(&s->sem); diff --git a/trunk/sound/oss/ite8172.c b/trunk/sound/oss/ite8172.c index 26e5944b6ba8..58f879fda975 100644 --- a/trunk/sound/oss/ite8172.c +++ b/trunk/sound/oss/ite8172.c @@ -1859,7 +1859,7 @@ static int it8172_release(struct inode *inode, struct file *file) struct it8172_state *s = (struct it8172_state *)file->private_data; #ifdef IT8172_VERBOSE_DEBUG - dbg("%s", __FUNCTION__); + dbg(__FUNCTION__); #endif lock_kernel(); if (file->f_mode & FMODE_WRITE) diff --git a/trunk/sound/pci/atiixp_modem.c b/trunk/sound/pci/atiixp_modem.c index c1a239a4dac6..8a59598167f9 100644 --- a/trunk/sound/pci/atiixp_modem.c +++ b/trunk/sound/pci/atiixp_modem.c @@ -405,7 +405,7 @@ static int snd_atiixp_acquire_codec(atiixp_t *chip) while (atiixp_read(chip, PHYS_OUT_ADDR) & ATI_REG_PHYS_OUT_ADDR_EN) { if (! timeout--) { - snd_printk(KERN_WARNING "atiixp-modem: codec acquire timeout\n"); + snd_printk(KERN_WARNING "atiixp: codec acquire timeout\n"); return -EBUSY; } udelay(1); @@ -436,7 +436,7 @@ static unsigned short snd_atiixp_codec_read(atiixp_t *chip, unsigned short codec } while (--timeout); /* time out may happen during reset */ if (reg < 0x7c) - snd_printk(KERN_WARNING "atiixp-modem: codec read timeout (reg %x)\n", reg); + snd_printk(KERN_WARNING "atiixp: codec read timeout (reg %x)\n", reg); return 0xffff; } @@ -498,7 +498,7 @@ static int snd_atiixp_aclink_reset(atiixp_t *chip) do_delay(); atiixp_update(chip, CMD, ATI_REG_CMD_AC_RESET, ATI_REG_CMD_AC_RESET); if (--timeout) { - snd_printk(KERN_ERR "atiixp-modem: codec reset timeout\n"); + snd_printk(KERN_ERR "atiixp: codec reset timeout\n"); break; } } @@ -552,7 +552,7 @@ static int snd_atiixp_codec_detect(atiixp_t *chip) atiixp_write(chip, IER, 0); /* disable irqs */ if ((chip->codec_not_ready_bits & ALL_CODEC_NOT_READY) == ALL_CODEC_NOT_READY) { - snd_printk(KERN_ERR "atiixp-modem: no codec detected!\n"); + snd_printk(KERN_ERR "atiixp: no codec detected!\n"); return -ENXIO; } return 0; @@ -635,7 +635,7 @@ static void snd_atiixp_xrun_dma(atiixp_t *chip, atiixp_dma_t *dma) { if (! dma->substream || ! dma->running) return; - snd_printdd("atiixp-modem: XRUN detected (DMA %d)\n", dma->ops->type); + snd_printdd("atiixp: XRUN detected (DMA %d)\n", dma->ops->type); snd_pcm_stop(dma->substream, SNDRV_PCM_STATE_XRUN); } @@ -1081,14 +1081,14 @@ static int __devinit snd_atiixp_mixer_new(atiixp_t *chip, int clock) ac97.scaps = AC97_SCAP_SKIP_AUDIO; if ((err = snd_ac97_mixer(pbus, &ac97, &chip->ac97[i])) < 0) { chip->ac97[i] = NULL; /* to be sure */ - snd_printdd("atiixp-modem: codec %d not available for modem\n", i); + snd_printdd("atiixp: codec %d not available for modem\n", i); continue; } codec_count++; } if (! codec_count) { - snd_printk(KERN_ERR "atiixp-modem: no codec available\n"); + snd_printk(KERN_ERR "atiixp: no codec available\n"); return -ENODEV; } @@ -1159,7 +1159,7 @@ static void __devinit snd_atiixp_proc_init(atiixp_t *chip) { snd_info_entry_t *entry; - if (! snd_card_proc_new(chip->card, "atiixp-modem", &entry)) + if (! snd_card_proc_new(chip->card, "atiixp", &entry)) snd_info_set_text_ops(entry, chip, 1024, snd_atiixp_proc_read); }