From 753260868273f54772ee2b8da101b63053d18951 Mon Sep 17 00:00:00 2001 From: Arnaldo Carvalho de Melo Date: Thu, 22 Sep 2005 03:27:56 -0300 Subject: [PATCH] --- yaml --- r: 9327 b: refs/heads/master c: 1d67e6501b8dba54ef8dcabebe2ad049b8ad0d67 h: refs/heads/master i: 9325: a5521b9a42a249330a2617b052cf0933e2db0ac6 9323: 8ab4c167978c59ab00cef32e5ca08857ba90a85c 9319: f713a74cd0db65c0d9fae7268f9d7da0785dd329 9311: edf2b39c0f19d229f6cbd7ce090e592082be7fb8 v: v3 --- [refs] | 2 +- .../Documentation/device-mapper/snapshot.txt | 73 -- trunk/Documentation/sparse.txt | 4 +- trunk/Documentation/usb/URB.txt | 74 +- trunk/MAINTAINERS | 14 +- trunk/README | 8 +- trunk/arch/alpha/kernel/process.c | 4 - trunk/arch/arm/kernel/entry-armv.S | 2 +- trunk/arch/arm/kernel/io.c | 6 +- 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/ppc/syslib/ppc85xx_setup.c | 8 +- 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/base/class.c | 13 - trunk/drivers/base/dd.c | 3 - trunk/drivers/block/ub.c | 55 +- trunk/drivers/char/hpet.c | 1 + trunk/drivers/char/ipmi/ipmi_msghandler.c | 6 +- trunk/drivers/connector/cn_queue.c | 32 +- trunk/drivers/connector/connector.c | 74 +- 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/input/input.c | 1 - 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/mfd/ucb1x00-ts.c | 4 +- trunk/drivers/mtd/devices/docecc.c | 8 +- trunk/drivers/net/8390.c | 2 +- trunk/drivers/net/bonding/bond_main.c | 3 +- trunk/drivers/net/r8169.c | 4 +- trunk/drivers/net/skge.c | 216 ++-- trunk/drivers/net/skge.h | 2 - trunk/drivers/pci/hotplug.c | 4 + trunk/drivers/pci/hotplug/rpadlpar_sysfs.c | 4 +- trunk/drivers/pci/hotplug/sgi_hotplug.c | 6 +- trunk/drivers/pci/pci-sysfs.c | 2 +- trunk/drivers/pci/probe.c | 22 +- trunk/drivers/s390/cio/ccwgroup.c | 2 +- trunk/drivers/scsi/ata_piix.c | 1 + trunk/drivers/scsi/libata-core.c | 81 +- trunk/drivers/scsi/mesh.c | 29 +- trunk/drivers/scsi/sata_nv.c | 2 - trunk/drivers/serial/clps711x.c | 2 +- trunk/drivers/usb/core/message.c | 2 +- trunk/drivers/usb/core/usb.c | 6 +- trunk/drivers/usb/gadget/pxa2xx_udc.c | 4 +- trunk/drivers/usb/gadget/pxa2xx_udc.h | 8 +- trunk/drivers/usb/host/sl811-hcd.c | 16 +- trunk/drivers/usb/net/pegasus.c | 29 +- trunk/drivers/usb/serial/airprime.c | 3 +- trunk/drivers/usb/serial/ftdi_sio.c | 8 +- trunk/drivers/usb/serial/option.c | 11 +- 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-arm/io.h | 6 +- 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 + trunk/include/linux/connector.h | 21 +- trunk/include/linux/device.h | 5 - trunk/include/linux/libata.h | 1 - .../linux/netfilter_ipv4/ip_conntrack.h | 25 +- .../linux/netfilter_ipv4/ip_conntrack_pptp.h | 125 +- .../linux/netfilter_ipv4/ip_conntrack_tuple.h | 6 +- .../linux/netfilter_ipv4/ip_nat_core.h | 12 +- trunk/include/linux/pci_ids.h | 3 +- trunk/include/linux/reboot.h | 4 - trunk/include/net/llc_sap.h | 3 +- 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 +- trunk/net/core/neighbour.c | 2 - trunk/net/ipv4/netfilter/Kconfig | 11 - trunk/net/ipv4/netfilter/Makefile | 7 +- .../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_proto_gre.c | 1 - .../ipv4/netfilter/ip_conntrack_proto_sctp.c | 1 - .../ipv4/netfilter/ip_conntrack_proto_tcp.c | 3 +- .../ipv4/netfilter/ip_conntrack_standalone.c | 2 +- trunk/net/ipv4/netfilter/ip_nat_core.c | 35 +- trunk/net/ipv4/netfilter/ip_nat_helper.c | 4 - trunk/net/ipv4/netfilter/ip_nat_standalone.c | 25 +- trunk/net/ipv4/tcp_output.c | 9 - trunk/net/ipv6/addrconf.c | 2 - trunk/net/ipv6/netfilter/Kconfig | 11 - trunk/net/ipv6/netfilter/Makefile | 2 +- trunk/net/irda/irttp.c | 16 +- trunk/net/llc/llc_c_ac.c | 105 +- trunk/net/llc/llc_s_ac.c | 6 +- trunk/net/llc/llc_sap.c | 5 +- trunk/net/llc/llc_station.c | 8 +- trunk/net/packet/af_packet.c | 6 + trunk/net/sctp/sm_statefuns.c | 22 +- trunk/net/socket.c | 4 +- trunk/sound/oss/au1000.c | 2 +- trunk/sound/oss/ite8172.c | 2 +- trunk/sound/pci/atiixp_modem.c | 16 +- 164 files changed, 1109 insertions(+), 3021 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 c91eb9dd8ddf..960f4d804d6d 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 188bab3ae0ed164bc18f98be932512d777dd038b +refs/heads/master: 1d67e6501b8dba54ef8dcabebe2ad049b8ad0d67 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/Documentation/usb/URB.txt b/trunk/Documentation/usb/URB.txt index a49e5f2c2b46..d59b95cc6f1b 100644 --- a/trunk/Documentation/usb/URB.txt +++ b/trunk/Documentation/usb/URB.txt @@ -1,6 +1,5 @@ Revised: 2000-Dec-05. Again: 2002-Jul-06 -Again: 2005-Sep-19 NOTE: @@ -19,8 +18,8 @@ called USB Request Block, or URB for short. and deliver the data and status back. - Execution of an URB is inherently an asynchronous operation, i.e. the - usb_submit_urb(urb) call returns immediately after it has successfully - queued the requested action. + usb_submit_urb(urb) call returns immediately after it has successfully queued + the requested action. - Transfers for one URB can be canceled with usb_unlink_urb(urb) at any time. @@ -95,9 +94,8 @@ To free an URB, use void usb_free_urb(struct urb *urb) -You may free an urb that you've submitted, but which hasn't yet been -returned to you in a completion callback. It will automatically be -deallocated when it is no longer in use. +You may not free an urb that you've submitted, but which hasn't yet been +returned to you in a completion callback. 1.4. What has to be filled in? @@ -147,36 +145,30 @@ to get seamless ISO streaming. 1.6. How to cancel an already running URB? -There are two ways to cancel an URB you've submitted but which hasn't -been returned to your driver yet. For an asynchronous cancel, call +For an URB which you've submitted, but which hasn't been returned to +your driver by the host controller, call int usb_unlink_urb(struct urb *urb) It removes the urb from the internal list and frees all allocated -HW descriptors. The status is changed to reflect unlinking. Note -that the URB will not normally have finished when usb_unlink_urb() -returns; you must still wait for the completion handler to be called. +HW descriptors. The status is changed to reflect unlinking. After +usb_unlink_urb() returns with that status code, you can free the URB +with usb_free_urb(). -To cancel an URB synchronously, call - - void usb_kill_urb(struct urb *urb) - -It does everything usb_unlink_urb does, and in addition it waits -until after the URB has been returned and the completion handler -has finished. It also marks the URB as temporarily unusable, so -that if the completion handler or anyone else tries to resubmit it -they will get a -EPERM error. Thus you can be sure that when -usb_kill_urb() returns, the URB is totally idle. +There is also an asynchronous unlink mode. To use this, set the +the URB_ASYNC_UNLINK flag in urb->transfer flags before calling +usb_unlink_urb(). When using async unlinking, the URB will not +normally be unlinked when usb_unlink_urb() returns. Instead, wait +for the completion handler to be called. 1.7. What about the completion handler? The handler is of the following type: - typedef void (*usb_complete_t)(struct urb *, struct pt_regs *) + typedef void (*usb_complete_t)(struct urb *); -I.e., it gets the URB that caused the completion call, plus the -register values at the time of the corresponding interrupt (if any). +i.e. it gets just the URB that caused the completion call. In the completion handler, you should have a look at urb->status to detect any USB errors. Since the context parameter is included in the URB, you can pass information to the completion handler. @@ -184,11 +176,17 @@ you can pass information to the completion handler. Note that even when an error (or unlink) is reported, data may have been transferred. That's because USB transfers are packetized; it might take sixteen packets to transfer your 1KByte buffer, and ten of them might -have transferred succesfully before the completion was called. +have transferred succesfully before the completion is called. NOTE: ***** WARNING ***** -NEVER SLEEP IN A COMPLETION HANDLER. These are normally called +Don't use urb->dev field in your completion handler; it's cleared +as part of giving urbs back to drivers. (Addressing an issue with +ownership of periodic URBs, which was otherwise ambiguous.) Instead, +use urb->context to hold all the data your driver needs. + +NOTE: ***** WARNING ***** +Also, NEVER SLEEP IN A COMPLETION HANDLER. These are normally called during hardware interrupt processing. If you can, defer substantial work to a tasklet (bottom half) to keep system latencies low. You'll probably need to use spinlocks to protect data structures you manipulate @@ -231,10 +229,24 @@ ISO data with some other event stream. Interrupt transfers, like isochronous transfers, are periodic, and happen in intervals that are powers of two (1, 2, 4 etc) units. Units are frames for full and low speed devices, and microframes for high speed ones. + +Currently, after you submit one interrupt URB, that urb is owned by the +host controller driver until you cancel it with usb_unlink_urb(). You +may unlink interrupt urbs in their completion handlers, if you need to. + +After a transfer completion is called, the URB is automagically resubmitted. +THIS BEHAVIOR IS EXPECTED TO BE REMOVED!! + +Interrupt transfers may only send (or receive) the "maxpacket" value for +the given interrupt endpoint; if you need more data, you will need to +copy that data out of (or into) another buffer. Similarly, you can't +queue interrupt transfers. +THESE RESTRICTIONS ARE EXPECTED TO BE REMOVED!! + +Note that this automagic resubmission model does make it awkward to use +interrupt OUT transfers. The portable solution involves unlinking those +OUT urbs after the data is transferred, and perhaps submitting a final +URB for a short packet. + The usb_submit_urb() call modifies urb->interval to the implemented interval value that is less than or equal to the requested interval value. - -In Linux 2.6, unlike earlier versions, interrupt URBs are not automagically -restarted when they complete. They end when the completion handler is -called, just like other URBs. If you want an interrupt URB to be restarted, -your completion handler must resubmit it. diff --git a/trunk/MAINTAINERS b/trunk/MAINTAINERS index 7d1dd5bad39a..ade7415d2467 100644 --- a/trunk/MAINTAINERS +++ b/trunk/MAINTAINERS @@ -1063,6 +1063,8 @@ M: wli@holomorphy.com S: Maintained I2C SUBSYSTEM +P: Greg Kroah-Hartman +M: greg@kroah.com P: Jean Delvare M: khali@linux-fr.org L: lm-sensors@lm-sensors.org @@ -1402,18 +1404,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/arm/kernel/io.c b/trunk/arch/arm/kernel/io.c index 1f6822dfae74..6c20c1188b60 100644 --- a/trunk/arch/arm/kernel/io.c +++ b/trunk/arch/arm/kernel/io.c @@ -7,7 +7,7 @@ * Copy data from IO memory space to "real" memory space. * This needs to be optimized. */ -void _memcpy_fromio(void *to, const volatile void __iomem *from, size_t count) +void _memcpy_fromio(void *to, void __iomem *from, size_t count) { unsigned char *t = to; while (count) { @@ -22,7 +22,7 @@ void _memcpy_fromio(void *to, const volatile void __iomem *from, size_t count) * Copy data from "real" memory space to IO memory space. * This needs to be optimized. */ -void _memcpy_toio(volatile void __iomem *to, const void *from, size_t count) +void _memcpy_toio(void __iomem *to, const void *from, size_t count) { const unsigned char *f = from; while (count) { @@ -37,7 +37,7 @@ void _memcpy_toio(volatile void __iomem *to, const void *from, size_t count) * "memset" on IO memory space. * This needs to be optimized. */ -void _memset_io(volatile void __iomem *dst, int c, size_t count) +void _memset_io(void __iomem *dst, int c, size_t count) { while (count) { count--; 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/ppc/syslib/ppc85xx_setup.c b/trunk/arch/ppc/syslib/ppc85xx_setup.c index 832b8bf99ae7..b7242f1bd931 100644 --- a/trunk/arch/ppc/syslib/ppc85xx_setup.c +++ b/trunk/arch/ppc/syslib/ppc85xx_setup.c @@ -184,8 +184,8 @@ mpc85xx_setup_pci1(struct pci_controller *hose) pci->powar1 = 0x80044000 | (__ilog2(MPC85XX_PCI1_UPPER_MEM - MPC85XX_PCI1_LOWER_MEM + 1) - 1); - /* Setup outbound IO windows @ MPC85XX_PCI1_IO_BASE */ - pci->potar2 = (MPC85XX_PCI1_LOWER_IO >> 12) & 0x000fffff; + /* Setup outboud IO windows @ MPC85XX_PCI1_IO_BASE */ + pci->potar2 = 0x00000000; pci->potear2 = 0x00000000; pci->powbar2 = (MPC85XX_PCI1_IO_BASE >> 12) & 0x000fffff; /* Enable, IO R/W */ @@ -235,8 +235,8 @@ mpc85xx_setup_pci2(struct pci_controller *hose) pci->powar1 = 0x80044000 | (__ilog2(MPC85XX_PCI2_UPPER_MEM - MPC85XX_PCI2_LOWER_MEM + 1) - 1); - /* Setup outbound IO windows @ MPC85XX_PCI2_IO_BASE */ - pci->potar2 = (MPC85XX_PCI2_LOWER_IO >> 12) & 0x000fffff;; + /* Setup outboud IO windows @ MPC85XX_PCI2_IO_BASE */ + pci->potar2 = 0x00000000; pci->potear2 = 0x00000000; pci->powbar2 = (MPC85XX_PCI2_IO_BASE >> 12) & 0x000fffff; /* Enable, IO R/W */ 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/base/class.c b/trunk/drivers/base/class.c index ce23dc8c18c5..3b112e3542f8 100644 --- a/trunk/drivers/base/class.c +++ b/trunk/drivers/base/class.c @@ -669,7 +669,6 @@ void class_device_destroy(struct class *cls, dev_t devt) int class_device_rename(struct class_device *class_dev, char *new_name) { int error = 0; - char *old_class_name = NULL, *new_class_name = NULL; class_dev = class_device_get(class_dev); if (!class_dev) @@ -678,24 +677,12 @@ int class_device_rename(struct class_device *class_dev, char *new_name) pr_debug("CLASS: renaming '%s' to '%s'\n", class_dev->class_id, new_name); - if (class_dev->dev) - old_class_name = make_class_name(class_dev); - strlcpy(class_dev->class_id, new_name, KOBJ_NAME_LEN); error = kobject_rename(&class_dev->kobj, new_name); - if (class_dev->dev) { - new_class_name = make_class_name(class_dev); - sysfs_create_link(&class_dev->dev->kobj, &class_dev->kobj, - new_class_name); - sysfs_remove_link(&class_dev->dev->kobj, old_class_name); - } class_device_put(class_dev); - kfree(old_class_name); - kfree(new_class_name); - return error; } diff --git a/trunk/drivers/base/dd.c b/trunk/drivers/base/dd.c index 3565e9795301..d5bbce38282f 100644 --- a/trunk/drivers/base/dd.c +++ b/trunk/drivers/base/dd.c @@ -40,9 +40,6 @@ */ void device_bind_driver(struct device * dev) { - if (klist_node_attached(&dev->knode_driver)) - return; - pr_debug("bound device '%s' to driver '%s'\n", dev->bus_id, dev->driver->name); klist_add_tail(&dev->knode_driver, &dev->driver->klist_devices); diff --git a/trunk/drivers/block/ub.c b/trunk/drivers/block/ub.c index ed4d5006fe62..aa0bf7ee008d 100644 --- a/trunk/drivers/block/ub.c +++ b/trunk/drivers/block/ub.c @@ -172,7 +172,7 @@ struct bulk_cs_wrap { */ struct ub_dev; -#define UB_MAX_REQ_SG 9 /* cdrecord requires 32KB and maybe a header */ +#define UB_MAX_REQ_SG 4 #define UB_MAX_SECTORS 64 /* @@ -387,7 +387,7 @@ struct ub_dev { struct bulk_cs_wrap work_bcs; struct usb_ctrlrequest work_cr; - int sg_stat[6]; + int sg_stat[UB_MAX_REQ_SG+1]; struct ub_scsi_trace tr; }; @@ -525,13 +525,12 @@ static ssize_t ub_diag_show(struct device *dev, struct device_attribute *attr, "qlen %d qmax %d\n", sc->cmd_queue.qlen, sc->cmd_queue.qmax); cnt += sprintf(page + cnt, - "sg %d %d %d %d %d .. %d\n", + "sg %d %d %d %d %d\n", sc->sg_stat[0], sc->sg_stat[1], sc->sg_stat[2], sc->sg_stat[3], - sc->sg_stat[4], - sc->sg_stat[5]); + sc->sg_stat[4]); list_for_each (p, &sc->luns) { lun = list_entry(p, struct ub_lun, link); @@ -836,7 +835,7 @@ static int ub_cmd_build_block(struct ub_dev *sc, struct ub_lun *lun, return -1; } cmd->nsg = n_elem; - sc->sg_stat[n_elem < 5 ? n_elem : 5]++; + sc->sg_stat[n_elem]++; /* * build the command @@ -892,7 +891,7 @@ static int ub_cmd_build_packet(struct ub_dev *sc, struct ub_lun *lun, return -1; } cmd->nsg = n_elem; - sc->sg_stat[n_elem < 5 ? n_elem : 5]++; + sc->sg_stat[n_elem]++; memcpy(&cmd->cdb, rq->cmd, rq->cmd_len); cmd->cdb_len = rq->cmd_len; @@ -1011,6 +1010,7 @@ static int ub_scsi_cmd_start(struct ub_dev *sc, struct ub_scsi_cmd *cmd) sc->last_pipe = sc->send_bulk_pipe; usb_fill_bulk_urb(&sc->work_urb, sc->dev, sc->send_bulk_pipe, bcb, US_BULK_CB_WRAP_LEN, ub_urb_complete, sc); + sc->work_urb.transfer_flags = 0; /* Fill what we shouldn't be filling, because usb-storage did so. */ sc->work_urb.actual_length = 0; @@ -1019,6 +1019,7 @@ static int ub_scsi_cmd_start(struct ub_dev *sc, struct ub_scsi_cmd *cmd) if ((rc = usb_submit_urb(&sc->work_urb, GFP_ATOMIC)) != 0) { /* XXX Clear stalls */ + printk("ub: cmd #%d start failed (%d)\n", cmd->tag, rc); /* P3 */ ub_complete(&sc->work_done); return rc; } @@ -1189,9 +1190,11 @@ static void ub_scsi_urb_compl(struct ub_dev *sc, struct ub_scsi_cmd *cmd) return; } if (urb->status != 0) { + printk("ub: cmd #%d cmd status (%d)\n", cmd->tag, urb->status); /* P3 */ goto Bad_End; } if (urb->actual_length != US_BULK_CB_WRAP_LEN) { + printk("ub: cmd #%d xferred %d\n", cmd->tag, urb->actual_length); /* P3 */ /* XXX Must do reset here to unconfuse the device */ goto Bad_End; } @@ -1392,12 +1395,14 @@ static void ub_data_start(struct ub_dev *sc, struct ub_scsi_cmd *cmd) usb_fill_bulk_urb(&sc->work_urb, sc->dev, pipe, page_address(sg->page) + sg->offset, sg->length, ub_urb_complete, sc); + sc->work_urb.transfer_flags = 0; sc->work_urb.actual_length = 0; sc->work_urb.error_count = 0; sc->work_urb.status = 0; if ((rc = usb_submit_urb(&sc->work_urb, GFP_ATOMIC)) != 0) { /* XXX Clear stalls */ + printk("ub: data #%d submit failed (%d)\n", cmd->tag, rc); /* P3 */ ub_complete(&sc->work_done); ub_state_done(sc, cmd, rc); return; @@ -1437,6 +1442,7 @@ static int __ub_state_stat(struct ub_dev *sc, struct ub_scsi_cmd *cmd) sc->last_pipe = sc->recv_bulk_pipe; usb_fill_bulk_urb(&sc->work_urb, sc->dev, sc->recv_bulk_pipe, &sc->work_bcs, US_BULK_CS_WRAP_LEN, ub_urb_complete, sc); + sc->work_urb.transfer_flags = 0; sc->work_urb.actual_length = 0; sc->work_urb.error_count = 0; sc->work_urb.status = 0; @@ -1557,6 +1563,7 @@ static int ub_submit_clear_stall(struct ub_dev *sc, struct ub_scsi_cmd *cmd, usb_fill_control_urb(&sc->work_urb, sc->dev, sc->send_ctrl_pipe, (unsigned char*) cr, NULL, 0, ub_urb_complete, sc); + sc->work_urb.transfer_flags = 0; sc->work_urb.actual_length = 0; sc->work_urb.error_count = 0; sc->work_urb.status = 0; @@ -1993,16 +2000,17 @@ static int ub_sync_getmaxlun(struct ub_dev *sc) usb_fill_control_urb(&sc->work_urb, sc->dev, sc->recv_ctrl_pipe, (unsigned char*) cr, p, 1, ub_probe_urb_complete, &compl); + sc->work_urb.transfer_flags = 0; sc->work_urb.actual_length = 0; sc->work_urb.error_count = 0; sc->work_urb.status = 0; if ((rc = usb_submit_urb(&sc->work_urb, GFP_KERNEL)) != 0) { if (rc == -EPIPE) { - printk("%s: Stall submitting GetMaxLUN, using 1 LUN\n", + printk("%s: Stall at GetMaxLUN, using 1 LUN\n", sc->name); /* P3 */ } else { - printk(KERN_NOTICE + printk(KERN_WARNING "%s: Unable to submit GetMaxLUN (%d)\n", sc->name, rc); } @@ -2020,18 +2028,6 @@ static int ub_sync_getmaxlun(struct ub_dev *sc) del_timer_sync(&timer); usb_kill_urb(&sc->work_urb); - if ((rc = sc->work_urb.status) < 0) { - if (rc == -EPIPE) { - printk("%s: Stall at GetMaxLUN, using 1 LUN\n", - sc->name); /* P3 */ - } else { - printk(KERN_NOTICE - "%s: Error at GetMaxLUN (%d)\n", - sc->name, rc); - } - goto err_io; - } - if (sc->work_urb.actual_length != 1) { printk("%s: GetMaxLUN returned %d bytes\n", sc->name, sc->work_urb.actual_length); /* P3 */ @@ -2052,7 +2048,6 @@ static int ub_sync_getmaxlun(struct ub_dev *sc) kfree(p); return nluns; -err_io: err_submit: kfree(p); err_alloc: @@ -2085,6 +2080,7 @@ static int ub_probe_clear_stall(struct ub_dev *sc, int stalled_pipe) usb_fill_control_urb(&sc->work_urb, sc->dev, sc->send_ctrl_pipe, (unsigned char*) cr, NULL, 0, ub_probe_urb_complete, &compl); + sc->work_urb.transfer_flags = 0; sc->work_urb.actual_length = 0; sc->work_urb.error_count = 0; sc->work_urb.status = 0; @@ -2217,10 +2213,8 @@ static int ub_probe(struct usb_interface *intf, * This is needed to clear toggles. It is a problem only if we do * `rmmod ub && modprobe ub` without disconnects, but we like that. */ -#if 0 /* iPod Mini fails if we do this (big white iPod works) */ ub_probe_clear_stall(sc, sc->recv_bulk_pipe); ub_probe_clear_stall(sc, sc->send_bulk_pipe); -#endif /* * The way this is used by the startup code is a little specific. @@ -2247,10 +2241,10 @@ static int ub_probe(struct usb_interface *intf, for (i = 0; i < 3; i++) { if ((rc = ub_sync_getmaxlun(sc)) < 0) { /* - * This segment is taken from usb-storage. They say - * that ZIP-100 needs this, but my own ZIP-100 works - * fine without this. - * Still, it does not seem to hurt anything. + * Some devices (i.e. Iomega Zip100) need this -- + * apparently the bulk pipes get STALLed when the + * GetMaxLUN request is processed. + * XXX I have a ZIP-100, verify it does this. */ if (rc == -EPIPE) { ub_probe_clear_stall(sc, sc->recv_bulk_pipe); @@ -2319,7 +2313,7 @@ static int ub_probe_lun(struct ub_dev *sc, int lnum) disk->first_minor = lun->id * UB_MINORS_PER_MAJOR; disk->fops = &ub_bd_fops; disk->private_data = lun; - disk->driverfs_dev = &sc->intf->dev; + disk->driverfs_dev = &sc->intf->dev; /* XXX Many to one ok? */ rc = -ENOMEM; if ((q = blk_init_queue(ub_request_fn, &sc->lock)) == NULL) @@ -2472,6 +2466,9 @@ static int __init ub_init(void) { int rc; + /* P3 */ printk("ub: sizeof ub_scsi_cmd %zu ub_dev %zu ub_lun %zu\n", + sizeof(struct ub_scsi_cmd), sizeof(struct ub_dev), sizeof(struct ub_lun)); + if ((rc = register_blkdev(UB_MAJOR, DRV_NAME)) != 0) goto err_regblkdev; devfs_mk_dir(DEVFS_NAME); 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/connector/cn_queue.c b/trunk/drivers/connector/cn_queue.c index 9f2f00d82917..966632182e2d 100644 --- a/trunk/drivers/connector/cn_queue.c +++ b/trunk/drivers/connector/cn_queue.c @@ -31,19 +31,16 @@ #include #include -void cn_queue_wrapper(void *data) +static void cn_queue_wrapper(void *data) { - struct cn_callback_data *d = data; + struct cn_callback_entry *cbq = data; - d->callback(d->callback_priv); - - d->destruct_data(d->ddata); - d->ddata = NULL; - - kfree(d->free); + cbq->cb->callback(cbq->cb->priv); + cbq->destruct_data(cbq->ddata); + cbq->ddata = NULL; } -static struct cn_callback_entry *cn_queue_alloc_callback_entry(char *name, struct cb_id *id, void (*callback)(void *)) +static struct cn_callback_entry *cn_queue_alloc_callback_entry(struct cn_callback *cb) { struct cn_callback_entry *cbq; @@ -53,11 +50,8 @@ static struct cn_callback_entry *cn_queue_alloc_callback_entry(char *name, struc return NULL; } - snprintf(cbq->id.name, sizeof(cbq->id.name), "%s", name); - memcpy(&cbq->id.id, id, sizeof(struct cb_id)); - cbq->data.callback = callback; - - INIT_WORK(&cbq->work, &cn_queue_wrapper, &cbq->data); + cbq->cb = cb; + INIT_WORK(&cbq->work, &cn_queue_wrapper, cbq); return cbq; } @@ -74,12 +68,12 @@ int cn_cb_equal(struct cb_id *i1, struct cb_id *i2) return ((i1->idx == i2->idx) && (i1->val == i2->val)); } -int cn_queue_add_callback(struct cn_queue_dev *dev, char *name, struct cb_id *id, void (*callback)(void *)) +int cn_queue_add_callback(struct cn_queue_dev *dev, struct cn_callback *cb) { struct cn_callback_entry *cbq, *__cbq; int found = 0; - cbq = cn_queue_alloc_callback_entry(name, id, callback); + cbq = cn_queue_alloc_callback_entry(cb); if (!cbq) return -ENOMEM; @@ -88,7 +82,7 @@ int cn_queue_add_callback(struct cn_queue_dev *dev, char *name, struct cb_id *id spin_lock_bh(&dev->queue_lock); list_for_each_entry(__cbq, &dev->queue_list, callback_entry) { - if (cn_cb_equal(&__cbq->id.id, id)) { + if (cn_cb_equal(&__cbq->cb->id, &cb->id)) { found = 1; break; } @@ -105,7 +99,7 @@ int cn_queue_add_callback(struct cn_queue_dev *dev, char *name, struct cb_id *id cbq->nls = dev->nls; cbq->seq = 0; - cbq->group = cbq->id.id.idx; + cbq->group = cbq->cb->id.idx; return 0; } @@ -117,7 +111,7 @@ void cn_queue_del_callback(struct cn_queue_dev *dev, struct cb_id *id) spin_lock_bh(&dev->queue_lock); list_for_each_entry_safe(cbq, n, &dev->queue_list, callback_entry) { - if (cn_cb_equal(&cbq->id.id, id)) { + if (cn_cb_equal(&cbq->cb->id, id)) { list_del(&cbq->callback_entry); found = 1; break; diff --git a/trunk/drivers/connector/connector.c b/trunk/drivers/connector/connector.c index bb0b3a8de14b..aaf6d468a8b9 100644 --- a/trunk/drivers/connector/connector.c +++ b/trunk/drivers/connector/connector.c @@ -84,7 +84,7 @@ int cn_netlink_send(struct cn_msg *msg, u32 __group, int gfp_mask) spin_lock_bh(&dev->cbdev->queue_lock); list_for_each_entry(__cbq, &dev->cbdev->queue_list, callback_entry) { - if (cn_cb_equal(&__cbq->id.id, &msg->id)) { + if (cn_cb_equal(&__cbq->cb->id, &msg->id)) { found = 1; group = __cbq->group; } @@ -127,56 +127,42 @@ static int cn_call_callback(struct cn_msg *msg, void (*destruct_data)(void *), v { struct cn_callback_entry *__cbq; struct cn_dev *dev = &cdev; - int err = -ENODEV; + int found = 0; spin_lock_bh(&dev->cbdev->queue_lock); list_for_each_entry(__cbq, &dev->cbdev->queue_list, callback_entry) { - if (cn_cb_equal(&__cbq->id.id, &msg->id)) { + if (cn_cb_equal(&__cbq->cb->id, &msg->id)) { + /* + * Let's scream if there is some magic and the + * data will arrive asynchronously here. + * [i.e. netlink messages will be queued]. + * After the first warning I will fix it + * quickly, but now I think it is + * impossible. --zbr (2004_04_27). + */ if (likely(!test_bit(0, &__cbq->work.pending) && - __cbq->data.ddata == NULL)) { - __cbq->data.callback_priv = msg; + __cbq->ddata == NULL)) { + __cbq->cb->priv = msg; - __cbq->data.ddata = data; - __cbq->data.destruct_data = destruct_data; + __cbq->ddata = data; + __cbq->destruct_data = destruct_data; if (queue_work(dev->cbdev->cn_queue, &__cbq->work)) - err = 0; + found = 1; } else { - struct work_struct *w; - struct cn_callback_data *d; - - w = kzalloc(sizeof(*w) + sizeof(*d), GFP_ATOMIC); - if (w) { - d = (struct cn_callback_data *)(w+1); - - d->callback_priv = msg; - d->callback = __cbq->data.callback; - d->ddata = data; - d->destruct_data = destruct_data; - d->free = w; - - INIT_LIST_HEAD(&w->entry); - w->pending = 0; - w->func = &cn_queue_wrapper; - w->data = d; - init_timer(&w->timer); - - if (queue_work(dev->cbdev->cn_queue, w)) - err = 0; - else { - kfree(w); - err = -EINVAL; - } - } else - err = -ENOMEM; + printk("%s: cbq->data=%p, " + "work->pending=%08lx.\n", + __func__, __cbq->ddata, + __cbq->work.pending); + WARN_ON(1); } break; } } spin_unlock_bh(&dev->cbdev->queue_lock); - return err; + return found ? 0 : -ENODEV; } /* @@ -305,10 +291,22 @@ int cn_add_callback(struct cb_id *id, char *name, void (*callback)(void *)) { int err; struct cn_dev *dev = &cdev; + struct cn_callback *cb; + + cb = kzalloc(sizeof(*cb), GFP_KERNEL); + if (!cb) + return -ENOMEM; + + scnprintf(cb->name, sizeof(cb->name), "%s", name); - err = cn_queue_add_callback(dev->cbdev, name, id, callback); - if (err) + memcpy(&cb->id, id, sizeof(cb->id)); + cb->callback = callback; + + err = cn_queue_add_callback(dev->cbdev, cb); + if (err) { + kfree(cb); return err; + } cn_notify(id, 0); 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/input/input.c b/trunk/drivers/input/input.c index 14ae5583e198..88636a204525 100644 --- a/trunk/drivers/input/input.c +++ b/trunk/drivers/input/input.c @@ -308,7 +308,6 @@ static struct input_device_id *input_match_device(struct input_device_id *id, st MATCH_BIT(ledbit, LED_MAX); MATCH_BIT(sndbit, SND_MAX); MATCH_BIT(ffbit, FF_MAX); - MATCH_BIT(swbit, SW_MAX); return id; } 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/mfd/ucb1x00-ts.c b/trunk/drivers/mfd/ucb1x00-ts.c index a260f83bcb02..a851d65c7cfe 100644 --- a/trunk/drivers/mfd/ucb1x00-ts.c +++ b/trunk/drivers/mfd/ucb1x00-ts.c @@ -48,8 +48,8 @@ struct ucb1x00_ts { u16 x_res; u16 y_res; - unsigned int restart:1; - unsigned int adcsync:1; + int restart:1; + int adcsync:1; }; static int adcsync; 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 f87027420081..6d76f3a99b17 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_CMD) & E8390_TRANS) + if (inb_p(e8390_base) & E8390_TRANS) { printk(KERN_WARNING "%s: trigger_send() called with the transmitter busy.\n", dev->name); diff --git a/trunk/drivers/net/bonding/bond_main.c b/trunk/drivers/net/bonding/bond_main.c index 6d00c3de1a83..90449a0f2a6c 100644 --- a/trunk/drivers/net/bonding/bond_main.c +++ b/trunk/drivers/net/bonding/bond_main.c @@ -1653,8 +1653,7 @@ static int bond_enslave(struct net_device *bond_dev, struct net_device *slave_de int old_features = bond_dev->features; int res = 0; - if (!bond->params.use_carrier && slave_dev->ethtool_ops == NULL && - slave_dev->do_ioctl == NULL) { + if (slave_dev->do_ioctl == NULL) { printk(KERN_WARNING DRV_NAME ": Warning : no link monitoring support for %s\n", slave_dev->name); diff --git a/trunk/drivers/net/r8169.c b/trunk/drivers/net/r8169.c index f9223c1c5aa4..f0471d102e3c 100644 --- a/trunk/drivers/net/r8169.c +++ b/trunk/drivers/net/r8169.c @@ -100,11 +100,11 @@ VERSION 2.2LK <2005/01/25> #ifdef CONFIG_R8169_NAPI #define rtl8169_rx_skb netif_receive_skb -#define rtl8169_rx_hwaccel_skb vlan_hwaccel_receive_skb +#define rtl8169_rx_hwaccel_skb vlan_hwaccel_rx #define rtl8169_rx_quota(count, quota) min(count, quota) #else #define rtl8169_rx_skb netif_rx -#define rtl8169_rx_hwaccel_skb vlan_hwaccel_rx +#define rtl8169_rx_hwaccel_skb vlan_hwaccel_receive_skb #define rtl8169_rx_quota(count, quota) count #endif diff --git a/trunk/drivers/net/skge.c b/trunk/drivers/net/skge.c index fd398da4993b..0208258e7826 100644 --- a/trunk/drivers/net/skge.c +++ b/trunk/drivers/net/skge.c @@ -42,7 +42,7 @@ #include "skge.h" #define DRV_NAME "skge" -#define DRV_VERSION "1.1" +#define DRV_VERSION "1.0" #define PFX DRV_NAME " " #define DEFAULT_TX_RING_SIZE 128 @@ -105,28 +105,41 @@ static const u32 rxirqmask[] = { IS_R1_F, IS_R2_F }; static const u32 txirqmask[] = { IS_XA1_F, IS_XA2_F }; static const u32 portirqmask[] = { IS_PORT_1, IS_PORT_2 }; +/* Don't need to look at whole 16K. + * last interesting register is descriptor poll timer. + */ +#define SKGE_REGS_LEN (29*128) + static int skge_get_regs_len(struct net_device *dev) { - return 0x4000; + return SKGE_REGS_LEN; } /* - * Returns copy of whole control register region - * Note: skip RAM address register because accessing it will - * cause bus hangs! + * Returns copy of control register region + * I/O region is divided into banks and certain regions are unreadable */ static void skge_get_regs(struct net_device *dev, struct ethtool_regs *regs, void *p) { const struct skge_port *skge = netdev_priv(dev); + unsigned long offs; const void __iomem *io = skge->hw->regs; + static const unsigned long bankmap + = (1<<0) | (1<<2) | (1<<8) | (1<<9) + | (1<<12) | (1<<13) | (1<<14) | (1<<15) | (1<<16) + | (1<<17) | (1<<20) | (1<<21) | (1<<22) | (1<<23) + | (1<<24) | (1<<25) | (1<<26) | (1<<27) | (1<<28); regs->version = 1; - memset(p, 0, regs->len); - memcpy_fromio(p, io, B3_RAM_ADDR); + for (offs = 0; offs < regs->len; offs += 128) { + u32 len = min_t(u32, 128, regs->len - offs); - memcpy_fromio(p + B3_RI_WTO_R1, io + B3_RI_WTO_R1, - regs->len - B3_RI_WTO_R1); + if (bankmap & (1<<(offs/128))) + memcpy_fromio(p + offs, io + offs, len); + else + memset(p + offs, 0, len); + } } /* Wake on Lan only supported on Yukon chps with rev 1 or above */ @@ -762,6 +775,17 @@ static int skge_ring_alloc(struct skge_ring *ring, void *vaddr, u64 base) return 0; } +static struct sk_buff *skge_rx_alloc(struct net_device *dev, unsigned int size) +{ + struct sk_buff *skb = dev_alloc_skb(size); + + if (likely(skb)) { + skb->dev = dev; + skb_reserve(skb, NET_IP_ALIGN); + } + return skb; +} + /* Allocate and setup a new buffer for receiving */ static void skge_rx_setup(struct skge_port *skge, struct skge_element *e, struct sk_buff *skb, unsigned int bufsize) @@ -834,17 +858,16 @@ static int skge_rx_fill(struct skge_port *skge) { struct skge_ring *ring = &skge->rx_ring; struct skge_element *e; + unsigned int bufsize = skge->rx_buf_size; e = ring->start; do { - struct sk_buff *skb; + struct sk_buff *skb = skge_rx_alloc(skge->netdev, bufsize); - skb = dev_alloc_skb(skge->rx_buf_size + NET_IP_ALIGN); if (!skb) return -ENOMEM; - skb_reserve(skb, NET_IP_ALIGN); - skge_rx_setup(skge, e, skb, skge->rx_buf_size); + skge_rx_setup(skge, e, skb, bufsize); } while ( (e = e->next) != ring->start); ring->to_clean = ring->start; @@ -1643,22 +1666,6 @@ static void yukon_reset(struct skge_hw *hw, int port) | GM_RXCR_UCF_ENA | GM_RXCR_MCF_ENA); } -/* Apparently, early versions of Yukon-Lite had wrong chip_id? */ -static int is_yukon_lite_a0(struct skge_hw *hw) -{ - u32 reg; - int ret; - - if (hw->chip_id != CHIP_ID_YUKON) - return 0; - - reg = skge_read32(hw, B2_FAR); - skge_write8(hw, B2_FAR + 3, 0xff); - ret = (skge_read8(hw, B2_FAR + 3) != 0); - skge_write32(hw, B2_FAR, reg); - return ret; -} - static void yukon_mac_init(struct skge_hw *hw, int port) { struct skge_port *skge = netdev_priv(hw->dev[port]); @@ -1774,11 +1781,9 @@ static void yukon_mac_init(struct skge_hw *hw, int port) /* Configure Rx MAC FIFO */ skge_write16(hw, SK_REG(port, RX_GMF_FL_MSK), RX_FF_FL_DEF_MSK); reg = GMF_OPER_ON | GMF_RX_F_FL_ON; - - /* disable Rx GMAC FIFO Flush for YUKON-Lite Rev. A0 only */ - if (is_yukon_lite_a0(hw)) + if (hw->chip_id == CHIP_ID_YUKON_LITE && + hw->chip_rev >= CHIP_REV_YU_LITE_A3) reg &= ~GMF_RX_F_FL_ON; - skge_write8(hw, SK_REG(port, RX_GMF_CTRL_T), GMF_RST_CLR); skge_write16(hw, SK_REG(port, RX_GMF_CTRL_T), reg); /* @@ -2437,14 +2442,6 @@ static void yukon_set_multicast(struct net_device *dev) gma_write16(hw, port, GM_RX_CTRL, reg); } -static inline u16 phy_length(const struct skge_hw *hw, u32 status) -{ - if (hw->chip_id == CHIP_ID_GENESIS) - return status >> XMR_FS_LEN_SHIFT; - else - return status >> GMR_FS_LEN_SHIFT; -} - static inline int bad_phy_status(const struct skge_hw *hw, u32 status) { if (hw->chip_id == CHIP_ID_GENESIS) @@ -2454,99 +2451,80 @@ static inline int bad_phy_status(const struct skge_hw *hw, u32 status) (status & GMR_FS_RX_OK) == 0; } +static void skge_rx_error(struct skge_port *skge, int slot, + u32 control, u32 status) +{ + if (netif_msg_rx_err(skge)) + printk(KERN_DEBUG PFX "%s: rx err, slot %d control 0x%x status 0x%x\n", + skge->netdev->name, slot, control, status); + + if ((control & (BMU_EOF|BMU_STF)) != (BMU_STF|BMU_EOF)) + skge->net_stats.rx_length_errors++; + else if (skge->hw->chip_id == CHIP_ID_GENESIS) { + if (status & (XMR_FS_RUNT|XMR_FS_LNG_ERR)) + skge->net_stats.rx_length_errors++; + if (status & XMR_FS_FRA_ERR) + skge->net_stats.rx_frame_errors++; + if (status & XMR_FS_FCS_ERR) + skge->net_stats.rx_crc_errors++; + } else { + if (status & (GMR_FS_LONG_ERR|GMR_FS_UN_SIZE)) + skge->net_stats.rx_length_errors++; + if (status & GMR_FS_FRAGMENT) + skge->net_stats.rx_frame_errors++; + if (status & GMR_FS_CRC_ERR) + skge->net_stats.rx_crc_errors++; + } +} /* Get receive buffer from descriptor. * Handles copy of small buffers and reallocation failures */ static inline struct sk_buff *skge_rx_get(struct skge_port *skge, struct skge_element *e, - u32 control, u32 status, u16 csum) + unsigned int len) { - struct sk_buff *skb; - u16 len = control & BMU_BBC; - - if (unlikely(netif_msg_rx_status(skge))) - printk(KERN_DEBUG PFX "%s: rx slot %td status 0x%x len %d\n", - skge->netdev->name, e - skge->rx_ring.start, - status, len); - - if (len > skge->rx_buf_size) - goto error; - - if ((control & (BMU_EOF|BMU_STF)) != (BMU_STF|BMU_EOF)) - goto error; - - if (bad_phy_status(skge->hw, status)) - goto error; - - if (phy_length(skge->hw, status) != len) - goto error; + struct sk_buff *nskb, *skb; if (len < RX_COPY_THRESHOLD) { - skb = dev_alloc_skb(len + 2); - if (!skb) - goto resubmit; + nskb = skge_rx_alloc(skge->netdev, len + NET_IP_ALIGN); + if (unlikely(!nskb)) + return NULL; - skb_reserve(skb, 2); pci_dma_sync_single_for_cpu(skge->hw->pdev, pci_unmap_addr(e, mapaddr), len, PCI_DMA_FROMDEVICE); - memcpy(skb->data, e->skb->data, len); + memcpy(nskb->data, e->skb->data, len); pci_dma_sync_single_for_device(skge->hw->pdev, pci_unmap_addr(e, mapaddr), len, PCI_DMA_FROMDEVICE); + + if (skge->rx_csum) { + struct skge_rx_desc *rd = e->desc; + nskb->csum = le16_to_cpu(rd->csum2); + nskb->ip_summed = CHECKSUM_HW; + } skge_rx_reuse(e, skge->rx_buf_size); + return nskb; } else { - struct sk_buff *nskb; - nskb = dev_alloc_skb(skge->rx_buf_size + NET_IP_ALIGN); - if (!nskb) - goto resubmit; + nskb = skge_rx_alloc(skge->netdev, skge->rx_buf_size); + if (unlikely(!nskb)) + return NULL; pci_unmap_single(skge->hw->pdev, pci_unmap_addr(e, mapaddr), pci_unmap_len(e, maplen), PCI_DMA_FROMDEVICE); skb = e->skb; - prefetch(skb->data); - skge_rx_setup(skge, e, nskb, skge->rx_buf_size); - } - - skb_put(skb, len); - skb->dev = skge->netdev; - if (skge->rx_csum) { - skb->csum = csum; - skb->ip_summed = CHECKSUM_HW; - } - - skb->protocol = eth_type_trans(skb, skge->netdev); - - return skb; -error: - - if (netif_msg_rx_err(skge)) - printk(KERN_DEBUG PFX "%s: rx err, slot %td control 0x%x status 0x%x\n", - skge->netdev->name, e - skge->rx_ring.start, - control, status); + if (skge->rx_csum) { + struct skge_rx_desc *rd = e->desc; + skb->csum = le16_to_cpu(rd->csum2); + skb->ip_summed = CHECKSUM_HW; + } - if (skge->hw->chip_id == CHIP_ID_GENESIS) { - if (status & (XMR_FS_RUNT|XMR_FS_LNG_ERR)) - skge->net_stats.rx_length_errors++; - if (status & XMR_FS_FRA_ERR) - skge->net_stats.rx_frame_errors++; - if (status & XMR_FS_FCS_ERR) - skge->net_stats.rx_crc_errors++; - } else { - if (status & (GMR_FS_LONG_ERR|GMR_FS_UN_SIZE)) - skge->net_stats.rx_length_errors++; - if (status & GMR_FS_FRAGMENT) - skge->net_stats.rx_frame_errors++; - if (status & GMR_FS_CRC_ERR) - skge->net_stats.rx_crc_errors++; + skge_rx_setup(skge, e, nskb, skge->rx_buf_size); + return skb; } - -resubmit: - skge_rx_reuse(e, skge->rx_buf_size); - return NULL; } @@ -2562,16 +2540,32 @@ static int skge_poll(struct net_device *dev, int *budget) for (e = ring->to_clean; work_done < to_do; e = e->next) { struct skge_rx_desc *rd = e->desc; struct sk_buff *skb; - u32 control; + u32 control, len, status; rmb(); control = rd->control; if (control & BMU_OWN) break; - skb = skge_rx_get(skge, e, control, rd->status, - le16_to_cpu(rd->csum2)); + len = control & BMU_BBC; + status = rd->status; + + if (unlikely((control & (BMU_EOF|BMU_STF)) != (BMU_STF|BMU_EOF) + || bad_phy_status(hw, status))) { + skge_rx_error(skge, e - ring->start, control, status); + skge_rx_reuse(e, skge->rx_buf_size); + continue; + } + + if (netif_msg_rx_status(skge)) + printk(KERN_DEBUG PFX "%s: rx slot %td status 0x%x len %d\n", + dev->name, e - ring->start, rd->status, len); + + skb = skge_rx_get(skge, e, len); if (likely(skb)) { + skb_put(skb, len); + skb->protocol = eth_type_trans(skb, dev); + dev->last_rx = jiffies; netif_receive_skb(skb); diff --git a/trunk/drivers/net/skge.h b/trunk/drivers/net/skge.h index 72c175b87a5a..efbf98c675d2 100644 --- a/trunk/drivers/net/skge.h +++ b/trunk/drivers/net/skge.h @@ -953,7 +953,6 @@ enum { */ enum { XMR_FS_LEN = 0x3fff<<18, /* Bit 31..18: Rx Frame Length */ - XMR_FS_LEN_SHIFT = 18, XMR_FS_2L_VLAN = 1<<17, /* Bit 17: tagged wh 2Lev VLAN ID*/ XMR_FS_1_VLAN = 1<<16, /* Bit 16: tagged wh 1ev VLAN ID*/ XMR_FS_BC = 1<<15, /* Bit 15: Broadcast Frame */ @@ -1869,7 +1868,6 @@ enum { /* Receive Frame Status Encoding */ enum { GMR_FS_LEN = 0xffff<<16, /* Bit 31..16: Rx Frame Length */ - GMR_FS_LEN_SHIFT = 16, GMR_FS_VLAN = 1<<13, /* Bit 13: VLAN Packet */ GMR_FS_JABBER = 1<<12, /* Bit 12: Jabber Packet */ GMR_FS_UN_SIZE = 1<<11, /* Bit 11: Undersize Packet */ diff --git a/trunk/drivers/pci/hotplug.c b/trunk/drivers/pci/hotplug.c index e1743be31909..10444988a10b 100644 --- a/trunk/drivers/pci/hotplug.c +++ b/trunk/drivers/pci/hotplug.c @@ -7,6 +7,7 @@ int pci_hotplug (struct device *dev, char **envp, int num_envp, char *buffer, int buffer_size) { struct pci_dev *pdev; + char *scratch; int i = 0; int length = 0; @@ -17,6 +18,9 @@ int pci_hotplug (struct device *dev, char **envp, int num_envp, if (!pdev) return -ENODEV; + scratch = buffer; + + if (add_hotplug_env_var(envp, num_envp, &i, buffer, buffer_size, &length, "PCI_CLASS=%04X", pdev->class)) diff --git a/trunk/drivers/pci/hotplug/rpadlpar_sysfs.c b/trunk/drivers/pci/hotplug/rpadlpar_sysfs.c index db69be85b458..752e6513c447 100644 --- a/trunk/drivers/pci/hotplug/rpadlpar_sysfs.c +++ b/trunk/drivers/pci/hotplug/rpadlpar_sysfs.c @@ -62,7 +62,7 @@ static ssize_t add_slot_store(struct dlpar_io_attr *dlpar_attr, char drc_name[MAX_DRC_NAME_LEN]; char *end; - if (nbytes >= MAX_DRC_NAME_LEN) + if (nbytes > MAX_DRC_NAME_LEN) return 0; memcpy(drc_name, buf, nbytes); @@ -83,7 +83,7 @@ static ssize_t remove_slot_store(struct dlpar_io_attr *dlpar_attr, char drc_name[MAX_DRC_NAME_LEN]; char *end; - if (nbytes >= MAX_DRC_NAME_LEN) + if (nbytes > MAX_DRC_NAME_LEN) return 0; memcpy(drc_name, buf, nbytes); diff --git a/trunk/drivers/pci/hotplug/sgi_hotplug.c b/trunk/drivers/pci/hotplug/sgi_hotplug.c index a32ae82e5922..b1409441c1cd 100644 --- a/trunk/drivers/pci/hotplug/sgi_hotplug.c +++ b/trunk/drivers/pci/hotplug/sgi_hotplug.c @@ -159,7 +159,7 @@ static int sn_hp_slot_private_alloc(struct hotplug_slot *bss_hotplug_slot, pcibus_info = SN_PCIBUS_BUSSOFT_INFO(pci_bus); - slot = kzalloc(sizeof(*slot), GFP_KERNEL); + slot = kcalloc(1, sizeof(*slot), GFP_KERNEL); if (!slot) return -ENOMEM; bss_hotplug_slot->private = slot; @@ -491,7 +491,7 @@ static int sn_hotplug_slot_register(struct pci_bus *pci_bus) if (sn_pci_slot_valid(pci_bus, device) != 1) continue; - bss_hotplug_slot = kzalloc(sizeof(*bss_hotplug_slot), + bss_hotplug_slot = kcalloc(1, sizeof(*bss_hotplug_slot), GFP_KERNEL); if (!bss_hotplug_slot) { rc = -ENOMEM; @@ -499,7 +499,7 @@ static int sn_hotplug_slot_register(struct pci_bus *pci_bus) } bss_hotplug_slot->info = - kzalloc(sizeof(struct hotplug_slot_info), + kcalloc(1, sizeof(struct hotplug_slot_info), GFP_KERNEL); if (!bss_hotplug_slot->info) { rc = -ENOMEM; diff --git a/trunk/drivers/pci/pci-sysfs.c b/trunk/drivers/pci/pci-sysfs.c index 2898830c496f..56a3b397efee 100644 --- a/trunk/drivers/pci/pci-sysfs.c +++ b/trunk/drivers/pci/pci-sysfs.c @@ -360,7 +360,7 @@ pci_create_resource_files(struct pci_dev *pdev) continue; /* allocate attribute structure, piggyback attribute name */ - res_attr = kzalloc(sizeof(*res_attr) + 10, GFP_ATOMIC); + res_attr = kcalloc(1, sizeof(*res_attr) + 10, GFP_ATOMIC); if (res_attr) { char *res_attr_name = (char *)(res_attr + 1); diff --git a/trunk/drivers/pci/probe.c b/trunk/drivers/pci/probe.c index 005786416bb5..26a55d08b506 100644 --- a/trunk/drivers/pci/probe.c +++ b/trunk/drivers/pci/probe.c @@ -165,7 +165,7 @@ static void pci_read_bases(struct pci_dev *dev, unsigned int howmany, int rom) if (l == 0xffffffff) l = 0; if ((l & PCI_BASE_ADDRESS_SPACE) == PCI_BASE_ADDRESS_SPACE_MEMORY) { - sz = pci_size(l, sz, (u32)PCI_BASE_ADDRESS_MEM_MASK); + sz = pci_size(l, sz, PCI_BASE_ADDRESS_MEM_MASK); if (!sz) continue; res->start = l & PCI_BASE_ADDRESS_MEM_MASK; @@ -215,7 +215,7 @@ static void pci_read_bases(struct pci_dev *dev, unsigned int howmany, int rom) if (l == 0xffffffff) l = 0; if (sz && sz != 0xffffffff) { - sz = pci_size(l, sz, (u32)PCI_ROM_ADDRESS_MASK); + sz = pci_size(l, sz, PCI_ROM_ADDRESS_MASK); if (sz) { res->flags = (l & IORESOURCE_ROM_ENABLE) | IORESOURCE_MEM | IORESOURCE_PREFETCH | @@ -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/s390/cio/ccwgroup.c b/trunk/drivers/s390/cio/ccwgroup.c index dbb3eb0e330b..91ea8e4777f3 100644 --- a/trunk/drivers/s390/cio/ccwgroup.c +++ b/trunk/drivers/s390/cio/ccwgroup.c @@ -437,7 +437,7 @@ __ccwgroup_get_gdev_by_cdev(struct ccw_device *cdev) if (cdev->dev.driver_data) { gdev = (struct ccwgroup_device *)cdev->dev.driver_data; if (get_device(&gdev->dev)) { - if (device_is_registered(&gdev->dev)) + if (klist_node_attached(&gdev->dev.knode_bus)) return gdev; put_device(&gdev->dev); } diff --git a/trunk/drivers/scsi/ata_piix.c b/trunk/drivers/scsi/ata_piix.c index d71cef767cec..87e0c36f1554 100644 --- a/trunk/drivers/scsi/ata_piix.c +++ b/trunk/drivers/scsi/ata_piix.c @@ -442,6 +442,7 @@ static void piix_sata_phy_reset(struct ata_port *ap) * piix_set_piomode - Initialize host controller PATA PIO timings * @ap: Port whose timings we are configuring * @adev: um + * @pio: PIO mode, 0 - 4 * * Set PIO mode for device, in host controller PCI config space. * diff --git a/trunk/drivers/scsi/libata-core.c b/trunk/drivers/scsi/libata-core.c index e5b01997117a..d92273cbe0de 100644 --- a/trunk/drivers/scsi/libata-core.c +++ b/trunk/drivers/scsi/libata-core.c @@ -4131,53 +4131,6 @@ int ata_device_add(struct ata_probe_ent *ent) return 0; } -/** - * ata_host_set_remove - PCI layer callback for device removal - * @host_set: ATA host set that was removed - * - * Unregister all objects associated with this host set. Free those - * objects. - * - * LOCKING: - * Inherited from calling layer (may sleep). - */ - - -void ata_host_set_remove(struct ata_host_set *host_set) -{ - struct ata_port *ap; - unsigned int i; - - for (i = 0; i < host_set->n_ports; i++) { - ap = host_set->ports[i]; - scsi_remove_host(ap->host); - } - - free_irq(host_set->irq, host_set); - - for (i = 0; i < host_set->n_ports; i++) { - ap = host_set->ports[i]; - - ata_scsi_release(ap->host); - - if ((ap->flags & ATA_FLAG_NO_LEGACY) == 0) { - struct ata_ioports *ioaddr = &ap->ioaddr; - - if (ioaddr->cmd_addr == 0x1f0) - release_region(0x1f0, 8); - else if (ioaddr->cmd_addr == 0x170) - release_region(0x170, 8); - } - - scsi_host_put(ap->host); - } - - if (host_set->ops->host_stop) - host_set->ops->host_stop(host_set); - - kfree(host_set); -} - /** * ata_scsi_release - SCSI layer callback hook for host unload * @host: libata host to be unloaded @@ -4518,8 +4471,39 @@ void ata_pci_remove_one (struct pci_dev *pdev) { struct device *dev = pci_dev_to_dev(pdev); struct ata_host_set *host_set = dev_get_drvdata(dev); + struct ata_port *ap; + unsigned int i; + + for (i = 0; i < host_set->n_ports; i++) { + ap = host_set->ports[i]; + + scsi_remove_host(ap->host); + } + + free_irq(host_set->irq, host_set); + + for (i = 0; i < host_set->n_ports; i++) { + ap = host_set->ports[i]; + + ata_scsi_release(ap->host); + + if ((ap->flags & ATA_FLAG_NO_LEGACY) == 0) { + struct ata_ioports *ioaddr = &ap->ioaddr; + + if (ioaddr->cmd_addr == 0x1f0) + release_region(0x1f0, 8); + else if (ioaddr->cmd_addr == 0x170) + release_region(0x170, 8); + } + + scsi_host_put(ap->host); + } + + if (host_set->ops->host_stop) + host_set->ops->host_stop(host_set); + + kfree(host_set); - ata_host_set_remove(host_set); pci_release_regions(pdev); pci_disable_device(pdev); dev_set_drvdata(dev, NULL); @@ -4589,7 +4573,6 @@ module_exit(ata_exit); EXPORT_SYMBOL_GPL(ata_std_bios_param); EXPORT_SYMBOL_GPL(ata_std_ports); EXPORT_SYMBOL_GPL(ata_device_add); -EXPORT_SYMBOL_GPL(ata_host_set_remove); EXPORT_SYMBOL_GPL(ata_sg_init); EXPORT_SYMBOL_GPL(ata_sg_init_one); EXPORT_SYMBOL_GPL(ata_qc_complete); 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/scsi/sata_nv.c b/trunk/drivers/scsi/sata_nv.c index c05653c7779d..a1d62dee3be6 100644 --- a/trunk/drivers/scsi/sata_nv.c +++ b/trunk/drivers/scsi/sata_nv.c @@ -158,8 +158,6 @@ static struct pci_device_id nv_pci_tbl[] = { PCI_ANY_ID, PCI_ANY_ID, 0, 0, MCP51 }, { PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NFORCE_MCP55_SATA, PCI_ANY_ID, PCI_ANY_ID, 0, 0, MCP55 }, - { PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NFORCE_MCP55_SATA2, - PCI_ANY_ID, PCI_ANY_ID, 0, 0, MCP55 }, { PCI_VENDOR_ID_NVIDIA, PCI_ANY_ID, PCI_ANY_ID, PCI_ANY_ID, PCI_CLASS_STORAGE_IDE<<8, 0xffff00, GENERIC }, diff --git a/trunk/drivers/serial/clps711x.c b/trunk/drivers/serial/clps711x.c index 87ef368384fb..78c1f36ad9b7 100644 --- a/trunk/drivers/serial/clps711x.c +++ b/trunk/drivers/serial/clps711x.c @@ -98,7 +98,7 @@ static irqreturn_t clps711xuart_int_rx(int irq, void *dev_id, struct pt_regs *re { struct uart_port *port = dev_id; struct tty_struct *tty = port->info->tty; - unsigned int status, ch, flg; + unsigned int status, ch, flg, ignored = 0; status = clps_readl(SYSFLG(port)); while (!(status & SYSFLG_URXFE)) { diff --git a/trunk/drivers/usb/core/message.c b/trunk/drivers/usb/core/message.c index f1fb67fe22a8..c47c8052b486 100644 --- a/trunk/drivers/usb/core/message.c +++ b/trunk/drivers/usb/core/message.c @@ -987,7 +987,7 @@ void usb_disable_device(struct usb_device *dev, int skip_ep0) /* remove this interface if it has been registered */ interface = dev->actconfig->interface[i]; - if (!device_is_registered(&interface->dev)) + if (!klist_node_attached(&interface->dev.knode_bus)) continue; dev_dbg (&dev->dev, "unregistering interface %s\n", interface->dev.bus_id); diff --git a/trunk/drivers/usb/core/usb.c b/trunk/drivers/usb/core/usb.c index 7d131509e419..087af73a59dd 100644 --- a/trunk/drivers/usb/core/usb.c +++ b/trunk/drivers/usb/core/usb.c @@ -303,7 +303,7 @@ int usb_driver_claim_interface(struct usb_driver *driver, /* if interface was already added, bind now; else let * the future device_add() bind it, bypassing probe() */ - if (device_is_registered(dev)) + if (klist_node_attached(&dev->knode_bus)) device_bind_driver(dev); return 0; @@ -336,8 +336,8 @@ void usb_driver_release_interface(struct usb_driver *driver, if (iface->condition != USB_INTERFACE_BOUND) return; - /* don't release if the interface hasn't been added yet */ - if (device_is_registered(dev)) { + /* release only after device_add() */ + if (klist_node_attached(&dev->knode_bus)) { iface->condition = USB_INTERFACE_UNBINDING; device_release_driver(dev); } diff --git a/trunk/drivers/usb/gadget/pxa2xx_udc.c b/trunk/drivers/usb/gadget/pxa2xx_udc.c index 73f8c9404156..1507738337c4 100644 --- a/trunk/drivers/usb/gadget/pxa2xx_udc.c +++ b/trunk/drivers/usb/gadget/pxa2xx_udc.c @@ -422,7 +422,7 @@ static inline void ep0_idle (struct pxa2xx_udc *dev) } static int -write_packet(volatile unsigned long *uddr, struct pxa2xx_request *req, unsigned max) +write_packet(volatile u32 *uddr, struct pxa2xx_request *req, unsigned max) { u8 *buf; unsigned length, count; @@ -2602,7 +2602,7 @@ static int __exit pxa2xx_udc_remove(struct device *_dev) * VBUS IRQs should probably be ignored so that the PXA device just acts * "dead" to USB hosts until system resume. */ -static int pxa2xx_udc_suspend(struct device *dev, pm_message_t state, u32 level) +static int pxa2xx_udc_suspend(struct device *dev, u32 state, u32 level) { struct pxa2xx_udc *udc = dev_get_drvdata(dev); diff --git a/trunk/drivers/usb/gadget/pxa2xx_udc.h b/trunk/drivers/usb/gadget/pxa2xx_udc.h index a58f3e6e71f1..d0bc396a85d5 100644 --- a/trunk/drivers/usb/gadget/pxa2xx_udc.h +++ b/trunk/drivers/usb/gadget/pxa2xx_udc.h @@ -69,11 +69,11 @@ struct pxa2xx_ep { * UDDR = UDC Endpoint Data Register (the fifo) * DRCM = DMA Request Channel Map */ - volatile unsigned long *reg_udccs; - volatile unsigned long *reg_ubcr; - volatile unsigned long *reg_uddr; + volatile u32 *reg_udccs; + volatile u32 *reg_ubcr; + volatile u32 *reg_uddr; #ifdef USE_DMA - volatile unsigned long *reg_drcmr; + volatile u32 *reg_drcmr; #define drcmr(n) .reg_drcmr = & DRCMR ## n , #else #define drcmr(n) diff --git a/trunk/drivers/usb/host/sl811-hcd.c b/trunk/drivers/usb/host/sl811-hcd.c index d42a15d10a46..d2a1fd40dfcb 100644 --- a/trunk/drivers/usb/host/sl811-hcd.c +++ b/trunk/drivers/usb/host/sl811-hcd.c @@ -782,9 +782,6 @@ static irqreturn_t sl811h_irq(struct usb_hcd *hcd, struct pt_regs *regs) /* usb 1.1 says max 90% of a frame is available for periodic transfers. * this driver doesn't promise that much since it's got to handle an * IRQ per packet; irq handling latencies also use up that time. - * - * NOTE: the periodic schedule is a sparse tree, with the load for - * each branch minimized. see fig 3.5 in the OHCI spec for example. */ #define MAX_PERIODIC_LOAD 500 /* out of 1000 usec */ @@ -846,7 +843,6 @@ static int sl811h_urb_enqueue( if (!(sl811->port1 & (1 << USB_PORT_FEAT_ENABLE)) || !HC_IS_RUNNING(hcd->state)) { retval = -ENODEV; - kfree(ep); goto fail; } @@ -915,16 +911,8 @@ static int sl811h_urb_enqueue( case PIPE_ISOCHRONOUS: case PIPE_INTERRUPT: urb->interval = ep->period; - if (ep->branch < PERIODIC_SIZE) { - /* NOTE: the phase is correct here, but the value - * needs offsetting by the transfer queue depth. - * All current drivers ignore start_frame, so this - * is unlikely to ever matter... - */ - urb->start_frame = (sl811->frame & (PERIODIC_SIZE - 1)) - + ep->branch; + if (ep->branch < PERIODIC_SIZE) break; - } retval = balance(sl811, ep->period, ep->load); if (retval < 0) @@ -1134,7 +1122,7 @@ sl811h_hub_descriptor ( desc->wHubCharacteristics = (__force __u16)cpu_to_le16(temp); /* two bitmaps: ports removable, and legacy PortPwrCtrlMask */ - desc->bitmap[0] = 0 << 1; + desc->bitmap[0] = 1 << 1; desc->bitmap[1] = ~0; } diff --git a/trunk/drivers/usb/net/pegasus.c b/trunk/drivers/usb/net/pegasus.c index 6a4ffe6c3977..7484d34780fc 100644 --- a/trunk/drivers/usb/net/pegasus.c +++ b/trunk/drivers/usb/net/pegasus.c @@ -647,13 +647,6 @@ static void read_bulk_callback(struct urb *urb, struct pt_regs *regs) pkt_len -= 8; } - /* - * If the packet is unreasonably long, quietly drop it rather than - * kernel panicing by calling skb_put. - */ - if (pkt_len > PEGASUS_MTU) - goto goon; - /* * at this point we are sure pegasus->rx_skb != NULL * so we go ahead and pass up the packet. @@ -893,17 +886,15 @@ static inline void get_interrupt_interval(pegasus_t * pegasus) __u8 data[2]; read_eprom_word(pegasus, 4, (__u16 *) data); - if (pegasus->usb->speed != USB_SPEED_HIGH) { - if (data[1] < 0x80) { - if (netif_msg_timer(pegasus)) - dev_info(&pegasus->intf->dev, "intr interval " - "changed from %ums to %ums\n", - data[1], 0x80); - data[1] = 0x80; -#ifdef PEGASUS_WRITE_EEPROM - write_eprom_word(pegasus, 4, *(__u16 *) data); + if (data[1] < 0x80) { + if (netif_msg_timer(pegasus)) + dev_info(&pegasus->intf->dev, + "intr interval changed from %ums to %ums\n", + data[1], 0x80); + data[1] = 0x80; +#ifdef PEGASUS_WRITE_EEPROM + write_eprom_word(pegasus, 4, *(__u16 *) data); #endif - } } pegasus->intr_interval = data[1]; } @@ -913,9 +904,8 @@ static void set_carrier(struct net_device *net) pegasus_t *pegasus = netdev_priv(net); u16 tmp; - if (!read_mii_word(pegasus, pegasus->phy, MII_BMSR, &tmp)) + if (read_mii_word(pegasus, pegasus->phy, MII_BMSR, &tmp)) return; - if (tmp & BMSR_LSTATUS) netif_carrier_on(net); else @@ -1365,7 +1355,6 @@ static void pegasus_disconnect(struct usb_interface *intf) cancel_delayed_work(&pegasus->carrier_check); unregister_netdev(pegasus->net); usb_put_dev(interface_to_usbdev(intf)); - unlink_all_urbs(pegasus); free_all_urbs(pegasus); free_skb_pool(pegasus); if (pegasus->rx_skb) diff --git a/trunk/drivers/usb/serial/airprime.c b/trunk/drivers/usb/serial/airprime.c index 926d4c2c1600..a4ce0008d69b 100644 --- a/trunk/drivers/usb/serial/airprime.c +++ b/trunk/drivers/usb/serial/airprime.c @@ -16,8 +16,7 @@ #include "usb-serial.h" static struct usb_device_id id_table [] = { - { USB_DEVICE(0xf3d, 0x0112) }, /* AirPrime CDMA Wireless PC Card */ - { USB_DEVICE(0x1410, 0x1110) }, /* Novatel Wireless Merlin CDMA */ + { USB_DEVICE(0xf3d, 0x0112) }, { }, }; MODULE_DEVICE_TABLE(usb, id_table); diff --git a/trunk/drivers/usb/serial/ftdi_sio.c b/trunk/drivers/usb/serial/ftdi_sio.c index 5a8631c8a4a7..4e434cb10bb1 100644 --- a/trunk/drivers/usb/serial/ftdi_sio.c +++ b/trunk/drivers/usb/serial/ftdi_sio.c @@ -1846,12 +1846,10 @@ static void ftdi_set_termios (struct usb_serial_port *port, struct termios *old_ } else { /* set the baudrate determined before */ if (change_speed(port)) { - err("%s urb failed to set baudrate", __FUNCTION__); - } - /* Ensure RTS and DTR are raised when baudrate changed from 0 */ - if ((old_termios->c_cflag & CBAUD) == B0) { - set_mctrl(port, TIOCM_DTR | TIOCM_RTS); + err("%s urb failed to set baurdrate", __FUNCTION__); } + /* Ensure RTS and DTR are raised */ + set_mctrl(port, TIOCM_DTR | TIOCM_RTS); } /* Set flow control */ diff --git a/trunk/drivers/usb/serial/option.c b/trunk/drivers/usb/serial/option.c index 4989e5740d18..92d0f925d053 100644 --- a/trunk/drivers/usb/serial/option.c +++ b/trunk/drivers/usb/serial/option.c @@ -25,9 +25,6 @@ 2005-06-20 v0.4.1 add missing braces :-/ killed end-of-line whitespace 2005-07-15 v0.4.2 rename WLAN product to FUSION, add FUSION2 - 2005-09-10 v0.4.3 added HUAWEI E600 card and Audiovox AirCard - 2005-09-20 v0.4.4 increased recv buffer size: the card sometimes - wants to send >2000 bytes. Work sponsored by: Sigos GmbH, Germany @@ -74,21 +71,15 @@ static int option_send_setup(struct usb_serial_port *port); /* Vendor and product IDs */ #define OPTION_VENDOR_ID 0x0AF0 -#define HUAWEI_VENDOR_ID 0x12D1 -#define AUDIOVOX_VENDOR_ID 0x0F3D #define OPTION_PRODUCT_OLD 0x5000 #define OPTION_PRODUCT_FUSION 0x6000 #define OPTION_PRODUCT_FUSION2 0x6300 -#define HUAWEI_PRODUCT_E600 0x1001 -#define AUDIOVOX_PRODUCT_AIRCARD 0x0112 static struct usb_device_id option_ids[] = { { USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_OLD) }, { USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_FUSION) }, { USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_FUSION2) }, - { USB_DEVICE(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E600) }, - { USB_DEVICE(AUDIOVOX_VENDOR_ID, AUDIOVOX_PRODUCT_AIRCARD) }, { } /* Terminating entry */ }; @@ -141,7 +132,7 @@ static int debug; #define N_IN_URB 4 #define N_OUT_URB 1 -#define IN_BUFLEN 4096 +#define IN_BUFLEN 1024 #define OUT_BUFLEN 128 struct option_port_private { 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-arm/io.h b/trunk/include/asm-arm/io.h index 5c4ae8f5dbb0..cfa71a0dffb6 100644 --- a/trunk/include/asm-arm/io.h +++ b/trunk/include/asm-arm/io.h @@ -136,9 +136,9 @@ extern void __readwrite_bug(const char *fn); /* * String version of IO memory access ops: */ -extern void _memcpy_fromio(void *, const volatile void __iomem *, size_t); -extern void _memcpy_toio(volatile void __iomem *, const void *, size_t); -extern void _memset_io(volatile void __iomem *, int, size_t); +extern void _memcpy_fromio(void *, void __iomem *, size_t); +extern void _memcpy_toio(void __iomem *, const void *, size_t); +extern void _memset_io(void __iomem *, int, size_t); #define mmiowb() 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/connector.h b/trunk/include/linux/connector.h index 86d4b0a81713..96de26301f84 100644 --- a/trunk/include/linux/connector.h +++ b/trunk/include/linux/connector.h @@ -104,19 +104,12 @@ struct cn_queue_dev { struct sock *nls; }; -struct cn_callback_id { +struct cn_callback { unsigned char name[CN_CBQ_NAMELEN]; - struct cb_id id; -}; -struct cn_callback_data { - void (*destruct_data) (void *); - void *ddata; - - void *callback_priv; + struct cb_id id; void (*callback) (void *); - - void *free; + void *priv; }; struct cn_callback_entry { @@ -125,8 +118,8 @@ struct cn_callback_entry { struct work_struct work; struct cn_queue_dev *pdev; - struct cn_callback_id id; - struct cn_callback_data data; + void (*destruct_data) (void *); + void *ddata; int seq, group; struct sock *nls; @@ -151,7 +144,7 @@ int cn_add_callback(struct cb_id *, char *, void (*callback) (void *)); void cn_del_callback(struct cb_id *); int cn_netlink_send(struct cn_msg *, u32, int); -int cn_queue_add_callback(struct cn_queue_dev *dev, char *name, struct cb_id *id, void (*callback)(void *)); +int cn_queue_add_callback(struct cn_queue_dev *dev, struct cn_callback *cb); void cn_queue_del_callback(struct cn_queue_dev *dev, struct cb_id *id); struct cn_queue_dev *cn_queue_alloc_dev(char *name, struct sock *); @@ -159,8 +152,6 @@ void cn_queue_free_dev(struct cn_queue_dev *dev); int cn_cb_equal(struct cb_id *, struct cb_id *); -void cn_queue_wrapper(void *data); - extern int cn_already_initialized; #endif /* __KERNEL__ */ diff --git a/trunk/include/linux/device.h b/trunk/include/linux/device.h index 95d607a48f06..06e5d42f2c7b 100644 --- a/trunk/include/linux/device.h +++ b/trunk/include/linux/device.h @@ -317,11 +317,6 @@ dev_set_drvdata (struct device *dev, void *data) dev->driver_data = data; } -static inline int device_is_registered(struct device *dev) -{ - return klist_node_attached(&dev->knode_bus); -} - /* * High level routines for use by the bus drivers */ diff --git a/trunk/include/linux/libata.h b/trunk/include/linux/libata.h index ceee1fc42c60..022105c745fc 100644 --- a/trunk/include/linux/libata.h +++ b/trunk/include/linux/libata.h @@ -393,7 +393,6 @@ extern int ata_pci_init_one (struct pci_dev *pdev, struct ata_port_info **port_i extern void ata_pci_remove_one (struct pci_dev *pdev); #endif /* CONFIG_PCI */ extern int ata_device_add(struct ata_probe_ent *ent); -extern void ata_host_set_remove(struct ata_host_set *host_set); extern int ata_scsi_detect(Scsi_Host_Template *sht); extern int ata_scsi_ioctl(struct scsi_device *dev, int cmd, void __user *arg); extern int ata_scsi_queuecmd(struct scsi_cmnd *cmd, void (*done)(struct scsi_cmnd *)); 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/netfilter_ipv4/ip_nat_core.h b/trunk/include/linux/netfilter_ipv4/ip_nat_core.h index 30db23f06b03..3b50eb91f007 100644 --- a/trunk/include/linux/netfilter_ipv4/ip_nat_core.h +++ b/trunk/include/linux/netfilter_ipv4/ip_nat_core.h @@ -5,14 +5,16 @@ /* This header used to share core functionality between the standalone NAT module, and the compatibility layer's use of NAT for masquerading. */ +extern int ip_nat_init(void); +extern void ip_nat_cleanup(void); -extern unsigned int ip_nat_packet(struct ip_conntrack *ct, +extern unsigned int nat_packet(struct ip_conntrack *ct, enum ip_conntrack_info conntrackinfo, unsigned int hooknum, struct sk_buff **pskb); -extern int ip_nat_icmp_reply_translation(struct sk_buff **pskb, - struct ip_conntrack *ct, - enum ip_nat_manip_type manip, - enum ip_conntrack_dir dir); +extern int icmp_reply_translation(struct sk_buff **pskb, + struct ip_conntrack *ct, + enum ip_nat_manip_type manip, + enum ip_conntrack_dir dir); #endif /* _IP_NAT_CORE_H */ diff --git a/trunk/include/linux/pci_ids.h b/trunk/include/linux/pci_ids.h index b86a4b77007e..c49d28eca561 100644 --- a/trunk/include/linux/pci_ids.h +++ b/trunk/include/linux/pci_ids.h @@ -1268,8 +1268,7 @@ #define PCI_DEVICE_ID_NVIDIA_NFORCE_MCP51_SATA 0x0266 #define PCI_DEVICE_ID_NVIDIA_NFORCE_MCP51_SATA2 0x0267 #define PCI_DEVICE_ID_NVIDIA_NFORCE_MCP55_IDE 0x036E -#define PCI_DEVICE_ID_NVIDIA_NFORCE_MCP55_SATA 0x037E -#define PCI_DEVICE_ID_NVIDIA_NFORCE_MCP55_SATA2 0x037F +#define PCI_DEVICE_ID_NVIDIA_NFORCE_MCP55_SATA 0x036F #define PCI_DEVICE_ID_NVIDIA_NVENET_12 0x0268 #define PCI_DEVICE_ID_NVIDIA_NVENET_13 0x0269 #define PCI_DEVICE_ID_NVIDIA_MCP51_AUDIO 0x026B 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/include/net/llc_sap.h b/trunk/include/net/llc_sap.h index 353baaa627f3..6dd4cdccca42 100644 --- a/trunk/include/net/llc_sap.h +++ b/trunk/include/net/llc_sap.h @@ -13,10 +13,11 @@ */ struct llc_sap; struct sk_buff; +struct net_device; extern void llc_sap_rtn_pdu(struct llc_sap *sap, struct sk_buff *skb); extern void llc_save_primitive(struct sk_buff* skb, unsigned char prim); -extern struct sk_buff *llc_alloc_frame(void); +extern struct sk_buff *llc_alloc_frame(struct net_device *dev); extern void llc_build_and_send_test_pkt(struct llc_sap *sap, struct sk_buff *skb, 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/core/neighbour.c b/trunk/net/core/neighbour.c index 5f160082aafc..39fc55edf691 100644 --- a/trunk/net/core/neighbour.c +++ b/trunk/net/core/neighbour.c @@ -61,9 +61,7 @@ static int pneigh_ifdown(struct neigh_table *tbl, struct net_device *dev); void neigh_changeaddr(struct neigh_table *tbl, struct net_device *dev); static struct neigh_table *neigh_tables; -#ifdef CONFIG_PROC_FS static struct file_operations neigh_stat_seq_fops; -#endif /* Neighbour hash table buckets are protected with rwlock tbl->lock. diff --git a/trunk/net/ipv4/netfilter/Kconfig b/trunk/net/ipv4/netfilter/Kconfig index 2cd7e7d1ac90..3cf9b451675c 100644 --- a/trunk/net/ipv4/netfilter/Kconfig +++ b/trunk/net/ipv4/netfilter/Kconfig @@ -537,17 +537,6 @@ config IP_NF_TARGET_TCPMSS To compile it as a module, choose M here. If unsure, say N. -config IP_NF_TARGET_NFQUEUE - tristate "NFQUEUE Target Support" - depends on IP_NF_IPTABLES - help - This Target replaced the old obsolete QUEUE target. - - As opposed to QUEUE, it supports 65535 different queues, - not just one. - - To compile it as a module, choose M here. If unsure, say N. - # NAT + specific targets config IP_NF_NAT tristate "Full NAT" diff --git a/trunk/net/ipv4/netfilter/Makefile b/trunk/net/ipv4/netfilter/Makefile index dab4b58dd31e..3d45d3c0283c 100644 --- a/trunk/net/ipv4/netfilter/Makefile +++ b/trunk/net/ipv4/netfilter/Makefile @@ -4,8 +4,7 @@ # objects for the standalone - connection tracking / NAT ip_conntrack-objs := ip_conntrack_standalone.o ip_conntrack_core.o ip_conntrack_proto_generic.o ip_conntrack_proto_tcp.o ip_conntrack_proto_udp.o ip_conntrack_proto_icmp.o -ip_nat-objs := ip_nat_core.o ip_nat_helper.o ip_nat_proto_unknown.o ip_nat_proto_tcp.o ip_nat_proto_udp.o ip_nat_proto_icmp.o -iptable_nat-objs := ip_nat_rule.o ip_nat_standalone.o +iptable_nat-objs := ip_nat_standalone.o ip_nat_rule.o ip_nat_core.o ip_nat_helper.o ip_nat_proto_unknown.o ip_nat_proto_tcp.o ip_nat_proto_udp.o ip_nat_proto_icmp.o ip_conntrack_pptp-objs := ip_conntrack_helper_pptp.o ip_conntrack_proto_gre.o ip_nat_pptp-objs := ip_nat_helper_pptp.o ip_nat_proto_gre.o @@ -41,7 +40,7 @@ obj-$(CONFIG_IP_NF_IPTABLES) += ip_tables.o # the three instances of ip_tables obj-$(CONFIG_IP_NF_FILTER) += iptable_filter.o obj-$(CONFIG_IP_NF_MANGLE) += iptable_mangle.o -obj-$(CONFIG_IP_NF_NAT) += iptable_nat.o ip_nat.o +obj-$(CONFIG_IP_NF_NAT) += iptable_nat.o obj-$(CONFIG_IP_NF_RAW) += iptable_raw.o # matches @@ -93,7 +92,6 @@ obj-$(CONFIG_IP_NF_TARGET_TCPMSS) += ipt_TCPMSS.o obj-$(CONFIG_IP_NF_TARGET_NOTRACK) += ipt_NOTRACK.o obj-$(CONFIG_IP_NF_TARGET_CLUSTERIP) += ipt_CLUSTERIP.o obj-$(CONFIG_IP_NF_TARGET_TTL) += ipt_TTL.o -obj-$(CONFIG_IP_NF_TARGET_NFQUEUE) += ipt_NFQUEUE.o # generic ARP tables obj-$(CONFIG_IP_NF_ARPTABLES) += arp_tables.o @@ -103,3 +101,4 @@ obj-$(CONFIG_IP_NF_ARP_MANGLE) += arpt_mangle.o obj-$(CONFIG_IP_NF_ARPFILTER) += arptable_filter.o obj-$(CONFIG_IP_NF_QUEUE) += ip_queue.o +obj-$(CONFIG_NETFILTER_NETLINK_QUEUE) += ipt_NFQUEUE.o 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_proto_gre.c b/trunk/net/ipv4/netfilter/ip_conntrack_proto_gre.c index 744abb9d377a..de3cb9db6f85 100644 --- a/trunk/net/ipv4/netfilter/ip_conntrack_proto_gre.c +++ b/trunk/net/ipv4/netfilter/ip_conntrack_proto_gre.c @@ -247,7 +247,6 @@ static int gre_packet(struct ip_conntrack *ct, ct->proto.gre.stream_timeout); /* Also, more likely to be important, and not a probe. */ set_bit(IPS_ASSURED_BIT, &ct->status); - ip_conntrack_event_cache(IPCT_STATUS, skb); } else ip_ct_refresh_acct(ct, conntrackinfo, skb, ct->proto.gre.timeout); diff --git a/trunk/net/ipv4/netfilter/ip_conntrack_proto_sctp.c b/trunk/net/ipv4/netfilter/ip_conntrack_proto_sctp.c index 59a4a0111dd3..a875f35e576d 100644 --- a/trunk/net/ipv4/netfilter/ip_conntrack_proto_sctp.c +++ b/trunk/net/ipv4/netfilter/ip_conntrack_proto_sctp.c @@ -416,7 +416,6 @@ static int sctp_packet(struct ip_conntrack *conntrack, && newconntrack == SCTP_CONNTRACK_ESTABLISHED) { DEBUGP("Setting assured bit\n"); set_bit(IPS_ASSURED_BIT, &conntrack->status); - ip_conntrack_event_cache(IPCT_STATUS, skb); } return NF_ACCEPT; diff --git a/trunk/net/ipv4/netfilter/ip_conntrack_proto_tcp.c b/trunk/net/ipv4/netfilter/ip_conntrack_proto_tcp.c index 121760d6cc50..1985abc59d24 100644 --- a/trunk/net/ipv4/netfilter/ip_conntrack_proto_tcp.c +++ b/trunk/net/ipv4/netfilter/ip_conntrack_proto_tcp.c @@ -1014,8 +1014,7 @@ static int tcp_packet(struct ip_conntrack *conntrack, /* Set ASSURED if we see see valid ack in ESTABLISHED after SYN_RECV or a valid answer for a picked up connection. */ - set_bit(IPS_ASSURED_BIT, &conntrack->status); - ip_conntrack_event_cache(IPCT_STATUS, skb); + set_bit(IPS_ASSURED_BIT, &conntrack->status); } ip_ct_refresh_acct(conntrack, ctinfo, skb, timeout); 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/netfilter/ip_nat_core.c b/trunk/net/ipv4/netfilter/ip_nat_core.c index c5e3abd24672..c3ea891d38e7 100644 --- a/trunk/net/ipv4/netfilter/ip_nat_core.c +++ b/trunk/net/ipv4/netfilter/ip_nat_core.c @@ -74,14 +74,12 @@ ip_nat_proto_find_get(u_int8_t protonum) return p; } -EXPORT_SYMBOL_GPL(ip_nat_proto_find_get); void ip_nat_proto_put(struct ip_nat_protocol *p) { module_put(p->me); } -EXPORT_SYMBOL_GPL(ip_nat_proto_put); /* We keep an extra hash for each conntrack, for fast searching. */ static inline unsigned int @@ -113,7 +111,6 @@ ip_nat_cheat_check(u_int32_t oldvalinv, u_int32_t newval, u_int16_t oldcheck) return csum_fold(csum_partial((char *)diffs, sizeof(diffs), oldcheck^0xFFFF)); } -EXPORT_SYMBOL(ip_nat_cheat_check); /* Is this tuple already taken? (not by us) */ int @@ -130,7 +127,6 @@ ip_nat_used_tuple(const struct ip_conntrack_tuple *tuple, invert_tuplepr(&reply, tuple); return ip_conntrack_tuple_taken(&reply, ignored_conntrack); } -EXPORT_SYMBOL(ip_nat_used_tuple); /* If we source map this tuple so reply looks like reply_tuple, will * that meet the constraints of range. */ @@ -351,7 +347,6 @@ ip_nat_setup_info(struct ip_conntrack *conntrack, return NF_ACCEPT; } -EXPORT_SYMBOL(ip_nat_setup_info); /* Returns true if succeeded. */ static int @@ -392,10 +387,10 @@ manip_pkt(u_int16_t proto, } /* Do packet manipulations according to ip_nat_setup_info. */ -unsigned int ip_nat_packet(struct ip_conntrack *ct, - enum ip_conntrack_info ctinfo, - unsigned int hooknum, - struct sk_buff **pskb) +unsigned int nat_packet(struct ip_conntrack *ct, + enum ip_conntrack_info ctinfo, + unsigned int hooknum, + struct sk_buff **pskb) { enum ip_conntrack_dir dir = CTINFO2DIR(ctinfo); unsigned long statusbit; @@ -422,13 +417,12 @@ unsigned int ip_nat_packet(struct ip_conntrack *ct, } return NF_ACCEPT; } -EXPORT_SYMBOL_GPL(ip_nat_packet); /* Dir is direction ICMP is coming from (opposite to packet it contains) */ -int ip_nat_icmp_reply_translation(struct sk_buff **pskb, - struct ip_conntrack *ct, - enum ip_nat_manip_type manip, - enum ip_conntrack_dir dir) +int icmp_reply_translation(struct sk_buff **pskb, + struct ip_conntrack *ct, + enum ip_nat_manip_type manip, + enum ip_conntrack_dir dir) { struct { struct icmphdr icmp; @@ -515,7 +509,6 @@ int ip_nat_icmp_reply_translation(struct sk_buff **pskb, return 1; } -EXPORT_SYMBOL_GPL(ip_nat_icmp_reply_translation); /* Protocol registration. */ int ip_nat_protocol_register(struct ip_nat_protocol *proto) @@ -532,7 +525,6 @@ int ip_nat_protocol_register(struct ip_nat_protocol *proto) write_unlock_bh(&ip_nat_lock); return ret; } -EXPORT_SYMBOL(ip_nat_protocol_register); /* Noone stores the protocol anywhere; simply delete it. */ void ip_nat_protocol_unregister(struct ip_nat_protocol *proto) @@ -544,7 +536,6 @@ void ip_nat_protocol_unregister(struct ip_nat_protocol *proto) /* Someone could be still looking at the proto in a bh. */ synchronize_net(); } -EXPORT_SYMBOL(ip_nat_protocol_unregister); #if defined(CONFIG_IP_NF_CONNTRACK_NETLINK) || \ defined(CONFIG_IP_NF_CONNTRACK_NETLINK_MODULE) @@ -591,7 +582,7 @@ EXPORT_SYMBOL_GPL(ip_nat_port_nfattr_to_range); EXPORT_SYMBOL_GPL(ip_nat_port_range_to_nfattr); #endif -static int __init ip_nat_init(void) +int __init ip_nat_init(void) { size_t i; @@ -633,14 +624,10 @@ static int clean_nat(struct ip_conntrack *i, void *data) return 0; } -static void __exit ip_nat_cleanup(void) +/* Not __exit: called from ip_nat_standalone.c:init_or_cleanup() --RR */ +void ip_nat_cleanup(void) { ip_ct_iterate_cleanup(&clean_nat, NULL); ip_conntrack_destroyed = NULL; vfree(bysource); } - -MODULE_LICENSE("GPL"); - -module_init(ip_nat_init); -module_exit(ip_nat_cleanup); diff --git a/trunk/net/ipv4/netfilter/ip_nat_helper.c b/trunk/net/ipv4/netfilter/ip_nat_helper.c index 5d506e0564d5..d2dd5d313556 100644 --- a/trunk/net/ipv4/netfilter/ip_nat_helper.c +++ b/trunk/net/ipv4/netfilter/ip_nat_helper.c @@ -199,7 +199,6 @@ ip_nat_mangle_tcp_packet(struct sk_buff **pskb, } return 1; } -EXPORT_SYMBOL(ip_nat_mangle_tcp_packet); /* Generic function for mangling variable-length address changes inside * NATed UDP connections (like the CONNECT DATA XXXXX MESG XXXXX INDEX XXXXX @@ -257,7 +256,6 @@ ip_nat_mangle_udp_packet(struct sk_buff **pskb, return 1; } -EXPORT_SYMBOL(ip_nat_mangle_udp_packet); /* Adjust one found SACK option including checksum correction */ static void @@ -401,7 +399,6 @@ ip_nat_seq_adjust(struct sk_buff **pskb, return 1; } -EXPORT_SYMBOL(ip_nat_seq_adjust); /* Setup NAT on this expected conntrack so it follows master. */ /* If we fail to get a free NAT slot, we'll get dropped on confirm */ @@ -428,4 +425,3 @@ void ip_nat_follow_master(struct ip_conntrack *ct, /* hook doesn't matter, but it has to do destination manip */ ip_nat_setup_info(ct, &range, NF_IP_PRE_ROUTING); } -EXPORT_SYMBOL(ip_nat_follow_master); diff --git a/trunk/net/ipv4/netfilter/ip_nat_standalone.c b/trunk/net/ipv4/netfilter/ip_nat_standalone.c index 30cd4e18c129..0ff368b131f6 100644 --- a/trunk/net/ipv4/netfilter/ip_nat_standalone.c +++ b/trunk/net/ipv4/netfilter/ip_nat_standalone.c @@ -108,8 +108,8 @@ ip_nat_fn(unsigned int hooknum, case IP_CT_RELATED: case IP_CT_RELATED+IP_CT_IS_REPLY: if ((*pskb)->nh.iph->protocol == IPPROTO_ICMP) { - if (!ip_nat_icmp_reply_translation(pskb, ct, maniptype, - CTINFO2DIR(ctinfo))) + if (!icmp_reply_translation(pskb, ct, maniptype, + CTINFO2DIR(ctinfo))) return NF_DROP; else return NF_ACCEPT; @@ -152,7 +152,7 @@ ip_nat_fn(unsigned int hooknum, } IP_NF_ASSERT(info); - return ip_nat_packet(ct, ctinfo, hooknum, pskb); + return nat_packet(ct, ctinfo, hooknum, pskb); } static unsigned int @@ -325,10 +325,15 @@ static int init_or_cleanup(int init) printk("ip_nat_init: can't setup rules.\n"); goto cleanup_nothing; } + ret = ip_nat_init(); + if (ret < 0) { + printk("ip_nat_init: can't setup rules.\n"); + goto cleanup_rule_init; + } ret = nf_register_hook(&ip_nat_in_ops); if (ret < 0) { printk("ip_nat_init: can't register in hook.\n"); - goto cleanup_rule_init; + goto cleanup_nat; } ret = nf_register_hook(&ip_nat_out_ops); if (ret < 0) { @@ -369,6 +374,8 @@ static int init_or_cleanup(int init) nf_unregister_hook(&ip_nat_out_ops); cleanup_inops: nf_unregister_hook(&ip_nat_in_ops); + cleanup_nat: + ip_nat_cleanup(); cleanup_rule_init: ip_nat_rule_cleanup(); cleanup_nothing: @@ -388,4 +395,14 @@ static void __exit fini(void) module_init(init); module_exit(fini); +EXPORT_SYMBOL(ip_nat_setup_info); +EXPORT_SYMBOL(ip_nat_protocol_register); +EXPORT_SYMBOL(ip_nat_protocol_unregister); +EXPORT_SYMBOL_GPL(ip_nat_proto_find_get); +EXPORT_SYMBOL_GPL(ip_nat_proto_put); +EXPORT_SYMBOL(ip_nat_cheat_check); +EXPORT_SYMBOL(ip_nat_mangle_tcp_packet); +EXPORT_SYMBOL(ip_nat_mangle_udp_packet); +EXPORT_SYMBOL(ip_nat_used_tuple); +EXPORT_SYMBOL(ip_nat_follow_master); MODULE_LICENSE("GPL"); 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/ipv6/addrconf.c b/trunk/net/ipv6/addrconf.c index 4e509e52fbc1..2fea3f4402a0 100644 --- a/trunk/net/ipv6/addrconf.c +++ b/trunk/net/ipv6/addrconf.c @@ -3520,8 +3520,6 @@ int __init addrconf_init(void) if (err) return err; - ip6_null_entry.rt6i_idev = in6_dev_get(&loopback_dev); - register_netdevice_notifier(&ipv6_dev_notf); #ifdef CONFIG_IPV6_PRIVACY diff --git a/trunk/net/ipv6/netfilter/Kconfig b/trunk/net/ipv6/netfilter/Kconfig index bb7ccfe33f23..216fbe1ac65c 100644 --- a/trunk/net/ipv6/netfilter/Kconfig +++ b/trunk/net/ipv6/netfilter/Kconfig @@ -209,17 +209,6 @@ config IP6_NF_TARGET_REJECT To compile it as a module, choose M here. If unsure, say N. -config IP6_NF_TARGET_NFQUEUE - tristate "NFQUEUE Target Support" - depends on IP_NF_IPTABLES - help - This Target replaced the old obsolete QUEUE target. - - As opposed to QUEUE, it supports 65535 different queues, - not just one. - - To compile it as a module, choose M here. If unsure, say N. - # if [ "$CONFIG_IP6_NF_FILTER" != "n" ]; then # dep_tristate ' REJECT target support' CONFIG_IP6_NF_TARGET_REJECT $CONFIG_IP6_NF_FILTER # if [ "$CONFIG_EXPERIMENTAL" = "y" ]; then diff --git a/trunk/net/ipv6/netfilter/Makefile b/trunk/net/ipv6/netfilter/Makefile index 2b2c370e8b1c..bd9a16a5cbba 100644 --- a/trunk/net/ipv6/netfilter/Makefile +++ b/trunk/net/ipv6/netfilter/Makefile @@ -21,9 +21,9 @@ obj-$(CONFIG_IP6_NF_FILTER) += ip6table_filter.o obj-$(CONFIG_IP6_NF_MANGLE) += ip6table_mangle.o obj-$(CONFIG_IP6_NF_TARGET_MARK) += ip6t_MARK.o obj-$(CONFIG_IP6_NF_TARGET_HL) += ip6t_HL.o -obj-$(CONFIG_IP6_NF_TARGET_NFQUEUE) += ip6t_NFQUEUE.o obj-$(CONFIG_IP6_NF_QUEUE) += ip6_queue.o obj-$(CONFIG_IP6_NF_TARGET_LOG) += ip6t_LOG.o obj-$(CONFIG_IP6_NF_RAW) += ip6table_raw.o obj-$(CONFIG_IP6_NF_MATCH_HL) += ip6t_hl.o obj-$(CONFIG_IP6_NF_TARGET_REJECT) += ip6t_REJECT.o +obj-$(CONFIG_NETFILTER_NETLINK_QUEUE) += ip6t_NFQUEUE.o diff --git a/trunk/net/irda/irttp.c b/trunk/net/irda/irttp.c index 8aff254cb418..6602d901f8b1 100644 --- a/trunk/net/irda/irttp.c +++ b/trunk/net/irda/irttp.c @@ -38,7 +38,7 @@ #include #include -static struct irttp_cb *irttp; +static struct irttp_cb *irttp = NULL; static void __irttp_close_tsap(struct tsap_cb *self); @@ -86,9 +86,12 @@ static pi_param_info_t param_info = { pi_major_call_table, 1, 0x0f, 4 }; */ int __init irttp_init(void) { - irttp = kmalloc(sizeof(struct irttp_cb), GFP_KERNEL); - if (irttp == NULL) - return -ENOMEM; + /* Initialize the irttp structure. */ + if (irttp == NULL) { + irttp = kmalloc(sizeof(struct irttp_cb), GFP_KERNEL); + if (irttp == NULL) + return -ENOMEM; + } memset(irttp, 0, sizeof(struct irttp_cb)); irttp->magic = TTP_MAGIC; @@ -97,7 +100,6 @@ int __init irttp_init(void) if (!irttp->tsaps) { IRDA_ERROR("%s: can't allocate IrTTP hashbin!\n", __FUNCTION__); - kfree(irttp); return -ENOMEM; } @@ -113,6 +115,7 @@ int __init irttp_init(void) void __exit irttp_cleanup(void) { /* Check for main structure */ + IRDA_ASSERT(irttp != NULL, return;); IRDA_ASSERT(irttp->magic == TTP_MAGIC, return;); /* @@ -379,6 +382,7 @@ struct tsap_cb *irttp_open_tsap(__u8 stsap_sel, int credit, notify_t *notify) struct lsap_cb *lsap; notify_t ttp_notify; + IRDA_ASSERT(irttp != NULL, return NULL;); IRDA_ASSERT(irttp->magic == TTP_MAGIC, return NULL;); /* The IrLMP spec (IrLMP 1.1 p10) says that we have the right to @@ -1876,6 +1880,8 @@ static int irttp_seq_open(struct inode *inode, struct file *file) struct seq_file *seq; int rc = -ENOMEM; struct irttp_iter_state *s; + + IRDA_ASSERT(irttp != NULL, return -EINVAL;); s = kmalloc(sizeof(*s), GFP_KERNEL); if (!s) diff --git a/trunk/net/llc/llc_c_ac.c b/trunk/net/llc/llc_c_ac.c index b218be4c10ec..db98ea2113a5 100644 --- a/trunk/net/llc/llc_c_ac.c +++ b/trunk/net/llc/llc_c_ac.c @@ -217,13 +217,12 @@ int llc_conn_ac_stop_rej_tmr_if_data_flag_eq_2(struct sock *sk, int llc_conn_ac_send_disc_cmd_p_set_x(struct sock *sk, struct sk_buff *skb) { int rc = -ENOBUFS; - struct sk_buff *nskb = llc_alloc_frame(); + struct llc_sock *llc = llc_sk(sk); + struct sk_buff *nskb = llc_alloc_frame(llc->dev); if (nskb) { - struct llc_sock *llc = llc_sk(sk); struct llc_sap *sap = llc->sap; - nskb->dev = llc->dev; llc_pdu_header_init(nskb, LLC_PDU_TYPE_U, sap->laddr.lsap, llc->daddr.lsap, LLC_PDU_CMD); llc_pdu_init_as_disc_cmd(nskb, 1); @@ -243,14 +242,13 @@ int llc_conn_ac_send_disc_cmd_p_set_x(struct sock *sk, struct sk_buff *skb) int llc_conn_ac_send_dm_rsp_f_set_p(struct sock *sk, struct sk_buff *skb) { int rc = -ENOBUFS; - struct sk_buff *nskb = llc_alloc_frame(); + struct llc_sock *llc = llc_sk(sk); + struct sk_buff *nskb = llc_alloc_frame(llc->dev); if (nskb) { - struct llc_sock *llc = llc_sk(sk); struct llc_sap *sap = llc->sap; u8 f_bit; - nskb->dev = llc->dev; llc_pdu_decode_pf_bit(skb, &f_bit); llc_pdu_header_init(nskb, LLC_PDU_TYPE_U, sap->laddr.lsap, llc->daddr.lsap, LLC_PDU_RSP); @@ -270,14 +268,13 @@ int llc_conn_ac_send_dm_rsp_f_set_p(struct sock *sk, struct sk_buff *skb) int llc_conn_ac_send_dm_rsp_f_set_1(struct sock *sk, struct sk_buff *skb) { int rc = -ENOBUFS; - struct sk_buff *nskb = llc_alloc_frame(); + struct llc_sock *llc = llc_sk(sk); + struct sk_buff *nskb = llc_alloc_frame(llc->dev); if (nskb) { - struct llc_sock *llc = llc_sk(sk); struct llc_sap *sap = llc->sap; u8 f_bit = 1; - nskb->dev = llc->dev; llc_pdu_header_init(nskb, LLC_PDU_TYPE_U, sap->laddr.lsap, llc->daddr.lsap, LLC_PDU_RSP); llc_pdu_init_as_dm_rsp(nskb, f_bit); @@ -306,11 +303,10 @@ int llc_conn_ac_send_frmr_rsp_f_set_x(struct sock *sk, struct sk_buff *skb) llc_pdu_decode_pf_bit(skb, &f_bit); else f_bit = 0; - nskb = llc_alloc_frame(); + nskb = llc_alloc_frame(llc->dev); if (nskb) { struct llc_sap *sap = llc->sap; - nskb->dev = llc->dev; llc_pdu_header_init(nskb, LLC_PDU_TYPE_U, sap->laddr.lsap, llc->daddr.lsap, LLC_PDU_RSP); llc_pdu_init_as_frmr_rsp(nskb, pdu, f_bit, llc->vS, @@ -330,15 +326,14 @@ int llc_conn_ac_send_frmr_rsp_f_set_x(struct sock *sk, struct sk_buff *skb) int llc_conn_ac_resend_frmr_rsp_f_set_0(struct sock *sk, struct sk_buff *skb) { int rc = -ENOBUFS; - struct sk_buff *nskb = llc_alloc_frame(); + struct llc_sock *llc = llc_sk(sk); + struct sk_buff *nskb = llc_alloc_frame(llc->dev); if (nskb) { u8 f_bit = 0; - struct llc_sock *llc = llc_sk(sk); struct llc_sap *sap = llc->sap; struct llc_pdu_sn *pdu = (struct llc_pdu_sn *)&llc->rx_pdu_hdr; - nskb->dev = llc->dev; llc_pdu_header_init(nskb, LLC_PDU_TYPE_U, sap->laddr.lsap, llc->daddr.lsap, LLC_PDU_RSP); llc_pdu_init_as_frmr_rsp(nskb, pdu, f_bit, llc->vS, @@ -360,15 +355,14 @@ int llc_conn_ac_resend_frmr_rsp_f_set_p(struct sock *sk, struct sk_buff *skb) u8 f_bit; int rc = -ENOBUFS; struct sk_buff *nskb; + struct llc_sock *llc = llc_sk(sk); llc_pdu_decode_pf_bit(skb, &f_bit); - nskb = llc_alloc_frame(); + nskb = llc_alloc_frame(llc->dev); if (nskb) { - struct llc_sock *llc = llc_sk(sk); struct llc_sap *sap = llc->sap; struct llc_pdu_sn *pdu = llc_pdu_sn_hdr(skb); - nskb->dev = llc->dev; llc_pdu_header_init(nskb, LLC_PDU_TYPE_U, sap->laddr.lsap, llc->daddr.lsap, LLC_PDU_RSP); llc_pdu_init_as_frmr_rsp(nskb, pdu, f_bit, llc->vS, @@ -451,13 +445,12 @@ int llc_conn_ac_resend_i_xxx_x_set_0_or_send_rr(struct sock *sk, u8 nr; struct llc_pdu_sn *pdu = llc_pdu_sn_hdr(skb); int rc = -ENOBUFS; - struct sk_buff *nskb = llc_alloc_frame(); + struct llc_sock *llc = llc_sk(sk); + struct sk_buff *nskb = llc_alloc_frame(llc->dev); if (nskb) { - struct llc_sock *llc = llc_sk(sk); struct llc_sap *sap = llc->sap; - nskb->dev = llc->dev; llc_pdu_header_init(nskb, LLC_PDU_TYPE_U, sap->laddr.lsap, llc->daddr.lsap, LLC_PDU_RSP); llc_pdu_init_as_rr_rsp(nskb, 0, llc->vR); @@ -487,13 +480,12 @@ int llc_conn_ac_resend_i_rsp_f_set_1(struct sock *sk, struct sk_buff *skb) int llc_conn_ac_send_rej_cmd_p_set_1(struct sock *sk, struct sk_buff *skb) { int rc = -ENOBUFS; - struct sk_buff *nskb = llc_alloc_frame(); + struct llc_sock *llc = llc_sk(sk); + struct sk_buff *nskb = llc_alloc_frame(llc->dev); if (nskb) { - struct llc_sock *llc = llc_sk(sk); struct llc_sap *sap = llc->sap; - nskb->dev = llc->dev; llc_pdu_header_init(nskb, LLC_PDU_TYPE_S, sap->laddr.lsap, llc->daddr.lsap, LLC_PDU_CMD); llc_pdu_init_as_rej_cmd(nskb, 1, llc->vR); @@ -512,14 +504,13 @@ int llc_conn_ac_send_rej_cmd_p_set_1(struct sock *sk, struct sk_buff *skb) int llc_conn_ac_send_rej_rsp_f_set_1(struct sock *sk, struct sk_buff *skb) { int rc = -ENOBUFS; - struct sk_buff *nskb = llc_alloc_frame(); + struct llc_sock *llc = llc_sk(sk); + struct sk_buff *nskb = llc_alloc_frame(llc->dev); if (nskb) { u8 f_bit = 1; - struct llc_sock *llc = llc_sk(sk); struct llc_sap *sap = llc->sap; - nskb->dev = llc->dev; llc_pdu_header_init(nskb, LLC_PDU_TYPE_S, sap->laddr.lsap, llc->daddr.lsap, LLC_PDU_RSP); llc_pdu_init_as_rej_rsp(nskb, f_bit, llc->vR); @@ -538,14 +529,13 @@ int llc_conn_ac_send_rej_rsp_f_set_1(struct sock *sk, struct sk_buff *skb) int llc_conn_ac_send_rej_xxx_x_set_0(struct sock *sk, struct sk_buff *skb) { int rc = -ENOBUFS; - struct sk_buff *nskb = llc_alloc_frame(); + struct llc_sock *llc = llc_sk(sk); + struct sk_buff *nskb = llc_alloc_frame(llc->dev); if (nskb) { - struct llc_sock *llc = llc_sk(sk); struct llc_sap *sap = llc->sap; u8 f_bit = 0; - nskb->dev = llc->dev; llc_pdu_header_init(nskb, LLC_PDU_TYPE_S, sap->laddr.lsap, llc->daddr.lsap, LLC_PDU_RSP); llc_pdu_init_as_rej_rsp(nskb, f_bit, llc->vR); @@ -564,13 +554,12 @@ int llc_conn_ac_send_rej_xxx_x_set_0(struct sock *sk, struct sk_buff *skb) int llc_conn_ac_send_rnr_cmd_p_set_1(struct sock *sk, struct sk_buff *skb) { int rc = -ENOBUFS; - struct sk_buff *nskb = llc_alloc_frame(); + struct llc_sock *llc = llc_sk(sk); + struct sk_buff *nskb = llc_alloc_frame(llc->dev); if (nskb) { - struct llc_sock *llc = llc_sk(sk); struct llc_sap *sap = llc->sap; - nskb->dev = llc->dev; llc_pdu_header_init(nskb, LLC_PDU_TYPE_S, sap->laddr.lsap, llc->daddr.lsap, LLC_PDU_CMD); llc_pdu_init_as_rnr_cmd(nskb, 1, llc->vR); @@ -589,14 +578,13 @@ int llc_conn_ac_send_rnr_cmd_p_set_1(struct sock *sk, struct sk_buff *skb) int llc_conn_ac_send_rnr_rsp_f_set_1(struct sock *sk, struct sk_buff *skb) { int rc = -ENOBUFS; - struct sk_buff *nskb = llc_alloc_frame(); + struct llc_sock *llc = llc_sk(sk); + struct sk_buff *nskb = llc_alloc_frame(llc->dev); if (nskb) { - struct llc_sock *llc = llc_sk(sk); struct llc_sap *sap = llc->sap; u8 f_bit = 1; - nskb->dev = llc->dev; llc_pdu_header_init(nskb, LLC_PDU_TYPE_S, sap->laddr.lsap, llc->daddr.lsap, LLC_PDU_RSP); llc_pdu_init_as_rnr_rsp(nskb, f_bit, llc->vR); @@ -615,14 +603,13 @@ int llc_conn_ac_send_rnr_rsp_f_set_1(struct sock *sk, struct sk_buff *skb) int llc_conn_ac_send_rnr_xxx_x_set_0(struct sock *sk, struct sk_buff *skb) { int rc = -ENOBUFS; - struct sk_buff *nskb = llc_alloc_frame(); + struct llc_sock *llc = llc_sk(sk); + struct sk_buff *nskb = llc_alloc_frame(llc->dev); if (nskb) { u8 f_bit = 0; - struct llc_sock *llc = llc_sk(sk); struct llc_sap *sap = llc->sap; - nskb->dev = llc->dev; llc_pdu_header_init(nskb, LLC_PDU_TYPE_S, sap->laddr.lsap, llc->daddr.lsap, LLC_PDU_RSP); llc_pdu_init_as_rnr_rsp(nskb, f_bit, llc->vR); @@ -653,13 +640,12 @@ int llc_conn_ac_set_remote_busy(struct sock *sk, struct sk_buff *skb) int llc_conn_ac_opt_send_rnr_xxx_x_set_0(struct sock *sk, struct sk_buff *skb) { int rc = -ENOBUFS; - struct sk_buff *nskb = llc_alloc_frame(); + struct llc_sock *llc = llc_sk(sk); + struct sk_buff *nskb = llc_alloc_frame(llc->dev); if (nskb) { - struct llc_sock *llc = llc_sk(sk); struct llc_sap *sap = llc->sap; - nskb->dev = llc->dev; llc_pdu_header_init(nskb, LLC_PDU_TYPE_S, sap->laddr.lsap, llc->daddr.lsap, LLC_PDU_RSP); llc_pdu_init_as_rnr_rsp(nskb, 0, llc->vR); @@ -678,13 +664,12 @@ int llc_conn_ac_opt_send_rnr_xxx_x_set_0(struct sock *sk, struct sk_buff *skb) int llc_conn_ac_send_rr_cmd_p_set_1(struct sock *sk, struct sk_buff *skb) { int rc = -ENOBUFS; - struct sk_buff *nskb = llc_alloc_frame(); + struct llc_sock *llc = llc_sk(sk); + struct sk_buff *nskb = llc_alloc_frame(llc->dev); if (nskb) { - struct llc_sock *llc = llc_sk(sk); struct llc_sap *sap = llc->sap; - nskb->dev = llc->dev; llc_pdu_header_init(nskb, LLC_PDU_TYPE_S, sap->laddr.lsap, llc->daddr.lsap, LLC_PDU_CMD); llc_pdu_init_as_rr_cmd(nskb, 1, llc->vR); @@ -703,14 +688,13 @@ int llc_conn_ac_send_rr_cmd_p_set_1(struct sock *sk, struct sk_buff *skb) int llc_conn_ac_send_rr_rsp_f_set_1(struct sock *sk, struct sk_buff *skb) { int rc = -ENOBUFS; - struct sk_buff *nskb = llc_alloc_frame(); + struct llc_sock *llc = llc_sk(sk); + struct sk_buff *nskb = llc_alloc_frame(llc->dev); if (nskb) { - struct llc_sock *llc = llc_sk(sk); struct llc_sap *sap = llc->sap; u8 f_bit = 1; - nskb->dev = llc->dev; llc_pdu_header_init(nskb, LLC_PDU_TYPE_S, sap->laddr.lsap, llc->daddr.lsap, LLC_PDU_RSP); llc_pdu_init_as_rr_rsp(nskb, f_bit, llc->vR); @@ -729,14 +713,13 @@ int llc_conn_ac_send_rr_rsp_f_set_1(struct sock *sk, struct sk_buff *skb) int llc_conn_ac_send_ack_rsp_f_set_1(struct sock *sk, struct sk_buff *skb) { int rc = -ENOBUFS; - struct sk_buff *nskb = llc_alloc_frame(); + struct llc_sock *llc = llc_sk(sk); + struct sk_buff *nskb = llc_alloc_frame(llc->dev); if (nskb) { - struct llc_sock *llc = llc_sk(sk); struct llc_sap *sap = llc->sap; u8 f_bit = 1; - nskb->dev = llc->dev; llc_pdu_header_init(nskb, LLC_PDU_TYPE_S, sap->laddr.lsap, llc->daddr.lsap, LLC_PDU_RSP); llc_pdu_init_as_rr_rsp(nskb, f_bit, llc->vR); @@ -755,13 +738,12 @@ int llc_conn_ac_send_ack_rsp_f_set_1(struct sock *sk, struct sk_buff *skb) int llc_conn_ac_send_rr_xxx_x_set_0(struct sock *sk, struct sk_buff *skb) { int rc = -ENOBUFS; - struct sk_buff *nskb = llc_alloc_frame(); + struct llc_sock *llc = llc_sk(sk); + struct sk_buff *nskb = llc_alloc_frame(llc->dev); if (nskb) { - struct llc_sock *llc = llc_sk(sk); struct llc_sap *sap = llc->sap; - nskb->dev = llc->dev; llc_pdu_header_init(nskb, LLC_PDU_TYPE_S, sap->laddr.lsap, llc->daddr.lsap, LLC_PDU_RSP); llc_pdu_init_as_rr_rsp(nskb, 0, llc->vR); @@ -780,13 +762,12 @@ int llc_conn_ac_send_rr_xxx_x_set_0(struct sock *sk, struct sk_buff *skb) int llc_conn_ac_send_ack_xxx_x_set_0(struct sock *sk, struct sk_buff *skb) { int rc = -ENOBUFS; - struct sk_buff *nskb = llc_alloc_frame(); + struct llc_sock *llc = llc_sk(sk); + struct sk_buff *nskb = llc_alloc_frame(llc->dev); if (nskb) { - struct llc_sock *llc = llc_sk(sk); struct llc_sap *sap = llc->sap; - nskb->dev = llc->dev; llc_pdu_header_init(nskb, LLC_PDU_TYPE_S, sap->laddr.lsap, llc->daddr.lsap, LLC_PDU_RSP); llc_pdu_init_as_rr_rsp(nskb, 0, llc->vR); @@ -815,8 +796,8 @@ void llc_conn_set_p_flag(struct sock *sk, u8 value) int llc_conn_ac_send_sabme_cmd_p_set_x(struct sock *sk, struct sk_buff *skb) { int rc = -ENOBUFS; - struct sk_buff *nskb = llc_alloc_frame(); struct llc_sock *llc = llc_sk(sk); + struct sk_buff *nskb = llc_alloc_frame(llc->dev); if (nskb) { struct llc_sap *sap = llc->sap; @@ -824,7 +805,6 @@ int llc_conn_ac_send_sabme_cmd_p_set_x(struct sock *sk, struct sk_buff *skb) if (llc->dev->flags & IFF_LOOPBACK) dmac = llc->dev->dev_addr; - nskb->dev = llc->dev; llc_pdu_header_init(nskb, LLC_PDU_TYPE_U, sap->laddr.lsap, llc->daddr.lsap, LLC_PDU_CMD); llc_pdu_init_as_sabme_cmd(nskb, 1); @@ -845,11 +825,11 @@ int llc_conn_ac_send_ua_rsp_f_set_p(struct sock *sk, struct sk_buff *skb) { u8 f_bit; int rc = -ENOBUFS; - struct sk_buff *nskb = llc_alloc_frame(); + struct llc_sock *llc = llc_sk(sk); + struct sk_buff *nskb = llc_alloc_frame(llc->dev); llc_pdu_decode_pf_bit(skb, &f_bit); if (nskb) { - struct llc_sock *llc = llc_sk(sk); struct llc_sap *sap = llc->sap; nskb->dev = llc->dev; @@ -1001,13 +981,12 @@ static int llc_conn_ac_send_rr_rsp_f_set_ackpf(struct sock *sk, struct sk_buff *skb) { int rc = -ENOBUFS; - struct sk_buff *nskb = llc_alloc_frame(); + struct llc_sock *llc = llc_sk(sk); + struct sk_buff *nskb = llc_alloc_frame(llc->dev); if (nskb) { - struct llc_sock *llc = llc_sk(sk); struct llc_sap *sap = llc->sap; - nskb->dev = llc->dev; llc_pdu_header_init(nskb, LLC_PDU_TYPE_S, sap->laddr.lsap, llc->daddr.lsap, LLC_PDU_RSP); llc_pdu_init_as_rr_rsp(nskb, llc->ack_pf, llc->vR); diff --git a/trunk/net/llc/llc_s_ac.c b/trunk/net/llc/llc_s_ac.c index ed8ba7de6122..270b2f2030cd 100644 --- a/trunk/net/llc/llc_s_ac.c +++ b/trunk/net/llc/llc_s_ac.c @@ -103,10 +103,9 @@ int llc_sap_action_send_xid_r(struct llc_sap *sap, struct sk_buff *skb) llc_pdu_decode_sa(skb, mac_da); llc_pdu_decode_da(skb, mac_sa); llc_pdu_decode_ssap(skb, &dsap); - nskb = llc_alloc_frame(); + nskb = llc_alloc_frame(skb->dev); if (!nskb) goto out; - nskb->dev = skb->dev; llc_pdu_header_init(nskb, LLC_PDU_TYPE_U, sap->laddr.lsap, dsap, LLC_PDU_RSP); llc_pdu_init_as_xid_rsp(nskb, LLC_XID_NULL_CLASS_2, 0); @@ -149,10 +148,9 @@ int llc_sap_action_send_test_r(struct llc_sap *sap, struct sk_buff *skb) llc_pdu_decode_sa(skb, mac_da); llc_pdu_decode_da(skb, mac_sa); llc_pdu_decode_ssap(skb, &dsap); - nskb = llc_alloc_frame(); + nskb = llc_alloc_frame(skb->dev); if (!nskb) goto out; - nskb->dev = skb->dev; llc_pdu_header_init(nskb, LLC_PDU_TYPE_U, sap->laddr.lsap, dsap, LLC_PDU_RSP); llc_pdu_init_as_test_rsp(nskb, skb); diff --git a/trunk/net/llc/llc_sap.c b/trunk/net/llc/llc_sap.c index 34228ef14985..0adaa289bf0a 100644 --- a/trunk/net/llc/llc_sap.c +++ b/trunk/net/llc/llc_sap.c @@ -26,11 +26,12 @@ /** * llc_alloc_frame - allocates sk_buff for frame + * @dev: network device this skb will be sent over * * Allocates an sk_buff for frame and initializes sk_buff fields. * Returns allocated skb or %NULL when out of memory. */ -struct sk_buff *llc_alloc_frame(void) +struct sk_buff *llc_alloc_frame(struct net_device *dev) { struct sk_buff *skb = alloc_skb(128, GFP_ATOMIC); @@ -38,7 +39,7 @@ struct sk_buff *llc_alloc_frame(void) skb_reserve(skb, 50); skb->nh.raw = skb->h.raw = skb->data; skb->protocol = htons(ETH_P_802_2); - skb->dev = dev_base->next; + skb->dev = dev; skb->mac.raw = skb->head; } return skb; diff --git a/trunk/net/llc/llc_station.c b/trunk/net/llc/llc_station.c index 8fe48a24bad5..85a7ac276141 100644 --- a/trunk/net/llc/llc_station.c +++ b/trunk/net/llc/llc_station.c @@ -249,7 +249,7 @@ static int llc_station_ac_inc_xid_r_cnt_by_1(struct sk_buff *skb) static int llc_station_ac_send_null_dsap_xid_c(struct sk_buff *skb) { int rc = 1; - struct sk_buff *nskb = llc_alloc_frame(); + struct sk_buff *nskb = llc_alloc_frame(skb->dev); if (!nskb) goto out; @@ -270,12 +270,11 @@ static int llc_station_ac_send_xid_r(struct sk_buff *skb) { u8 mac_da[ETH_ALEN], dsap; int rc = 1; - struct sk_buff* nskb = llc_alloc_frame(); + struct sk_buff* nskb = llc_alloc_frame(skb->dev); if (!nskb) goto out; rc = 0; - nskb->dev = skb->dev; llc_pdu_decode_sa(skb, mac_da); llc_pdu_decode_ssap(skb, &dsap); llc_pdu_header_init(nskb, LLC_PDU_TYPE_U, 0, dsap, LLC_PDU_RSP); @@ -295,12 +294,11 @@ static int llc_station_ac_send_test_r(struct sk_buff *skb) { u8 mac_da[ETH_ALEN], dsap; int rc = 1; - struct sk_buff *nskb = llc_alloc_frame(); + struct sk_buff *nskb = llc_alloc_frame(skb->dev); if (!nskb) goto out; rc = 0; - nskb->dev = skb->dev; llc_pdu_decode_sa(skb, mac_da); llc_pdu_decode_ssap(skb, &dsap); llc_pdu_header_init(nskb, LLC_PDU_TYPE_U, 0, dsap, LLC_PDU_RSP); diff --git a/trunk/net/packet/af_packet.c b/trunk/net/packet/af_packet.c index 6a67a87384cc..ee865d88183b 100644 --- a/trunk/net/packet/af_packet.c +++ b/trunk/net/packet/af_packet.c @@ -761,6 +761,12 @@ static int packet_sendmsg(struct kiocb *iocb, struct socket *sock, if (dev->hard_header) { int res; err = -EINVAL; + if (saddr) { + if (saddr->sll_halen != dev->addr_len) + goto out_free; + if (saddr->sll_hatype != dev->type) + goto out_free; + } res = dev->hard_header(skb, dev, ntohs(proto), addr, NULL, len); if (sock->type != SOCK_DGRAM) { skb->tail = skb->data; 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/net/socket.c b/trunk/net/socket.c index dbd1a6851edd..f9264472377f 100644 --- a/trunk/net/socket.c +++ b/trunk/net/socket.c @@ -1700,9 +1700,7 @@ asmlinkage long sys_sendmsg(int fd, struct msghdr __user *msg, unsigned flags) struct socket *sock; char address[MAX_SOCK_ADDR]; struct iovec iovstack[UIO_FASTIOV], *iov = iovstack; - unsigned char ctl[sizeof(struct cmsghdr) + 20] - __attribute__ ((aligned (sizeof(__kernel_size_t)))); - /* 20 is size of ipv6_pktinfo */ + unsigned char ctl[sizeof(struct cmsghdr) + 20]; /* 20 is size of ipv6_pktinfo */ unsigned char *ctl_buf = ctl; struct msghdr msg_sys; int err, ctl_len, iov_size, total_len; 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); }