···32413241S: Beaverton, Oregon 9700532423242S: USA3243324332443244-N: Marcelo W. Tosatti32453245-E: marcelo.tosatti@cyclades.com32463246-D: Miscellaneous kernel hacker32443244+N: Marcelo Tosatti32453245+E: marcelo@kvack.org32473246D: v2.4 kernel maintainer32483248-D: Current pc300/cyclades maintainer32493249-S: Cyclades Corporation32503250-S: Av Cristovao Colombo, 462. Floresta.32513251-S: Porto Alegre32523247S: Brazil3253324832543249N: Stefan Traby
-5
Documentation/devices.txt
···17211721 These devices support the same API as the generic SCSI17221722 devices.1723172317241724- 97 block Packet writing for CD/DVD devices17251725- 0 = /dev/pktcdvd0 First packet-writing module17261726- 1 = /dev/pktcdvd1 Second packet-writing module17271727- ...17281728-17291724 98 char Control and Measurement Device (comedi)17301725 0 = /dev/comedi0 First comedi device17311726 1 = /dev/comedi1 Second comedi device
+4-4
Documentation/dvb/get_dvb_firmware
···259259}260260261261sub nxt2002 {262262- my $sourcefile = "Broadband4PC_4_2_11.zip";262262+ my $sourcefile = "Technisat_DVB-PC_4_4_COMPACT.zip";263263 my $url = "http://www.bbti.us/download/windows/$sourcefile";264264- my $hash = "c6d2ea47a8f456d887ada0cfb718ff2a";264264+ my $hash = "476befae8c7c1bb9648954060b1eec1f";265265 my $outfile = "dvb-fe-nxt2002.fw";266266 my $tmpdir = tempdir(DIR => "/tmp", CLEANUP => 1);267267···269269270270 wgetfile($sourcefile, $url);271271 unzip($sourcefile, $tmpdir);272272- verify("$tmpdir/SkyNETU.sys", $hash);273273- extract("$tmpdir/SkyNETU.sys", 375832, 5908, $outfile);272272+ verify("$tmpdir/SkyNET.sys", $hash);273273+ extract("$tmpdir/SkyNET.sys", 331624, 5908, $outfile);274274275275 $outfile;276276}
+9
Documentation/feature-removal-schedule.txt
···57575858---------------------------59596060+What: sbp2: module parameter "force_inquiry_hack"6161+When: July 20066262+Why: Superceded by parameter "workarounds". Both parameters are meant to be6363+ used ad-hoc and for single devices only, i.e. not in modprobe.conf,6464+ therefore the impact of this feature replacement should be low.6565+Who: Stefan Richter <stefanr@s5r6.in-berlin.de>6666+6767+---------------------------6868+6069What: Video4Linux API 1 ioctls and video_decoder.h from Video devices.6170When: July 20066271Why: V4L1 AP1 was replaced by V4L2 API. during migration from 2.4 to 2.6
-17
Documentation/firmware_class/README
···105105 on the setup, so I think that the choice on what firmware to make106106 persistent should be left to userspace.107107108108- - Why register_firmware()+__init can be useful:109109- - For boot devices needing firmware.110110- - To make the transition easier:111111- The firmware can be declared __init and register_firmware()112112- called on module_init. Then the firmware is warranted to be113113- there even if "firmware hotplug userspace" is not there yet or114114- it doesn't yet provide the needed firmware.115115- Once the firmware is widely available in userspace, it can be116116- removed from the kernel. Or made optional (CONFIG_.*_FIRMWARE).117117-118118- In either case, if firmware hotplug support is there, it can move the119119- firmware out of kernel memory into the real filesystem for later120120- usage.121121-122122- Note: If persistence is implemented on top of initramfs,123123- register_firmware() may not be appropriate.124124-
···55 *66 * Sample code on how to use request_firmware() from drivers.77 *88- * Note that register_firmware() is currently useless.99- *108 */1191210#include <linux/module.h>···1416#include <linux/string.h>15171618#include "linux/firmware.h"1717-1818-#define WE_CAN_NEED_FIRMWARE_BEFORE_USERSPACE_IS_AVAILABLE1919-#ifdef WE_CAN_NEED_FIRMWARE_BEFORE_USERSPACE_IS_AVAILABLE2020-char __init inkernel_firmware[] = "let's say that this is firmware\n";2121-#endif22192320static struct device ghost_device = {2421 .bus_id = "ghost0",···9710498105static int sample_init(void)99106{100100-#ifdef WE_CAN_NEED_FIRMWARE_BEFORE_USERSPACE_IS_AVAILABLE101101- register_firmware("sample_driver_fw", inkernel_firmware,102102- sizeof(inkernel_firmware));103103-#endif104107 device_initialize(&ghost_device);105108 /* since there is no real hardware insertion I just call the106109 * sample probe functions here */
+2-2
Documentation/memory-barriers.txt
···10311031LOCKS VS MEMORY ACCESSES10321032------------------------1033103310341034-Consider the following: the system has a pair of spinlocks (N) and (Q), and10341034+Consider the following: the system has a pair of spinlocks (M) and (Q), and10351035three CPUs; then should the following sequence of events occur:1036103610371037 CPU 1 CPU 2···16781678 smp_wmb();16791679 <A:modify v=2> <C:busy>16801680 <C:queue v=2>16811681- p = &b; q = p;16811681+ p = &v; q = p;16821682 <D:request p>16831683 <B:modify p=&v> <D:commit p=&v>16841684 <D:read p>
+234
Documentation/spi/pxa2xx
···11+PXA2xx SPI on SSP driver HOWTO22+===================================================33+This a mini howto on the pxa2xx_spi driver. The driver turns a PXA2xx44+synchronous serial port into a SPI master controller55+(see Documentation/spi/spi_summary). The driver has the following features66+77+- Support for any PXA2xx SSP88+- SSP PIO and SSP DMA data transfers.99+- External and Internal (SSPFRM) chip selects.1010+- Per slave device (chip) configuration.1111+- Full suspend, freeze, resume support.1212+1313+The driver is built around a "spi_message" fifo serviced by workqueue and a1414+tasklet. The workqueue, "pump_messages", drives message fifo and the tasklet1515+(pump_transfer) is responsible for queuing SPI transactions and setting up and1616+launching the dma/interrupt driven transfers.1717+1818+Declaring PXA2xx Master Controllers1919+-----------------------------------2020+Typically a SPI master is defined in the arch/.../mach-*/board-*.c as a2121+"platform device". The master configuration is passed to the driver via a table2222+found in include/asm-arm/arch-pxa/pxa2xx_spi.h:2323+2424+struct pxa2xx_spi_master {2525+ enum pxa_ssp_type ssp_type;2626+ u32 clock_enable;2727+ u16 num_chipselect;2828+ u8 enable_dma;2929+};3030+3131+The "pxa2xx_spi_master.ssp_type" field must have a value between 1 and 3 and3232+informs the driver which features a particular SSP supports.3333+3434+The "pxa2xx_spi_master.clock_enable" field is used to enable/disable the3535+corresponding SSP peripheral block in the "Clock Enable Register (CKEN"). See3636+the "PXA2xx Developer Manual" section "Clocks and Power Management".3737+3838+The "pxa2xx_spi_master.num_chipselect" field is used to determine the number of3939+slave device (chips) attached to this SPI master.4040+4141+The "pxa2xx_spi_master.enable_dma" field informs the driver that SSP DMA should4242+be used. This caused the driver to acquire two DMA channels: rx_channel and4343+tx_channel. The rx_channel has a higher DMA service priority the tx_channel.4444+See the "PXA2xx Developer Manual" section "DMA Controller".4545+4646+NSSP MASTER SAMPLE4747+------------------4848+Below is a sample configuration using the PXA255 NSSP.4949+5050+static struct resource pxa_spi_nssp_resources[] = {5151+ [0] = {5252+ .start = __PREG(SSCR0_P(2)), /* Start address of NSSP */5353+ .end = __PREG(SSCR0_P(2)) + 0x2c, /* Range of registers */5454+ .flags = IORESOURCE_MEM,5555+ },5656+ [1] = {5757+ .start = IRQ_NSSP, /* NSSP IRQ */5858+ .end = IRQ_NSSP,5959+ .flags = IORESOURCE_IRQ,6060+ },6161+};6262+6363+static struct pxa2xx_spi_master pxa_nssp_master_info = {6464+ .ssp_type = PXA25x_NSSP, /* Type of SSP */6565+ .clock_enable = CKEN9_NSSP, /* NSSP Peripheral clock */6666+ .num_chipselect = 1, /* Matches the number of chips attached to NSSP */6767+ .enable_dma = 1, /* Enables NSSP DMA */6868+};6969+7070+static struct platform_device pxa_spi_nssp = {7171+ .name = "pxa2xx-spi", /* MUST BE THIS VALUE, so device match driver */7272+ .id = 2, /* Bus number, MUST MATCH SSP number 1..n */7373+ .resource = pxa_spi_nssp_resources,7474+ .num_resources = ARRAY_SIZE(pxa_spi_nssp_resources),7575+ .dev = {7676+ .platform_data = &pxa_nssp_master_info, /* Passed to driver */7777+ },7878+};7979+8080+static struct platform_device *devices[] __initdata = {8181+ &pxa_spi_nssp,8282+};8383+8484+static void __init board_init(void)8585+{8686+ (void)platform_add_device(devices, ARRAY_SIZE(devices));8787+}8888+8989+Declaring Slave Devices9090+-----------------------9191+Typically each SPI slave (chip) is defined in the arch/.../mach-*/board-*.c9292+using the "spi_board_info" structure found in "linux/spi/spi.h". See9393+"Documentation/spi/spi_summary" for additional information.9494+9595+Each slave device attached to the PXA must provide slave specific configuration9696+information via the structure "pxa2xx_spi_chip" found in9797+"include/asm-arm/arch-pxa/pxa2xx_spi.h". The pxa2xx_spi master controller driver9898+will uses the configuration whenever the driver communicates with the slave9999+device.100100+101101+struct pxa2xx_spi_chip {102102+ u8 tx_threshold;103103+ u8 rx_threshold;104104+ u8 dma_burst_size;105105+ u32 timeout_microsecs;106106+ u8 enable_loopback;107107+ void (*cs_control)(u32 command);108108+};109109+110110+The "pxa2xx_spi_chip.tx_threshold" and "pxa2xx_spi_chip.rx_threshold" fields are111111+used to configure the SSP hardware fifo. These fields are critical to the112112+performance of pxa2xx_spi driver and misconfiguration will result in rx113113+fifo overruns (especially in PIO mode transfers). Good default values are114114+115115+ .tx_threshold = 12,116116+ .rx_threshold = 4,117117+118118+The "pxa2xx_spi_chip.dma_burst_size" field is used to configure PXA2xx DMA119119+engine and is related the "spi_device.bits_per_word" field. Read and understand120120+the PXA2xx "Developer Manual" sections on the DMA controller and SSP Controllers121121+to determine the correct value. An SSP configured for byte-wide transfers would122122+use a value of 8.123123+124124+The "pxa2xx_spi_chip.timeout_microsecs" fields is used to efficiently handle125125+trailing bytes in the SSP receiver fifo. The correct value for this field is126126+dependent on the SPI bus speed ("spi_board_info.max_speed_hz") and the specific127127+slave device. Please note the the PXA2xx SSP 1 does not support trailing byte128128+timeouts and must busy-wait any trailing bytes.129129+130130+The "pxa2xx_spi_chip.enable_loopback" field is used to place the SSP porting131131+into internal loopback mode. In this mode the SSP controller internally132132+connects the SSPTX pin the the SSPRX pin. This is useful for initial setup133133+testing.134134+135135+The "pxa2xx_spi_chip.cs_control" field is used to point to a board specific136136+function for asserting/deasserting a slave device chip select. If the field is137137+NULL, the pxa2xx_spi master controller driver assumes that the SSP port is138138+configured to use SSPFRM instead.139139+140140+NSSP SALVE SAMPLE141141+-----------------142142+The pxa2xx_spi_chip structure is passed to the pxa2xx_spi driver in the143143+"spi_board_info.controller_data" field. Below is a sample configuration using144144+the PXA255 NSSP.145145+146146+/* Chip Select control for the CS8415A SPI slave device */147147+static void cs8415a_cs_control(u32 command)148148+{149149+ if (command & PXA2XX_CS_ASSERT)150150+ GPCR(2) = GPIO_bit(2);151151+ else152152+ GPSR(2) = GPIO_bit(2);153153+}154154+155155+/* Chip Select control for the CS8405A SPI slave device */156156+static void cs8405a_cs_control(u32 command)157157+{158158+ if (command & PXA2XX_CS_ASSERT)159159+ GPCR(3) = GPIO_bit(3);160160+ else161161+ GPSR(3) = GPIO_bit(3);162162+}163163+164164+static struct pxa2xx_spi_chip cs8415a_chip_info = {165165+ .tx_threshold = 12, /* SSP hardward FIFO threshold */166166+ .rx_threshold = 4, /* SSP hardward FIFO threshold */167167+ .dma_burst_size = 8, /* Byte wide transfers used so 8 byte bursts */168168+ .timeout_microsecs = 64, /* Wait at least 64usec to handle trailing */169169+ .cs_control = cs8415a_cs_control, /* Use external chip select */170170+};171171+172172+static struct pxa2xx_spi_chip cs8405a_chip_info = {173173+ .tx_threshold = 12, /* SSP hardward FIFO threshold */174174+ .rx_threshold = 4, /* SSP hardward FIFO threshold */175175+ .dma_burst_size = 8, /* Byte wide transfers used so 8 byte bursts */176176+ .timeout_microsecs = 64, /* Wait at least 64usec to handle trailing */177177+ .cs_control = cs8405a_cs_control, /* Use external chip select */178178+};179179+180180+static struct spi_board_info streetracer_spi_board_info[] __initdata = {181181+ {182182+ .modalias = "cs8415a", /* Name of spi_driver for this device */183183+ .max_speed_hz = 3686400, /* Run SSP as fast a possbile */184184+ .bus_num = 2, /* Framework bus number */185185+ .chip_select = 0, /* Framework chip select */186186+ .platform_data = NULL; /* No spi_driver specific config */187187+ .controller_data = &cs8415a_chip_info, /* Master chip config */188188+ .irq = STREETRACER_APCI_IRQ, /* Slave device interrupt */189189+ },190190+ {191191+ .modalias = "cs8405a", /* Name of spi_driver for this device */192192+ .max_speed_hz = 3686400, /* Run SSP as fast a possbile */193193+ .bus_num = 2, /* Framework bus number */194194+ .chip_select = 1, /* Framework chip select */195195+ .controller_data = &cs8405a_chip_info, /* Master chip config */196196+ .irq = STREETRACER_APCI_IRQ, /* Slave device interrupt */197197+ },198198+};199199+200200+static void __init streetracer_init(void)201201+{202202+ spi_register_board_info(streetracer_spi_board_info,203203+ ARRAY_SIZE(streetracer_spi_board_info));204204+}205205+206206+207207+DMA and PIO I/O Support208208+-----------------------209209+The pxa2xx_spi driver support both DMA and interrupt driven PIO message210210+transfers. The driver defaults to PIO mode and DMA transfers must enabled by211211+setting the "enable_dma" flag in the "pxa2xx_spi_master" structure and and212212+ensuring that the "pxa2xx_spi_chip.dma_burst_size" field is non-zero. The DMA213213+mode support both coherent and stream based DMA mappings.214214+215215+The following logic is used to determine the type of I/O to be used on216216+a per "spi_transfer" basis:217217+218218+if !enable_dma or dma_burst_size == 0 then219219+ always use PIO transfers220220+221221+if spi_message.is_dma_mapped and rx_dma_buf != 0 and tx_dma_buf != 0 then222222+ use coherent DMA mode223223+224224+if rx_buf and tx_buf are aligned on 8 byte boundary then225225+ use streaming DMA mode226226+227227+otherwise228228+ use PIO transfer229229+230230+THANKS TO231231+---------232232+233233+David Brownell and others for mentoring the development of this driver.234234+
+33-1
Documentation/spi/spi-summary
···414414The driver will initialize the fields of that spi_master, including the415415bus number (maybe the same as the platform device ID) and three methods416416used to interact with the SPI core and SPI protocol drivers. It will417417-also initialize its own internal state.417417+also initialize its own internal state. (See below about bus numbering418418+and those methods.)419419+420420+After you initialize the spi_master, then use spi_register_master() to421421+publish it to the rest of the system. At that time, device nodes for422422+the controller and any predeclared spi devices will be made available,423423+and the driver model core will take care of binding them to drivers.424424+425425+If you need to remove your SPI controller driver, spi_unregister_master()426426+will reverse the effect of spi_register_master().427427+428428+429429+BUS NUMBERING430430+431431+Bus numbering is important, since that's how Linux identifies a given432432+SPI bus (shared SCK, MOSI, MISO). Valid bus numbers start at zero. On433433+SOC systems, the bus numbers should match the numbers defined by the chip434434+manufacturer. For example, hardware controller SPI2 would be bus number 2,435435+and spi_board_info for devices connected to it would use that number.436436+437437+If you don't have such hardware-assigned bus number, and for some reason438438+you can't just assign them, then provide a negative bus number. That will439439+then be replaced by a dynamically assigned number. You'd then need to treat440440+this as a non-static configuration (see above).441441+442442+443443+SPI MASTER METHODS418444419445 master->setup(struct spi_device *spi)420446 This sets up the device clock rate, SPI mode, and word sizes.···457431 state it dynamically associates with that device. If you do that,458432 be sure to provide the cleanup() method to free that state.459433434434+435435+SPI MESSAGE QUEUE436436+460437The bulk of the driver will be managing the I/O queue fed by transfer().461438462439That queue could be purely conceptual. For example, a driver used only···469440often DMA (especially if the root filesystem is in SPI flash), and470441execution contexts like IRQ handlers, tasklets, or workqueues (such471442as keventd). Your driver can be as fancy, or as simple, as you need.443443+Such a transfer() method would normally just add the message to a444444+queue, and then start some asynchronous transfer engine (unless it's445445+already running).472446473447474448THANKS TO
+3
Documentation/watchdog/watchdog-api.txt
···3636some data to the device. So a very simple watchdog daemon would look3737like this:38383939+#include <stdlib.h>4040+#include <fcntl.h>4141+3942int main(int argc, const char *argv[]) {4043 int fd=open("/dev/watchdog",O_WRONLY);4144 if (fd==-1) {
+39-3
MAINTAINERS
···4040 PLEASE document known bugs. If it doesn't work for everything4141 or does something very odd once a month document it.42424343+ PLEASE remember that submissions must be made under the terms4444+ of the OSDL certificate of contribution4545+ (http://www.osdl.org/newsroom/press_releases/2004/2004_05_24_dco.html)4646+ and should include a Signed-off-by: line.4747+43486. Make sure you have the right to send any changes you make. If you4449 do changes at work you may find your employer owns the patch4550 not you.46514747-7. Happy hacking.5252+7. When sending security related changes or reports to a maintainer5353+ please Cc: security@kernel.org, especially if the maintainer5454+ does not respond.5555+5656+8. Happy hacking.48574958 -----------------------------------5059···988979EXT3 FILE SYSTEM989980P: Stephen Tweedie, Andrew Morton990981M: sct@redhat.com, akpm@osdl.org, adilger@clusterfs.com991991-L: ext3-users@redhat.com982982+L: ext2-devel@lists.sourceforge.net992983S: Maintained993984994985F71805F HARDWARE MONITORING DRIVER···15571548T: git kernel.org:/pub/scm/linux/kernel/git/shaggy/jfs-2.6.git15581549S: Supported1559155015511551+JOURNALLING LAYER FOR BLOCK DEVICS (JBD)15521552+P: Stephen Tweedie, Andrew Morton15531553+M: sct@redhat.com, akpm@osdl.org15541554+L: ext2-devel@lists.sourceforge.net15551555+S: Maintained15561556+15601557KCONFIG15611558P: Roman Zippel15621559M: zippel@linux-m68k.org15631560L: kbuild-devel@lists.sourceforge.net15611561+S: Maintained15621562+15631563+KDUMP15641564+P: Vivek Goyal15651565+M: vgoyal@in.ibm.com15661566+P: Haren Myneni15671567+M: hbabu@us.ibm.com15681568+L: fastboot@lists.osdl.org15691569+L: linux-kernel@vger.kernel.org15701570+W: http://lse.sourceforge.net/kdump/15641571S: Maintained1565157215661573KERNEL AUTOMOUNTER (AUTOFS)···16461621L: linux-scsi@vger.kernel.org16471622S: Maintained1648162316241624+LED SUBSYSTEM16251625+P: Richard Purdie16261626+M: rpurdie@rpsys.net16271627+S: Maintained16281628+16491629LEGO USB Tower driver16501630P: Juergen Stuber16511631M: starblue@users.sourceforge.net···1710168017111681LINUX FOR POWERPC EMBEDDED PPC8XX17121682P: Marcelo Tosatti17131713-M: marcelo.tosatti@cyclades.com16831683+M: marcelo@kvack.org17141684W: http://www.penguinppc.org/17151685L: linuxppc-embedded@ozlabs.org17161686S: Maintained···25592529P: Jaroslav Kysela25602530M: perex@suse.cz25612531L: alsa-devel@alsa-project.org25322532+S: Maintained25332533+25342534+SPI SUBSYSTEM25352535+P: David Brownell25362536+M: dbrownell@users.sourceforge.net25372537+L: spi-devel-general@lists.sourceforge.net25622538S: Maintained2563253925642540TPM DEVICE DRIVER
+2-2
Makefile
···11VERSION = 222PATCHLEVEL = 633SUBLEVEL = 1744-EXTRAVERSION =-rc455-NAME=Sliding Snow Leopard44+EXTRAVERSION =-rc555+NAME=Lordi Rules6677# *DOCUMENTATION*88# To see a list of typical targets execute "make help"
···758758 bool "Support for hot-pluggable CPUs (EXPERIMENTAL)"759759 depends on SMP && HOTPLUG && EXPERIMENTAL && !X86_VOYAGER760760 ---help---761761- Say Y here to experiment with turning CPUs off and on. CPUs762762- can be controlled through /sys/devices/system/cpu.761761+ Say Y here to experiment with turning CPUs off and on, and to762762+ enable suspend on SMP systems. CPUs can be controlled through763763+ /sys/devices/system/cpu.763764764764- Say N.765765766766endmenu767767
···1341134113421342 connect_bsp_APIC();1343134313441344+ /*13451345+ * Hack: In case of kdump, after a crash, kernel might be booting13461346+ * on a cpu with non-zero lapic id. But boot_cpu_physical_apicid13471347+ * might be zero if read from MP tables. Get it from LAPIC.13481348+ */13491349+#ifdef CONFIG_CRASH_DUMP13501350+ boot_cpu_physical_apicid = GET_APIC_ID(apic_read(APIC_ID));13511351+#endif13441352 phys_cpu_present_map = physid_mask_of_physid(boot_cpu_physical_apicid);1345135313461354 setup_local_APIC();
+2
arch/i386/kernel/setup.c
···13201320 probe_roms();13211321 for (i = 0; i < e820.nr_map; i++) {13221322 struct resource *res;13231323+ if (e820.map[i].addr + e820.map[i].size > 0x100000000ULL)13241324+ continue;13231325 res = kzalloc(sizeof(struct resource), GFP_ATOMIC);13241326 switch (e820.map[i].type) {13251327 case E820_RAM: res->name = "System RAM"; break;
···651651 * Specifically, in the case of x86, we will always add652652 * memory to the highmem for now.653653 */654654-#ifdef CONFIG_HOTPLUG_MEMORY654654+#ifdef CONFIG_MEMORY_HOTPLUG655655#ifndef CONFIG_NEED_MULTIPLE_NODES656656int add_memory(u64 start, u64 size)657657{
+4-3
arch/i386/oprofile/nmi_int.c
···332332{333333 __u8 cpu_model = boot_cpu_data.x86_model;334334335335- if (cpu_model > 0xd)335335+ if (cpu_model == 14)336336+ *cpu_type = "i386/core";337337+ else if (cpu_model > 0xd)336338 return 0;337337-338338- if (cpu_model == 9) {339339+ else if (cpu_model == 9) {339340 *cpu_type = "i386/p6_mobile";340341 } else if (cpu_model > 5) {341342 *cpu_type = "i386/piii";
+1-1
arch/i386/power/cpu.c
···9292 write_cr4(ctxt->cr4);9393 write_cr3(ctxt->cr3);9494 write_cr2(ctxt->cr2);9595- write_cr2(ctxt->cr0);9595+ write_cr0(ctxt->cr0);96969797 /*9898 * now restore the descriptor tables to their proper values
+2-2
arch/ia64/configs/sn2_defconfig
···134134CONFIG_ARCH_SPARSEMEM_ENABLE=y135135CONFIG_ARCH_DISCONTIGMEM_DEFAULT=y136136CONFIG_NUMA=y137137-CONFIG_NODES_SHIFT=8137137+CONFIG_NODES_SHIFT=10138138CONFIG_VIRTUAL_MEM_MAP=y139139CONFIG_HOLES_IN_ZONE=y140140CONFIG_HAVE_ARCH_EARLY_PFN_TO_NID=y···11591159# CONFIG_SCHEDSTATS is not set11601160# CONFIG_DEBUG_SLAB is not set11611161CONFIG_DEBUG_PREEMPT=y11621162-CONFIG_DEBUG_MUTEXES=y11621162+# CONFIG_DEBUG_MUTEXES is not set11631163# CONFIG_DEBUG_SPINLOCK is not set11641164# CONFIG_DEBUG_SPINLOCK_SLEEP is not set11651165# CONFIG_DEBUG_KOBJECT is not set
+2-2
arch/ia64/kernel/iosapic.c
···416416 ia64_vector vec = irq_to_vector(irq);417417 struct iosapic_rte_info *rte;418418419419- move_irq(irq);419419+ move_native_irq(irq);420420 list_for_each_entry(rte, &iosapic_intr_info[vec].rtes, rte_list)421421 iosapic_eoi(rte->addr, vec);422422}···458458{459459 irq_desc_t *idesc = irq_descp(irq);460460461461- move_irq(irq);461461+ move_native_irq(irq);462462 /*463463 * Once we have recorded IRQ_PENDING already, we can mask the464464 * interrupt for real. This prevents IRQ storms from unhandled
···16361636 compat, sizeof(compat)-1);16371637 if (len <= 0)16381638 return PLATFORM_GENERIC;16391639- if (strncmp(compat, RELOC("chrp"), 4))16391639+ if (strcmp(compat, RELOC("chrp")))16401640 return PLATFORM_GENERIC;1641164116421642 /* Default to pSeries. We need to know if we are running LPAR */
+2
arch/powerpc/kernel/systbl.S
···338338SYSCALL(readlinkat)339339SYSCALL(fchmodat)340340SYSCALL(faccessat)341341+COMPAT_SYS(get_robust_list)342342+COMPAT_SYS(set_robust_list)341343342344/*343345 * please add new calls to arch/powerpc/platforms/cell/spu_callbacks.c
···255255{256256 /* Manually leave the kernel version on the panel. */257257 ppc_md.progress("Linux ppc64\n", 0);258258- ppc_md.progress(system_utsname.version, 0);258258+ ppc_md.progress(system_utsname.release, 0);259259260260 return 0;261261}
···249249 unsigned long flags;250250 unsigned long seq, next;251251 __u64 timer, todval;252252+ int cpu = smp_processor_id();252253253254 if (sysctl_hz_timer != 0)254255 return;255256256256- cpu_set(smp_processor_id(), nohz_cpu_mask);257257+ cpu_set(cpu, nohz_cpu_mask);257258258259 /*259260 * Leave the clock comparator set up for the next timer260261 * tick if either rcu or a softirq is pending.261262 */262262- if (rcu_pending(smp_processor_id()) || local_softirq_pending()) {263263- cpu_clear(smp_processor_id(), nohz_cpu_mask);263263+ if (rcu_needs_cpu(cpu) || local_softirq_pending()) {264264+ cpu_clear(cpu, nohz_cpu_mask);264265 return;265266 }266267···272271 next = next_timer_interrupt();273272 do {274273 seq = read_seqbegin_irqsave(&xtime_lock, flags);275275- timer = (__u64)(next - jiffies) + jiffies_64;274274+ timer = (__u64 next) - (__u64 jiffies) + jiffies_64;276275 } while (read_seqretry_irqrestore(&xtime_lock, seq, flags));277276 todval = -1ULL;278277 /* Be careful about overflows. */
+5
arch/sparc/kernel/ioport.c
···274274 if (mmu_map_dma_area(dma_addrp, va, res->start, len_total) != 0)275275 goto err_noiommu;276276277277+ /* Set the resource name, if known. */278278+ if (sdev) {279279+ res->name = sdev->prom_name;280280+ }281281+277282 return (void *)res->start;278283279284err_noiommu:
+1
arch/sparc/kernel/module.c
···113113114114 switch (ELF32_R_TYPE(rel[i].r_info)) {115115 case R_SPARC_32:116116+ case R_SPARC_UA32:116117 location[0] = v >> 24;117118 location[1] = v >> 16;118119 location[2] = v >> 8;
-13
arch/sparc/kernel/sparc_ksyms.c
···251251EXPORT_SYMBOL(__prom_getsibling);252252253253/* sparc library symbols */254254-EXPORT_SYMBOL(memchr);255254EXPORT_SYMBOL(memscan);256255EXPORT_SYMBOL(strlen);257257-EXPORT_SYMBOL(strnlen);258258-EXPORT_SYMBOL(strcpy);259259-EXPORT_SYMBOL(strncpy);260260-EXPORT_SYMBOL(strcat);261261-EXPORT_SYMBOL(strncat);262262-EXPORT_SYMBOL(strcmp);263256EXPORT_SYMBOL(strncmp);264264-EXPORT_SYMBOL(strchr);265265-EXPORT_SYMBOL(strrchr);266266-EXPORT_SYMBOL(strstr);267257EXPORT_SYMBOL(page_kernel);268258269259/* Special internal versions of library functions. */···307317308318/* Sun Power Management Idle Handler */309319EXPORT_SYMBOL(pm_idle);310310-311311-/* Binfmt_misc needs this */312312-EXPORT_SYMBOL(sys_close);
···11#22# Automatically generated make config: don't edit33-# Linux kernel version: 2.6.1644-# Sun Apr 2 19:31:04 200633+# Linux kernel version: 2.6.17-rc344+# Fri May 12 12:43:49 200655#66CONFIG_SPARC=y77CONFIG_SPARC64=y···114114CONFIG_HUGETLB_PAGE_SIZE_4MB=y115115# CONFIG_HUGETLB_PAGE_SIZE_512K is not set116116# CONFIG_HUGETLB_PAGE_SIZE_64K is not set117117+CONFIG_ARCH_SELECT_MEMORY_MODEL=y117118CONFIG_ARCH_SPARSEMEM_ENABLE=y118119CONFIG_ARCH_SPARSEMEM_DEFAULT=y119120CONFIG_LARGE_ALLOCS=y···431430# CONFIG_SCSI_INIA100 is not set432431# CONFIG_SCSI_SYM53C8XX_2 is not set433432# CONFIG_SCSI_IPR is not set434434-# CONFIG_SCSI_QLOGIC_FC is not set435433# CONFIG_SCSI_QLOGIC_1280 is not set436434# CONFIG_SCSI_QLOGICPTI is not set437435# CONFIG_SCSI_QLA_FC is not set···10421042# CONFIG_USB_ACECAD is not set10431043# CONFIG_USB_KBTAB is not set10441044# CONFIG_USB_POWERMATE is not set10451045-# CONFIG_USB_MTOUCH is not set10461046-# CONFIG_USB_ITMTOUCH is not set10471047-# CONFIG_USB_EGALAX is not set10451045+# CONFIG_USB_TOUCHSCREEN is not set10481046# CONFIG_USB_YEALINK is not set10491047# CONFIG_USB_XPAD is not set10501048# CONFIG_USB_ATI_REMOTE is not set···11111113# LED devices11121114#11131115# CONFIG_NEW_LEDS is not set11161116+11171117+#11181118+# LED drivers11191119+#11201120+11211121+#11221122+# LED Triggers11231123+#1114112411151125#11161126# InfiniBand support···13091303# CONFIG_DEBUG_INFO is not set13101304CONFIG_DEBUG_FS=y13111305# CONFIG_DEBUG_VM is not set13061306+# CONFIG_UNWIND_INFO is not set13121307CONFIG_FORCED_INLINING=y13131308# CONFIG_RCU_TORTURE_TEST is not set13141309# CONFIG_DEBUG_STACK_USAGE is not set
+5
arch/sparc64/kernel/module.c
···143143 location[3] = v >> 0;144144 break;145145146146+ case R_SPARC_DISP32:147147+ v -= (Elf64_Addr) location;148148+ *loc32 = v;149149+ break;150150+146151 case R_SPARC_WDISP30:147152 v -= (Elf64_Addr) location;148153 *loc32 = (*loc32 & ~0x3fffffff) |
+2-2
arch/sparc64/kernel/pci_iommu.c
···218218 * DMA for PCI device PDEV. Return non-NULL cpu-side address if219219 * successful and set *DMA_ADDRP to the PCI side dma address.220220 */221221-static void *pci_4u_alloc_consistent(struct pci_dev *pdev, size_t size, dma_addr_t *dma_addrp)221221+static void *pci_4u_alloc_consistent(struct pci_dev *pdev, size_t size, dma_addr_t *dma_addrp, gfp_t gfp)222222{223223 struct pcidev_cookie *pcp;224224 struct pci_iommu *iommu;···232232 if (order >= 10)233233 return NULL;234234235235- first_page = __get_free_pages(GFP_ATOMIC, order);235235+ first_page = __get_free_pages(gfp, order);236236 if (first_page == 0UL)237237 return NULL;238238 memset((char *)first_page, 0, PAGE_SIZE << order);
···102102{103103 if (regs->eflags & X86_EFLAGS_IF)104104 local_irq_disable();105105+ /* Make sure to not schedule here because we could be running106106+ on an exception stack. */105107 preempt_enable_no_resched();106108}107109···485483{486484 struct task_struct *tsk = current;487485488488- conditional_sti(regs);489489-490486 tsk->thread.error_code = error_code;491487 tsk->thread.trap_no = trapnr;492488···521521 if (notify_die(DIE_TRAP, str, regs, error_code, trapnr, signr) \522522 == NOTIFY_STOP) \523523 return; \524524+ conditional_sti(regs); \524525 do_trap(trapnr, signr, str, regs, error_code, NULL); \525526}526527···536535 if (notify_die(DIE_TRAP, str, regs, error_code, trapnr, signr) \537536 == NOTIFY_STOP) \538537 return; \538538+ conditional_sti(regs); \539539 do_trap(trapnr, signr, str, regs, error_code, &info); \540540}541541···550548DO_ERROR(11, SIGBUS, "segment not present", segment_not_present)551549DO_ERROR_INFO(17, SIGBUS, "alignment check", alignment_check, BUS_ADRALN, 0)552550DO_ERROR(18, SIGSEGV, "reserved", reserved)553553-DO_ERROR(12, SIGBUS, "stack segment", stack_segment)551551+552552+/* Runs on IST stack */553553+asmlinkage void do_stack_segment(struct pt_regs *regs, long error_code)554554+{555555+ if (notify_die(DIE_TRAP, "stack segment", regs, error_code,556556+ 12, SIGBUS) == NOTIFY_STOP)557557+ return;558558+ preempt_conditional_sti(regs);559559+ do_trap(12, SIGBUS, "stack segment", regs, error_code, NULL);560560+ preempt_conditional_cli(regs);561561+}554562555563asmlinkage void do_double_fault(struct pt_regs * regs, long error_code)556564{···694682 if (notify_die(DIE_INT3, "int3", regs, error_code, 3, SIGTRAP) == NOTIFY_STOP) {695683 return;696684 }685685+ preempt_conditional_sti(regs);697686 do_trap(3, SIGTRAP, "int3", regs, error_code, NULL);698698- return;687687+ preempt_conditional_cli(regs);699688}700689701690/* Help handler running on IST stack to switch back to user stack
+11-4
arch/x86_64/mm/srat.c
···3434static struct bootnode nodes[MAX_NUMNODES] __initdata;3535static struct bootnode nodes_add[MAX_NUMNODES] __initdata;3636static int found_add_area __initdata;3737-int hotadd_percent __initdata = 10;3737+int hotadd_percent __initdata = 0;3838+#ifndef RESERVE_HOTADD3939+#define hotadd_percent 0 /* Ignore all settings */4040+#endif3841static u8 pxm2node[256] = { [0 ... 255] = 0xff };39424043/* Too small nodes confuse the VM badly. Usually they result···106103 int i;107104 printk(KERN_ERR "SRAT: SRAT not used.\n");108105 acpi_numa = -1;106106+ found_add_area = 0;109107 for (i = 0; i < MAX_LOCAL_APIC; i++)110108 apicid_to_node[i] = NUMA_NO_NODE;111109 for (i = 0; i < MAX_NUMNODES; i++)···158154 int pxm, node;159155 if (srat_disabled())160156 return;161161- if (pa->header.length != sizeof(struct acpi_table_processor_affinity)) { bad_srat();157157+ if (pa->header.length != sizeof(struct acpi_table_processor_affinity)) {158158+ bad_srat();162159 return;163160 }164161 if (pa->flags.enabled == 0)···196191 allowed = (end_pfn - e820_hole_size(0, end_pfn)) * PAGE_SIZE;197192 allowed = (allowed / 100) * hotadd_percent;198193 if (allocated + mem > allowed) {194194+ unsigned long range;199195 /* Give them at least part of their hotadd memory upto hotadd_percent200196 It would be better to spread the limit out201197 over multiple hotplug areas, but that is too complicated202198 right now */203199 if (allocated >= allowed)204200 return 0;205205- pages = (allowed - allocated + mem) / sizeof(struct page);201201+ range = allowed - allocated;202202+ pages = (range / PAGE_SIZE);206203 mem = pages * sizeof(struct page);207207- nd->end = nd->start + pages*PAGE_SIZE;204204+ nd->end = nd->start + range;208205 }209206 /* Not completely fool proof, but a good sanity check */210207 addr = find_e820_area(last_area_end, end_pfn<<PAGE_SHIFT, mem);
···34523452 if (unlikely(laptop_mode) && blk_fs_request(req))34533453 laptop_io_completion();3454345434553455- if (disk && blk_fs_request(req)) {34553455+ /*34563456+ * Account IO completion. bar_rq isn't accounted as a normal34573457+ * IO on queueing nor completion. Accounting the containing34583458+ * request is enough.34593459+ */34603460+ if (disk && blk_fs_request(req) && req != &req->q->bar_rq) {34563461 unsigned long duration = jiffies - req->start_time;34573462 const int rw = rq_data_dir(req);34583463
+8-31
drivers/base/firmware_class.c
···8686static CLASS_ATTR(timeout, 0644, firmware_timeout_show, firmware_timeout_store);87878888static void fw_class_dev_release(struct class_device *class_dev);8989-int firmware_class_uevent(struct class_device *dev, char **envp,9090- int num_envp, char *buffer, int buffer_size);91899292-static struct class firmware_class = {9393- .name = "firmware",9494- .uevent = firmware_class_uevent,9595- .release = fw_class_dev_release,9696-};9797-9898-int9999-firmware_class_uevent(struct class_device *class_dev, char **envp,100100- int num_envp, char *buffer, int buffer_size)9090+static int firmware_class_uevent(struct class_device *class_dev, char **envp,9191+ int num_envp, char *buffer, int buffer_size)10192{10293 struct firmware_priv *fw_priv = class_get_devdata(class_dev);10394 int i = 0, len = 0;···106115107116 return 0;108117}118118+119119+static struct class firmware_class = {120120+ .name = "firmware",121121+ .uevent = firmware_class_uevent,122122+ .release = fw_class_dev_release,123123+};109124110125static ssize_t111126firmware_loading_show(struct class_device *class_dev, char *buf)···490493 }491494}492495493493-/**494494- * register_firmware: - provide a firmware image for later usage495495- * @name: name of firmware image file496496- * @data: buffer pointer for the firmware image497497- * @size: size of the data buffer area498498- *499499- * Make sure that @data will be available by requesting firmware @name.500500- *501501- * Note: This will not be possible until some kind of persistence502502- * is available.503503- **/504504-void505505-register_firmware(const char *name, const u8 *data, size_t size)506506-{507507- /* This is meaningless without firmware caching, so until we508508- * decide if firmware caching is reasonable just leave it as a509509- * noop */510510-}511511-512496/* Async support */513497struct firmware_work {514498 struct work_struct work;···608630EXPORT_SYMBOL(release_firmware);609631EXPORT_SYMBOL(request_firmware);610632EXPORT_SYMBOL(request_firmware_nowait);611611-EXPORT_SYMBOL(register_firmware);
+10-8
drivers/block/ub.c
···536536 kfree(lun);537537 }538538539539+ usb_set_intfdata(sc->intf, NULL);540540+ usb_put_intf(sc->intf);541541+ usb_put_dev(sc->dev);539542 kfree(sc);540543}541544···22242221 // sc->ifnum = intf->cur_altsetting->desc.bInterfaceNumber;22252222 usb_set_intfdata(intf, sc);22262223 usb_get_dev(sc->dev);22272227- // usb_get_intf(sc->intf); /* Do we need this? */22242224+ /*22252225+ * Since we give the interface struct to the block level through22262226+ * disk->driverfs_dev, we have to pin it. Otherwise, block_uevent22272227+ * oopses on close after a disconnect (kernels 2.6.16 and up).22282228+ */22292229+ usb_get_intf(sc->intf);2228223022292231 snprintf(sc->name, 12, DRV_NAME "(%d.%d)",22302232 sc->dev->bus->busnum, sc->dev->devnum);···2294228622952287err_dev_desc:22962288 usb_set_intfdata(intf, NULL);22972297- // usb_put_intf(sc->intf);22892289+ usb_put_intf(sc->intf);22982290 usb_put_dev(sc->dev);22992291 kfree(sc);23002292err_core:···24682460 * At this point there must be no commands coming from anyone24692461 * and no URBs left in transit.24702462 */24712471-24722472- usb_set_intfdata(intf, NULL);24732473- // usb_put_intf(sc->intf);24742474- sc->intf = NULL;24752475- usb_put_dev(sc->dev);24762476- sc->dev = NULL;2477246324782464 ub_put(sc);24792465}
+1-1
drivers/char/Kconfig
···291291292292config RIO293293 tristate "Specialix RIO system support"294294- depends on SERIAL_NONSTANDARD && !64BIT294294+ depends on SERIAL_NONSTANDARD295295 help296296 This is a driver for the Specialix RIO, a smart serial card which297297 drives an outboard box that can support up to 128 ports. Product
-9
drivers/char/rio/host.h
···3333#ifndef __rio_host_h__3434#define __rio_host_h__35353636-#ifdef SCCS_LABELS3737-#ifndef lint3838-static char *_host_h_sccs_ = "@(#)host.h 1.2";3939-#endif4040-#endif4141-4236/*4337** the host structure - one per host card in the system.4438*/···7177#define RC_STARTUP 17278#define RC_RUNNING 27379#define RC_STUFFED 37474-#define RC_SOMETHING 47575-#define RC_SOMETHING_NEW 57676-#define RC_SOMETHING_ELSE 67780#define RC_READY 77881#define RUN_STATE 77982/*
···13941394 return RIO_FAIL;13951395 }1396139613971397- if (((int) ((char) PortP->InUse) == -1) || !(CmdBlkP = RIOGetCmdBlk())) {13981398- rio_dprintk(RIO_DEBUG_CTRL, "Cannot allocate command block for command %d on port %d\n", Cmd, PortP->PortNum);13971397+ if ((PortP->InUse == (typeof(PortP->InUse))-1) ||13981398+ !(CmdBlkP = RIOGetCmdBlk())) {13991399+ rio_dprintk(RIO_DEBUG_CTRL, "Cannot allocate command block "14001400+ "for command %d on port %d\n", Cmd, PortP->PortNum);13991401 return RIO_FAIL;14001402 }1401140314021402- rio_dprintk(RIO_DEBUG_CTRL, "Command blk %p - InUse now %d\n", CmdBlkP, PortP->InUse);14041404+ rio_dprintk(RIO_DEBUG_CTRL, "Command blk %p - InUse now %d\n",14051405+ CmdBlkP, PortP->InUse);1403140614041404- PktCmdP = (struct PktCmd_M *) &CmdBlkP->Packet.data[0];14071407+ PktCmdP = (struct PktCmd_M *)&CmdBlkP->Packet.data[0];1405140814061409 CmdBlkP->Packet.src_unit = 0;14071410 if (PortP->SecondBlock)···1428142514291426 switch (Cmd) {14301427 case MEMDUMP:14311431- rio_dprintk(RIO_DEBUG_CTRL, "Queue MEMDUMP command blk %p (addr 0x%x)\n", CmdBlkP, (int) SubCmd.Addr);14281428+ rio_dprintk(RIO_DEBUG_CTRL, "Queue MEMDUMP command blk %p "14291429+ "(addr 0x%x)\n", CmdBlkP, (int) SubCmd.Addr);14321430 PktCmdP->SubCommand = MEMDUMP;14331431 PktCmdP->SubAddr = SubCmd.Addr;14341432 break;14351433 case FCLOSE:14361436- rio_dprintk(RIO_DEBUG_CTRL, "Queue FCLOSE command blk %p\n", CmdBlkP);14341434+ rio_dprintk(RIO_DEBUG_CTRL, "Queue FCLOSE command blk %p\n",14351435+ CmdBlkP);14371436 break;14381437 case READ_REGISTER:14391439- rio_dprintk(RIO_DEBUG_CTRL, "Queue READ_REGISTER (0x%x) command blk %p\n", (int) SubCmd.Addr, CmdBlkP);14381438+ rio_dprintk(RIO_DEBUG_CTRL, "Queue READ_REGISTER (0x%x) "14391439+ "command blk %p\n", (int) SubCmd.Addr, CmdBlkP);14401440 PktCmdP->SubCommand = READ_REGISTER;14411441 PktCmdP->SubAddr = SubCmd.Addr;14421442 break;14431443 case RESUME:14441444- rio_dprintk(RIO_DEBUG_CTRL, "Queue RESUME command blk %p\n", CmdBlkP);14441444+ rio_dprintk(RIO_DEBUG_CTRL, "Queue RESUME command blk %p\n",14451445+ CmdBlkP);14451446 break;14461447 case RFLUSH:14471447- rio_dprintk(RIO_DEBUG_CTRL, "Queue RFLUSH command blk %p\n", CmdBlkP);14481448+ rio_dprintk(RIO_DEBUG_CTRL, "Queue RFLUSH command blk %p\n",14491449+ CmdBlkP);14481450 CmdBlkP->PostFuncP = RIORFlushEnable;14491451 break;14501452 case SUSPEND:14511451- rio_dprintk(RIO_DEBUG_CTRL, "Queue SUSPEND command blk %p\n", CmdBlkP);14531453+ rio_dprintk(RIO_DEBUG_CTRL, "Queue SUSPEND command blk %p\n",14541454+ CmdBlkP);14521455 break;1453145614541457 case MGET:14551455- rio_dprintk(RIO_DEBUG_CTRL, "Queue MGET command blk %p\n", CmdBlkP);14581458+ rio_dprintk(RIO_DEBUG_CTRL, "Queue MGET command blk %p\n",14591459+ CmdBlkP);14561460 break;1457146114581462 case MSET:14591463 case MBIC:14601464 case MBIS:14611465 CmdBlkP->Packet.data[4] = (char) PortP->ModemLines;14621462- rio_dprintk(RIO_DEBUG_CTRL, "Queue MSET/MBIC/MBIS command blk %p\n", CmdBlkP);14661466+ rio_dprintk(RIO_DEBUG_CTRL, "Queue MSET/MBIC/MBIS command "14671467+ "blk %p\n", CmdBlkP);14631468 break;1464146914651470 case WFLUSH:···14761465 ** allowed then we should not bother sending any more to the14771466 ** RTA.14781467 */14791479- if ((int) ((char) PortP->WflushFlag) == (int) -1) {14801480- rio_dprintk(RIO_DEBUG_CTRL, "Trashed WFLUSH, WflushFlag about to wrap!");14681468+ if (PortP->WflushFlag == (typeof(PortP->WflushFlag))-1) {14691469+ rio_dprintk(RIO_DEBUG_CTRL, "Trashed WFLUSH, "14701470+ "WflushFlag about to wrap!");14811471 RIOFreeCmdBlk(CmdBlkP);14821472 return (RIO_FAIL);14831473 } else {14841484- rio_dprintk(RIO_DEBUG_CTRL, "Queue WFLUSH command blk %p\n", CmdBlkP);14741474+ rio_dprintk(RIO_DEBUG_CTRL, "Queue WFLUSH command "14751475+ "blk %p\n", CmdBlkP);14851476 CmdBlkP->PostFuncP = RIOWFlushMark;14861477 }14871478 break;
+5-51
drivers/char/rio/rioioctl.h
···3333#ifndef __rioioctl_h__3434#define __rioioctl_h__35353636-#ifdef SCCS_LABELS3737-static char *_rioioctl_h_sccs_ = "@(#)rioioctl.h 1.2";3838-#endif3939-4036/*4137** RIO device driver - user ioctls and associated structures.4238*/···4044struct portStats {4145 int port;4246 int gather;4343- ulong txchars;4444- ulong rxchars;4545- ulong opens;4646- ulong closes;4747- ulong ioctls;4747+ unsigned long txchars;4848+ unsigned long rxchars;4949+ unsigned long opens;5050+ unsigned long closes;5151+ unsigned long ioctls;4852};49535050-5151-#define rIOC ('r'<<8)5252-#define TCRIOSTATE (rIOC | 1)5353-#define TCRIOXPON (rIOC | 2)5454-#define TCRIOXPOFF (rIOC | 3)5555-#define TCRIOXPCPS (rIOC | 4)5656-#define TCRIOXPRINT (rIOC | 5)5757-#define TCRIOIXANYON (rIOC | 6)5858-#define TCRIOIXANYOFF (rIOC | 7)5959-#define TCRIOIXONON (rIOC | 8)6060-#define TCRIOIXONOFF (rIOC | 9)6161-#define TCRIOMBIS (rIOC | 10)6262-#define TCRIOMBIC (rIOC | 11)6363-#define TCRIOTRIAD (rIOC | 12)6464-#define TCRIOTSTATE (rIOC | 13)6565-6666-/*6767-** 15.10.1998 ARG - ESIL 0761 part fix6868-** Add RIO ioctls for manipulating RTS and CTS flow control, (as LynxOS6969-** appears to not support hardware flow control).7070-*/7171-#define TCRIOCTSFLOWEN (rIOC | 14) /* enable CTS flow control */7272-#define TCRIOCTSFLOWDIS (rIOC | 15) /* disable CTS flow control */7373-#define TCRIORTSFLOWEN (rIOC | 16) /* enable RTS flow control */7474-#define TCRIORTSFLOWDIS (rIOC | 17) /* disable RTS flow control */7575-7676-/*7777-** 09.12.1998 ARG - ESIL 0776 part fix7878-** Definition for 'RIOC' also appears in daemon.h, so we'd better do a7979-** #ifndef here first.8080-** 'RIO_QUICK_CHECK' also #define'd here as this ioctl is now8181-** allowed to be used by customers.8282-**8383-** 05.02.1999 ARG -8484-** This is what I've decied to do with ioctls etc., which are intended to be8585-** invoked from users applications :8686-** Anything that needs to be defined here will be removed from daemon.h, that8787-** way it won't end up having to be defined/maintained in two places. The only8888-** consequence of this is that this file should now be #include'd by daemon.h8989-**9090-** 'stats' ioctls now #define'd here as they are to be used by customers.9191-*/9254#define RIOC ('R'<<8)|('i'<<16)|('o'<<24)93559456#define RIO_QUICK_CHECK (RIOC | 105)
+1-1
drivers/char/tpm/Kconfig
···22222323config TCG_TIS2424 tristate "TPM Interface Specification 1.2 Interface"2525- depends on TCG_TPM2525+ depends on TCG_TPM && PNPACPI2626 ---help---2727 If you have a TPM security chip that is compliant with the2828 TCG TIS 1.2 TPM specification say Yes and it will be accessible
···398398 while (unlikely(size > copied));399399 return copied;400400}401401-EXPORT_SYMBOL_GPL(tty_insert_flip_string_flags);401401+EXPORT_SYMBOL(tty_insert_flip_string_flags);402402403403void tty_schedule_flip(struct tty_struct *tty)404404{
+5-11
drivers/char/watchdog/i8xx_tco.c
···3333 * 82801E (C-ICH) : document number 273599-001, 273645-002,3434 * 82801EB (ICH5) : document number 252516-001, 252517-003,3535 * 82801ER (ICH5R) : document number 252516-001, 252517-003,3636- * 82801FB (ICH6) : document number 301473-002, 301474-007,3737- * 82801FR (ICH6R) : document number 301473-002, 301474-007,3838- * 82801FBM (ICH6-M) : document number 301473-002, 301474-007,3939- * 82801FW (ICH6W) : document number 301473-001, 301474-007,4040- * 82801FRW (ICH6RW) : document number 301473-001, 301474-0074136 *4237 * 20000710 Nils Faerber4338 * Initial Version 0.01···6166 * 20050807 Wim Van Sebroeck <wim@iguana.be>6267 * 0.08 Make sure that the watchdog is only "armed" when started.6368 * (Kernel Bug 4251)6969+ * 20060416 Wim Van Sebroeck <wim@iguana.be>7070+ * 0.09 Remove support for the ICH6, ICH6R, ICH6-M, ICH6W and ICH6RW and7171+ * ICH7 chipsets. (See Kernel Bug 6031 - other code will support these7272+ * chipsets)6473 */65746675/*···8990#include "i8xx_tco.h"90919192/* Module and version information */9292-#define TCO_VERSION "0.08"9393+#define TCO_VERSION "0.09"9394#define TCO_MODULE_NAME "i8xx TCO timer"9495#define TCO_DRIVER_NAME TCO_MODULE_NAME ", v" TCO_VERSION9596#define PFX TCO_MODULE_NAME ": "···390391 { PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82801DB_12, PCI_ANY_ID, PCI_ANY_ID, },391392 { PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82801E_0, PCI_ANY_ID, PCI_ANY_ID, },392393 { PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82801EB_0, PCI_ANY_ID, PCI_ANY_ID, },393393- { PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ICH6_0, PCI_ANY_ID, PCI_ANY_ID, },394394- { PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ICH6_1, PCI_ANY_ID, PCI_ANY_ID, },395395- { PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ICH6_2, PCI_ANY_ID, PCI_ANY_ID, },396396- { PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ICH7_0, PCI_ANY_ID, PCI_ANY_ID, },397397- { PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ICH7_1, PCI_ANY_ID, PCI_ANY_ID, },398394 { PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ESB_1, PCI_ANY_ID, PCI_ANY_ID, },399395 { 0, }, /* End of list */400396};
+6
drivers/char/watchdog/s3c2410_wdt.c
···423423 if (tmr_atboot && started == 0) {424424 printk(KERN_INFO PFX "Starting Watchdog Timer\n");425425 s3c2410wdt_start();426426+ } else if (!tmr_atboot) {427427+ /* if we're not enabling the watchdog, then ensure it is428428+ * disabled if it has been left running from the bootloader429429+ * or other source */430430+431431+ s3c2410wdt_stop();426432 }427433428434 return 0;
···553553 * register content.554554 * To actually enable physical responses is the job of our interrupt555555 * handler which programs the physical request filter. */556556- reg_write(ohci, OHCI1394_PhyUpperBound, 0xffff0000);556556+ reg_write(ohci, OHCI1394_PhyUpperBound, 0x01000000);557557558558 DBGMSG("physUpperBoundOffset=%08x",559559 reg_read(ohci, OHCI1394_PhyUpperBound));
+145-62
drivers/ieee1394/sbp2.c
···4242#include <linux/kernel.h>4343#include <linux/list.h>4444#include <linux/string.h>4545+#include <linux/stringify.h>4546#include <linux/slab.h>4647#include <linux/interrupt.h>4748#include <linux/fs.h>···118117 */119118static int max_sectors = SBP2_MAX_SECTORS;120119module_param(max_sectors, int, 0444);121121-MODULE_PARM_DESC(max_sectors, "Change max sectors per I/O supported (default = 255)");120120+MODULE_PARM_DESC(max_sectors, "Change max sectors per I/O supported (default = "121121+ __stringify(SBP2_MAX_SECTORS) ")");122122123123/*124124 * Exclusive login to sbp2 device? In most cases, the sbp2 driver should···137135MODULE_PARM_DESC(exclusive_login, "Exclusive login to sbp2 device (default = 1)");138136139137/*140140- * SCSI inquiry hack for really badly behaved sbp2 devices. Turn this on141141- * if your sbp2 device is not properly handling the SCSI inquiry command.142142- * This hack makes the inquiry look more like a typical MS Windows inquiry143143- * by enforcing 36 byte inquiry and avoiding access to mode_sense page 8.138138+ * If any of the following workarounds is required for your device to work,139139+ * please submit the kernel messages logged by sbp2 to the linux1394-devel140140+ * mailing list.144141 *145145- * If force_inquiry_hack=1 is required for your device to work,146146- * please submit the logged sbp2_firmware_revision value of this device to147147- * the linux1394-devel mailing list.142142+ * - 128kB max transfer143143+ * Limit transfer size. Necessary for some old bridges.144144+ *145145+ * - 36 byte inquiry146146+ * When scsi_mod probes the device, let the inquiry command look like that147147+ * from MS Windows.148148+ *149149+ * - skip mode page 8150150+ * Suppress sending of mode_sense for mode page 8 if the device pretends to151151+ * support the SCSI Primary Block commands instead of Reduced Block Commands.152152+ *153153+ * - fix capacity154154+ * Tell sd_mod to correct the last sector number reported by read_capacity.155155+ * Avoids access beyond actual disk limits on devices with an off-by-one bug.156156+ * Don't use this with devices which don't have this bug.157157+ *158158+ * - override internal blacklist159159+ * Instead of adding to the built-in blacklist, use only the workarounds160160+ * specified in the module load parameter.161161+ * Useful if a blacklist entry interfered with a non-broken device.148162 */163163+static int sbp2_default_workarounds;164164+module_param_named(workarounds, sbp2_default_workarounds, int, 0644);165165+MODULE_PARM_DESC(workarounds, "Work around device bugs (default = 0"166166+ ", 128kB max transfer = " __stringify(SBP2_WORKAROUND_128K_MAX_TRANS)167167+ ", 36 byte inquiry = " __stringify(SBP2_WORKAROUND_INQUIRY_36)168168+ ", skip mode page 8 = " __stringify(SBP2_WORKAROUND_MODE_SENSE_8)169169+ ", fix capacity = " __stringify(SBP2_WORKAROUND_FIX_CAPACITY)170170+ ", override internal blacklist = " __stringify(SBP2_WORKAROUND_OVERRIDE)171171+ ", or a combination)");172172+173173+/* legacy parameter */149174static int force_inquiry_hack;150175module_param(force_inquiry_hack, int, 0644);151151-MODULE_PARM_DESC(force_inquiry_hack, "Force SCSI inquiry hack (default = 0)");176176+MODULE_PARM_DESC(force_inquiry_hack, "Deprecated, use 'workarounds'");152177153178/*154179 * Export information about protocols/devices supported by this driver.···295266};296267297268/*298298- * List of device firmwares that require the inquiry hack.299299- * Yields a few false positives but did not break other devices so far.269269+ * List of devices with known bugs.270270+ *271271+ * The firmware_revision field, masked with 0xffff00, is the best indicator272272+ * for the type of bridge chip of a device. It yields a few false positives273273+ * but this did not break correctly behaving devices so far.300274 */301301-static u32 sbp2_broken_inquiry_list[] = {302302- 0x00002800, /* Stefan Richter <stefanr@s5r6.in-berlin.de> */303303- /* DViCO Momobay CX-1 */304304- 0x00000200 /* Andreas Plesch <plesch@fas.harvard.edu> */305305- /* QPS Fire DVDBurner */275275+static const struct {276276+ u32 firmware_revision;277277+ u32 model_id;278278+ unsigned workarounds;279279+} sbp2_workarounds_table[] = {280280+ /* TSB42AA9 */ {281281+ .firmware_revision = 0x002800,282282+ .workarounds = SBP2_WORKAROUND_INQUIRY_36 |283283+ SBP2_WORKAROUND_MODE_SENSE_8,284284+ },285285+ /* Initio bridges, actually only needed for some older ones */ {286286+ .firmware_revision = 0x000200,287287+ .workarounds = SBP2_WORKAROUND_INQUIRY_36,288288+ },289289+ /* Symbios bridge */ {290290+ .firmware_revision = 0xa0b800,291291+ .workarounds = SBP2_WORKAROUND_128K_MAX_TRANS,292292+ },293293+ /*294294+ * Note about the following Apple iPod blacklist entries:295295+ *296296+ * There are iPods (2nd gen, 3rd gen) with model_id==0. Since our297297+ * matching logic treats 0 as a wildcard, we cannot match this ID298298+ * without rewriting the matching routine. Fortunately these iPods299299+ * do not feature the read_capacity bug according to one report.300300+ * Read_capacity behaviour as well as model_id could change due to301301+ * Apple-supplied firmware updates though.302302+ */303303+ /* iPod 4th generation */ {304304+ .firmware_revision = 0x0a2700,305305+ .model_id = 0x000021,306306+ .workarounds = SBP2_WORKAROUND_FIX_CAPACITY,307307+ },308308+ /* iPod mini */ {309309+ .firmware_revision = 0x0a2700,310310+ .model_id = 0x000023,311311+ .workarounds = SBP2_WORKAROUND_FIX_CAPACITY,312312+ },313313+ /* iPod Photo */ {314314+ .firmware_revision = 0x0a2700,315315+ .model_id = 0x00007e,316316+ .workarounds = SBP2_WORKAROUND_FIX_CAPACITY,317317+ }306318};307319308320/**************************************···835765836766 /* Register the status FIFO address range. We could use the same FIFO837767 * for targets at different nodes. However we need different FIFOs per838838- * target in order to support multi-unit devices. */768768+ * target in order to support multi-unit devices.769769+ * The FIFO is located out of the local host controller's physical range770770+ * but, if possible, within the posted write area. Status writes will771771+ * then be performed as unified transactions. This slightly reduces772772+ * bandwidth usage, and some Prolific based devices seem to require it.773773+ */839774 scsi_id->status_fifo_addr = hpsb_allocate_and_register_addrspace(840775 &sbp2_highlevel, ud->ne->host, &sbp2_ops,841776 sizeof(struct sbp2_status_block), sizeof(quadlet_t),842842- ~0ULL, ~0ULL);777777+ 0x010000000000ULL, CSR1212_ALL_SPACE_END);843778 if (!scsi_id->status_fifo_addr) {844779 SBP2_ERR("failed to allocate status FIFO address range");845780 goto failed_alloc;···15251450 struct csr1212_dentry *dentry;15261451 u64 management_agent_addr;15271452 u32 command_set_spec_id, command_set, unit_characteristics,15281528- firmware_revision, workarounds;14531453+ firmware_revision;14541454+ unsigned workarounds;15291455 int i;1530145615311457 SBP2_DEBUG_ENTER();···15821506 case SBP2_FIRMWARE_REVISION_KEY:15831507 /* Firmware revision */15841508 firmware_revision = kv->value.immediate;15851585- if (force_inquiry_hack)15861586- SBP2_INFO("sbp2_firmware_revision = %x",15871587- (unsigned int)firmware_revision);15881588- else15891589- SBP2_DEBUG("sbp2_firmware_revision = %x",15901590- (unsigned int)firmware_revision);15091509+ SBP2_DEBUG("sbp2_firmware_revision = %x",15101510+ (unsigned int)firmware_revision);15911511 break;1592151215931513 default:···15911519 }15921520 }1593152115941594- /* This is the start of our broken device checking. We try to hack15951595- * around oddities and known defects. */15961596- workarounds = 0x0;15971597-15981598- /* If the vendor id is 0xa0b8 (Symbios vendor id), then we have a15991599- * bridge with 128KB max transfer size limitation. For sanity, we16001600- * only voice this when the current max_sectors setting16011601- * exceeds the 128k limit. By default, that is not the case.16021602- *16031603- * It would be really nice if we could detect this before the scsi16041604- * host gets initialized. That way we can down-force the16051605- * max_sectors to account for it. That is not currently16061606- * possible. */16071607- if ((firmware_revision & 0xffff00) ==16081608- SBP2_128KB_BROKEN_FIRMWARE &&16091609- (max_sectors * 512) > (128*1024)) {16101610- SBP2_WARN("Node " NODE_BUS_FMT ": Bridge only supports 128KB max transfer size.",16111611- NODE_BUS_ARGS(ud->ne->host, ud->ne->nodeid));16121612- SBP2_WARN("WARNING: Current max_sectors setting is larger than 128KB (%d sectors)!",16131613- max_sectors);16141614- workarounds |= SBP2_BREAKAGE_128K_MAX_TRANSFER;15221522+ workarounds = sbp2_default_workarounds;15231523+ if (force_inquiry_hack) {15241524+ SBP2_WARN("force_inquiry_hack is deprecated. "15251525+ "Use parameter 'workarounds' instead.");15261526+ workarounds |= SBP2_WORKAROUND_INQUIRY_36;16151527 }1616152816171617- /* Check for a blacklisted set of devices that require us to force16181618- * a 36 byte host inquiry. This can be overriden as a module param16191619- * (to force all hosts). */16201620- for (i = 0; i < ARRAY_SIZE(sbp2_broken_inquiry_list); i++) {16211621- if ((firmware_revision & 0xffff00) ==16221622- sbp2_broken_inquiry_list[i]) {16231623- SBP2_WARN("Node " NODE_BUS_FMT ": Using 36byte inquiry workaround",16241624- NODE_BUS_ARGS(ud->ne->host, ud->ne->nodeid));16251625- workarounds |= SBP2_BREAKAGE_INQUIRY_HACK;16261626- break; /* No need to continue. */15291529+ if (!(workarounds & SBP2_WORKAROUND_OVERRIDE))15301530+ for (i = 0; i < ARRAY_SIZE(sbp2_workarounds_table); i++) {15311531+ if (sbp2_workarounds_table[i].firmware_revision &&15321532+ sbp2_workarounds_table[i].firmware_revision !=15331533+ (firmware_revision & 0xffff00))15341534+ continue;15351535+ if (sbp2_workarounds_table[i].model_id &&15361536+ sbp2_workarounds_table[i].model_id != ud->model_id)15371537+ continue;15381538+ workarounds |= sbp2_workarounds_table[i].workarounds;15391539+ break;16271540 }16281628- }15411541+15421542+ if (workarounds)15431543+ SBP2_INFO("Workarounds for node " NODE_BUS_FMT ": 0x%x "15441544+ "(firmware_revision 0x%06x, vendor_id 0x%06x,"15451545+ " model_id 0x%06x)",15461546+ NODE_BUS_ARGS(ud->ne->host, ud->ne->nodeid),15471547+ workarounds, firmware_revision,15481548+ ud->vendor_id ? ud->vendor_id : ud->ne->vendor_id,15491549+ ud->model_id);15501550+15511551+ /* We would need one SCSI host template for each target to adjust15521552+ * max_sectors on the fly, therefore warn only. */15531553+ if (workarounds & SBP2_WORKAROUND_128K_MAX_TRANS &&15541554+ (max_sectors * 512) > (128 * 1024))15551555+ SBP2_WARN("Node " NODE_BUS_FMT ": Bridge only supports 128KB "15561556+ "max transfer size. WARNING: Current max_sectors "15571557+ "setting is larger than 128KB (%d sectors)",15581558+ NODE_BUS_ARGS(ud->ne->host, ud->ne->nodeid),15591559+ max_sectors);1629156016301561 /* If this is a logical unit directory entry, process the parent16311562 * to get the values. */···2522244725232448 scsi_id->sdev = sdev;2524244925252525- if (force_inquiry_hack ||25262526- scsi_id->workarounds & SBP2_BREAKAGE_INQUIRY_HACK) {24502450+ if (scsi_id->workarounds & SBP2_WORKAROUND_INQUIRY_36)25272451 sdev->inquiry_len = 36;25282528- sdev->skip_ms_page_8 = 1;25292529- }25302452 return 0;25312453}2532245425332455static int sbp2scsi_slave_configure(struct scsi_device *sdev)25342456{24572457+ struct scsi_id_instance_data *scsi_id =24582458+ (struct scsi_id_instance_data *)sdev->host->hostdata[0];24592459+25352460 blk_queue_dma_alignment(sdev->request_queue, (512 - 1));25362461 sdev->use_10_for_rw = 1;25372462 sdev->use_10_for_ms = 1;24632463+24642464+ if (sdev->type == TYPE_DISK &&24652465+ scsi_id->workarounds & SBP2_WORKAROUND_MODE_SENSE_8)24662466+ sdev->skip_ms_page_8 = 1;24672467+ if (scsi_id->workarounds & SBP2_WORKAROUND_FIX_CAPACITY)24682468+ sdev->fix_capacity = 1;25382469 return 0;25392470}25402471···26842603 scsi_driver_template.cmd_per_lun = 1;26852604 }2686260526872687- /* Set max sectors (module load option). Default is 255 sectors. */26062606+ if (sbp2_default_workarounds & SBP2_WORKAROUND_128K_MAX_TRANS &&26072607+ (max_sectors * 512) > (128 * 1024))26082608+ max_sectors = 128 * 1024 / 512;26882609 scsi_driver_template.max_sectors = max_sectors;2689261026902611 /* Register our high level driver with 1394 stack */
+8-10
drivers/ieee1394/sbp2.h
···227227#define SBP2_SW_VERSION_ENTRY 0x00010483228228229229/*230230- * Other misc defines231231- */232232-#define SBP2_128KB_BROKEN_FIRMWARE 0xa0b800233233-234234-/*235230 * SCSI specific stuff236231 */237232238233#define SBP2_MAX_SG_ELEMENT_LENGTH 0xf000239234#define SBP2_MAX_SECTORS 255 /* Max sectors supported */240235#define SBP2_MAX_CMDS 8 /* This should be safe */236236+237237+/* Flags for detected oddities and brokeness */238238+#define SBP2_WORKAROUND_128K_MAX_TRANS 0x1239239+#define SBP2_WORKAROUND_INQUIRY_36 0x2240240+#define SBP2_WORKAROUND_MODE_SENSE_8 0x4241241+#define SBP2_WORKAROUND_FIX_CAPACITY 0x8242242+#define SBP2_WORKAROUND_OVERRIDE 0x100241243242244/* This is the two dma types we use for cmd_dma below */243245enum cmd_dma_types {···269267 int dma_dir;270268271269};272272-273273-/* A list of flags for detected oddities and brokeness. */274274-#define SBP2_BREAKAGE_128K_MAX_TRANSFER 0x1275275-#define SBP2_BREAKAGE_INQUIRY_HACK 0x2276270277271struct sbp2scsi_host_info;278272···343345 struct Scsi_Host *scsi_host;344346345347 /* Device specific workarounds/brokeness */346346- u32 workarounds;348348+ unsigned workarounds;347349};348350349351/* Sbp2 host data structure (one per IEEE1394 host) */
···3232 *3333 * $Id: ucm.c 2594 2005-06-13 19:46:02Z libor $3434 */3535+3636+#include <linux/completion.h>3537#include <linux/init.h>3638#include <linux/fs.h>3739#include <linux/module.h>···74727573struct ib_ucm_context {7674 int id;7777- wait_queue_head_t wait;7575+ struct completion comp;7876 atomic_t ref;7977 int events_reported;8078···140138static void ib_ucm_ctx_put(struct ib_ucm_context *ctx)141139{142140 if (atomic_dec_and_test(&ctx->ref))143143- wake_up(&ctx->wait);141141+ complete(&ctx->comp);144142}145143146144static inline int ib_ucm_new_cm_id(int event)···180178 return NULL;181179182180 atomic_set(&ctx->ref, 1);183183- init_waitqueue_head(&ctx->wait);181181+ init_completion(&ctx->comp);184182 ctx->file = file;185183 INIT_LIST_HEAD(&ctx->events);186184···588586 if (IS_ERR(ctx))589587 return PTR_ERR(ctx);590588591591- atomic_dec(&ctx->ref);592592- wait_event(ctx->wait, !atomic_read(&ctx->ref));589589+ ib_ucm_ctx_put(ctx);590590+ wait_for_completion(&ctx->comp);593591594592 /* No new events will be generated after destroying the cm_id. */595593 ib_destroy_cm_id(ctx->cm_id);
+3-1
drivers/infiniband/core/uverbs_mem.c
···211211 */212212213213 work = kmalloc(sizeof *work, GFP_KERNEL);214214- if (!work)214214+ if (!work) {215215+ mmput(mm);215216 return;217217+ }216218217219 INIT_WORK(&work->work, ib_umem_account, work);218220 work->mm = mm;
+14-15
drivers/infiniband/hw/ipath/ipath_driver.c
···116116#define PCI_DEVICE_ID_INFINIPATH_PE800 0x10117117118118static const struct pci_device_id ipath_pci_tbl[] = {119119- {PCI_DEVICE(PCI_VENDOR_ID_PATHSCALE,120120- PCI_DEVICE_ID_INFINIPATH_HT)},121121- {PCI_DEVICE(PCI_VENDOR_ID_PATHSCALE,122122- PCI_DEVICE_ID_INFINIPATH_PE800)},119119+ { PCI_DEVICE(PCI_VENDOR_ID_PATHSCALE, PCI_DEVICE_ID_INFINIPATH_HT) },120120+ { PCI_DEVICE(PCI_VENDOR_ID_PATHSCALE, PCI_DEVICE_ID_INFINIPATH_PE800) },121121+ { 0, }123122};124123125124MODULE_DEVICE_TABLE(pci, ipath_pci_tbl);···19051906 } else19061907 ipath_dbg("irq is 0, not doing free_irq "19071908 "for unit %u\n", dd->ipath_unit);19091909+19101910+ /*19111911+ * we check for NULL here, because it's outside19121912+ * the kregbase check, and we need to call it19131913+ * after the free_irq. Thus it's possible that19141914+ * the function pointers were never initialized.19151915+ */19161916+ if (dd->ipath_f_cleanup)19171917+ /* clean up chip-specific stuff */19181918+ dd->ipath_f_cleanup(dd);19191919+19081920 dd->pcidev = NULL;19091921 }19101910-19111911- /*19121912- * we check for NULL here, because it's outside the kregbase19131913- * check, and we need to call it after the free_irq. Thus19141914- * it's possible that the function pointers were never19151915- * initialized.19161916- */19171917- if (dd->ipath_f_cleanup)19181918- /* clean up chip-specific stuff */19191919- dd->ipath_f_cleanup(dd);19201920-19211922 spin_lock_irqsave(&ipath_devs_lock, flags);19221923 }19231924
+3-4
drivers/infiniband/hw/ipath/ipath_eeprom.c
···505505 * ipath_get_guid - get the GUID from the i2c device506506 * @dd: the infinipath device507507 *508508- * When we add the multi-chip support, we will probably have to add509509- * the ability to use the number of guids field, and get the guid from510510- * the first chip's flash, to use for all of them.508508+ * We have the capability to use the ipath_nguid field, and get509509+ * the guid from the first chip's flash, to use for all of them.511510 */512512-void ipath_get_guid(struct ipath_devdata *dd)511511+void ipath_get_eeprom_info(struct ipath_devdata *dd)513512{514513 void *buf;515514 struct ipath_flash *ifp;
···607607 case 4: /* Ponderosa is one of the bringup boards */608608 n = "Ponderosa";609609 break;610610- case 5: /* HT-460 original production board */610610+ case 5:611611+ /*612612+ * HT-460 original production board; two production levels, with613613+ * different serial number ranges. See ipath_ht_early_init() for614614+ * case where we enable IPATH_GPIO_INTR for later serial # range.615615+ */611616 n = "InfiniPath_HT-460";612617 break;613618 case 6:···647642 if (n)648643 snprintf(name, namelen, "%s", n);649644650650- if (dd->ipath_majrev != 3 || dd->ipath_minrev != 2) {645645+ if (dd->ipath_majrev != 3 || (dd->ipath_minrev < 2 || dd->ipath_minrev > 3)) {651646 /*652647 * This version of the driver only supports the HT-400653648 * Rev 3.2···15251520 */15261521 ipath_write_kreg(dd, dd->ipath_kregs->kr_sendctrl,15271522 INFINIPATH_S_ABORT);15231523+15241524+ ipath_get_eeprom_info(dd);15251525+ if(dd->ipath_boardrev == 5 && dd->ipath_serial[0] == '1' &&15261526+ dd->ipath_serial[1] == '2' && dd->ipath_serial[2] == '8') {15271527+ /*15281528+ * Later production HT-460 has same changes as HT-465, so15291529+ * can use GPIO interrupts. They have serial #'s starting15301530+ * with 128, rather than 112.15311531+ */15321532+ dd->ipath_flags |= IPATH_GPIO_INTR;15331533+ dd->ipath_flags &= ~IPATH_POLL_RX_INTR;15341534+ }15281535 return 0;15291536}15301537
-1
drivers/infiniband/hw/ipath/ipath_init_chip.c
···879879880880done:881881 if (!ret) {882882- ipath_get_guid(dd);883882 *dd->ipath_statusp |= IPATH_STATUS_CHIP_PRESENT;884883 if (!dd->ipath_f_intrsetup(dd)) {885884 /* now we can enable all interrupts from the chip */
···136136 ret = 1;137137 goto bail;138138 }139139- spin_lock(&rkt->lock);140139 mr = rkt->table[(sge->lkey >> (32 - ib_ipath_lkey_table_size))];141141- spin_unlock(&rkt->lock);142140 if (unlikely(mr == NULL || mr->lkey != sge->lkey)) {143141 ret = 0;144142 goto bail;···182184 * @acc: access flags183185 *184186 * Return 1 if successful, otherwise 0.185185- *186186- * The QP r_rq.lock should be held.187187 */188188int ipath_rkey_ok(struct ipath_ibdev *dev, struct ipath_sge_state *ss,189189 u32 len, u64 vaddr, u32 rkey, int acc)···192196 size_t off;193197 int ret;194198195195- spin_lock(&rkt->lock);196199 mr = rkt->table[(rkey >> (32 - ib_ipath_lkey_table_size))];197197- spin_unlock(&rkt->lock);198200 if (unlikely(mr == NULL || mr->lkey != rkey)) {199201 ret = 0;200202 goto bail;
+7-5
drivers/infiniband/hw/ipath/ipath_layer.c
···872872 update_sge(ss, len);873873 length -= len;874874 }875875+ /* Update address before sending packet. */876876+ update_sge(ss, length);875877 /* must flush early everything before trigger word */876878 ipath_flush_wc();877879 __raw_writel(last, piobuf);878880 /* be sure trigger word is written */879881 ipath_flush_wc();880880- update_sge(ss, length);881882}882883883884/**···944943 if (likely(ss->num_sge == 1 && len <= ss->sge.length &&945944 !((unsigned long)ss->sge.vaddr & (sizeof(u32) - 1)))) {946945 u32 w;946946+ u32 *addr = (u32 *) ss->sge.vaddr;947947948948+ /* Update address before sending packet. */949949+ update_sge(ss, len);948950 /* Need to round up for the last dword in the packet. */949951 w = (len + 3) >> 2;950950- __iowrite32_copy(piobuf, ss->sge.vaddr, w - 1);952952+ __iowrite32_copy(piobuf, addr, w - 1);951953 /* must flush early everything before trigger word */952954 ipath_flush_wc();953953- __raw_writel(((u32 *) ss->sge.vaddr)[w - 1],954954- piobuf + w - 1);955955+ __raw_writel(addr[w - 1], piobuf + w - 1);955956 /* be sure trigger word is written */956957 ipath_flush_wc();957957- update_sge(ss, len);958958 ret = 0;959959 goto bail;960960 }
···340340 /* XXX should send SRP_I_LOGOUT request */341341342342 init_completion(&target->done);343343- ib_send_cm_dreq(target->cm_id, NULL, 0);343343+ if (ib_send_cm_dreq(target->cm_id, NULL, 0)) {344344+ printk(KERN_DEBUG PFX "Sending CM DREQ failed\n");345345+ return;346346+ }344347 wait_for_completion(&target->done);345348}346349···354351 spin_lock_irq(target->scsi_host->host_lock);355352 if (target->state != SRP_TARGET_DEAD) {356353 spin_unlock_irq(target->scsi_host->host_lock);357357- scsi_host_put(target->scsi_host);358354 return;359355 }360356 target->state = SRP_TARGET_REMOVED;···366364 scsi_remove_host(target->scsi_host);367365 ib_destroy_cm_id(target->cm_id);368366 srp_free_target_ib(target);369369- scsi_host_put(target->scsi_host);370370- /* And another put to really free the target port... */371367 scsi_host_put(target->scsi_host);372368}373369···12411241 list_for_each_entry_safe(req, tmp, &target->req_queue, list)12421242 if (req->scmnd->device == scmnd->device) {12431243 req->scmnd->result = DID_RESET << 16;12441244- scmnd->scsi_done(scmnd);12441244+ req->scmnd->scsi_done(req->scmnd);12451245 srp_remove_req(target, req);12461246 }12471247
-1
drivers/isdn/capi/capi.c
···14991499 printk(KERN_ERR "capi20: unable to get major %d\n", capi_major);15001500 return major_ret;15011501 }15021502- capi_major = major_ret;15031502 capi_class = class_create(THIS_MODULE, "capi");15041503 if (IS_ERR(capi_class)) {15051504 unregister_chrdev(capi_major, "capi20");
+2-2
drivers/isdn/gigaset/usb-gigaset.c
···710710 retval = -ENODEV; //FIXME711711712712 /* See if the device offered us matches what we can accept */713713- if ((le16_to_cpu(udev->descriptor.idVendor != USB_M105_VENDOR_ID)) ||714714- (le16_to_cpu(udev->descriptor.idProduct != USB_M105_PRODUCT_ID)))713713+ if ((le16_to_cpu(udev->descriptor.idVendor) != USB_M105_VENDOR_ID) ||714714+ (le16_to_cpu(udev->descriptor.idProduct) != USB_M105_PRODUCT_ID))715715 return -ENODEV;716716717717 /* this starts to become ascii art... */
+1-1
drivers/isdn/i4l/isdn_tty.c
···28802880 p[0]++;28812881 i = 0;28822882 while (*p[0] && (strchr("0123456789,-*[]?;", *p[0])) &&28832883- (i < ISDN_LMSNLEN))28832883+ (i < ISDN_LMSNLEN - 1))28842884 m->lmsn[i++] = *p[0]++;28852885 m->lmsn[i] = '\0';28862886 break;
+5-2
drivers/leds/Kconfig
···44config NEW_LEDS55 bool "LED Support"66 help77- Say Y to enable Linux LED support. This is not related to standard88- keyboard LEDs which are controlled via the input system.77+ Say Y to enable Linux LED support. This allows control of supported88+ LEDs from both userspace and optionally, by kernel events (triggers).99+1010+ This is not related to standard keyboard LEDs which are controlled1111+ via the input system.9121013config LEDS_CLASS1114 tristate "LED Class Support"
+7-2
drivers/leds/led-class.c
···1919#include <linux/sysdev.h>2020#include <linux/timer.h>2121#include <linux/err.h>2222+#include <linux/ctype.h>2223#include <linux/leds.h>2324#include "leds.h"2425···4443 ssize_t ret = -EINVAL;4544 char *after;4645 unsigned long state = simple_strtoul(buf, &after, 10);4646+ size_t count = after - buf;47474848- if (after - buf > 0) {4949- ret = after - buf;4848+ if (*after && isspace(*after))4949+ count++;5050+5151+ if (count == size) {5252+ ret = count;5053 led_set_brightness(led_cdev, state);5154 }5255
+13-4
drivers/leds/ledtrig-timer.c
···2020#include <linux/device.h>2121#include <linux/sysdev.h>2222#include <linux/timer.h>2323+#include <linux/ctype.h>2324#include <linux/leds.h>2425#include "leds.h"2526···7069 int ret = -EINVAL;7170 char *after;7271 unsigned long state = simple_strtoul(buf, &after, 10);7272+ size_t count = after - buf;73737474- if (after - buf > 0) {7474+ if (*after && isspace(*after))7575+ count++;7676+7777+ if (count == size) {7578 timer_data->delay_on = state;7679 mod_timer(&timer_data->timer, jiffies + 1);7777- ret = after - buf;8080+ ret = count;7881 }79828083 return ret;···10297 int ret = -EINVAL;10398 char *after;10499 unsigned long state = simple_strtoul(buf, &after, 10);100100+ size_t count = after - buf;105101106106- if (after - buf > 0) {102102+ if (*after && isspace(*after))103103+ count++;104104+105105+ if (count == size) {107106 timer_data->delay_off = state;108107 mod_timer(&timer_data->timer, jiffies + 1);109109- ret = after - buf;108108+ ret = count;110109 }111110112111 return ret;
+1-1
drivers/md/md.c
···22522252 } else {22532253 if (cmd_match(page, "check"))22542254 set_bit(MD_RECOVERY_CHECK, &mddev->recovery);22552255- else if (cmd_match(page, "repair"))22552255+ else if (!cmd_match(page, "repair"))22562256 return -EINVAL;22572257 set_bit(MD_RECOVERY_REQUESTED, &mddev->recovery);22582258 set_bit(MD_RECOVERY_SYNC, &mddev->recovery);
···88 tristate "Video For Linux"99 ---help---1010 Support for audio/video capture and overlay devices and FM radio1111- cards. The exact capabilities of each device vary. User tools for1212- this are available from1313- <ftp://ftp.uk.linux.org/pub/linux/video4linux/>.1111+ cards. The exact capabilities of each device vary.14121513 This kernel includes support for the new Video for Linux Two API,1614 (V4L2) as well as the original system. Drivers and applications1715 need to be rewritten to use V4L2, but drivers for popular cards1816 and applications for most video capture functions already exist.19172020- Documentation for the original API is included in the file2121- <file:Documentation/video4linux/API.html>. Documentation for V4L2 is2222- available on the web at <http://bytesex.org/v4l/>.1818+ Additional info and docs are available on the web at1919+ <http://linuxtv.org>2020+2121+ Documentation for V4L2 is also available on the web at2222+ <http://bytesex.org/v4l/>.23232424 To compile this driver as a module, choose M here: the2525 module will be called videodev.2626+2727+config VIDEO_V4L12828+ boolean "Enable Video For Linux API 1 (DEPRECATED)"2929+ depends on VIDEO_DEV3030+ select VIDEO_V4L1_COMPAT3131+ default y3232+ ---help---3333+ Enables a compatibility API used by most V4L2 devices to allow3434+ its usage with legacy applications that supports only V4L1 api.3535+3636+ If you are unsure as to whether this is required, answer Y.3737+3838+config VIDEO_V4L1_COMPAT3939+ boolean "Enable Video For Linux API 1 compatible Layer"4040+ depends on VIDEO_DEV4141+ default y4242+ ---help---4343+ This api were developed to be used at Kernel 2.2 and 2.4, but4444+ lacks support for several video standards. There are several4545+ drivers at kernel that still depends on it.4646+4747+ Documentation for the original API is included in the file4848+ <Documentation/video4linux/API.html>.4949+5050+ User tools for this are available from5151+ <ftp://ftp.uk.linux.org/pub/linux/video4linux/>.5252+5353+ If you are unsure as to whether this is required, answer Y.5454+5555+config VIDEO_V4L25656+ tristate5757+ default y26582759source "drivers/media/video/Kconfig"2860···9765 module will be called dabusb.98669967endmenu100100-
···2222source "drivers/media/dvb/dvb-core/Kconfig"23232424comment "Supported SAA7146 based PCI Adapters"2525- depends on DVB_CORE && PCI2525+ depends on DVB_CORE && PCI && I2C2626source "drivers/media/dvb/ttpci/Kconfig"27272828comment "Supported USB Adapters"2929- depends on DVB_CORE && USB2929+ depends on DVB_CORE && USB && I2C3030source "drivers/media/dvb/dvb-usb/Kconfig"3131source "drivers/media/dvb/ttusb-budget/Kconfig"3232source "drivers/media/dvb/ttusb-dec/Kconfig"3333source "drivers/media/dvb/cinergyT2/Kconfig"34343535comment "Supported FlexCopII (B2C2) Adapters"3636- depends on DVB_CORE && (PCI || USB)3636+ depends on DVB_CORE && (PCI || USB) && I2C3737source "drivers/media/dvb/b2c2/Kconfig"38383939comment "Supported BT878 Adapters"4040- depends on DVB_CORE && PCI4040+ depends on DVB_CORE && PCI && I2C4141source "drivers/media/dvb/bt8xx/Kconfig"42424343comment "Supported Pluto2 Adapters"4444- depends on DVB_CORE && PCI4444+ depends on DVB_CORE && PCI && I2C4545source "drivers/media/dvb/pluto2/Kconfig"46464747comment "Supported DVB Frontends"
+3-3
drivers/media/dvb/b2c2/Kconfig
···11config DVB_B2C2_FLEXCOP22 tristate "Technisat/B2C2 FlexCopII(b) and FlexCopIII adapters"33- depends on DVB_CORE33+ depends on DVB_CORE && I2C44 select DVB_STV029955 select DVB_MT35266 select DVB_MT312···16161717config DVB_B2C2_FLEXCOP_PCI1818 tristate "Technisat/B2C2 Air/Sky/Cable2PC PCI"1919- depends on DVB_B2C2_FLEXCOP && PCI1919+ depends on DVB_B2C2_FLEXCOP && PCI && I2C2020 help2121 Support for the Air/Sky/CableStar2 PCI card (DVB/ATSC) by Technisat/B2C2.2222···24242525config DVB_B2C2_FLEXCOP_USB2626 tristate "Technisat/B2C2 Air/Sky/Cable2PC USB"2727- depends on DVB_B2C2_FLEXCOP && USB2727+ depends on DVB_B2C2_FLEXCOP && USB && I2C2828 help2929 Support for the Air/Sky/Cable2PC USB1.1 box (DVB/ATSC) by Technisat/B2C2,3030
+2-1
drivers/media/dvb/bt8xx/Kconfig
···11config DVB_BT8XX22 tristate "BT8xx based PCI cards"33- depends on DVB_CORE && PCI && VIDEO_BT84833+ depends on DVB_CORE && PCI && I2C && VIDEO_BT84844 select DVB_MT35255 select DVB_SP887X66 select DVB_NXT600077 select DVB_CX2411088 select DVB_OR5121199 select DVB_LGDT330X1010+ select DVB_ZL103531011 select FW_LOADER1112 help1213 Support for PCI cards based on the Bt8xx PCI bridge. Examples are
+3-3
drivers/media/dvb/bt8xx/dvb-bt8xx.c
···115115 return 0;116116}117117118118-static struct bt878 __init *dvb_bt8xx_878_match(unsigned int bttv_nr, struct pci_dev* bttv_pci_dev)118118+static struct bt878 __devinit *dvb_bt8xx_878_match(unsigned int bttv_nr, struct pci_dev* bttv_pci_dev)119119{120120 unsigned int card_nr;121121···709709 }710710}711711712712-static int __init dvb_bt8xx_load_card(struct dvb_bt8xx_card *card, u32 type)712712+static int __devinit dvb_bt8xx_load_card(struct dvb_bt8xx_card *card, u32 type)713713{714714 int result;715715···794794 return 0;795795}796796797797-static int dvb_bt8xx_probe(struct bttv_sub_device *sub)797797+static int __devinit dvb_bt8xx_probe(struct bttv_sub_device *sub)798798{799799 struct dvb_bt8xx_card *card;800800 struct pci_dev* bttv_pci_dev;
···11config DVB_USB22 tristate "Support for various USB DVB devices"33- depends on DVB_CORE && USB33+ depends on DVB_CORE && USB && I2C44 select FW_LOADER55 help66 By enabling this you will be able to choose the various supported
···7788config RADIO_CADET99 tristate "ADS Cadet AM/FM Tuner"1010- depends on ISA && VIDEO_DEV1010+ depends on ISA && VIDEO_V4L11111 ---help---1212 Choose Y here if you have one of these AM/FM radio cards, and then1313 fill in the port address below.···25252626config RADIO_RTRACK2727 tristate "AIMSlab RadioTrack (aka RadioReveal) support"2828- depends on ISA && VIDEO_DEV2828+ depends on ISA && VIDEO_V4L12929 ---help---3030 Choose Y here if you have one of these FM radio cards, and then fill3131 in the port address below.···59596060config RADIO_RTRACK26161 tristate "AIMSlab RadioTrack II support"6262- depends on ISA && VIDEO_DEV6262+ depends on ISA && VIDEO_V4L16363 ---help---6464 Choose Y here if you have this FM radio card, and then fill in the6565 port address below.···82828383config RADIO_AZTECH8484 tristate "Aztech/Packard Bell Radio"8585- depends on ISA && VIDEO_DEV8585+ depends on ISA && VIDEO_V4L18686 ---help---8787 Choose Y here if you have one of these FM radio cards, and then fill8888 in the port address below.···106106107107config RADIO_GEMTEK108108 tristate "GemTek Radio Card support"109109- depends on ISA && VIDEO_DEV109109+ depends on ISA && VIDEO_V4L1110110 ---help---111111 Choose Y here if you have this FM radio card, and then fill in the112112 port address below.···131131132132config RADIO_GEMTEK_PCI133133 tristate "GemTek PCI Radio Card support"134134- depends on VIDEO_DEV && PCI134134+ depends on VIDEO_V4L1 && PCI135135 ---help---136136 Choose Y here if you have this PCI FM radio card.137137···145145146146config RADIO_MAXIRADIO147147 tristate "Guillemot MAXI Radio FM 2000 radio"148148- depends on VIDEO_DEV && PCI148148+ depends on VIDEO_V4L1 && PCI149149 ---help---150150 Choose Y here if you have this radio card. This card may also be151151 found as Gemtek PCI FM.···160160161161config RADIO_MAESTRO162162 tristate "Maestro on board radio"163163- depends on VIDEO_DEV163163+ depends on VIDEO_V4L1164164 ---help---165165 Say Y here to directly support the on-board radio tuner on the166166 Maestro 2 or 2E sound card.···175175176176config RADIO_MIROPCM20177177 tristate "miroSOUND PCM20 radio"178178- depends on ISA && VIDEO_DEV && SOUND_ACI_MIXER178178+ depends on ISA && VIDEO_V4L1 && SOUND_ACI_MIXER179179 ---help---180180 Choose Y here if you have this FM radio card. You also need to say Y181181 to "ACI mixer (miroSOUND PCM1-pro/PCM12/PCM20 radio)" (in "Sound")···208208209209config RADIO_SF16FMI210210 tristate "SF16FMI Radio"211211- depends on ISA && VIDEO_DEV211211+ depends on ISA && VIDEO_V4L1212212 ---help---213213 Choose Y here if you have one of these FM radio cards. If you214214 compile the driver into the kernel and your card is not PnP one, you···225225226226config RADIO_SF16FMR2227227 tristate "SF16FMR2 Radio"228228- depends on ISA && VIDEO_DEV228228+ depends on ISA && VIDEO_V4L1229229 ---help---230230 Choose Y here if you have one of these FM radio cards.231231···239239240240config RADIO_TERRATEC241241 tristate "TerraTec ActiveRadio ISA Standalone"242242- depends on ISA && VIDEO_DEV242242+ depends on ISA && VIDEO_V4L1243243 ---help---244244 Choose Y here if you have this FM radio card, and then fill in the245245 port address below. (TODO)···268268269269config RADIO_TRUST270270 tristate "Trust FM radio card"271271- depends on ISA && VIDEO_DEV271271+ depends on ISA && VIDEO_V4L1272272 help273273 This is a driver for the Trust FM radio cards. Say Y if you have274274 such a card and want to use it under Linux.···286286287287config RADIO_TYPHOON288288 tristate "Typhoon Radio (a.k.a. EcoRadio)"289289- depends on ISA && VIDEO_DEV289289+ depends on ISA && VIDEO_V4L1290290 ---help---291291 Choose Y here if you have one of these FM radio cards, and then fill292292 in the port address and the frequency used for muting below.···330330331331config RADIO_ZOLTRIX332332 tristate "Zoltrix Radio"333333- depends on ISA && VIDEO_DEV333333+ depends on ISA && VIDEO_V4L1334334 ---help---335335 Choose Y here if you have one of these FM radio cards, and then fill336336 in the port address below.
+47-32
drivers/media/video/Kconfig
···22# Multimedia Video device configuration33#4455-menu "Video For Linux"55+menu "Video Capture Adapters"66 depends on VIDEO_DEV7788-comment "Video Adapters"88+comment "Video Capture Adapters"991010config VIDEO_ADV_DEBUG1111 bool "Enable advanced debug functionality"···1616 V4L devices.1717 In doubt, say N.18181919+config VIDEO_VIVI2020+ tristate "Virtual Video Driver"2121+ depends on VIDEO_V4L2 && !SPARC32 && !SPARC642222+ select VIDEO_BUF2323+ default n2424+ ---help---2525+ Enables a virtual video driver. This device shows a color bar2626+ and a timestamp, as a real device would generate by using V4L22727+ api.2828+ Say Y here if you want to test video apps or debug V4L devices.2929+ In doubt, say N.3030+1931source "drivers/media/video/bt8xx/Kconfig"20322133config VIDEO_SAA65882234 tristate "SAA6588 Radio Chip RDS decoder support on BT848 cards"2323- depends on VIDEO_DEV && I2C && VIDEO_BT8483535+ depends on I2C && VIDEO_BT84824362537 help2638 Support for Radio Data System (RDS) decoder. This allows seeing···44324533config VIDEO_PMS4634 tristate "Mediavision Pro Movie Studio Video For Linux"4747- depends on VIDEO_DEV && ISA3535+ depends on ISA && VIDEO_V4L14836 help4937 Say Y if you have such a thing.5038···53415442config VIDEO_PLANB5543 tristate "PlanB Video-In on PowerMac"5656- depends on PPC_PMAC && VIDEO_DEV && BROKEN4444+ depends on PPC_PMAC && VIDEO_V4L1 && BROKEN5745 help5846 PlanB is the V4L driver for the PowerMac 7x00/8x00 series video5947 input hardware. If you want to experiment with this, say Y.···64526553config VIDEO_BWQCAM6654 tristate "Quickcam BW Video For Linux"6767- depends on VIDEO_DEV && PARPORT5555+ depends on PARPORT && VIDEO_V4L16856 help6957 Say Y have if you the black and white version of the QuickCam7058 camera. See the next option for the color version.···74627563config VIDEO_CQCAM7664 tristate "QuickCam Colour Video For Linux (EXPERIMENTAL)"7777- depends on EXPERIMENTAL && VIDEO_DEV && PARPORT6565+ depends on EXPERIMENTAL && PARPORT && VIDEO_V4L17866 help7967 This is the video4linux driver for the colour version of the8068 Connectix QuickCam. If you have one of these cameras, say Y here,···85738674config VIDEO_W99668775 tristate "W9966CF Webcam (FlyCam Supra and others) Video For Linux"8888- depends on PARPORT_1284 && VIDEO_DEV && PARPORT7676+ depends on PARPORT_1284 && PARPORT && VIDEO_V4L18977 help9078 Video4linux driver for Winbond's w9966 based Webcams.9179 Currently tested with the LifeView FlyCam Supra.···98869987config VIDEO_CPIA10088 tristate "CPiA Video For Linux"101101- depends on VIDEO_DEV8989+ depends on VIDEO_V4L110290 ---help---10391 This is the video4linux driver for cameras based on Vision's CPiA10492 (Colour Processor Interface ASIC), such as the Creative Labs Video···135123136124config VIDEO_SAA5246A137125 tristate "SAA5246A, SAA5281 Teletext processor"138138- depends on VIDEO_DEV && I2C126126+ depends on I2C && VIDEO_V4L1139127 help140128 Support for I2C bus based teletext using the SAA5246A or SAA5281141129 chip. Useful only if you live in Europe.···162150163151config VIDEO_VINO164152 tristate "SGI Vino Video For Linux (EXPERIMENTAL)"165165- depends on VIDEO_DEV && I2C && SGI_IP22 && EXPERIMENTAL153153+ depends on I2C && SGI_IP22 && EXPERIMENTAL && VIDEO_V4L1166154 select I2C_ALGO_SGI167155 help168156 Say Y here to build in support for the Vino video input system found···170158171159config VIDEO_STRADIS172160 tristate "Stradis 4:2:2 MPEG-2 video driver (EXPERIMENTAL)"173173- depends on EXPERIMENTAL && VIDEO_DEV && PCI161161+ depends on EXPERIMENTAL && PCI && VIDEO_V4L1 && !PPC64174162 help175163 Say Y here to enable support for the Stradis 4:2:2 MPEG-2 video176164 driver for PCI. There is a product page at···178166179167config VIDEO_ZORAN180168 tristate "Zoran ZR36057/36067 Video For Linux"181181- depends on VIDEO_DEV && PCI && I2C_ALGOBIT169169+ depends on PCI && I2C_ALGOBIT && VIDEO_V4L1 && !PPC64182170 help183171 Say Y for support for MJPEG capture cards based on the Zoran184172 36057/36067 PCI controller chipset. This includes the Iomega···226214227215config VIDEO_ZR36120228216 tristate "Zoran ZR36120/36125 Video For Linux"229229- depends on VIDEO_DEV && PCI && I2C && BROKEN217217+ depends on PCI && I2C && VIDEO_V4L1 && BROKEN230218 help231219 Support for ZR36120/ZR36125 based frame grabber/overlay boards.232220 This includes the Victor II, WaveWatcher, Video Wonder, Maxi-TV,···238226239227config VIDEO_MEYE240228 tristate "Sony Vaio Picturebook Motion Eye Video For Linux"241241- depends on VIDEO_DEV && PCI && SONYPI229229+ depends on PCI && SONYPI && VIDEO_V4L1242230 ---help---243231 This is the video4linux driver for the Motion Eye camera found244232 in the Vaio Picturebook laptops. Please read the material in···254242255243config VIDEO_MXB256244 tristate "Siemens-Nixdorf 'Multimedia eXtension Board'"257257- depends on VIDEO_DEV && PCI245245+ depends on PCI && VIDEO_V4L1258246 select VIDEO_SAA7146_VV259247 select VIDEO_TUNER260248 ---help---···266254267255config VIDEO_DPC268256 tristate "Philips-Semiconductors 'dpc7146 demonstration board'"269269- depends on VIDEO_DEV && PCI257257+ depends on PCI && VIDEO_V4L1270258 select VIDEO_SAA7146_VV259259+ select VIDEO_V4L2271260 ---help---272261 This is a video4linux driver for the 'dpc7146 demonstration273262 board' by Philips-Semiconductors. It's the reference design···281268282269config VIDEO_HEXIUM_ORION283270 tristate "Hexium HV-PCI6 and Orion frame grabber"284284- depends on VIDEO_DEV && PCI271271+ depends on PCI && VIDEO_V4L1285272 select VIDEO_SAA7146_VV273273+ select VIDEO_V4L2286274 ---help---287275 This is a video4linux driver for the Hexium HV-PCI6 and288276 Orion frame grabber cards by Hexium.···293279294280config VIDEO_HEXIUM_GEMINI295281 tristate "Hexium Gemini frame grabber"296296- depends on VIDEO_DEV && PCI282282+ depends on PCI && VIDEO_V4L1297283 select VIDEO_SAA7146_VV284284+ select VIDEO_V4L2298285 ---help---299286 This is a video4linux driver for the Hexium Gemini frame300287 grabber card by Hexium. Please note that the Gemini Dual···308293309294config VIDEO_OVCAMCHIP310295 tristate "OmniVision Camera Chip support"311311- depends on VIDEO_DEV && I2C296296+ depends on I2C && VIDEO_V4L1312297 ---help---313298 Support for the OmniVision OV6xxx and OV7xxx series of camera chips.314299 This driver is intended to be used with the ov511 and w9968cf USB···319304320305config VIDEO_M32R_AR321306 tristate "AR devices"322322- depends on M32R307307+ depends on M32R && VIDEO_V4L1323308 ---help---324309 This is a video4linux driver for the Renesas AR (Artificial Retina)325310 camera module.···380365source "drivers/media/video/cx25840/Kconfig"381366382367config VIDEO_SAA711X383383- tristate "Philips SAA7113/4/5 video decoders"384384- depends on VIDEO_DEV && I2C && EXPERIMENTAL368368+ tristate "Philips SAA7113/4/5 video decoders (OBSOLETED)"369369+ depends on VIDEO_V4L1 && I2C && EXPERIMENTAL385370 ---help---386386- Support for the Philips SAA7113/4/5 video decoders.371371+ Old support for the Philips SAA7113/4 video decoders.387372388373 To compile this driver as a module, choose M here: the389374 module will be called saa7115.390375391376config VIDEO_SAA7127392377 tristate "Philips SAA7127/9 digital video encoders"393393- depends on VIDEO_DEV && I2C && EXPERIMENTAL378378+ depends on VIDEO_V4L2 && I2C && EXPERIMENTAL394379 ---help---395380 Support for the Philips SAA7127/9 digital video encoders.396381···399384400385config VIDEO_UPD64031A401386 tristate "NEC Electronics uPD64031A Ghost Reduction"402402- depends on VIDEO_DEV && I2C && EXPERIMENTAL387387+ depends on VIDEO_V4L2 && I2C && EXPERIMENTAL403388 ---help---404389 Support for the NEC Electronics uPD64031A Ghost Reduction405390 video chip. It is most often found in NTSC TV cards made for···411396412397config VIDEO_UPD64083413398 tristate "NEC Electronics uPD64083 3-Dimensional Y/C separation"414414- depends on VIDEO_DEV && I2C && EXPERIMENTAL399399+ depends on VIDEO_V4L2 && I2C && EXPERIMENTAL415400 ---help---416401 Support for the NEC Electronics uPD64083 3-Dimensional Y/C417402 separation video chip. It is used to improve the quality of···433418434419config USB_DSBR435420 tristate "D-Link USB FM radio support (EXPERIMENTAL)"436436- depends on USB && VIDEO_DEV && EXPERIMENTAL421421+ depends on USB && VIDEO_V4L1 && EXPERIMENTAL437422 ---help---438423 Say Y here if you want to connect this type of radio to your439424 computer's USB port. Note that the audio is not digital, and···449434450435config USB_OV511451436 tristate "USB OV511 Camera support"452452- depends on USB && VIDEO_DEV437437+ depends on USB && VIDEO_V4L1453438 ---help---454439 Say Y here if you want to connect this type of camera to your455440 computer's USB port. See <file:Documentation/video4linux/ov511.txt>···460445461446config USB_SE401462447 tristate "USB SE401 Camera support"463463- depends on USB && VIDEO_DEV448448+ depends on USB && VIDEO_V4L1464449 ---help---465450 Say Y here if you want to connect this type of camera to your466451 computer's USB port. See <file:Documentation/video4linux/se401.txt>···473458474459config USB_STV680475460 tristate "USB STV680 (Pencam) Camera support"476476- depends on USB && VIDEO_DEV461461+ depends on USB && VIDEO_V4L1477462 ---help---478463 Say Y here if you want to connect this type of camera to your479464 computer's USB port. This includes the Pencam line of cameras.···485470486471config USB_W9968CF487472 tristate "USB W996[87]CF JPEG Dual Mode Camera support"488488- depends on USB && VIDEO_DEV && I2C473473+ depends on USB && VIDEO_V4L1 && I2C489474 select VIDEO_OVCAMCHIP490475 ---help---491476 Say Y here if you want support for cameras based on OV681 or
···2991299129922992 if (UNSET != audiomux[0]) {29932993 gpiobits = 0;29942994- for (i = 0; i < 5; i++) {29942994+ for (i = 0; i < 4; i++) {29952995 bttv_tvcards[btv->c.type].gpiomux[i] = audiomux[i];29962996 gpiobits |= audiomux[i];29972997 }29982998 } else {29992999 gpiobits = audioall;30003000- for (i = 0; i < 5; i++) {30003000+ for (i = 0; i < 4; i++) {30013001 bttv_tvcards[btv->c.type].gpiomux[i] = audioall;30023002 }30033003 }
···146146 fields++;147147148148 /* estimate risc mem: worst case is one write per page border +149149- one write per scan line + syncs + jump (all 2 dwords) */150150- instructions = (bpl * lines * fields) / PAGE_SIZE + lines * fields;151151- instructions += 3 + 4;149149+ one write per scan line + syncs + jump (all 2 dwords). Padding150150+ can cause next bpl to start close to a page border. First DMA151151+ region may be smaller than PAGE_SIZE */152152+ instructions = fields * (1 + ((bpl + padding) * lines) / PAGE_SIZE + lines);153153+ instructions += 2;152154 if ((rc = btcx_riscmem_alloc(pci,risc,instructions*8)) < 0)153155 return rc;154156···178176 int rc;179177180178 /* estimate risc mem: worst case is one write per page border +181181- one write per scan line + syncs + jump (all 2 dwords) */182182- instructions = (bpl * lines) / PAGE_SIZE + lines;183183- instructions += 3 + 4;179179+ one write per scan line + syncs + jump (all 2 dwords). Here180180+ there is no padding and no sync. First DMA region may be smaller181181+ than PAGE_SIZE */182182+ instructions = 1 + (bpl * lines) / PAGE_SIZE + lines;183183+ instructions += 1;184184 if ((rc = btcx_riscmem_alloc(pci,risc,instructions*8)) < 0)185185 return rc;186186
···3535#include "cx88.h"3636#include <media/v4l2-common.h>37373838+#ifdef CONFIG_VIDEO_V4L1_COMPAT3839/* Include V4L1 specific functions. Should be removed soon */3940#include <linux/videodev.h>4141+#endif40424143MODULE_DESCRIPTION("v4l2 driver module for cx2388x based TV cards");4244MODULE_AUTHOR("Gerd Knorr <kraxel@bytesex.org> [SuSE Labs]");
+1-1
drivers/media/video/em28xx/Kconfig
···11config VIDEO_EM28XX22 tristate "Empia EM2800/2820/2840 USB video capture support"33- depends on VIDEO_DEV && USB && I2C33+ depends on VIDEO_V4L1 && USB && I2C44 select VIDEO_BUF55 select VIDEO_TUNER66 select VIDEO_TVEEPROM
···11config USB_ET61X25122 tristate "USB ET61X[12]51 PC Camera Controller support"33- depends on USB && VIDEO_DEV33+ depends on USB && VIDEO_V4L144 ---help---55 Say Y here if you want support for cameras based on Etoms ET61X15166 or ET61X251 PC Camera Controllers.
+1-1
drivers/media/video/pwc/Kconfig
···11config USB_PWC22 tristate "USB Philips Cameras"33- depends on USB && VIDEO_DEV33+ depends on USB && VIDEO_V4L144 ---help---55 Say Y or M here if you want to use one of these Philips & OEM66 webcams:
···35043504 /* power-up tuner chip */35053505 saa_andorl(SAA7134_GPIO_GPMODE0 >> 2, 0x00040000, 0x00040000);35063506 saa_andorl(SAA7134_GPIO_GPSTATUS0 >> 2, 0x00040000, 0x00000000);35073507+ break;35073508 case SAA7134_BOARD_PINNACLE_300I_DVBT_PAL:35083509 /* this turns the remote control chip off to work around a bug in it */35093510 saa_writeb(SAA7134_GPIO_GPMODE1, 0x80);
+5-1
drivers/media/video/saa7134/saa7134-core.c
···548548 if (report & SAA7134_IRQ_REPORT_GPIO16) {549549 switch (dev->has_remote) {550550 case SAA7134_REMOTE_GPIO:551551+ if (!dev->remote)552552+ break;551553 if (dev->remote->mask_keydown & 0x10000) {552554 saa7134_input_irq(dev);553555 }···566564 if (report & SAA7134_IRQ_REPORT_GPIO18) {567565 switch (dev->has_remote) {568566 case SAA7134_REMOTE_GPIO:567567+ if (!dev->remote)568568+ break;569569 if ((dev->remote->mask_keydown & 0x40000) ||570570 (dev->remote->mask_keyup & 0x40000)) {571571 saa7134_input_irq(dev);···680676 SAA7134_IRQ2_INTE_PE |681677 SAA7134_IRQ2_INTE_AR;682678683683- if (dev->has_remote == SAA7134_REMOTE_GPIO) {679679+ if (dev->has_remote == SAA7134_REMOTE_GPIO && dev->remote) {684680 if (dev->remote->mask_keydown & 0x10000)685681 irq2_mask |= SAA7134_IRQ2_INTE_GPIO16;686682 else if (dev->remote->mask_keydown & 0x40000)
+2
drivers/media/video/saa7134/saa7134-video.c
···3131#include "saa7134.h"3232#include <media/v4l2-common.h>33333434+#ifdef CONFIG_VIDEO_V4L1_COMPAT3435/* Include V4L1 specific functions. Should be removed soon */3536#include <linux/videodev.h>3737+#endif36383739/* ------------------------------------------------------------------ */3840
+1-1
drivers/media/video/sn9c102/Kconfig
···11config USB_SN9C10222 tristate "USB SN9C10x PC Camera Controller support"33- depends on USB && VIDEO_DEV33+ depends on USB && VIDEO_V4L144 ---help---55 Say Y here if you want support for cameras based on SONiX SN9C101,66 SN9C102 or SN9C103 PC Camera Controllers.
···3344config USB_VICAM55 tristate "USB 3com HomeConnect (aka vicam) support (EXPERIMENTAL)"66- depends on USB && VIDEO_DEV && EXPERIMENTAL66+ depends on USB && VIDEO_V4L1 && EXPERIMENTAL77 select VIDEO_USBVIDEO88 ---help---99 Say Y here if you have 3com homeconnect camera (vicam).···13131414config USB_IBMCAM1515 tristate "USB IBM (Xirlink) C-it Camera support"1616- depends on USB && VIDEO_DEV1616+ depends on USB && VIDEO_V4L11717 select VIDEO_USBVIDEO1818 ---help---1919 Say Y here if you want to connect a IBM "C-It" camera, also known as···28282929config USB_KONICAWC3030 tristate "USB Konica Webcam support"3131- depends on USB && VIDEO_DEV3131+ depends on USB && VIDEO_V4L13232 select VIDEO_USBVIDEO3333 ---help---3434 Say Y here if you want support for webcams based on a Konica
+5
drivers/media/video/vivi.c
···2626#include <linux/random.h>2727#include <linux/version.h>2828#include <linux/videodev2.h>2929+#include <linux/dma-mapping.h>3030+#ifdef CONFIG_VIDEO_V4L1_COMPAT3131+/* Include V4L1 specific functions. Should be removed soon */3232+#include <linux/videodev.h>3333+#endif2934#include <linux/interrupt.h>3035#include <media/video-buf.h>3136#include <media/v4l2-common.h>
+1-1
drivers/media/video/zc0301/Kconfig
···11config USB_ZC030122 tristate "USB ZC0301 Image Processor and Control Chip support"33- depends on USB && VIDEO_DEV33+ depends on USB && VIDEO_V4L144 ---help---55 Say Y here if you want support for cameras based on the ZC030166 Image Processor and Control Chip.
···28912891 goto out_drain;28922892 }2893289328942894- if (np->msi_flags & NV_MSI_X_CAPABLE) {28952895- for (i = 0; i < (np->msi_flags & NV_MSI_X_VECTORS_MASK); i++) {28962896- np->msi_x_entry[i].entry = i;28972897- }28982898- if ((ret = pci_enable_msix(np->pci_dev, np->msi_x_entry, (np->msi_flags & NV_MSI_X_VECTORS_MASK))) == 0) {28992899- np->msi_flags |= NV_MSI_X_ENABLED;29002900- if (optimization_mode == NV_OPTIMIZATION_MODE_THROUGHPUT) {29012901- /* Request irq for rx handling */29022902- if (request_irq(np->msi_x_entry[NV_MSI_X_VECTOR_RX].vector, &nv_nic_irq_rx, SA_SHIRQ, dev->name, dev) != 0) {29032903- printk(KERN_INFO "forcedeth: request_irq failed for rx %d\n", ret);29042904- pci_disable_msix(np->pci_dev);29052905- np->msi_flags &= ~NV_MSI_X_ENABLED;29062906- goto out_drain;29072907- }29082908- /* Request irq for tx handling */29092909- if (request_irq(np->msi_x_entry[NV_MSI_X_VECTOR_TX].vector, &nv_nic_irq_tx, SA_SHIRQ, dev->name, dev) != 0) {29102910- printk(KERN_INFO "forcedeth: request_irq failed for tx %d\n", ret);29112911- pci_disable_msix(np->pci_dev);29122912- np->msi_flags &= ~NV_MSI_X_ENABLED;29132913- goto out_drain;29142914- }29152915- /* Request irq for link and timer handling */29162916- if (request_irq(np->msi_x_entry[NV_MSI_X_VECTOR_OTHER].vector, &nv_nic_irq_other, SA_SHIRQ, dev->name, dev) != 0) {29172917- printk(KERN_INFO "forcedeth: request_irq failed for link %d\n", ret);29182918- pci_disable_msix(np->pci_dev);29192919- np->msi_flags &= ~NV_MSI_X_ENABLED;29202920- goto out_drain;29212921- }29222922-29232923- /* map interrupts to their respective vector */29242924- writel(0, base + NvRegMSIXMap0);29252925- writel(0, base + NvRegMSIXMap1);29262926- set_msix_vector_map(dev, NV_MSI_X_VECTOR_RX, NVREG_IRQ_RX_ALL);29272927- set_msix_vector_map(dev, NV_MSI_X_VECTOR_TX, NVREG_IRQ_TX_ALL);29282928- set_msix_vector_map(dev, NV_MSI_X_VECTOR_OTHER, NVREG_IRQ_OTHER);29292929- } else {29302930- /* Request irq for all interrupts */29312931- if (request_irq(np->msi_x_entry[NV_MSI_X_VECTOR_ALL].vector, &nv_nic_irq, SA_SHIRQ, dev->name, dev) != 0) {29322932- printk(KERN_INFO "forcedeth: request_irq failed %d\n", ret);29332933- pci_disable_msix(np->pci_dev);29342934- np->msi_flags &= ~NV_MSI_X_ENABLED;29352935- goto out_drain;29362936- }29372937-29382938- /* map interrupts to vector 0 */29392939- writel(0, base + NvRegMSIXMap0);29402940- writel(0, base + NvRegMSIXMap1);29412941- }29422942- }29432943- }29442944- if (ret != 0 && np->msi_flags & NV_MSI_CAPABLE) {29452945- if ((ret = pci_enable_msi(np->pci_dev)) == 0) {29462946- np->msi_flags |= NV_MSI_ENABLED;29472947- if (request_irq(np->pci_dev->irq, &nv_nic_irq, SA_SHIRQ, dev->name, dev) != 0) {29482948- printk(KERN_INFO "forcedeth: request_irq failed %d\n", ret);29492949- pci_disable_msi(np->pci_dev);29502950- np->msi_flags &= ~NV_MSI_ENABLED;29512951- goto out_drain;29522952- }29532953-29542954- /* map interrupts to vector 0 */29552955- writel(0, base + NvRegMSIMap0);29562956- writel(0, base + NvRegMSIMap1);29572957- /* enable msi vector 0 */29582958- writel(NVREG_MSI_VECTOR_0_ENABLED, base + NvRegMSIIrqMask);29592959- }29602960- }29612961- if (ret != 0) {29622962- if (request_irq(np->pci_dev->irq, &nv_nic_irq, SA_SHIRQ, dev->name, dev) != 0)29632963- goto out_drain;29642964- }29652965-29662894 /* ask for interrupts */29672895 nv_enable_hw_interrupts(dev, np->irqmask);29682896
+9-4
drivers/net/ixp2000/enp2611.c
···149149 int status;150150151151 dev = nds[i];152152+ if (dev == NULL)153153+ continue;152154153155 status = pm3386_is_link_up(i);154156 if (status && !netif_carrier_ok(dev)) {···193191194192static int __init enp2611_init_module(void)195193{ 194194+ int ports;196195 int i;197196198197 if (!machine_is_enp2611())···202199 caleb_reset();203200 pm3386_reset();204201205205- for (i = 0; i < 3; i++) {202202+ ports = pm3386_port_count();203203+ for (i = 0; i < ports; i++) {206204 nds[i] = ixpdev_alloc(i, sizeof(struct enp2611_ixpdev_priv));207205 if (nds[i] == NULL) {208206 while (--i >= 0)···219215220216 ixp2400_msf_init(&enp2611_msf_parameters);221217222222- if (ixpdev_init(3, nds, enp2611_set_port_admin_status)) {223223- for (i = 0; i < 3; i++)224224- free_netdev(nds[i]);218218+ if (ixpdev_init(ports, nds, enp2611_set_port_admin_status)) {219219+ for (i = 0; i < ports; i++)220220+ if (nds[i])221221+ free_netdev(nds[i]);225222 return -EINVAL;226223 }227224
+24-6
drivers/net/ixp2000/pm3386.c
···8686 pm3386_reg_write(port >> 1, reg, value);8787}88888989+int pm3386_secondary_present(void)9090+{9191+ return pm3386_reg_read(1, 0) == 0x3386;9292+}89939094void pm3386_reset(void)9195{9296 u8 mac[3][6];9797+ int secondary;9898+9999+ secondary = pm3386_secondary_present();9310094101 /* Save programmed MAC addresses. */95102 pm3386_get_mac(0, mac[0]);96103 pm3386_get_mac(1, mac[1]);9797- pm3386_get_mac(2, mac[2]);104104+ if (secondary)105105+ pm3386_get_mac(2, mac[2]);9810699107 /* Assert analog and digital reset. */100108 pm3386_reg_write(0, 0x002, 0x0060);101101- pm3386_reg_write(1, 0x002, 0x0060);109109+ if (secondary)110110+ pm3386_reg_write(1, 0x002, 0x0060);102111 mdelay(1);103112104113 /* Deassert analog reset. */105114 pm3386_reg_write(0, 0x002, 0x0062);106106- pm3386_reg_write(1, 0x002, 0x0062);115115+ if (secondary)116116+ pm3386_reg_write(1, 0x002, 0x0062);107117 mdelay(10);108118109119 /* Deassert digital reset. */110120 pm3386_reg_write(0, 0x002, 0x0063);111111- pm3386_reg_write(1, 0x002, 0x0063);121121+ if (secondary)122122+ pm3386_reg_write(1, 0x002, 0x0063);112123 mdelay(10);113124114125 /* Restore programmed MAC addresses. */115126 pm3386_set_mac(0, mac[0]);116127 pm3386_set_mac(1, mac[1]);117117- pm3386_set_mac(2, mac[2]);128128+ if (secondary)129129+ pm3386_set_mac(2, mac[2]);118130119131 /* Disable carrier on all ports. */120132 pm3386_set_carrier(0, 0);121133 pm3386_set_carrier(1, 0);122122- pm3386_set_carrier(2, 0);134134+ if (secondary)135135+ pm3386_set_carrier(2, 0);123136}124137125138static u16 swaph(u16 x)126139{127140 return ((x << 8) | (x >> 8)) & 0xffff;141141+}142142+143143+int pm3386_port_count(void)144144+{145145+ return 2 + pm3386_secondary_present();128146}129147130148void pm3386_init_port(int port)
···16911691 memset(ei_local->mcfilter, 0xFF, 8);16921692 }1693169316941694- /* 16951695- * DP8390 manuals don't specify any magic sequence for altering16961696- * the multicast regs on an already running card. To be safe, we16971697- * ensure multicast mode is off prior to loading up the new hash16981698- * table. If this proves to be not enough, we can always resort16991699- * to stopping the NIC, loading the table and then restarting.17001700- */17011701-17021702- if (netif_running(dev))17031703- outb_p(E8390_RXCONFIG, e8390_base + EN0_RXCR);17041704-17051694 outb_p(E8390_NODMA + E8390_PAGE1, e8390_base + E8390_CMD);17061695 for(i = 0; i < 8; i++) 17071696 {···17041715 outb_p(E8390_RXCONFIG | 0x48, e8390_base + EN0_RXCR);17051716 else17061717 outb_p(E8390_RXCONFIG | 0x40, e8390_base + EN0_RXCR);17181718+17191719+ outb_p(E8390_NODMA+E8390_PAGE0+E8390_START, e8390_base+E8390_CMD);17071720}1708172117091722/*
···850850 break;851851 skb->dev = dev; /* Mark as being used by this device. */852852 np->rx_addr[i] = pci_map_single(np->pci_dev,skb->data,853853- skb->len,PCI_DMA_FROMDEVICE);853853+ np->rx_buf_sz,PCI_DMA_FROMDEVICE);854854855855 np->rx_ring[i].buffer1 = np->rx_addr[i];856856 np->rx_ring[i].status = DescOwn;···13161316 skb->dev = dev; /* Mark as being used by this device. */13171317 np->rx_addr[entry] = pci_map_single(np->pci_dev,13181318 skb->data,13191319- skb->len, PCI_DMA_FROMDEVICE);13191319+ np->rx_buf_sz, PCI_DMA_FROMDEVICE);13201320 np->rx_ring[entry].buffer1 = np->rx_addr[entry];13211321 }13221322 wmb();
+3-31
drivers/net/via-rhine.c
···491491 u8 tx_thresh, rx_thresh;492492493493 struct mii_if_info mii_if;494494- struct work_struct tx_timeout_task;495495- struct work_struct check_media_task;496494 void __iomem *base;497495};498496···498500static void mdio_write(struct net_device *dev, int phy_id, int location, int value);499501static int rhine_open(struct net_device *dev);500502static void rhine_tx_timeout(struct net_device *dev);501501-static void rhine_tx_timeout_task(struct net_device *dev);502502-static void rhine_check_media_task(struct net_device *dev);503503static int rhine_start_tx(struct sk_buff *skb, struct net_device *dev);504504static irqreturn_t rhine_interrupt(int irq, void *dev_instance, struct pt_regs *regs);505505static void rhine_tx(struct net_device *dev);···852856 if (rp->quirks & rqRhineI)853857 dev->features |= NETIF_F_SG|NETIF_F_HW_CSUM;854858855855- INIT_WORK(&rp->tx_timeout_task,856856- (void (*)(void *))rhine_tx_timeout_task, dev);857857-858858- INIT_WORK(&rp->check_media_task,859859- (void (*)(void *))rhine_check_media_task, dev);860860-861859 /* dev->name not defined before register_netdev()! */862860 rc = register_netdev(dev);863861 if (rc)···10981108 netif_carrier_ok(mii->dev));10991109}1100111011011101-static void rhine_check_media_task(struct net_device *dev)11021102-{11031103- rhine_check_media(dev, 0);11041104-}11051105-11061111static void init_registers(struct net_device *dev)11071112{11081113 struct rhine_private *rp = netdev_priv(dev);···11511166 if (quirks & rqRhineI) {11521167 iowrite8(0x01, ioaddr + MIIRegAddr); // MII_BMSR1153116811541154- /* Do not call from ISR! */11551155- msleep(1);11691169+ /* Can be called from ISR. Evil. */11701170+ mdelay(1);1156117111571172 /* 0x80 must be set immediately before turning it off */11581173 iowrite8(0x80, ioaddr + MIICmd);···12401255}1241125612421257static void rhine_tx_timeout(struct net_device *dev)12431243-{12441244- struct rhine_private *rp = netdev_priv(dev);12451245-12461246- /*12471247- * Move bulk of work outside of interrupt context12481248- */12491249- schedule_work(&rp->tx_timeout_task);12501250-}12511251-12521252-static void rhine_tx_timeout_task(struct net_device *dev)12531258{12541259 struct rhine_private *rp = netdev_priv(dev);12551260 void __iomem *ioaddr = rp->base;···16521677 spin_lock(&rp->lock);1653167816541679 if (intr_status & IntrLinkChange)16551655- schedule_work(&rp->check_media_task);16801680+ rhine_check_media(dev, 0);16561681 if (intr_status & IntrStatsMax) {16571682 rp->stats.rx_crc_errors += ioread16(ioaddr + RxCRCErrs);16581683 rp->stats.rx_missed_errors += ioread16(ioaddr + RxMissed);···19021927 spin_unlock_irq(&rp->lock);1903192819041929 free_irq(rp->pdev->irq, dev);19051905-19061906- flush_scheduled_work();19071907-19081930 free_rbufs(dev);19091931 free_tbufs(dev);19101932 free_ring(dev);
+3-3
drivers/net/wireless/bcm43xx/bcm43xx_main.c
···32713271 bcm43xx_sysfs_register(bcm);32723272 //FIXME: check for bcm43xx_sysfs_register failure. This function is a bit messy regarding unwinding, though...3273327332743274+ /*FIXME: This should be handled by softmac instead. */32753275+ schedule_work(&bcm->softmac->associnfo.work);32763276+32743277 assert(err == 0);32753278out:32763279 return err;···3949394639503947 netif_device_attach(net_dev);3951394839523952- /*FIXME: This should be handled by softmac instead. */39533953- schedule_work(&bcm->softmac->associnfo.work);39543954-39553949 dprintk(KERN_INFO PFX "Device resumed.\n");3956395039573951 return 0;
+1-3
drivers/net/wireless/orinoco.c
···812812 if (datalen > IEEE80211_DATA_LEN + 12) {813813 printk(KERN_DEBUG "%s: oversized monitor frame, "814814 "data length = %d\n", dev->name, datalen);815815- err = -EIO;816815 stats->rx_length_errors++;817816 goto update_stats;818817 }···820821 if (!skb) {821822 printk(KERN_WARNING "%s: Cannot allocate skb for monitor frame\n",822823 dev->name);823823- err = -ENOMEM;824824- goto drop;824824+ goto update_stats;825825 }826826827827 /* Copy the 802.11 header to the skb */
+35-25
drivers/pci/pci-acpi.c
···3333 acpi_status status;3434 struct acpi_object_list input;3535 union acpi_object in_params[4];3636- struct acpi_buffer output;3737- union acpi_object out_obj; 3636+ struct acpi_buffer output = {ACPI_ALLOCATE_BUFFER, NULL};3737+ union acpi_object *out_obj;3838 u32 osc_dw0;39394040- /* Setting up output buffer */4141- output.length = sizeof(out_obj) + 3*sizeof(u32); 4242- output.pointer = &out_obj;43404441 /* Setting up input parameters */4542 input.count = 4;···5861 "Evaluate _OSC Set fails. Status = 0x%04x\n", status);5962 return status;6063 }6161- if (out_obj.type != ACPI_TYPE_BUFFER) {6464+ out_obj = output.pointer;6565+6666+ if (out_obj->type != ACPI_TYPE_BUFFER) {6267 printk(KERN_DEBUG 6368 "Evaluate _OSC returns wrong type\n");6464- return AE_TYPE;6969+ status = AE_TYPE;7070+ goto query_osc_out;6571 }6666- osc_dw0 = *((u32 *) out_obj.buffer.pointer);7272+ osc_dw0 = *((u32 *) out_obj->buffer.pointer);6773 if (osc_dw0) {6874 if (osc_dw0 & OSC_REQUEST_ERROR)6975 printk(KERN_DEBUG "_OSC request fails\n"); ···7676 printk(KERN_DEBUG "_OSC invalid revision\n"); 7777 if (osc_dw0 & OSC_CAPABILITIES_MASK_ERROR) {7878 /* Update Global Control Set */7979- global_ctrlsets = *((u32 *)(out_obj.buffer.pointer+8));8080- return AE_OK;7979+ global_ctrlsets = *((u32 *)(out_obj->buffer.pointer+8));8080+ status = AE_OK;8181+ goto query_osc_out;8182 }8282- return AE_ERROR;8383+ status = AE_ERROR;8484+ goto query_osc_out;8385 }84868587 /* Update Global Control Set */8686- global_ctrlsets = *((u32 *)(out_obj.buffer.pointer + 8));8787- return AE_OK;8888+ global_ctrlsets = *((u32 *)(out_obj->buffer.pointer + 8));8989+ status = AE_OK;9090+9191+query_osc_out:9292+ kfree(output.pointer);9393+ return status;8894}89959096···10296 acpi_status status;10397 struct acpi_object_list input;10498 union acpi_object in_params[4];105105- struct acpi_buffer output;106106- union acpi_object out_obj; 9999+ struct acpi_buffer output = {ACPI_ALLOCATE_BUFFER, NULL};100100+ union acpi_object *out_obj;107101 u32 osc_dw0;108102109109- /* Setting up output buffer */110110- output.length = sizeof(out_obj) + 3*sizeof(u32); 111111- output.pointer = &out_obj;112112-113103 /* Setting up input parameters */114104 input.count = 4;115105 input.pointer = in_params;···126124 "Evaluate _OSC Set fails. Status = 0x%04x\n", status);127125 return status;128126 }129129- if (out_obj.type != ACPI_TYPE_BUFFER) {127127+ out_obj = output.pointer;128128+ if (out_obj->type != ACPI_TYPE_BUFFER) {130129 printk(KERN_DEBUG 131130 "Evaluate _OSC returns wrong type\n");132132- return AE_TYPE;131131+ status = AE_TYPE;132132+ goto run_osc_out;133133 }134134- osc_dw0 = *((u32 *) out_obj.buffer.pointer);134134+ osc_dw0 = *((u32 *) out_obj->buffer.pointer);135135 if (osc_dw0) {136136 if (osc_dw0 & OSC_REQUEST_ERROR)137137 printk(KERN_DEBUG "_OSC request fails\n"); ···143139 printk(KERN_DEBUG "_OSC invalid revision\n"); 144140 if (osc_dw0 & OSC_CAPABILITIES_MASK_ERROR) {145141 printk(KERN_DEBUG "_OSC FW not grant req. control\n");146146- return AE_SUPPORT;142142+ status = AE_SUPPORT;143143+ goto run_osc_out;147144 }148148- return AE_ERROR;145145+ status = AE_ERROR;146146+ goto run_osc_out;149147 }150150- return AE_OK;148148+ status = AE_OK;149149+150150+run_osc_out:151151+ kfree(output.pointer);152152+ return status;151153}152154153155/**
+15-1
drivers/pci/quirks.c
···634634 * non-x86 architectures (yes Via exists on PPC among other places),635635 * we must mask the PCI_INTERRUPT_LINE value versus 0xf to get636636 * interrupts delivered properly.637637+ *638638+ * Some of the on-chip devices are actually '586 devices' so they are639639+ * listed here.637640 */638641static void quirk_via_irq(struct pci_dev *dev)639642{···651648 pci_write_config_byte(dev, PCI_INTERRUPT_LINE, new_irq);652649 }653650}651651+DECLARE_PCI_FIXUP_ENABLE(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_82C586_0, quirk_via_irq);652652+DECLARE_PCI_FIXUP_ENABLE(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_82C586_1, quirk_via_irq);653653+DECLARE_PCI_FIXUP_ENABLE(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_82C586_2, quirk_via_irq);654654+DECLARE_PCI_FIXUP_ENABLE(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_82C586_3, quirk_via_irq);654655DECLARE_PCI_FIXUP_ENABLE(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_82C686, quirk_via_irq);655656DECLARE_PCI_FIXUP_ENABLE(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_82C686_4, quirk_via_irq);656657DECLARE_PCI_FIXUP_ENABLE(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_82C686_5, quirk_via_irq);···902895}903896DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_8237, k8t_sound_hostbridge);904897898898+#ifndef CONFIG_ACPI_SLEEP905899/*906900 * On ASUS P4B boards, the SMBus PCI Device within the ICH2/4 southbridge907901 * is not activated. The myth is that Asus said that they do not want the···914906 * bridge. Unfortunately, this device has no subvendor/subdevice ID. So it 915907 * becomes necessary to do this tweak in two steps -- I've chosen the Host916908 * bridge as trigger.909909+ *910910+ * Actually, leaving it unhidden and not redoing the quirk over suspend2ram911911+ * will cause thermal management to break down, and causing machine to912912+ * overheat.917913 */918918-static int __initdata asus_hides_smbus = 0;914914+static int __initdata asus_hides_smbus;919915920916static void __init asus_hides_smbus_hostbridge(struct pci_dev *dev)921917{···10611049 printk(KERN_INFO "PCI: Enabled ICH6/i801 SMBus device\n");10621050}10631051DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ICH6_1, asus_hides_smbus_lpc_ich6 );10521052+10531053+#endif1064105410651055/*10661056 * SiS 96x south bridge: BIOS typically hides SMBus device...
+16-7
drivers/pcmcia/pcmcia_ioctl.c
···426426427427 if (!warning_printed) {428428 printk(KERN_INFO "pcmcia: Detected deprecated PCMCIA ioctl "429429- "usage.\n");429429+ "usage from process: %s.\n", current->comm);430430 printk(KERN_INFO "pcmcia: This interface will soon be removed from "431431 "the kernel; please expect breakage unless you upgrade "432432 "to new tools.\n");···601601 ret = CS_BAD_ARGS;602602 else {603603 struct pcmcia_device *p_dev = get_pcmcia_device(s, buf->config.Function);604604- ret = pccard_get_configuration_info(s, p_dev, &buf->config);605605- pcmcia_put_dev(p_dev);604604+ if (p_dev == NULL)605605+ ret = CS_BAD_ARGS;606606+ else {607607+ ret = pccard_get_configuration_info(s, p_dev, &buf->config);608608+ pcmcia_put_dev(p_dev);609609+ }606610 }607611 break;608612 case DS_GET_FIRST_TUPLE:···636632 ret = CS_BAD_ARGS;637633 else {638634 struct pcmcia_device *p_dev = get_pcmcia_device(s, buf->status.Function);639639- ret = pccard_get_status(s, p_dev, &buf->status);640640- pcmcia_put_dev(p_dev);635635+ if (p_dev == NULL)636636+ ret = CS_BAD_ARGS;637637+ else {638638+ ret = pccard_get_status(s, p_dev, &buf->status);639639+ pcmcia_put_dev(p_dev);640640+ }641641 }642642 break;643643 case DS_VALIDATE_CIS:···673665 if (!(buf->conf_reg.Function &&674666 (buf->conf_reg.Function >= s->functions))) {675667 struct pcmcia_device *p_dev = get_pcmcia_device(s, buf->conf_reg.Function);676676- if (p_dev)668668+ if (p_dev) {677669 ret = pcmcia_access_configuration_register(p_dev, &buf->conf_reg);678678- pcmcia_put_dev(p_dev);670670+ pcmcia_put_dev(p_dev);671671+ }679672 }680673 break;681674 case DS_GET_FIRST_REGION:
···141141 /* try the driver's ioctl interface */142142 if (ops->ioctl) {143143 err = ops->ioctl(class_dev->dev, cmd, arg);144144- if (err != -EINVAL)144144+ if (err != -ENOIOCTLCMD)145145 return err;146146 }147147148148 /* if the driver does not provide the ioctl interface149149 * or if that particular ioctl was not implemented150150- * (-EINVAL), we will try to emulate here.150150+ * (-ENOIOCTLCMD), we will try to emulate here.151151 */152152153153 switch (cmd) {···233233 break;234234235235 default:236236- err = -EINVAL;236236+ err = -ENOTTY;237237 break;238238 }239239
···864864/**865865 * ata_port_queue_task - Queue port_task866866 * @ap: The ata_port to queue port_task for867867+ * @fn: workqueue function to be scheduled868868+ * @data: data value to pass to workqueue function869869+ * @delay: delay time for workqueue function867870 *868871 * Schedule @fn(@data) for execution after @delay jiffies using869872 * port_task. There is one port_task per port and it's the···27422739 * ata_dev_init_params - Issue INIT DEV PARAMS command27432740 * @ap: Port associated with device @dev27442741 * @dev: Device to which command will be sent27422742+ * @heads: Number of heads (taskfile parameter)27432743+ * @sectors: Number of sectors (taskfile parameter)27452744 *27462745 * LOCKING:27472746 * Kernel thread context (may sleep)···3643363836443639 ata_pio_sector(qc);36453640 }36413641+36423642+ ata_altstatus(ap); /* flush */36463643}3647364436483645static void ata_pio_error(struct ata_port *ap)···37613754 spin_lock_irqsave(&ap->host_set->lock, flags);37623755 ap->flags &= ~ATA_FLAG_NOINTR;37633756 ata_data_xfer(ap, qc->cdb, qc->dev->cdb_len, 1);37573757+ ata_altstatus(ap); /* flush */37583758+37643759 if (qc->tf.protocol == ATA_PROT_ATAPI_DMA)37653760 ap->ops->bmdma_start(qc); /* initiate bmdma */37663761 spin_unlock_irqrestore(&ap->host_set->lock, flags);37673762 } else {37683763 ata_data_xfer(ap, qc->cdb, qc->dev->cdb_len, 1);37643764+ ata_altstatus(ap); /* flush */3769376537703766 /* PIO commands are handled by polling */37713767 ap->hsm_task_state = HSM_ST;···43124302 * ata_device_suspend - prepare a device for suspend43134303 * @ap: port the device is connected to43144304 * @dev: the device to suspend43054305+ * @state: target power management state43154306 *43164307 * Flush the cache on the drive, if appropriate, then issue a43174308 * standbynow command.
+79-59
drivers/scsi/sata_mv.c
···3737#include <asm/io.h>38383939#define DRV_NAME "sata_mv"4040-#define DRV_VERSION "0.6"4040+#define DRV_VERSION "0.7"41414242enum {4343 /* BAR's are enumerated in terms of pci_resource_start() terms */···50505151 MV_PCI_REG_BASE = 0,5252 MV_IRQ_COAL_REG_BASE = 0x18000, /* 6xxx part only */5353+ MV_IRQ_COAL_CAUSE = (MV_IRQ_COAL_REG_BASE + 0x08),5454+ MV_IRQ_COAL_CAUSE_LO = (MV_IRQ_COAL_REG_BASE + 0x88),5555+ MV_IRQ_COAL_CAUSE_HI = (MV_IRQ_COAL_REG_BASE + 0x8c),5656+ MV_IRQ_COAL_THRESHOLD = (MV_IRQ_COAL_REG_BASE + 0xcc),5757+ MV_IRQ_COAL_TIME_THRESHOLD = (MV_IRQ_COAL_REG_BASE + 0xd0),5858+5359 MV_SATAHC0_REG_BASE = 0x20000,5460 MV_FLASH_CTL = 0x1046c,5561 MV_GPIO_PORT_CTL = 0x104f0,···308302 dma_addr_t crpb_dma;309303 struct mv_sg *sg_tbl;310304 dma_addr_t sg_tbl_dma;311311-312312- unsigned req_producer; /* cp of req_in_ptr */313313- unsigned rsp_consumer; /* cp of rsp_out_ptr */314305 u32 pp_flags;315306};316307···940937 writelfl(pp->crpb_dma & EDMA_RSP_Q_BASE_LO_MASK,941938 port_mmio + EDMA_RSP_Q_OUT_PTR_OFS);942939943943- pp->req_producer = pp->rsp_consumer = 0;944944-945940 /* Don't turn on EDMA here...do it before DMA commands only. Else946941 * we'll be unable to send non-data, PIO, etc due to restricted access947942 * to shadow regs.···10231022 }10241023}1025102410261026-static inline unsigned mv_inc_q_index(unsigned *index)10251025+static inline unsigned mv_inc_q_index(unsigned index)10271026{10281028- *index = (*index + 1) & MV_MAX_Q_DEPTH_MASK;10291029- return *index;10271027+ return (index + 1) & MV_MAX_Q_DEPTH_MASK;10301028}1031102910321030static inline void mv_crqb_pack_cmd(u16 *cmdw, u8 data, u8 addr, unsigned last)10331031{10341034- *cmdw = data | (addr << CRQB_CMD_ADDR_SHIFT) | CRQB_CMD_CS |10321032+ u16 tmp = data | (addr << CRQB_CMD_ADDR_SHIFT) | CRQB_CMD_CS |10351033 (last ? CRQB_CMD_LAST : 0);10341034+ *cmdw = cpu_to_le16(tmp);10361035}1037103610381037/**···10541053 u16 *cw;10551054 struct ata_taskfile *tf;10561055 u16 flags = 0;10561056+ unsigned in_index;1057105710581058 if (ATA_PROT_DMA != qc->tf.protocol)10591059 return;10601060-10611061- /* the req producer index should be the same as we remember it */10621062- WARN_ON(((readl(mv_ap_base(qc->ap) + EDMA_REQ_Q_IN_PTR_OFS) >>10631063- EDMA_REQ_Q_PTR_SHIFT) & MV_MAX_Q_DEPTH_MASK) !=10641064- pp->req_producer);1065106010661061 /* Fill in command request block10671062 */···10661069 WARN_ON(MV_MAX_Q_DEPTH <= qc->tag);10671070 flags |= qc->tag << CRQB_TAG_SHIFT;1068107110691069- pp->crqb[pp->req_producer].sg_addr =10701070- cpu_to_le32(pp->sg_tbl_dma & 0xffffffff);10711071- pp->crqb[pp->req_producer].sg_addr_hi =10721072- cpu_to_le32((pp->sg_tbl_dma >> 16) >> 16);10731073- pp->crqb[pp->req_producer].ctrl_flags = cpu_to_le16(flags);10721072+ /* get current queue index from hardware */10731073+ in_index = (readl(mv_ap_base(ap) + EDMA_REQ_Q_IN_PTR_OFS)10741074+ >> EDMA_REQ_Q_PTR_SHIFT) & MV_MAX_Q_DEPTH_MASK;1074107510751075- cw = &pp->crqb[pp->req_producer].ata_cmd[0];10761076+ pp->crqb[in_index].sg_addr =10771077+ cpu_to_le32(pp->sg_tbl_dma & 0xffffffff);10781078+ pp->crqb[in_index].sg_addr_hi =10791079+ cpu_to_le32((pp->sg_tbl_dma >> 16) >> 16);10801080+ pp->crqb[in_index].ctrl_flags = cpu_to_le16(flags);10811081+10821082+ cw = &pp->crqb[in_index].ata_cmd[0];10761083 tf = &qc->tf;1077108410781085 /* Sadly, the CRQB cannot accomodate all registers--there are···11451144 struct mv_port_priv *pp = ap->private_data;11461145 struct mv_crqb_iie *crqb;11471146 struct ata_taskfile *tf;11471147+ unsigned in_index;11481148 u32 flags = 0;1149114911501150 if (ATA_PROT_DMA != qc->tf.protocol)11511151 return;11521152-11531153- /* the req producer index should be the same as we remember it */11541154- WARN_ON(((readl(mv_ap_base(qc->ap) + EDMA_REQ_Q_IN_PTR_OFS) >>11551155- EDMA_REQ_Q_PTR_SHIFT) & MV_MAX_Q_DEPTH_MASK) !=11561156- pp->req_producer);1157115211581153 /* Fill in Gen IIE command request block11591154 */···11591162 WARN_ON(MV_MAX_Q_DEPTH <= qc->tag);11601163 flags |= qc->tag << CRQB_TAG_SHIFT;1161116411621162- crqb = (struct mv_crqb_iie *) &pp->crqb[pp->req_producer];11651165+ /* get current queue index from hardware */11661166+ in_index = (readl(mv_ap_base(ap) + EDMA_REQ_Q_IN_PTR_OFS)11671167+ >> EDMA_REQ_Q_PTR_SHIFT) & MV_MAX_Q_DEPTH_MASK;11681168+11691169+ crqb = (struct mv_crqb_iie *) &pp->crqb[in_index];11631170 crqb->addr = cpu_to_le32(pp->sg_tbl_dma & 0xffffffff);11641171 crqb->addr_hi = cpu_to_le32((pp->sg_tbl_dma >> 16) >> 16);11651172 crqb->flags = cpu_to_le32(flags);···12111210{12121211 void __iomem *port_mmio = mv_ap_base(qc->ap);12131212 struct mv_port_priv *pp = qc->ap->private_data;12131213+ unsigned in_index;12141214 u32 in_ptr;1215121512161216 if (ATA_PROT_DMA != qc->tf.protocol) {···12231221 return ata_qc_issue_prot(qc);12241222 }1225122312261226- in_ptr = readl(port_mmio + EDMA_REQ_Q_IN_PTR_OFS);12241224+ in_ptr = readl(port_mmio + EDMA_REQ_Q_IN_PTR_OFS);12251225+ in_index = (in_ptr >> EDMA_REQ_Q_PTR_SHIFT) & MV_MAX_Q_DEPTH_MASK;1227122612281228- /* the req producer index should be the same as we remember it */12291229- WARN_ON(((in_ptr >> EDMA_REQ_Q_PTR_SHIFT) & MV_MAX_Q_DEPTH_MASK) !=12301230- pp->req_producer);12311227 /* until we do queuing, the queue should be empty at this point */12321232- WARN_ON(((in_ptr >> EDMA_REQ_Q_PTR_SHIFT) & MV_MAX_Q_DEPTH_MASK) !=12331233- ((readl(port_mmio + EDMA_REQ_Q_OUT_PTR_OFS) >>12341234- EDMA_REQ_Q_PTR_SHIFT) & MV_MAX_Q_DEPTH_MASK));12281228+ WARN_ON(in_index != ((readl(port_mmio + EDMA_REQ_Q_OUT_PTR_OFS)12291229+ >> EDMA_REQ_Q_PTR_SHIFT) & MV_MAX_Q_DEPTH_MASK));1235123012361236- mv_inc_q_index(&pp->req_producer); /* now incr producer index */12311231+ in_index = mv_inc_q_index(in_index); /* now incr producer index */1237123212381233 mv_start_dma(port_mmio, pp);1239123412401235 /* and write the request in pointer to kick the EDMA to life */12411236 in_ptr &= EDMA_REQ_Q_BASE_LO_MASK;12421242- in_ptr |= pp->req_producer << EDMA_REQ_Q_PTR_SHIFT;12371237+ in_ptr |= in_index << EDMA_REQ_Q_PTR_SHIFT;12431238 writelfl(in_ptr, port_mmio + EDMA_REQ_Q_IN_PTR_OFS);1244123912451240 return 0;···12591260{12601261 void __iomem *port_mmio = mv_ap_base(ap);12611262 struct mv_port_priv *pp = ap->private_data;12631263+ unsigned out_index;12621264 u32 out_ptr;12631265 u8 ata_status;1264126612651265- out_ptr = readl(port_mmio + EDMA_RSP_Q_OUT_PTR_OFS);12671267+ out_ptr = readl(port_mmio + EDMA_RSP_Q_OUT_PTR_OFS);12681268+ out_index = (out_ptr >> EDMA_RSP_Q_PTR_SHIFT) & MV_MAX_Q_DEPTH_MASK;1266126912671267- /* the response consumer index should be the same as we remember it */12681268- WARN_ON(((out_ptr >> EDMA_RSP_Q_PTR_SHIFT) & MV_MAX_Q_DEPTH_MASK) !=12691269- pp->rsp_consumer);12701270-12711271- ata_status = pp->crpb[pp->rsp_consumer].flags >> CRPB_FLAG_STATUS_SHIFT;12701270+ ata_status = le16_to_cpu(pp->crpb[out_index].flags)12711271+ >> CRPB_FLAG_STATUS_SHIFT;1272127212731273 /* increment our consumer index... */12741274- pp->rsp_consumer = mv_inc_q_index(&pp->rsp_consumer);12741274+ out_index = mv_inc_q_index(out_index);1275127512761276 /* and, until we do NCQ, there should only be 1 CRPB waiting */12771277- WARN_ON(((readl(port_mmio + EDMA_RSP_Q_IN_PTR_OFS) >>12781278- EDMA_RSP_Q_PTR_SHIFT) & MV_MAX_Q_DEPTH_MASK) !=12791279- pp->rsp_consumer);12771277+ WARN_ON(out_index != ((readl(port_mmio + EDMA_RSP_Q_IN_PTR_OFS)12781278+ >> EDMA_RSP_Q_PTR_SHIFT) & MV_MAX_Q_DEPTH_MASK));1280127912811280 /* write out our inc'd consumer index so EDMA knows we're caught up */12821281 out_ptr &= EDMA_RSP_Q_BASE_LO_MASK;12831283- out_ptr |= pp->rsp_consumer << EDMA_RSP_Q_PTR_SHIFT;12821282+ out_ptr |= out_index << EDMA_RSP_Q_PTR_SHIFT;12841283 writelfl(out_ptr, port_mmio + EDMA_RSP_Q_OUT_PTR_OFS);1285128412861285 /* Return ATA status register for completed CRPB */···12881291/**12891292 * mv_err_intr - Handle error interrupts on the port12901293 * @ap: ATA channel to manipulate12941294+ * @reset_allowed: bool: 0 == don't trigger from reset here12911295 *12921296 * In most cases, just clear the interrupt and move on. However,12931297 * some cases require an eDMA reset, which is done right before···12991301 * LOCKING:13001302 * Inherited from caller.13011303 */13021302-static void mv_err_intr(struct ata_port *ap)13041304+static void mv_err_intr(struct ata_port *ap, int reset_allowed)13031305{13041306 void __iomem *port_mmio = mv_ap_base(ap);13051307 u32 edma_err_cause, serr = 0;···13211323 writelfl(0, port_mmio + EDMA_ERR_IRQ_CAUSE_OFS);1322132413231325 /* check for fatal here and recover if needed */13241324- if (EDMA_ERR_FATAL & edma_err_cause) {13261326+ if (reset_allowed && (EDMA_ERR_FATAL & edma_err_cause))13251327 mv_stop_and_reset(ap);13261326- }13271328}1328132913291330/**···13711374 struct ata_port *ap = host_set->ports[port];13721375 struct mv_port_priv *pp = ap->private_data;1373137613741374- hard_port = port & MV_PORT_MASK; /* range 0-3 */13771377+ hard_port = mv_hardport_from_port(port); /* range 0..3 */13751378 handled = 0; /* ensure ata_status is set if handled++ */1376137913771380 /* Note that DEV_IRQ might happen spuriously during EDMA,13781378- * and should be ignored in such cases. We could mask it,13791379- * but it's pretty rare and may not be worth the overhead.13811381+ * and should be ignored in such cases.13821382+ * The cause of this is still under investigation.13801383 */ 13811384 if (pp->pp_flags & MV_PP_FLAG_EDMA_EN) {13821385 /* EDMA: check for response queue interrupt */···13901393 ata_status = readb((void __iomem *)13911394 ap->ioaddr.status_addr);13921395 handled = 1;13961396+ /* ignore spurious intr if drive still BUSY */13971397+ if (ata_status & ATA_BUSY) {13981398+ ata_status = 0;13991399+ handled = 0;14001400+ }13931401 }13941402 }13951403···14081406 shift++; /* skip bit 8 in the HC Main IRQ reg */14091407 }14101408 if ((PORT0_ERR << shift) & relevant) {14111411- mv_err_intr(ap);14091409+ mv_err_intr(ap, 1);14121410 err_mask |= AC_ERR_OTHER;14131411 handled = 1;14141412 }···14501448 struct ata_host_set *host_set = dev_instance;14511449 unsigned int hc, handled = 0, n_hcs;14521450 void __iomem *mmio = host_set->mmio_base;14511451+ struct mv_host_priv *hpriv;14531452 u32 irq_stat;1454145314551454 irq_stat = readl(mmio + HC_MAIN_IRQ_CAUSE_OFS);···14721469 handled++;14731470 }14741471 }14721472+14731473+ hpriv = host_set->private_data;14741474+ if (IS_60XX(hpriv)) {14751475+ /* deal with the interrupt coalescing bits */14761476+ if (irq_stat & (TRAN_LO_DONE | TRAN_HI_DONE | PORTS_0_7_COAL_DONE)) {14771477+ writelfl(0, mmio + MV_IRQ_COAL_CAUSE_LO);14781478+ writelfl(0, mmio + MV_IRQ_COAL_CAUSE_HI);14791479+ writelfl(0, mmio + MV_IRQ_COAL_CAUSE);14801480+ }14811481+ }14821482+14751483 if (PCI_ERR & irq_stat) {14761484 printk(KERN_ERR DRV_NAME ": PCI ERROR; PCI IRQ cause=0x%08x\n",14771485 readl(mmio + PCI_IRQ_CAUSE_OFS));···1881186718821868 if (IS_60XX(hpriv)) {18831869 u32 ifctl = readl(port_mmio + SATA_INTERFACE_CTL);18841884- ifctl |= (1 << 12) | (1 << 7);18701870+ ifctl |= (1 << 7); /* enable gen2i speed */18711871+ ifctl = (ifctl & 0xfff) | 0x9b1000; /* from chip spec */18851872 writelfl(ifctl, port_mmio + SATA_INTERFACE_CTL);18861873 }18871874···20462031 ap->host_set->mmio_base, ap, qc, qc->scsicmd,20472032 &qc->scsicmd->cmnd);2048203320492049- mv_err_intr(ap);20342034+ mv_err_intr(ap, 0);20502035 mv_stop_and_reset(ap);2051203620522052- qc->err_mask |= AC_ERR_TIMEOUT;20532053- ata_eh_qc_complete(qc);20372037+ WARN_ON(!(qc->flags & ATA_QCFLAG_ACTIVE));20382038+ if (qc->flags & ATA_QCFLAG_ACTIVE) {20392039+ qc->err_mask |= AC_ERR_TIMEOUT;20402040+ ata_eh_qc_complete(qc);20412041+ }20542042}2055204320562044/**···22472229 void __iomem *port_mmio = mv_port_base(mmio, port);2248223022492231 u32 ifctl = readl(port_mmio + SATA_INTERFACE_CTL);22502250- ifctl |= (1 << 12);22322232+ ifctl |= (1 << 7); /* enable gen2i speed */22332233+ ifctl = (ifctl & 0xfff) | 0x9b1000; /* from chip spec */22512234 writelfl(ifctl, port_mmio + SATA_INTERFACE_CTL);22522235 }22532236···23492330 if (rc) {23502331 return rc;23512332 }23332333+ pci_set_master(pdev);2352233423532335 rc = pci_request_regions(pdev, DRV_NAME);23542336 if (rc) {
···7575 inexpensive battery powered microcontroller evaluation board.7676 This same cable can be used to flash new firmware.77777878+config SPI_MPC83xx7979+ tristate "Freescale MPC83xx SPI controller"8080+ depends on SPI_MASTER && PPC_83xx && EXPERIMENTAL8181+ select SPI_BITBANG8282+ help8383+ This enables using the Freescale MPC83xx SPI controller in master8484+ mode.8585+8686+ Note, this driver uniquely supports the SPI controller on the MPC83xx8787+ family of PowerPC processors. The MPC83xx uses a simple set of shift8888+ registers for data (opposed to the CPM based descriptor model).8989+9090+config SPI_PXA2XX9191+ tristate "PXA2xx SSP SPI master"9292+ depends on SPI_MASTER && ARCH_PXA && EXPERIMENTAL9393+ help9494+ This enables using a PXA2xx SSP port as a SPI master controller.9595+ The driver can be configured to use any SSP port and additional9696+ documentation can be found a Documentation/spi/pxa2xx.9797+9898+config SPI_S3C24XX_GPIO9999+ tristate "Samsung S3C24XX series SPI by GPIO"100100+ depends on SPI_MASTER && ARCH_S3C2410 && SPI_BITBANG && EXPERIMENTAL101101+ help102102+ SPI driver for Samsung S3C24XX series ARM SoCs using103103+ GPIO lines to provide the SPI bus. This can be used where104104+ the inbuilt hardware cannot provide the transfer mode, or105105+ where the board is using non hardware connected pins.78106#79107# Add new SPI master controllers in alphabetical order above this line80108#81109110110+111111+config SPI_S3C24XX112112+ tristate "Samsung S3C24XX series SPI"113113+ depends on SPI_MASTER && ARCH_S3C2410 && EXPERIMENTAL114114+ help115115+ SPI driver for Samsung S3C24XX series ARM SoCs8211683117#84118# There are lots of SPI device types, with sensors and memory
+4
drivers/spi/Makefile
···1313# SPI master controller drivers (bus)1414obj-$(CONFIG_SPI_BITBANG) += spi_bitbang.o1515obj-$(CONFIG_SPI_BUTTERFLY) += spi_butterfly.o1616+obj-$(CONFIG_SPI_PXA2XX) += pxa2xx_spi.o1717+obj-$(CONFIG_SPI_MPC83xx) += spi_mpc83xx.o1818+obj-$(CONFIG_SPI_S3C24XX_GPIO) += spi_s3c24xx_gpio.o1919+obj-$(CONFIG_SPI_S3C24XX) += spi_s3c24xx.o1620# ... add above this line ...17211822# SPI protocol drivers (device/link on bus)
+1486
drivers/spi/pxa2xx_spi.c
···11+/*22+ * Copyright (C) 2005 Stephen Street / StreetFire Sound Labs33+ *44+ * This program is free software; you can redistribute it and/or modify55+ * it under the terms of the GNU General Public License as published by66+ * the Free Software Foundation; either version 2 of the License, or77+ * (at your option) any later version.88+ *99+ * This program is distributed in the hope that it will be useful,1010+ * but WITHOUT ANY WARRANTY; without even the implied warranty of1111+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the1212+ * GNU General Public License for more details.1313+ *1414+ * You should have received a copy of the GNU General Public License1515+ * along with this program; if not, write to the Free Software1616+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.1717+ */1818+1919+#include <linux/init.h>2020+#include <linux/module.h>2121+#include <linux/device.h>2222+#include <linux/ioport.h>2323+#include <linux/errno.h>2424+#include <linux/interrupt.h>2525+#include <linux/platform_device.h>2626+#include <linux/dma-mapping.h>2727+#include <linux/spi/spi.h>2828+#include <linux/workqueue.h>2929+#include <linux/errno.h>3030+#include <linux/delay.h>3131+3232+#include <asm/io.h>3333+#include <asm/irq.h>3434+#include <asm/hardware.h>3535+#include <asm/delay.h>3636+#include <asm/dma.h>3737+3838+#include <asm/arch/hardware.h>3939+#include <asm/arch/pxa-regs.h>4040+#include <asm/arch/pxa2xx_spi.h>4141+4242+MODULE_AUTHOR("Stephen Street");4343+MODULE_DESCRIPTION("PXA2xx SSP SPI Contoller");4444+MODULE_LICENSE("GPL");4545+4646+#define MAX_BUSES 34747+4848+#define DMA_INT_MASK (DCSR_ENDINTR | DCSR_STARTINTR | DCSR_BUSERR)4949+#define RESET_DMA_CHANNEL (DCSR_NODESC | DMA_INT_MASK)5050+#define IS_DMA_ALIGNED(x) (((u32)(x)&0x07)==0)5151+5252+#define DEFINE_SSP_REG(reg, off) \5353+static inline u32 read_##reg(void *p) { return __raw_readl(p + (off)); } \5454+static inline void write_##reg(u32 v, void *p) { __raw_writel(v, p + (off)); }5555+5656+DEFINE_SSP_REG(SSCR0, 0x00)5757+DEFINE_SSP_REG(SSCR1, 0x04)5858+DEFINE_SSP_REG(SSSR, 0x08)5959+DEFINE_SSP_REG(SSITR, 0x0c)6060+DEFINE_SSP_REG(SSDR, 0x10)6161+DEFINE_SSP_REG(SSTO, 0x28)6262+DEFINE_SSP_REG(SSPSP, 0x2c)6363+6464+#define START_STATE ((void*)0)6565+#define RUNNING_STATE ((void*)1)6666+#define DONE_STATE ((void*)2)6767+#define ERROR_STATE ((void*)-1)6868+6969+#define QUEUE_RUNNING 07070+#define QUEUE_STOPPED 17171+7272+struct driver_data {7373+ /* Driver model hookup */7474+ struct platform_device *pdev;7575+7676+ /* SPI framework hookup */7777+ enum pxa_ssp_type ssp_type;7878+ struct spi_master *master;7979+8080+ /* PXA hookup */8181+ struct pxa2xx_spi_master *master_info;8282+8383+ /* DMA setup stuff */8484+ int rx_channel;8585+ int tx_channel;8686+ u32 *null_dma_buf;8787+8888+ /* SSP register addresses */8989+ void *ioaddr;9090+ u32 ssdr_physical;9191+9292+ /* SSP masks*/9393+ u32 dma_cr1;9494+ u32 int_cr1;9595+ u32 clear_sr;9696+ u32 mask_sr;9797+9898+ /* Driver message queue */9999+ struct workqueue_struct *workqueue;100100+ struct work_struct pump_messages;101101+ spinlock_t lock;102102+ struct list_head queue;103103+ int busy;104104+ int run;105105+106106+ /* Message Transfer pump */107107+ struct tasklet_struct pump_transfers;108108+109109+ /* Current message transfer state info */110110+ struct spi_message* cur_msg;111111+ struct spi_transfer* cur_transfer;112112+ struct chip_data *cur_chip;113113+ size_t len;114114+ void *tx;115115+ void *tx_end;116116+ void *rx;117117+ void *rx_end;118118+ int dma_mapped;119119+ dma_addr_t rx_dma;120120+ dma_addr_t tx_dma;121121+ size_t rx_map_len;122122+ size_t tx_map_len;123123+ u8 n_bytes;124124+ u32 dma_width;125125+ int cs_change;126126+ void (*write)(struct driver_data *drv_data);127127+ void (*read)(struct driver_data *drv_data);128128+ irqreturn_t (*transfer_handler)(struct driver_data *drv_data);129129+ void (*cs_control)(u32 command);130130+};131131+132132+struct chip_data {133133+ u32 cr0;134134+ u32 cr1;135135+ u32 to;136136+ u32 psp;137137+ u32 timeout;138138+ u8 n_bytes;139139+ u32 dma_width;140140+ u32 dma_burst_size;141141+ u32 threshold;142142+ u32 dma_threshold;143143+ u8 enable_dma;144144+ u8 bits_per_word;145145+ u32 speed_hz;146146+ void (*write)(struct driver_data *drv_data);147147+ void (*read)(struct driver_data *drv_data);148148+ void (*cs_control)(u32 command);149149+};150150+151151+static void pump_messages(void *data);152152+153153+static int flush(struct driver_data *drv_data)154154+{155155+ unsigned long limit = loops_per_jiffy << 1;156156+157157+ void *reg = drv_data->ioaddr;158158+159159+ do {160160+ while (read_SSSR(reg) & SSSR_RNE) {161161+ read_SSDR(reg);162162+ }163163+ } while ((read_SSSR(reg) & SSSR_BSY) && limit--);164164+ write_SSSR(SSSR_ROR, reg);165165+166166+ return limit;167167+}168168+169169+static void restore_state(struct driver_data *drv_data)170170+{171171+ void *reg = drv_data->ioaddr;172172+173173+ /* Clear status and disable clock */174174+ write_SSSR(drv_data->clear_sr, reg);175175+ write_SSCR0(drv_data->cur_chip->cr0 & ~SSCR0_SSE, reg);176176+177177+ /* Load the registers */178178+ write_SSCR1(drv_data->cur_chip->cr1, reg);179179+ write_SSCR0(drv_data->cur_chip->cr0, reg);180180+ if (drv_data->ssp_type != PXA25x_SSP) {181181+ write_SSTO(0, reg);182182+ write_SSPSP(drv_data->cur_chip->psp, reg);183183+ }184184+}185185+186186+static void null_cs_control(u32 command)187187+{188188+}189189+190190+static void null_writer(struct driver_data *drv_data)191191+{192192+ void *reg = drv_data->ioaddr;193193+ u8 n_bytes = drv_data->n_bytes;194194+195195+ while ((read_SSSR(reg) & SSSR_TNF)196196+ && (drv_data->tx < drv_data->tx_end)) {197197+ write_SSDR(0, reg);198198+ drv_data->tx += n_bytes;199199+ }200200+}201201+202202+static void null_reader(struct driver_data *drv_data)203203+{204204+ void *reg = drv_data->ioaddr;205205+ u8 n_bytes = drv_data->n_bytes;206206+207207+ while ((read_SSSR(reg) & SSSR_RNE)208208+ && (drv_data->rx < drv_data->rx_end)) {209209+ read_SSDR(reg);210210+ drv_data->rx += n_bytes;211211+ }212212+}213213+214214+static void u8_writer(struct driver_data *drv_data)215215+{216216+ void *reg = drv_data->ioaddr;217217+218218+ while ((read_SSSR(reg) & SSSR_TNF)219219+ && (drv_data->tx < drv_data->tx_end)) {220220+ write_SSDR(*(u8 *)(drv_data->tx), reg);221221+ ++drv_data->tx;222222+ }223223+}224224+225225+static void u8_reader(struct driver_data *drv_data)226226+{227227+ void *reg = drv_data->ioaddr;228228+229229+ while ((read_SSSR(reg) & SSSR_RNE)230230+ && (drv_data->rx < drv_data->rx_end)) {231231+ *(u8 *)(drv_data->rx) = read_SSDR(reg);232232+ ++drv_data->rx;233233+ }234234+}235235+236236+static void u16_writer(struct driver_data *drv_data)237237+{238238+ void *reg = drv_data->ioaddr;239239+240240+ while ((read_SSSR(reg) & SSSR_TNF)241241+ && (drv_data->tx < drv_data->tx_end)) {242242+ write_SSDR(*(u16 *)(drv_data->tx), reg);243243+ drv_data->tx += 2;244244+ }245245+}246246+247247+static void u16_reader(struct driver_data *drv_data)248248+{249249+ void *reg = drv_data->ioaddr;250250+251251+ while ((read_SSSR(reg) & SSSR_RNE)252252+ && (drv_data->rx < drv_data->rx_end)) {253253+ *(u16 *)(drv_data->rx) = read_SSDR(reg);254254+ drv_data->rx += 2;255255+ }256256+}257257+static void u32_writer(struct driver_data *drv_data)258258+{259259+ void *reg = drv_data->ioaddr;260260+261261+ while ((read_SSSR(reg) & SSSR_TNF)262262+ && (drv_data->tx < drv_data->tx_end)) {263263+ write_SSDR(*(u32 *)(drv_data->tx), reg);264264+ drv_data->tx += 4;265265+ }266266+}267267+268268+static void u32_reader(struct driver_data *drv_data)269269+{270270+ void *reg = drv_data->ioaddr;271271+272272+ while ((read_SSSR(reg) & SSSR_RNE)273273+ && (drv_data->rx < drv_data->rx_end)) {274274+ *(u32 *)(drv_data->rx) = read_SSDR(reg);275275+ drv_data->rx += 4;276276+ }277277+}278278+279279+static void *next_transfer(struct driver_data *drv_data)280280+{281281+ struct spi_message *msg = drv_data->cur_msg;282282+ struct spi_transfer *trans = drv_data->cur_transfer;283283+284284+ /* Move to next transfer */285285+ if (trans->transfer_list.next != &msg->transfers) {286286+ drv_data->cur_transfer =287287+ list_entry(trans->transfer_list.next,288288+ struct spi_transfer,289289+ transfer_list);290290+ return RUNNING_STATE;291291+ } else292292+ return DONE_STATE;293293+}294294+295295+static int map_dma_buffers(struct driver_data *drv_data)296296+{297297+ struct spi_message *msg = drv_data->cur_msg;298298+ struct device *dev = &msg->spi->dev;299299+300300+ if (!drv_data->cur_chip->enable_dma)301301+ return 0;302302+303303+ if (msg->is_dma_mapped)304304+ return drv_data->rx_dma && drv_data->tx_dma;305305+306306+ if (!IS_DMA_ALIGNED(drv_data->rx) || !IS_DMA_ALIGNED(drv_data->tx))307307+ return 0;308308+309309+ /* Modify setup if rx buffer is null */310310+ if (drv_data->rx == NULL) {311311+ *drv_data->null_dma_buf = 0;312312+ drv_data->rx = drv_data->null_dma_buf;313313+ drv_data->rx_map_len = 4;314314+ } else315315+ drv_data->rx_map_len = drv_data->len;316316+317317+318318+ /* Modify setup if tx buffer is null */319319+ if (drv_data->tx == NULL) {320320+ *drv_data->null_dma_buf = 0;321321+ drv_data->tx = drv_data->null_dma_buf;322322+ drv_data->tx_map_len = 4;323323+ } else324324+ drv_data->tx_map_len = drv_data->len;325325+326326+ /* Stream map the rx buffer */327327+ drv_data->rx_dma = dma_map_single(dev, drv_data->rx,328328+ drv_data->rx_map_len,329329+ DMA_FROM_DEVICE);330330+ if (dma_mapping_error(drv_data->rx_dma))331331+ return 0;332332+333333+ /* Stream map the tx buffer */334334+ drv_data->tx_dma = dma_map_single(dev, drv_data->tx,335335+ drv_data->tx_map_len,336336+ DMA_TO_DEVICE);337337+338338+ if (dma_mapping_error(drv_data->tx_dma)) {339339+ dma_unmap_single(dev, drv_data->rx_dma,340340+ drv_data->rx_map_len, DMA_FROM_DEVICE);341341+ return 0;342342+ }343343+344344+ return 1;345345+}346346+347347+static void unmap_dma_buffers(struct driver_data *drv_data)348348+{349349+ struct device *dev;350350+351351+ if (!drv_data->dma_mapped)352352+ return;353353+354354+ if (!drv_data->cur_msg->is_dma_mapped) {355355+ dev = &drv_data->cur_msg->spi->dev;356356+ dma_unmap_single(dev, drv_data->rx_dma,357357+ drv_data->rx_map_len, DMA_FROM_DEVICE);358358+ dma_unmap_single(dev, drv_data->tx_dma,359359+ drv_data->tx_map_len, DMA_TO_DEVICE);360360+ }361361+362362+ drv_data->dma_mapped = 0;363363+}364364+365365+/* caller already set message->status; dma and pio irqs are blocked */366366+static void giveback(struct driver_data *drv_data)367367+{368368+ struct spi_transfer* last_transfer;369369+ unsigned long flags;370370+ struct spi_message *msg;371371+372372+ spin_lock_irqsave(&drv_data->lock, flags);373373+ msg = drv_data->cur_msg;374374+ drv_data->cur_msg = NULL;375375+ drv_data->cur_transfer = NULL;376376+ drv_data->cur_chip = NULL;377377+ queue_work(drv_data->workqueue, &drv_data->pump_messages);378378+ spin_unlock_irqrestore(&drv_data->lock, flags);379379+380380+ last_transfer = list_entry(msg->transfers.prev,381381+ struct spi_transfer,382382+ transfer_list);383383+384384+ if (!last_transfer->cs_change)385385+ drv_data->cs_control(PXA2XX_CS_DEASSERT);386386+387387+ msg->state = NULL;388388+ if (msg->complete)389389+ msg->complete(msg->context);390390+}391391+392392+static int wait_ssp_rx_stall(void *ioaddr)393393+{394394+ unsigned long limit = loops_per_jiffy << 1;395395+396396+ while ((read_SSSR(ioaddr) & SSSR_BSY) && limit--)397397+ cpu_relax();398398+399399+ return limit;400400+}401401+402402+static int wait_dma_channel_stop(int channel)403403+{404404+ unsigned long limit = loops_per_jiffy << 1;405405+406406+ while (!(DCSR(channel) & DCSR_STOPSTATE) && limit--)407407+ cpu_relax();408408+409409+ return limit;410410+}411411+412412+static void dma_handler(int channel, void *data, struct pt_regs *regs)413413+{414414+ struct driver_data *drv_data = data;415415+ struct spi_message *msg = drv_data->cur_msg;416416+ void *reg = drv_data->ioaddr;417417+ u32 irq_status = DCSR(channel) & DMA_INT_MASK;418418+ u32 trailing_sssr = 0;419419+420420+ if (irq_status & DCSR_BUSERR) {421421+422422+ /* Disable interrupts, clear status and reset DMA */423423+ write_SSCR0(read_SSCR0(reg) & ~SSCR0_SSE, reg);424424+ write_SSCR1(read_SSCR1(reg) & ~drv_data->dma_cr1, reg);425425+ if (drv_data->ssp_type != PXA25x_SSP)426426+ write_SSTO(0, reg);427427+ write_SSSR(drv_data->clear_sr, reg);428428+ DCSR(drv_data->rx_channel) = RESET_DMA_CHANNEL;429429+ DCSR(drv_data->tx_channel) = RESET_DMA_CHANNEL;430430+431431+ if (flush(drv_data) == 0)432432+ dev_err(&drv_data->pdev->dev,433433+ "dma_handler: flush fail\n");434434+435435+ unmap_dma_buffers(drv_data);436436+437437+ if (channel == drv_data->tx_channel)438438+ dev_err(&drv_data->pdev->dev,439439+ "dma_handler: bad bus address on "440440+ "tx channel %d, source %x target = %x\n",441441+ channel, DSADR(channel), DTADR(channel));442442+ else443443+ dev_err(&drv_data->pdev->dev,444444+ "dma_handler: bad bus address on "445445+ "rx channel %d, source %x target = %x\n",446446+ channel, DSADR(channel), DTADR(channel));447447+448448+ msg->state = ERROR_STATE;449449+ tasklet_schedule(&drv_data->pump_transfers);450450+ }451451+452452+ /* PXA255x_SSP has no timeout interrupt, wait for tailing bytes */453453+ if ((drv_data->ssp_type == PXA25x_SSP)454454+ && (channel == drv_data->tx_channel)455455+ && (irq_status & DCSR_ENDINTR)) {456456+457457+ /* Wait for rx to stall */458458+ if (wait_ssp_rx_stall(drv_data->ioaddr) == 0)459459+ dev_err(&drv_data->pdev->dev,460460+ "dma_handler: ssp rx stall failed\n");461461+462462+ /* Clear and disable interrupts on SSP and DMA channels*/463463+ write_SSCR1(read_SSCR1(reg) & ~drv_data->dma_cr1, reg);464464+ write_SSSR(drv_data->clear_sr, reg);465465+ DCSR(drv_data->tx_channel) = RESET_DMA_CHANNEL;466466+ DCSR(drv_data->rx_channel) = RESET_DMA_CHANNEL;467467+ if (wait_dma_channel_stop(drv_data->rx_channel) == 0)468468+ dev_err(&drv_data->pdev->dev,469469+ "dma_handler: dma rx channel stop failed\n");470470+471471+ unmap_dma_buffers(drv_data);472472+473473+ /* Read trailing bytes */474474+ /* Calculate number of trailing bytes, read them */475475+ trailing_sssr = read_SSSR(reg);476476+ if ((trailing_sssr & 0xf008) != 0xf000) {477477+ drv_data->rx = drv_data->rx_end -478478+ (((trailing_sssr >> 12) & 0x0f) + 1);479479+ drv_data->read(drv_data);480480+ }481481+ msg->actual_length += drv_data->len;482482+483483+ /* Release chip select if requested, transfer delays are484484+ * handled in pump_transfers */485485+ if (drv_data->cs_change)486486+ drv_data->cs_control(PXA2XX_CS_DEASSERT);487487+488488+ /* Move to next transfer */489489+ msg->state = next_transfer(drv_data);490490+491491+ /* Schedule transfer tasklet */492492+ tasklet_schedule(&drv_data->pump_transfers);493493+ }494494+}495495+496496+static irqreturn_t dma_transfer(struct driver_data *drv_data)497497+{498498+ u32 irq_status;499499+ u32 trailing_sssr = 0;500500+ struct spi_message *msg = drv_data->cur_msg;501501+ void *reg = drv_data->ioaddr;502502+503503+ irq_status = read_SSSR(reg) & drv_data->mask_sr;504504+ if (irq_status & SSSR_ROR) {505505+ /* Clear and disable interrupts on SSP and DMA channels*/506506+ write_SSCR0(read_SSCR0(reg) & ~SSCR0_SSE, reg);507507+ write_SSCR1(read_SSCR1(reg) & ~drv_data->dma_cr1, reg);508508+ if (drv_data->ssp_type != PXA25x_SSP)509509+ write_SSTO(0, reg);510510+ write_SSSR(drv_data->clear_sr, reg);511511+ DCSR(drv_data->tx_channel) = RESET_DMA_CHANNEL;512512+ DCSR(drv_data->rx_channel) = RESET_DMA_CHANNEL;513513+ unmap_dma_buffers(drv_data);514514+515515+ if (flush(drv_data) == 0)516516+ dev_err(&drv_data->pdev->dev,517517+ "dma_transfer: flush fail\n");518518+519519+ dev_warn(&drv_data->pdev->dev, "dma_transfer: fifo overun\n");520520+521521+ drv_data->cur_msg->state = ERROR_STATE;522522+ tasklet_schedule(&drv_data->pump_transfers);523523+524524+ return IRQ_HANDLED;525525+ }526526+527527+ /* Check for false positive timeout */528528+ if ((irq_status & SSSR_TINT) && DCSR(drv_data->tx_channel) & DCSR_RUN) {529529+ write_SSSR(SSSR_TINT, reg);530530+ return IRQ_HANDLED;531531+ }532532+533533+ if (irq_status & SSSR_TINT || drv_data->rx == drv_data->rx_end) {534534+535535+ /* Clear and disable interrupts on SSP and DMA channels*/536536+ write_SSCR1(read_SSCR1(reg) & ~drv_data->dma_cr1, reg);537537+ if (drv_data->ssp_type != PXA25x_SSP)538538+ write_SSTO(0, reg);539539+ write_SSSR(drv_data->clear_sr, reg);540540+ DCSR(drv_data->tx_channel) = RESET_DMA_CHANNEL;541541+ DCSR(drv_data->rx_channel) = RESET_DMA_CHANNEL;542542+543543+ if (wait_dma_channel_stop(drv_data->rx_channel) == 0)544544+ dev_err(&drv_data->pdev->dev,545545+ "dma_transfer: dma rx channel stop failed\n");546546+547547+ if (wait_ssp_rx_stall(drv_data->ioaddr) == 0)548548+ dev_err(&drv_data->pdev->dev,549549+ "dma_transfer: ssp rx stall failed\n");550550+551551+ unmap_dma_buffers(drv_data);552552+553553+ /* Calculate number of trailing bytes, read them */554554+ trailing_sssr = read_SSSR(reg);555555+ if ((trailing_sssr & 0xf008) != 0xf000) {556556+ drv_data->rx = drv_data->rx_end -557557+ (((trailing_sssr >> 12) & 0x0f) + 1);558558+ drv_data->read(drv_data);559559+ }560560+ msg->actual_length += drv_data->len;561561+562562+ /* Release chip select if requested, transfer delays are563563+ * handled in pump_transfers */564564+ if (drv_data->cs_change)565565+ drv_data->cs_control(PXA2XX_CS_DEASSERT);566566+567567+ /* Move to next transfer */568568+ msg->state = next_transfer(drv_data);569569+570570+ /* Schedule transfer tasklet */571571+ tasklet_schedule(&drv_data->pump_transfers);572572+573573+ return IRQ_HANDLED;574574+ }575575+576576+ /* Opps problem detected */577577+ return IRQ_NONE;578578+}579579+580580+static irqreturn_t interrupt_transfer(struct driver_data *drv_data)581581+{582582+ struct spi_message *msg = drv_data->cur_msg;583583+ void *reg = drv_data->ioaddr;584584+ unsigned long limit = loops_per_jiffy << 1;585585+ u32 irq_status;586586+ u32 irq_mask = (read_SSCR1(reg) & SSCR1_TIE) ?587587+ drv_data->mask_sr : drv_data->mask_sr & ~SSSR_TFS;588588+589589+ while ((irq_status = read_SSSR(reg) & irq_mask)) {590590+591591+ if (irq_status & SSSR_ROR) {592592+593593+ /* Clear and disable interrupts */594594+ write_SSCR0(read_SSCR0(reg) & ~SSCR0_SSE, reg);595595+ write_SSCR1(read_SSCR1(reg) & ~drv_data->int_cr1, reg);596596+ if (drv_data->ssp_type != PXA25x_SSP)597597+ write_SSTO(0, reg);598598+ write_SSSR(drv_data->clear_sr, reg);599599+600600+ if (flush(drv_data) == 0)601601+ dev_err(&drv_data->pdev->dev,602602+ "interrupt_transfer: flush fail\n");603603+604604+ /* Stop the SSP */605605+606606+ dev_warn(&drv_data->pdev->dev,607607+ "interrupt_transfer: fifo overun\n");608608+609609+ msg->state = ERROR_STATE;610610+ tasklet_schedule(&drv_data->pump_transfers);611611+612612+ return IRQ_HANDLED;613613+ }614614+615615+ /* Look for false positive timeout */616616+ if ((irq_status & SSSR_TINT)617617+ && (drv_data->rx < drv_data->rx_end))618618+ write_SSSR(SSSR_TINT, reg);619619+620620+ /* Pump data */621621+ drv_data->read(drv_data);622622+ drv_data->write(drv_data);623623+624624+ if (drv_data->tx == drv_data->tx_end) {625625+ /* Disable tx interrupt */626626+ write_SSCR1(read_SSCR1(reg) & ~SSCR1_TIE, reg);627627+ irq_mask = drv_data->mask_sr & ~SSSR_TFS;628628+629629+ /* PXA25x_SSP has no timeout, read trailing bytes */630630+ if (drv_data->ssp_type == PXA25x_SSP) {631631+ while ((read_SSSR(reg) & SSSR_BSY) && limit--)632632+ drv_data->read(drv_data);633633+634634+ if (limit == 0)635635+ dev_err(&drv_data->pdev->dev,636636+ "interrupt_transfer: "637637+ "trailing byte read failed\n");638638+ }639639+ }640640+641641+ if ((irq_status & SSSR_TINT)642642+ || (drv_data->rx == drv_data->rx_end)) {643643+644644+ /* Clear timeout */645645+ write_SSCR1(read_SSCR1(reg) & ~drv_data->int_cr1, reg);646646+ if (drv_data->ssp_type != PXA25x_SSP)647647+ write_SSTO(0, reg);648648+ write_SSSR(drv_data->clear_sr, reg);649649+650650+ /* Update total byte transfered */651651+ msg->actual_length += drv_data->len;652652+653653+ /* Release chip select if requested, transfer delays are654654+ * handled in pump_transfers */655655+ if (drv_data->cs_change)656656+ drv_data->cs_control(PXA2XX_CS_DEASSERT);657657+658658+ /* Move to next transfer */659659+ msg->state = next_transfer(drv_data);660660+661661+ /* Schedule transfer tasklet */662662+ tasklet_schedule(&drv_data->pump_transfers);663663+ }664664+ }665665+666666+ /* We did something */667667+ return IRQ_HANDLED;668668+}669669+670670+static irqreturn_t ssp_int(int irq, void *dev_id, struct pt_regs *regs)671671+{672672+ struct driver_data *drv_data = (struct driver_data *)dev_id;673673+ void *reg = drv_data->ioaddr;674674+675675+ if (!drv_data->cur_msg) {676676+677677+ write_SSCR0(read_SSCR0(reg) & ~SSCR0_SSE, reg);678678+ write_SSCR1(read_SSCR1(reg) & ~drv_data->int_cr1, reg);679679+ if (drv_data->ssp_type != PXA25x_SSP)680680+ write_SSTO(0, reg);681681+ write_SSSR(drv_data->clear_sr, reg);682682+683683+ dev_err(&drv_data->pdev->dev, "bad message state "684684+ "in interrupt handler");685685+686686+ /* Never fail */687687+ return IRQ_HANDLED;688688+ }689689+690690+ return drv_data->transfer_handler(drv_data);691691+}692692+693693+static void pump_transfers(unsigned long data)694694+{695695+ struct driver_data *drv_data = (struct driver_data *)data;696696+ struct spi_message *message = NULL;697697+ struct spi_transfer *transfer = NULL;698698+ struct spi_transfer *previous = NULL;699699+ struct chip_data *chip = NULL;700700+ void *reg = drv_data->ioaddr;701701+ u32 clk_div = 0;702702+ u8 bits = 0;703703+ u32 speed = 0;704704+ u32 cr0;705705+706706+ /* Get current state information */707707+ message = drv_data->cur_msg;708708+ transfer = drv_data->cur_transfer;709709+ chip = drv_data->cur_chip;710710+711711+ /* Handle for abort */712712+ if (message->state == ERROR_STATE) {713713+ message->status = -EIO;714714+ giveback(drv_data);715715+ return;716716+ }717717+718718+ /* Handle end of message */719719+ if (message->state == DONE_STATE) {720720+ message->status = 0;721721+ giveback(drv_data);722722+ return;723723+ }724724+725725+ /* Delay if requested at end of transfer*/726726+ if (message->state == RUNNING_STATE) {727727+ previous = list_entry(transfer->transfer_list.prev,728728+ struct spi_transfer,729729+ transfer_list);730730+ if (previous->delay_usecs)731731+ udelay(previous->delay_usecs);732732+ }733733+734734+ /* Setup the transfer state based on the type of transfer */735735+ if (flush(drv_data) == 0) {736736+ dev_err(&drv_data->pdev->dev, "pump_transfers: flush failed\n");737737+ message->status = -EIO;738738+ giveback(drv_data);739739+ return;740740+ }741741+ drv_data->n_bytes = chip->n_bytes;742742+ drv_data->dma_width = chip->dma_width;743743+ drv_data->cs_control = chip->cs_control;744744+ drv_data->tx = (void *)transfer->tx_buf;745745+ drv_data->tx_end = drv_data->tx + transfer->len;746746+ drv_data->rx = transfer->rx_buf;747747+ drv_data->rx_end = drv_data->rx + transfer->len;748748+ drv_data->rx_dma = transfer->rx_dma;749749+ drv_data->tx_dma = transfer->tx_dma;750750+ drv_data->len = transfer->len;751751+ drv_data->write = drv_data->tx ? chip->write : null_writer;752752+ drv_data->read = drv_data->rx ? chip->read : null_reader;753753+ drv_data->cs_change = transfer->cs_change;754754+755755+ /* Change speed and bit per word on a per transfer */756756+ if (transfer->speed_hz || transfer->bits_per_word) {757757+758758+ /* Disable clock */759759+ write_SSCR0(chip->cr0 & ~SSCR0_SSE, reg);760760+ cr0 = chip->cr0;761761+ bits = chip->bits_per_word;762762+ speed = chip->speed_hz;763763+764764+ if (transfer->speed_hz)765765+ speed = transfer->speed_hz;766766+767767+ if (transfer->bits_per_word)768768+ bits = transfer->bits_per_word;769769+770770+ if (reg == SSP1_VIRT)771771+ clk_div = SSP1_SerClkDiv(speed);772772+ else if (reg == SSP2_VIRT)773773+ clk_div = SSP2_SerClkDiv(speed);774774+ else if (reg == SSP3_VIRT)775775+ clk_div = SSP3_SerClkDiv(speed);776776+777777+ if (bits <= 8) {778778+ drv_data->n_bytes = 1;779779+ drv_data->dma_width = DCMD_WIDTH1;780780+ drv_data->read = drv_data->read != null_reader ?781781+ u8_reader : null_reader;782782+ drv_data->write = drv_data->write != null_writer ?783783+ u8_writer : null_writer;784784+ } else if (bits <= 16) {785785+ drv_data->n_bytes = 2;786786+ drv_data->dma_width = DCMD_WIDTH2;787787+ drv_data->read = drv_data->read != null_reader ?788788+ u16_reader : null_reader;789789+ drv_data->write = drv_data->write != null_writer ?790790+ u16_writer : null_writer;791791+ } else if (bits <= 32) {792792+ drv_data->n_bytes = 4;793793+ drv_data->dma_width = DCMD_WIDTH4;794794+ drv_data->read = drv_data->read != null_reader ?795795+ u32_reader : null_reader;796796+ drv_data->write = drv_data->write != null_writer ?797797+ u32_writer : null_writer;798798+ }799799+800800+ cr0 = clk_div801801+ | SSCR0_Motorola802802+ | SSCR0_DataSize(bits > 16 ? bits - 16 : bits)803803+ | SSCR0_SSE804804+ | (bits > 16 ? SSCR0_EDSS : 0);805805+806806+ /* Start it back up */807807+ write_SSCR0(cr0, reg);808808+ }809809+810810+ message->state = RUNNING_STATE;811811+812812+ /* Try to map dma buffer and do a dma transfer if successful */813813+ if ((drv_data->dma_mapped = map_dma_buffers(drv_data))) {814814+815815+ /* Ensure we have the correct interrupt handler */816816+ drv_data->transfer_handler = dma_transfer;817817+818818+ /* Setup rx DMA Channel */819819+ DCSR(drv_data->rx_channel) = RESET_DMA_CHANNEL;820820+ DSADR(drv_data->rx_channel) = drv_data->ssdr_physical;821821+ DTADR(drv_data->rx_channel) = drv_data->rx_dma;822822+ if (drv_data->rx == drv_data->null_dma_buf)823823+ /* No target address increment */824824+ DCMD(drv_data->rx_channel) = DCMD_FLOWSRC825825+ | drv_data->dma_width826826+ | chip->dma_burst_size827827+ | drv_data->len;828828+ else829829+ DCMD(drv_data->rx_channel) = DCMD_INCTRGADDR830830+ | DCMD_FLOWSRC831831+ | drv_data->dma_width832832+ | chip->dma_burst_size833833+ | drv_data->len;834834+835835+ /* Setup tx DMA Channel */836836+ DCSR(drv_data->tx_channel) = RESET_DMA_CHANNEL;837837+ DSADR(drv_data->tx_channel) = drv_data->tx_dma;838838+ DTADR(drv_data->tx_channel) = drv_data->ssdr_physical;839839+ if (drv_data->tx == drv_data->null_dma_buf)840840+ /* No source address increment */841841+ DCMD(drv_data->tx_channel) = DCMD_FLOWTRG842842+ | drv_data->dma_width843843+ | chip->dma_burst_size844844+ | drv_data->len;845845+ else846846+ DCMD(drv_data->tx_channel) = DCMD_INCSRCADDR847847+ | DCMD_FLOWTRG848848+ | drv_data->dma_width849849+ | chip->dma_burst_size850850+ | drv_data->len;851851+852852+ /* Enable dma end irqs on SSP to detect end of transfer */853853+ if (drv_data->ssp_type == PXA25x_SSP)854854+ DCMD(drv_data->tx_channel) |= DCMD_ENDIRQEN;855855+856856+ /* Fix me, need to handle cs polarity */857857+ drv_data->cs_control(PXA2XX_CS_ASSERT);858858+859859+ /* Go baby, go */860860+ write_SSSR(drv_data->clear_sr, reg);861861+ DCSR(drv_data->rx_channel) |= DCSR_RUN;862862+ DCSR(drv_data->tx_channel) |= DCSR_RUN;863863+ if (drv_data->ssp_type != PXA25x_SSP)864864+ write_SSTO(chip->timeout, reg);865865+ write_SSCR1(chip->cr1866866+ | chip->dma_threshold867867+ | drv_data->dma_cr1,868868+ reg);869869+ } else {870870+ /* Ensure we have the correct interrupt handler */871871+ drv_data->transfer_handler = interrupt_transfer;872872+873873+ /* Fix me, need to handle cs polarity */874874+ drv_data->cs_control(PXA2XX_CS_ASSERT);875875+876876+ /* Go baby, go */877877+ write_SSSR(drv_data->clear_sr, reg);878878+ if (drv_data->ssp_type != PXA25x_SSP)879879+ write_SSTO(chip->timeout, reg);880880+ write_SSCR1(chip->cr1881881+ | chip->threshold882882+ | drv_data->int_cr1,883883+ reg);884884+ }885885+}886886+887887+static void pump_messages(void *data)888888+{889889+ struct driver_data *drv_data = data;890890+ unsigned long flags;891891+892892+ /* Lock queue and check for queue work */893893+ spin_lock_irqsave(&drv_data->lock, flags);894894+ if (list_empty(&drv_data->queue) || drv_data->run == QUEUE_STOPPED) {895895+ drv_data->busy = 0;896896+ spin_unlock_irqrestore(&drv_data->lock, flags);897897+ return;898898+ }899899+900900+ /* Make sure we are not already running a message */901901+ if (drv_data->cur_msg) {902902+ spin_unlock_irqrestore(&drv_data->lock, flags);903903+ return;904904+ }905905+906906+ /* Extract head of queue */907907+ drv_data->cur_msg = list_entry(drv_data->queue.next,908908+ struct spi_message, queue);909909+ list_del_init(&drv_data->cur_msg->queue);910910+911911+ /* Initial message state*/912912+ drv_data->cur_msg->state = START_STATE;913913+ drv_data->cur_transfer = list_entry(drv_data->cur_msg->transfers.next,914914+ struct spi_transfer,915915+ transfer_list);916916+917917+ /* Setup the SSP using the per chip configuration */918918+ drv_data->cur_chip = spi_get_ctldata(drv_data->cur_msg->spi);919919+ restore_state(drv_data);920920+921921+ /* Mark as busy and launch transfers */922922+ tasklet_schedule(&drv_data->pump_transfers);923923+924924+ drv_data->busy = 1;925925+ spin_unlock_irqrestore(&drv_data->lock, flags);926926+}927927+928928+static int transfer(struct spi_device *spi, struct spi_message *msg)929929+{930930+ struct driver_data *drv_data = spi_master_get_devdata(spi->master);931931+ unsigned long flags;932932+933933+ spin_lock_irqsave(&drv_data->lock, flags);934934+935935+ if (drv_data->run == QUEUE_STOPPED) {936936+ spin_unlock_irqrestore(&drv_data->lock, flags);937937+ return -ESHUTDOWN;938938+ }939939+940940+ msg->actual_length = 0;941941+ msg->status = -EINPROGRESS;942942+ msg->state = START_STATE;943943+944944+ list_add_tail(&msg->queue, &drv_data->queue);945945+946946+ if (drv_data->run == QUEUE_RUNNING && !drv_data->busy)947947+ queue_work(drv_data->workqueue, &drv_data->pump_messages);948948+949949+ spin_unlock_irqrestore(&drv_data->lock, flags);950950+951951+ return 0;952952+}953953+954954+static int setup(struct spi_device *spi)955955+{956956+ struct pxa2xx_spi_chip *chip_info = NULL;957957+ struct chip_data *chip;958958+ struct driver_data *drv_data = spi_master_get_devdata(spi->master);959959+ unsigned int clk_div;960960+961961+ if (!spi->bits_per_word)962962+ spi->bits_per_word = 8;963963+964964+ if (drv_data->ssp_type != PXA25x_SSP965965+ && (spi->bits_per_word < 4 || spi->bits_per_word > 32))966966+ return -EINVAL;967967+ else if (spi->bits_per_word < 4 || spi->bits_per_word > 16)968968+ return -EINVAL;969969+970970+ /* Only alloc (or use chip_info) on first setup */971971+ chip = spi_get_ctldata(spi);972972+ if (chip == NULL) {973973+ chip = kzalloc(sizeof(struct chip_data), GFP_KERNEL);974974+ if (!chip)975975+ return -ENOMEM;976976+977977+ chip->cs_control = null_cs_control;978978+ chip->enable_dma = 0;979979+ chip->timeout = SSP_TIMEOUT(1000);980980+ chip->threshold = SSCR1_RxTresh(1) | SSCR1_TxTresh(1);981981+ chip->dma_burst_size = drv_data->master_info->enable_dma ?982982+ DCMD_BURST8 : 0;983983+984984+ chip_info = spi->controller_data;985985+ }986986+987987+ /* chip_info isn't always needed */988988+ if (chip_info) {989989+ if (chip_info->cs_control)990990+ chip->cs_control = chip_info->cs_control;991991+992992+ chip->timeout = SSP_TIMEOUT(chip_info->timeout_microsecs);993993+994994+ chip->threshold = SSCR1_RxTresh(chip_info->rx_threshold)995995+ | SSCR1_TxTresh(chip_info->tx_threshold);996996+997997+ chip->enable_dma = chip_info->dma_burst_size != 0998998+ && drv_data->master_info->enable_dma;999999+ chip->dma_threshold = 0;10001000+10011001+ if (chip->enable_dma) {10021002+ if (chip_info->dma_burst_size <= 8) {10031003+ chip->dma_threshold = SSCR1_RxTresh(8)10041004+ | SSCR1_TxTresh(8);10051005+ chip->dma_burst_size = DCMD_BURST8;10061006+ } else if (chip_info->dma_burst_size <= 16) {10071007+ chip->dma_threshold = SSCR1_RxTresh(16)10081008+ | SSCR1_TxTresh(16);10091009+ chip->dma_burst_size = DCMD_BURST16;10101010+ } else {10111011+ chip->dma_threshold = SSCR1_RxTresh(32)10121012+ | SSCR1_TxTresh(32);10131013+ chip->dma_burst_size = DCMD_BURST32;10141014+ }10151015+ }10161016+10171017+10181018+ if (chip_info->enable_loopback)10191019+ chip->cr1 = SSCR1_LBM;10201020+ }10211021+10221022+ if (drv_data->ioaddr == SSP1_VIRT)10231023+ clk_div = SSP1_SerClkDiv(spi->max_speed_hz);10241024+ else if (drv_data->ioaddr == SSP2_VIRT)10251025+ clk_div = SSP2_SerClkDiv(spi->max_speed_hz);10261026+ else if (drv_data->ioaddr == SSP3_VIRT)10271027+ clk_div = SSP3_SerClkDiv(spi->max_speed_hz);10281028+ else10291029+ return -ENODEV;10301030+ chip->speed_hz = spi->max_speed_hz;10311031+10321032+ chip->cr0 = clk_div10331033+ | SSCR0_Motorola10341034+ | SSCR0_DataSize(spi->bits_per_word > 16 ?10351035+ spi->bits_per_word - 16 : spi->bits_per_word)10361036+ | SSCR0_SSE10371037+ | (spi->bits_per_word > 16 ? SSCR0_EDSS : 0);10381038+ chip->cr1 |= (((spi->mode & SPI_CPHA) != 0) << 4)10391039+ | (((spi->mode & SPI_CPOL) != 0) << 3);10401040+10411041+ /* NOTE: PXA25x_SSP _could_ use external clocking ... */10421042+ if (drv_data->ssp_type != PXA25x_SSP)10431043+ dev_dbg(&spi->dev, "%d bits/word, %d Hz, mode %d\n",10441044+ spi->bits_per_word,10451045+ (CLOCK_SPEED_HZ)10461046+ / (1 + ((chip->cr0 & SSCR0_SCR) >> 8)),10471047+ spi->mode & 0x3);10481048+ else10491049+ dev_dbg(&spi->dev, "%d bits/word, %d Hz, mode %d\n",10501050+ spi->bits_per_word,10511051+ (CLOCK_SPEED_HZ/2)10521052+ / (1 + ((chip->cr0 & SSCR0_SCR) >> 8)),10531053+ spi->mode & 0x3);10541054+10551055+ if (spi->bits_per_word <= 8) {10561056+ chip->n_bytes = 1;10571057+ chip->dma_width = DCMD_WIDTH1;10581058+ chip->read = u8_reader;10591059+ chip->write = u8_writer;10601060+ } else if (spi->bits_per_word <= 16) {10611061+ chip->n_bytes = 2;10621062+ chip->dma_width = DCMD_WIDTH2;10631063+ chip->read = u16_reader;10641064+ chip->write = u16_writer;10651065+ } else if (spi->bits_per_word <= 32) {10661066+ chip->cr0 |= SSCR0_EDSS;10671067+ chip->n_bytes = 4;10681068+ chip->dma_width = DCMD_WIDTH4;10691069+ chip->read = u32_reader;10701070+ chip->write = u32_writer;10711071+ } else {10721072+ dev_err(&spi->dev, "invalid wordsize\n");10731073+ kfree(chip);10741074+ return -ENODEV;10751075+ }10761076+ chip->bits_per_word = spi->bits_per_word;10771077+10781078+ spi_set_ctldata(spi, chip);10791079+10801080+ return 0;10811081+}10821082+10831083+static void cleanup(const struct spi_device *spi)10841084+{10851085+ struct chip_data *chip = spi_get_ctldata((struct spi_device *)spi);10861086+10871087+ kfree(chip);10881088+}10891089+10901090+static int init_queue(struct driver_data *drv_data)10911091+{10921092+ INIT_LIST_HEAD(&drv_data->queue);10931093+ spin_lock_init(&drv_data->lock);10941094+10951095+ drv_data->run = QUEUE_STOPPED;10961096+ drv_data->busy = 0;10971097+10981098+ tasklet_init(&drv_data->pump_transfers,10991099+ pump_transfers, (unsigned long)drv_data);11001100+11011101+ INIT_WORK(&drv_data->pump_messages, pump_messages, drv_data);11021102+ drv_data->workqueue = create_singlethread_workqueue(11031103+ drv_data->master->cdev.dev->bus_id);11041104+ if (drv_data->workqueue == NULL)11051105+ return -EBUSY;11061106+11071107+ return 0;11081108+}11091109+11101110+static int start_queue(struct driver_data *drv_data)11111111+{11121112+ unsigned long flags;11131113+11141114+ spin_lock_irqsave(&drv_data->lock, flags);11151115+11161116+ if (drv_data->run == QUEUE_RUNNING || drv_data->busy) {11171117+ spin_unlock_irqrestore(&drv_data->lock, flags);11181118+ return -EBUSY;11191119+ }11201120+11211121+ drv_data->run = QUEUE_RUNNING;11221122+ drv_data->cur_msg = NULL;11231123+ drv_data->cur_transfer = NULL;11241124+ drv_data->cur_chip = NULL;11251125+ spin_unlock_irqrestore(&drv_data->lock, flags);11261126+11271127+ queue_work(drv_data->workqueue, &drv_data->pump_messages);11281128+11291129+ return 0;11301130+}11311131+11321132+static int stop_queue(struct driver_data *drv_data)11331133+{11341134+ unsigned long flags;11351135+ unsigned limit = 500;11361136+ int status = 0;11371137+11381138+ spin_lock_irqsave(&drv_data->lock, flags);11391139+11401140+ /* This is a bit lame, but is optimized for the common execution path.11411141+ * A wait_queue on the drv_data->busy could be used, but then the common11421142+ * execution path (pump_messages) would be required to call wake_up or11431143+ * friends on every SPI message. Do this instead */11441144+ drv_data->run = QUEUE_STOPPED;11451145+ while (!list_empty(&drv_data->queue) && drv_data->busy && limit--) {11461146+ spin_unlock_irqrestore(&drv_data->lock, flags);11471147+ msleep(10);11481148+ spin_lock_irqsave(&drv_data->lock, flags);11491149+ }11501150+11511151+ if (!list_empty(&drv_data->queue) || drv_data->busy)11521152+ status = -EBUSY;11531153+11541154+ spin_unlock_irqrestore(&drv_data->lock, flags);11551155+11561156+ return status;11571157+}11581158+11591159+static int destroy_queue(struct driver_data *drv_data)11601160+{11611161+ int status;11621162+11631163+ status = stop_queue(drv_data);11641164+ if (status != 0)11651165+ return status;11661166+11671167+ destroy_workqueue(drv_data->workqueue);11681168+11691169+ return 0;11701170+}11711171+11721172+static int pxa2xx_spi_probe(struct platform_device *pdev)11731173+{11741174+ struct device *dev = &pdev->dev;11751175+ struct pxa2xx_spi_master *platform_info;11761176+ struct spi_master *master;11771177+ struct driver_data *drv_data = 0;11781178+ struct resource *memory_resource;11791179+ int irq;11801180+ int status = 0;11811181+11821182+ platform_info = dev->platform_data;11831183+11841184+ if (platform_info->ssp_type == SSP_UNDEFINED) {11851185+ dev_err(&pdev->dev, "undefined SSP\n");11861186+ return -ENODEV;11871187+ }11881188+11891189+ /* Allocate master with space for drv_data and null dma buffer */11901190+ master = spi_alloc_master(dev, sizeof(struct driver_data) + 16);11911191+ if (!master) {11921192+ dev_err(&pdev->dev, "can not alloc spi_master\n");11931193+ return -ENOMEM;11941194+ }11951195+ drv_data = spi_master_get_devdata(master);11961196+ drv_data->master = master;11971197+ drv_data->master_info = platform_info;11981198+ drv_data->pdev = pdev;11991199+12001200+ master->bus_num = pdev->id;12011201+ master->num_chipselect = platform_info->num_chipselect;12021202+ master->cleanup = cleanup;12031203+ master->setup = setup;12041204+ master->transfer = transfer;12051205+12061206+ drv_data->ssp_type = platform_info->ssp_type;12071207+ drv_data->null_dma_buf = (u32 *)ALIGN((u32)(drv_data +12081208+ sizeof(struct driver_data)), 8);12091209+12101210+ /* Setup register addresses */12111211+ memory_resource = platform_get_resource(pdev, IORESOURCE_MEM, 0);12121212+ if (!memory_resource) {12131213+ dev_err(&pdev->dev, "memory resources not defined\n");12141214+ status = -ENODEV;12151215+ goto out_error_master_alloc;12161216+ }12171217+12181218+ drv_data->ioaddr = (void *)io_p2v((unsigned long)(memory_resource->start));12191219+ drv_data->ssdr_physical = memory_resource->start + 0x00000010;12201220+ if (platform_info->ssp_type == PXA25x_SSP) {12211221+ drv_data->int_cr1 = SSCR1_TIE | SSCR1_RIE;12221222+ drv_data->dma_cr1 = 0;12231223+ drv_data->clear_sr = SSSR_ROR;12241224+ drv_data->mask_sr = SSSR_RFS | SSSR_TFS | SSSR_ROR;12251225+ } else {12261226+ drv_data->int_cr1 = SSCR1_TIE | SSCR1_RIE | SSCR1_TINTE;12271227+ drv_data->dma_cr1 = SSCR1_TSRE | SSCR1_RSRE | SSCR1_TINTE;12281228+ drv_data->clear_sr = SSSR_ROR | SSSR_TINT;12291229+ drv_data->mask_sr = SSSR_TINT | SSSR_RFS | SSSR_TFS | SSSR_ROR;12301230+ }12311231+12321232+ /* Attach to IRQ */12331233+ irq = platform_get_irq(pdev, 0);12341234+ if (irq < 0) {12351235+ dev_err(&pdev->dev, "irq resource not defined\n");12361236+ status = -ENODEV;12371237+ goto out_error_master_alloc;12381238+ }12391239+12401240+ status = request_irq(irq, ssp_int, 0, dev->bus_id, drv_data);12411241+ if (status < 0) {12421242+ dev_err(&pdev->dev, "can not get IRQ\n");12431243+ goto out_error_master_alloc;12441244+ }12451245+12461246+ /* Setup DMA if requested */12471247+ drv_data->tx_channel = -1;12481248+ drv_data->rx_channel = -1;12491249+ if (platform_info->enable_dma) {12501250+12511251+ /* Get two DMA channels (rx and tx) */12521252+ drv_data->rx_channel = pxa_request_dma("pxa2xx_spi_ssp_rx",12531253+ DMA_PRIO_HIGH,12541254+ dma_handler,12551255+ drv_data);12561256+ if (drv_data->rx_channel < 0) {12571257+ dev_err(dev, "problem (%d) requesting rx channel\n",12581258+ drv_data->rx_channel);12591259+ status = -ENODEV;12601260+ goto out_error_irq_alloc;12611261+ }12621262+ drv_data->tx_channel = pxa_request_dma("pxa2xx_spi_ssp_tx",12631263+ DMA_PRIO_MEDIUM,12641264+ dma_handler,12651265+ drv_data);12661266+ if (drv_data->tx_channel < 0) {12671267+ dev_err(dev, "problem (%d) requesting tx channel\n",12681268+ drv_data->tx_channel);12691269+ status = -ENODEV;12701270+ goto out_error_dma_alloc;12711271+ }12721272+12731273+ if (drv_data->ioaddr == SSP1_VIRT) {12741274+ DRCMRRXSSDR = DRCMR_MAPVLD12751275+ | drv_data->rx_channel;12761276+ DRCMRTXSSDR = DRCMR_MAPVLD12771277+ | drv_data->tx_channel;12781278+ } else if (drv_data->ioaddr == SSP2_VIRT) {12791279+ DRCMRRXSS2DR = DRCMR_MAPVLD12801280+ | drv_data->rx_channel;12811281+ DRCMRTXSS2DR = DRCMR_MAPVLD12821282+ | drv_data->tx_channel;12831283+ } else if (drv_data->ioaddr == SSP3_VIRT) {12841284+ DRCMRRXSS3DR = DRCMR_MAPVLD12851285+ | drv_data->rx_channel;12861286+ DRCMRTXSS3DR = DRCMR_MAPVLD12871287+ | drv_data->tx_channel;12881288+ } else {12891289+ dev_err(dev, "bad SSP type\n");12901290+ goto out_error_dma_alloc;12911291+ }12921292+ }12931293+12941294+ /* Enable SOC clock */12951295+ pxa_set_cken(platform_info->clock_enable, 1);12961296+12971297+ /* Load default SSP configuration */12981298+ write_SSCR0(0, drv_data->ioaddr);12991299+ write_SSCR1(SSCR1_RxTresh(4) | SSCR1_TxTresh(12), drv_data->ioaddr);13001300+ write_SSCR0(SSCR0_SerClkDiv(2)13011301+ | SSCR0_Motorola13021302+ | SSCR0_DataSize(8),13031303+ drv_data->ioaddr);13041304+ if (drv_data->ssp_type != PXA25x_SSP)13051305+ write_SSTO(0, drv_data->ioaddr);13061306+ write_SSPSP(0, drv_data->ioaddr);13071307+13081308+ /* Initial and start queue */13091309+ status = init_queue(drv_data);13101310+ if (status != 0) {13111311+ dev_err(&pdev->dev, "problem initializing queue\n");13121312+ goto out_error_clock_enabled;13131313+ }13141314+ status = start_queue(drv_data);13151315+ if (status != 0) {13161316+ dev_err(&pdev->dev, "problem starting queue\n");13171317+ goto out_error_clock_enabled;13181318+ }13191319+13201320+ /* Register with the SPI framework */13211321+ platform_set_drvdata(pdev, drv_data);13221322+ status = spi_register_master(master);13231323+ if (status != 0) {13241324+ dev_err(&pdev->dev, "problem registering spi master\n");13251325+ goto out_error_queue_alloc;13261326+ }13271327+13281328+ return status;13291329+13301330+out_error_queue_alloc:13311331+ destroy_queue(drv_data);13321332+13331333+out_error_clock_enabled:13341334+ pxa_set_cken(platform_info->clock_enable, 0);13351335+13361336+out_error_dma_alloc:13371337+ if (drv_data->tx_channel != -1)13381338+ pxa_free_dma(drv_data->tx_channel);13391339+ if (drv_data->rx_channel != -1)13401340+ pxa_free_dma(drv_data->rx_channel);13411341+13421342+out_error_irq_alloc:13431343+ free_irq(irq, drv_data);13441344+13451345+out_error_master_alloc:13461346+ spi_master_put(master);13471347+ return status;13481348+}13491349+13501350+static int pxa2xx_spi_remove(struct platform_device *pdev)13511351+{13521352+ struct driver_data *drv_data = platform_get_drvdata(pdev);13531353+ int irq;13541354+ int status = 0;13551355+13561356+ if (!drv_data)13571357+ return 0;13581358+13591359+ /* Remove the queue */13601360+ status = destroy_queue(drv_data);13611361+ if (status != 0)13621362+ return status;13631363+13641364+ /* Disable the SSP at the peripheral and SOC level */13651365+ write_SSCR0(0, drv_data->ioaddr);13661366+ pxa_set_cken(drv_data->master_info->clock_enable, 0);13671367+13681368+ /* Release DMA */13691369+ if (drv_data->master_info->enable_dma) {13701370+ if (drv_data->ioaddr == SSP1_VIRT) {13711371+ DRCMRRXSSDR = 0;13721372+ DRCMRTXSSDR = 0;13731373+ } else if (drv_data->ioaddr == SSP2_VIRT) {13741374+ DRCMRRXSS2DR = 0;13751375+ DRCMRTXSS2DR = 0;13761376+ } else if (drv_data->ioaddr == SSP3_VIRT) {13771377+ DRCMRRXSS3DR = 0;13781378+ DRCMRTXSS3DR = 0;13791379+ }13801380+ pxa_free_dma(drv_data->tx_channel);13811381+ pxa_free_dma(drv_data->rx_channel);13821382+ }13831383+13841384+ /* Release IRQ */13851385+ irq = platform_get_irq(pdev, 0);13861386+ if (irq >= 0)13871387+ free_irq(irq, drv_data);13881388+13891389+ /* Disconnect from the SPI framework */13901390+ spi_unregister_master(drv_data->master);13911391+13921392+ /* Prevent double remove */13931393+ platform_set_drvdata(pdev, NULL);13941394+13951395+ return 0;13961396+}13971397+13981398+static void pxa2xx_spi_shutdown(struct platform_device *pdev)13991399+{14001400+ int status = 0;14011401+14021402+ if ((status = pxa2xx_spi_remove(pdev)) != 0)14031403+ dev_err(&pdev->dev, "shutdown failed with %d\n", status);14041404+}14051405+14061406+#ifdef CONFIG_PM14071407+static int suspend_devices(struct device *dev, void *pm_message)14081408+{14091409+ pm_message_t *state = pm_message;14101410+14111411+ if (dev->power.power_state.event != state->event) {14121412+ dev_warn(dev, "pm state does not match request\n");14131413+ return -1;14141414+ }14151415+14161416+ return 0;14171417+}14181418+14191419+static int pxa2xx_spi_suspend(struct platform_device *pdev, pm_message_t state)14201420+{14211421+ struct driver_data *drv_data = platform_get_drvdata(pdev);14221422+ int status = 0;14231423+14241424+ /* Check all childern for current power state */14251425+ if (device_for_each_child(&pdev->dev, &state, suspend_devices) != 0) {14261426+ dev_warn(&pdev->dev, "suspend aborted\n");14271427+ return -1;14281428+ }14291429+14301430+ status = stop_queue(drv_data);14311431+ if (status != 0)14321432+ return status;14331433+ write_SSCR0(0, drv_data->ioaddr);14341434+ pxa_set_cken(drv_data->master_info->clock_enable, 0);14351435+14361436+ return 0;14371437+}14381438+14391439+static int pxa2xx_spi_resume(struct platform_device *pdev)14401440+{14411441+ struct driver_data *drv_data = platform_get_drvdata(pdev);14421442+ int status = 0;14431443+14441444+ /* Enable the SSP clock */14451445+ pxa_set_cken(drv_data->master_info->clock_enable, 1);14461446+14471447+ /* Start the queue running */14481448+ status = start_queue(drv_data);14491449+ if (status != 0) {14501450+ dev_err(&pdev->dev, "problem starting queue (%d)\n", status);14511451+ return status;14521452+ }14531453+14541454+ return 0;14551455+}14561456+#else14571457+#define pxa2xx_spi_suspend NULL14581458+#define pxa2xx_spi_resume NULL14591459+#endif /* CONFIG_PM */14601460+14611461+static struct platform_driver driver = {14621462+ .driver = {14631463+ .name = "pxa2xx-spi",14641464+ .bus = &platform_bus_type,14651465+ .owner = THIS_MODULE,14661466+ },14671467+ .probe = pxa2xx_spi_probe,14681468+ .remove = __devexit_p(pxa2xx_spi_remove),14691469+ .shutdown = pxa2xx_spi_shutdown,14701470+ .suspend = pxa2xx_spi_suspend,14711471+ .resume = pxa2xx_spi_resume,14721472+};14731473+14741474+static int __init pxa2xx_spi_init(void)14751475+{14761476+ platform_driver_register(&driver);14771477+14781478+ return 0;14791479+}14801480+module_init(pxa2xx_spi_init);14811481+14821482+static void __exit pxa2xx_spi_exit(void)14831483+{14841484+ platform_driver_unregister(&driver);14851485+}14861486+module_exit(pxa2xx_spi_exit);
+7-6
drivers/spi/spi.c
···338338 * spi_alloc_master - allocate SPI master controller339339 * @dev: the controller, possibly using the platform_bus340340 * @size: how much driver-private data to preallocate; the pointer to this341341- * memory is in the class_data field of the returned class_device,341341+ * memory is in the class_data field of the returned class_device,342342 * accessible with spi_master_get_devdata().343343 *344344 * This call is used only by SPI master controller drivers, which are the345345 * only ones directly touching chip registers. It's how they allocate346346- * an spi_master structure, prior to calling spi_add_master().346346+ * an spi_master structure, prior to calling spi_register_master().347347 *348348 * This must be called from context that can sleep. It returns the SPI349349 * master structure on success, else NULL.350350 *351351 * The caller is responsible for assigning the bus number and initializing352352- * the master's methods before calling spi_add_master(); and (after errors352352+ * the master's methods before calling spi_register_master(); and (after errors353353 * adding the device) calling spi_master_put() to prevent a memory leak.354354 */355355struct spi_master * __init_or_module···395395int __init_or_module396396spi_register_master(struct spi_master *master)397397{398398- static atomic_t dyn_bus_id = ATOMIC_INIT(0);398398+ static atomic_t dyn_bus_id = ATOMIC_INIT((1<<16) - 1);399399 struct device *dev = master->cdev.dev;400400 int status = -ENODEV;401401 int dynamic = 0;···404404 return -ENODEV;405405406406 /* convention: dynamically assigned bus IDs count down from the max */407407- if (master->bus_num == 0) {407407+ if (master->bus_num < 0) {408408 master->bus_num = atomic_dec_return(&dyn_bus_id);409409 dynamic = 1;410410 }···522522}523523EXPORT_SYMBOL_GPL(spi_sync);524524525525-#define SPI_BUFSIZ (SMP_CACHE_BYTES)525525+/* portable code must never pass more than 32 bytes */526526+#define SPI_BUFSIZ max(32,SMP_CACHE_BYTES)526527527528static u8 *buf;528529
+84-20
drivers/spi/spi_bitbang.c
···138138 return t->len - count;139139}140140141141+int spi_bitbang_setup_transfer(struct spi_device *spi, struct spi_transfer *t)142142+{143143+ struct spi_bitbang_cs *cs = spi->controller_state;144144+ u8 bits_per_word;145145+ u32 hz;146146+147147+ if (t) {148148+ bits_per_word = t->bits_per_word;149149+ hz = t->speed_hz;150150+ } else {151151+ bits_per_word = 0;152152+ hz = 0;153153+ }154154+155155+ /* spi_transfer level calls that work per-word */156156+ if (!bits_per_word)157157+ bits_per_word = spi->bits_per_word;158158+ if (bits_per_word <= 8)159159+ cs->txrx_bufs = bitbang_txrx_8;160160+ else if (bits_per_word <= 16)161161+ cs->txrx_bufs = bitbang_txrx_16;162162+ else if (bits_per_word <= 32)163163+ cs->txrx_bufs = bitbang_txrx_32;164164+ else165165+ return -EINVAL;166166+167167+ /* nsecs = (clock period)/2 */168168+ if (!hz)169169+ hz = spi->max_speed_hz;170170+ if (hz) {171171+ cs->nsecs = (1000000000/2) / hz;172172+ if (cs->nsecs > (MAX_UDELAY_MS * 1000 * 1000))173173+ return -EINVAL;174174+ }175175+176176+ return 0;177177+}178178+EXPORT_SYMBOL_GPL(spi_bitbang_setup_transfer);179179+141180/**142181 * spi_bitbang_setup - default setup for per-word I/O loops143182 */···184145{185146 struct spi_bitbang_cs *cs = spi->controller_state;186147 struct spi_bitbang *bitbang;148148+ int retval;187149188188- if (!spi->max_speed_hz)150150+ bitbang = spi_master_get_devdata(spi->master);151151+152152+ /* REVISIT: some systems will want to support devices using lsb-first153153+ * bit encodings on the wire. In pure software that would be trivial,154154+ * just bitbang_txrx_le_cphaX() routines shifting the other way, and155155+ * some hardware controllers also have this support.156156+ */157157+ if ((spi->mode & SPI_LSB_FIRST) != 0)189158 return -EINVAL;190159191160 if (!cs) {···202155 return -ENOMEM;203156 spi->controller_state = cs;204157 }205205- bitbang = spi_master_get_devdata(spi->master);206158207159 if (!spi->bits_per_word)208160 spi->bits_per_word = 8;209209-210210- /* spi_transfer level calls that work per-word */211211- if (spi->bits_per_word <= 8)212212- cs->txrx_bufs = bitbang_txrx_8;213213- else if (spi->bits_per_word <= 16)214214- cs->txrx_bufs = bitbang_txrx_16;215215- else if (spi->bits_per_word <= 32)216216- cs->txrx_bufs = bitbang_txrx_32;217217- else218218- return -EINVAL;219161220162 /* per-word shift register access, in hardware or bitbanging */221163 cs->txrx_word = bitbang->txrx_word[spi->mode & (SPI_CPOL|SPI_CPHA)];222164 if (!cs->txrx_word)223165 return -EINVAL;224166225225- /* nsecs = (clock period)/2 */226226- cs->nsecs = (1000000000/2) / (spi->max_speed_hz);227227- if (cs->nsecs > MAX_UDELAY_MS * 1000)228228- return -EINVAL;167167+ retval = spi_bitbang_setup_transfer(spi, NULL);168168+ if (retval < 0)169169+ return retval;229170230230- dev_dbg(&spi->dev, "%s, mode %d, %u bits/w, %u nsec\n",171171+ dev_dbg(&spi->dev, "%s, mode %d, %u bits/w, %u nsec/bit\n",231172 __FUNCTION__, spi->mode & (SPI_CPOL | SPI_CPHA),232173 spi->bits_per_word, 2 * cs->nsecs);233174···281246 unsigned tmp;282247 unsigned cs_change;283248 int status;249249+ int (*setup_transfer)(struct spi_device *,250250+ struct spi_transfer *);284251285252 m = container_of(bitbang->queue.next, struct spi_message,286253 queue);···299262 tmp = 0;300263 cs_change = 1;301264 status = 0;265265+ setup_transfer = NULL;302266303267 list_for_each_entry (t, &m->transfers, transfer_list) {304268 if (bitbang->shutdown) {305269 status = -ESHUTDOWN;306270 break;271271+ }272272+273273+ /* override or restore speed and wordsize */274274+ if (t->speed_hz || t->bits_per_word) {275275+ setup_transfer = bitbang->setup_transfer;276276+ if (!setup_transfer) {277277+ status = -ENOPROTOOPT;278278+ break;279279+ }280280+ }281281+ if (setup_transfer) {282282+ status = setup_transfer(spi, t);283283+ if (status < 0)284284+ break;307285 }308286309287 /* set up default clock polarity, and activate chip;···377325 m->status = status;378326 m->complete(m->context);379327328328+ /* restore speed and wordsize */329329+ if (setup_transfer)330330+ setup_transfer(spi, NULL);331331+380332 /* normally deactivate chipselect ... unless no error and381333 * cs_change has hinted that the next message will probably382334 * be for this chip too.···404348{405349 struct spi_bitbang *bitbang;406350 unsigned long flags;351351+ int status = 0;407352408353 m->actual_length = 0;409354 m->status = -EINPROGRESS;···414357 return -ESHUTDOWN;415358416359 spin_lock_irqsave(&bitbang->lock, flags);417417- list_add_tail(&m->queue, &bitbang->queue);418418- queue_work(bitbang->workqueue, &bitbang->work);360360+ if (!spi->max_speed_hz)361361+ status = -ENETDOWN;362362+ else {363363+ list_add_tail(&m->queue, &bitbang->queue);364364+ queue_work(bitbang->workqueue, &bitbang->work);365365+ }419366 spin_unlock_irqrestore(&bitbang->lock, flags);420367421421- return 0;368368+ return status;422369}423370EXPORT_SYMBOL_GPL(spi_bitbang_transfer);424371···467406 bitbang->use_dma = 0;468407 bitbang->txrx_bufs = spi_bitbang_bufs;469408 if (!bitbang->master->setup) {409409+ if (!bitbang->setup_transfer)410410+ bitbang->setup_transfer =411411+ spi_bitbang_setup_transfer;470412 bitbang->master->setup = spi_bitbang_setup;471413 bitbang->master->cleanup = spi_bitbang_cleanup;472414 }
+1
drivers/spi/spi_butterfly.c
···321321 * (firmware resets at45, acts as spi slave) or neither (we ignore322322 * both, AVR uses AT45). Here we expect firmware for the first option.323323 */324324+324325 pp->info[0].max_speed_hz = 15 * 1000 * 1000;325326 strcpy(pp->info[0].modalias, "mtd_dataflash");326327 pp->info[0].platform_data = &flash;
+483
drivers/spi/spi_mpc83xx.c
···11+/*22+ * MPC83xx SPI controller driver.33+ *44+ * Maintainer: Kumar Gala55+ *66+ * Copyright (C) 2006 Polycom, Inc.77+ *88+ * This program is free software; you can redistribute it and/or modify it99+ * under the terms of the GNU General Public License as published by the1010+ * Free Software Foundation; either version 2 of the License, or (at your1111+ * option) any later version.1212+ */1313+#include <linux/module.h>1414+#include <linux/init.h>1515+#include <linux/types.h>1616+#include <linux/kernel.h>1717+#include <linux/completion.h>1818+#include <linux/interrupt.h>1919+#include <linux/delay.h>2020+#include <linux/irq.h>2121+#include <linux/device.h>2222+#include <linux/spi/spi.h>2323+#include <linux/spi/spi_bitbang.h>2424+#include <linux/platform_device.h>2525+#include <linux/fsl_devices.h>2626+2727+#include <asm/irq.h>2828+#include <asm/io.h>2929+3030+/* SPI Controller registers */3131+struct mpc83xx_spi_reg {3232+ u8 res1[0x20];3333+ __be32 mode;3434+ __be32 event;3535+ __be32 mask;3636+ __be32 command;3737+ __be32 transmit;3838+ __be32 receive;3939+};4040+4141+/* SPI Controller mode register definitions */4242+#define SPMODE_CI_INACTIVEHIGH (1 << 29)4343+#define SPMODE_CP_BEGIN_EDGECLK (1 << 28)4444+#define SPMODE_DIV16 (1 << 27)4545+#define SPMODE_REV (1 << 26)4646+#define SPMODE_MS (1 << 25)4747+#define SPMODE_ENABLE (1 << 24)4848+#define SPMODE_LEN(x) ((x) << 20)4949+#define SPMODE_PM(x) ((x) << 16)5050+5151+/*5252+ * Default for SPI Mode:5353+ * SPI MODE 0 (inactive low, phase middle, MSB, 8-bit length, slow clk5454+ */5555+#define SPMODE_INIT_VAL (SPMODE_CI_INACTIVEHIGH | SPMODE_DIV16 | SPMODE_REV | \5656+ SPMODE_MS | SPMODE_LEN(7) | SPMODE_PM(0xf))5757+5858+/* SPIE register values */5959+#define SPIE_NE 0x00000200 /* Not empty */6060+#define SPIE_NF 0x00000100 /* Not full */6161+6262+/* SPIM register values */6363+#define SPIM_NE 0x00000200 /* Not empty */6464+#define SPIM_NF 0x00000100 /* Not full */6565+6666+/* SPI Controller driver's private data. */6767+struct mpc83xx_spi {6868+ /* bitbang has to be first */6969+ struct spi_bitbang bitbang;7070+ struct completion done;7171+7272+ struct mpc83xx_spi_reg __iomem *base;7373+7474+ /* rx & tx bufs from the spi_transfer */7575+ const void *tx;7676+ void *rx;7777+7878+ /* functions to deal with different sized buffers */7979+ void (*get_rx) (u32 rx_data, struct mpc83xx_spi *);8080+ u32(*get_tx) (struct mpc83xx_spi *);8181+8282+ unsigned int count;8383+ u32 irq;8484+8585+ unsigned nsecs; /* (clock cycle time)/2 */8686+8787+ u32 sysclk;8888+ void (*activate_cs) (u8 cs, u8 polarity);8989+ void (*deactivate_cs) (u8 cs, u8 polarity);9090+};9191+9292+static inline void mpc83xx_spi_write_reg(__be32 __iomem * reg, u32 val)9393+{9494+ out_be32(reg, val);9595+}9696+9797+static inline u32 mpc83xx_spi_read_reg(__be32 __iomem * reg)9898+{9999+ return in_be32(reg);100100+}101101+102102+#define MPC83XX_SPI_RX_BUF(type) \103103+void mpc83xx_spi_rx_buf_##type(u32 data, struct mpc83xx_spi *mpc83xx_spi) \104104+{ \105105+ type * rx = mpc83xx_spi->rx; \106106+ *rx++ = (type)data; \107107+ mpc83xx_spi->rx = rx; \108108+}109109+110110+#define MPC83XX_SPI_TX_BUF(type) \111111+u32 mpc83xx_spi_tx_buf_##type(struct mpc83xx_spi *mpc83xx_spi) \112112+{ \113113+ u32 data; \114114+ const type * tx = mpc83xx_spi->tx; \115115+ data = *tx++; \116116+ mpc83xx_spi->tx = tx; \117117+ return data; \118118+}119119+120120+MPC83XX_SPI_RX_BUF(u8)121121+MPC83XX_SPI_RX_BUF(u16)122122+MPC83XX_SPI_RX_BUF(u32)123123+MPC83XX_SPI_TX_BUF(u8)124124+MPC83XX_SPI_TX_BUF(u16)125125+MPC83XX_SPI_TX_BUF(u32)126126+127127+static void mpc83xx_spi_chipselect(struct spi_device *spi, int value)128128+{129129+ struct mpc83xx_spi *mpc83xx_spi;130130+ u8 pol = spi->mode & SPI_CS_HIGH ? 1 : 0;131131+132132+ mpc83xx_spi = spi_master_get_devdata(spi->master);133133+134134+ if (value == BITBANG_CS_INACTIVE) {135135+ if (mpc83xx_spi->deactivate_cs)136136+ mpc83xx_spi->deactivate_cs(spi->chip_select, pol);137137+ }138138+139139+ if (value == BITBANG_CS_ACTIVE) {140140+ u32 regval = mpc83xx_spi_read_reg(&mpc83xx_spi->base->mode);141141+ u32 len = spi->bits_per_word;142142+ if (len == 32)143143+ len = 0;144144+ else145145+ len = len - 1;146146+147147+ /* mask out bits we are going to set */148148+ regval &= ~0x38ff0000;149149+150150+ if (spi->mode & SPI_CPHA)151151+ regval |= SPMODE_CP_BEGIN_EDGECLK;152152+ if (spi->mode & SPI_CPOL)153153+ regval |= SPMODE_CI_INACTIVEHIGH;154154+155155+ regval |= SPMODE_LEN(len);156156+157157+ if ((mpc83xx_spi->sysclk / spi->max_speed_hz) >= 64) {158158+ u8 pm = mpc83xx_spi->sysclk / (spi->max_speed_hz * 64);159159+ regval |= SPMODE_PM(pm) | SPMODE_DIV16;160160+ } else {161161+ u8 pm = mpc83xx_spi->sysclk / (spi->max_speed_hz * 4);162162+ regval |= SPMODE_PM(pm);163163+ }164164+165165+ mpc83xx_spi_write_reg(&mpc83xx_spi->base->mode, regval);166166+ if (mpc83xx_spi->activate_cs)167167+ mpc83xx_spi->activate_cs(spi->chip_select, pol);168168+ }169169+}170170+171171+static172172+int mpc83xx_spi_setup_transfer(struct spi_device *spi, struct spi_transfer *t)173173+{174174+ struct mpc83xx_spi *mpc83xx_spi;175175+ u32 regval;176176+ u8 bits_per_word;177177+ u32 hz;178178+179179+ mpc83xx_spi = spi_master_get_devdata(spi->master);180180+181181+ if (t) {182182+ bits_per_word = t->bits_per_word;183183+ hz = t->speed_hz;184184+ } else {185185+ bits_per_word = 0;186186+ hz = 0;187187+ }188188+189189+ /* spi_transfer level calls that work per-word */190190+ if (!bits_per_word)191191+ bits_per_word = spi->bits_per_word;192192+193193+ /* Make sure its a bit width we support [4..16, 32] */194194+ if ((bits_per_word < 4)195195+ || ((bits_per_word > 16) && (bits_per_word != 32)))196196+ return -EINVAL;197197+198198+ if (bits_per_word <= 8) {199199+ mpc83xx_spi->get_rx = mpc83xx_spi_rx_buf_u8;200200+ mpc83xx_spi->get_tx = mpc83xx_spi_tx_buf_u8;201201+ } else if (bits_per_word <= 16) {202202+ mpc83xx_spi->get_rx = mpc83xx_spi_rx_buf_u16;203203+ mpc83xx_spi->get_tx = mpc83xx_spi_tx_buf_u16;204204+ } else if (bits_per_word <= 32) {205205+ mpc83xx_spi->get_rx = mpc83xx_spi_rx_buf_u32;206206+ mpc83xx_spi->get_tx = mpc83xx_spi_tx_buf_u32;207207+ } else208208+ return -EINVAL;209209+210210+ /* nsecs = (clock period)/2 */211211+ if (!hz)212212+ hz = spi->max_speed_hz;213213+ mpc83xx_spi->nsecs = (1000000000 / 2) / hz;214214+ if (mpc83xx_spi->nsecs > MAX_UDELAY_MS * 1000)215215+ return -EINVAL;216216+217217+ if (bits_per_word == 32)218218+ bits_per_word = 0;219219+ else220220+ bits_per_word = bits_per_word - 1;221221+222222+ regval = mpc83xx_spi_read_reg(&mpc83xx_spi->base->mode);223223+224224+ /* Mask out bits_per_wordgth */225225+ regval &= 0xff0fffff;226226+ regval |= SPMODE_LEN(bits_per_word);227227+228228+ mpc83xx_spi_write_reg(&mpc83xx_spi->base->mode, regval);229229+230230+ return 0;231231+}232232+233233+static int mpc83xx_spi_setup(struct spi_device *spi)234234+{235235+ struct spi_bitbang *bitbang;236236+ struct mpc83xx_spi *mpc83xx_spi;237237+ int retval;238238+239239+ if (!spi->max_speed_hz)240240+ return -EINVAL;241241+242242+ bitbang = spi_master_get_devdata(spi->master);243243+ mpc83xx_spi = spi_master_get_devdata(spi->master);244244+245245+ if (!spi->bits_per_word)246246+ spi->bits_per_word = 8;247247+248248+ retval = mpc83xx_spi_setup_transfer(spi, NULL);249249+ if (retval < 0)250250+ return retval;251251+252252+ dev_dbg(&spi->dev, "%s, mode %d, %u bits/w, %u nsec\n",253253+ __FUNCTION__, spi->mode & (SPI_CPOL | SPI_CPHA),254254+ spi->bits_per_word, 2 * mpc83xx_spi->nsecs);255255+256256+ /* NOTE we _need_ to call chipselect() early, ideally with adapter257257+ * setup, unless the hardware defaults cooperate to avoid confusion258258+ * between normal (active low) and inverted chipselects.259259+ */260260+261261+ /* deselect chip (low or high) */262262+ spin_lock(&bitbang->lock);263263+ if (!bitbang->busy) {264264+ bitbang->chipselect(spi, BITBANG_CS_INACTIVE);265265+ ndelay(mpc83xx_spi->nsecs);266266+ }267267+ spin_unlock(&bitbang->lock);268268+269269+ return 0;270270+}271271+272272+static int mpc83xx_spi_bufs(struct spi_device *spi, struct spi_transfer *t)273273+{274274+ struct mpc83xx_spi *mpc83xx_spi;275275+ u32 word;276276+277277+ mpc83xx_spi = spi_master_get_devdata(spi->master);278278+279279+ mpc83xx_spi->tx = t->tx_buf;280280+ mpc83xx_spi->rx = t->rx_buf;281281+ mpc83xx_spi->count = t->len;282282+ INIT_COMPLETION(mpc83xx_spi->done);283283+284284+ /* enable rx ints */285285+ mpc83xx_spi_write_reg(&mpc83xx_spi->base->mask, SPIM_NE);286286+287287+ /* transmit word */288288+ word = mpc83xx_spi->get_tx(mpc83xx_spi);289289+ mpc83xx_spi_write_reg(&mpc83xx_spi->base->transmit, word);290290+291291+ wait_for_completion(&mpc83xx_spi->done);292292+293293+ /* disable rx ints */294294+ mpc83xx_spi_write_reg(&mpc83xx_spi->base->mask, 0);295295+296296+ return t->len - mpc83xx_spi->count;297297+}298298+299299+irqreturn_t mpc83xx_spi_irq(s32 irq, void *context_data,300300+ struct pt_regs * ptregs)301301+{302302+ struct mpc83xx_spi *mpc83xx_spi = context_data;303303+ u32 event;304304+ irqreturn_t ret = IRQ_NONE;305305+306306+ /* Get interrupt events(tx/rx) */307307+ event = mpc83xx_spi_read_reg(&mpc83xx_spi->base->event);308308+309309+ /* We need handle RX first */310310+ if (event & SPIE_NE) {311311+ u32 rx_data = mpc83xx_spi_read_reg(&mpc83xx_spi->base->receive);312312+313313+ if (mpc83xx_spi->rx)314314+ mpc83xx_spi->get_rx(rx_data, mpc83xx_spi);315315+316316+ ret = IRQ_HANDLED;317317+ }318318+319319+ if ((event & SPIE_NF) == 0)320320+ /* spin until TX is done */321321+ while (((event =322322+ mpc83xx_spi_read_reg(&mpc83xx_spi->base->event)) &323323+ SPIE_NF) == 0)324324+ cpu_relax();325325+326326+ mpc83xx_spi->count -= 1;327327+ if (mpc83xx_spi->count) {328328+ if (mpc83xx_spi->tx) {329329+ u32 word = mpc83xx_spi->get_tx(mpc83xx_spi);330330+ mpc83xx_spi_write_reg(&mpc83xx_spi->base->transmit,331331+ word);332332+ }333333+ } else {334334+ complete(&mpc83xx_spi->done);335335+ }336336+337337+ /* Clear the events */338338+ mpc83xx_spi_write_reg(&mpc83xx_spi->base->event, event);339339+340340+ return ret;341341+}342342+343343+static int __init mpc83xx_spi_probe(struct platform_device *dev)344344+{345345+ struct spi_master *master;346346+ struct mpc83xx_spi *mpc83xx_spi;347347+ struct fsl_spi_platform_data *pdata;348348+ struct resource *r;349349+ u32 regval;350350+ int ret = 0;351351+352352+ /* Get resources(memory, IRQ) associated with the device */353353+ master = spi_alloc_master(&dev->dev, sizeof(struct mpc83xx_spi));354354+355355+ if (master == NULL) {356356+ ret = -ENOMEM;357357+ goto err;358358+ }359359+360360+ platform_set_drvdata(dev, master);361361+ pdata = dev->dev.platform_data;362362+363363+ if (pdata == NULL) {364364+ ret = -ENODEV;365365+ goto free_master;366366+ }367367+368368+ r = platform_get_resource(dev, IORESOURCE_MEM, 0);369369+ if (r == NULL) {370370+ ret = -ENODEV;371371+ goto free_master;372372+ }373373+374374+ mpc83xx_spi = spi_master_get_devdata(master);375375+ mpc83xx_spi->bitbang.master = spi_master_get(master);376376+ mpc83xx_spi->bitbang.chipselect = mpc83xx_spi_chipselect;377377+ mpc83xx_spi->bitbang.setup_transfer = mpc83xx_spi_setup_transfer;378378+ mpc83xx_spi->bitbang.txrx_bufs = mpc83xx_spi_bufs;379379+ mpc83xx_spi->sysclk = pdata->sysclk;380380+ mpc83xx_spi->activate_cs = pdata->activate_cs;381381+ mpc83xx_spi->deactivate_cs = pdata->deactivate_cs;382382+ mpc83xx_spi->get_rx = mpc83xx_spi_rx_buf_u8;383383+ mpc83xx_spi->get_tx = mpc83xx_spi_tx_buf_u8;384384+385385+ mpc83xx_spi->bitbang.master->setup = mpc83xx_spi_setup;386386+ init_completion(&mpc83xx_spi->done);387387+388388+ mpc83xx_spi->base = ioremap(r->start, r->end - r->start + 1);389389+ if (mpc83xx_spi->base == NULL) {390390+ ret = -ENOMEM;391391+ goto put_master;392392+ }393393+394394+ mpc83xx_spi->irq = platform_get_irq(dev, 0);395395+396396+ if (mpc83xx_spi->irq < 0) {397397+ ret = -ENXIO;398398+ goto unmap_io;399399+ }400400+401401+ /* Register for SPI Interrupt */402402+ ret = request_irq(mpc83xx_spi->irq, mpc83xx_spi_irq,403403+ 0, "mpc83xx_spi", mpc83xx_spi);404404+405405+ if (ret != 0)406406+ goto unmap_io;407407+408408+ master->bus_num = pdata->bus_num;409409+ master->num_chipselect = pdata->max_chipselect;410410+411411+ /* SPI controller initializations */412412+ mpc83xx_spi_write_reg(&mpc83xx_spi->base->mode, 0);413413+ mpc83xx_spi_write_reg(&mpc83xx_spi->base->mask, 0);414414+ mpc83xx_spi_write_reg(&mpc83xx_spi->base->command, 0);415415+ mpc83xx_spi_write_reg(&mpc83xx_spi->base->event, 0xffffffff);416416+417417+ /* Enable SPI interface */418418+ regval = pdata->initial_spmode | SPMODE_INIT_VAL | SPMODE_ENABLE;419419+ mpc83xx_spi_write_reg(&mpc83xx_spi->base->mode, regval);420420+421421+ ret = spi_bitbang_start(&mpc83xx_spi->bitbang);422422+423423+ if (ret != 0)424424+ goto free_irq;425425+426426+ printk(KERN_INFO427427+ "%s: MPC83xx SPI Controller driver at 0x%p (irq = %d)\n",428428+ dev->dev.bus_id, mpc83xx_spi->base, mpc83xx_spi->irq);429429+430430+ return ret;431431+432432+free_irq:433433+ free_irq(mpc83xx_spi->irq, mpc83xx_spi);434434+unmap_io:435435+ iounmap(mpc83xx_spi->base);436436+put_master:437437+ spi_master_put(master);438438+free_master:439439+ kfree(master);440440+err:441441+ return ret;442442+}443443+444444+static int __devexit mpc83xx_spi_remove(struct platform_device *dev)445445+{446446+ struct mpc83xx_spi *mpc83xx_spi;447447+ struct spi_master *master;448448+449449+ master = platform_get_drvdata(dev);450450+ mpc83xx_spi = spi_master_get_devdata(master);451451+452452+ spi_bitbang_stop(&mpc83xx_spi->bitbang);453453+ free_irq(mpc83xx_spi->irq, mpc83xx_spi);454454+ iounmap(mpc83xx_spi->base);455455+ spi_master_put(mpc83xx_spi->bitbang.master);456456+457457+ return 0;458458+}459459+460460+static struct platform_driver mpc83xx_spi_driver = {461461+ .probe = mpc83xx_spi_probe,462462+ .remove = __devexit_p(mpc83xx_spi_remove),463463+ .driver = {464464+ .name = "mpc83xx_spi",465465+ },466466+};467467+468468+static int __init mpc83xx_spi_init(void)469469+{470470+ return platform_driver_register(&mpc83xx_spi_driver);471471+}472472+473473+static void __exit mpc83xx_spi_exit(void)474474+{475475+ platform_driver_unregister(&mpc83xx_spi_driver);476476+}477477+478478+module_init(mpc83xx_spi_init);479479+module_exit(mpc83xx_spi_exit);480480+481481+MODULE_AUTHOR("Kumar Gala");482482+MODULE_DESCRIPTION("Simple MPC83xx SPI Driver");483483+MODULE_LICENSE("GPL");
+453
drivers/spi/spi_s3c24xx.c
···11+/* linux/drivers/spi/spi_s3c24xx.c22+ *33+ * Copyright (c) 2006 Ben Dooks44+ * Copyright (c) 2006 Simtec Electronics55+ * Ben Dooks <ben@simtec.co.uk>66+ *77+ * This program is free software; you can redistribute it and/or modify88+ * it under the terms of the GNU General Public License version 2 as99+ * published by the Free Software Foundation.1010+ *1111+*/1212+1313+1414+//#define DEBUG1515+1616+#include <linux/config.h>1717+#include <linux/init.h>1818+#include <linux/spinlock.h>1919+#include <linux/workqueue.h>2020+#include <linux/interrupt.h>2121+#include <linux/delay.h>2222+#include <linux/errno.h>2323+#include <linux/err.h>2424+#include <linux/clk.h>2525+#include <linux/platform_device.h>2626+2727+#include <linux/spi/spi.h>2828+#include <linux/spi/spi_bitbang.h>2929+3030+#include <asm/io.h>3131+#include <asm/dma.h>3232+#include <asm/hardware.h>3333+3434+#include <asm/arch/regs-gpio.h>3535+#include <asm/arch/regs-spi.h>3636+#include <asm/arch/spi.h>3737+3838+struct s3c24xx_spi {3939+ /* bitbang has to be first */4040+ struct spi_bitbang bitbang;4141+ struct completion done;4242+4343+ void __iomem *regs;4444+ int irq;4545+ int len;4646+ int count;4747+4848+ /* data buffers */4949+ const unsigned char *tx;5050+ unsigned char *rx;5151+5252+ struct clk *clk;5353+ struct resource *ioarea;5454+ struct spi_master *master;5555+ struct spi_device *curdev;5656+ struct device *dev;5757+ struct s3c2410_spi_info *pdata;5858+};5959+6060+#define SPCON_DEFAULT (S3C2410_SPCON_MSTR | S3C2410_SPCON_SMOD_INT)6161+#define SPPIN_DEFAULT (S3C2410_SPPIN_KEEP)6262+6363+static inline struct s3c24xx_spi *to_hw(struct spi_device *sdev)6464+{6565+ return spi_master_get_devdata(sdev->master);6666+}6767+6868+static void s3c24xx_spi_chipsel(struct spi_device *spi, int value)6969+{7070+ struct s3c24xx_spi *hw = to_hw(spi);7171+ unsigned int cspol = spi->mode & SPI_CS_HIGH ? 1 : 0;7272+ unsigned int spcon;7373+7474+ switch (value) {7575+ case BITBANG_CS_INACTIVE:7676+ if (hw->pdata->set_cs)7777+ hw->pdata->set_cs(hw->pdata, value, cspol);7878+ else7979+ s3c2410_gpio_setpin(hw->pdata->pin_cs, cspol ^ 1);8080+ break;8181+8282+ case BITBANG_CS_ACTIVE:8383+ spcon = readb(hw->regs + S3C2410_SPCON);8484+8585+ if (spi->mode & SPI_CPHA)8686+ spcon |= S3C2410_SPCON_CPHA_FMTB;8787+ else8888+ spcon &= ~S3C2410_SPCON_CPHA_FMTB;8989+9090+ if (spi->mode & SPI_CPOL)9191+ spcon |= S3C2410_SPCON_CPOL_HIGH;9292+ else9393+ spcon &= ~S3C2410_SPCON_CPOL_HIGH;9494+9595+ spcon |= S3C2410_SPCON_ENSCK;9696+9797+ /* write new configration */9898+9999+ writeb(spcon, hw->regs + S3C2410_SPCON);100100+101101+ if (hw->pdata->set_cs)102102+ hw->pdata->set_cs(hw->pdata, value, cspol);103103+ else104104+ s3c2410_gpio_setpin(hw->pdata->pin_cs, cspol);105105+106106+ break;107107+108108+ }109109+}110110+111111+static int s3c24xx_spi_setupxfer(struct spi_device *spi,112112+ struct spi_transfer *t)113113+{114114+ struct s3c24xx_spi *hw = to_hw(spi);115115+ unsigned int bpw;116116+ unsigned int hz;117117+ unsigned int div;118118+119119+ bpw = t ? t->bits_per_word : spi->bits_per_word;120120+ hz = t ? t->speed_hz : spi->max_speed_hz;121121+122122+ if (bpw != 8) {123123+ dev_err(&spi->dev, "invalid bits-per-word (%d)\n", bpw);124124+ return -EINVAL;125125+ }126126+127127+ div = clk_get_rate(hw->clk) / hz;128128+129129+ /* is clk = pclk / (2 * (pre+1)), or is it130130+ * clk = (pclk * 2) / ( pre + 1) */131131+132132+ div = (div / 2) - 1;133133+134134+ if (div < 0)135135+ div = 1;136136+137137+ if (div > 255)138138+ div = 255;139139+140140+ dev_dbg(&spi->dev, "setting pre-scaler to %d (hz %d)\n", div, hz);141141+ writeb(div, hw->regs + S3C2410_SPPRE);142142+143143+ spin_lock(&hw->bitbang.lock);144144+ if (!hw->bitbang.busy) {145145+ hw->bitbang.chipselect(spi, BITBANG_CS_INACTIVE);146146+ /* need to ndelay for 0.5 clocktick ? */147147+ }148148+ spin_unlock(&hw->bitbang.lock);149149+150150+ return 0;151151+}152152+153153+static int s3c24xx_spi_setup(struct spi_device *spi)154154+{155155+ int ret;156156+157157+ if (!spi->bits_per_word)158158+ spi->bits_per_word = 8;159159+160160+ if ((spi->mode & SPI_LSB_FIRST) != 0)161161+ return -EINVAL;162162+163163+ ret = s3c24xx_spi_setupxfer(spi, NULL);164164+ if (ret < 0) {165165+ dev_err(&spi->dev, "setupxfer returned %d\n", ret);166166+ return ret;167167+ }168168+169169+ dev_dbg(&spi->dev, "%s: mode %d, %u bpw, %d hz\n",170170+ __FUNCTION__, spi->mode, spi->bits_per_word,171171+ spi->max_speed_hz);172172+173173+ return 0;174174+}175175+176176+static inline unsigned int hw_txbyte(struct s3c24xx_spi *hw, int count)177177+{178178+ return hw->tx ? hw->tx[count] : 0xff;179179+}180180+181181+static int s3c24xx_spi_txrx(struct spi_device *spi, struct spi_transfer *t)182182+{183183+ struct s3c24xx_spi *hw = to_hw(spi);184184+185185+ dev_dbg(&spi->dev, "txrx: tx %p, rx %p, len %d\n",186186+ t->tx_buf, t->rx_buf, t->len);187187+188188+ hw->tx = t->tx_buf;189189+ hw->rx = t->rx_buf;190190+ hw->len = t->len;191191+ hw->count = 0;192192+193193+ /* send the first byte */194194+ writeb(hw_txbyte(hw, 0), hw->regs + S3C2410_SPTDAT);195195+ wait_for_completion(&hw->done);196196+197197+ return hw->count;198198+}199199+200200+static irqreturn_t s3c24xx_spi_irq(int irq, void *dev, struct pt_regs *regs)201201+{202202+ struct s3c24xx_spi *hw = dev;203203+ unsigned int spsta = readb(hw->regs + S3C2410_SPSTA);204204+ unsigned int count = hw->count;205205+206206+ if (spsta & S3C2410_SPSTA_DCOL) {207207+ dev_dbg(hw->dev, "data-collision\n");208208+ complete(&hw->done);209209+ goto irq_done;210210+ }211211+212212+ if (!(spsta & S3C2410_SPSTA_READY)) {213213+ dev_dbg(hw->dev, "spi not ready for tx?\n");214214+ complete(&hw->done);215215+ goto irq_done;216216+ }217217+218218+ hw->count++;219219+220220+ if (hw->rx)221221+ hw->rx[count] = readb(hw->regs + S3C2410_SPRDAT);222222+223223+ count++;224224+225225+ if (count < hw->len)226226+ writeb(hw_txbyte(hw, count), hw->regs + S3C2410_SPTDAT);227227+ else228228+ complete(&hw->done);229229+230230+ irq_done:231231+ return IRQ_HANDLED;232232+}233233+234234+static int s3c24xx_spi_probe(struct platform_device *pdev)235235+{236236+ struct s3c24xx_spi *hw;237237+ struct spi_master *master;238238+ struct spi_board_info *bi;239239+ struct resource *res;240240+ int err = 0;241241+ int i;242242+243243+ master = spi_alloc_master(&pdev->dev, sizeof(struct s3c24xx_spi));244244+ if (master == NULL) {245245+ dev_err(&pdev->dev, "No memory for spi_master\n");246246+ err = -ENOMEM;247247+ goto err_nomem;248248+ }249249+250250+ hw = spi_master_get_devdata(master);251251+ memset(hw, 0, sizeof(struct s3c24xx_spi));252252+253253+ hw->master = spi_master_get(master);254254+ hw->pdata = pdev->dev.platform_data;255255+ hw->dev = &pdev->dev;256256+257257+ if (hw->pdata == NULL) {258258+ dev_err(&pdev->dev, "No platform data supplied\n");259259+ err = -ENOENT;260260+ goto err_no_pdata;261261+ }262262+263263+ platform_set_drvdata(pdev, hw);264264+ init_completion(&hw->done);265265+266266+ /* setup the state for the bitbang driver */267267+268268+ hw->bitbang.master = hw->master;269269+ hw->bitbang.setup_transfer = s3c24xx_spi_setupxfer;270270+ hw->bitbang.chipselect = s3c24xx_spi_chipsel;271271+ hw->bitbang.txrx_bufs = s3c24xx_spi_txrx;272272+ hw->bitbang.master->setup = s3c24xx_spi_setup;273273+274274+ dev_dbg(hw->dev, "bitbang at %p\n", &hw->bitbang);275275+276276+ /* find and map our resources */277277+278278+ res = platform_get_resource(pdev, IORESOURCE_MEM, 0);279279+ if (res == NULL) {280280+ dev_err(&pdev->dev, "Cannot get IORESOURCE_MEM\n");281281+ err = -ENOENT;282282+ goto err_no_iores;283283+ }284284+285285+ hw->ioarea = request_mem_region(res->start, (res->end - res->start)+1,286286+ pdev->name);287287+288288+ if (hw->ioarea == NULL) {289289+ dev_err(&pdev->dev, "Cannot reserve region\n");290290+ err = -ENXIO;291291+ goto err_no_iores;292292+ }293293+294294+ hw->regs = ioremap(res->start, (res->end - res->start)+1);295295+ if (hw->regs == NULL) {296296+ dev_err(&pdev->dev, "Cannot map IO\n");297297+ err = -ENXIO;298298+ goto err_no_iomap;299299+ }300300+301301+ hw->irq = platform_get_irq(pdev, 0);302302+ if (hw->irq < 0) {303303+ dev_err(&pdev->dev, "No IRQ specified\n");304304+ err = -ENOENT;305305+ goto err_no_irq;306306+ }307307+308308+ err = request_irq(hw->irq, s3c24xx_spi_irq, 0, pdev->name, hw);309309+ if (err) {310310+ dev_err(&pdev->dev, "Cannot claim IRQ\n");311311+ goto err_no_irq;312312+ }313313+314314+ hw->clk = clk_get(&pdev->dev, "spi");315315+ if (IS_ERR(hw->clk)) {316316+ dev_err(&pdev->dev, "No clock for device\n");317317+ err = PTR_ERR(hw->clk);318318+ goto err_no_clk;319319+ }320320+321321+ /* for the moment, permanently enable the clock */322322+323323+ clk_enable(hw->clk);324324+325325+ /* program defaults into the registers */326326+327327+ writeb(0xff, hw->regs + S3C2410_SPPRE);328328+ writeb(SPPIN_DEFAULT, hw->regs + S3C2410_SPPIN);329329+ writeb(SPCON_DEFAULT, hw->regs + S3C2410_SPCON);330330+331331+ /* setup any gpio we can */332332+333333+ if (!hw->pdata->set_cs) {334334+ s3c2410_gpio_setpin(hw->pdata->pin_cs, 1);335335+ s3c2410_gpio_cfgpin(hw->pdata->pin_cs, S3C2410_GPIO_OUTPUT);336336+ }337337+338338+ /* register our spi controller */339339+340340+ err = spi_bitbang_start(&hw->bitbang);341341+ if (err) {342342+ dev_err(&pdev->dev, "Failed to register SPI master\n");343343+ goto err_register;344344+ }345345+346346+ dev_dbg(hw->dev, "shutdown=%d\n", hw->bitbang.shutdown);347347+348348+ /* register all the devices associated */349349+350350+ bi = &hw->pdata->board_info[0];351351+ for (i = 0; i < hw->pdata->board_size; i++, bi++) {352352+ dev_info(hw->dev, "registering %s\n", bi->modalias);353353+354354+ bi->controller_data = hw;355355+ spi_new_device(master, bi);356356+ }357357+358358+ return 0;359359+360360+ err_register:361361+ clk_disable(hw->clk);362362+ clk_put(hw->clk);363363+364364+ err_no_clk:365365+ free_irq(hw->irq, hw);366366+367367+ err_no_irq:368368+ iounmap(hw->regs);369369+370370+ err_no_iomap:371371+ release_resource(hw->ioarea);372372+ kfree(hw->ioarea);373373+374374+ err_no_iores:375375+ err_no_pdata:376376+ spi_master_put(hw->master);;377377+378378+ err_nomem:379379+ return err;380380+}381381+382382+static int s3c24xx_spi_remove(struct platform_device *dev)383383+{384384+ struct s3c24xx_spi *hw = platform_get_drvdata(dev);385385+386386+ platform_set_drvdata(dev, NULL);387387+388388+ spi_unregister_master(hw->master);389389+390390+ clk_disable(hw->clk);391391+ clk_put(hw->clk);392392+393393+ free_irq(hw->irq, hw);394394+ iounmap(hw->regs);395395+396396+ release_resource(hw->ioarea);397397+ kfree(hw->ioarea);398398+399399+ spi_master_put(hw->master);400400+ return 0;401401+}402402+403403+404404+#ifdef CONFIG_PM405405+406406+static int s3c24xx_spi_suspend(struct platform_device *pdev, pm_message_t msg)407407+{408408+ struct s3c24xx_spi *hw = platform_get_drvdata(dev);409409+410410+ clk_disable(hw->clk);411411+ return 0;412412+}413413+414414+static int s3c24xx_spi_resume(struct platform_device *pdev)415415+{416416+ struct s3c24xx_spi *hw = platform_get_drvdata(dev);417417+418418+ clk_enable(hw->clk);419419+ return 0;420420+}421421+422422+#else423423+#define s3c24xx_spi_suspend NULL424424+#define s3c24xx_spi_resume NULL425425+#endif426426+427427+static struct platform_driver s3c24xx_spidrv = {428428+ .probe = s3c24xx_spi_probe,429429+ .remove = s3c24xx_spi_remove,430430+ .suspend = s3c24xx_spi_suspend,431431+ .resume = s3c24xx_spi_resume,432432+ .driver = {433433+ .name = "s3c2410-spi",434434+ .owner = THIS_MODULE,435435+ },436436+};437437+438438+static int __init s3c24xx_spi_init(void)439439+{440440+ return platform_driver_register(&s3c24xx_spidrv);441441+}442442+443443+static void __exit s3c24xx_spi_exit(void)444444+{445445+ platform_driver_unregister(&s3c24xx_spidrv);446446+}447447+448448+module_init(s3c24xx_spi_init);449449+module_exit(s3c24xx_spi_exit);450450+451451+MODULE_DESCRIPTION("S3C24XX SPI Driver");452452+MODULE_AUTHOR("Ben Dooks, <ben@simtec.co.uk>");453453+MODULE_LICENSE("GPL");
+188
drivers/spi/spi_s3c24xx_gpio.c
···11+/* linux/drivers/spi/spi_s3c24xx_gpio.c22+ *33+ * Copyright (c) 2006 Ben Dooks44+ * Copyright (c) 2006 Simtec Electronics55+ *66+ * S3C24XX GPIO based SPI driver77+ *88+ * This program is free software; you can redistribute it and/or modify99+ * it under the terms of the GNU General Public License version 2 as1010+ * published by the Free Software Foundation.1111+ *1212+*/1313+1414+#include <linux/config.h>1515+#include <linux/kernel.h>1616+#include <linux/init.h>1717+#include <linux/delay.h>1818+#include <linux/spinlock.h>1919+#include <linux/platform_device.h>2020+2121+#include <linux/spi/spi.h>2222+#include <linux/spi/spi_bitbang.h>2323+2424+#include <asm/arch/regs-gpio.h>2525+#include <asm/arch/spi-gpio.h>2626+#include <asm/arch/hardware.h>2727+2828+struct s3c2410_spigpio {2929+ struct spi_bitbang bitbang;3030+3131+ struct s3c2410_spigpio_info *info;3232+ struct platform_device *dev;3333+};3434+3535+static inline struct s3c2410_spigpio *spidev_to_sg(struct spi_device *spi)3636+{3737+ return spi->controller_data;3838+}3939+4040+static inline void setsck(struct spi_device *dev, int on)4141+{4242+ struct s3c2410_spigpio *sg = spidev_to_sg(dev);4343+ s3c2410_gpio_setpin(sg->info->pin_clk, on ? 1 : 0);4444+}4545+4646+static inline void setmosi(struct spi_device *dev, int on)4747+{4848+ struct s3c2410_spigpio *sg = spidev_to_sg(dev);4949+ s3c2410_gpio_setpin(sg->info->pin_mosi, on ? 1 : 0);5050+}5151+5252+static inline u32 getmiso(struct spi_device *dev)5353+{5454+ struct s3c2410_spigpio *sg = spidev_to_sg(dev);5555+ return s3c2410_gpio_getpin(sg->info->pin_miso) ? 1 : 0;5656+}5757+5858+#define spidelay(x) ndelay(x)5959+6060+#define EXPAND_BITBANG_TXRX6161+#include <linux/spi/spi_bitbang.h>6262+6363+6464+static u32 s3c2410_spigpio_txrx_mode0(struct spi_device *spi,6565+ unsigned nsecs, u32 word, u8 bits)6666+{6767+ return bitbang_txrx_be_cpha0(spi, nsecs, 0, word, bits);6868+}6969+7070+static u32 s3c2410_spigpio_txrx_mode1(struct spi_device *spi,7171+ unsigned nsecs, u32 word, u8 bits)7272+{7373+ return bitbang_txrx_be_cpha1(spi, nsecs, 0, word, bits);7474+}7575+7676+static void s3c2410_spigpio_chipselect(struct spi_device *dev, int value)7777+{7878+ struct s3c2410_spigpio *sg = spidev_to_sg(dev);7979+8080+ if (sg->info && sg->info->chip_select)8181+ (sg->info->chip_select)(sg->info, value);8282+}8383+8484+static int s3c2410_spigpio_probe(struct platform_device *dev)8585+{8686+ struct spi_master *master;8787+ struct s3c2410_spigpio *sp;8888+ int ret;8989+ int i;9090+9191+ master = spi_alloc_master(&dev->dev, sizeof(struct s3c2410_spigpio));9292+ if (master == NULL) {9393+ dev_err(&dev->dev, "failed to allocate spi master\n");9494+ ret = -ENOMEM;9595+ goto err;9696+ }9797+9898+ sp = spi_master_get_devdata(master);9999+100100+ platform_set_drvdata(dev, sp);101101+102102+ /* copy in the plkatform data */103103+ sp->info = dev->dev.platform_data;104104+105105+ /* setup spi bitbang adaptor */106106+ sp->bitbang.master = spi_master_get(master);107107+ sp->bitbang.chipselect = s3c2410_spigpio_chipselect;108108+109109+ sp->bitbang.txrx_word[SPI_MODE_0] = s3c2410_spigpio_txrx_mode0;110110+ sp->bitbang.txrx_word[SPI_MODE_1] = s3c2410_spigpio_txrx_mode1;111111+112112+ /* set state of spi pins */113113+ s3c2410_gpio_setpin(sp->info->pin_clk, 0);114114+ s3c2410_gpio_setpin(sp->info->pin_mosi, 0);115115+116116+ s3c2410_gpio_cfgpin(sp->info->pin_clk, S3C2410_GPIO_OUTPUT);117117+ s3c2410_gpio_cfgpin(sp->info->pin_mosi, S3C2410_GPIO_OUTPUT);118118+ s3c2410_gpio_cfgpin(sp->info->pin_miso, S3C2410_GPIO_INPUT);119119+120120+ ret = spi_bitbang_start(&sp->bitbang);121121+ if (ret)122122+ goto err_no_bitbang;123123+124124+ /* register the chips to go with the board */125125+126126+ for (i = 0; i < sp->info->board_size; i++) {127127+ dev_info(&dev->dev, "registering %p: %s\n",128128+ &sp->info->board_info[i],129129+ sp->info->board_info[i].modalias);130130+131131+ sp->info->board_info[i].controller_data = sp;132132+ spi_new_device(master, sp->info->board_info + i);133133+ }134134+135135+ return 0;136136+137137+ err_no_bitbang:138138+ spi_master_put(sp->bitbang.master);139139+ err:140140+ return ret;141141+142142+}143143+144144+static int s3c2410_spigpio_remove(struct platform_device *dev)145145+{146146+ struct s3c2410_spigpio *sp = platform_get_drvdata(dev);147147+148148+ spi_bitbang_stop(&sp->bitbang);149149+ spi_master_put(sp->bitbang.master);150150+151151+ return 0;152152+}153153+154154+/* all gpio should be held over suspend/resume, so we should155155+ * not need to deal with this156156+*/157157+158158+#define s3c2410_spigpio_suspend NULL159159+#define s3c2410_spigpio_resume NULL160160+161161+162162+static struct platform_driver s3c2410_spigpio_drv = {163163+ .probe = s3c2410_spigpio_probe,164164+ .remove = s3c2410_spigpio_remove,165165+ .suspend = s3c2410_spigpio_suspend,166166+ .resume = s3c2410_spigpio_resume,167167+ .driver = {168168+ .name = "s3c24xx-spi-gpio",169169+ .owner = THIS_MODULE,170170+ },171171+};172172+173173+static int __init s3c2410_spigpio_init(void)174174+{175175+ return platform_driver_register(&s3c2410_spigpio_drv);176176+}177177+178178+static void __exit s3c2410_spigpio_exit(void)179179+{180180+ platform_driver_unregister(&s3c2410_spigpio_drv);181181+}182182+183183+module_init(s3c2410_spigpio_init);184184+module_exit(s3c2410_spigpio_exit);185185+186186+MODULE_DESCRIPTION("S3C24XX SPI Driver");187187+MODULE_AUTHOR("Ben Dooks, <ben@simtec.co.uk>");188188+MODULE_LICENSE("GPL");
···18051805 USB_SPEED_FULL;18061806 hcd->self.root_hub = rhdev;1807180718081808+ /* wakeup flag init defaults to "everything works" for root hubs,18091809+ * but drivers can override it in reset() if needed, along with18101810+ * recording the overall controller's system wakeup capability.18111811+ */18121812+ device_init_wakeup(&rhdev->dev, 1);18131813+18081814 /* "reset" is misnamed; its role is now one-time init. the controller18091815 * should already have been reset (and boot firmware kicked off etc).18101816 */···18181812 dev_err(hcd->self.controller, "can't setup\n");18191813 goto err_hcd_driver_setup;18201814 }18211821-18221822- /* wakeup flag init is in transition; for now we can't rely on PCI to18231823- * initialize these bits properly, so we let reset() override it.18241824- * This init should _precede_ the reset() once PCI behaves.18251825- */18261826- device_init_wakeup(&rhdev->dev,18271827- device_can_wakeup(hcd->self.controller));1828181518291816 /* NOTE: root hub and controller capabilities may not be the same */18301817 if (device_can_wakeup(hcd->self.controller)
+13-10
drivers/usb/core/hub.c
···11681168static int choose_configuration(struct usb_device *udev)11691169{11701170 int i;11711171- u16 devstatus;11721172- int bus_powered;11731171 int num_configs;11741172 struct usb_host_config *c, *best;11751175-11761176- /* If this fails, assume the device is bus-powered */11771177- devstatus = 0;11781178- usb_get_status(udev, USB_RECIP_DEVICE, 0, &devstatus);11791179- le16_to_cpus(&devstatus);11801180- bus_powered = ((devstatus & (1 << USB_DEVICE_SELF_POWERED)) == 0);11811181- dev_dbg(&udev->dev, "device is %s-powered\n",11821182- bus_powered ? "bus" : "self");1183117311841174 best = NULL;11851175 c = udev->config;···11871197 * similar errors in their descriptors. If the next test11881198 * were allowed to execute, such configurations would always11891199 * be rejected and the devices would not work as expected.12001200+ * In the meantime, we run the risk of selecting a config12011201+ * that requires external power at a time when that power12021202+ * isn't available. It seems to be the lesser of two evils.12031203+ *12041204+ * Bugzilla #6448 reports a device that appears to crash12051205+ * when it receives a GET_DEVICE_STATUS request! We don't12061206+ * have any other way to tell whether a device is self-powered,12071207+ * but since we don't use that information anywhere but here,12081208+ * the call has been removed.12091209+ *12101210+ * Maybe the GET_DEVICE_STATUS call and the test below can12111211+ * be reinstated when device firmwares become more reliable.12121212+ * Don't hold your breath.11901213 */11911214#if 011921215 /* Rule out self-powered configs for a bus-powered device */
+1-1
drivers/usb/host/ohci-hcd.c
···863863 i = ohci->num_ports;864864 while (i--)865865 ohci_writel (ohci, RH_PS_PSS,866866- &ohci->regs->roothub.portstatus [temp]);866866+ &ohci->regs->roothub.portstatus [i]);867867 ohci_dbg (ohci, "restart complete\n");868868 }869869 return 0;
···1515#include <linux/module.h>1616#include <linux/init.h>1717#include <linux/usb.h>1818+#include <linux/delay.h>18191920#define MAX_INTEL_HEX_RECORD_LENGTH 162021typedef struct _INTEL_HEX_RECORD···115114116115 /* De-assert reset (let the CPU run) */117116 err = emi26_set_reset(dev,0);117117+ msleep(250); /* let device settle */118118119119 /* 2. We upload the FPGA firmware into the EMI120120 * Note: collect up to 1023 (yes!) bytes and send them with···152150 goto wraperr;153151 }154152 }153153+ msleep(250); /* let device settle */155154156155 /* De-assert reset (let the CPU run) */157156 err = emi26_set_reset(dev,0);···195192 err("%s - error loading firmware: error = %d", __FUNCTION__, err);196193 goto wraperr;197194 }195195+ msleep(250); /* let device settle */198196199197 /* return 1 to fail the driver inialization200198 * and give real driver change to load */
+4
drivers/usb/misc/emi62.c
···1515#include <linux/init.h>1616#include <linux/module.h>1717#include <linux/usb.h>1818+#include <linux/delay.h>18191920#define MAX_INTEL_HEX_RECORD_LENGTH 162021typedef struct _INTEL_HEX_RECORD···124123125124 /* De-assert reset (let the CPU run) */126125 err = emi62_set_reset(dev,0);126126+ msleep(250); /* let device settle */127127128128 /* 2. We upload the FPGA firmware into the EMI129129 * Note: collect up to 1023 (yes!) bytes and send them with···168166 err("%s - error loading firmware: error = %d", __FUNCTION__, err);169167 goto wraperr;170168 }169169+ msleep(250); /* let device settle */171170172171 /* 4. We put the part of the firmware that lies in the external RAM into the EZ-USB */173172···231228 err("%s - error loading firmware: error = %d", __FUNCTION__, err);232229 goto wraperr;233230 }231231+ msleep(250); /* let device settle */234232235233 kfree(buf);236234
+15-5
drivers/usb/net/pegasus.c
···318318 set_register(pegasus, PhyCtrl, (indx | PHY_READ));319319 for (i = 0; i < REG_TIMEOUT; i++) {320320 ret = get_registers(pegasus, PhyCtrl, 1, data);321321+ if (ret == -ESHUTDOWN)322322+ goto fail;321323 if (data[0] & PHY_DONE)322324 break;323325 }···328326 *regd = le16_to_cpu(regdi);329327 return ret;330328 }329329+fail:331330 if (netif_msg_drv(pegasus))332331 dev_warn(&pegasus->intf->dev, "fail %s\n", __FUNCTION__);333332···357354 set_register(pegasus, PhyCtrl, (indx | PHY_WRITE));358355 for (i = 0; i < REG_TIMEOUT; i++) {359356 ret = get_registers(pegasus, PhyCtrl, 1, data);357357+ if (ret == -ESHUTDOWN)358358+ goto fail;360359 if (data[0] & PHY_DONE)361360 break;362361 }363362 if (i < REG_TIMEOUT)364363 return ret;365364365365+fail:366366 if (netif_msg_drv(pegasus))367367 dev_warn(&pegasus->intf->dev, "fail %s\n", __FUNCTION__);368368 return -ETIMEDOUT;···393387 ret = get_registers(pegasus, EpromCtrl, 1, &tmp);394388 if (tmp & EPROM_DONE)395389 break;390390+ if (ret == -ESHUTDOWN)391391+ goto fail;396392 }397393 if (i < REG_TIMEOUT) {398394 ret = get_registers(pegasus, EpromData, 2, &retdatai);···402394 return ret;403395 }404396397397+fail:405398 if (netif_msg_drv(pegasus))406399 dev_warn(&pegasus->intf->dev, "fail %s\n", __FUNCTION__);407400 return -ETIMEDOUT;···442433443434 for (i = 0; i < REG_TIMEOUT; i++) {444435 ret = get_registers(pegasus, EpromCtrl, 1, &tmp);436436+ if (ret == -ESHUTDOWN)437437+ goto fail;445438 if (tmp & EPROM_DONE)446439 break;447440 }448441 disable_eprom_write(pegasus);449442 if (i < REG_TIMEOUT)450443 return ret;444444+fail:451445 if (netif_msg_drv(pegasus))452446 dev_warn(&pegasus->intf->dev, "fail %s\n", __FUNCTION__);453447 return -ETIMEDOUT;···13901378 struct pegasus *pegasus = usb_get_intfdata(intf);1391137913921380 netif_device_detach (pegasus->net);13811381+ cancel_delayed_work(&pegasus->carrier_check);13931382 if (netif_running(pegasus->net)) {13941394- cancel_delayed_work(&pegasus->carrier_check);13951395-13961383 usb_kill_urb(pegasus->rx_urb);13971384 usb_kill_urb(pegasus->intr_urb);13981385 }···14111400 pegasus->intr_urb->status = 0;14121401 pegasus->intr_urb->actual_length = 0;14131402 intr_callback(pegasus->intr_urb, NULL);14141414-14151415- queue_delayed_work(pegasus_workqueue, &pegasus->carrier_check,14161416- CARRIER_CHECK_DELAY);14171403 }14041404+ queue_delayed_work(pegasus_workqueue, &pegasus->carrier_check,14051405+ CARRIER_CHECK_DELAY);14181406 return 0;14191407}14201408
+10
drivers/usb/serial/Kconfig
···7171 To compile this driver as a module, choose M here: the7272 module will be called anydata.73737474+config USB_SERIAL_ARK31167575+ tristate "USB ARK Micro 3116 USB Serial Driver (EXPERIMENTAL)"7676+ depends on USB_SERIAL && EXPERIMENTAL7777+ help7878+ Say Y here if you want to use a ARK Micro 3116 USB to Serial7979+ device.8080+8181+ To compile this driver as a module, choose M here: the8282+ module will be called ark31168383+7484config USB_SERIAL_BELKIN7585 tristate "USB Belkin and Peracom Single Port Serial Driver"7686 depends on USB_SERIAL
···189189190190 portNumber = tty->index - serial->minor;191191 port = serial->port[portNumber];192192- if (!port)193193- return -ENODEV;192192+ if (!port) {193193+ retval = -ENODEV;194194+ goto bailout_kref_put;195195+ }194196195195- if (mutex_lock_interruptible(&port->mutex))196196- return -ERESTARTSYS;197197+ if (mutex_lock_interruptible(&port->mutex)) {198198+ retval = -ERESTARTSYS;199199+ goto bailout_kref_put;200200+ }197201198202 ++port->open_count;199203···213209 * safe because we are called with BKL held */214210 if (!try_module_get(serial->type->driver.owner)) {215211 retval = -ENODEV;216216- goto bailout_kref_put;212212+ goto bailout_mutex_unlock;217213 }218214219215 /* only call the device specific open if this ···228224229225bailout_module_put:230226 module_put(serial->type->driver.owner);231231-bailout_kref_put:232232- kref_put(&serial->kref, destroy_serial);227227+bailout_mutex_unlock:233228 port->open_count = 0;234229 mutex_unlock(&port->mutex);230230+bailout_kref_put:231231+ kref_put(&serial->kref, destroy_serial);235232 return retval;236233}237234
+12-6
drivers/video/backlight/backlight.c
···29293030static ssize_t backlight_store_power(struct class_device *cdev, const char *buf, size_t count)3131{3232- int rc = -ENXIO, power;3232+ int rc = -ENXIO;3333 char *endp;3434 struct backlight_device *bd = to_backlight_device(cdev);3535+ int power = simple_strtoul(buf, &endp, 0);3636+ size_t size = endp - buf;35373636- power = simple_strtoul(buf, &endp, 0);3737- if (*endp && !isspace(*endp))3838+ if (*endp && isspace(*endp))3939+ size++;4040+ if (size != count)3841 return -EINVAL;39424043 down(&bd->sem);···68656966static ssize_t backlight_store_brightness(struct class_device *cdev, const char *buf, size_t count)7067{7171- int rc = -ENXIO, brightness;6868+ int rc = -ENXIO;7269 char *endp;7370 struct backlight_device *bd = to_backlight_device(cdev);7171+ int brightness = simple_strtoul(buf, &endp, 0);7272+ size_t size = endp - buf;74737575- brightness = simple_strtoul(buf, &endp, 0);7676- if (*endp && !isspace(*endp))7474+ if (*endp && isspace(*endp))7575+ size++;7676+ if (size != count)7777 return -EINVAL;78787979 down(&bd->sem);
+16-16
drivers/video/backlight/lcd.c
···31313232static ssize_t lcd_store_power(struct class_device *cdev, const char *buf, size_t count)3333{3434- int rc, power;3434+ int rc = -ENXIO;3535 char *endp;3636 struct lcd_device *ld = to_lcd_device(cdev);3737+ int power = simple_strtoul(buf, &endp, 0);3838+ size_t size = endp - buf;37393838- power = simple_strtoul(buf, &endp, 0);3939- if (*endp && !isspace(*endp))4040+ if (*endp && isspace(*endp))4141+ size++;4242+ if (size != count)4043 return -EINVAL;41444245 down(&ld->sem);···4744 pr_debug("lcd: set power to %d\n", power);4845 ld->props->set_power(ld, power);4946 rc = count;5050- } else5151- rc = -ENXIO;4747+ }5248 up(&ld->sem);53495450 return rc;···55535654static ssize_t lcd_show_contrast(struct class_device *cdev, char *buf)5755{5858- int rc;5656+ int rc = -ENXIO;5957 struct lcd_device *ld = to_lcd_device(cdev);60586159 down(&ld->sem);6260 if (likely(ld->props && ld->props->get_contrast))6361 rc = sprintf(buf, "%d\n", ld->props->get_contrast(ld));6464- else6565- rc = -ENXIO;6662 up(&ld->sem);67636864 return rc;···68686969static ssize_t lcd_store_contrast(struct class_device *cdev, const char *buf, size_t count)7070{7171- int rc, contrast;7171+ int rc = -ENXIO;7272 char *endp;7373 struct lcd_device *ld = to_lcd_device(cdev);7474+ int contrast = simple_strtoul(buf, &endp, 0);7575+ size_t size = endp - buf;74767575- contrast = simple_strtoul(buf, &endp, 0);7676- if (*endp && !isspace(*endp))7777+ if (*endp && isspace(*endp))7878+ size++;7979+ if (size != count)7780 return -EINVAL;78817982 down(&ld->sem);···8481 pr_debug("lcd: set contrast to %d\n", contrast);8582 ld->props->set_contrast(ld, contrast);8683 rc = count;8787- } else8888- rc = -ENXIO;8484+ }8985 up(&ld->sem);90869187 return rc;···92909391static ssize_t lcd_show_max_contrast(struct class_device *cdev, char *buf)9492{9595- int rc;9393+ int rc = -ENXIO;9694 struct lcd_device *ld = to_lcd_device(cdev);97959896 down(&ld->sem);9997 if (likely(ld->props))10098 rc = sprintf(buf, "%d\n", ld->props->max_contrast);101101- else102102- rc = -ENXIO;10399 up(&ld->sem);104100105101 return rc;
+2-2
drivers/video/i810/i810_main.c
···7676 *7777 * Experiment with v_offset to find out which works best for you.7878 */7979-static u32 v_offset_default __initdata; /* For 32 MiB Aper size, 8 should be the default */8080-static u32 voffset __initdata = 0;7979+static u32 v_offset_default __devinitdata; /* For 32 MiB Aper size, 8 should be the default */8080+static u32 voffset __devinitdata;81818282static int i810fb_cursor(struct fb_info *info, struct fb_cursor *cursor);8383static int __devinit i810fb_init_pci (struct pci_dev *dev,
+21-2
drivers/video/matrox/g450_pll.c
···316316 case M_PIXEL_PLL_B:317317 case M_PIXEL_PLL_C:318318 {319319- u_int8_t tmp;319319+ u_int8_t tmp, xpwrctrl;320320 unsigned long flags;321321322322 matroxfb_DAC_lock_irqsave(flags);323323+324324+ xpwrctrl = matroxfb_DAC_in(PMINFO M1064_XPWRCTRL);325325+ matroxfb_DAC_out(PMINFO M1064_XPWRCTRL, xpwrctrl & ~M1064_XPWRCTRL_PANELPDN);326326+ mga_outb(M_SEQ_INDEX, M_SEQ1);327327+ mga_outb(M_SEQ_DATA, mga_inb(M_SEQ_DATA) | M_SEQ1_SCROFF);323328 tmp = matroxfb_DAC_in(PMINFO M1064_XPIXCLKCTRL);329329+ tmp |= M1064_XPIXCLKCTRL_DIS;324330 if (!(tmp & M1064_XPIXCLKCTRL_PLL_UP)) {325325- matroxfb_DAC_out(PMINFO M1064_XPIXCLKCTRL, tmp | M1064_XPIXCLKCTRL_PLL_UP);331331+ tmp |= M1064_XPIXCLKCTRL_PLL_UP;326332 }333333+ matroxfb_DAC_out(PMINFO M1064_XPIXCLKCTRL, tmp);334334+ matroxfb_DAC_out(PMINFO M1064_XDVICLKCTRL, 0);335335+ matroxfb_DAC_out(PMINFO M1064_XPWRCTRL, xpwrctrl);336336+327337 matroxfb_DAC_unlock_irqrestore(flags);328338 }329339 {···428418 frequency to higher - with <= lowest wins, while429419 with < highest one wins */430420 if (delta <= deltaarray[idx-1]) {421421+ /* all else being equal except VCO,422422+ * choose VCO not near (within 1/16th or so) VCOmin423423+ * (freqs near VCOmin aren't as stable)424424+ */425425+ if (delta == deltaarray[idx-1]426426+ && vco != g450_mnp2vco(PMINFO mnparray[idx-1])427427+ && vco < (pi->vcomin * 17 / 16)) {428428+ break;429429+ }431430 mnparray[idx] = mnparray[idx-1];432431 deltaarray[idx] = deltaarray[idx-1];433432 } else {
···7474 struct autofs_wait_queue *next;7575 autofs_wqt_t wait_queue_token;7676 /* We use the following to see what we are waiting for */7777- int hash;7878- int len;7777+ unsigned int hash;7878+ unsigned int len;7979 char *name;8080 u32 dev;8181 u64 ino;···8585 pid_t tgid;8686 /* This is for status reporting upon return */8787 int status;8888- atomic_t notify;8988 atomic_t wait_ctr;9089};9190
+3-7
fs/autofs4/root.c
···327327static void *autofs4_follow_link(struct dentry *dentry, struct nameidata *nd)328328{329329 struct autofs_sb_info *sbi = autofs4_sbi(dentry->d_sb);330330+ struct autofs_info *ino = autofs4_dentry_ino(dentry);330331 int oz_mode = autofs4_oz_mode(sbi);331332 unsigned int lookup_type;332333 int status;···341340 if (oz_mode || !lookup_type)342341 goto done;343342344344- /*345345- * If a request is pending wait for it.346346- * If it's a mount then it won't be expired till at least347347- * a liitle later and if it's an expire then we might need348348- * to mount it again.349349- */350350- if (autofs4_ispending(dentry)) {343343+ /* If an expire request is pending wait for it. */344344+ if (ino && (ino->flags & AUTOFS_INF_EXPIRING)) {351345 DPRINTK("waiting for active request %p name=%.*s",352346 dentry, dentry->d_name.len, dentry->d_name.name);353347
+55-26
fs/autofs4/waitq.c
···189189 return len;190190}191191192192+static struct autofs_wait_queue *193193+autofs4_find_wait(struct autofs_sb_info *sbi,194194+ char *name, unsigned int hash, unsigned int len)195195+{196196+ struct autofs_wait_queue *wq;197197+198198+ for (wq = sbi->queues; wq; wq = wq->next) {199199+ if (wq->hash == hash &&200200+ wq->len == len &&201201+ wq->name && !memcmp(wq->name, name, len))202202+ break;203203+ }204204+ return wq;205205+}206206+192207int autofs4_wait(struct autofs_sb_info *sbi, struct dentry *dentry,193208 enum autofs_notify notify)194209{210210+ struct autofs_info *ino;195211 struct autofs_wait_queue *wq;196212 char *name;197213 unsigned int len = 0;198214 unsigned int hash = 0;199199- int status;215215+ int status, type;200216201217 /* In catatonic mode, we don't wait for nobody */202218 if (sbi->catatonic)···239223 return -EINTR;240224 }241225242242- for (wq = sbi->queues ; wq ; wq = wq->next) {243243- if (wq->hash == dentry->d_name.hash &&244244- wq->len == len &&245245- wq->name && !memcmp(wq->name, name, len))246246- break;226226+ wq = autofs4_find_wait(sbi, name, hash, len);227227+ ino = autofs4_dentry_ino(dentry);228228+ if (!wq && ino && notify == NFY_NONE) {229229+ /*230230+ * Either we've betean the pending expire to post it's231231+ * wait or it finished while we waited on the mutex.232232+ * So we need to wait till either, the wait appears233233+ * or the expire finishes.234234+ */235235+236236+ while (ino->flags & AUTOFS_INF_EXPIRING) {237237+ mutex_unlock(&sbi->wq_mutex);238238+ schedule_timeout_interruptible(HZ/10);239239+ if (mutex_lock_interruptible(&sbi->wq_mutex)) {240240+ kfree(name);241241+ return -EINTR;242242+ }243243+ wq = autofs4_find_wait(sbi, name, hash, len);244244+ if (wq)245245+ break;246246+ }247247+248248+ /*249249+ * Not ideal but the status has already gone. Of the two250250+ * cases where we wait on NFY_NONE neither depend on the251251+ * return status of the wait.252252+ */253253+ if (!wq) {254254+ kfree(name);255255+ mutex_unlock(&sbi->wq_mutex);256256+ return 0;257257+ }247258 }248259249260 if (!wq) {250250- /* Can't wait for an expire if there's no mount */251251- if (notify == NFY_NONE && !d_mountpoint(dentry)) {252252- kfree(name);253253- mutex_unlock(&sbi->wq_mutex);254254- return -ENOENT;255255- }256256-257261 /* Create a new wait queue */258262 wq = kmalloc(sizeof(struct autofs_wait_queue),GFP_KERNEL);259263 if (!wq) {···299263 wq->tgid = current->tgid;300264 wq->status = -EINTR; /* Status return if interrupted */301265 atomic_set(&wq->wait_ctr, 2);302302- atomic_set(&wq->notify, 1);303266 mutex_unlock(&sbi->wq_mutex);304304- } else {305305- atomic_inc(&wq->wait_ctr);306306- mutex_unlock(&sbi->wq_mutex);307307- kfree(name);308308- DPRINTK("existing wait id = 0x%08lx, name = %.*s, nfy=%d",309309- (unsigned long) wq->wait_queue_token, wq->len, wq->name, notify);310310- }311311-312312- if (notify != NFY_NONE && atomic_read(&wq->notify)) {313313- int type;314314-315315- atomic_dec(&wq->notify);316267317268 if (sbi->version < 5) {318269 if (notify == NFY_MOUNT)···322299323300 /* autofs4_notify_daemon() may block */324301 autofs4_notify_daemon(sbi, wq, type);302302+ } else {303303+ atomic_inc(&wq->wait_ctr);304304+ mutex_unlock(&sbi->wq_mutex);305305+ kfree(name);306306+ DPRINTK("existing wait id = 0x%08lx, name = %.*s, nfy=%d",307307+ (unsigned long) wq->wait_queue_token, wq->len, wq->name, notify);325308 }326309327310 /* wq->name is NULL if and only if the lock is already released */
+9-21
fs/binfmt_flat.c
···428428 loff_t fpos;429429 unsigned long start_code, end_code;430430 int ret;431431- int exec_fileno;432431433432 hdr = ((struct flat_hdr *) bprm->buf); /* exec-header */434433 inode = bprm->file->f_dentry->d_inode;···501502 goto err;502503 }503504504504- /* check file descriptor */505505- exec_fileno = get_unused_fd();506506- if (exec_fileno < 0) {507507- ret = -EMFILE;508508- goto err;509509- }510510- get_file(bprm->file);511511- fd_install(exec_fileno, bprm->file);512512-513505 /* Flush all traces of the currently running executable */514506 if (id == 0) {515507 result = flush_old_exec(bprm);516508 if (result) {517509 ret = result;518518- goto err_close;510510+ goto err;519511 }520512521513 /* OK, This is the point of no return */···538548 textpos = (unsigned long) -ENOMEM;539549 printk("Unable to mmap process text, errno %d\n", (int)-textpos);540550 ret = textpos;541541- goto err_close;551551+ goto err;542552 }543553544554 down_write(¤t->mm->mmap_sem);···554564 (int)-datapos);555565 do_munmap(current->mm, textpos, text_len);556566 ret = realdatastart;557557- goto err_close;567567+ goto err;558568 }559569 datapos = realdatastart + MAX_SHARED_LIBS * sizeof(unsigned long);560570···577587 do_munmap(current->mm, textpos, text_len);578588 do_munmap(current->mm, realdatastart, data_len + extra);579589 ret = result;580580- goto err_close;590590+ goto err;581591 }582592583593 reloc = (unsigned long *) (datapos+(ntohl(hdr->reloc_start)-text_len));···596606 printk("Unable to allocate RAM for process text/data, errno %d\n",597607 (int)-textpos);598608 ret = textpos;599599- goto err_close;609609+ goto err;600610 }601611602612 realdatastart = textpos + ntohl(hdr->data_start);···642652 do_munmap(current->mm, textpos, text_len + data_len + extra +643653 MAX_SHARED_LIBS * sizeof(unsigned long));644654 ret = result;645645- goto err_close;655655+ goto err;646656 }647657 }648658···707717 addr = calc_reloc(*rp, libinfo, id, 0);708718 if (addr == RELOC_FAILED) {709719 ret = -ENOEXEC;710710- goto err_close;720720+ goto err;711721 }712722 *rp = addr;713723 }···737747 rp = (unsigned long *) calc_reloc(addr, libinfo, id, 1);738748 if (rp == (unsigned long *)RELOC_FAILED) {739749 ret = -ENOEXEC;740740- goto err_close;750750+ goto err;741751 }742752743753 /* Get the pointer's value. */···752762 addr = calc_reloc(addr, libinfo, id, 0);753763 if (addr == RELOC_FAILED) {754764 ret = -ENOEXEC;755755- goto err_close;765765+ goto err;756766 }757767758768 /* Write back the relocated pointer. */···773783 stack_len);774784775785 return 0;776776-err_close:777777- sys_close(exec_fileno);778786err:779787 return ret;780788}
···505505 int i;506506507507 if (group->default_groups) {508508- /* FYI, we're faking mkdir here508508+ /*509509+ * FYI, we're faking mkdir here509510 * I'm not sure we need this semaphore, as we're called510511 * from our parent's mkdir. That holds our parent's511512 * i_mutex, so afaik lookup cannot continue through our512513 * parent to find us, let alone mess with our tree.513514 * That said, taking our i_mutex is closer to mkdir514514- * emulation, and shouldn't hurt. */515515+ * emulation, and shouldn't hurt.516516+ */515517 mutex_lock(&dentry->d_inode->i_mutex);516518517519 for (i = 0; group->default_groups[i]; i++) {···548546549547 item->ci_group = NULL;550548 item->ci_parent = NULL;549549+550550+ /* Drop the reference for ci_entry */551551 config_item_put(item);552552553553+ /* Drop the reference for ci_parent */553554 config_group_put(group);554555 }555556}556557557558static void link_obj(struct config_item *parent_item, struct config_item *item)558559{559559- /* Parent seems redundant with group, but it makes certain560560- * traversals much nicer. */560560+ /*561561+ * Parent seems redundant with group, but it makes certain562562+ * traversals much nicer.563563+ */561564 item->ci_parent = parent_item;565565+566566+ /*567567+ * We hold a reference on the parent for the child's ci_parent568568+ * link.569569+ */562570 item->ci_group = config_group_get(to_config_group(parent_item));563571 list_add_tail(&item->ci_entry, &item->ci_group->cg_children);564572573573+ /*574574+ * We hold a reference on the child for ci_entry on the parent's575575+ * cg_children576576+ */565577 config_item_get(item);566578}567579···700684 type = parent_item->ci_type;701685 BUG_ON(!type);702686687687+ /*688688+ * If ->drop_item() exists, it is responsible for the689689+ * config_item_put().690690+ */703691 if (type->ct_group_ops && type->ct_group_ops->drop_item)704692 type->ct_group_ops->drop_item(to_config_group(parent_item),705693 item);···714694715695static int configfs_mkdir(struct inode *dir, struct dentry *dentry, int mode)716696{717717- int ret;697697+ int ret, module_got = 0;718698 struct config_group *group;719699 struct config_item *item;720700 struct config_item *parent_item;721701 struct configfs_subsystem *subsys;722702 struct configfs_dirent *sd;723703 struct config_item_type *type;724724- struct module *owner;704704+ struct module *owner = NULL;725705 char *name;726706727727- if (dentry->d_parent == configfs_sb->s_root)728728- return -EPERM;707707+ if (dentry->d_parent == configfs_sb->s_root) {708708+ ret = -EPERM;709709+ goto out;710710+ }729711730712 sd = dentry->d_parent->d_fsdata;731731- if (!(sd->s_type & CONFIGFS_USET_DIR))732732- return -EPERM;713713+ if (!(sd->s_type & CONFIGFS_USET_DIR)) {714714+ ret = -EPERM;715715+ goto out;716716+ }733717718718+ /* Get a working ref for the duration of this function */734719 parent_item = configfs_get_config_item(dentry->d_parent);735720 type = parent_item->ci_type;736721 subsys = to_config_group(parent_item)->cg_subsys;···744719 if (!type || !type->ct_group_ops ||745720 (!type->ct_group_ops->make_group &&746721 !type->ct_group_ops->make_item)) {747747- config_item_put(parent_item);748748- return -EPERM; /* What lack-of-mkdir returns */722722+ ret = -EPERM; /* Lack-of-mkdir returns -EPERM */723723+ goto out_put;749724 }750725751726 name = kmalloc(dentry->d_name.len + 1, GFP_KERNEL);752727 if (!name) {753753- config_item_put(parent_item);754754- return -ENOMEM;728728+ ret = -ENOMEM;729729+ goto out_put;755730 }731731+756732 snprintf(name, dentry->d_name.len + 1, "%s", dentry->d_name.name);757733758734 down(&subsys->su_sem);···774748775749 kfree(name);776750 if (!item) {777777- config_item_put(parent_item);778778- return -ENOMEM;751751+ /*752752+ * If item == NULL, then link_obj() was never called.753753+ * There are no extra references to clean up.754754+ */755755+ ret = -ENOMEM;756756+ goto out_put;779757 }780758781781- ret = -EINVAL;759759+ /*760760+ * link_obj() has been called (via link_group() for groups).761761+ * From here on out, errors must clean that up.762762+ */763763+782764 type = item->ci_type;783783- if (type) {784784- owner = type->ct_owner;785785- if (try_module_get(owner)) {786786- if (group) {787787- ret = configfs_attach_group(parent_item,788788- item,789789- dentry);790790- } else {791791- ret = configfs_attach_item(parent_item,792792- item,793793- dentry);794794- }795795-796796- if (ret) {797797- down(&subsys->su_sem);798798- if (group)799799- unlink_group(group);800800- else801801- unlink_obj(item);802802- client_drop_item(parent_item, item);803803- up(&subsys->su_sem);804804-805805- config_item_put(parent_item);806806- module_put(owner);807807- }808808- }765765+ if (!type) {766766+ ret = -EINVAL;767767+ goto out_unlink;809768 }810769770770+ owner = type->ct_owner;771771+ if (!try_module_get(owner)) {772772+ ret = -EINVAL;773773+ goto out_unlink;774774+ }775775+776776+ /*777777+ * I hate doing it this way, but if there is778778+ * an error, module_put() probably should779779+ * happen after any cleanup.780780+ */781781+ module_got = 1;782782+783783+ if (group)784784+ ret = configfs_attach_group(parent_item, item, dentry);785785+ else786786+ ret = configfs_attach_item(parent_item, item, dentry);787787+788788+out_unlink:789789+ if (ret) {790790+ /* Tear down everything we built up */791791+ down(&subsys->su_sem);792792+ if (group)793793+ unlink_group(group);794794+ else795795+ unlink_obj(item);796796+ client_drop_item(parent_item, item);797797+ up(&subsys->su_sem);798798+799799+ if (module_got)800800+ module_put(owner);801801+ }802802+803803+out_put:804804+ /*805805+ * link_obj()/link_group() took a reference from child->parent,806806+ * so the parent is safely pinned. We can drop our working807807+ * reference.808808+ */809809+ config_item_put(parent_item);810810+811811+out:811812 return ret;812813}813814···854801 if (sd->s_type & CONFIGFS_USET_DEFAULT)855802 return -EPERM;856803804804+ /* Get a working ref until we have the child */857805 parent_item = configfs_get_config_item(dentry->d_parent);858806 subsys = to_config_group(parent_item)->cg_subsys;859807 BUG_ON(!subsys);···871817 return ret;872818 }873819820820+ /* Get a working ref for the duration of this function */874821 item = configfs_get_config_item(dentry);875822876823 /* Drop reference from above, item already holds one. */
+1-1
fs/exportfs/expfs.c
···102102 if (acceptable(context, result))103103 return result;104104 if (S_ISDIR(result->d_inode->i_mode)) {105105- /* there is no other dentry, so fail */105105+ err = -EACCES;106106 goto err_result;107107 }108108
+6-3
fs/inotify.c
···848848 inode = watch->inode;849849 mutex_lock(&inode->inotify_mutex);850850 mutex_lock(&dev->mutex);851851- remove_watch_no_event(watch, dev);851851+852852+ /* make sure we didn't race with another list removal */853853+ if (likely(idr_find(&dev->idr, watch->wd)))854854+ remove_watch_no_event(watch, dev);855855+852856 mutex_unlock(&dev->mutex);853857 mutex_unlock(&inode->inotify_mutex);854858 put_inotify_watch(watch);···894890 mutex_lock(&dev->mutex);895891896892 /* make sure that we did not race */897897- watch = idr_find(&dev->idr, wd);898898- if (likely(watch))893893+ if (likely(idr_find(&dev->idr, wd) == watch))899894 remove_watch(watch, dev);900895901896 mutex_unlock(&dev->mutex);
+4-2
fs/jffs2/nodelist.c
···438438 if (c->mtd->point) {439439 err = c->mtd->point(c->mtd, ofs, len, &retlen, &buffer);440440 if (!err && retlen < tn->csize) {441441- JFFS2_WARNING("MTD point returned len too short: %u instead of %u.\n", retlen, tn->csize);441441+ JFFS2_WARNING("MTD point returned len too short: %zu "442442+ "instead of %u.\n", retlen, tn->csize);442443 c->mtd->unpoint(c->mtd, buffer, ofs, len);443444 } else if (err)444445 JFFS2_WARNING("MTD point failed: error code %d.\n", err);···462461 }463462464463 if (retlen != len) {465465- JFFS2_ERROR("short read at %#08x: %d instead of %d.\n", ofs, retlen, len);464464+ JFFS2_ERROR("short read at %#08x: %zd instead of %d.\n",465465+ ofs, retlen, len);466466 err = -EIO;467467 goto free_out;468468 }
+5-15
fs/jfs/jfs_metapage.c
···542542static int metapage_releasepage(struct page *page, gfp_t gfp_mask)543543{544544 struct metapage *mp;545545- int busy = 0;545545+ int ret = 1;546546 unsigned int offset;547547548548 for (offset = 0; offset < PAGE_CACHE_SIZE; offset += PSIZE) {···552552 continue;553553554554 jfs_info("metapage_releasepage: mp = 0x%p", mp);555555- if (mp->count || mp->nohomeok) {555555+ if (mp->count || mp->nohomeok ||556556+ test_bit(META_dirty, &mp->flag)) {556557 jfs_info("count = %ld, nohomeok = %d", mp->count,557558 mp->nohomeok);558558- busy = 1;559559+ ret = 0;559560 continue;560560- }561561- wait_on_page_writeback(page);562562- //WARN_ON(test_bit(META_dirty, &mp->flag));563563- if (test_bit(META_dirty, &mp->flag)) {564564- dump_mem("dirty mp in metapage_releasepage", mp,565565- sizeof(struct metapage));566566- dump_mem("page", page, sizeof(struct page));567567- dump_stack();568561 }569562 if (mp->lsn)570563 remove_from_logsync(mp);···565572 INCREMENT(mpStat.pagefree);566573 free_metapage(mp);567574 }568568- if (busy)569569- return -1;570570-571571- return 0;575575+ return ret;572576}573577574578static void metapage_invalidatepage(struct page *page, unsigned long offset)
+2-5
fs/namespace.c
···899899/*900900 * do loopback mount.901901 */902902-static int do_loopback(struct nameidata *nd, char *old_name, unsigned long flags, int mnt_flags)902902+static int do_loopback(struct nameidata *nd, char *old_name, int recurse)903903{904904 struct nameidata old_nd;905905 struct vfsmount *mnt = NULL;906906- int recurse = flags & MS_REC;907906 int err = mount_is_safe(nd);908908-909907 if (err)910908 return err;911909 if (!old_name || !*old_name)···937939 spin_unlock(&vfsmount_lock);938940 release_mounts(&umount_list);939941 }940940- mnt->mnt_flags = mnt_flags;941942942943out:943944 up_write(&namespace_sem);···13501353 retval = do_remount(&nd, flags & ~MS_REMOUNT, mnt_flags,13511354 data_page);13521355 else if (flags & MS_BIND)13531353- retval = do_loopback(&nd, dev_name, flags, mnt_flags);13561356+ retval = do_loopback(&nd, dev_name, flags & MS_REC);13541357 else if (flags & (MS_SHARED | MS_PRIVATE | MS_SLAVE | MS_UNBINDABLE))13551358 retval = do_change_type(&nd, flags);13561359 else if (flags & MS_MOVE)
···276276 return ret;277277}278278279279+/* This can also be called from ocfs2_write_zero_page() which has done280280+ * it's own cluster locking. */281281+int ocfs2_prepare_write_nolock(struct inode *inode, struct page *page,282282+ unsigned from, unsigned to)283283+{284284+ int ret;285285+286286+ down_read(&OCFS2_I(inode)->ip_alloc_sem);287287+288288+ ret = block_prepare_write(page, from, to, ocfs2_get_block);289289+290290+ up_read(&OCFS2_I(inode)->ip_alloc_sem);291291+292292+ return ret;293293+}294294+279295/*280296 * ocfs2_prepare_write() can be an outer-most ocfs2 call when it is called281297 * from loopback. It must be able to perform its own locking around282298 * ocfs2_get_block().283299 */284284-int ocfs2_prepare_write(struct file *file, struct page *page,285285- unsigned from, unsigned to)300300+static int ocfs2_prepare_write(struct file *file, struct page *page,301301+ unsigned from, unsigned to)286302{287303 struct inode *inode = page->mapping->host;288304 int ret;···311295 goto out;312296 }313297314314- down_read(&OCFS2_I(inode)->ip_alloc_sem);315315-316316- ret = block_prepare_write(page, from, to, ocfs2_get_block);317317-318318- up_read(&OCFS2_I(inode)->ip_alloc_sem);298298+ ret = ocfs2_prepare_write_nolock(inode, page, from, to);319299320300 ocfs2_meta_unlock(inode, 0);321301out:···637625 int ret;638626639627 mlog_entry_void();628628+629629+ /*630630+ * We get PR data locks even for O_DIRECT. This allows631631+ * concurrent O_DIRECT I/O but doesn't let O_DIRECT with632632+ * extending and buffered zeroing writes race. If they did633633+ * race then the buffered zeroing could be written back after634634+ * the O_DIRECT I/O. It's one thing to tell people not to mix635635+ * buffered and O_DIRECT writes, but expecting them to636636+ * understand that file extension is also an implicit buffered637637+ * write is too much. By getting the PR we force writeback of638638+ * the buffered zeroing before proceeding.639639+ */640640+ ret = ocfs2_data_lock(inode, 0);641641+ if (ret < 0) {642642+ mlog_errno(ret);643643+ goto out;644644+ }645645+ ocfs2_data_unlock(inode, 0);646646+640647 ret = blockdev_direct_IO_no_locking(rw, iocb, inode,641648 inode->i_sb->s_bdev, iov, offset,642649 nr_segs, 643650 ocfs2_direct_IO_get_blocks,644651 ocfs2_dio_end_io);652652+out:645653 mlog_exit(ret);646654 return ret;647655}
···569569570570 ret = -ENOMEM;571571 ctxt.new_ent = kmem_cache_alloc(ocfs2_em_ent_cachep,572572- GFP_KERNEL);572572+ GFP_NOFS);573573 if (!ctxt.new_ent) {574574 mlog_errno(ret);575575 return ret;···583583 if (ctxt.need_left && !ctxt.left_ent) {584584 ctxt.left_ent =585585 kmem_cache_alloc(ocfs2_em_ent_cachep,586586- GFP_KERNEL);586586+ GFP_NOFS);587587 if (!ctxt.left_ent)588588 break;589589 }590590 if (ctxt.need_right && !ctxt.right_ent) {591591 ctxt.right_ent =592592 kmem_cache_alloc(ocfs2_em_ent_cachep,593593- GFP_KERNEL);593593+ GFP_NOFS);594594 if (!ctxt.right_ent)595595 break;596596 }
+63-25
fs/ocfs2/file.c
···613613614614/* Some parts of this taken from generic_cont_expand, which turned out615615 * to be too fragile to do exactly what we need without us having to616616- * worry about recursive locking in ->commit_write(). */616616+ * worry about recursive locking in ->prepare_write() and617617+ * ->commit_write(). */617618static int ocfs2_write_zero_page(struct inode *inode,618619 u64 size)619620{···642641 goto out;643642 }644643645645- ret = ocfs2_prepare_write(NULL, page, offset, offset);644644+ ret = ocfs2_prepare_write_nolock(inode, page, offset, offset);646645 if (ret < 0) {647646 mlog_errno(ret);648647 goto out_unlock;···696695 return ret;697696}698697698698+/* 699699+ * A tail_to_skip value > 0 indicates that we're being called from700700+ * ocfs2_file_aio_write(). This has the following implications:701701+ *702702+ * - we don't want to update i_size703703+ * - di_bh will be NULL, which is fine because it's only used in the704704+ * case where we want to update i_size.705705+ * - ocfs2_zero_extend() will then only be filling the hole created706706+ * between i_size and the start of the write.707707+ */699708static int ocfs2_extend_file(struct inode *inode,700709 struct buffer_head *di_bh,701701- u64 new_i_size)710710+ u64 new_i_size,711711+ size_t tail_to_skip)702712{703713 int ret = 0;704714 u32 clusters_to_add;715715+716716+ BUG_ON(!tail_to_skip && !di_bh);705717706718 /* setattr sometimes calls us like this. */707719 if (new_i_size == 0)···728714 OCFS2_I(inode)->ip_clusters;729715730716 if (clusters_to_add) {717717+ /* 718718+ * protect the pages that ocfs2_zero_extend is going to719719+ * be pulling into the page cache.. we do this before the720720+ * metadata extend so that we don't get into the situation721721+ * where we've extended the metadata but can't get the data722722+ * lock to zero.723723+ */724724+ ret = ocfs2_data_lock(inode, 1);725725+ if (ret < 0) {726726+ mlog_errno(ret);727727+ goto out;728728+ }729729+731730 ret = ocfs2_extend_allocation(inode, clusters_to_add);732731 if (ret < 0) {733732 mlog_errno(ret);734734- goto out;733733+ goto out_unlock;735734 }736735737737- ret = ocfs2_zero_extend(inode, new_i_size);736736+ ret = ocfs2_zero_extend(inode, (u64)new_i_size - tail_to_skip);738737 if (ret < 0) {739738 mlog_errno(ret);740740- goto out;739739+ goto out_unlock;741740 }742742- } 743743-744744- /* No allocation required, we just use this helper to745745- * do a trivial update of i_size. */746746- ret = ocfs2_simple_size_update(inode, di_bh, new_i_size);747747- if (ret < 0) {748748- mlog_errno(ret);749749- goto out;750741 }742742+743743+ if (!tail_to_skip) {744744+ /* We're being called from ocfs2_setattr() which wants745745+ * us to update i_size */746746+ ret = ocfs2_simple_size_update(inode, di_bh, new_i_size);747747+ if (ret < 0)748748+ mlog_errno(ret);749749+ }750750+751751+out_unlock:752752+ if (clusters_to_add) /* this is the only case in which we lock */753753+ ocfs2_data_unlock(inode, 1);751754752755out:753756 return ret;···824793 if (i_size_read(inode) > attr->ia_size)825794 status = ocfs2_truncate_file(inode, bh, attr->ia_size);826795 else827827- status = ocfs2_extend_file(inode, bh, attr->ia_size);796796+ status = ocfs2_extend_file(inode, bh, attr->ia_size, 0);828797 if (status < 0) {829798 if (status != -ENOSPC)830799 mlog_errno(status);···10801049 if (!clusters)10811050 break;1082105110831083- ret = ocfs2_extend_allocation(inode, clusters);10521052+ ret = ocfs2_extend_file(inode, NULL, newsize, count);10841053 if (ret < 0) {10851054 if (ret != -ENOSPC)10861055 mlog_errno(ret);10871087- goto out;10881088- }10891089-10901090- /* Fill any holes which would've been created by this10911091- * write. If we're O_APPEND, this will wind up10921092- * (correctly) being a noop. */10931093- ret = ocfs2_zero_extend(inode, (u64) newsize - count);10941094- if (ret < 0) {10951095- mlog_errno(ret);10961056 goto out;10971057 }10981058 break;···11671145 /* communicate with ocfs2_dio_end_io */11681146 ocfs2_iocb_set_rw_locked(iocb);11691147 }11481148+11491149+ /*11501150+ * We're fine letting folks race truncates and extending11511151+ * writes with read across the cluster, just like they can11521152+ * locally. Hence no rw_lock during read.11531153+ * 11541154+ * Take and drop the meta data lock to update inode fields11551155+ * like i_size. This allows the checks down below11561156+ * generic_file_aio_read() a chance of actually working. 11571157+ */11581158+ ret = ocfs2_meta_lock(inode, NULL, NULL, 0);11591159+ if (ret < 0) {11601160+ mlog_errno(ret);11611161+ goto bail;11621162+ }11631163+ ocfs2_meta_unlock(inode, 0);1170116411711165 ret = generic_file_aio_read(iocb, buf, count, iocb->ki_pos);11721166 if (ret == -EINVAL)
+5-3
fs/ocfs2/journal.c
···117117{118118 struct ocfs2_journal_handle *retval = NULL;119119120120- retval = kcalloc(1, sizeof(*retval), GFP_KERNEL);120120+ retval = kcalloc(1, sizeof(*retval), GFP_NOFS);121121 if (!retval) {122122 mlog(ML_ERROR, "Failed to allocate memory for journal "123123 "handle!\n");···870870 if (p_blocks > CONCURRENT_JOURNAL_FILL)871871 p_blocks = CONCURRENT_JOURNAL_FILL;872872873873+ /* We are reading journal data which should not874874+ * be put in the uptodate cache */873875 status = ocfs2_read_blocks(OCFS2_SB(inode->i_sb),874876 p_blkno, p_blocks, bhs, 0,875875- inode);877877+ NULL);876878 if (status < 0) {877879 mlog_errno(status);878880 goto bail;···984982{985983 struct ocfs2_la_recovery_item *item;986984987987- item = kmalloc(sizeof(struct ocfs2_la_recovery_item), GFP_KERNEL);985985+ item = kmalloc(sizeof(struct ocfs2_la_recovery_item), GFP_NOFS);988986 if (!item) {989987 /* Though we wish to avoid it, we are in fact safe in990988 * skipping local alloc cleanup as fsck.ocfs2 is more
+2-2
fs/ocfs2/uptodate.c
···337337 (unsigned long long)oi->ip_blkno,338338 (unsigned long long)block, expand_tree);339339340340- new = kmem_cache_alloc(ocfs2_uptodate_cachep, GFP_KERNEL);340340+ new = kmem_cache_alloc(ocfs2_uptodate_cachep, GFP_NOFS);341341 if (!new) {342342 mlog_errno(-ENOMEM);343343 return;···349349 * has no way of tracking that. */350350 for(i = 0; i < OCFS2_INODE_MAX_CACHE_ARRAY; i++) {351351 tree[i] = kmem_cache_alloc(ocfs2_uptodate_cachep,352352- GFP_KERNEL);352352+ GFP_NOFS);353353 if (!tree[i]) {354354 mlog_errno(-ENOMEM);355355 goto out_free;
+3-3
fs/ocfs2/vote.c
···586586{587587 struct ocfs2_net_wait_ctxt *w;588588589589- w = kcalloc(1, sizeof(*w), GFP_KERNEL);589589+ w = kcalloc(1, sizeof(*w), GFP_NOFS);590590 if (!w) {591591 mlog_errno(-ENOMEM);592592 goto bail;···749749750750 BUG_ON(!ocfs2_is_valid_vote_request(type));751751752752- request = kcalloc(1, sizeof(*request), GFP_KERNEL);752752+ request = kcalloc(1, sizeof(*request), GFP_NOFS);753753 if (!request) {754754 mlog_errno(-ENOMEM);755755 } else {···11291129 struct ocfs2_super *osb = data;11301130 struct ocfs2_vote_work *work;1131113111321132- work = kmalloc(sizeof(struct ocfs2_vote_work), GFP_KERNEL);11321132+ work = kmalloc(sizeof(struct ocfs2_vote_work), GFP_NOFS);11331133 if (!work) {11341134 status = -ENOMEM;11351135 mlog_errno(status);
···533533534534 devfs_remove_disk(disk);535535536536+ kobject_uevent(&disk->kobj, KOBJ_REMOVE);536537 if (disk->holder_dir)537538 kobject_unregister(disk->holder_dir);538539 if (disk->slave_dir)···546545 kfree(disk_name);547546 }548547 put_device(disk->driverfs_dev);548548+ disk->driverfs_dev = NULL;549549 }550550- kobject_uevent(&disk->kobj, KOBJ_REMOVE);551550 kobject_del(&disk->kobj);552551}
+5
fs/smbfs/dir.c
···434434 if (dentry->d_name.len > SMB_MAXNAMELEN)435435 goto out;436436437437+ /* Do not allow lookup of names with backslashes in */438438+ error = -EINVAL;439439+ if (memchr(dentry->d_name.name, '\\', dentry->d_name.len))440440+ goto out;441441+437442 lock_kernel();438443 error = smb_proc_getattr(dentry, &finfo);439444#ifdef SMBFS_PARANOIA
+3-1
fs/smbfs/request.c
···339339 /*340340 * On timeout or on interrupt we want to try and remove the341341 * request from the recvq/xmitq.342342+ * First check if the request is still part of a queue. (May343343+ * have been removed by some error condition)342344 */343345 smb_lock_server(server);344344- if (!(req->rq_flags & SMB_REQ_RECEIVED)) {346346+ if (!list_empty(&req->rq_queue)) {345347 list_del_init(&req->rq_queue);346348 smb_rput(req);347349 }
+71
include/asm-arm/arch-pxa/pxa2xx_spi.h
···11+/*22+ * Copyright (C) 2005 Stephen Street / StreetFire Sound Labs33+ *44+ * This program is free software; you can redistribute it and/or modify55+ * it under the terms of the GNU General Public License as published by66+ * the Free Software Foundation; either version 2 of the License, or77+ * (at your option) any later version.88+ *99+ * This program is distributed in the hope that it will be useful,1010+ * but WITHOUT ANY WARRANTY; without even the implied warranty of1111+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the1212+ * GNU General Public License for more details.1313+ *1414+ * You should have received a copy of the GNU General Public License1515+ * along with this program; if not, write to the Free Software1616+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.1717+ */1818+1919+#ifndef PXA2XX_SPI_H_2020+#define PXA2XX_SPI_H_2121+2222+#define PXA2XX_CS_ASSERT (0x01)2323+#define PXA2XX_CS_DEASSERT (0x02)2424+2525+#if defined(CONFIG_PXA25x)2626+#define CLOCK_SPEED_HZ 36864002727+#define SSP1_SerClkDiv(x) (((CLOCK_SPEED_HZ/2/(x+1))<<8)&0x0000ff00)2828+#define SSP2_SerClkDiv(x) (((CLOCK_SPEED_HZ/(x+1))<<8)&0x000fff00)2929+#define SSP3_SerClkDiv(x) (((CLOCK_SPEED_HZ/(x+1))<<8)&0x000fff00)3030+#define SSP_TIMEOUT_SCALE (2712)3131+#elif defined(CONFIG_PXA27x)3232+#define CLOCK_SPEED_HZ 130000003333+#define SSP1_SerClkDiv(x) (((CLOCK_SPEED_HZ/(x+1))<<8)&0x000fff00)3434+#define SSP2_SerClkDiv(x) (((CLOCK_SPEED_HZ/(x+1))<<8)&0x000fff00)3535+#define SSP3_SerClkDiv(x) (((CLOCK_SPEED_HZ/(x+1))<<8)&0x000fff00)3636+#define SSP_TIMEOUT_SCALE (769)3737+#endif3838+3939+#define SSP_TIMEOUT(x) ((x*10000)/SSP_TIMEOUT_SCALE)4040+#define SSP1_VIRT ((void *)(io_p2v(__PREG(SSCR0_P(1)))))4141+#define SSP2_VIRT ((void *)(io_p2v(__PREG(SSCR0_P(2)))))4242+#define SSP3_VIRT ((void *)(io_p2v(__PREG(SSCR0_P(3)))))4343+4444+enum pxa_ssp_type {4545+ SSP_UNDEFINED = 0,4646+ PXA25x_SSP, /* pxa 210, 250, 255, 26x */4747+ PXA25x_NSSP, /* pxa 255, 26x (including ASSP) */4848+ PXA27x_SSP,4949+};5050+5151+/* device.platform_data for SSP controller devices */5252+struct pxa2xx_spi_master {5353+ enum pxa_ssp_type ssp_type;5454+ u32 clock_enable;5555+ u16 num_chipselect;5656+ u8 enable_dma;5757+};5858+5959+/* spi_board_info.controller_data for SPI slave devices,6060+ * copied to spi_device.platform_data ... mostly for dma tuning6161+ */6262+struct pxa2xx_spi_chip {6363+ u8 tx_threshold;6464+ u8 rx_threshold;6565+ u8 dma_burst_size;6666+ u32 timeout_microsecs;6767+ u8 enable_loopback;6868+ void (*cs_control)(u32 command);6969+};7070+7171+#endif /*PXA2XX_SPI_H_*/
+31
include/asm-arm/arch-s3c2410/spi-gpio.h
···11+/* linux/include/asm-arm/arch-s3c2410/spi.h22+ *33+ * Copyright (c) 2006 Simtec Electronics44+ * Ben Dooks <ben@simtec.co.uk>55+ *66+ * S3C2410 - SPI Controller platfrom_device info77+ *88+ * This program is free software; you can redistribute it and/or modify99+ * it under the terms of the GNU General Public License version 2 as1010+ * published by the Free Software Foundation.1111+*/1212+1313+#ifndef __ASM_ARCH_SPIGPIO_H1414+#define __ASM_ARCH_SPIGPIO_H __FILE__1515+1616+struct s3c2410_spigpio_info;1717+struct spi_board_info;1818+1919+struct s3c2410_spigpio_info {2020+ unsigned long pin_clk;2121+ unsigned long pin_mosi;2222+ unsigned long pin_miso;2323+2424+ unsigned long board_size;2525+ struct spi_board_info *board_info;2626+2727+ void (*chip_select)(struct s3c2410_spigpio_info *spi, int cs);2828+};2929+3030+3131+#endif /* __ASM_ARCH_SPIGPIO_H */
+29
include/asm-arm/arch-s3c2410/spi.h
···11+/* linux/include/asm-arm/arch-s3c2410/spi.h22+ *33+ * Copyright (c) 2006 Simtec Electronics44+ * Ben Dooks <ben@simtec.co.uk>55+ *66+ * S3C2410 - SPI Controller platform_device info77+ *88+ * This program is free software; you can redistribute it and/or modify99+ * it under the terms of the GNU General Public License version 2 as1010+ * published by the Free Software Foundation.1111+*/1212+1313+#ifndef __ASM_ARCH_SPI_H1414+#define __ASM_ARCH_SPI_H __FILE__1515+1616+struct s3c2410_spi_info;1717+struct spi_board_info;1818+1919+struct s3c2410_spi_info {2020+ unsigned long pin_cs; /* simple gpio cs */2121+2222+ unsigned long board_size;2323+ struct spi_board_info *board_info;2424+2525+ void (*set_cs)(struct s3c2410_spi_info *spi, int cs, int pol);2626+};2727+2828+2929+#endif /* __ASM_ARCH_SPI_H */
···296296#define __NR_pselect6 301297297#define __NR_ppoll 302298298#define __NR_unshare 303299299+#define __NR_set_robust_list 304300300+#define __NR_get_robust_list 305301301+#define __NR_splice 306302302+#define __NR_sync_file_range 307303303+#define __NR_tee 308304304+#define __NR_vmsplice 309299305300300-#define NR_syscalls 304306306+#define NR_syscalls 310301307302308/* 303309 * There are some system calls that are not present on 64 bit, some
+5-3
include/asm-sparc/unistd.h
···316316#define __NR_pselect6 297317317#define __NR_ppoll 298318318#define __NR_unshare 299319319+#define __NR_set_robust_list 300320320+#define __NR_get_robust_list 301319321320320-/* WARNING: You MAY NOT add syscall numbers larger than 299, since322322+/* WARNING: You MAY NOT add syscall numbers larger than 301, since321323 * all of the syscall tables in the Sparc kernel are322322- * sized to have 299 entries (starting at zero). Therefore323323- * find a free slot in the 0-299 range.324324+ * sized to have 301 entries (starting at zero). Therefore325325+ * find a free slot in the 0-301 range.324326 */325327326328#define _syscall0(type,name) \
···318318#define __NR_pselect6 297319319#define __NR_ppoll 298320320#define __NR_unshare 299321321+#define __NR_set_robust_list 300322322+#define __NR_get_robust_list 301321323322322-/* WARNING: You MAY NOT add syscall numbers larger than 299, since324324+/* WARNING: You MAY NOT add syscall numbers larger than 301, since323325 * all of the syscall tables in the Sparc kernel are324324- * sized to have 299 entries (starting at zero). Therefore325325- * find a free slot in the 0-299 range.326326+ * sized to have 301 entries (starting at zero). Therefore327327+ * find a free slot in the 0-301 range.326328 */327329328330#define _syscall0(type,name) \
···125125extern char *get_options(const char *str, int nints, int *ints);126126extern unsigned long long memparse(char *ptr, char **retptr);127127128128+extern int core_kernel_text(unsigned long addr);128129extern int __kernel_text_address(unsigned long addr);129130extern int kernel_text_address(unsigned long addr);130131extern int session_of_pgrp(int pgrp);
+1
include/linux/mmc/mmc.h
···6969 unsigned int timeout_ns; /* data timeout (in ns, max 80ms) */7070 unsigned int timeout_clks; /* data timeout (in clocks) */7171 unsigned int blksz_bits; /* data block size */7272+ unsigned int blksz; /* data block size */7273 unsigned int blocks; /* number of blocks */7374 unsigned int error; /* data error */7475 unsigned int flags;
···132132}133133134134extern int rcu_pending(int cpu);135135+extern int rcu_needs_cpu(int cpu);135136136137/**137138 * rcu_read_lock - mark the beginning of an RCU read-side critical section.
+1
include/linux/slab.h
···150150151151extern void kfree(const void *);152152extern unsigned int ksize(const void *);153153+extern int slab_is_available(void);153154154155#ifdef CONFIG_NUMA155156extern void *kmem_cache_alloc_node(kmem_cache_t *, gfp_t flags, int node);
+28-17
include/linux/spi/spi.h
···3131 * @master: SPI controller used with the device.3232 * @max_speed_hz: Maximum clock rate to be used with this chip3333 * (on this board); may be changed by the device's driver.3434+ * The spi_transfer.speed_hz can override this for each transfer.3435 * @chip-select: Chipselect, distinguishing chips handled by "master".3536 * @mode: The spi mode defines how data is clocked out and in.3637 * This may be changed by the device's driver.3838+ * The "active low" default for chipselect mode can be overridden,3939+ * as can the "MSB first" default for each word in a transfer.3740 * @bits_per_word: Data transfers involve one or more words; word sizes3838- * like eight or 12 bits are common. In-memory wordsizes are4141+ * like eight or 12 bits are common. In-memory wordsizes are3942 * powers of two bytes (e.g. 20 bit samples use 32 bits).4040- * This may be changed by the device's driver.4343+ * This may be changed by the device's driver, or left at the4444+ * default (0) indicating protocol words are eight bit bytes.4545+ * The spi_transfer.bits_per_word can override this for each transfer.4146 * @irq: Negative, or the number passed to request_irq() to receive4242- * interrupts from this device.4747+ * interrupts from this device.4348 * @controller_state: Controller's runtime state4449 * @controller_data: Board-specific definitions for controller, such as4545- * FIFO initialization parameters; from board_info.controller_data5050+ * FIFO initialization parameters; from board_info.controller_data4651 *4752 * An spi_device is used to interchange data between an SPI slave4853 * (usually a discrete chip) and CPU memory.···7065#define SPI_MODE_2 (SPI_CPOL|0)7166#define SPI_MODE_3 (SPI_CPOL|SPI_CPHA)7267#define SPI_CS_HIGH 0x04 /* chipselect active high? */6868+#define SPI_LSB_FIRST 0x08 /* per-word bits-on-wire */7369 u8 bits_per_word;7470 int irq;7571 void *controller_state;···79738074 // likely need more hooks for more protocol options affecting how8175 // the controller talks to each chip, like:8282- // - bit order (default is wordwise msb-first)8376 // - memory packing (12 bit samples into low bits, others zeroed)8477 // - priority8578 // - drop chipselect after each word···148143 * struct spi_master - interface to SPI master controller149144 * @cdev: class interface to this driver150145 * @bus_num: board-specific (and often SOC-specific) identifier for a151151- * given SPI controller.146146+ * given SPI controller.152147 * @num_chipselect: chipselects are used to distinguish individual153153- * SPI slaves, and are numbered from zero to num_chipselects.154154- * each slave has a chipselect signal, but it's common that not155155- * every chipselect is connected to a slave.148148+ * SPI slaves, and are numbered from zero to num_chipselects.149149+ * each slave has a chipselect signal, but it's common that not150150+ * every chipselect is connected to a slave.156151 * @setup: updates the device mode and clocking records used by a157157- * device's SPI controller; protocol code may call this.152152+ * device's SPI controller; protocol code may call this.158153 * @transfer: adds a message to the controller's transfer queue.159154 * @cleanup: frees controller-specific state160155 *···172167struct spi_master {173168 struct class_device cdev;174169175175- /* other than zero (== assign one dynamically), bus_num is fully170170+ /* other than negative (== assign one dynamically), bus_num is fully176171 * board-specific. usually that simplifies to being SOC-specific.177177- * example: one SOC has three SPI controllers, numbered 1..3,172172+ * example: one SOC has three SPI controllers, numbered 0..2,178173 * and one board's schematics might show it using SPI-2. software179174 * would normally use bus_num=2 for that controller.180175 */181181- u16 bus_num;176176+ s16 bus_num;182177183178 /* chipselects will be integral to many controllers; some others184179 * might use board-specific GPIOs.···273268 * @tx_dma: DMA address of tx_buf, if spi_message.is_dma_mapped274269 * @rx_dma: DMA address of rx_buf, if spi_message.is_dma_mapped275270 * @len: size of rx and tx buffers (in bytes)271271+ * @speed_hz: Select a speed other then the device default for this272272+ * transfer. If 0 the default (from spi_device) is used.273273+ * @bits_per_word: select a bits_per_word other then the device default274274+ * for this transfer. If 0 the default (from spi_device) is used.276275 * @cs_change: affects chipselect after this transfer completes277276 * @delay_usecs: microseconds to delay after this transfer before278278- * (optionally) changing the chipselect status, then starting279279- * the next transfer or completing this spi_message.277277+ * (optionally) changing the chipselect status, then starting278278+ * the next transfer or completing this spi_message.280279 * @transfer_list: transfers are sequenced through spi_message.transfers281280 *282281 * SPI transfers always write the same number of bytes as they read.···331322 dma_addr_t rx_dma;332323333324 unsigned cs_change:1;325325+ u8 bits_per_word;334326 u16 delay_usecs;327327+ u32 speed_hz;335328336329 struct list_head transfer_list;337330};···367356 * and its transfers, ignore them until its completion callback.368357 */369358struct spi_message {370370- struct list_head transfers;359359+ struct list_head transfers;371360372361 struct spi_device *spi;373362···385374 */386375387376 /* completion is reported through a callback */388388- void (*complete)(void *context);377377+ void (*complete)(void *context);389378 void *context;390379 unsigned actual_length;391380 int status;
+8
include/linux/spi/spi_bitbang.h
···30303131 struct spi_master *master;32323333+ /* setup_transfer() changes clock and/or wordsize to match settings3434+ * for this transfer; zeroes restore defaults from spi_device.3535+ */3636+ int (*setup_transfer)(struct spi_device *spi,3737+ struct spi_transfer *t);3838+3339 void (*chipselect)(struct spi_device *spi, int is_on);3440#define BITBANG_CS_ACTIVE 1 /* normally nCS, active low */3541#define BITBANG_CS_INACTIVE 0···5751extern int spi_bitbang_setup(struct spi_device *spi);5852extern void spi_bitbang_cleanup(const struct spi_device *spi);5953extern int spi_bitbang_transfer(struct spi_device *spi, struct spi_message *m);5454+extern int spi_bitbang_setup_transfer(struct spi_device *spi,5555+ struct spi_transfer *t);60566157/* start or stop queue processing */6258extern int spi_bitbang_start(struct spi_bitbang *spi);
···310310311311 panic("VFS: Unable to mount root fs on %s", b);312312 }313313+314314+ printk("No filesystem could mount root, tried: ");315315+ for (p = fs_names; *p; p += strlen(p)+1)316316+ printk(" %s", p);317317+ printk("\n");313318 panic("VFS: Unable to mount root fs on %s", __bdevname(ROOT_DEV, b));314319out:315320 putname(fs_names);
···22312231 * So only GFP_KERNEL allocations, if all nodes in the cpuset are22322232 * short of memory, might require taking the callback_mutex mutex.22332233 *22342234- * The first loop over the zonelist in mm/page_alloc.c:__alloc_pages()22352235- * calls here with __GFP_HARDWALL always set in gfp_mask, enforcing22362236- * hardwall cpusets - no allocation on a node outside the cpuset is22372237- * allowed (unless in interrupt, of course).22342234+ * The first call here from mm/page_alloc:get_page_from_freelist()22352235+ * has __GFP_HARDWALL set in gfp_mask, enforcing hardwall cpusets, so22362236+ * no allocation on a node outside the cpuset is allowed (unless in22372237+ * interrupt, of course).22382238 *22392239- * The second loop doesn't even call here for GFP_ATOMIC requests22402240- * (if the __alloc_pages() local variable 'wait' is set). That check22412241- * and the checks below have the combined affect in the second loop of22422242- * the __alloc_pages() routine that:22392239+ * The second pass through get_page_from_freelist() doesn't even call22402240+ * here for GFP_ATOMIC calls. For those calls, the __alloc_pages()22412241+ * variable 'wait' is not set, and the bit ALLOC_CPUSET is not set22422242+ * in alloc_flags. That logic and the checks below have the combined22432243+ * affect that:22432244 * in_interrupt - any node ok (current task context irrelevant)22442245 * GFP_ATOMIC - any node ok22452246 * GFP_KERNEL - any node in enclosing mem_exclusive cpuset ok22462247 * GFP_USER - only nodes in current tasks mems allowed ok.22482248+ *22492249+ * Rule:22502250+ * Don't call cpuset_zone_allowed() if you can't sleep, unless you22512251+ * pass in the __GFP_HARDWALL flag set in gfp_flag, which disables22522252+ * the code that might scan up ancestor cpusets and sleep.22472253 **/2248225422492255int __cpuset_zone_allowed(struct zone *z, gfp_t gfp_mask)···22612255 if (in_interrupt())22622256 return 1;22632257 node = z->zone_pgdat->node_id;22582258+ might_sleep_if(!(gfp_mask & __GFP_HARDWALL));22642259 if (node_isset(node, current->mems_allowed))22652260 return 1;22662261 if (gfp_mask & __GFP_HARDWALL) /* If hardwall request, stop here */
+1-1
kernel/extable.c
···4040 return e;4141}42424343-static int core_kernel_text(unsigned long addr)4343+int core_kernel_text(unsigned long addr)4444{4545 if (addr >= (unsigned long)_stext &&4646 addr <= (unsigned long)_etext)
+6-6
kernel/module.c
···705705706706void symbol_put_addr(void *addr)707707{708708- unsigned long flags;708708+ struct module *modaddr;709709710710- spin_lock_irqsave(&modlist_lock, flags);711711- if (!kernel_text_address((unsigned long)addr))710710+ if (core_kernel_text((unsigned long)addr))711711+ return;712712+713713+ if (!(modaddr = module_text_address((unsigned long)addr)))712714 BUG();713713-714714- module_put(module_text_address((unsigned long)addr));715715- spin_unlock_irqrestore(&modlist_lock, flags);715715+ module_put(modaddr);716716}717717EXPORT_SYMBOL_GPL(symbol_put_addr);718718
+19
kernel/rcupdate.c
···479479 return 0;480480}481481482482+/*483483+ * Check to see if there is any immediate RCU-related work to be done484484+ * by the current CPU, returning 1 if so. This function is part of the485485+ * RCU implementation; it is -not- an exported member of the RCU API.486486+ */482487int rcu_pending(int cpu)483488{484489 return __rcu_pending(&rcu_ctrlblk, &per_cpu(rcu_data, cpu)) ||485490 __rcu_pending(&rcu_bh_ctrlblk, &per_cpu(rcu_bh_data, cpu));491491+}492492+493493+/*494494+ * Check to see if any future RCU-related work will need to be done495495+ * by the current CPU, even if none need be done immediately, returning496496+ * 1 if so. This function is part of the RCU implementation; it is -not-497497+ * an exported member of the RCU API.498498+ */499499+int rcu_needs_cpu(int cpu)500500+{501501+ struct rcu_data *rdp = &per_cpu(rcu_data, cpu);502502+ struct rcu_data *rdp_bh = &per_cpu(rcu_bh_data, cpu);503503+504504+ return (!!rdp->curlist || !!rdp_bh->curlist || rcu_pending(cpu));486505}487506488507void rcu_check_callbacks(int cpu, int user)
+18-44
kernel/sched.c
···665665}666666667667/*668668- * We place interactive tasks back into the active array, if possible.669669- *670670- * To guarantee that this does not starve expired tasks we ignore the671671- * interactivity of a task if the first expired task had to wait more672672- * than a 'reasonable' amount of time. This deadline timeout is673673- * load-dependent, as the frequency of array switched decreases with674674- * increasing number of running tasks. We also ignore the interactivity675675- * if a better static_prio task has expired, and switch periodically676676- * regardless, to ensure that highly interactive tasks do not starve677677- * the less fortunate for unreasonably long periods.678678- */679679-static inline int expired_starving(runqueue_t *rq)680680-{681681- int limit;682682-683683- /*684684- * Arrays were recently switched, all is well685685- */686686- if (!rq->expired_timestamp)687687- return 0;688688-689689- limit = STARVATION_LIMIT * rq->nr_running;690690-691691- /*692692- * It's time to switch arrays693693- */694694- if (jiffies - rq->expired_timestamp >= limit)695695- return 1;696696-697697- /*698698- * There's a better selection in the expired array699699- */700700- if (rq->curr->static_prio > rq->best_expired_prio)701701- return 1;702702-703703- /*704704- * All is well705705- */706706- return 0;707707-}708708-709709-/*710668 * __activate_task - move a task to the runqueue.711669 */712670static void __activate_task(task_t *p, runqueue_t *rq)713671{714672 prio_array_t *target = rq->active;715673716716- if (unlikely(batch_task(p) || (expired_starving(rq) && !rt_task(p))))674674+ if (batch_task(p))717675 target = rq->expired;718676 enqueue_task(p, target);719677 rq->nr_running++;···24902532}2491253324922534/*25352535+ * We place interactive tasks back into the active array, if possible.25362536+ *25372537+ * To guarantee that this does not starve expired tasks we ignore the25382538+ * interactivity of a task if the first expired task had to wait more25392539+ * than a 'reasonable' amount of time. This deadline timeout is25402540+ * load-dependent, as the frequency of array switched decreases with25412541+ * increasing number of running tasks. We also ignore the interactivity25422542+ * if a better static_prio task has expired:25432543+ */25442544+#define EXPIRED_STARVING(rq) \25452545+ ((STARVATION_LIMIT && ((rq)->expired_timestamp && \25462546+ (jiffies - (rq)->expired_timestamp >= \25472547+ STARVATION_LIMIT * ((rq)->nr_running) + 1))) || \25482548+ ((rq)->curr->static_prio > (rq)->best_expired_prio))25492549+25502550+/*24932551 * Account user cpu time to a process.24942552 * @p: the process that the cpu time gets accounted to24952553 * @hardirq_offset: the offset to subtract from hardirq_count()···2640266626412667 if (!rq->expired_timestamp)26422668 rq->expired_timestamp = jiffies;26432643- if (!TASK_INTERACTIVE(p) || expired_starving(rq)) {26692669+ if (!TASK_INTERACTIVE(p) || EXPIRED_STARVING(rq)) {26442670 enqueue_task(p, rq->expired);26452671 if (p->static_prio < rq->best_expired_prio)26462672 rq->best_expired_prio = p->static_prio;
+16
kernel/timer.c
···541541 }542542 spin_unlock(&base->lock);543543544544+ /*545545+ * It can happen that other CPUs service timer IRQs and increment546546+ * jiffies, but we have not yet got a local timer tick to process547547+ * the timer wheels. In that case, the expiry time can be before548548+ * jiffies, but since the high-resolution timer here is relative to549549+ * jiffies, the default expression when high-resolution timers are550550+ * not active,551551+ *552552+ * time_before(MAX_JIFFY_OFFSET + jiffies, expires)553553+ *554554+ * would falsely evaluate to true. If that is the case, just555555+ * return jiffies so that we can immediately fire the local timer556556+ */557557+ if (time_before(expires, jiffies))558558+ return jiffies;559559+544560 if (time_before(hr_expires, expires))545561 return hr_expires;546562
+1-1
lib/Kconfig.debug
···189189config UNWIND_INFO190190 bool "Compile the kernel with frame unwind information"191191 depends on !IA64192192- depends on !MODULES || !(MIPS || PARISC || PPC || SUPERH || SPARC64 || V850)192192+ depends on !MODULES || !(MIPS || PARISC || PPC || SUPERH || V850)193193 help194194 If you say Y here the resulting kernel image will be slightly larger195195 but not slower, and it will give very useful debugging information.
+3-3
lib/kobject.c
···198198199199 /* be noisy on error issues */200200 if (error == -EEXIST)201201- printk("kobject_add failed for %s with -EEXIST, "201201+ pr_debug("kobject_add failed for %s with -EEXIST, "202202 "don't try to register things with the "203203 "same name in the same directory.\n",204204 kobject_name(kobj));205205 else206206- printk("kobject_add failed for %s (%d)\n",206206+ pr_debug("kobject_add failed for %s (%d)\n",207207 kobject_name(kobj), error);208208- dump_stack();208208+ /* dump_stack(); */209209 }210210211211 return error;
+21-9
mm/page_alloc.c
···3939#include <linux/mempolicy.h>40404141#include <asm/tlbflush.h>4242+#include <asm/div64.h>4243#include "internal.h"43444445/*···951950 goto got_pg;952951953952 do {954954- if (cpuset_zone_allowed(*z, gfp_mask))953953+ if (cpuset_zone_allowed(*z, gfp_mask|__GFP_HARDWALL))955954 wakeup_kswapd(*z, order);956955 } while (*(++z));957956···970969 alloc_flags |= ALLOC_HARDER;971970 if (gfp_mask & __GFP_HIGH)972971 alloc_flags |= ALLOC_HIGH;973973- alloc_flags |= ALLOC_CPUSET;972972+ if (wait)973973+ alloc_flags |= ALLOC_CPUSET;974974975975 /*976976 * Go through the zonelist again. Let __GFP_HIGH and allocations···21252123#ifdef CONFIG_FLAT_NODE_MEM_MAP21262124 /* ia64 gets its own node_mem_map, before this, without bootmem */21272125 if (!pgdat->node_mem_map) {21282128- unsigned long size;21262126+ unsigned long size, start, end;21292127 struct page *map;2130212821312131- size = (pgdat->node_spanned_pages + 1) * sizeof(struct page);21292129+ /*21302130+ * The zone's endpoints aren't required to be MAX_ORDER21312131+ * aligned but the node_mem_map endpoints must be in order21322132+ * for the buddy allocator to function correctly.21332133+ */21342134+ start = pgdat->node_start_pfn & ~(MAX_ORDER_NR_PAGES - 1);21352135+ end = pgdat->node_start_pfn + pgdat->node_spanned_pages;21362136+ end = ALIGN(end, MAX_ORDER_NR_PAGES);21372137+ size = (end - start) * sizeof(struct page);21322138 map = alloc_remap(pgdat->node_id, size);21332139 if (!map)21342140 map = alloc_bootmem_node(pgdat, size);21352135- pgdat->node_mem_map = map;21412141+ pgdat->node_mem_map = map + (pgdat->node_start_pfn - start);21362142 }21372143#ifdef CONFIG_FLATMEM21382144 /*···25762566 }2577256725782568 for_each_zone(zone) {25792579- unsigned long tmp;25692569+ u64 tmp;25702570+25802571 spin_lock_irqsave(&zone->lru_lock, flags);25812581- tmp = (pages_min * zone->present_pages) / lowmem_pages;25722572+ tmp = (u64)pages_min * zone->present_pages;25732573+ do_div(tmp, lowmem_pages);25822574 if (is_highmem(zone)) {25832575 /*25842576 * __GFP_HIGH and PF_MEMALLOC allocations usually don't···26072595 zone->pages_min = tmp;26082596 }2609259726102610- zone->pages_low = zone->pages_min + tmp / 4;26112611- zone->pages_high = zone->pages_min + tmp / 2;25982598+ zone->pages_low = zone->pages_min + (tmp >> 2);25992599+ zone->pages_high = zone->pages_min + (tmp >> 1);26122600 spin_unlock_irqrestore(&zone->lru_lock, flags);26132601 }26142602
+15-4
mm/slab.c
···700700 FULL701701} g_cpucache_up;702702703703+/*704704+ * used by boot code to determine if it can use slab based allocator705705+ */706706+int slab_is_available(void)707707+{708708+ return g_cpucache_up == FULL;709709+}710710+703711static DEFINE_PER_CPU(struct work_struct, reap_work);704712705713static void free_block(struct kmem_cache *cachep, void **objpp, int len,···22002192 check_irq_on();22012193 for_each_online_node(node) {22022194 l3 = cachep->nodelists[node];22032203- if (l3) {21952195+ if (l3 && l3->alien)21962196+ drain_alien_cache(cachep, l3->alien);21972197+ }21982198+21992199+ for_each_online_node(node) {22002200+ l3 = cachep->nodelists[node];22012201+ if (l3)22042202 drain_array(cachep, l3, l3->shared, 1, node);22052205- if (l3->alien)22062206- drain_alien_cache(cachep, l3->alien);22072207- }22082203 }22092204}22102205
+3-6
mm/sparse.c
···3232 unsigned long array_size = SECTIONS_PER_ROOT *3333 sizeof(struct mem_section);34343535- if (system_state == SYSTEM_RUNNING)3535+ if (slab_is_available())3636 section = kmalloc_node(array_size, GFP_KERNEL, nid);3737 else3838 section = alloc_bootmem_node(NODE_DATA(nid), array_size);···8787 unsigned long root_nr;8888 struct mem_section* root;89899090- for (root_nr = 0;9191- root_nr < NR_MEM_SECTIONS;9292- root_nr += SECTIONS_PER_ROOT) {9393- root = __nr_to_section(root_nr);9494-9090+ for (root_nr = 0; root_nr < NR_SECTION_ROOTS; root_nr++) {9191+ root = __nr_to_section(root_nr * SECTIONS_PER_ROOT);9592 if (!root)9693 continue;9794
···208208 if (type != ICMPV6_DEST_UNREACH && type != ICMPV6_PKT_TOOBIG)209209 return;210210211211- spi = ntohl(ntohs(ipcomph->cpi));211211+ spi = htonl(ntohs(ipcomph->cpi));212212 x = xfrm_state_lookup((xfrm_address_t *)&iph->daddr, spi, IPPROTO_COMP, AF_INET6);213213 if (!x)214214 return;
+1-1
net/ipv6/netfilter/ip6_tables.c
···1103110311041104 write_lock_bh(&t->lock);11051105 private = t->private;11061106- if (private->number != paddc->num_counters) {11061106+ if (private->number != tmp.num_counters) {11071107 ret = -EINVAL;11081108 goto unlock_up_free;11091109 }
+1-1
net/ipv6/netfilter/ip6t_LOG.c
···439439440440 if (loginfo->logflags & IP6T_LOG_NFLOG)441441 nf_log_packet(PF_INET6, hooknum, *pskb, in, out, &li,442442- loginfo->prefix);442442+ "%s", loginfo->prefix);443443 else444444 ip6t_log_packet(PF_INET6, hooknum, *pskb, in, out, &li,445445 loginfo->prefix);
+1-1
net/ipv6/netfilter/ip6t_eui64.c
···40404141 memset(eui64, 0, sizeof(eui64));42424343- if (eth_hdr(skb)->h_proto == ntohs(ETH_P_IPV6)) {4343+ if (eth_hdr(skb)->h_proto == htons(ETH_P_IPV6)) {4444 if (skb->nh.ipv6h->version == 0x6) {4545 memcpy(eui64, eth_hdr(skb)->h_source, 3);4646 memcpy(eui64 + 5, eth_hdr(skb)->h_source + 3, 3);
+2-2
net/ipx/af_ipx.c
···944944 return rc;945945}946946947947-static int ipx_map_frame_type(unsigned char type)947947+static __be16 ipx_map_frame_type(unsigned char type)948948{949949- int rc = 0;949949+ __be16 rc = 0;950950951951 switch (type) {952952 case IPX_FRAME_ETHERII: rc = htons(ETH_P_IPX); break;
+1-1
net/ipx/ipx_route.c
···119119 return rc;120120}121121122122-static int ipxrtr_delete(long net)122122+static int ipxrtr_delete(__u32 net)123123{124124 struct ipx_route *r, *tmp;125125 int rc;
···7373 const union sctp_addr *peer,7474 struct sctp_transport **pt);75757676+static void sctp_add_backlog(struct sock *sk, struct sk_buff *skb);7777+76787779/* Calculate the SCTP checksum of an SCTP packet. */7880static inline int sctp_rcv_checksum(struct sk_buff *skb)···188186 */189187 if (sk->sk_bound_dev_if && (sk->sk_bound_dev_if != af->skb_iif(skb)))190188 {191191- sock_put(sk);192189 if (asoc) {193190 sctp_association_put(asoc);194191 asoc = NULL;···198197 sk = sctp_get_ctl_sock();199198 ep = sctp_sk(sk)->ep;200199 sctp_endpoint_hold(ep);201201- sock_hold(sk);202200 rcvr = &ep->base;203201 }204202···253253 */254254 sctp_bh_lock_sock(sk);255255256256- /* It is possible that the association could have moved to a different257257- * socket if it is peeled off. If so, update the sk.258258- */ 259259- if (sk != rcvr->sk) {260260- sctp_bh_lock_sock(rcvr->sk);261261- sctp_bh_unlock_sock(sk);262262- sk = rcvr->sk;263263- }264264-265256 if (sock_owned_by_user(sk))266266- sk_add_backlog(sk, skb);257257+ sctp_add_backlog(sk, skb);267258 else268268- sctp_backlog_rcv(sk, skb);259259+ sctp_inq_push(&chunk->rcvr->inqueue, chunk);269260270270- /* Release the sock and the sock ref we took in the lookup calls.271271- * The asoc/ep ref will be released in sctp_backlog_rcv.272272- */273261 sctp_bh_unlock_sock(sk);274274- sock_put(sk);262262+263263+ /* Release the asoc/ep ref we took in the lookup calls. */264264+ if (asoc)265265+ sctp_association_put(asoc);266266+ else267267+ sctp_endpoint_put(ep);275268276269 return 0;277270···273280 return 0;274281275282discard_release:276276- /* Release any structures we may be holding. */277277- sock_put(sk);283283+ /* Release the asoc/ep ref we took in the lookup calls. */278284 if (asoc)279285 sctp_association_put(asoc);280286 else···282290 goto discard_it;283291}284292285285-/* Handle second half of inbound skb processing. If the sock was busy,286286- * we may have need to delay processing until later when the sock is287287- * released (on the backlog). If not busy, we call this routine288288- * directly from the bottom half.293293+/* Process the backlog queue of the socket. Every skb on294294+ * the backlog holds a ref on an association or endpoint.295295+ * We hold this ref throughout the state machine to make296296+ * sure that the structure we need is still around.289297 */290298int sctp_backlog_rcv(struct sock *sk, struct sk_buff *skb)291299{292300 struct sctp_chunk *chunk = SCTP_INPUT_CB(skb)->chunk;293293- struct sctp_inq *inqueue = NULL;301301+ struct sctp_inq *inqueue = &chunk->rcvr->inqueue;294302 struct sctp_ep_common *rcvr = NULL;303303+ int backloged = 0;295304296305 rcvr = chunk->rcvr;297306298298- BUG_TRAP(rcvr->sk == sk);307307+ /* If the rcvr is dead then the association or endpoint308308+ * has been deleted and we can safely drop the chunk309309+ * and refs that we are holding.310310+ */311311+ if (rcvr->dead) {312312+ sctp_chunk_free(chunk);313313+ goto done;314314+ }299315300300- if (rcvr->dead) {301301- sctp_chunk_free(chunk);302302- } else {303303- inqueue = &chunk->rcvr->inqueue;304304- sctp_inq_push(inqueue, chunk);305305- }316316+ if (unlikely(rcvr->sk != sk)) {317317+ /* In this case, the association moved from one socket to318318+ * another. We are currently sitting on the backlog of the319319+ * old socket, so we need to move.320320+ * However, since we are here in the process context we321321+ * need to take make sure that the user doesn't own322322+ * the new socket when we process the packet.323323+ * If the new socket is user-owned, queue the chunk to the324324+ * backlog of the new socket without dropping any refs.325325+ * Otherwise, we can safely push the chunk on the inqueue.326326+ */306327307307- /* Release the asoc/ep ref we took in the lookup calls in sctp_rcv. */ 308308- if (SCTP_EP_TYPE_ASSOCIATION == rcvr->type)309309- sctp_association_put(sctp_assoc(rcvr));310310- else311311- sctp_endpoint_put(sctp_ep(rcvr));312312-328328+ sk = rcvr->sk;329329+ sctp_bh_lock_sock(sk);330330+331331+ if (sock_owned_by_user(sk)) {332332+ sk_add_backlog(sk, skb);333333+ backloged = 1;334334+ } else335335+ sctp_inq_push(inqueue, chunk);336336+337337+ sctp_bh_unlock_sock(sk);338338+339339+ /* If the chunk was backloged again, don't drop refs */340340+ if (backloged)341341+ return 0;342342+ } else {343343+ sctp_inq_push(inqueue, chunk);344344+ }345345+346346+done:347347+ /* Release the refs we took in sctp_add_backlog */348348+ if (SCTP_EP_TYPE_ASSOCIATION == rcvr->type)349349+ sctp_association_put(sctp_assoc(rcvr));350350+ else if (SCTP_EP_TYPE_SOCKET == rcvr->type)351351+ sctp_endpoint_put(sctp_ep(rcvr));352352+ else353353+ BUG();354354+313355 return 0;314356}315357316316-void sctp_backlog_migrate(struct sctp_association *assoc, 317317- struct sock *oldsk, struct sock *newsk)358358+static void sctp_add_backlog(struct sock *sk, struct sk_buff *skb)318359{319319- struct sk_buff *skb;320320- struct sctp_chunk *chunk;360360+ struct sctp_chunk *chunk = SCTP_INPUT_CB(skb)->chunk;361361+ struct sctp_ep_common *rcvr = chunk->rcvr;321362322322- skb = oldsk->sk_backlog.head;323323- oldsk->sk_backlog.head = oldsk->sk_backlog.tail = NULL;324324- while (skb != NULL) {325325- struct sk_buff *next = skb->next;363363+ /* Hold the assoc/ep while hanging on the backlog queue.364364+ * This way, we know structures we need will not disappear from us365365+ */366366+ if (SCTP_EP_TYPE_ASSOCIATION == rcvr->type)367367+ sctp_association_hold(sctp_assoc(rcvr));368368+ else if (SCTP_EP_TYPE_SOCKET == rcvr->type)369369+ sctp_endpoint_hold(sctp_ep(rcvr));370370+ else371371+ BUG();326372327327- chunk = SCTP_INPUT_CB(skb)->chunk;328328- skb->next = NULL;329329- if (&assoc->base == chunk->rcvr)330330- sk_add_backlog(newsk, skb);331331- else332332- sk_add_backlog(oldsk, skb);333333- skb = next;334334- }373373+ sk_add_backlog(sk, skb);335374}336375337376/* Handle icmp frag needed error. */···435412 union sctp_addr daddr;436413 struct sctp_af *af;437414 struct sock *sk = NULL;438438- struct sctp_association *asoc = NULL;415415+ struct sctp_association *asoc;439416 struct sctp_transport *transport = NULL;440417441418 *app = NULL; *tpp = NULL;···476453 return sk;477454478455out:479479- sock_put(sk);480456 if (asoc)481457 sctp_association_put(asoc);482458 return NULL;···485463void sctp_err_finish(struct sock *sk, struct sctp_association *asoc)486464{487465 sctp_bh_unlock_sock(sk);488488- sock_put(sk);489466 if (asoc)490467 sctp_association_put(asoc);491468}···511490 int type = skb->h.icmph->type;512491 int code = skb->h.icmph->code;513492 struct sock *sk;514514- struct sctp_association *asoc;493493+ struct sctp_association *asoc = NULL;515494 struct sctp_transport *transport;516495 struct inet_sock *inet;517496 char *saveip, *savesctp;···737716738717hit:739718 sctp_endpoint_hold(ep);740740- sock_hold(epb->sk);741719 read_unlock(&head->lock);742720 return ep;743721}···838818hit:839819 *pt = transport;840820 sctp_association_hold(asoc);841841- sock_hold(epb->sk);842821 read_unlock(&head->lock);843822 return asoc;844823}···865846 struct sctp_transport *transport;866847867848 if ((asoc = sctp_lookup_association(laddr, paddr, &transport))) {868868- sock_put(asoc->base.sk);869849 sctp_association_put(asoc);870850 return 1;871851 }
+12-4
net/sctp/sm_sideeffect.c
···498498 sctp_add_cmd_sf(commands, SCTP_CMD_NEW_STATE,499499 SCTP_STATE(SCTP_STATE_CLOSED));500500501501- /* Set sk_err to ECONNRESET on a 1-1 style socket. */502502- if (!sctp_style(asoc->base.sk, UDP))503503- asoc->base.sk->sk_err = ECONNRESET; 504504-505501 /* SEND_FAILED sent later when cleaning up the association. */506502 asoc->outqueue.error = error;507503 sctp_add_cmd_sf(commands, SCTP_CMD_DELETE_TCB, SCTP_NULL());···832836 }833837834838 return;839839+}840840+841841+/* Helper function to set sk_err on a 1-1 style socket. */842842+static void sctp_cmd_set_sk_err(struct sctp_association *asoc, int error)843843+{844844+ struct sock *sk = asoc->base.sk;845845+846846+ if (!sctp_style(sk, UDP))847847+ sk->sk_err = error;835848}836849837850/* These three macros allow us to pull the debugging code out of the···14621457 error = sctp_outq_uncork(&asoc->outqueue);14631458 local_cork = 0;14641459 asoc->peer.retran_path = t;14601460+ break;14611461+ case SCTP_CMD_SET_SK_ERR:14621462+ sctp_cmd_set_sk_err(asoc, cmd->obj.error);14651463 break;14661464 default:14671465 printk(KERN_WARNING "Impossible command: %u, %p\n",
+54-27
net/sctp/sm_statefuns.c
···9393static struct sctp_sackhdr *sctp_sm_pull_sack(struct sctp_chunk *chunk);94949595static sctp_disposition_t sctp_stop_t1_and_abort(sctp_cmd_seq_t *commands,9696- __u16 error,9696+ __u16 error, int sk_err,9797 const struct sctp_association *asoc,9898 struct sctp_transport *transport);9999···448448 __u32 init_tag;449449 struct sctp_chunk *err_chunk;450450 struct sctp_packet *packet;451451- sctp_disposition_t ret;451451+ __u16 error;452452453453 if (!sctp_vtag_verify(chunk, asoc))454454 return sctp_sf_pdiscard(ep, asoc, type, arg, commands);···480480 goto nomem;481481482482 sctp_add_cmd_sf(commands, SCTP_CMD_REPLY, SCTP_CHUNK(reply));483483- sctp_add_cmd_sf(commands, SCTP_CMD_NEW_STATE,484484- SCTP_STATE(SCTP_STATE_CLOSED));485485- SCTP_INC_STATS(SCTP_MIB_ABORTEDS);486486- sctp_add_cmd_sf(commands, SCTP_CMD_DELETE_TCB, SCTP_NULL());487487- return SCTP_DISPOSITION_DELETE_TCB;483483+ return sctp_stop_t1_and_abort(commands, SCTP_ERROR_INV_PARAM,484484+ ECONNREFUSED, asoc,485485+ chunk->transport);488486 }489487490488 /* Verify the INIT chunk before processing it. */···509511 sctp_add_cmd_sf(commands, SCTP_CMD_SEND_PKT,510512 SCTP_PACKET(packet));511513 SCTP_INC_STATS(SCTP_MIB_OUTCTRLCHUNKS);512512- sctp_add_cmd_sf(commands, SCTP_CMD_NEW_STATE,513513- SCTP_STATE(SCTP_STATE_CLOSED));514514- sctp_add_cmd_sf(commands, SCTP_CMD_DELETE_TCB,515515- SCTP_NULL());516516- return SCTP_DISPOSITION_CONSUME;514514+ error = SCTP_ERROR_INV_PARAM;517515 } else {518518- sctp_add_cmd_sf(commands, SCTP_CMD_NEW_STATE,519519- SCTP_STATE(SCTP_STATE_CLOSED));520520- sctp_add_cmd_sf(commands, SCTP_CMD_DELETE_TCB,521521- SCTP_NULL());522522- return SCTP_DISPOSITION_NOMEM;516516+ error = SCTP_ERROR_NO_RESOURCE;523517 }524518 } else {525525- ret = sctp_sf_tabort_8_4_8(ep, asoc, type, arg,526526- commands);527527- sctp_add_cmd_sf(commands, SCTP_CMD_NEW_STATE,528528- SCTP_STATE(SCTP_STATE_CLOSED));529529- sctp_add_cmd_sf(commands, SCTP_CMD_DELETE_TCB,530530- SCTP_NULL());531531- return ret;519519+ sctp_sf_tabort_8_4_8(ep, asoc, type, arg, commands);520520+ error = SCTP_ERROR_INV_PARAM;532521 }522522+ return sctp_stop_t1_and_abort(commands, error, ECONNREFUSED,523523+ asoc, chunk->transport);533524 }534525535526 /* Tag the variable length parameters. Note that we never···873886 struct sctp_transport *transport = (struct sctp_transport *) arg;874887875888 if (asoc->overall_error_count >= asoc->max_retrans) {889889+ sctp_add_cmd_sf(commands, SCTP_CMD_SET_SK_ERR,890890+ SCTP_ERROR(ETIMEDOUT));876891 /* CMD_ASSOC_FAILED calls CMD_DELETE_TCB. */877892 sctp_add_cmd_sf(commands, SCTP_CMD_ASSOC_FAILED,878893 SCTP_U32(SCTP_ERROR_NO_ERROR));···10191030 commands);1020103110211032 hbinfo = (sctp_sender_hb_info_t *) chunk->skb->data;10331033+ /* Make sure that the length of the parameter is what we expect */10341034+ if (ntohs(hbinfo->param_hdr.length) !=10351035+ sizeof(sctp_sender_hb_info_t)) {10361036+ return SCTP_DISPOSITION_DISCARD;10371037+ }10381038+10221039 from_addr = hbinfo->daddr;10231040 link = sctp_assoc_lookup_paddr(asoc, &from_addr);10241041···21212126 int attempts = asoc->init_err_counter + 1;2122212721232128 if (attempts > asoc->max_init_attempts) {21292129+ sctp_add_cmd_sf(commands, SCTP_CMD_SET_SK_ERR,21302130+ SCTP_ERROR(ETIMEDOUT));21242131 sctp_add_cmd_sf(commands, SCTP_CMD_INIT_FAILED,21252132 SCTP_U32(SCTP_ERROR_STALE_COOKIE));21262133 return SCTP_DISPOSITION_DELETE_TCB;···22592262 if (len >= sizeof(struct sctp_chunkhdr) + sizeof(struct sctp_errhdr))22602263 error = ((sctp_errhdr_t *)chunk->skb->data)->cause;2261226422652265+ sctp_add_cmd_sf(commands, SCTP_CMD_SET_SK_ERR, SCTP_ERROR(ECONNRESET));22622266 /* ASSOC_FAILED will DELETE_TCB. */22632267 sctp_add_cmd_sf(commands, SCTP_CMD_ASSOC_FAILED, SCTP_U32(error));22642268 SCTP_INC_STATS(SCTP_MIB_ABORTEDS);···23042306 if (len >= sizeof(struct sctp_chunkhdr) + sizeof(struct sctp_errhdr))23052307 error = ((sctp_errhdr_t *)chunk->skb->data)->cause;2306230823072307- return sctp_stop_t1_and_abort(commands, error, asoc, chunk->transport);23092309+ return sctp_stop_t1_and_abort(commands, error, ECONNREFUSED, asoc,23102310+ chunk->transport);23082311}2309231223102313/*···23172318 void *arg,23182319 sctp_cmd_seq_t *commands)23192320{23202320- return sctp_stop_t1_and_abort(commands, SCTP_ERROR_NO_ERROR, asoc,23212321+ return sctp_stop_t1_and_abort(commands, SCTP_ERROR_NO_ERROR,23222322+ ENOPROTOOPT, asoc,23212323 (struct sctp_transport *)arg);23222324}23232325···23432343 * This is common code called by several sctp_sf_*_abort() functions above.23442344 */23452345static sctp_disposition_t sctp_stop_t1_and_abort(sctp_cmd_seq_t *commands,23462346- __u16 error,23462346+ __u16 error, int sk_err,23472347 const struct sctp_association *asoc,23482348 struct sctp_transport *transport)23492349{···23532353 SCTP_INC_STATS(SCTP_MIB_ABORTEDS);23542354 sctp_add_cmd_sf(commands, SCTP_CMD_TIMER_STOP,23552355 SCTP_TO(SCTP_EVENT_TIMEOUT_T1_INIT));23562356+ sctp_add_cmd_sf(commands, SCTP_CMD_SET_SK_ERR, SCTP_ERROR(sk_err));23562357 /* CMD_INIT_FAILED will DELETE_TCB. */23572358 sctp_add_cmd_sf(commands, SCTP_CMD_INIT_FAILED,23582359 SCTP_U32(error));···33373336 sctp_add_cmd_sf(commands, SCTP_CMD_TIMER_STOP,33383337 SCTP_TO(SCTP_EVENT_TIMEOUT_T4_RTO));33393338 sctp_add_cmd_sf(commands, SCTP_CMD_DISCARD_PACKET,SCTP_NULL());33393339+ sctp_add_cmd_sf(commands, SCTP_CMD_SET_SK_ERR,33403340+ SCTP_ERROR(ECONNABORTED));33403341 sctp_add_cmd_sf(commands, SCTP_CMD_ASSOC_FAILED,33413342 SCTP_U32(SCTP_ERROR_ASCONF_ACK));33423343 SCTP_INC_STATS(SCTP_MIB_ABORTEDS);···33653362 * processing the rest of the chunks in the packet.33663363 */33673364 sctp_add_cmd_sf(commands, SCTP_CMD_DISCARD_PACKET,SCTP_NULL());33653365+ sctp_add_cmd_sf(commands, SCTP_CMD_SET_SK_ERR,33663366+ SCTP_ERROR(ECONNABORTED));33683367 sctp_add_cmd_sf(commands, SCTP_CMD_ASSOC_FAILED,33693368 SCTP_U32(SCTP_ERROR_ASCONF_ACK));33703369 SCTP_INC_STATS(SCTP_MIB_ABORTEDS);···37193714 if (asoc->state <= SCTP_STATE_COOKIE_ECHOED) {37203715 sctp_add_cmd_sf(commands, SCTP_CMD_TIMER_STOP,37213716 SCTP_TO(SCTP_EVENT_TIMEOUT_T1_INIT));37173717+ sctp_add_cmd_sf(commands, SCTP_CMD_SET_SK_ERR,37183718+ SCTP_ERROR(ECONNREFUSED));37223719 sctp_add_cmd_sf(commands, SCTP_CMD_INIT_FAILED,37233720 SCTP_U32(SCTP_ERROR_PROTO_VIOLATION));37243721 } else {37223722+ sctp_add_cmd_sf(commands, SCTP_CMD_SET_SK_ERR,37233723+ SCTP_ERROR(ECONNABORTED));37253724 sctp_add_cmd_sf(commands, SCTP_CMD_ASSOC_FAILED,37263725 SCTP_U32(SCTP_ERROR_PROTO_VIOLATION));37273726 SCTP_DEC_STATS(SCTP_MIB_CURRESTAB);···40434034 * TCB. This is a departure from our typical NOMEM handling.40444035 */4045403640374037+ sctp_add_cmd_sf(commands, SCTP_CMD_SET_SK_ERR,40384038+ SCTP_ERROR(ECONNABORTED));40464039 /* Delete the established association. */40474040 sctp_add_cmd_sf(commands, SCTP_CMD_ASSOC_FAILED,40484041 SCTP_U32(SCTP_ERROR_USER_ABORT));···41864175 * TCB. This is a departure from our typical NOMEM handling.41874176 */4188417741784178+ sctp_add_cmd_sf(commands, SCTP_CMD_SET_SK_ERR,41794179+ SCTP_ERROR(ECONNREFUSED));41894180 /* Delete the established association. */41904181 sctp_add_cmd_sf(commands, SCTP_CMD_INIT_FAILED,41914182 SCTP_U32(SCTP_ERROR_USER_ABORT));···45564543 struct sctp_transport *transport = arg;4557454445584545 if (asoc->overall_error_count >= asoc->max_retrans) {45464546+ sctp_add_cmd_sf(commands, SCTP_CMD_SET_SK_ERR,45474547+ SCTP_ERROR(ETIMEDOUT));45594548 /* CMD_ASSOC_FAILED calls CMD_DELETE_TCB. */45604549 sctp_add_cmd_sf(commands, SCTP_CMD_ASSOC_FAILED,45614550 SCTP_U32(SCTP_ERROR_NO_ERROR));···46774662 SCTP_DEBUG_PRINTK("Giving up on INIT, attempts: %d"46784663 " max_init_attempts: %d\n",46794664 attempts, asoc->max_init_attempts);46654665+ sctp_add_cmd_sf(commands, SCTP_CMD_SET_SK_ERR,46664666+ SCTP_ERROR(ETIMEDOUT));46804667 sctp_add_cmd_sf(commands, SCTP_CMD_INIT_FAILED,46814668 SCTP_U32(SCTP_ERROR_NO_ERROR));46824669 return SCTP_DISPOSITION_DELETE_TCB;···4728471147294712 sctp_add_cmd_sf(commands, SCTP_CMD_REPLY, SCTP_CHUNK(repl));47304713 } else {47144714+ sctp_add_cmd_sf(commands, SCTP_CMD_SET_SK_ERR,47154715+ SCTP_ERROR(ETIMEDOUT));47314716 sctp_add_cmd_sf(commands, SCTP_CMD_INIT_FAILED,47324717 SCTP_U32(SCTP_ERROR_NO_ERROR));47334718 return SCTP_DISPOSITION_DELETE_TCB;···4761474247624743 SCTP_DEBUG_PRINTK("Timer T2 expired.\n");47634744 if (asoc->overall_error_count >= asoc->max_retrans) {47454745+ sctp_add_cmd_sf(commands, SCTP_CMD_SET_SK_ERR,47464746+ SCTP_ERROR(ETIMEDOUT));47644747 /* Note: CMD_ASSOC_FAILED calls CMD_DELETE_TCB. */47654748 sctp_add_cmd_sf(commands, SCTP_CMD_ASSOC_FAILED,47664749 SCTP_U32(SCTP_ERROR_NO_ERROR));···48384817 if (asoc->overall_error_count >= asoc->max_retrans) {48394818 sctp_add_cmd_sf(commands, SCTP_CMD_TIMER_STOP,48404819 SCTP_TO(SCTP_EVENT_TIMEOUT_T4_RTO));48204820+ sctp_add_cmd_sf(commands, SCTP_CMD_SET_SK_ERR,48214821+ SCTP_ERROR(ETIMEDOUT));48414822 sctp_add_cmd_sf(commands, SCTP_CMD_ASSOC_FAILED,48424823 SCTP_U32(SCTP_ERROR_NO_ERROR));48434824 SCTP_INC_STATS(SCTP_MIB_ABORTEDS);···48934870 goto nomem;4894487148954872 sctp_add_cmd_sf(commands, SCTP_CMD_REPLY, SCTP_CHUNK(reply));48734873+ sctp_add_cmd_sf(commands, SCTP_CMD_SET_SK_ERR,48744874+ SCTP_ERROR(ETIMEDOUT));48964875 sctp_add_cmd_sf(commands, SCTP_CMD_ASSOC_FAILED,48974876 SCTP_U32(SCTP_ERROR_NO_ERROR));48984877···53345309 * processing the rest of the chunks in the packet.53355310 */53365311 sctp_add_cmd_sf(commands, SCTP_CMD_DISCARD_PACKET,SCTP_NULL());53125312+ sctp_add_cmd_sf(commands, SCTP_CMD_SET_SK_ERR,53135313+ SCTP_ERROR(ECONNABORTED));53375314 sctp_add_cmd_sf(commands, SCTP_CMD_ASSOC_FAILED,53385315 SCTP_U32(SCTP_ERROR_NO_DATA));53395316 SCTP_INC_STATS(SCTP_MIB_ABORTEDS);
+17-12
net/sctp/socket.c
···10571057 inet_sk(sk)->dport = htons(asoc->peer.port);10581058 af = sctp_get_af_specific(to.sa.sa_family);10591059 af->to_sk_daddr(&to, sk);10601060+ sk->sk_err = 0;1060106110611062 timeo = sock_sndtimeo(sk, sk->sk_socket->file->f_flags & O_NONBLOCK);10621063 err = sctp_wait_for_connect(asoc, &timeo);···1229122812301229 ep = sctp_sk(sk)->ep;1231123012321232- /* Walk all associations on a socket, not on an endpoint. */12311231+ /* Walk all associations on an endpoint. */12331232 list_for_each_safe(pos, temp, &ep->asocs) {12341233 asoc = list_entry(pos, struct sctp_association, asocs);12351234···12421241 if (sctp_state(asoc, CLOSED)) {12431242 sctp_unhash_established(asoc);12441243 sctp_association_free(asoc);12441244+ continue;12451245+ }12461246+ }1245124712461246- } else if (sock_flag(sk, SOCK_LINGER) &&12471247- !sk->sk_lingertime)12481248- sctp_primitive_ABORT(asoc, NULL);12491249- else12501250- sctp_primitive_SHUTDOWN(asoc, NULL);12511251- } else12481248+ if (sock_flag(sk, SOCK_LINGER) && !sk->sk_lingertime)12491249+ sctp_primitive_ABORT(asoc, NULL);12501250+ else12521251 sctp_primitive_SHUTDOWN(asoc, NULL);12531252 }12541253···53185317 */53195318 sctp_release_sock(sk);53205319 current_timeo = schedule_timeout(current_timeo);53205320+ BUG_ON(sk != asoc->base.sk);53215321 sctp_lock_sock(sk);5322532253235323 *timeo_p = current_timeo;···56065604 */56075605 newsp->type = type;5608560656095609- spin_lock_bh(&oldsk->sk_lock.slock);56105610- /* Migrate the backlog from oldsk to newsk. */56115611- sctp_backlog_migrate(assoc, oldsk, newsk);56125612- /* Migrate the association to the new socket. */56075607+ /* Mark the new socket "in-use" by the user so that any packets56085608+ * that may arrive on the association after we've moved it are56095609+ * queued to the backlog. This prevents a potential race between56105610+ * backlog processing on the old socket and new-packet processing56115611+ * on the new socket.56125612+ */56135613+ sctp_lock_sock(newsk);56135614 sctp_assoc_migrate(assoc, newsk);56145614- spin_unlock_bh(&oldsk->sk_lock.slock);5615561556165616 /* If the association on the newsk is already closed before accept()56175617 * is called, set RCV_SHUTDOWN flag.···56225618 newsk->sk_shutdown |= RCV_SHUTDOWN;5623561956245620 newsk->sk_state = SCTP_SS_ESTABLISHED;56215621+ sctp_release_sock(newsk);56255622}5626562356275624/* This proto struct describes the ULP interface for SCTP. */
···20262026 if (irq > 0)20272027 {20282028 devc->dev_no = my_dev;20292029- if (request_irq(devc->irq, adintr, 0, devc->name, (void *)my_dev) < 0)20292029+ if (request_irq(devc->irq, adintr, 0, devc->name,20302030+ (void *)(long)my_dev) < 0)20302031 {20312032 printk(KERN_WARNING "ad1848: Unable to allocate IRQ\n");20322033 /* Don't free it either then.. */···21762175 if (!share_dma)21772176 {21782177 if (devc->irq > 0) /* There is no point in freeing irq, if it wasn't allocated */21792179- free_irq(devc->irq, (void *)devc->dev_no);21782178+ free_irq(devc->irq, (void *)(long)devc->dev_no);2180217921812180 sound_free_dma(dma_playback);21822181···22052204 unsigned char c930_stat = 0;22062205 int cnt = 0;2207220622082208- dev = (int)dev_id;22072207+ dev = (long)dev_id;22092208 devc = (ad1848_info *) audio_devs[dev]->devc;2210220922112210interrupt_again: /* Jump back here if int status doesn't reset */···29012900 return(dev);29022901}2903290229042904-static struct pnp_dev *ad1848_init_generic(struct pnp_card *bus, struct address_info *hw_config, int slot)29032903+static struct pnp_dev __init *ad1848_init_generic(struct pnp_card *bus,29042904+ struct address_info *hw_config, int slot)29052905{2906290629072907 /* Configure Audio device */
+3-3
sound/oss/nm256_audio.c
···960960961961962962/* Installs the AC97 mixer into CARD. */963963-static int __init963963+static int __devinit964964nm256_install_mixer (struct nm256_info *card)965965{966966 int mixer;···995995 * RAM.996996 */997997998998-static void __init998998+static void __devinit999999nm256_peek_for_sig (struct nm256_info *card)10001000{10011001 u32 port1offset ···10561056 card->playing = 0;10571057 card->recording = 0;10581058 card->rev = rev;10591059- spin_lock_init(&card->lock);10591059+ spin_lock_init(&card->lock);1060106010611061 /* Init the memory port info. */10621062 for (x = 0; x < 2; x++) {